[gtk/wip/matthiasc/popup4: 35/57] Drop child surfaces



commit d844bdc8602e912bd7987c52f2424515fc803927
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Mar 22 14:24:39 2019 -0400

    Drop child surfaces
    
    Drop gdk_surface_child_new and the child surface type,
    since we no longer use them. Deprecate surface apis
    that only make sense with child surfaces.

 docs/reference/gdk/gdk4-sections.txt |   5 -
 gdk/broadway/gdksurface-broadway.c   |   3 +-
 gdk/gdkdevice.c                      |   4 +-
 gdk/gdkevents.h                      |   1 -
 gdk/gdksurface.c                     | 172 +----------------------------------
 gdk/gdksurface.h                     |  17 ----
 gdk/quartz/gdkevents-quartz.c        |   2 +-
 gdk/quartz/gdksurface-quartz.c       |  27 +-----
 gdk/wayland/gdksurface-wayland.c     |   4 +-
 gdk/win32/gdksurface-win32.c         |   6 --
 gdk/x11/gdkdisplay-x11.c             |  11 +--
 gdk/x11/gdksurface-x11.c             |  11 ---
 gtk/gtkgesture.c                     |  15 +--
 13 files changed, 15 insertions(+), 263 deletions(-)
---
diff --git a/docs/reference/gdk/gdk4-sections.txt b/docs/reference/gdk/gdk4-sections.txt
index fb68d5aec0..9f4009e42e 100644
--- a/docs/reference/gdk/gdk4-sections.txt
+++ b/docs/reference/gdk/gdk4-sections.txt
@@ -214,7 +214,6 @@ gdk_surface_move
 gdk_surface_resize
 gdk_surface_move_resize
 gdk_surface_move_to_rect
-gdk_surface_has_native
 gdk_surface_raise
 gdk_surface_lower
 gdk_surface_restack
@@ -273,10 +272,6 @@ gdk_surface_get_root_coords
 gdk_surface_get_device_position
 GdkModifierType
 GdkModifierIntent
-gdk_surface_get_parent
-gdk_surface_get_toplevel
-gdk_surface_get_children
-gdk_surface_peek_children
 gdk_surface_set_icon_name
 gdk_surface_set_transient_for
 gdk_surface_set_startup_id
diff --git a/gdk/broadway/gdksurface-broadway.c b/gdk/broadway/gdksurface-broadway.c
index 732d2a7fd6..aafc7c4e6f 100644
--- a/gdk/broadway/gdksurface-broadway.c
+++ b/gdk/broadway/gdksurface-broadway.c
@@ -46,8 +46,7 @@
 /* Forward declarations */
 static void        gdk_surface_impl_broadway_finalize   (GObject            *object);
 
