[mutter/wip/carlosg/input-thread: 5/6] core: Do not update last device on CLUTTER_DEVICE_ADDED/REMOVED




commit 1392b22831d949d8ff6dddb6a78d7b9d4811245f
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Sep 25 18:49:19 2020 +0200

    core: Do not update last device on CLUTTER_DEVICE_ADDED/REMOVED
    
    We only update the last device from actual input interaction here,
    avoid this pair of events. This is specially nasty with
    CLUTTER_DEVICE_REMOVED, since the device we're notifying upon will be
    disposed soon after emission.
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403

 src/core/events.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/core/events.c b/src/core/events.c
index 2cde9ca8e6..afaa002a71 100644
--- a/src/core/events.c
+++ b/src/core/events.c
@@ -205,7 +205,7 @@ meta_display_handle_event (MetaDisplay        *display,
   G_GNUC_UNUSED gboolean bypass_wayland = FALSE;
   MetaGestureTracker *gesture_tracker;
   ClutterEventSequence *sequence;
-  ClutterInputDevice *source;
+  ClutterInputDevice *source = NULL;
 
   sequence = clutter_event_get_event_sequence (event);
 
@@ -270,7 +270,9 @@ meta_display_handle_event (MetaDisplay        *display,
         }
     }
 
-  source = clutter_event_get_source_device (event);
+  if (event->type != CLUTTER_DEVICE_ADDED &&
+      event->type != CLUTTER_DEVICE_REMOVED)
+    source = clutter_event_get_source_device (event);
 
   if (source)
     meta_backend_update_last_device (backend, source);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]