[gtk] gdk: Remove GDK_SURFACE_FOREIGN



commit d13843ee2a5e2afabe6418cc7e9e744258a3fc5d
Author: Benjamin Otte <otte redhat com>
Date:   Tue Jun 26 00:47:40 2018 +0200

    gdk: Remove GDK_SURFACE_FOREIGN
    
    We don't create surfaces of that type anymore.

 gdk/gdkdisplay.c              |   3 +-
 gdk/gdksurface.c              | 154 ++++++++++++++++--------------------------
 gdk/gdksurface.h              |   2 -
 gdk/win32/gdkdevice-win32.c   |   3 +-
 gdk/win32/gdkgeometry-win32.c |   6 +-
 gdk/win32/gdksurface-win32.c  |  41 ++++-------
 gdk/x11/gdkdevice-core-x11.c  |   3 +-
 gdk/x11/gdkdevice-xi2.c       |   3 +-
 gdk/x11/gdkdnd-x11.c          |   2 +-
 gdk/x11/gdkdrop-x11.c         |   3 -
 gdk/x11/gdksurface-x11.c      | 103 ++++++++++++----------------
 11 files changed, 123 insertions(+), 200 deletions(-)
---
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index acfa0c13d9..8485e4f893 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -631,8 +631,7 @@ get_current_toplevel (GdkDisplay      *display,
   pointer_surface = _gdk_device_surface_at_position (device, &x, &y, &state, TRUE);
 
   if (pointer_surface != NULL &&
-      (GDK_SURFACE_DESTROYED (pointer_surface) ||
-       GDK_SURFACE_TYPE (pointer_surface) == GDK_SURFACE_FOREIGN))
+      GDK_SURFACE_DESTROYED (pointer_surface))
     pointer_surface = NULL;
 
   *x_out = round (x);
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index 27d7b3cb95..c9a27018b5 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -333,16 +333,8 @@ gdk_surface_finalize (GObject *object)
 
   if (!GDK_SURFACE_DESTROYED (surface))
     {
-      if (GDK_SURFACE_TYPE (surface) != GDK_SURFACE_FOREIGN)
-        {
-          g_warning ("losing last reference to undestroyed surface");
-          _gdk_surface_destroy (surface, FALSE);
-        }
-      else
-        /* We use TRUE here, to keep us from actually calling
-         * XDestroyWindow() on the window
-         */
-        _gdk_surface_destroy (surface, TRUE);
+      g_warning ("losing last reference to undestroyed surface");
+      _gdk_surface_destroy (surface, FALSE);
     }
 
   if (surface->impl)
