[mutter] wayland/pointer: Add support for the new ClutterSeat inhibit-unfocus API
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] wayland/pointer: Add support for the new ClutterSeat inhibit-unfocus API
- Date: Mon, 24 Feb 2020 10:06:23 +0000 (UTC)
commit bf24b816c29431024f46151d356d5d6a47fd85a3
Author: Jonas Dreßler <verdre v0yd nl>
Date: Wed Feb 19 21:19:19 2020 +0100
wayland/pointer: Add support for the new ClutterSeat inhibit-unfocus API
The last commit added a new API to ClutterSeat to inhibit setting the
focus-surface of the MetaWaylandPointer to NULL, let's do that.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1077
src/wayland/meta-wayland-pointer.c | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
---
diff --git a/src/wayland/meta-wayland-pointer.c b/src/wayland/meta-wayland-pointer.c
index 0a8e4c929..5ef36a9f3 100644
--- a/src/wayland/meta-wayland-pointer.c
+++ b/src/wayland/meta-wayland-pointer.c
@@ -227,8 +227,11 @@ sync_focus_surface (MetaWaylandPointer *pointer)
MetaDisplay *display = meta_get_display ();
MetaBackend *backend = meta_get_backend ();
MetaCursorTracker *cursor_tracker = meta_backend_get_cursor_tracker (backend);
+ ClutterBackend *clutter_backend = clutter_get_default_backend ();
+ ClutterSeat *clutter_seat = clutter_backend_get_default_seat (clutter_backend);
- if (!meta_cursor_tracker_get_pointer_visible (cursor_tracker))
+ if (!meta_cursor_tracker_get_pointer_visible (cursor_tracker) &&
+ !clutter_seat_is_unfocus_inhibited (clutter_seat))
{
meta_wayland_pointer_set_focus (pointer, NULL);
return;
@@ -430,11 +433,14 @@ default_grab_focus (MetaWaylandPointerGrab *grab,
MetaDisplay *display = meta_get_display ();
MetaBackend *backend = meta_get_backend ();
MetaCursorTracker *cursor_tracker = meta_backend_get_cursor_tracker (backend);
+ ClutterBackend *clutter_backend = clutter_get_default_backend ();
+ ClutterSeat *clutter_seat = clutter_backend_get_default_seat (clutter_backend);
if (!meta_wayland_seat_has_pointer (seat))
return;
- if (!meta_cursor_tracker_get_pointer_visible (cursor_tracker))
+ if (!meta_cursor_tracker_get_pointer_visible (cursor_tracker) &&
+ !clutter_seat_is_unfocus_inhibited (clutter_seat))
return;
if (pointer->button_count > 0)
@@ -520,6 +526,11 @@ meta_wayland_pointer_enable (MetaWaylandPointer *pointer)
"visibility-changed",
G_CALLBACK (meta_wayland_pointer_on_cursor_visibility_changed),
pointer);
+
+ g_signal_connect_swapped (clutter_seat,
+ "is-unfocus-inhibited-changed",
+ G_CALLBACK (sync_focus_surface),
+ pointer);
}
void
@@ -527,6 +538,8 @@ meta_wayland_pointer_disable (MetaWaylandPointer *pointer)
{
MetaBackend *backend = meta_get_backend ();
MetaCursorTracker *cursor_tracker = meta_backend_get_cursor_tracker (backend);
+ ClutterBackend *clutter_backend = clutter_get_default_backend ();
+ ClutterSeat *clutter_seat = clutter_backend_get_default_seat (clutter_backend);
g_signal_handlers_disconnect_by_func (cursor_tracker,
(gpointer) meta_wayland_pointer_on_cursor_changed,
@@ -536,6 +549,10 @@ meta_wayland_pointer_disable (MetaWaylandPointer *pointer)
meta_wayland_pointer_on_cursor_visibility_changed,
pointer);
+ g_signal_handlers_disconnect_by_func (clutter_seat,
+ sync_focus_surface,
+ pointer);
+
if (pointer->cursor_surface)
{
g_clear_signal_handler (&pointer->cursor_surface_destroy_id,
@@ -897,9 +914,12 @@ meta_wayland_pointer_set_focus (MetaWaylandPointer *pointer,
MetaWaylandInputDevice *input_device = META_WAYLAND_INPUT_DEVICE (pointer);
MetaBackend *backend = meta_get_backend ();
MetaCursorTracker *cursor_tracker = meta_backend_get_cursor_tracker (backend);
+ ClutterBackend *clutter_backend = clutter_get_default_backend ();
+ ClutterSeat *clutter_seat = clutter_backend_get_default_seat (clutter_backend);
g_return_if_fail (meta_cursor_tracker_get_pointer_visible (cursor_tracker) ||
- surface == NULL);
+ clutter_seat_is_unfocus_inhibited (clutter_seat) ||
+ surface == NULL);
if (pointer->focus_surface == surface)
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]