[mutter/wayland] window: Split out logic for determining whether an X window is ours



commit 91b789c707136677e9d58be99bae7a3cc8d7d36a
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sat Feb 1 18:43:33 2014 -0500

    window: Split out logic for determining whether an X window is ours

 src/core/window.c |   54 +++++++++++++++++++++++++++++++++-------------------
 1 files changed, 34 insertions(+), 20 deletions(-)
---
diff --git a/src/core/window.c b/src/core/window.c
index cb47acd..a58dc7f 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -771,6 +771,35 @@ maybe_filter_xwindow (MetaDisplay       *display,
   return filtered;
 }
 
+static gboolean
+is_our_xwindow (MetaDisplay       *display,
+                MetaScreen        *screen
+                Window             xwindow,
+                XWindowAttributes *attrs)
+{
+  /* A black list of override redirect windows that we don't need to manage: */
+  if (attrs->override_redirect &&
+      (xwindow == screen->no_focus_window ||
+       xwindow == screen->flash_window ||
+       xwindow == screen->wm_sn_selection_window ||
+       attrs->class == InputOnly ||
+       /* any windows created via meta_create_offscreen_window: */
+       (attrs->x == -100 && attrs->y == -100
+       && attrs->width == 1 && attrs->height == 1) ||
+       xwindow == screen->wm_cm_selection_window ||
+       xwindow == screen->guard_window ||
+       (display->compositor &&
+        xwindow == XCompositeGetOverlayWindow (display->xdisplay,
+                                              screen->xroot)
+       )
+      )
+     ) {
+    return TRUE;
+  }
+
+  return FALSE;
+}
+
 gboolean
 meta_window_should_attach_to_parent (MetaWindow *window)
 {
@@ -1449,26 +1478,11 @@ meta_window_new (MetaDisplay       *display,
 
   g_assert (screen);
 
-  /* A black list of override redirect windows that we don't need to manage: */
-  if (attrs.override_redirect &&
-      (xwindow == screen->no_focus_window ||
-       xwindow == screen->flash_window ||
-       xwindow == screen->wm_sn_selection_window ||
-       attrs.class == InputOnly ||
-       /* any windows created via meta_create_offscreen_window: */
-       (attrs.x == -100 && attrs.y == -100
-       && attrs.width == 1 && attrs.height == 1) ||
-       xwindow == screen->wm_cm_selection_window ||
-       xwindow == screen->guard_window ||
-       (display->compositor &&
-        xwindow == XCompositeGetOverlayWindow (display->xdisplay,
-                                              screen->xroot)
-       )
-      )
-     ) {
-    meta_verbose ("Not managing our own windows\n");
-    goto error;
-  }
+  if (is_our_xwindow (display, screen, xwindow, &attrs))
+    {
+      meta_verbose ("Not managing our own windows\n");
+      goto error;
+    }
 
   if (maybe_filter_xwindow (display, xwindow, must_be_viewable, &attrs))
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]