@@ -656,12 +648,6 @@ gdk_surface_new (GdkDisplay    *display,
 #endif
       break;
     case GDK_SURFACE_CHILD:
-      if (GDK_SURFACE_TYPE (parent) == GDK_SURFACE_FOREIGN)
-        {
-          g_warning (G_STRLOC "Child surfaces must not be created as children of\n"
-                     "a surface of type GDK_SURFACE_FOREIGN");
-          return NULL;
-        }
       break;
     default:
       g_warning (G_STRLOC "cannot make surfaces of type %d", surface->surface_type);
@@ -897,81 +883,69 @@ _gdk_surface_destroy_hierarchy (GdkSurface *surface,
     case GDK_SURFACE_TOPLEVEL:
     case GDK_SURFACE_CHILD:
     case GDK_SURFACE_TEMP:
-    case GDK_SURFACE_FOREIGN:
     case GDK_SURFACE_SUBSURFACE:
-      if (surface->surface_type == GDK_SURFACE_FOREIGN && !foreign_destroy)
-        {
-        }
-      else
+      if (surface->parent)
         {
-          if (surface->parent)
-            {
-              if (surface->parent->children)
-                surface->parent->children = g_list_remove_link (surface->parent->children, 
&surface->children_list_node);
+          if (surface->parent->children)
+            surface->parent->children = g_list_remove_link (surface->parent->children, 
&surface->children_list_node);
 
-              if (!recursing &&
-                  GDK_SURFACE_IS_MAPPED (surface))
-                {
-                  recompute_visible_regions (surface, FALSE);
-                  gdk_surface_invalidate_in_parent (surface);
-                }
-            }
-
-          if (surface->gl_paint_context)
+          if (!recursing &&
+              GDK_SURFACE_IS_MAPPED (surface))
             {
-              /* Make sure to destroy if current */
-              g_object_run_dispose (G_OBJECT (surface->gl_paint_context));
-              g_object_unref (surface->gl_paint_context);
-              surface->gl_paint_context = NULL;
+              recompute_visible_regions (surface, FALSE);
+              gdk_surface_invalidate_in_parent (surface);
             }
+        }
 
-          if (surface->frame_clock)
-            {
-              g_object_run_dispose (G_OBJECT (surface->frame_clock));
-              gdk_surface_set_frame_clock (surface, NULL);
-            }
+      if (surface->gl_paint_context)
+        {
+          /* Make sure to destroy if current */
+          g_object_run_dispose (G_OBJECT (surface->gl_paint_context));
+          g_object_unref (surface->gl_paint_context);
+          surface->gl_paint_context = NULL;
+        }
 
-          if (surface->surface_type == GDK_SURFACE_FOREIGN)
-            g_assert (surface->children == NULL);
-          else
-            {
-              tmp = surface->children;
-              surface->children = NULL;
-              /* No need to free children list, its all made up of in-struct nodes */
+      if (surface->frame_clock)
+        {
+          g_object_run_dispose (G_OBJECT (surface->frame_clock));
+          gdk_surface_set_frame_clock (surface, NULL);
+        }
 
-              while (tmp)
-                {
-                  temp_surface = tmp->data;
-                  tmp = tmp->next;
-
-                  if (temp_surface)
-                    _gdk_surface_destroy_hierarchy (temp_surface,
-                                                   TRUE,
-                                                   recursing_native || gdk_surface_has_impl (surface),
-                                                   foreign_destroy);
-                }
-            }
+      tmp = surface->children;
+      surface->children = NULL;
+      /* No need to free children list, its all made up of in-struct nodes */
 
-          _gdk_surface_clear_update_area (surface);
+      while (tmp)
+        {
+          temp_surface = tmp->data;
+          tmp = tmp->next;
+
+          if (temp_surface)
+            _gdk_surface_destroy_hierarchy (temp_surface,
+                                           TRUE,
+                                           recursing_native || gdk_surface_has_impl (surface),
+                                           foreign_destroy);
+        }
 
-          impl_class = GDK_SURFACE_IMPL_GET_CLASS (surface->impl);
+      _gdk_surface_clear_update_area (surface);
 
-          if (gdk_surface_has_impl (surface))
-            impl_class->destroy (surface, recursing_native, foreign_destroy);
-          else
-            {
-              /* hide to make sure we repaint and break grabs */
-              gdk_surface_hide (surface);
-            }
+      impl_class = GDK_SURFACE_IMPL_GET_CLASS (surface->impl);
 
-          surface->state |= GDK_SURFACE_STATE_WITHDRAWN;
-          surface->parent = NULL;
-          surface->destroyed = TRUE;
+      if (gdk_surface_has_impl (surface))
+        impl_class->destroy (surface, recursing_native, foreign_destroy);
+      else
+        {
+          /* hide to make sure we repaint and break grabs */
+          gdk_surface_hide (surface);
+        }
 
-          surface_remove_from_pointer_info (surface, display);
+      surface->state |= GDK_SURFACE_STATE_WITHDRAWN;
+      surface->parent = NULL;
+      surface->destroyed = TRUE;
 
-          g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_STATE]);
-        }
+      surface_remove_from_pointer_info (surface, display);
+
+      g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_STATE]);
       break;
     }
 }
