diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c index 6a5fb46ee..2d798755f 100644 --- a/src/compositor/compositor.c +++ b/src/compositor/compositor.c @@ -847,29 +847,6 @@ meta_compositor_window_surface_changed (MetaCompositor *compositor, 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 event_is_passive_button_grab (MetaDisplay *display, 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, let GTK+ handle it without mangling */ 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)))) break; diff --git a/src/core/display-private.h b/src/core/display-private.h index 14725c1e8..c4548fcd0 100644 --- a/src/core/display-private.h +++ b/src/core/display-private.h @@ -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_resizing (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, MetaVirtualModifier modifiers, diff --git a/src/core/display.c b/src/core/display.c index 58dede3d1..67efd2c9c 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -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: * @display: a #MetaDisplay @@ -1748,7 +1777,7 @@ meta_display_sync_wayland_input_focus (MetaDisplay *display) MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default (); MetaWindow *focus_window; - if (display->grab_op != META_GRAB_OP_NONE) + if (meta_grab_op_is_wayland (display->grab_op)) focus_window = NULL; else if (meta_display_xwindow_is_a_no_focus_window (display, display->focus_xwindow)) focus_window = NULL; @@ -1759,7 +1788,7 @@ meta_display_sync_wayland_input_focus (MetaDisplay *display) 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); else meta_wayland_seat_repick (compositor->seat, NULL); diff --git a/src/wayland/meta-wayland-seat.c b/src/wayland/meta-wayland-seat.c index 4b08e4ac3..8ec7b2b75 100644 --- a/src/wayland/meta-wayland-seat.c +++ b/src/wayland/meta-wayland-seat.c @@ -436,7 +436,7 @@ meta_wayland_seat_repick (MetaWaylandSeat *seat, MetaWaylandSurface *surface = NULL; 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); return;