[PATCH] Fix awful.client is_in_direction and calculate_distance
Both were expecting a client, but are actually passed a geometry. Signed-off-by: Andreas Hübner an...@gmx.de --- lib/awful/client.lua.in | 21 - 1 files changed, 8 insertions(+), 13 deletions(-) diff --git a/lib/awful/client.lua.in b/lib/awful/client.lua.in index bfd361f..47c0d40 100644 --- a/lib/awful/client.lua.in +++ b/lib/awful/client.lua.in @@ -236,15 +236,13 @@ function next(i, c) end end --- Return true whether client B is in the right direction --- compared to client A. +-- Return true whether geometry B is in the right direction +-- compared to geometry A. -- @param dir The direction. --- @param cA The first client. --- @param cB The second client. +-- @param gA The first geometry. +-- @param gB The second geometry. -- @return True if B is in the direction of A. -local function is_in_direction(dir, cA, cB) -local gA = cA:geometry() -local gB = cB:geometry() +local function is_in_direction(dir, gA, gB) if dir == up then return gA.y gB.y elseif dir == down then @@ -263,13 +261,10 @@ end -- This avoid the focus of an upper client when you move to the right in a -- tilebottom layout with nmaster=2 and 5 clients open, for instance. -- @param dir The direction. --- @param cA The first client. --- @param cB The second client. +-- @param cA The first geometry. +-- @param cB The second geometry. -- @return The distance between the clients. -local function calculate_distance(dir, cA, cB) -local gA = cA:geometry() -local gB = cB:geometry() - +local function calculate_distance(dir, gA, gB) if dir == up then gB.y = gB.y + gB.height elseif dir == down then -- 1.6.3.3 -- To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.
[PATCH] tag.lua: fix new client screen
From: Sébastien Gross seb•ɑƬ•chezwam•ɖɵʈ•org Prevent from blinking the first screen in multiheads by using the mouse-focused screen tag list for a new client instead of screen 1. Signed-off-by: Sébastien Gross seb•ɑƬ•chezwam•ɖɵʈ•org --- lib/awful/tag.lua.in |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/awful/tag.lua.in b/lib/awful/tag.lua.in index 0096194..b23310b 100644 --- a/lib/awful/tag.lua.in +++ b/lib/awful/tag.lua.in @@ -316,7 +316,7 @@ function withcurrent(c, startup) c:tags(c.transient_for:tags()) end if #c:tags() == 0 then -c:tags(selectedlist(c.screen)) +c:tags(selectedlist(capi.mouse.screen)) end end end -- 1.5.6.5 -- To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.
[Patch] Fix crash bugs due to missing type checks
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Hi, this fixes some lua-triggerable crashes that happened because e.g. a client_t* was interpreted as a wibox_t*. Commit messages explain more. @jd: No idea if a) my fixes are correct (more testing needed, I only tested some stuff). b) I covered all the necessary places (I just grepped for luaA_object_ref). c) when I started this list I had three bullet points in mind, but I can't remember the third one. :/ 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) iQEcBAEBCAAGBQJKoPE0AAoJECLkKOvLj8sGQpwH/31zNkiEDB27eDD3L0lyqHE8 CLS15fOEEdSuhb3/JifgsPJ5gmipLeo0U71i+2MJgGuYJKXrw8zNC9l/EN6+9ybW /elfPS14zwg0eriJQwqYyyQNHWmUFEkkAukI2OFfOUdXhvoL3sfKoz2qoqLXnrCJ H25Ubr8TAWUXa9MhJFQaztl5oFSusOPL0COOtEiHNc1AMbQ88beUryzq3Nyg8Ktr bPswWvqvf7PixhFgq+aDcPrwTUVHWTKSBEgEKNLBBXBZ7arBhgDQiMEQtnom+R4k DS0c7PVRqYr40/WgAa7Ln0GGEL7o0HgCgsUc8l//ZwFMa1gyJJFOh4ZjxFiJuZE= =thr2 -END PGP SIGNATURE- From 4ab243d887d764e5632b344dfa85735a631df4b5 Mon Sep 17 00:00:00 2001 From: Uli Schlachter psyc...@znc.in Date: Fri, 4 Sep 2009 12:38:06 +0200 Subject: [PATCH 1/2] Add some missing luaA_checkudata() calls 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 psyc...@znc.in --- wibox.c|2 ++ widgets/imagebox.c |1 + widgets/textbox.c |1 + 3 files changed, 4 insertions(+), 0 deletions(-) diff --git a/wibox.c b/wibox.c index a6e9610..3c51f66 100644 --- a/wibox.c +++ b/wibox.c @@ -1463,6 +1463,7 @@ luaA_wibox_set_border_width(lua_State *L, wibox_t *wibox) static int luaA_wibox_set_shape_bounding(lua_State *L, wibox_t *wibox) { +luaA_checkudata(L, -1, image_class); luaA_object_unref_item(L, -3, wibox-shape.bounding); wibox-shape.bounding = luaA_object_ref_item(L, -3, -1); wibox-need_shape_update = true; @@ -1479,6 +1480,7 @@ luaA_wibox_get_shape_bounding(lua_State *L, wibox_t *wibox) static int luaA_wibox_set_shape_clip(lua_State *L, wibox_t *wibox) { +luaA_checkudata(L, -1, image_class); luaA_object_unref_item(L, -3, wibox-shape.clip); wibox-shape.clip = luaA_object_ref_item(L, -3, -1); wibox-need_shape_update = true; diff --git a/widgets/imagebox.c b/widgets/imagebox.c index b913282..45a5dad 100644 --- a/widgets/imagebox.c +++ b/widgets/imagebox.c @@ -133,6 +133,7 @@ luaA_imagebox_newindex(lua_State *L, awesome_token_t token) size_t len; case A_TK_IMAGE: +luaA_checkudata(L, 1, image_class); luaA_object_unref_item(L, 1, d-image); d-image = luaA_object_ref_item(L, 1, 3); break; diff --git a/widgets/textbox.c b/widgets/textbox.c index 42a0454..598572c 100644 --- a/widgets/textbox.c +++ b/widgets/textbox.c @@ -346,6 +346,7 @@ luaA_textbox_newindex(lua_State *L, awesome_token_t token) d-bg_resize = luaA_checkboolean(L, 3); break; case A_TK_BG_IMAGE: +luaA_checkudata(L, 1, image_class); luaA_object_unref_item(L, 1, d-bg_image); d-bg_image = luaA_object_ref_item(L, 1, 3); break; -- 1.6.3.3 From d93ab48fed5898fd72153e7c3c2d1f8a21b95bc2 Mon Sep 17 00:00:00 2001 From: Uli Schlachter psyc...@znc.in Date: Fri, 4 Sep 2009 12:46:20 +0200 Subject: [PATCH 2/2] Add some missing class type checks Some functions didn't check the class of objects they were passed but just casted them to the type they expected. This lead to code like e.g. the following to crash awesome: c.titlebar = c This adds a new function luaA_object_ref_class() which works like luaA_object_ref(), but which also checks the class of the object. Additionally, this function is now used in all necessary places. Signed-off-by: Uli Schlachter psyc...@znc.in --- common/luaobject.h | 14 ++ root.c |2 +- tag.c |4 ++-- titlebar.c |2 +- wibox.c|2 +- 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/common/luaobject.h b/common/luaobject.h index 19aca17..056368b 100644 --- a/common/luaobject.h +++ b/common/luaobject.h @@ -106,6 +106,20 @@ luaA_object_ref(lua_State *L, int oud) return p; } +/** Reference an object and return a pointer to it checking its type. + * That only works with userdata. + * \param L The Lua VM state. + * \param oud The object index on the stack. + * \param class The class of object expected + * \return The object reference, or NULL if not referenceable. + */ +static inline void *
Re: tab and tablist widget
At 1252020371 time_t, Cedric GESTES wrote: what do you think about that? I think it's definitively the way to go. -- Julien Danjou // ᐰ jul...@danjou.info http://julien.danjou.info // 9A0D 5FD9 EB42 22F6 8974 C95C A462 B51E C2FE E5CD // This is the end of my signature. signature.asc Description: Digital signature
Re: [PATCH] client: Fix get_client_in_direction
At 1251985082 time_t, Sébastien Gross wrote: Both is_in_direction() and calculate_distance() expect clients instead of geometries. Thanks Seb, pushed. ;) Cheers, -- Julien Danjou // ᐰ jul...@danjou.info http://julien.danjou.info // 9A0D 5FD9 EB42 22F6 8974 C95C A462 B51E C2FE E5CD // There is nothing under this line. signature.asc Description: Digital signature
Re: [PATCH] small fix for floating
At 1252007132 time_t, Cedric GESTES wrote: dont set the geometry of a floating windows when the geometry is empty What's the point of this patch? It should not change anything AFAICT. -- Julien Danjou // ᐰ jul...@danjou.info http://julien.danjou.info // 9A0D 5FD9 EB42 22F6 8974 C95C A462 B51E C2FE E5CD // Trust no one. signature.asc Description: Digital signature
Re: [PATCH] Fix awful.client is_in_direction and calculate_distance
At 1252052734 time_t, Andreas Hübner wrote: Both were expecting a client, but are actually passed a geometry. While this patch is good, I've applied the one Sebastien Gross sent ealier, which was simpler. :) Anyway, thanks much for your contribution! Cheers, -- Julien Danjou // ᐰ jul...@danjou.info http://julien.danjou.info // 9A0D 5FD9 EB42 22F6 8974 C95C A462 B51E C2FE E5CD // In the Sixth Sense, Bruce Willis is dead. signature.asc Description: Digital signature
Re: [PATCH] small fix for floating
it allow the following without failling: -- force client on tag 5 to be floating and ontop client.add_signal(new, function (c) c:add_signal(tagged, function(c, t) if t == tags[1][5] then c.ontop = true --yeah crappy but need to be set before floating --awful.client.property.set(c, floating_geometry, c:geometry()) awful.client.floating.set(c, true) end end) end) On Fri, Sep 4, 2009 at 1:34 PM, Julien Danjoujul...@danjou.info wrote: At 1252007132 time_t, Cedric GESTES wrote: dont set the geometry of a floating windows when the geometry is empty What's the point of this patch? It should not change anything AFAICT. -- Julien Danjou // ᐰ jul...@danjou.info http://julien.danjou.info // 9A0D 5FD9 EB42 22F6 8974 C95C A462 B51E C2FE E5CD // Trust no one. -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkqg+zkACgkQpGK1HsL+5c2suwCgsSFoucwpuhCtc8gFPTtNzl/Z Y2oAn2Kp1DUTTNMzORvE9NBB1+jAXAwC =r/36 -END PGP SIGNATURE- -- To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.
Re: [PATCH] small fix for floating
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Cedric GESTES wrote: -c:geometry(property.get(c, floating_geometry)) +local geo = property.get(c, floating_geometry) +if geo ~= nil then +geo = c:geometry() +end Did you mean this? local geo = property.get(c, floating_geometry) if geo ~= nil then c:geometry(geo) end (c:geometry(nil) could trigger the luaA_istable() check in client.c, can nil do that? Does it count as a real argument?) - -- 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) iQEcBAEBCAAGBQJKoPxrAAoJECLkKOvLj8sGbGYIAI5hj6tqtBqmDY0cGT8K9CQN 7FLAIdPMYb29IYKW/mj8t0OjPcLrAneya2Ym7kRpI2nkiDbv7znkMxIST0O9mPan Ecb3iEiVm4SteaURNDug4v8FAAgTVk3+kgwqEUwZMeVDWOmvYFC6ke/3RH07iWzc IUh2b/i/3HIaUZi4bPCoaqCiUq/EJesKtfVBJnM7s6tnHlSb5Zfh5/Hrh71NLGl2 9QLGqsQCkXgoq8KOT0VidPmHtP+DR9ZEXz75dax9BoHVNFjOUwna4szu5ojF4PB6 a+ISwDcOSXslxQE8cbFVF11jv7gWr5IqN6U2IrGOMgpDEM87xMEdmmtC8FbPYUo= =yGTd -END PGP SIGNATURE- -- To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.
Re: [PATCH] small fix for floating
yeah: c:geometry(nil) : W: awesome: luaA_dofunction:108: error while running function stack traceback: [C]: in function 'geometry' [string c:geometry(42)]:1: in function 'f' /usr/share/awesome/lib/awful/remote.lua:25: in function /usr/share/awesome/lib/awful/remote.lua:21 error: [string c:geometry(42)]:1: bad argument #1 to 'geometry' (table expected, got number) W: awesome: luaA_dofunction:108: error while running function A better solution is to check for nil in geometry? On Fri, Sep 4, 2009 at 1:39 PM, Uli Schlachterpsyc...@znc.in wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Cedric GESTES wrote: - c:geometry(property.get(c, floating_geometry)) + local geo = property.get(c, floating_geometry) + if geo ~= nil then + geo = c:geometry() + end Did you mean this? local geo = property.get(c, floating_geometry) if geo ~= nil then c:geometry(geo) end (c:geometry(nil) could trigger the luaA_istable() check in client.c, can nil do that? Does it count as a real argument?) - -- 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) iQEcBAEBCAAGBQJKoPxrAAoJECLkKOvLj8sGbGYIAI5hj6tqtBqmDY0cGT8K9CQN 7FLAIdPMYb29IYKW/mj8t0OjPcLrAneya2Ym7kRpI2nkiDbv7znkMxIST0O9mPan Ecb3iEiVm4SteaURNDug4v8FAAgTVk3+kgwqEUwZMeVDWOmvYFC6ke/3RH07iWzc IUh2b/i/3HIaUZi4bPCoaqCiUq/EJesKtfVBJnM7s6tnHlSb5Zfh5/Hrh71NLGl2 9QLGqsQCkXgoq8KOT0VidPmHtP+DR9ZEXz75dax9BoHVNFjOUwna4szu5ojF4PB6 a+ISwDcOSXslxQE8cbFVF11jv7gWr5IqN6U2IrGOMgpDEM87xMEdmmtC8FbPYUo= =yGTd -END PGP SIGNATURE- -- To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.
Re: [PATCH] small fix for floating
At 1252064589 time_t, Cedric GESTES wrote: A better solution is to check for nil in geometry? Yes. -- Julien Danjou // ᐰ jul...@danjou.info http://julien.danjou.info // 9A0D 5FD9 EB42 22F6 8974 C95C A462 B51E C2FE E5CD // Anna Molly! Anna Molly! Anna Molly! signature.asc Description: Digital signature
Re: [Patch] Fix crash bugs due to missing type checks
At 1252061493 time_t, Uli Schlachter wrote: No idea if a) my fixes are correct (more testing needed, I only tested some stuff). They seems to be. b) I covered all the necessary places (I just grepped for luaA_object_ref). That should do it. Thanks for that. Pushed, of course. Cheers, -- Julien Danjou // ᐰ jul...@danjou.info http://julien.danjou.info // 9A0D 5FD9 EB42 22F6 8974 C95C A462 B51E C2FE E5CD // The more we fly, the more we climb, the more we know that heaven is a lie. signature.asc Description: Digital signature
[PATCH] fix titlebar
sorry, fix a bug introduced with the customwidget. From a7848134a7f5fe945796f35ec497aedfe9070a98 Mon Sep 17 00:00:00 2001 From: Cedric GESTES cta...@gmail.com Date: Fri, 4 Sep 2009 14:39:53 +0200 Subject: [PATCH] titlebar: fix title and appicon position in the layout Signed-off-by: Cedric GESTES cta...@gmail.com --- lib/awful/titlebar.lua.in |8 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/awful/titlebar.lua.in b/lib/awful/titlebar.lua.in index 0a6f289..674c843 100644 --- a/lib/awful/titlebar.lua.in +++ b/lib/awful/titlebar.lua.in @@ -143,12 +143,12 @@ end function update(c) if c.titlebar and data[c] then local widgets = c.titlebar.widgets -if widgets[2].title then -widgets[2].title.text = span font_desc=' .. data[c].font .. +if widgets[3].title then +widgets[3].title.text = span font_desc=' .. data[c].font .. ' .. util.escape(c.name) .. /span end -if widgets[2].appicon then -widgets[2].appicon.image = c.icon +if widgets[3].appicon then +widgets[3].appicon.image = c.icon end if capi.client.focus == c then c.titlebar.fg = data[c].fg_focus -- 1.6.0.4
[Patch] Some fixes to awesome_atexit()
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Hi, First patch fixes some valgrind invalid access errors and second one fixes a valgrind leaked fd warning (libev leaked its epoll and signalfd file descriptors). 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) iQEcBAEBCAAGBQJKoRMQAAoJECLkKOvLj8sGKKcH/R5ad6q+GO5bcIju+S9RVXq0 sH2FfdTaxVdhHNfACAXkrz2ScOmhQgY0ucToz2IbODBWsPkBsGQphlhnmXpZ1BfA Bb3576DkNVXSG7uleQs+g7u2yDu6KoL3Srcb9gVffR0QfZStg6cctypHe61Eb0+j a/cHUkTPsHiNcbth7xeva5deBZLV7adbjCwQigfS/l5p4b4kVjgL6WWJmzUiJ/Ej 5JO4cEdTTDuZydbOWsRbOJE/GlhTxcykeUJyfAb2czlyd3Qgk8AMh9xCeXWA2p0+ WSP8pbVb5En3bjH5vAL1dpSdFuKqXfXJZ5U59eK7yqM58j+D8AIjGM0SLZaZIQk= =iYb8 -END PGP SIGNATURE- From 4be181e5ebbcd4ede6dc2464e677b3387b5c5513 Mon Sep 17 00:00:00 2001 From: Uli Schlachter psyc...@znc.in Date: Fri, 4 Sep 2009 15:10:56 +0200 Subject: [PATCH 1/2] Disconnect from the X server after closing lua Else stuff like this can happen: Invalid read of size 4: at 0x300280BB7F: (within /usr/lib/libxcb.so.1.1.0) by 0x300280BD21: xcb_get_extension_data (in /usr/lib/libxcb.so.1.1.0) by 0x300280A55A: xcb_send_request (in /usr/lib/libxcb.so.1.1.0) by 0x300C604A4F: xcb_render_free_picture (in /usr/lib/libxcb-render.so.0.0.0) by 0x300B24C4BB: (within /usr/lib/libcairo.so.2.10800.8) by 0x300B22F1B6: cairo_surface_finish (in /usr/lib/libcairo.so.2.10800.8) by 0x300B22F234: cairo_surface_destroy (in /usr/lib/libcairo.so.2.10800.8) by 0x300B218124: (within /usr/lib/libcairo.so.2.10800.8) by 0x300B212750: cairo_destroy (in /usr/lib/libcairo.so.2.10800.8) by 0x42E4D0: wibox_wipe (draw.h:110) by 0x42E568: luaA_wibox_gc (wibox.c:46) by 0x3008E0CB15: (within /usr/lib/liblua5.1.so.0.0.0) Address 0x4e56ec0 is 20,928 bytes inside a block of size 20,992 free'd at 0x4A0761F: free (vg_replace_malloc.c:323) by 0x40F974: awesome_atexit (awesome.c:97) by 0x410316: main (awesome.c:577) Signed-off-by: Uli Schlachter psyc...@znc.in --- awesome.c |7 --- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/awesome.c b/awesome.c index 157880d..37684a7 100644 --- a/awesome.c +++ b/awesome.c @@ -92,12 +92,13 @@ awesome_atexit(void) titlebar_client_detach(*c); } +/* Close Lua */ +lua_close(globalconf.L); + xcb_flush(globalconf.connection); +/* Disconnect *after* closing lua */ xcb_disconnect(globalconf.connection); - -/* Close Lua */ -lua_close(globalconf.L); } /** Scan X to find windows to manage. -- 1.6.3.3 From d12296ee229a675d49e67e105a5806cd0003c961 Mon Sep 17 00:00:00 2001 From: Uli Schlachter psyc...@znc.in Date: Fri, 4 Sep 2009 15:14:07 +0200 Subject: [PATCH 2/2] awesome_atexit(): Clean up libev's state Signed-off-by: Uli Schlachter psyc...@znc.in --- awesome.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/awesome.c b/awesome.c index 37684a7..60da046 100644 --- a/awesome.c +++ b/awesome.c @@ -99,6 +99,8 @@ awesome_atexit(void) /* Disconnect *after* closing lua */ xcb_disconnect(globalconf.connection); + +ev_default_destroy(); } /** Scan X to find windows to manage. -- 1.6.3.3
float and ontop windows can’t get focus
Hello, I put this rule in my rc.lua : { rule = { class = MPlayer }, properties = { ontop = true, floating = true } }, As expected, my mplayer became on top and floating (but on the other screen than the expected one). I can move it (and during the moving, the window is resized o_O) and resize it but all the other keystroke are catch by the windows under the floating one. Since I’m not sure about the syntaxe, I don’t report a bug… but if it’s the case, I can do it (with this same awfull english, yes…) Speaking about « on top » Is it a bad idear to put a default binding for « on top » in the default rc.lua ? Regards, Olivier. -- [Message tapé sur un clavier Bépo : http://www.bepo.fr ] http://soubresauts.net -- To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.
Re: [Patch] Remove the new signal
At 1252072837 time_t, Uli Schlachter wrote: Judging from my patch I think that atm there isn't anything which needs these dangerous early signals. :/ And when we'll need them we will go back where we are now? Running away is not a solution. So far, a part from the one bug you found with .screen, none have been found. If one is found and make new totally unusable and unfixable, I'll envisage to remove that signal. :) -- 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
Re: [Patch] Some fixes to awesome_atexit()
At 1252070161 time_t, Uli Schlachter wrote: First patch fixes some valgrind invalid access errors and second one fixes a valgrind leaked fd warning (libev leaked its epoll and signalfd file descriptors). Good catch, all in! Cheers, -- Julien Danjou // ᐰ jul...@danjou.info http://julien.danjou.info // 9A0D 5FD9 EB42 22F6 8974 C95C A462 B51E C2FE E5CD // Trust no one. signature.asc Description: Digital signature
[PATCH + RFC] Fix unsafe comparison of floating point numbers.
When compiling with -Wfloat-equal you will notice a few warnings about unsafe comparison of floating points with == or != operators. To get around this two functions a_compare_float a_compare_double were created. They safely compare the two floating point numbers within a given precision. Thanks, - Brian Gianforcaro From b88d4f3c79fe55d60327605212626dc8c9401038 Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro b.gia...@gmail.com Date: Fri, 4 Sep 2009 00:47:20 -0400 Subject: [PATCH 2/3] common: Fix unsafe comparison of floating point numbers When compiling with -Wfloat-equal you will notice a few warnings about unsafe comparison of floating points with == or != operators. To get around this two functions a_compare_float a_compare_double were created. They safely compare the two floating point numbers within a given precision. Signed-off-by: Brian Gianforcaro b.gia...@gmail.com --- awesomeConfig.cmake |2 +- client.c|2 +- common/util.h | 28 wibox.c |6 +++--- widgets/graph.c |2 +- 5 files changed, 34 insertions(+), 6 deletions(-) diff --git a/awesomeConfig.cmake b/awesomeConfig.cmake index 019cd5a..2bb60c2 100644 --- a/awesomeConfig.cmake +++ b/awesomeConfig.cmake @@ -19,7 +19,7 @@ link_directories(/usr/local/lib) # {{{ CFLAGS add_definitions(-std=gnu99 -ggdb3 -fno-strict-aliasing -Wall -Wextra -Wchar-subscripts -Wundef -Wshadow -Wcast-align -Wwrite-strings --Wsign-compare -Wunused -Wno-unused-parameter -Wuninitialized -Winit-self +-Wsign-compare -Wunused -Wfloat-equal -Wno-unused-parameter -Wuninitialized -Winit-self -Wpointer-arith -Wredundant-decls -Wformat-nonliteral -Wno-format-zero-length -Wmissing-format-attribute -Wmissing-prototypes -Wstrict-prototypes) diff --git a/client.c b/client.c index 140c90b..af4b835 100644 --- a/client.c +++ b/client.c @@ -72,7 +72,7 @@ client_set_opacity(lua_State *L, int cidx, double opacity) { client_t *c = luaA_client_checkudata(L, cidx); -if(c-opacity != opacity) +if(!a_compare_double(c-opacity, opacity)) { c-opacity = opacity; window_opacity_set(c-window, opacity); diff --git a/common/util.h b/common/util.h index 779eb46..198ac48 100644 --- a/common/util.h +++ b/common/util.h @@ -273,6 +273,34 @@ static inline int a_strncmp(const char *a, const char *b, ssize_t n) return strncmp(NONULL(a), NONULL(b), n); } +/** High precision float comparison + * \param[in] a The first float to compare + * \param[in] b The second float to compare + * \return true if equal within precision, false if not equal within defined precision. + */ +static inline int a_compare_float(const float a, const float b) +{ +const float precision = 0.1; +if((a - precision) b (a + precision) b) + return true; +else + return false; +} + +/** High precision double comparison + * \param[in] a The first double to compare + * \param[in] b The second double to compare + * \return true on equal within precison, false if not equal within defined precision. + */ +static inline int a_compare_double(const double a, const double b) +{ +const double precision = 0.1; +if((a - precision) b (a + precision) b) + return true; +else + return false; +} + ssize_t a_strncpy(char *dst, ssize_t n, const char *src, ssize_t l) __attribute__((nonnull(1))); ssize_t a_strcpy(char *dst, ssize_t n, const char *src) __attribute__((nonnull(1))); diff --git a/wibox.c b/wibox.c index c7214b2..278c6ec 100644 --- a/wibox.c +++ b/wibox.c @@ -317,7 +317,7 @@ void wibox_set_opacity(lua_State *L, int udx, double opacity) { wibox_t *w = luaA_checkudata(L, udx, wibox_class); -if(w-opacity != opacity) +if(!a_compare_double(w-opacity,opacity)) { w-opacity = opacity; if(w-window) @@ -763,7 +763,7 @@ wibox_attach(lua_State *L, int udx, screen_t *s) window_set_cursor(wibox-window, xcursor_new(globalconf.connection, xcursor_font_fromstr(wibox-cursor))); -if(wibox-opacity != -1) +if(!a_compare_double(wibox-opacity,-1)) window_opacity_set(wibox-window, wibox-opacity); ewmh_update_strut(wibox-window, wibox-strut); @@ -806,7 +806,7 @@ luaA_wibox_new(lua_State *L) w-visible = true; -if(!w-opacity) +if(a_compare_double(w-opacity, 0)) w-opacity = -1; if(!w-cursor) diff --git a/widgets/graph.c b/widgets/graph.c index 861fce3..82cd3ab 100644 --- a/widgets/graph.c +++ b/widgets/graph.c @@ -333,7 +333,7 @@ luaA_graph_plot_properties_set(lua_State *L) plot-scale = luaA_getopt_boolean(L, 3, scale, plot-scale); max_value = luaA_getopt_number(L, 3, max_value, plot-max_value); -if(max_value != plot-max_value) +if(!a_compare_float(max_value, plot-max_value)) plot-max_value = plot-current_max = max_value; if((buf = luaA_getopt_lstring(L, 3, style, NULL, len))) -- 1.6.3.3
[PATCH] Two patch documentation series
The first patch tells the doxygen preprocessor to parse D-Bus functions, as well as enabling transparent background in the generated dot images. The second patch is a set of doxygen style comments for the D-Bus functions. Thanks, - Brian Gianforcaro From 950f30540a874320bc39ed78a349a977cb00a73c Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro b.gia...@gmail.com Date: Thu, 3 Sep 2009 17:18:54 -0400 Subject: [PATCH 1/2] awesome.doxygen: doxygen configuration fixes. * Set a #define for WITH_DBUS * Set dot to use transparent image backgrounds * Fix small typo Signed-off-by: Brian Gianforcaro b.gia...@gmail.com --- awesome.doxygen.in |7 --- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/awesome.doxygen.in b/awesome.doxygen.in index 07c03e5..d6a5b92 100644 --- a/awesome.doxygen.in +++ b/awesome.doxygen.in @@ -203,7 +203,8 @@ EXPAND_ONLY_PREDEF = YES SEARCH_INCLUDES= YES INCLUDE_PATH = INCLUDE_FILE_PATTERNS = -PREDEFINED = __attribute__(x)= +PREDEFINED = WITH_DBUS = \ + __attribute__(x)= EXPAND_AS_DEFINED = SKIP_FUNCTION_MACROS = YES #--- @@ -225,7 +226,7 @@ CLASS_GRAPH= YES COLLABORATION_GRAPH= YES GROUP_GRAPHS = YES UML_LOOK = YES -TEMPLATE_RELATIONS = YeS +TEMPLATE_RELATIONS = YES INCLUDE_GRAPH = YES INCLUDED_BY_GRAPH = YES CALL_GRAPH = YES @@ -237,7 +238,7 @@ DOT_PATH = DOTFILE_DIRS = DOT_GRAPH_MAX_NODES= 50 MAX_DOT_GRAPH_DEPTH= 1000 -DOT_TRANSPARENT= NO +DOT_TRANSPARENT= YES DOT_MULTI_TARGETS = NO GENERATE_LEGEND= YES DOT_CLEANUP= YES -- 1.6.3.3 From 63b602933955d1d11f98da917c36aaca1c70dfb8 Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro b.gia...@gmail.com Date: Fri, 4 Sep 2009 10:31:29 -0400 Subject: [PATCH 2/2] Added documentation to D-Bus functions. Signed-off-by: Brian Gianforcaro b.gia...@gmail.com --- dbus.c | 56 +++- 1 files changed, 55 insertions(+), 1 deletions(-) diff --git a/dbus.c b/dbus.c index 7c6572d..fb25337 100644 --- a/dbus.c +++ b/dbus.c @@ -39,6 +39,10 @@ ev_io dbusio_sys = { .fd = -1 }; static signal_array_t dbus_signals; +/** Clean up the D-Bus connection data members + * \param dbus_connection The D-Bus connection to clean up + * \param dbusio The D-Bus event watcher + */ static void a_dbus_cleanup_bus(DBusConnection *dbus_connection, ev_io *dbusio) { @@ -58,6 +62,10 @@ a_dbus_cleanup_bus(DBusConnection *dbus_connection, ev_io *dbusio) dbus_connection_unref(dbus_connection); } +/** Iterate through the D-Bus messages counting each or traverse each sub message. + * \param iter The D-Bus message iterator pointer + * \return The number of arguments in the iterator + */ static int a_dbus_message_iter(DBusMessageIter *iter) { @@ -248,6 +256,10 @@ a_dbus_message_iter(DBusMessageIter *iter) return nargs; } +/** Process a single request from D-Bus + * \param dbus_connection The connection to the D-Bus server. + * \param msg The D-Bus message request being sent to the D-Bus connection. + */ static void a_dbus_process_request(DBusConnection *dbus_connection, DBusMessage *msg) { @@ -380,6 +392,10 @@ a_dbus_process_request(DBusConnection *dbus_connection, DBusMessage *msg) } } +/** Attempt to process all the requests in the D-Bus connection. + * \param dbus_connection The D-Bus connection to process from + * \param dbusio The D-Bus event watcher + */ static void a_dbus_process_requests_on_bus(DBusConnection *dbus_connection, ev_io *dbusio) { @@ -411,18 +427,32 @@ a_dbus_process_requests_on_bus(DBusConnection *dbus_connection, ev_io *dbusio) dbus_connection_flush(dbus_connection); } +/** Foreword D-Bus process session requests on too the correct function. + * \param w The D-Bus event watcher + * \param revents (not used) + */ static void a_dbus_process_requests_session(EV_P_ ev_io *w, int revents) { a_dbus_process_requests_on_bus(dbus_connection_session, w); } +/** Foreword D-Bus process system requests on too the correct function. + * \param w The D-Bus event watcher + * \param revents (not used) + */ static void a_dbus_process_requests_system(EV_P_ ev_io *w, int revents) { a_dbus_process_requests_on_bus(dbus_connection_system, w); } +/** Attempt to request a D-Bus name + * \param dbus_connection The application's connection to D-Bus + * \param name The D-Bus connection name to be requested + * \return true if the name is primary owner or the name is already + * the owner, otherwise false. + */ static bool a_dbus_request_name(DBusConnection *dbus_connection, const char *name) { @@ -453,6 +483,12 @@ a_dbus_request_name(DBusConnection *dbus_connection, const char *name) return false; } +/** Attempt to release the D-Bus name owner
Re: [PATCH] Two patch documentation series
At 1252075326 time_t, Brian Gianforcaro wrote: The first patch tells the doxygen preprocessor to parse D-Bus functions, as well as enabling transparent background in the generated dot images. The second patch is a set of doxygen style comments for the D-Bus functions. Both pushed, thanks. Cheers, -- Julien Danjou // ᐰ jul...@danjou.info http://julien.danjou.info // 9A0D 5FD9 EB42 22F6 8974 C95C A462 B51E C2FE E5CD // I'm no superman. signature.asc Description: Digital signature
Re: [PATCH] Fix awful.client is_in_direction and calculate_distance
On Fri, Sep 04, 2009 at 01:35:31PM +0200, Julien Danjou wrote: While this patch is good, I've applied the one Sebastien Gross sent ealier, which was simpler. :) Wah, sorry - really should've checked the mailing list before sending the patch. I was wondering where to send the patch, read PATCHES and off it went. :) Anyway, thanks much for your contribution! Thanks for awesome. :) Andreas -- To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.
Fwd: float and ontop windows can’t get focus
Sorry for the personal response. The answer to is not set to awesome-devel… do you tried the very last git version (after 1df4f1c6) ? because there was a bug with some rules matching when they dont have too. Hum… strange. I try to explain (I can do it in french if I’m not clear ;o)) I use two screen. I launch mplayer from my term on the screen 1. I can’t see mplayer but it apear as float on the taskbar (still screen 1). I clic on the taskbar and mplayer apear on screen 2. On screen 2 I have the same problem than in my previous mail : the mplayer window can get focus and catch keys. If I move mplayer on screen 1, the window catch my keys and get focus. I must add that I have modification (that don’t work) of tags in my rc.lua, see this post : http://www.mail-archive.com/awes...@naquadah.org/msg01735.html Removing this config I have even strange comportment (and git sinc beetween the two tests) I can’t launch mplayer from the first screen (I must say that awsome recognize this one as the first one but in my xorg config the first one is the other). No window open and I must kill it with Ctrl-C Olivier. -- [Message tapé sur un clavier Bépo : http://www.bepo.fr ] http://soubresauts.net -- [Message tapé sur un clavier Bépo : http://www.bepo.fr ] http://soubresauts.net -- To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.