-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Julien Danjou wrote:
> At 1245756208 time_t, Uli Schlachter wrote:
>> +    size = width * height;
> 
> Seems unused.

Seems you are right.
http://git.znc.in/?p=psychon/awesome.git;a=commitdiff;h=56d73102ea8995c911664f0203f77f7a3dc0767d

>> +static void
>> +do_update_shape(xcb_window_t win, xcb_shape_kind_t kind, image_t *image, 
>> int offset)
>> +{
>> +    xcb_pixmap_t shape;
>> +
>> +    if(!image)
>> +    {
>> +        /* Reset the shape */
>> +        shape = XCB_NONE;
>> +    } else {
> 
> No bracket on one line please :)
> And I prefer if(image) when possible, it's just simpler.

Hm, so many different projects with so many different coding styles...
http://git.znc.in/?p=psychon/awesome.git;a=commitdiff;h=b8fe16f7153b645e0c1f22fcb5c0dcfc45454919

>> +        shape = image_to_1bit_pixmap(image, win);
>> +    }
>> +
>> +    xcb_shape_mask(globalconf.connection, XCB_SHAPE_SO_SET, kind,
>> +            win, offset, offset, shape);
> 
> Bad indentation.
> (Yeah, I am annoying.)

Nope, you aren't. Only three style comments, that's nothing. ;)
http://git.znc.in/?p=psychon/awesome.git;a=commitdiff;h=630019c51f846aaa5d6ad71162d9baa68d1fd100

>> +local function do_rounded_corners(width, height, corner)
>> +    local img = image.argb32(width, height, nil)
>> +
>> +    -- Completly transparent
>> +    img:draw_rectangle(0, 0, width, height, true, "#ffffff")
>> +
>> +    -- [[ This is the "layout" of the wibox:
>> +    --    ----------------------
>> +    --   /|                    |\
>> +    --  /4|         1          |5\
>> +    -- |--------------------------|
>> +    -- |            2             |
>> +    -- |--------------------------|
>> +    --  \6|         3          |7/
>> +    --   \|                    |/
>> +    --    ----------------------
>> +    -- ]]
>> +
>> +    -- Show the "content" of the wibox
>> +    -- 1
>> +    img:draw_rectangle(corner, 0, width - corner * 2, corner, true, 
>> "#000000")
>> +    -- 2
>> +    img:draw_rectangle(0, corner, width, height - corner * 2, true, 
>> "#000000")
>> +    -- 3
>> +    img:draw_rectangle(corner, height - corner, width - corner * 2, corner, 
>> true, "#000000")
>> +
>> +    -- These are the 'real' rounded corners
>> +    -- 4
>> +    img:draw_circle(corner, corner, corner, corner, true, "#000000")
>> +    -- 5
>> +    img:draw_circle(width - 1 - corner, corner, corner, corner, true, 
>> "#000000")
>> +    -- 6
>> +    img:draw_circle(corner, height - 1 - corner, corner, corner, true, 
>> "#000000")
>> +    -- 7
>> +    img:draw_circle(width - 1 - corner, height - 1 - corner, corner, 
>> corner, true, "#000000")
>> +
>> +    return img
>> +end
> 
> I find this really really... nice. :)
> Why don't you draw the opposite, i.e. simply the part you want to
> remove?

Uhm, how would I do that? I would need to do some evil math with cos and sin for
this and then loop through the single pixels...
(untested code, just now written. cos is the cosine and arcsin is the arcsine,
arguments to them are in degrees. No idea if I got the math right or if lua got
the necessary functions.)

 for i=0, corner_size do
      local w = cos(arcsin(i/corner_size*90°))
      for x=0, w do
          <set pixel (i, w) to transparent)
      end
 end

Would you prefer something like this? (I bet this would make this faster, but no
idea if this is easier...)

> Otherwise, the code seems quite clean and clear, I just do not know
> anything about XShape so I can't really judge.
> I still wonder what is cliping and bounding... ? :)

Heh, second try:
If you just want an arbitrary shaped window, set the bounding shape and be done.
If you want a shaped window with a border, the clipping shape is the content
area and the bounding shape the border area and the content area together.

If this still doesn't make this clear, I'll have to start doing some screenshots
with examples which I could then add to the wiki as a start of documenting this.

Cheers,
Uli
- --
"Do you know that books smell like nutmeg or some spice from a foreign land?"
                                                  -- Faber in Fahrenheit 451
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iQEcBAEBCAAGBQJKQNGUAAoJECLkKOvLj8sGMgYIAInH4JXAXunVT2f95qTqeVo0
q4xlXvCehqHX8PIvzNaLDJvTsN5P9sjQg88yVAY5ZUsFK2DzVrCSRetTy/ugRDCF
U4rdO+tlGwspgo4dWbvvSG08gx/qXgVkKgfTAxkTiU3LScbLgLkUumV92cE0YWCZ
c5aGNS+wDXlqn9197g0MdTdZBd76dzYPV/8IhdA3MNocaSJbcOzTqCADpxnQqjlA
LSU5ArzZbR0mr+LlCUUaMFUKEZKdAMwADT7NdqsI7L1jBwoHv+IcV4BeMdAaELgc
pwSpTd/Z+5OTjymCCZ8Ysp3K5ljUWHG5vNW5VJcVTSVv0o8i9yeaBFSufCVfy1I=
=c0am
-----END PGP SIGNATURE-----

-- 
To unsubscribe, send mail to [email protected].

Reply via email to