@@ -2235,10 +2209,8 @@ _gdk_surface_update_viewable (GdkSurface *surface)
 {
   gboolean viewable;
 
-  if (surface->surface_type == GDK_SURFACE_FOREIGN)
-    viewable = TRUE;
-  else if (gdk_surface_is_toplevel (surface) ||
-           surface->parent->viewable)
+  if (gdk_surface_is_toplevel (surface) ||
+      surface->parent->viewable)
     viewable = GDK_SURFACE_IS_MAPPED (surface);
   else
     viewable = FALSE;
@@ -2899,24 +2871,19 @@ gdk_surface_set_cursor_internal (GdkSurface *surface,
                                  GdkDevice *device,
                                  GdkCursor *cursor)
 {
+  GdkPointerSurfaceInfo *pointer_info;
+  GdkDisplay *display;
+
   if (GDK_SURFACE_DESTROYED (surface))
     return;
 
   g_assert (gdk_surface_get_display (surface) == gdk_device_get_display (device));
 
-  if (surface->surface_type == GDK_SURFACE_FOREIGN)
-    GDK_DEVICE_GET_CLASS (device)->set_surface_cursor (device, surface, cursor);
-  else
-    {
-      GdkPointerSurfaceInfo *pointer_info;
-      GdkDisplay *display;
-
-      display = gdk_surface_get_display (surface);
-      pointer_info = _gdk_display_get_pointer_info (display, device);
+  display = gdk_surface_get_display (surface);
+  pointer_info = _gdk_display_get_pointer_info (display, device);
 
-      if (_gdk_surface_event_parent_of (surface, pointer_info->surface_under_pointer))
-        update_cursor (display, device);
-    }
+  if (_gdk_surface_event_parent_of (surface, pointer_info->surface_under_pointer))
+    update_cursor (display, device);
 }
 
 /**
@@ -5525,7 +5492,6 @@ gdk_surface_set_state (GdkSurface      *surface,
     case GDK_SURFACE_TEMP: /* ? */
       g_object_notify (G_OBJECT (surface), "state");
       break;
-    case GDK_SURFACE_FOREIGN:
     case GDK_SURFACE_CHILD:
     default:
       break;
diff --git a/gdk/gdksurface.h b/gdk/gdksurface.h
index 29e3eed820..bfb8f5aeff 100644
--- a/gdk/gdksurface.h
+++ b/gdk/gdksurface.h
@@ -45,7 +45,6 @@ typedef struct _GdkGeometry          GdkGeometry;
  * @GDK_SURFACE_CHILD: child surface (used to implement e.g. #GtkEntry)
  * @GDK_SURFACE_TEMP: override redirect temporary surface (used to implement
  *  #GtkMenu)
- * @GDK_SURFACE_FOREIGN: foreign surface (see gdk_surface_foreign_new())
  * @GDK_SURFACE_SUBSURFACE: subsurface; This surface is visually
  *  tied to a toplevel, and is moved/stacked with it. Currently this window
  *  type is only implemented in Wayland. Since 3.14
@@ -57,7 +56,6 @@ typedef enum
   GDK_SURFACE_TOPLEVEL,
   GDK_SURFACE_CHILD,
   GDK_SURFACE_TEMP,
-  GDK_SURFACE_FOREIGN,
   GDK_SURFACE_SUBSURFACE
 } GdkSurfaceType;
 
diff --git a/gdk/win32/gdkdevice-win32.c b/gdk/win32/gdkdevice-win32.c
index 037d1b05cf..49549e19ba 100644
--- a/gdk/win32/gdkdevice-win32.c
+++ b/gdk/win32/gdkdevice-win32.c
@@ -222,8 +222,7 @@ _gdk_device_win32_surface_at_position (GdkDevice       *device,
       do {
         window = gdk_win32_handle_table_lookup (hwnd);
 
-        if (window != NULL &&
-            GDK_SURFACE_TYPE (window) != GDK_SURFACE_FOREIGN)
+        if (window != NULL)
           break;
 
         screen_to_client (hwnd, screen_pt, &client_pt);
diff --git a/gdk/win32/gdkgeometry-win32.c b/gdk/win32/gdkgeometry-win32.c
index d3119d4b49..f800fa8cc6 100644
--- a/gdk/win32/gdkgeometry-win32.c
+++ b/gdk/win32/gdkgeometry-win32.c
@@ -131,8 +131,7 @@ _gdk_win32_surface_tmp_unset_bg (GdkSurface *window,
     return;
 
   if (_gdk_surface_has_impl (window) &&
-      GDK_SURFACE_IS_WIN32 (window) &&
-      window->surface_type != GDK_SURFACE_FOREIGN)
+      GDK_SURFACE_IS_WIN32 (window))
     tmp_unset_bg (window);
 
   if (recurse)
@@ -164,8 +163,7 @@ _gdk_win32_surface_tmp_reset_bg (GdkSurface *window,
     return;
 
   if (_gdk_surface_has_impl (window) &&
-      GDK_SURFACE_IS_WIN32 (window) &&
-      window->surface_type != GDK_SURFACE_FOREIGN)
+      GDK_SURFACE_IS_WIN32 (window))
     {
       tmp_reset_bg (window);
     }
diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c
index af46bd7b28..ee922825fe 100644
--- a/gdk/win32/gdksurface-win32.c
+++ b/gdk/win32/gdksurface-win32.c
@@ -126,9 +126,6 @@ static void     gdk_win32_impl_frame_clock_after_paint (GdkFrameClock *clock,
 static gboolean _gdk_surface_get_functions (GdkSurface         *window,
                                            GdkWMFunction     *functions);
 
-#define SURFACE_IS_TOPLEVEL(window)               \
-  (GDK_SURFACE_TYPE (window) != GDK_SURFACE_FOREIGN)
-
 struct _GdkWin32Surface {
   GdkSurface parent;
 };
@@ -595,22 +592,14 @@ _gdk_win32_display_create_surface_impl (GdkDisplay    *display,
          /* The common code warns for this case. */
          hparent = GetDesktopWindow ();
        }
-      /* Children of foreign windows aren't toplevel windows */
-      if (real_parent != NULL && GDK_SURFACE_TYPE (real_parent) == GDK_SURFACE_FOREIGN)
-       {
-         dwStyle = WS_CHILDWINDOW | WS_CLIPCHILDREN;
-       }
+      /* MSDN: We need WS_CLIPCHILDREN and WS_CLIPSIBLINGS for GL Context Creation */
+      if (window->surface_type == GDK_SURFACE_TOPLEVEL)
+        dwStyle = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
       else
-       {
-         /* MSDN: We need WS_CLIPCHILDREN and WS_CLIPSIBLINGS for GL Context Creation */
-         if (window->surface_type == GDK_SURFACE_TOPLEVEL)
-           dwStyle = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
-         else
-           dwStyle = WS_OVERLAPPED | WS_MINIMIZEBOX | WS_SYSMENU | WS_CAPTION | WS_THICKFRAME | 
WS_CLIPCHILDREN;
+        dwStyle = WS_OVERLAPPED | WS_MINIMIZEBOX | WS_SYSMENU | WS_CAPTION | WS_THICKFRAME | WS_CLIPCHILDREN;
 
-         offset_x = _gdk_offset_x;
-         offset_y = _gdk_offset_y;
-       }
+      offset_x = _gdk_offset_x;
+      offset_y = _gdk_offset_y;
       break;
 
     case GDK_SURFACE_TEMP:
@@ -645,8 +634,8 @@ _gdk_win32_display_create_surface_impl (GdkDisplay    *display,
       x = y = CW_USEDEFAULT;
     }
   else
-         {
-      /* TEMP, FOREIGN: Put these where requested */
+    {
+      /* TEMP: Put these where requested */
       x = real_x;
       y = real_y;
     }
@@ -810,9 +799,8 @@ gdk_win32_surface_destroy_notify (GdkSurface *window)
 
   if (!GDK_SURFACE_DESTROYED (window))
     {
-      if (GDK_SURFACE_TYPE (window) != GDK_SURFACE_FOREIGN)
-       g_warning ("window %p unexpectedly destroyed",
-                  GDK_SURFACE_HWND (window));
+      g_warning ("window %p unexpectedly destroyed",
+                 GDK_SURFACE_HWND (window));
 
       _gdk_surface_destroy (window, TRUE);
     }
@@ -1380,8 +1368,7 @@ gdk_win32_surface_move_resize (GdkSurface *window,
  out:
   surface_impl->inhibit_configure = FALSE;
 
-  if (SURFACE_IS_TOPLEVEL (window))
-    _gdk_win32_emit_configure_event (window);
+  _gdk_win32_emit_configure_event (window);
 }
 
 static void
@@ -2175,10 +2162,6 @@ _gdk_win32_surface_lacks_wm_decorations (GdkSurface *window)
   if (GDK_SURFACE_DESTROYED (window))
     return FALSE;
 
-  /* only toplevels can be layered */
-  if (!SURFACE_IS_TOPLEVEL (window))
-    return FALSE;
-
   impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
 
   /* This is because GTK calls gdk_surface_set_decorations (window, 0),
@@ -5048,7 +5031,7 @@ gdk_win32_surface_set_opacity (GdkSurface *window,
 
   g_return_if_fail (GDK_IS_SURFACE (window));
 
-  if (!SURFACE_IS_TOPLEVEL (window) || GDK_SURFACE_DESTROYED (window))
+  if (GDK_SURFACE_DESTROYED (window))
     return;
 
   if (opacity < 0)
diff --git a/gdk/x11/gdkdevice-core-x11.c b/gdk/x11/gdkdevice-core-x11.c
index 32d7cfbb12..58196e43e6 100644
--- a/gdk/x11/gdkdevice-core-x11.c
+++ b/gdk/x11/gdkdevice-core-x11.c
@@ -533,8 +533,7 @@ gdk_x11_device_core_surface_at_position (GdkDevice       *device,
         break;
 
       if (get_toplevel && last != root &&
-          (surface = gdk_x11_surface_lookup_for_display (display, last)) != NULL &&
-          surface->surface_type != GDK_SURFACE_FOREIGN)
+          (surface = gdk_x11_surface_lookup_for_display (display, last)) != NULL)
         {
           xwindow = last;
           break;
diff --git a/gdk/x11/gdkdevice-xi2.c b/gdk/x11/gdkdevice-xi2.c
index b5152c143c..9abb0e82dd 100644
--- a/gdk/x11/gdkdevice-xi2.c
+++ b/gdk/x11/gdkdevice-xi2.c
@@ -624,8 +624,7 @@ gdk_x11_device_xi2_surface_at_position (GdkDevice       *device,
         break;
 
       if (get_toplevel && last != root &&
-          (surface = gdk_x11_surface_lookup_for_display (display, last)) != NULL &&
-          GDK_SURFACE_TYPE (surface) != GDK_SURFACE_FOREIGN)
+          (surface = gdk_x11_surface_lookup_for_display (display, last)) != NULL)
         {
           xwindow = last;
           break;
diff --git a/gdk/x11/gdkdnd-x11.c b/gdk/x11/gdkdnd-x11.c
index f1070f7b0c..04b6178948 100644
--- a/gdk/x11/gdkdnd-x11.c
+++ b/gdk/x11/gdkdnd-x11.c
@@ -1355,7 +1355,7 @@ _gdk_x11_display_get_drag_protocol (GdkDisplay      *display,
 
   /* Check for a local drag */
   surface = gdk_x11_surface_lookup_for_display (display, xid);
-  if (surface && gdk_surface_get_surface_type (surface) != GDK_SURFACE_FOREIGN)
+  if (surface)
     {
       if (g_object_get_data (G_OBJECT (surface), "gdk-dnd-registered") != NULL)
         {
diff --git a/gdk/x11/gdkdrop-x11.c b/gdk/x11/gdkdrop-x11.c
index 1bd315efe5..add5c98cd4 100644
--- a/gdk/x11/gdkdrop-x11.c
+++ b/gdk/x11/gdkdrop-x11.c
@@ -709,9 +709,6 @@ gdk_x11_drop_filter (GdkSurface   *surface,
   if (xevent->type != ClientMessage)
     return GDK_FILTER_CONTINUE;
 
-  if (gdk_surface_get_surface_type (surface) == GDK_SURFACE_FOREIGN)
-    return GDK_FILTER_CONTINUE; /* Not for us */
-
   display = GDK_SURFACE_DISPLAY (surface);
 
   for (i = 0; i < G_N_ELEMENTS (xdnd_filters); i++)
diff --git a/gdk/x11/gdksurface-x11.c b/gdk/x11/gdksurface-x11.c
index a833b7ccd5..0a7563efe8 100644
--- a/gdk/x11/gdksurface-x11.c
+++ b/gdk/x11/gdksurface-x11.c
@@ -110,11 +110,6 @@ static void     move_to_current_desktop           (GdkSurface *surface);
 
 static void        gdk_surface_impl_x11_finalize   (GObject            *object);
 
-#define SURFACE_IS_TOPLEVEL_OR_FOREIGN(surface)           \
-  (GDK_SURFACE_TYPE (surface) == GDK_SURFACE_TOPLEVEL ||   \
-   GDK_SURFACE_TYPE (surface) == GDK_SURFACE_TEMP ||       \
-   GDK_SURFACE_TYPE (surface) == GDK_SURFACE_FOREIGN)
-
 #define SURFACE_IS_TOPLEVEL(surface)                      \
   (GDK_SURFACE_TYPE (surface) == GDK_SURFACE_TOPLEVEL ||   \
    GDK_SURFACE_TYPE (surface) == GDK_SURFACE_TEMP)
@@ -1068,8 +1063,7 @@ gdk_x11_surface_destroy_notify (GdkSurface *surface)
 
   if (!GDK_SURFACE_DESTROYED (surface))
     {
-      if (GDK_SURFACE_TYPE(surface) != GDK_SURFACE_FOREIGN)
-       g_warning ("GdkSurface %#lx unexpectedly destroyed", GDK_SURFACE_XID (surface));
+      g_warning ("GdkSurface %#lx unexpectedly destroyed", GDK_SURFACE_XID (surface));
 
       _gdk_surface_destroy (surface, TRUE);
     }
@@ -1316,7 +1310,6 @@ gdk_surface_x11_hide (GdkSurface *surface)
       gdk_surface_withdraw (surface);
       return;
       
-    case GDK_SURFACE_FOREIGN:
     case GDK_SURFACE_CHILD:
     default:
       break;
@@ -1473,7 +1466,7 @@ _gdk_x11_surface_set_surface_scale (GdkSurface *surface,
   _gdk_surface_update_size (surface);
 
   toplevel = _gdk_x11_surface_get_toplevel (surface);
-  if (toplevel && surface->surface_type != GDK_SURFACE_FOREIGN)
+  if (toplevel)
     {
       /* These are affected by surface scale: */
       geom_mask = toplevel->last_geometry_hints_mask &
@@ -1484,25 +1477,17 @@ _gdk_x11_surface_set_surface_scale (GdkSurface *surface,
                                        geom_mask);
     }
 
-  if (surface->surface_type == GDK_SURFACE_FOREIGN)
-    XMoveWindow (GDK_SURFACE_XDISPLAY (surface),
-                 GDK_SURFACE_XID (surface),
-                 surface->x * impl->surface_scale,
-                 surface->y * impl->surface_scale);
-  else
+  if (impl->override_redirect)
     {
-      if (impl->override_redirect)
-        {
-          impl->unscaled_width = surface->width * impl->surface_scale;
-          impl->unscaled_height = surface->height * impl->surface_scale;
-        }
-
-      XResizeWindow (GDK_SURFACE_XDISPLAY (surface),
-                     GDK_SURFACE_XID (surface),
-                     surface->width * impl->surface_scale,
-                     surface->height * impl->surface_scale);
+      impl->unscaled_width = surface->width * impl->surface_scale;
+      impl->unscaled_height = surface->height * impl->surface_scale;
     }
 
+  XResizeWindow (GDK_SURFACE_XDISPLAY (surface),
+                 GDK_SURFACE_XID (surface),
+                 surface->width * impl->surface_scale,
+                 surface->height * impl->surface_scale);
+
   gdk_surface_invalidate_rect (surface, NULL);
 }
 
@@ -1668,7 +1653,7 @@ gdk_x11_surface_focus (GdkSurface *surface,
   g_return_if_fail (GDK_IS_SURFACE (surface));
 
   if (GDK_SURFACE_DESTROYED (surface) ||
-      !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface))
+      !SURFACE_IS_TOPLEVEL (surface))
     return;
 
   display = GDK_SURFACE_DISPLAY (surface);
@@ -1718,7 +1703,7 @@ gdk_x11_surface_set_type_hint (GdkSurface        *surface,
   Atom atom;
   
   if (GDK_SURFACE_DESTROYED (surface) ||
-      !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface))
+      !SURFACE_IS_TOPLEVEL (surface))
     return;
 
   display = gdk_surface_get_display (surface);
@@ -1792,7 +1777,7 @@ gdk_x11_surface_get_type_hint (GdkSurface *surface)
   g_return_val_if_fail (GDK_IS_SURFACE (surface), GDK_SURFACE_TYPE_HINT_NORMAL);
 
   if (GDK_SURFACE_DESTROYED (surface) ||
-      !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface))
+      !SURFACE_IS_TOPLEVEL (surface))
     return GDK_SURFACE_TYPE_HINT_NORMAL;
 
   type = GDK_SURFACE_TYPE_HINT_NORMAL;
@@ -1879,7 +1864,7 @@ gdk_x11_surface_set_modal_hint (GdkSurface *surface,
                               gboolean   modal)
 {
   if (GDK_SURFACE_DESTROYED (surface) ||
-      !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface))
+      !SURFACE_IS_TOPLEVEL (surface))
     return;
 
   surface->modal_hint = modal;
@@ -1899,7 +1884,7 @@ gdk_x11_surface_set_skip_taskbar_hint (GdkSurface *surface,
   g_return_if_fail (GDK_SURFACE_TYPE (surface) != GDK_SURFACE_CHILD);
   
   if (GDK_SURFACE_DESTROYED (surface) ||
-      !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface))
+      !SURFACE_IS_TOPLEVEL (surface))
     return;
 
   toplevel = _gdk_x11_surface_get_toplevel (surface);
@@ -1920,7 +1905,7 @@ gdk_x11_surface_set_skip_pager_hint (GdkSurface *surface,
   g_return_if_fail (GDK_SURFACE_TYPE (surface) != GDK_SURFACE_CHILD);
   
   if (GDK_SURFACE_DESTROYED (surface) ||
-      !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface))
+      !SURFACE_IS_TOPLEVEL (surface))
     return;
 
   toplevel = _gdk_x11_surface_get_toplevel (surface);
@@ -1941,7 +1926,7 @@ gdk_x11_surface_set_urgency_hint (GdkSurface *surface,
   g_return_if_fail (GDK_SURFACE_TYPE (surface) != GDK_SURFACE_CHILD);
   
   if (GDK_SURFACE_DESTROYED (surface) ||
-      !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface))
+      !SURFACE_IS_TOPLEVEL (surface))
     return;
 
   toplevel = _gdk_x11_surface_get_toplevel (surface);
@@ -1960,7 +1945,7 @@ gdk_x11_surface_set_geometry_hints (GdkSurface         *surface,
   GdkToplevelX11 *toplevel;
 
   if (GDK_SURFACE_DESTROYED (surface) ||
-      !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface))
+      !SURFACE_IS_TOPLEVEL (surface))
     return;
 
   toplevel = _gdk_x11_surface_get_toplevel (surface);
