[gtk/wip/carlosg/input-cleanups: 11/26] gtkwidget: Drop _gtk_widget_get_device_surface()



commit 42ed8a2748c96794f52d9dc1007fee9383d829c9
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Jun 23 12:19:20 2020 +0200

    gtkwidget: Drop _gtk_widget_get_device_surface()
    
    A widget cannot have multiple surfaces anymore, nor needs to
    fetch the last event surface as it ought to handle its own.

 gtk/gtkmain.c          |  4 ++--
 gtk/gtkwidget.c        | 35 ++---------------------------------
 gtk/gtkwidgetprivate.h |  2 --
 3 files changed, 4 insertions(+), 37 deletions(-)
---
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index 650f3ba4c4..dd1aae99cf 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -1887,12 +1887,12 @@ synth_crossing_for_grab_notify (GtkWidget        *from,
       if (!from)
         from_surface = NULL;
       else
-        from_surface = _gtk_widget_get_device_surface (from, device);
+        from_surface = gtk_native_get_surface (gtk_widget_get_native (from));
 
       if (!to)
         to_surface = NULL;
       else
-        to_surface = _gtk_widget_get_device_surface (to, device);
+        to_surface = gtk_native_get_surface (gtk_widget_get_native (to));
 
       if (from_surface || to_surface)
         {
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 551abba8a1..8cb889fef2 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -7558,32 +7558,6 @@ is_my_surface (GtkWidget *widget,
   return gdk_surface_get_widget (surface) == widget;
 }
 
-/*
- * _gtk_widget_get_device_surface:
- * @widget: a #GtkWidget
- * @device: a #GdkDevice
- *
- * Returns: (nullable): the surface of @widget that @device is in, or %NULL
- */
-GdkSurface *
-_gtk_widget_get_device_surface (GtkWidget *widget,
-                               GdkDevice *device)
-{
-  GdkSurface *surface;
-
-  g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
-  g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
-
-  if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
-    return NULL;
-
-  surface = gdk_device_get_last_event_surface (device);
-  if (surface && is_my_surface (widget, surface))
-    return surface;
-  else
-    return NULL;
-}
-
 /*
  * _gtk_widget_list_devices:
  * @widget: a #GtkWidget
@@ -7666,19 +7640,14 @@ _gtk_widget_synthesize_crossing (GtkWidget       *from,
     {
       crossing.direction = GTK_CROSSING_OUT;
 
-      from_surface = _gtk_widget_get_device_surface (from, device);
-      if (!from_surface)
-        from_surface = gtk_widget_get_surface (from);
-
+      from_surface = gtk_widget_get_surface (from);
       gdk_surface_get_device_position (from_surface, device, &x, &y, NULL);
       gtk_widget_handle_crossing (from, &crossing, x, y);
     }
 
   if (to)
     {
-      to_surface = _gtk_widget_get_device_surface (to, device);
-      if (!to_surface)
-        to_surface = gtk_widget_get_surface (to);
+      to_surface = gtk_widget_get_surface (to);
 
       crossing.direction = GTK_CROSSING_IN;
       gdk_surface_get_device_position (to_surface, device, &x, &y, NULL);
diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h
index b93ca063e6..7ff554236b 100644
--- a/gtk/gtkwidgetprivate.h
+++ b/gtk/gtkwidgetprivate.h
@@ -257,8 +257,6 @@ void              _gtk_widget_propagate_display_changed    (GtkWidget  *widget,
 void              _gtk_widget_set_device_surface           (GtkWidget *widget,
                                                             GdkDevice *device,
                                                             GdkSurface *pointer_window);
-GdkSurface *       _gtk_widget_get_device_surface          (GtkWidget *widget,
-                                                            GdkDevice *device);
 GdkDevice **       _gtk_widget_list_devices                 (GtkWidget *widget,
                                                              guint     *out_n_devices);
 


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