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

awesome wrote:
> Summary - spurious mouse_enter events when hovering
> Task Type - Bug Report
> Category - Core
> Status - New
> Assigned To - 
> Operating System - All
> Severity - Low
> Priority - Normal
> Reported Version - git/master
> Due in Version - Undecided
> Due Date - Undecided
> Details - widget mouse_enter is broken in git/master - while hovering over 
> the widget (without leaving its area) there are spurious mouse_enter events.
> 
> To reproduce:
> 
> 1. Add the following code to default rc.lua:
> mytextbox.mouse_enter = function() naughty.notify{ text = "mouse in", timeout 
> = 0 } end
> mytextbox.mouse_leave = function() naughty.notify{ text = "mouse out", 
> timeout = 0 } end
> 
> 2. hover mouse over the clock and watch a long chain of "mouse ins".
> 
> Curiously this seems to occur only for widgets in non-floating wiboxes.
> 
> More information can be found at the following URL:
> http://awesome.naquadah.org/bugs/index.php?do=details&task_id=578

Ok, I finally found the time to debug this and yeah, bug confirmed. Next try:
print() instead of naughty. Hm, the bug disappears. A quick grep later and I had
the attached patch which fixes this.

Uli

P.S: @jd
That lua_pop in luaA_wibox_invalidate_byitem() looks fishy, is this some kind of
left-over which should be removed?

P.P.S: Should wibox_need_update() generate a mouse_leave event?
- --
"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)

iQEcBAEBCAAGBQJKhacOAAoJECLkKOvLj8sGiSoH/1vrBrqUHnq6DczHI+1esBz2
Z7dJ7Jlo8L5y9UbwBWobZpkgyCHEMxkITp3g653nAMTSd47eZEdtaTmtukf+hUTB
mFlEvZiKmz8U8oiAq3AJ/nUOjRXUxjRW2dsoDFcZUJ8Lr0CD6WDN9MLipW1PJxQU
n57QBMOY4GAXlVvsG+HQpbkhx1Grf3Y3OCzjTyojRfsks5OeYeZVpUBfwFEtlDb6
mn8YSo2gzXmJiqVRb2VCV4mu8LXVEY8xmFmDHDYl7S3mHn8U09nTUNZP6qjHkmQ2
6344Q/6+2D/8DauTEq/5/E4tgnSXql9p0mecu/1UgjWjlZvjxWEOV3VBtqLmAHQ=
=mNmx
-----END PGP SIGNATURE-----
>From 808df763587206fa290b5055be1703aed145cee5 Mon Sep 17 00:00:00 2001
From: Uli Schlachter <psyc...@znc.in>
Date: Fri, 14 Aug 2009 20:00:58 +0200
Subject: [PATCH] Don't generate spurious mouse_enter events

Whenever a wibox was updated, we cleared the "widget under the mouse" variable
which means we generated tons of mouse_enter events if the event handler caused
an update (e.g. by creating a naughty notify).

Signed-off-by: Uli Schlachter <psyc...@znc.in>
---
 wibox.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/wibox.c b/wibox.c
index 7220f6e..6ef1715 100644
--- a/wibox.c
+++ b/wibox.c
@@ -54,6 +54,9 @@ static void
 wibox_need_update(wibox_t *wibox)
 {
     wibox->need_update = true;
+    /* All out callers change the position of some widgets which means we should
+     * generate a new mouse_enter event.
+     */
     wibox->mouse_over = NULL;
 }
 
@@ -791,8 +794,10 @@ luaA_wibox_invalidate_byitem(lua_State *L, const void *item)
         wibox_t *wibox = *w;
         if(luaA_wibox_hasitem(L, wibox, item))
         {
-            /* update wibox */
-            wibox_need_update(wibox);
+            /* update wibox. Don't use wibox_need_update() here because for this
+             * specific case we don't want to touch wibox->mouse_over!
+             */
+            wibox->need_update = true;
             lua_pop(L, 1); /* remove widgets table */
         }
 
@@ -803,8 +808,8 @@ luaA_wibox_invalidate_byitem(lua_State *L, const void *item)
         client_t *c = *_c;
         if(c->titlebar && luaA_wibox_hasitem(L, c->titlebar, item))
         {
-            /* update wibox */
-            wibox_need_update(c->titlebar);
+            /* update wibox. See above for why this doesn't use wibox_need_update(). */
+            c->titlebar->need_update = true;
             lua_pop(L, 1); /* remove widgets table */
         }
     }
-- 
1.6.3.3

Reply via email to