]> Dogcows Code - chaz/openbox/commitdiff
ignore mouse clicks on override-redirect windows that aren't owned by openbox
authorDana Jansens <danakj@orodu.net>
Fri, 11 Jan 2008 23:13:12 +0000 (18:13 -0500)
committerDana Jansens <danakj@orodu.net>
Fri, 11 Jan 2008 23:13:12 +0000 (18:13 -0500)
openbox/event.c
openbox/focus_cycle_popup.c
openbox/popup.c
openbox/window.h

index 03229117d145f0bc55c42e6f0959c4ceebdbc141..cd5625990e9fa31ea1cac9f4863a6fb97bfe8f64 100644 (file)
@@ -694,12 +694,50 @@ static void event_process(const XEvent *ec, gpointer data)
     }
 #endif
 
-    if (e->type == ButtonPress || e->type == ButtonRelease ||
-        e->type == MotionNotify || e->type == KeyPress ||
-        e->type == KeyRelease)
-    {
-        event_handle_user_input(client, e);
+    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(ob_display, ob_screen) ||
+            e->xbutton.subwindow == None)
+        {
+            event_handle_user_input(client, e);
+        }
+        /* Otherwise only process it if it was physically on an openbox
+           internal window */
+        else {
+            Window target, parent, root, *children;
+            unsigned int nchildren;
+            ObWindow *w;
+
+            /* Find the top level ancestor of the subwindow, besides the
+               root */
+            target = e->xbutton.subwindow;
+            ob_debug("subwindow 0x%x\n", target);
+            while (XQueryTree(ob_display, target, &root, &parent, &children,
+                              &nchildren) != 0)
+            {
+                XFree(children);
+                if (parent == root) {
+                    ob_debug("parent is root\n");
+                    break;
+                }
+                target = parent;
+            }
+            ob_debug("toplevel 0x%x\n", target);
+
+            w = g_hash_table_lookup(window_map, &target);
+            ob_debug("w 0x%x\n", w);
+                
+            if ((w = g_hash_table_lookup(window_map, &target)) &&
+                WINDOW_IS_INTERNAL(w))
+            {
+                event_handle_user_input(client, e);
+            }
+        }
     }
+    else if (e->type == KeyPress || e->type == KeyRelease ||
+             e->type == MotionNotify)
+        event_handle_user_input(client, e);
 
     /* if something happens and it's not from an XEvent, then we don't know
        the time */
index 028fa45d806152ac7fd2029da106f9c8ef6fadbc..9a6f2420e7cb17928650e2e0f452f044236eb6db 100644 (file)
@@ -128,12 +128,14 @@ void focus_cycle_popup_startup(gboolean reconfig)
     XMapWindow(ob_display, popup.text);
 
     stacking_add(INTERNAL_AS_WINDOW(&popup));
+    g_hash_table_insert(window_map, &popup.bg, &popup);
 }
 
 void focus_cycle_popup_shutdown(gboolean reconfig)
 {
     icon_popup_free(single_popup);
 
+    g_hash_table_remove(window_map, &popup.bg);
     stacking_remove(INTERNAL_AS_WINDOW(&popup));
 
     while(popup.targets) {
index 071f5b62e2c5d9a40208170d40a27cb449a7450f..283348e7cbd3b2ef058c2c6262261e5a38a0a47f 100644 (file)
@@ -58,6 +58,7 @@ ObPopup *popup_new(void)
     XMapWindow(ob_display, self->text);
 
     stacking_add(INTERNAL_AS_WINDOW(self));
+    g_hash_table_insert(window_map, &self->bg, self);
     return self;
 }
 
@@ -68,6 +69,7 @@ void popup_free(ObPopup *self)
         XDestroyWindow(ob_display, self->text);
         RrAppearanceFree(self->a_bg);
         RrAppearanceFree(self->a_text);
+        g_hash_table_remove(window_map, &self->bg);
         stacking_remove(self);
         g_free(self);
     }
index aaf83995806e4f8f56526a53a0d0c5c18d237941..a172cfce62f10664bcb708e8deb0d9b4464ff3b8 100644 (file)
@@ -32,7 +32,8 @@ typedef enum {
     Window_Dock,
     Window_DockApp, /* used for events but not stacking */
     Window_Client,
-    Window_Internal /* used for stacking but not events */
+    Window_Internal /* used for stacking but not events (except to filter
+                       events on the root window) */
 } Window_InternalType;
 
 struct _ObWindow
This page took 0.032876 seconds and 4 git commands to generate.