surface: Remove GSK_SURFACE_ROOT
authorBenjamin Otte <otte@redhat.com>
Tue, 20 Mar 2018 23:55:59 +0000 (00:55 +0100)
committerBenjamin Otte <otte@redhat.com>
Tue, 20 Mar 2018 23:58:01 +0000 (00:58 +0100)
Root surface have been dead for a while now, no need to keep the enum
value around.

gdk/gdkdisplay.c
gdk/gdksurface.c
gdk/gdksurface.h
gdk/gdksurfaceimpl.c

index d8ca382e9e9bf647f6b321cd014fe264c83214ec..93449e99be15a04a9758dac3b24fcc9e0d3bffdd 100644 (file)
@@ -634,7 +634,6 @@ get_current_toplevel (GdkDisplay      *display,
 
   if (pointer_surface != NULL &&
       (GDK_SURFACE_DESTROYED (pointer_surface) ||
-       GDK_SURFACE_TYPE (pointer_surface) == GDK_SURFACE_ROOT ||
        GDK_SURFACE_TYPE (pointer_surface) == GDK_SURFACE_FOREIGN))
     pointer_surface = NULL;
 
index 5fe656be2ed9462e0a4da68fa3865612321a8408..5c7233bf2386b85a7a4a9d7057d63ddb230dc7ac 100644 (file)
@@ -479,9 +479,7 @@ gdk_surface_has_impl (GdkSurface *surface)
 static gboolean
 gdk_surface_is_toplevel (GdkSurface *surface)
 {
-  return
-    surface->parent == NULL ||
-    surface->parent->surface_type == GDK_SURFACE_ROOT;
+  return surface->parent == NULL;
 }
 
 gboolean
@@ -603,9 +601,7 @@ should_apply_clip_as_shape (GdkSurface *surface)
     /* Not for non-shaped toplevels */
     (surface->shape != NULL || surface->applied_shape) &&
     /* or for foreign surfaces */
-    surface->surface_type != GDK_SURFACE_FOREIGN &&
-    /* or for the root surface */
-    surface->surface_type != GDK_SURFACE_ROOT;
+    surface->surface_type != GDK_SURFACE_FOREIGN;
 }
 
 static void
@@ -744,9 +740,8 @@ recompute_visible_regions_internal (GdkSurface *private,
       private->clip_region = new_clip;
     }
 
