From d7183d33b4bb408f58509786015355628377ba7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20D=C3=A9chelotte?= Date: Tue, 1 Sep 2009 09:22:37 +0200 Subject: [PATCH] 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 4437e58f..05a8485d 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 1d82a371..a71c36b7 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