[gtk/wip/carlosg/more-device-api-cleanup: 7/13] gtktextview: Avoid gdk_device_get_associated_device()




commit 335764c012bc37b864141b73b803548ff933ded1
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Jul 30 14:29:12 2020 +0200

    gtktextview: Avoid gdk_device_get_associated_device()
    
    Query the seat for that.

 gtk/gtktextview.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index f59b259277..a61a163c1b 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -8601,6 +8601,7 @@ gtk_text_view_do_popup (GtkTextView *text_view,
                         GdkEvent    *trigger_event)
 {
   GtkTextViewPrivate *priv = text_view->priv;
+  GdkSeat *seat;
 
   if (!gtk_widget_get_realized (GTK_WIDGET (text_view)))
     return;
@@ -8628,12 +8629,14 @@ gtk_text_view_do_popup (GtkTextView *text_view,
   if (trigger_event && gdk_event_triggers_context_menu (trigger_event))
     {
       GdkDevice *device;
+      GdkSeat *seat;
       GdkRectangle rect = { 0, 0, 1, 1 };
 
       device = gdk_event_get_device (trigger_event);
+      seat = gdk_event_get_seat (trigger_event);
 
-      if (device && gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
-        device = gdk_device_get_associated_device (device);
+      if (device == gdk_seat_get_keyboard (seat))
+        device = gdk_seat_get_pointer (seat);
 
       if (device)
         {


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