-#define SURFACE_IS_TOPLEVEL(surface) \
-  (GDK_SURFACE_TYPE (surface) != GDK_SURFACE_CHILD)
+#define SURFACE_IS_TOPLEVEL(surface)  TRUE
 
 struct _GdkBroadwaySurface {
   GdkSurface parent;
diff --git a/gdk/gdkdevice.c b/gdk/gdkdevice.c
index 18640a7f74..f5dfc56cb8 100644
--- a/gdk/gdkdevice.c
+++ b/gdk/gdkdevice.c
@@ -1258,9 +1258,9 @@ gdk_device_grab (GdkDevice        *device,
   g_return_val_if_fail (GDK_IS_SURFACE (surface), GDK_GRAB_FAILED);
   g_return_val_if_fail (gdk_surface_get_display (surface) == gdk_device_get_display (device), 
GDK_GRAB_FAILED);
 
-  native = gdk_surface_get_toplevel (surface);
+  native = surface;
 
-  if (native == NULL || GDK_SURFACE_DESTROYED (native))
+  if (GDK_SURFACE_DESTROYED (native))
     return GDK_GRAB_NOT_VIEWABLE;
 
   res = GDK_DEVICE_GET_CLASS (device)->grab (device,
diff --git a/gdk/gdkevents.h b/gdk/gdkevents.h
index 73aef44431..a954f5daba 100644
--- a/gdk/gdkevents.h
+++ b/gdk/gdkevents.h
@@ -141,7 +141,6 @@ typedef union  _GdkEvent        GdkEvent;
  * @GDK_LEAVE_NOTIFY: the pointer has left the surface.
  * @GDK_FOCUS_CHANGE: the keyboard focus has entered or left the surface.
  * @GDK_CONFIGURE: the size, position or stacking order of the surface has changed.
- *   Note that GTK+ discards these events for %GDK_SURFACE_CHILD surfaces.
  * @GDK_PROXIMITY_IN: an input device has moved into contact with a sensing
  *   surface (e.g. a touchscreen or graphics tablet).
  * @GDK_PROXIMITY_OUT: an input device has moved out of contact with a sensing
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index c6b1732044..7aee9f9dbf 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -219,7 +219,7 @@ gdk_surface_init (GdkSurface *surface)
 {
   /* 0-initialization is good for all other fields. */
 
-  surface->surface_type = GDK_SURFACE_CHILD;
+  surface->surface_type = GDK_SURFACE_TOPLEVEL;
 
   surface->state = GDK_SURFACE_STATE_WITHDRAWN;
   surface->fullscreen_mode = GDK_FULLSCREEN_ON_CURRENT_MONITOR;
@@ -686,16 +686,7 @@ gdk_surface_new (GdkDisplay    *display,
   surface->alpha = 255;
 
   if (attributes->wclass == GDK_INPUT_ONLY)
-    {
-      /* Backwards compatiblity - we've always ignored
-       * attributes->surface_type for input-only surfaces
-       * before
-       */
-      if (parent == NULL)
-        surface->surface_type = GDK_SURFACE_TEMP;
-      else
-        surface->surface_type = GDK_SURFACE_CHILD;
-    }
+    surface->surface_type = GDK_SURFACE_TEMP;
   else
     surface->surface_type = attributes->surface_type;
 
@@ -707,8 +698,6 @@ gdk_surface_new (GdkDisplay    *display,
       if (parent != NULL)
         g_warning (G_STRLOC "Toplevel surfaces must be created without a parent");
       break;
-    case GDK_SURFACE_CHILD:
-      break;
     default:
       g_warning (G_STRLOC "cannot make surfaces of type %d", surface->surface_type);
       return NULL;
@@ -866,33 +855,6 @@ gdk_surface_new_temp (GdkDisplay *display)
   return gdk_surface_new (display, NULL, &attr);
 }
 
-/**
- * gdk_surface_new_child: (constructor)
- * @parent: the parent surface
- * @position: placement of the surface inside @parent
- *
- * Creates a new client-side child surface.
- *
- * Returns: (transfer full): the new #GdkSurface
- **/
-GdkSurface *
-gdk_surface_new_child (GdkSurface          *parent,
-                       const GdkRectangle *position)
-{
-  GdkSurfaceAttr attr;
-
-  g_return_val_if_fail (GDK_IS_SURFACE (parent), NULL);
-
-  attr.wclass = GDK_INPUT_OUTPUT;
-  attr.x = position->x;
-  attr.y = position->y;
-  attr.width = position->width;
-  attr.height = position->height;
-  attr.surface_type = GDK_SURFACE_CHILD;
-
-  return gdk_surface_new (gdk_surface_get_display (parent), parent, &attr);
-}
-
 static void
 update_pointer_info_foreach (GdkDisplay           *display,
                              GdkDevice            *device,
@@ -960,7 +922,6 @@ _gdk_surface_destroy_hierarchy (GdkSurface *surface,
       break;
 
     case GDK_SURFACE_TOPLEVEL:
-    case GDK_SURFACE_CHILD:
     case GDK_SURFACE_TEMP:
       if (surface->parent)
         {
@@ -1124,22 +1085,6 @@ gdk_surface_is_destroyed (GdkSurface *surface)
   return GDK_SURFACE_DESTROYED (surface);
 }
 
-/**
- * gdk_surface_has_native:
- * @surface: a #GdkSurface
- *
- * Checks whether the surface has a native surface or not.
- *
- * Returns: %TRUE if the @surface has a native surface, %FALSE otherwise.
- */
-gboolean
-gdk_surface_has_native (GdkSurface *surface)
-{
-  g_return_val_if_fail (GDK_IS_SURFACE (surface), FALSE);
-
-  return surface->parent == NULL || surface->parent->impl != surface->impl;
-}
-
 /**
  * gdk_surface_get_position:
  * @surface: a #GdkSurface
@@ -1168,101 +1113,6 @@ gdk_surface_get_position (GdkSurface *surface,
     *y = surface->y;
 }
 
-/**
- * gdk_surface_get_parent:
- * @surface: a #GdkSurface
- *
- * Obtains the parent of @surface, as known to GDK. Does not query the
- * X server; thus this returns the parent as passed to gdk_surface_new(),
- * not the actual parent. This should never matter unless you’re using
- * Xlib calls mixed with GDK calls on the X11 platform. It may also
- * matter for toplevel windows, because the window manager may choose
- * to reparent them.
- *
- * Returns: (transfer none): parent of @surface
- **/
-GdkSurface*
-gdk_surface_get_parent (GdkSurface *surface)
-{
-  g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
-
-  return surface->parent;
-}
-
-/**
- * gdk_surface_get_toplevel:
- * @surface: a #GdkSurface
- *
- * Gets the toplevel surface that’s an ancestor of @surface.
- *
- * Any surface type but %GDK_SURFACE_CHILD is considered a
- * toplevel surface, as is a %GDK_SURFACE_CHILD surface that
- * has a root surface as parent.
- *
- * Returns: (transfer none): the toplevel surface containing @surface
- **/
-GdkSurface *
-gdk_surface_get_toplevel (GdkSurface *surface)
-{
-  g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
-
-  while (surface->surface_type == GDK_SURFACE_CHILD)
-    {
-      if (gdk_surface_is_toplevel (surface))
-        break;
-      surface = surface->parent;
-    }
-
-  return surface;
-}
-
-/**
- * gdk_surface_get_children:
- * @surface: a #GdkSurface
- *
- * Gets the list of children of @surface known to GDK.
- * This function only returns children created via GDK,
- * so for example it’s useless when used with the root window;
- * it only returns surfaces an application created itself.
- *
- * The returned list must be freed, but the elements in the
- * list need not be.
- *
- * Returns: (transfer container) (element-type GdkSurface):
- *     list of child surfaces inside @surface
- **/
-GList*
-gdk_surface_get_children (GdkSurface *surface)
-{
-  g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
-
-  if (GDK_SURFACE_DESTROYED (surface))
-    return NULL;
-
-  return g_list_copy (surface->children);
-}
-
-/**
- * gdk_surface_peek_children:
- * @surface: a #GdkSurface
- *
- * Like gdk_surface_get_children(), but does not copy the list of
- * children, so the list does not need to be freed.
- *
- * Returns: (transfer none) (element-type GdkSurface):
- *     a reference to the list of child surfaces in @surface
- **/
-GList *
-gdk_surface_peek_children (GdkSurface *surface)
-{
-  g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
-
-  if (GDK_SURFACE_DESTROYED (surface))
-    return NULL;
-
-  return surface->children;
-}
-
 /**
  * gdk_surface_is_visible:
  * @surface: a #GdkSurface
@@ -1593,11 +1443,7 @@ gdk_surface_remove_update_surface (GdkSurface *surface)
 static gboolean
 gdk_surface_is_toplevel_frozen (GdkSurface *surface)
 {
-  GdkSurface *toplevel;
-
-  toplevel = gdk_surface_get_toplevel (surface);
-
-  return toplevel->update_and_descendants_freeze_count > 0;
+  return surface->update_and_descendants_freeze_count > 0;
 }
 
 static void
@@ -1914,7 +1760,6 @@ void
 gdk_surface_freeze_toplevel_updates (GdkSurface *surface)
 {
   g_return_if_fail (GDK_IS_SURFACE (surface));
-  g_return_if_fail (surface->surface_type != GDK_SURFACE_CHILD);
 
   surface->update_and_descendants_freeze_count++;
   _gdk_frame_clock_freeze (gdk_surface_get_frame_clock (surface));
@@ -1924,7 +1769,6 @@ void
 gdk_surface_thaw_toplevel_updates (GdkSurface *surface)
 {
   g_return_if_fail (GDK_IS_SURFACE (surface));
-  g_return_if_fail (surface->surface_type != GDK_SURFACE_CHILD);
   g_return_if_fail (surface->update_and_descendants_freeze_count > 0);
 
   surface->update_and_descendants_freeze_count--;
@@ -3886,8 +3730,7 @@ gdk_surface_print (GdkSurface *surface,
 #endif
     }
 
-  if (surface->surface_type != GDK_SURFACE_CHILD)
-    g_print (" %s", surface_types[surface->surface_type]);
+  g_print (" %s", surface_types[surface->surface_type]);
 
   if (surface->input_only)
     g_print (" input-only");
@@ -5114,13 +4957,9 @@ gdk_surface_set_frame_clock (GdkSurface     *surface,
 GdkFrameClock*
 gdk_surface_get_frame_clock (GdkSurface *surface)
 {
-  GdkSurface *toplevel;
-
   g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
 
-  toplevel = gdk_surface_get_toplevel (surface);
-
-  return toplevel->frame_clock;
+  return surface->frame_clock;
 }
 
 /**
@@ -5358,7 +5197,6 @@ gdk_surface_set_state (GdkSurface      *surface,
     case GDK_SURFACE_TEMP: /* ? */
       g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_STATE]);
       break;
-    case GDK_SURFACE_CHILD:
     default:
       break;
     }
diff --git a/gdk/gdksurface.h b/gdk/gdksurface.h
index b14d3411c4..dc7021136d 100644
--- a/gdk/gdksurface.h
+++ b/gdk/gdksurface.h
@@ -42,7 +42,6 @@ typedef struct _GdkGeometry          GdkGeometry;
 /**
  * GdkSurfaceType:
  * @GDK_SURFACE_TOPLEVEL: toplevel window (used to implement #GtkWindow)
- * @GDK_SURFACE_CHILD: child surface (used to implement e.g. #GtkEntry)
  * @GDK_SURFACE_TEMP: override redirect temporary surface (used to implement #GtkMenu)
  *
  * Describes the kind of surface.
@@ -50,7 +49,6 @@ typedef struct _GdkGeometry          GdkGeometry;
 typedef enum
 {
   GDK_SURFACE_TOPLEVEL,
-  GDK_SURFACE_CHILD,
   GDK_SURFACE_TEMP
 } GdkSurfaceType;
 
@@ -444,9 +442,6 @@ GdkSurface *   gdk_surface_new_popup_full       (GdkDisplay    *display,
                                                  GdkSurface    *parent);
 GDK_AVAILABLE_IN_ALL
 GdkSurface *   gdk_surface_new_temp             (GdkDisplay    *display);
-GDK_AVAILABLE_IN_ALL
-GdkSurface *   gdk_surface_new_child            (GdkSurface     *parent,
-                                                 const GdkRectangle *position);
 
 GDK_AVAILABLE_IN_ALL
 void          gdk_surface_destroy               (GdkSurface     *surface);
@@ -544,8 +539,6 @@ GdkSurfaceState gdk_surface_get_state (GdkSurface *surface);
 
 /* GdkSurface */
 
-GDK_AVAILABLE_IN_ALL
-gboolean      gdk_surface_has_native         (GdkSurface       *surface);
 GDK_AVAILABLE_IN_ALL
 void              gdk_surface_set_type_hint (GdkSurface        *surface,
                                              GdkSurfaceTypeHint hint);
@@ -649,16 +642,6 @@ GdkSurface *   gdk_surface_get_device_position (GdkSurface      *surface,
                                                 double          *x,
                                                 double          *y,
                                                 GdkModifierType *mask);
-GDK_AVAILABLE_IN_ALL
-GdkSurface *   gdk_surface_get_parent      (GdkSurface       *surface);
-GDK_AVAILABLE_IN_ALL
-GdkSurface *   gdk_surface_get_toplevel    (GdkSurface       *surface);
-
-GDK_AVAILABLE_IN_ALL
-GList *       gdk_surface_get_children   (GdkSurface      *surface);
-GDK_AVAILABLE_IN_ALL
-GList *       gdk_surface_peek_children   (GdkSurface       *surface);
-
 GDK_AVAILABLE_IN_ALL
 void          gdk_surface_set_icon_list   (GdkSurface       *surface,
                                            GList           *surfaces);
diff --git a/gdk/quartz/gdkevents-quartz.c b/gdk/quartz/gdkevents-quartz.c
index 4bd50478eb..775e14ba90 100644
--- a/gdk/quartz/gdkevents-quartz.c
+++ b/gdk/quartz/gdkevents-quartz.c
@@ -39,7 +39,7 @@
 #define GRIP_HEIGHT 15
 #define GDK_LION_RESIZE 5
 
-#define SURFACE_IS_TOPLEVEL(window)      (GDK_SURFACE_TYPE (window) != GDK_SURFACE_CHILD)
+#define SURFACE_IS_TOPLEVEL(window)      TRUE
 
 /* This is the window corresponding to the key window */
 static GdkSurface   *current_keyboard_window;
diff --git a/gdk/quartz/gdksurface-quartz.c b/gdk/quartz/gdksurface-quartz.c
index 86ed03487e..ab14161191 100644
--- a/gdk/quartz/gdksurface-quartz.c
+++ b/gdk/quartz/gdksurface-quartz.c
@@ -62,7 +62,7 @@ static FullscreenSavedGeometry *get_fullscreen_geometry (GdkSurface *window);
 static void update_toplevel_order (void);
 static void clear_toplevel_order  (void);
 
-#define SURFACE_IS_TOPLEVEL(window)      (GDK_SURFACE_TYPE (window) != GDK_SURFACE_CHILD)
+#define SURFACE_IS_TOPLEVEL(window)      TRUE
 
 /*
  * GdkQuartzSurface
@@ -827,29 +827,6 @@ _gdk_quartz_display_create_surface_impl (GdkDisplay    *display,
       }
       break;
 
-    case GDK_SURFACE_CHILD:
-      {
-       GdkSurfaceImplQuartz *parent_impl = GDK_SURFACE_IMPL_QUARTZ (window->parent->impl);
-
-       if (!window->input_only)
-         {
-           NSRect frame_rect = NSMakeRect (window->x + window->parent->abs_x,
-                                            window->y + window->parent->abs_y,
-                                            window->width,
-                                            window->height);
-       
-           impl->view = [[GdkQuartzView alloc] initWithFrame:frame_rect];
-           
-           [impl->view setGdkSurface:window];
-
-           /* GdkSurfaces should be hidden by default */
-           [impl->view setHidden:YES];
-           [parent_impl->view addSubview:impl->view];
-           [impl->view release];
-         }
-      }
-      break;
-
     default:
       g_assert_not_reached ();
     }
@@ -2620,8 +2597,6 @@ gdk_quartz_surface_set_keep_below (GdkSurface *window,
 static GdkSurface *
 gdk_quartz_surface_get_group (GdkSurface *window)
 {
-  g_return_val_if_fail (GDK_SURFACE_TYPE (window) != GDK_SURFACE_CHILD, NULL);
-
   if (GDK_SURFACE_DESTROYED (window) ||
       !SURFACE_IS_TOPLEVEL (window))
     return NULL;
diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c
index a6a2db42fd..3d06742cd9 100644
--- a/gdk/wayland/gdksurface-wayland.c
+++ b/gdk/wayland/gdksurface-wayland.c
@@ -48,8 +48,7 @@ enum {
 
 static guint signals[LAST_SIGNAL];
 
-#define SURFACE_IS_TOPLEVEL(surface) \
-  (GDK_SURFACE_TYPE (surface) != GDK_SURFACE_CHILD)
+#define SURFACE_IS_TOPLEVEL(surface)  TRUE
 
 #define MAX_WL_BUFFER_SIZE (4083) /* 4096 minus header, string argument length and NUL byte */
 
@@ -581,7 +580,6 @@ _gdk_wayland_display_create_surface_impl (GdkDisplay     *display,
       gdk_surface_set_title (surface, get_default_title ());
       break;
 
-    case GDK_SURFACE_CHILD:
     default:
       break;
     }
diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c
index e5a945c9bf..e735d1270a 100644
--- a/gdk/win32/gdksurface-win32.c
+++ b/gdk/win32/gdksurface-win32.c
@@ -499,7 +499,6 @@ RegisterGdkClass (GdkSurfaceType wtype, GdkSurfaceTypeHint wtype_hint)
         }
       break;
 
-    case GDK_SURFACE_CHILD:
     default:
       g_assert_not_reached ();
       break;
@@ -612,7 +611,6 @@ _gdk_win32_display_create_surface_impl (GdkDisplay    *display,
       break;
 
 
-    case GDK_SURFACE_CHILD:
     default:
       g_assert_not_reached ();
     }
@@ -1192,10 +1190,6 @@ gdk_win32_surface_move (GdkSurface *window,
   if (window->state & GDK_SURFACE_STATE_FULLSCREEN)
     return;
 
-  /* Don't check GDK_SURFACE_TYPE (window) == GDK_SURFACE_CHILD.
-   * Foreign windows (another app's windows) might be children of our
-   * windows! Especially in the case of gtkplug/socket.
-   */
   if (GetAncestor (GDK_SURFACE_HWND (window), GA_PARENT) != GetDesktopWindow ())
     {
       _gdk_surface_move_resize_child (window, x, y, window->width, window->height);
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index ca1237e703..003881359d 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -931,13 +931,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
                           xevent->xconfigure.border_width,
                           xevent->xconfigure.above,
                           xevent->xconfigure.override_redirect,
-                          !surface
-                          ? " (discarding)"
-                          : surface->surface_type == GDK_SURFACE_CHILD
-                          ? " (discarding child)"
-                          : xevent->xconfigure.event != xevent->xconfigure.window
-                          ? " (discarding substructure)"
-                          : ""));
+                          !surface ? " (discarding)" : ""));
       if (_gdk_x11_display_is_root_window (display, xevent->xconfigure.window))
         {
          _gdk_x11_screen_size_changed (x11_screen, xevent);
@@ -953,8 +947,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
 #endif
 
     if (!surface ||
-         xevent->xconfigure.event != xevent->xconfigure.window ||
-          GDK_SURFACE_TYPE (surface) == GDK_SURFACE_CHILD)
+         xevent->xconfigure.event != xevent->xconfigure.window)
        return_val = FALSE;
       else
        {
diff --git a/gdk/x11/gdksurface-x11.c b/gdk/x11/gdksurface-x11.c
index d23667c1e3..7c680ce402 100644
--- a/gdk/x11/gdksurface-x11.c
+++ b/gdk/x11/gdksurface-x11.c
@@ -870,7 +870,6 @@ _gdk_x11_display_create_surface_impl (GdkDisplay    *display,
         }
       break;
 
-    case GDK_SURFACE_CHILD:
     default:
       g_assert_not_reached ();
       break;
@@ -969,7 +968,6 @@ _gdk_x11_display_create_surface_impl (GdkDisplay    *display,
       setup_toplevel_window (surface, x11_screen);
       break;
 
-    case GDK_SURFACE_CHILD:
     default:
       break;
     }
@@ -1319,7 +1317,6 @@ gdk_surface_x11_hide (GdkSurface *surface)
       gdk_surface_x11_withdraw (surface);
       return;
       
-    case GDK_SURFACE_CHILD:
     default:
       break;
     }
@@ -1525,7 +1522,6 @@ gdk_x11_surface_move_to_current_desktop (GdkSurface *surface)
   GdkToplevelX11 *toplevel;
 
   g_return_if_fail (GDK_IS_SURFACE (surface));
-  g_return_if_fail (GDK_SURFACE_TYPE (surface) != GDK_SURFACE_CHILD);
 
   toplevel = _gdk_x11_surface_get_toplevel (surface);
 
@@ -1873,8 +1869,6 @@ gdk_x11_surface_set_skip_taskbar_hint (GdkSurface *surface,
 {
   GdkToplevelX11 *toplevel;
   
-  g_return_if_fail (GDK_SURFACE_TYPE (surface) != GDK_SURFACE_CHILD);
-  
   if (GDK_SURFACE_DESTROYED (surface) ||
       !SURFACE_IS_TOPLEVEL (surface))
     return;
@@ -1894,8 +1888,6 @@ gdk_x11_surface_set_skip_pager_hint (GdkSurface *surface,
 {
   GdkToplevelX11 *toplevel;
     
-  g_return_if_fail (GDK_SURFACE_TYPE (surface) != GDK_SURFACE_CHILD);
-  
   if (GDK_SURFACE_DESTROYED (surface) ||
       !SURFACE_IS_TOPLEVEL (surface))
     return;
@@ -1915,8 +1907,6 @@ gdk_x11_surface_set_urgency_hint (GdkSurface *surface,
 {
   GdkToplevelX11 *toplevel;
     
-  g_return_if_fail (GDK_SURFACE_TYPE (surface) != GDK_SURFACE_CHILD);
-  
   if (GDK_SURFACE_DESTROYED (surface) ||
       !SURFACE_IS_TOPLEVEL (surface))
     return;
@@ -3384,7 +3374,6 @@ gdk_x11_surface_set_group (GdkSurface *surface,
   GdkToplevelX11 *toplevel;
   
   g_return_if_fail (GDK_IS_SURFACE (surface));
-  g_return_if_fail (GDK_SURFACE_TYPE (surface) != GDK_SURFACE_CHILD);
   g_return_if_fail (leader == NULL || GDK_IS_SURFACE (leader));
 
   if (GDK_SURFACE_DESTROYED (surface) ||
diff --git a/gtk/gtkgesture.c b/gtk/gtkgesture.c
index 7276a3043d..2125af2bf1 100644
--- a/gtk/gtkgesture.c
+++ b/gtk/gtkgesture.c
@@ -600,23 +600,12 @@ _gtk_gesture_cancel_all (GtkGesture *gesture)
 
 static gboolean
 gesture_within_surface (GtkGesture *gesture,
-                        GdkSurface  *parent)
+                        GdkSurface  *surface)
 {
-  GdkSurface *surface;
   GtkWidget *widget;
 
   widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
-  surface = gtk_widget_get_surface (widget);
-
-  while (surface)
-    {
-      if (surface == parent)
-        return TRUE;
-
-      surface = gdk_surface_get_parent (surface);
-    }
-
-  return FALSE;
+  return surface == gtk_widget_get_surface (widget);
 }
 
 static gboolean


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