[gnome-shell/wip/wayland: 19/25] wayland: Create a dummy stage window when running as a display server



commit c75f55fb54f985892ff7e96771922597f17e8cdc
Author: Neil Roberts <neil linux intel com>
Date:   Wed Jun 19 13:49:31 2013 +0100

    wayland: Create a dummy stage window when running as a display server
    
    When Mutter is running as a display server then Clutter won't be using
    the X11 backend so there won't be a window for the stage. The shell
    global keeps track of this stage window to be used in various places.
    This patch adds a dummy window that is never mapped to use instead of
    the stage window so that the various places that are using it might be
    able to continue working without generating X errors.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=707467

 src/shell-global.c |   33 ++++++++++++++++++++++++++++++---
 1 files changed, 30 insertions(+), 3 deletions(-)
---
diff --git a/src/shell-global.c b/src/shell-global.c
index 0ea3287..21ea3d8 100644
--- a/src/shell-global.c
+++ b/src/shell-global.c
@@ -935,9 +935,36 @@ _shell_global_set_plugin (ShellGlobal *global,
                                                meta_screen_get_screen_number (global->meta_screen));
 
   global->stage = CLUTTER_STAGE (meta_get_stage_for_screen (global->meta_screen));
-  global->stage_xwindow = clutter_x11_get_stage_window (global->stage);
-  global->stage_gdk_window = gdk_x11_window_foreign_new_for_display (global->gdk_display,
-                                                                     global->stage_xwindow);
+#ifdef HAVE_WAYLAND
+  if (meta_is_wayland_compositor ())
+    {
+      /* When Mutter is acting as its own display server then the
+         stage does not have a window. Instead we'll just create a
+         dummy window that might make some things blunder along but
+         will probably just leave most things broken. It might be
+         possible to fix this to make the fake window be the same size
+         as the stage window would be and make it more useful. */
+
+      GdkWindowAttr attributes;
+
+      attributes.wclass = GDK_INPUT_OUTPUT;
+      attributes.width = 100;
+      attributes.height = 100;
+      attributes.window_type = GDK_WINDOW_TOPLEVEL;
+
+      global->stage_gdk_window = gdk_window_new (NULL,
+                                                 &attributes,
+                                                 0 /* attributes_mask */);
+      global->stage_xwindow = gdk_x11_window_get_xid (global->stage_gdk_window);
+    }
+  else
+#endif
+    {
+      global->stage_xwindow = clutter_x11_get_stage_window (global->stage);
+      global->stage_gdk_window =
+        gdk_x11_window_foreign_new_for_display (global->gdk_display,
+                                                global->stage_xwindow);
+    }
 
   g_signal_connect (global->stage, "notify::width",
                     G_CALLBACK (global_stage_notify_width), global);


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