Re:Tiling features in Mutter



Hi, everyone,

I have a few more remarks on this tabbing-tiling stuff and also a question concerning window managers.

It looks to me not only tiling but also tabbing can in principle be done completely from outside the window-manager/gnome-shell as a separate process. At the moment I'm working heavily on implementing this.

For tabbing an astonishingly simple way seems to be to reparent x11 client windows. It seems, though that window managers have a tendency to become confused by this and reparent the window back. Looking at what has been done on gtk_socket_steal() more people have already tried to get it working in a wm-independent way, and failed. It seems, though, the changes to a wm to accept it a very minimal. I have a (small) patch for mutter which seems to fix it.

Anyone any thoughts? Maybe there is a way handle it independent of window managers, and I don't know it? Or would it be possible to fix the Gnome WMs to accept reparenting by client applications?

Owen, would you accept a patch for mutter concerning this, like the one attached or something equivalent?

Best,

Oliver
diff --git a/src/core/frame.c b/src/core/frame.c
index 4db0002..0852c55 100644
--- a/src/core/frame.c
+++ b/src/core/frame.c
@@ -40,6 +40,28 @@
                     FocusChangeMask |                              \
                     ColormapChangeMask)
 
+static Window
+get_xwindow_parent_of_window (MetaWindow* child);
+
+static Window
+get_xwindow_parent_of_window (MetaWindow* child) {
+
+  Window root_window;
+  Window parent_window;
+  Window *children_list;
+  unsigned int children_count;
+
+  children_list = NULL;
+
+  XQueryTree (child->display->xdisplay, child->xwindow, &root_window,
+              &parent_window, &children_list, &children_count);
+
+  if (children_list!=NULL)
+    XFree(children_list);
+
+  return parent_window;
+}
+
 void
 meta_window_ensure_frame (MetaWindow *window)
 {
@@ -208,15 +230,18 @@ meta_window_destroy_frame (MetaWindow *window)
   meta_stack_tracker_record_add (window->screen->stack_tracker,
                                  window->xwindow,
                                  XNextRequest (window->display->xdisplay));
-  XReparentWindow (window->display->xdisplay,
-                   window->xwindow,
-                   window->screen->xroot,
-                   /* Using anything other than meta_window_get_position()
-                    * coordinates here means we'll need to ensure a configure
-                    * notify event is sent; see bug 399552.
-                    */
-                   window->frame->rect.x,
-                   window->frame->rect.y);
+
+  if (get_xwindow_parent_of_window(window)==window->frame->xwindow)
+    XReparentWindow (window->display->xdisplay,
+                     window->xwindow,
+                     window->screen->xroot,
+                     /* Using anything other than meta_window_get_position()
+                      * coordinates here means we'll need to ensure a configure
+                      * notify event is sent; see bug 399552.
+                      */
+                     window->frame->rect.x,
+                     window->frame->rect.y);
+
   meta_error_trap_pop (window->display);
 
   meta_ui_destroy_frame_window (window->screen->ui, frame->xwindow);


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