At 1245756208 time_t, Uli Schlachter wrote: > + size = width * height;
Seems unused. > +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. > + 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.) > +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? 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... ? :) Cheers, -- Julien Danjou // ᐰ <jul...@danjou.info> http://julien.danjou.info // 9A0D 5FD9 EB42 22F6 8974 C95C A462 B51E C2FE E5CD // Don't give up.
signature.asc
Description: Digital signature