luaA_object_ref_item doesn't check the type of object it returns which resulted
in stuff like this:
wibox.shape_clip = wibox
wibox.shape_bounding = wibox
imagebox.image = imagebox
textbox.bg_image = textbox
All of the above calls would result in a crash (unverified) and all of them
where fixed.
This should fix all places which use luaA_object_ref_item(). The others already
did a proper type check.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
We use lua_class_t pointer as key in the registry to store metatable we
will compare.
lauxlib uses a string, which sucks, because it forces to do a
pushliteral() each time you want to get a metatable from the registry,
which is slower.
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit adds a function called extents() to widgets. In the case of
a systray, it takes the systray's screen as its argument to correctly
calculate the width. By default, 1 is assumed. For all other widgets,
the argument can be ommitted.
The function doesn't return the geometry as drawn, instead it returns
the geometry the widget _wants_ to be drawn at, for example an imagebox
always has (image width, image height) as the return values even if it's
drawn with a smaller width and height on a smaller wibox.
Signed-off-by: Gregor Best <farhaven@googlemail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
In each widget's *_geometry function, two warnings were generated, e.g.:
warning: ‘geometry.y’ is used uninitialized in this function
warning: ‘geometry.x’ is used uninitialized in this function
Found by gogonkt with GCC 4.2.4 on gentoo.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Pretty much every single source file needs this struct, so it makes sense to
define it in a common header instead of in every single .c file.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>