ShellGlobal: use a different window for IBus when running on wayland

When running as a wayland compositor, the clutter stage doesn't
have an usable window for IPC, so just create another one.

Also, disable freezing the keyboard when running on wayland, as
we can't do it really.

https://bugzilla.gnome.org/show_bug.cgi?id=707467
This commit is contained in:
Giovanni Campagna 2013-09-11 17:53:58 +02:00
parent 4db6e70f97
commit ba9c1d98f6

View File

@ -847,9 +847,36 @@ _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));
global->stage_xwindow = clutter_x11_get_stage_window (global->stage);
global->ibus_window = gdk_x11_window_foreign_new_for_display (global->gdk_display, #ifdef HAVE_WAYLAND
global->stage_xwindow); if (meta_is_wayland_compositor ())
{
/* When Mutter is acting as its own display server then the
stage does not have a window, so create a different window
which we use to communicate with IBus, and leave stage_xwindow
as None.
*/
GdkWindowAttr attributes;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.width = 100;
attributes.height = 100;
attributes.window_type = GDK_WINDOW_TOPLEVEL;
global->ibus_window = gdk_window_new (NULL,
&attributes,
0 /* attributes_mask */);
global->stage_xwindow = None;
}
else
#endif
{
global->stage_xwindow = clutter_x11_get_stage_window (global->stage);
global->ibus_window = gdk_x11_window_foreign_new_for_display (global->gdk_display,
global->stage_xwindow);
}
st_im_text_set_event_window (global->ibus_window); st_im_text_set_event_window (global->ibus_window);
g_signal_connect (global->stage, "notify::width", g_signal_connect (global->stage, "notify::width",
@ -954,7 +981,8 @@ void
shell_global_freeze_keyboard (ShellGlobal *global, shell_global_freeze_keyboard (ShellGlobal *global,
guint32 timestamp) guint32 timestamp)
{ {
meta_display_freeze_keyboard (global->meta_display, global->stage_xwindow, timestamp); if (global->stage_xwindow != None)
meta_display_freeze_keyboard (global->meta_display, global->stage_xwindow, timestamp);
} }
/* Code to close all file descriptors before we exec; copied from gspawn.c in GLib. /* Code to close all file descriptors before we exec; copied from gspawn.c in GLib.