-  /* Update all children, recursively (except for root, where children are not exact). */
-  if ((abs_pos_changed || clip_region_changed || recalculate_children) &&
-      private->surface_type != GDK_SURFACE_ROOT)
+  /* Update all children, recursively */
+  if ((abs_pos_changed || clip_region_changed || recalculate_children))
     {
       for (l = private->children; l; l = l->next)
        {
@@ -834,8 +829,7 @@ get_native_device_event_mask (GdkSurface *private,
   else
     event_mask = private->event_mask;
 
-  if (private->surface_type == GDK_SURFACE_ROOT ||
-      private->surface_type == GDK_SURFACE_FOREIGN)
+  if (private->surface_type == GDK_SURFACE_FOREIGN)
     return event_mask;
   else
     {
@@ -912,9 +906,8 @@ gdk_surface_new (GdkDisplay    *display,
     {
     case GDK_SURFACE_TOPLEVEL:
     case GDK_SURFACE_TEMP:
-      if (parent != NULL && GDK_SURFACE_TYPE (parent) != GDK_SURFACE_ROOT)
-       g_warning (G_STRLOC "Toplevel surfaces must be created as children of\n"
-                  "a surface of type GDK_SURFACE_ROOT");
+      if (parent != NULL)
+       g_warning (G_STRLOC "Toplevel surfaces must be created without a parent");
       break;
     case GDK_SURFACE_SUBSURFACE:
 #ifdef GDK_WINDOWING_WAYLAND
@@ -926,11 +919,10 @@ gdk_surface_new (GdkDisplay    *display,
 #endif
       break;
     case GDK_SURFACE_CHILD:
-      if (GDK_SURFACE_TYPE (parent) == GDK_SURFACE_ROOT ||
-          GDK_SURFACE_TYPE (parent) == GDK_SURFACE_FOREIGN)
+      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_ROOT or GDK_SURFACE_FOREIGN");
+                     "a surface of type GDK_SURFACE_FOREIGN");
           return NULL;
         }
       break;
@@ -1181,13 +1173,6 @@ _gdk_surface_destroy_hierarchy (GdkSurface *surface,
       g_assert_not_reached ();
       break;
 
-    case GDK_SURFACE_ROOT:
-      if (!gdk_display_is_closed (display))
-       {
-         g_error ("attempted to destroy root window");
-         break;
-       }
-      /* else fall thru */
     case GDK_SURFACE_TOPLEVEL:
     case GDK_SURFACE_CHILD:
     case GDK_SURFACE_TEMP:
@@ -2533,8 +2518,7 @@ gdk_surface_invalidate_full (GdkSurface           *surface,
 
   if (surface->input_only ||
       !surface->viewable ||
-      cairo_region_is_empty (region) ||
-      surface->surface_type == GDK_SURFACE_ROOT)
+      cairo_region_is_empty (region))
     return;
 
   r.x = 0;
@@ -3051,8 +3035,7 @@ _gdk_surface_update_viewable (GdkSurface *surface)
 {
   gboolean viewable;
 
-  if (surface->surface_type == GDK_SURFACE_FOREIGN ||
-      surface->surface_type == GDK_SURFACE_ROOT)
+  if (surface->surface_type == GDK_SURFACE_FOREIGN)
     viewable = TRUE;
   else if (gdk_surface_is_toplevel (surface) ||
           surface->parent->viewable)
@@ -3888,8 +3871,7 @@ gdk_surface_set_cursor_internal (GdkSurface *surface,
 
   g_assert (gdk_surface_get_display (surface) == gdk_device_get_display (device));
 
-  if (surface->surface_type == GDK_SURFACE_ROOT ||
-      surface->surface_type == GDK_SURFACE_FOREIGN)
+  if (surface->surface_type == GDK_SURFACE_FOREIGN)
     GDK_DEVICE_GET_CLASS (device)->set_surface_cursor (device, surface, cursor);
   else
     {
@@ -4704,8 +4686,7 @@ get_event_toplevel (GdkSurface *surface)
 {
   GdkSurface *parent;
 
-  while ((parent = surface->parent) != NULL &&
-        (parent->surface_type != GDK_SURFACE_ROOT))
+  while ((parent = surface->parent) != NULL)
     surface = parent;
 
   return surface;
@@ -4763,8 +4744,7 @@ update_cursor (GdkDisplay *display,
      the cursor is inherited from the parent */
   while (cursor_surface->cursor == NULL &&
          !g_hash_table_contains (cursor_surface->device_cursor, device) &&
-        (parent = cursor_surface->parent) != NULL &&
-        parent->surface_type != GDK_SURFACE_ROOT)
+        (parent = cursor_surface->parent) != NULL)
     cursor_surface = parent;
 
   cursor = g_hash_table_lookup (cursor_surface->device_cursor, device);
@@ -5284,9 +5264,6 @@ _gdk_windowing_got_event (GdkDisplay *display,
     }
 #endif
 
-  if (event_surface->surface_type == GDK_SURFACE_ROOT)
-    goto out;
-
   if (event->any.type == GDK_ENTER_NOTIFY)
     _gdk_display_set_surface_under_pointer (display, device, event_surface);
   else if (event->any.type == GDK_LEAVE_NOTIFY)
@@ -6792,7 +6769,6 @@ gdk_surface_set_state (GdkSurface      *surface,
       g_object_notify (G_OBJECT (surface), "state");
       break;
     case GDK_SURFACE_FOREIGN:
-    case GDK_SURFACE_ROOT:
     case GDK_SURFACE_CHILD:
     default:
       break;
index 3a46e40b5676d2b067de1468c2ecb8da88d298fb..3f19c746eac497629ecb08b2c38943bd3058378c 100644 (file)
@@ -42,8 +42,6 @@ typedef struct _GdkGeometry          GdkGeometry;
 
 /**
  * GdkSurfaceType:
- * @GDK_SURFACE_ROOT: root window; this surface has no parent, covers the entire
- *  screen, and is created by the window system
  * @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
@@ -57,7 +55,6 @@ typedef struct _GdkGeometry          GdkGeometry;
  */
 typedef enum
 {
-  GDK_SURFACE_ROOT,
   GDK_SURFACE_TOPLEVEL,
   GDK_SURFACE_CHILD,
   GDK_SURFACE_TEMP,
index e73d11748a5bca23ff36ac0f4f0e9814d68df528..f5c7330198af81683502e2815076fad3eb4fab2b 100644 (file)
@@ -184,8 +184,7 @@ traverse_to_toplevel (GdkSurface *surface,
   gdouble xf = x;
   gdouble yf = y;
 
-  while ((parent = surface->parent) != NULL &&
-         (gdk_surface_get_surface_type (parent) != GDK_SURFACE_ROOT))
+  while ((parent = surface->parent) != NULL)
     {
       gdk_surface_coords_to_parent (surface, xf, yf, &xf, &yf);
       surface = parent;