@@ -2083,7 +2068,7 @@ gdk_surface_get_geometry_hints (GdkSurface      *surface,
   *geom_mask = 0;
   
   if (GDK_SURFACE_DESTROYED (surface) ||
-      !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface))
+      !SURFACE_IS_TOPLEVEL (surface))
     return;
 
   impl = GDK_SURFACE_IMPL_X11 (surface->impl);
@@ -2232,7 +2217,7 @@ gdk_x11_surface_set_title (GdkSurface   *surface,
   g_return_if_fail (title != NULL);
 
   if (GDK_SURFACE_DESTROYED (surface) ||
-      !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface))
+      !SURFACE_IS_TOPLEVEL (surface))
     return;
   
   display = gdk_surface_get_display (surface);
@@ -2263,7 +2248,7 @@ gdk_x11_surface_set_role (GdkSurface   *surface,
   display = gdk_surface_get_display (surface);
 
   if (GDK_SURFACE_DESTROYED (surface) ||
-      !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface))
+      !SURFACE_IS_TOPLEVEL (surface))
     return;
 
   if (role)
@@ -2286,7 +2271,7 @@ gdk_x11_surface_set_startup_id (GdkSurface   *surface,
   display = gdk_surface_get_display (surface);
 
   if (GDK_SURFACE_DESTROYED (surface) ||
-      !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface))
+      !SURFACE_IS_TOPLEVEL (surface))
     return;
 
   if (startup_id)
@@ -2304,7 +2289,7 @@ gdk_x11_surface_set_transient_for (GdkSurface *surface,
                                  GdkSurface *parent)
 {
   if (GDK_SURFACE_DESTROYED (surface) ||
-      !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface))
+      !SURFACE_IS_TOPLEVEL (surface))
     return;
 
   /* XSetTransientForHint() doesn't allow unsetting, so do it manually */
@@ -2639,7 +2624,7 @@ gdk_x11_surface_set_accept_focus (GdkSurface *surface,
       surface->accept_focus = accept_focus;
 
       if (!GDK_SURFACE_DESTROYED (surface) &&
-         SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface))
+         SURFACE_IS_TOPLEVEL (surface))
        update_wm_hints (surface, FALSE);
     }
 }
@@ -2656,7 +2641,7 @@ gdk_x11_surface_set_focus_on_map (GdkSurface *surface,
       
       if ((!GDK_SURFACE_DESTROYED (surface)) &&
          (!surface->focus_on_map) &&
-         SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface))
+         SURFACE_IS_TOPLEVEL (surface))
        gdk_x11_surface_set_user_time (surface, 0);
     }
 }
@@ -2690,7 +2675,7 @@ gdk_x11_surface_set_user_time (GdkSurface *surface,
   Window xid;
 
   if (GDK_SURFACE_DESTROYED (surface) ||
-      !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface))
+      !SURFACE_IS_TOPLEVEL (surface))
     return;
 
   display = gdk_surface_get_display (surface);
@@ -2933,7 +2918,7 @@ gdk_x11_surface_set_icon_list (GdkSurface *surface,
   gint i, n;
 
   if (GDK_SURFACE_DESTROYED (surface) ||
-      !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface))
+      !SURFACE_IS_TOPLEVEL (surface))
     return;
 
   display = gdk_surface_get_display (surface);
@@ -3015,7 +3000,7 @@ gdk_x11_surface_set_icon_name (GdkSurface   *surface,
   GdkDisplay *display;
 
   if (GDK_SURFACE_DESTROYED (surface) ||
-      !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface))
+      !SURFACE_IS_TOPLEVEL (surface))
     return;
 
   display = gdk_surface_get_display (surface);
@@ -3050,7 +3035,7 @@ static void
 gdk_x11_surface_iconify (GdkSurface *surface)
 {
   if (GDK_SURFACE_DESTROYED (surface) ||
-      !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface))
+      !SURFACE_IS_TOPLEVEL (surface))
     return;
 
   if (GDK_SURFACE_IS_MAPPED (surface))
@@ -3075,7 +3060,7 @@ static void
 gdk_x11_surface_deiconify (GdkSurface *surface)
 {
   if (GDK_SURFACE_DESTROYED (surface) ||
-      !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface))
+      !SURFACE_IS_TOPLEVEL (surface))
     return;
 
   if (GDK_SURFACE_IS_MAPPED (surface))
@@ -3101,7 +3086,7 @@ static void
 gdk_x11_surface_stick (GdkSurface *surface)
 {
   if (GDK_SURFACE_DESTROYED (surface) ||
-      !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface))
+      !SURFACE_IS_TOPLEVEL (surface))
     return;
 
   if (GDK_SURFACE_IS_MAPPED (surface))
@@ -3149,7 +3134,7 @@ static void
 gdk_x11_surface_unstick (GdkSurface *surface)
 {
   if (GDK_SURFACE_DESTROYED (surface) ||
-      !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface))
+      !SURFACE_IS_TOPLEVEL (surface))
     return;
 
   if (GDK_SURFACE_IS_MAPPED (surface))
@@ -3175,7 +3160,7 @@ static void
 gdk_x11_surface_maximize (GdkSurface *surface)
 {
   if (GDK_SURFACE_DESTROYED (surface) ||
-      !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface))
+      !SURFACE_IS_TOPLEVEL (surface))
     return;
 
   if (GDK_SURFACE_IS_MAPPED (surface))
@@ -3192,7 +3177,7 @@ static void
 gdk_x11_surface_unmaximize (GdkSurface *surface)
 {
   if (GDK_SURFACE_DESTROYED (surface) ||
-      !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface))
+      !SURFACE_IS_TOPLEVEL (surface))
     return;
 
   if (GDK_SURFACE_IS_MAPPED (surface))
@@ -3209,7 +3194,7 @@ static void
 gdk_x11_surface_apply_fullscreen_mode (GdkSurface *surface)
 {
   if (GDK_SURFACE_DESTROYED (surface) ||
-      !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface))
+      !SURFACE_IS_TOPLEVEL (surface))
     return;
 
   /* _NET_WM_FULLSCREEN_MONITORS gives an indication to the window manager as
@@ -3301,7 +3286,7 @@ static void
 gdk_x11_surface_fullscreen (GdkSurface *surface)
 {
   if (GDK_SURFACE_DESTROYED (surface) ||
-      !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface))
+      !SURFACE_IS_TOPLEVEL (surface))
     return;
 
   if (GDK_SURFACE_IS_MAPPED (surface))
@@ -3328,7 +3313,7 @@ gdk_x11_surface_fullscreen_on_monitor (GdkSurface  *surface,
   GdkRectangle geom;
 
   if (GDK_SURFACE_DESTROYED (surface) ||
-      !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface))
+      !SURFACE_IS_TOPLEVEL (surface))
     return;
 
   gdk_monitor_get_geometry (monitor, &geom);
@@ -3342,7 +3327,7 @@ static void
 gdk_x11_surface_unfullscreen (GdkSurface *surface)
 {
   if (GDK_SURFACE_DESTROYED (surface) ||
-      !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface))
+      !SURFACE_IS_TOPLEVEL (surface))
     return;
 
   if (GDK_SURFACE_IS_MAPPED (surface))
@@ -3363,7 +3348,7 @@ gdk_x11_surface_set_keep_above (GdkSurface *surface,
   g_return_if_fail (GDK_IS_SURFACE (surface));
 
   if (GDK_SURFACE_DESTROYED (surface) ||
-      !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface))
+      !SURFACE_IS_TOPLEVEL (surface))
     return;
 
   if (GDK_SURFACE_IS_MAPPED (surface))
@@ -3388,7 +3373,7 @@ gdk_x11_surface_set_keep_below (GdkSurface *surface, gboolean setting)
   g_return_if_fail (GDK_IS_SURFACE (surface));
 
   if (GDK_SURFACE_DESTROYED (surface) ||
-      !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface))
+      !SURFACE_IS_TOPLEVEL (surface))
     return;
 
   if (GDK_SURFACE_IS_MAPPED (surface))
@@ -3539,7 +3524,7 @@ gdk_x11_surface_set_decorations (GdkSurface      *surface,
   MotifWmHints hints;
 
   if (GDK_SURFACE_DESTROYED (surface) ||
-      !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface))
+      !SURFACE_IS_TOPLEVEL (surface))
     return;
   
   /* initialize to zero to avoid writing uninitialized data to socket */
@@ -3558,7 +3543,7 @@ gdk_x11_surface_get_decorations(GdkSurface       *surface,
   gboolean result = FALSE;
 
   if (GDK_SURFACE_DESTROYED (surface) ||
-      !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface))
+      !SURFACE_IS_TOPLEVEL (surface))
     return FALSE;
   
   hints = gdk_surface_get_mwm_hints (surface);
@@ -3587,7 +3572,7 @@ gdk_x11_surface_set_functions (GdkSurface    *surface,
   g_return_if_fail (GDK_IS_SURFACE (surface));
 
   if (GDK_SURFACE_DESTROYED (surface) ||
-      !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface))
+      !SURFACE_IS_TOPLEVEL (surface))
     return;
   
   /* initialize to zero to avoid writing uninitialized data to socket */
@@ -4369,7 +4354,7 @@ gdk_x11_surface_begin_resize_drag (GdkSurface     *surface,
                                   guint32        timestamp)
 {
   if (GDK_SURFACE_DESTROYED (surface) ||
-      !SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface))
+      !SURFACE_IS_TOPLEVEL (surface))
     return;
 
   /* Avoid EWMH for touch devices */


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