Commit 283649b8 authored by Jasper St. Pierre's avatar Jasper St. Pierre

Support keybindings again, too

parent fa65c380
......@@ -1003,18 +1003,13 @@ meta_compositor_window_shape_changed (MetaCompositor *compositor,
* application toolkit. As such, it will ignore any events sent
* to the a stage that isn't its X window.
* When a user clicks on what she thinks is the wallpaper, she
* is actually clicking on the guard window, which is an entirely
* separate top-level override-redirect window in the hierarchy.
* We want to recieve events on this guard window so that users
* can right-click on the background actor. We do this by telling
* Clutter a little white lie, by transforming clicks on the guard
* window to become clicks on the stage window, allowing Clutter
* to process the event normally.
* When running as an X window manager, we need to respond to
* events from lots of windows. Trick Clutter into translating
* these events by pretending we got an event on the stage window.
static void
maybe_spoof_guard_window_event_as_stage_event (MetaCompScreen *info,
XEvent *event)
maybe_spoof_event_as_stage_event (MetaCompScreen *info,
XEvent *event)
MetaDisplay *display = meta_screen_get_display (info->screen);
......@@ -1023,19 +1018,22 @@ maybe_spoof_guard_window_event_as_stage_event (MetaCompScreen *info,
XIEvent *input_event = (XIEvent *) event->;
/* Only care about pointer events for now. */
switch (input_event->evtype)
case XI_Motion:
case XI_ButtonPress:
case XI_ButtonRelease:
case XI_KeyPress:
case XI_KeyRelease:
XIDeviceEvent *device_event = ((XIDeviceEvent *) input_event);
if (device_event->event == info->screen->guard_window)
Window xwin = clutter_x11_get_stage_window (CLUTTER_STAGE (info->stage));
device_event->event = xwin;
/* If this is a GTK+ widget, like a window menu, let GTK+ handle
* it as-is without mangling. */
if (meta_ui_window_is_widget (info->screen->ui, device_event->event))
device_event->event = clutter_x11_get_stage_window (CLUTTER_STAGE (info->stage));
......@@ -1092,7 +1090,7 @@ meta_compositor_process_event (MetaCompositor *compositor,
info = meta_screen_get_compositor_data (screen);
maybe_spoof_guard_window_event_as_stage_event (info, event);
maybe_spoof_event_as_stage_event (info, event);
if (meta_plugin_manager_xevent_filter (info->plugin_mgr, event))
......@@ -1707,9 +1707,19 @@ update_focus_window (MetaDisplay *display,
if (display->focus_window)
ClutterActor *window_actor;
meta_topic (META_DEBUG_FOCUS, "* Focus --> %s with serial %lu\n",
display->focus_window->desc, serial);
meta_window_set_focused_internal (display->focus_window, TRUE);
/* XXX -- this is sort of a layer violation, but because we
* rely on the compositor for event delivery anyway, I don't
* think it's too bad... */
window_actor = CLUTTER_ACTOR (display->focus_window->compositor_private);
if (window_actor)
clutter_actor_grab_key_focus (window_actor);
meta_topic (META_DEBUG_FOCUS, "* Focus --> NULL with serial %lu\n", serial);
......@@ -215,8 +215,6 @@ meta_wayland_compositor_set_input_focus (MetaWaylandCompositor *compositor,
meta_wayland_keyboard_set_focus (&compositor->seat->keyboard,
meta_wayland_data_device_set_keyboard_focus (compositor->seat);
clutter_stage_set_key_focus (CLUTTER_STAGE (compositor->stage), window_actor);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment