summaryrefslogtreecommitdiff
path: root/openbox
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-09-21 18:09:48 +0000
committerDana Jansens <danakj@orodu.net>2003-09-21 18:09:48 +0000
commit1b75005e0d86ef8f4a80ad4f1ecda1d7c2c55048 (patch)
tree2e383df63ec73f5a83056b697ac16921c150f90f /openbox
parenta260db31a99ad35a5bf347facab2cdd61e3b7558 (diff)
count the EnterNotify events and tell openbox to ignore them when ungrabbing the pointer
Diffstat (limited to 'openbox')
-rw-r--r--openbox/grab.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/openbox/grab.c b/openbox/grab.c
index a53fe5e8..9c6065a7 100644
--- a/openbox/grab.c
+++ b/openbox/grab.c
@@ -78,8 +78,38 @@ gboolean grab_pointer(gboolean grab, ObCursor cur)
else
ret = TRUE;
} else if (pgrabs > 0) {
- if (--pgrabs == 0)
+ if (--pgrabs == 0) {
XUngrabPointer(ob_display, event_lasttime);
+
+ /* ignore all enter events caused by ungrabbing the pointer */
+ {
+ GSList *saved = NULL, *it;
+ XEvent *e;
+ guint n = 0;
+
+ XSync(ob_display, FALSE);
+
+ /* count the events */
+ while (TRUE) {
+ e = g_new(XEvent, 1);
+ if (XCheckTypedEvent(ob_display, EnterNotify, e)) {
+ saved = g_slist_append(saved, e);
+ ++n;
+ } else {
+ g_free(e);
+ break;
+ }
+ }
+ /* put the events back */
+ for (it = saved; it; it = g_slist_next(it)) {
+ XPutBackEvent(ob_display, it->data);
+ g_free(it->data);
+ }
+ g_slist_free(saved);
+ /* ignore the events */
+ event_ignore_enter_focus(n);
+ }
+ }
ret = TRUE;
}
return ret;