Hi, Here is a minor bugfix, for those of us who use an autoraise/autocollapse dock. More details can be found in the attached patch itself.
I hope it can be merge into stable. By that I mean, I hope it doesn't break anything, and that it can be easily applied to your repo, Carlos. Let me know if that's not the case. Regarding code style, is it on purpose that the code is now tabified? Would you like my patch to use leading tabs as well, or can it be "fixed" automatically when applying it? Best, -- Daniel
commit 7dbf61c43496de637f9a368fa39ec6ee79973e7a Author: Daniel Déchelotte <[email protected]> Date: Tue Sep 1 00:15:16 2009 +0200 Gobble "spurious" EnterNotify events when moving an appIcon or a dock This is a bug fix. Bug overview: if an AppIcon is moved rapidly over a Clip set to auto-expand, the latter may erroneously auto-expand afterwards. How to reproduce it: set a Clip to auto-collapse, and make sure it contains a (random) AppIcon, so as to easily visualise its open/close state. Now move rapidly an AppIcon over the Clip. Try to move it so fast that the cursor sometimes is out of the AppIcon's tile. Then, replace the AppIcon out of the Clip. Explanation and correction: if, while the AppIcon was being moved, the mouse cursor entered at least once in the Clip's tile, the latter is going to receive an EnterNotify event (after the AppIcon is replaced) and thus expand automatically after the relevant delay. The solution is to simply "gobble" (i.e., ignore) all EnterNotify events when moving an AppIcon. --- src/appicon.c | 9 ++++++++- src/dock.c | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/appicon.c b/src/appicon.c index 4437e58..05a8485 100644 --- a/src/appicon.c +++ b/src/appicon.c @@ -597,12 +597,19 @@ void appIconMouseDown(WObjDescriptor * desc, XEvent * event) while (!done) { WMMaskEvent(dpy, PointerMotionMask | ButtonReleaseMask | ButtonPressMask - | ButtonMotionMask | ExposureMask, &ev); + | ButtonMotionMask | ExposureMask | EnterWindowMask, &ev); switch (ev.type) { case Expose: WMHandleEvent(&ev); break; + case EnterNotify: + /* It means the cursor moved so fast that it entered + * something else (if moving slowly, it would have + * stayed in the appIcon that is being moved. Ignore + * such "spurious" EnterNotifiy's */ + break; + case MotionNotify: if (!grabbed) { if (abs(dx - ev.xmotion.x) >= MOVE_THRESHOLD diff --git a/src/dock.c b/src/dock.c index 1d82a37..a71c36b 100644 --- a/src/dock.c +++ b/src/dock.c @@ -3378,12 +3378,19 @@ static void handleDockMove(WDock * dock, WAppIcon * aicon, XEvent * event) done = 0; while (!done) { WMMaskEvent(dpy, PointerMotionMask | ButtonReleaseMask | ButtonPressMask - | ButtonMotionMask | ExposureMask, &ev); + | ButtonMotionMask | ExposureMask | EnterWindowMask, &ev); switch (ev.type) { case Expose: WMHandleEvent(&ev); break; + case EnterNotify: + /* It means the cursor moved so fast that it entered + * something else (if moving slowly, it would have + * stayed in the dock that is being moved. Ignore such + * "spurious" EnterNotifiy's */ + break; + case MotionNotify: if (!grabbed) { if (abs(ofs_x - ev.xmotion.x) >= MOVE_THRESHOLD
