1
0
Fork 0

compositor: fix mouse interactions on frames

meta_ui_window_is_widget() returns FALSE for frame windows, so we
must filter those explicitly (by letting the event go to gtk
and from there to MetaFrames). Also, for proper gtk widgets
(window menus) we want to let gtk see all events, including
keyboard, otherwise we break keynav in the window menu.
This means that having a window menu open disables keybindings
(because the event doesn't run through clutter)
This commit is contained in:
Giovanni Campagna 2014-02-26 23:46:08 +01:00
parent ed6821a819
commit 394b44a2c2
2 changed files with 10 additions and 4 deletions

View file

@ -76,6 +76,7 @@
#include "window-private.h" /* to check window->hidden */
#include "display-private.h" /* for meta_display_lookup_x_window() */
#include "util-private.h"
#include "frame.h"
#include "meta-wayland-private.h"
#include "meta-wayland-pointer.h"
#include "meta-wayland-keyboard.h"
@ -963,6 +964,7 @@ meta_compositor_window_surface_changed (MetaCompositor *compositor,
*/
static void
maybe_spoof_event_as_stage_event (MetaCompScreen *info,
MetaWindow *window,
XEvent *event)
{
MetaDisplay *display = meta_screen_get_display (info->screen);
@ -978,14 +980,17 @@ maybe_spoof_event_as_stage_event (MetaCompScreen *info,
case XI_Motion:
case XI_ButtonPress:
case XI_ButtonRelease:
/* If this is a window frame, let GTK+ handle it without mangling */
if (window && window->frame && device_event->event == window->frame->xwindow)
break;
case XI_KeyPress:
case XI_KeyRelease:
/* 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))
break;
/* fall through */
case XI_KeyPress:
case XI_KeyRelease:
device_event->event = clutter_x11_get_stage_window (CLUTTER_STAGE (info->stage));
break;
default:
@ -1021,7 +1026,7 @@ meta_compositor_process_event (MetaCompositor *compositor,
return TRUE;
}
maybe_spoof_event_as_stage_event (info, event);
maybe_spoof_event_as_stage_event (info, window, event);
if (meta_plugin_manager_xevent_filter (info->plugin_mgr, event))
{

View file

@ -456,6 +456,7 @@ meta_surface_actor_x11_new (MetaWindow *window)
priv->unredirected = FALSE;
sync_unredirected (self);
clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE);
return META_SURFACE_ACTOR (self);
}