[mutter/wip/carlosg/there-can-be-only-one: 17/26] backends/native: Fix cursor renderer assignment for tablet devices
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/there-can-be-only-one: 17/26] backends/native: Fix cursor renderer assignment for tablet devices
- Date: Tue, 8 Feb 2022 14:34:51 +0000 (UTC)
commit 3ab59175c8d995948aef136eaf2b6b097a2a1041
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Jan 12 13:56:53 2022 +0100
backends/native: Fix cursor renderer assignment for tablet devices
We create a cursor renderer per device for those at
meta_seat_native_handle_event_post() with PROXIMITY_IN events, but
the MetaWaylandTabletTool handles the event before that, and goes
with a NULL cursor renderer.
Make MetaBackend::get_cursor_renderer() on the native backend create
those cursor renderers on demand, and only handle PROXIMITY_OUT in
handle_event_post() to dispose those. This makes MetaWaylandTabletTool
happily get a cursor renderer again.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/285>
src/backends/native/meta-seat-native.c | 46 ++++++++++++++++++++--------------
1 file changed, 27 insertions(+), 19 deletions(-)
---
diff --git a/src/backends/native/meta-seat-native.c b/src/backends/native/meta-seat-native.c
index 12fead1fb2..0a318f9cfd 100644
--- a/src/backends/native/meta-seat-native.c
+++ b/src/backends/native/meta-seat-native.c
@@ -63,22 +63,7 @@ meta_seat_native_handle_event_post (ClutterSeat *seat,
ClutterInputDevice *device = clutter_event_get_source_device (event);
ClutterEventType event_type = event->type;
- if (event_type == CLUTTER_PROXIMITY_IN)
- {
- MetaCursorRenderer *cursor_renderer;
-
- if (!seat_native->tablet_cursors)
- {
- seat_native->tablet_cursors = g_hash_table_new_full (NULL, NULL, NULL,
- g_object_unref);
- }
-
- cursor_renderer = meta_cursor_renderer_new (meta_get_backend (), device);
- g_hash_table_insert (seat_native->tablet_cursors,
- device, cursor_renderer);
- return TRUE;
- }
- else if (event_type == CLUTTER_PROXIMITY_OUT)
+ if (event_type == CLUTTER_PROXIMITY_OUT)
{
if (seat_native->tablet_cursors)
g_hash_table_remove (seat_native->tablet_cursors, device);
@@ -619,9 +604,32 @@ meta_seat_native_maybe_ensure_cursor_renderer (MetaSeatNative *seat_native,
return seat_native->cursor_renderer;
}
- if (seat_native->tablet_cursors &&
- clutter_input_device_get_device_type (device) == CLUTTER_TABLET_DEVICE)
- return g_hash_table_lookup (seat_native->tablet_cursors, device);
+ if (clutter_input_device_get_device_type (device) == CLUTTER_TABLET_DEVICE)
+ {
+ MetaCursorRenderer *cursor_renderer = NULL;
+
+ if (!seat_native->tablet_cursors)
+ {
+ seat_native->tablet_cursors =
+ g_hash_table_new_full (NULL, NULL, NULL,
+ g_object_unref);
+ }
+ else
+ {
+ cursor_renderer = g_hash_table_lookup (seat_native->tablet_cursors,
+ device);
+ }
+
+ if (!cursor_renderer)
+ {
+ cursor_renderer = meta_cursor_renderer_new (meta_get_backend (),
+ device);
+ g_hash_table_insert (seat_native->tablet_cursors,
+ device, cursor_renderer);
+ }
+
+ return cursor_renderer;
+ }
return NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]