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.
This commit is contained in:
Neil Roberts 2013-06-19 13:49:31 +01:00
parent d663beab97
commit e3be2237b8

View File

@ -930,9 +930,34 @@ _shell_global_set_plugin (ShellGlobal *global,
meta_screen_get_screen_number (global->meta_screen)); meta_screen_get_screen_number (global->meta_screen));
global->stage = CLUTTER_STAGE (meta_get_stage_for_screen (global->meta_screen)); global->stage = CLUTTER_STAGE (meta_get_stage_for_screen (global->meta_screen));
if (meta_is_display_server ())
{
/* 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
{
global->stage_xwindow = clutter_x11_get_stage_window (global->stage); 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_gdk_window =
gdk_x11_window_foreign_new_for_display (global->gdk_display,
global->stage_xwindow); global->stage_xwindow);
}
g_signal_connect (global->stage, "notify::width", g_signal_connect (global->stage, "notify::width",
G_CALLBACK (global_stage_notify_width), global); G_CALLBACK (global_stage_notify_width), global);