[gtk/wip/matthiasc/popup5: 62/139] x11: Stop using child surface api



commit b5a40398ff49d7867ed784687f7038ca67783264
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Mar 23 00:14:00 2019 -0400

    x11: Stop using child surface api
    
    We no longer have child surfaces.
    Drop code that only makes sense in
    that case.

 gdk/x11/gdkdevicemanager-core-x11.c | 29 +++--------------------------
 gdk/x11/gdkdevicemanager-xi2.c      | 24 ++----------------------
 gdk/x11/gdksurface-x11.c            |  2 +-
 gdk/x11/gdkxid.c                    |  5 ++---
 4 files changed, 8 insertions(+), 52 deletions(-)
---
diff --git a/gdk/x11/gdkdevicemanager-core-x11.c b/gdk/x11/gdkdevicemanager-core-x11.c
index ee7e369584..85c5d947f7 100644
--- a/gdk/x11/gdkdevicemanager-core-x11.c
+++ b/gdk/x11/gdkdevicemanager-core-x11.c
@@ -258,17 +258,14 @@ static void
 set_user_time (GdkSurface *surface,
                GdkEvent  *event)
 {
-  g_return_if_fail (event != NULL);
-
-  surface = gdk_surface_get_toplevel (event->any.surface);
   g_return_if_fail (GDK_IS_SURFACE (surface));
+  g_return_if_fail (event != NULL);
 
   /* If an event doesn't have a valid timestamp, we shouldn't use it
    * to update the latest user interaction time.
    */
   if (gdk_event_get_time (event) != GDK_CURRENT_TIME)
-    gdk_x11_surface_set_user_time (gdk_surface_get_toplevel (surface),
-                                  gdk_event_get_time (event));
+    gdk_x11_surface_set_user_time (surface, gdk_event_get_time (event));
 }
 
 static GdkCrossingMode
@@ -309,24 +306,6 @@ translate_notify_type (int detail)
     }
 }
 
-static gboolean
-is_parent_of (GdkSurface *parent,
-              GdkSurface *child)
-{
-  GdkSurface *w;
-
-  w = child;
-  while (w != NULL)
-    {
-      if (w == parent)
-        return TRUE;
-
-      w = gdk_surface_get_parent (w);
-    }
-
-  return FALSE;
-}
-
 static GdkSurface *
 get_event_surface (GdkEventTranslator *translator,
                   const XEvent       *xevent)
@@ -347,9 +326,7 @@ get_event_surface (GdkEventTranslator *translator,
       info = _gdk_display_has_device_grab (display,
                                            GDK_X11_DEVICE_MANAGER_CORE (translator)->core_keyboard,
                                            serial);
-      if (info &&
-          (!is_parent_of (info->surface, surface) ||
-           !info->owner_events))
+      if (info && !info->owner_events)
         {
           /* Report key event against grab surface */
           surface = info->surface;
diff --git a/gdk/x11/gdkdevicemanager-xi2.c b/gdk/x11/gdkdevicemanager-xi2.c
index 01d51d3d3a..0f0f0aadce 100644
--- a/gdk/x11/gdkdevicemanager-xi2.c
+++ b/gdk/x11/gdkdevicemanager-xi2.c
@@ -1163,7 +1163,7 @@ set_user_time (GdkEvent *event)
   GdkSurface *surface;
   guint32 time;
 
-  surface = gdk_surface_get_toplevel (event->any.surface);
+  surface = event->any.surface;
   g_return_if_fail (GDK_IS_SURFACE (surface));
 
   time = gdk_event_get_time (event);
@@ -1229,24 +1229,6 @@ translate_axes (GdkDevice       *device,
   return axes;
 }
 
-static gboolean
-is_parent_of (GdkSurface *parent,
-              GdkSurface *child)
-{
-  GdkSurface *w;
-
-  w = child;
-  while (w != NULL)
-    {
-      if (w == parent)
-        return TRUE;
-
-      w = gdk_surface_get_parent (w);
-    }
-
-  return FALSE;
-}
-
 static gboolean
 get_event_surface (GdkEventTranslator *translator,
                   XIEvent            *ev,
@@ -1288,9 +1270,7 @@ get_event_surface (GdkEventTranslator *translator,
             serial = _gdk_display_get_next_serial (display);
             info = _gdk_display_has_device_grab (display, device, serial);
 
-            if (info &&
-                (!is_parent_of (info->surface, surface) ||
-                 !info->owner_events))
+            if (info && !info->owner_events)
               {
                 /* Report key event against grab surface */
                 surface = info->surface;
diff --git a/gdk/x11/gdksurface-x11.c b/gdk/x11/gdksurface-x11.c
index 9dfeb06703..da501383fb 100644
--- a/gdk/x11/gdksurface-x11.c
+++ b/gdk/x11/gdksurface-x11.c
@@ -227,7 +227,7 @@ set_sync_counter(Display     *display,
 void
 gdk_x11_surface_pre_damage (GdkSurface *surface)
 {
-  GdkSurface *toplevel_surface = gdk_surface_get_toplevel (surface);
+  GdkSurface *toplevel_surface = surface;
   GdkSurfaceImplX11 *impl;
 
   if (!toplevel_surface || !SURFACE_IS_TOPLEVEL (toplevel_surface))
diff --git a/gdk/x11/gdkxid.c b/gdk/x11/gdkxid.c
index 93ca3c12a3..b08ffce7bf 100644
--- a/gdk/x11/gdkxid.c
+++ b/gdk/x11/gdkxid.c
@@ -62,8 +62,7 @@ _gdk_x11_display_add_window (GdkDisplay *display,
 
   g_hash_table_insert (display_x11->xid_ht, xid, data);
 
-  if (gdk_surface_get_parent (GDK_SURFACE (data)) == NULL)
-    display_x11->toplevels = g_list_prepend (display_x11->toplevels, data);
+  display_x11->toplevels = g_list_prepend (display_x11->toplevels, data);
 }
 
 void
@@ -81,7 +80,7 @@ _gdk_x11_display_remove_window (GdkDisplay *display,
     return;
 
   surface = g_hash_table_lookup (display_x11->xid_ht, &xid);
-  if (surface && gdk_surface_get_parent (surface) == NULL)
+  if (surface)
     display_x11->toplevels = g_list_remove (display_x11->toplevels, surface);
 
   g_hash_table_remove (display_x11->xid_ht, &xid);


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