]> Dogcows Code - chaz/openbox/blobdiff - openbox/event.c
Merge branch 'backport' into work
[chaz/openbox] / openbox / event.c
index 80f3c727d0e35a8527e053dd703796064267580b..9377214bbe70015e846a4e8ee3e1f01d53fa4f37 100644 (file)
@@ -159,7 +159,7 @@ static Window event_get_window(XEvent *e)
     /* pick a window */
     switch (e->type) {
     case SelectionClear:
-        window = RootWindow(obt_display, ob_screen);
+        window = obt_root(ob_screen);
         break;
     case MapRequest:
         window = e->xmap.window;
@@ -269,7 +269,8 @@ static void event_hack_mods(XEvent *e)
            magic.  Our X core protocol stuff won't work, so we use this to
            find what the modifier state is instead. */
         if (XkbGetState(obt_display, XkbUseCoreKbd, &xkb_state) == Success)
-            e->xkey.state = xkb_state.compat_state;
+            e->xkey.state =
+                obt_keyboard_only_modmasks(xkb_state.compat_state);
         else
 #endif
         {
@@ -314,7 +315,7 @@ static gboolean wanted_focusevent(XEvent *e, gboolean in_client_only)
 
         /* These are the ones we want.. */
 
-        if (win == RootWindow(obt_display, ob_screen)) {
+        if (win == obt_root(ob_screen)) {
             /* If looking for a focus in on a client, then always return
                FALSE for focus in's to the root window */
             if (in_client_only)
@@ -368,7 +369,7 @@ static gboolean wanted_focusevent(XEvent *e, gboolean in_client_only)
             return FALSE;
 
         /* Focus left the root window revertedto state */
-        if (win == RootWindow(obt_display, ob_screen))
+        if (win == obt_root(ob_screen))
             return FALSE;
 
         /* These are the ones we want.. */
@@ -465,7 +466,9 @@ static void event_process(const XEvent *ec, gpointer data)
     e = ⅇ
 
     window = event_get_window(e);
-    if ((obwin = window_find(window))) {
+    if (window == obt_root(ob_screen))
+        /* don't do any lookups, waste of cpu */;
+    else if ((obwin = window_find(window))) {
         switch (obwin->type) {
         case OB_WINDOW_CLASS_DOCK:
             dock = WINDOW_AS_DOCK(obwin);
@@ -476,7 +479,7 @@ static void event_process(const XEvent *ec, gpointer data)
         case OB_WINDOW_CLASS_MENUFRAME:
             menu = WINDOW_AS_MENUFRAME(obwin);
             break;
-        case OB_WINDOW_CLASS_INTERNALWINDOW:
+        case OB_WINDOW_CLASS_INTERNAL:
             /* we don't do anything with events directly on these windows */
             break;
         }
@@ -592,7 +595,7 @@ static void event_process(const XEvent *ec, gpointer data)
             obt_display_ignore_errors(TRUE);
             if (XGetInputFocus(obt_display, &win, &i) &&
                 XGetGeometry(obt_display, win, &root, &i,&i,&u,&u,&u,&u) &&
-                root != RootWindow(obt_display, ob_screen))
+                root != obt_root(ob_screen))
             {
                 ob_debug_type(OB_DEBUG_FOCUS,
                               "Focus went to another screen !\n");
@@ -633,7 +636,7 @@ static void event_process(const XEvent *ec, gpointer data)
         event_handle_dock(dock, e);
     else if (menu)
         event_handle_menu(menu, e);
-    else if (window == RootWindow(obt_display, ob_screen))
+    else if (window == obt_root(ob_screen))
         event_handle_root(e);
     else if (e->type == MapRequest)
         client_manage(window);
@@ -700,7 +703,7 @@ static void event_process(const XEvent *ec, gpointer data)
     if (e->type == ButtonPress || e->type == ButtonRelease) {
         /* If the button press was on some non-root window, or was physically
            on the root window, the process it */
-        if (window != RootWindow(obt_display, ob_screen) ||
+        if (window != obt_root(ob_screen) ||
             e->xbutton.subwindow == None)
         {
             event_handle_user_input(client, e);
@@ -711,7 +714,7 @@ static void event_process(const XEvent *ec, gpointer data)
             ObWindow *w;
 
             if ((w = window_find(e->xbutton.subwindow)) &&
-                WINDOW_IS_INTERNALWINDOW(w))
+                WINDOW_IS_INTERNAL(w))
             {
                 event_handle_user_input(client, e);
             }
@@ -1227,14 +1230,14 @@ static void event_handle_client(ObClient *client, XEvent *e)
         break;
     }
     case UnmapNotify:
-        if (client->ignore_unmaps) {
-            client->ignore_unmaps--;
-            break;
-        }
         ob_debug("UnmapNotify for window 0x%x eventwin 0x%x sendevent %d "
                  "ignores left %d\n",
                  client->window, e->xunmap.event, e->xunmap.from_configure,
                  client->ignore_unmaps);
+        if (client->ignore_unmaps) {
+            client->ignore_unmaps--;
+            break;
+        }
         client_unmanage(client);
         break;
     case DestroyNotify:
@@ -1927,8 +1930,7 @@ void event_halt_focus_delay(void)
 
 gulong event_start_ignore_all_enters(void)
 {
-    XSync(obt_display, FALSE);
-    return LastKnownRequestProcessed(obt_display);
+    return NextRequest(obt_display);
 }
 
 static void event_ignore_enter_range(gulong start, gulong end)
@@ -1947,13 +1949,18 @@ static void event_ignore_enter_range(gulong start, gulong end)
                   r->start, r->end);
 
     /* increment the serial so we don't ignore events we weren't meant to */
-    XSync(obt_display, FALSE);
+    OBT_PROP_ERASE(screen_support_win, MOTIF_WM_HINTS);
 }
 
 void event_end_ignore_all_enters(gulong start)
 {
-    XSync(obt_display, FALSE);
-    event_ignore_enter_range(start, LastKnownRequestProcessed(obt_display));
+    /* Use (NextRequest-1) so that we ignore up to the current serial only.
+       Inside event_ignore_enter_range, we increment the serial by one, but if
+       we ignore that serial too, then any enter events generated by mouse
+       movement will be ignored until we create some further network traffic.
+       Instead ignore up to NextRequest-1, then when we increment the serial,
+       we will be *past* the range of ignored serials */
+    event_ignore_enter_range(start, NextRequest(obt_display)-1);
 }
 
 static gboolean is_enter_focus_event_ignored(XEvent *e)
This page took 0.024497 seconds and 4 git commands to generate.