wayland: Exempt CLICKING grab ops when syncing wayland input focus

If we have a CLICKING grab op we still need to send events to xwayland
so that we get them back for gtk+ to process thus we can't steer
wayland input focus away from it.

https://bugzilla.gnome.org/show_bug.cgi?id=726123
This commit is contained in:
Rui Matos 2014-03-17 20:53:19 +01:00
parent 8968501031
commit 76dc0ca681
4 changed files with 35 additions and 27 deletions

View File

@ -847,29 +847,6 @@ meta_compositor_window_surface_changed (MetaCompositor *compositor,
meta_window_actor_update_surface (window_actor); meta_window_actor_update_surface (window_actor);
} }
static gboolean
grab_op_is_clicking (MetaGrabOp grab_op)
{
switch (grab_op)
{
case META_GRAB_OP_CLICKING_MINIMIZE:
case META_GRAB_OP_CLICKING_MAXIMIZE:
case META_GRAB_OP_CLICKING_UNMAXIMIZE:
case META_GRAB_OP_CLICKING_DELETE:
case META_GRAB_OP_CLICKING_MENU:
case META_GRAB_OP_CLICKING_SHADE:
case META_GRAB_OP_CLICKING_UNSHADE:
case META_GRAB_OP_CLICKING_ABOVE:
case META_GRAB_OP_CLICKING_UNABOVE:
case META_GRAB_OP_CLICKING_STICK:
case META_GRAB_OP_CLICKING_UNSTICK:
return TRUE;
default:
return FALSE;
}
}
static gboolean static gboolean
event_is_passive_button_grab (MetaDisplay *display, event_is_passive_button_grab (MetaDisplay *display,
XIDeviceEvent *device_event) XIDeviceEvent *device_event)
@ -925,7 +902,7 @@ maybe_spoof_event_as_stage_event (MetaCompScreen *info,
/* If this is a window frame, and we think GTK+ needs to handle the event, /* If this is a window frame, and we think GTK+ needs to handle the event,
let GTK+ handle it without mangling */ let GTK+ handle it without mangling */
if (window && window->frame && device_event->event == window->frame->xwindow && if (window && window->frame && device_event->event == window->frame->xwindow &&
(grab_op_is_clicking (display->grab_op) || (meta_grab_op_is_clicking (display->grab_op) ||
(display->grab_op == META_GRAB_OP_NONE && !event_is_passive_button_grab (display, device_event)))) (display->grab_op == META_GRAB_OP_NONE && !event_is_passive_button_grab (display, device_event))))
break; break;

View File

@ -454,6 +454,8 @@ int meta_resize_gravity_from_grab_op (MetaGrabOp op);
gboolean meta_grab_op_is_moving (MetaGrabOp op); gboolean meta_grab_op_is_moving (MetaGrabOp op);
gboolean meta_grab_op_is_resizing (MetaGrabOp op); gboolean meta_grab_op_is_resizing (MetaGrabOp op);
gboolean meta_grab_op_is_mouse (MetaGrabOp op); gboolean meta_grab_op_is_mouse (MetaGrabOp op);
gboolean meta_grab_op_is_clicking (MetaGrabOp op);
gboolean meta_grab_op_is_wayland (MetaGrabOp op);
void meta_display_devirtualize_modifiers (MetaDisplay *display, void meta_display_devirtualize_modifiers (MetaDisplay *display,
MetaVirtualModifier modifiers, MetaVirtualModifier modifiers,

View File

@ -1424,6 +1424,35 @@ grab_op_should_block_mouse_events (MetaGrabOp op)
} }
} }
gboolean
meta_grab_op_is_clicking (MetaGrabOp grab_op)
{
switch (grab_op)
{
case META_GRAB_OP_CLICKING_MINIMIZE:
case META_GRAB_OP_CLICKING_MAXIMIZE:
case META_GRAB_OP_CLICKING_UNMAXIMIZE:
case META_GRAB_OP_CLICKING_DELETE:
case META_GRAB_OP_CLICKING_MENU:
case META_GRAB_OP_CLICKING_SHADE:
case META_GRAB_OP_CLICKING_UNSHADE:
case META_GRAB_OP_CLICKING_ABOVE:
case META_GRAB_OP_CLICKING_UNABOVE:
case META_GRAB_OP_CLICKING_STICK:
case META_GRAB_OP_CLICKING_UNSTICK:
return TRUE;
default:
return FALSE;
}
}
gboolean
meta_grab_op_is_wayland (MetaGrabOp op)
{
return (op != META_GRAB_OP_NONE && !meta_grab_op_is_clicking (op));
}
/** /**
* meta_display_xserver_time_is_before: * meta_display_xserver_time_is_before:
* @display: a #MetaDisplay * @display: a #MetaDisplay
@ -1748,7 +1777,7 @@ meta_display_sync_wayland_input_focus (MetaDisplay *display)
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default (); MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
MetaWindow *focus_window; MetaWindow *focus_window;
if (display->grab_op != META_GRAB_OP_NONE) if (meta_grab_op_is_wayland (display->grab_op))
focus_window = NULL; focus_window = NULL;
else if (meta_display_xwindow_is_a_no_focus_window (display, display->focus_xwindow)) else if (meta_display_xwindow_is_a_no_focus_window (display, display->focus_xwindow))
focus_window = NULL; focus_window = NULL;
@ -1759,7 +1788,7 @@ meta_display_sync_wayland_input_focus (MetaDisplay *display)
meta_wayland_compositor_set_input_focus (compositor, focus_window); meta_wayland_compositor_set_input_focus (compositor, focus_window);
if (display->grab_op != META_GRAB_OP_NONE) if (meta_grab_op_is_wayland (display->grab_op))
meta_wayland_pointer_set_focus (&compositor->seat->pointer, NULL); meta_wayland_pointer_set_focus (&compositor->seat->pointer, NULL);
else else
meta_wayland_seat_repick (compositor->seat, NULL); meta_wayland_seat_repick (compositor->seat, NULL);

View File

@ -436,7 +436,7 @@ meta_wayland_seat_repick (MetaWaylandSeat *seat,
MetaWaylandSurface *surface = NULL; MetaWaylandSurface *surface = NULL;
MetaDisplay *display = meta_get_display (); MetaDisplay *display = meta_get_display ();
if (display->grab_op != META_GRAB_OP_NONE) if (meta_grab_op_is_wayland (display->grab_op))
{ {
meta_wayland_pointer_update_current_focus (pointer, NULL); meta_wayland_pointer_update_current_focus (pointer, NULL);
return; return;