surface: Remove GSK_SURFACE_ROOT

Root surface have been dead for a while now, no need to keep the enum
value around.
This commit is contained in:
Benjamin Otte 2018-03-21 00:55:59 +01:00
parent 5290d9d8c7
commit 5a32469303
4 changed files with 15 additions and 44 deletions

View File

@ -634,7 +634,6 @@ get_current_toplevel (GdkDisplay *display,
if (pointer_surface != NULL && if (pointer_surface != NULL &&
(GDK_SURFACE_DESTROYED (pointer_surface) || (GDK_SURFACE_DESTROYED (pointer_surface) ||
GDK_SURFACE_TYPE (pointer_surface) == GDK_SURFACE_ROOT ||
GDK_SURFACE_TYPE (pointer_surface) == GDK_SURFACE_FOREIGN)) GDK_SURFACE_TYPE (pointer_surface) == GDK_SURFACE_FOREIGN))
pointer_surface = NULL; pointer_surface = NULL;

View File

@ -479,9 +479,7 @@ gdk_surface_has_impl (GdkSurface *surface)
static gboolean static gboolean
gdk_surface_is_toplevel (GdkSurface *surface) gdk_surface_is_toplevel (GdkSurface *surface)
{ {
return return surface->parent == NULL;
surface->parent == NULL ||
surface->parent->surface_type == GDK_SURFACE_ROOT;
} }
gboolean gboolean
@ -603,9 +601,7 @@ should_apply_clip_as_shape (GdkSurface *surface)
/* Not for non-shaped toplevels */ /* Not for non-shaped toplevels */
(surface->shape != NULL || surface->applied_shape) && (surface->shape != NULL || surface->applied_shape) &&
/* or for foreign surfaces */ /* or for foreign surfaces */
surface->surface_type != GDK_SURFACE_FOREIGN && surface->surface_type != GDK_SURFACE_FOREIGN;
/* or for the root surface */
surface->surface_type != GDK_SURFACE_ROOT;
} }
static void static void
@ -744,9 +740,8 @@ recompute_visible_regions_internal (GdkSurface *private,
private->clip_region = new_clip; private->clip_region = new_clip;
} }
/* Update all children, recursively (except for root, where children are not exact). */ /* Update all children, recursively */
if ((abs_pos_changed || clip_region_changed || recalculate_children) && if ((abs_pos_changed || clip_region_changed || recalculate_children))
private->surface_type != GDK_SURFACE_ROOT)
{ {
for (l = private->children; l; l = l->next) for (l = private->children; l; l = l->next)
{ {
@ -834,8 +829,7 @@ get_native_device_event_mask (GdkSurface *private,
else else
event_mask = private->event_mask; event_mask = private->event_mask;
if (private->surface_type == GDK_SURFACE_ROOT || if (private->surface_type == GDK_SURFACE_FOREIGN)
private->surface_type == GDK_SURFACE_FOREIGN)
return event_mask; return event_mask;
else else
{ {
@ -912,9 +906,8 @@ gdk_surface_new (GdkDisplay *display,
{ {
case GDK_SURFACE_TOPLEVEL: case GDK_SURFACE_TOPLEVEL:
case GDK_SURFACE_TEMP: case GDK_SURFACE_TEMP:
if (parent != NULL && GDK_SURFACE_TYPE (parent) != GDK_SURFACE_ROOT) if (parent != NULL)
g_warning (G_STRLOC "Toplevel surfaces must be created as children of\n" g_warning (G_STRLOC "Toplevel surfaces must be created without a parent");
"a surface of type GDK_SURFACE_ROOT");
break; break;
case GDK_SURFACE_SUBSURFACE: case GDK_SURFACE_SUBSURFACE:
#ifdef GDK_WINDOWING_WAYLAND #ifdef GDK_WINDOWING_WAYLAND
@ -926,11 +919,10 @@ gdk_surface_new (GdkDisplay *display,
#endif #endif
break; break;
case GDK_SURFACE_CHILD: case GDK_SURFACE_CHILD:
if (GDK_SURFACE_TYPE (parent) == GDK_SURFACE_ROOT || if (GDK_SURFACE_TYPE (parent) == GDK_SURFACE_FOREIGN)
GDK_SURFACE_TYPE (parent) == GDK_SURFACE_FOREIGN)
{ {
g_warning (G_STRLOC "Child surfaces must not be created as children of\n" 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; return NULL;
} }
break; break;
@ -1181,13 +1173,6 @@ _gdk_surface_destroy_hierarchy (GdkSurface *surface,
g_assert_not_reached (); g_assert_not_reached ();
break; 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_TOPLEVEL:
case GDK_SURFACE_CHILD: case GDK_SURFACE_CHILD:
case GDK_SURFACE_TEMP: case GDK_SURFACE_TEMP:
@ -2533,8 +2518,7 @@ gdk_surface_invalidate_full (GdkSurface *surface,
if (surface->input_only || if (surface->input_only ||
!surface->viewable || !surface->viewable ||
cairo_region_is_empty (region) || cairo_region_is_empty (region))
surface->surface_type == GDK_SURFACE_ROOT)
return; return;
r.x = 0; r.x = 0;
@ -3051,8 +3035,7 @@ _gdk_surface_update_viewable (GdkSurface *surface)
{ {
gboolean viewable; gboolean viewable;
if (surface->surface_type == GDK_SURFACE_FOREIGN || if (surface->surface_type == GDK_SURFACE_FOREIGN)
surface->surface_type == GDK_SURFACE_ROOT)
viewable = TRUE; viewable = TRUE;
else if (gdk_surface_is_toplevel (surface) || else if (gdk_surface_is_toplevel (surface) ||
surface->parent->viewable) 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)); g_assert (gdk_surface_get_display (surface) == gdk_device_get_display (device));
if (surface->surface_type == GDK_SURFACE_ROOT || if (surface->surface_type == GDK_SURFACE_FOREIGN)
surface->surface_type == GDK_SURFACE_FOREIGN)
GDK_DEVICE_GET_CLASS (device)->set_surface_cursor (device, surface, cursor); GDK_DEVICE_GET_CLASS (device)->set_surface_cursor (device, surface, cursor);
else else
{ {
@ -4704,8 +4686,7 @@ get_event_toplevel (GdkSurface *surface)
{ {
GdkSurface *parent; GdkSurface *parent;
while ((parent = surface->parent) != NULL && while ((parent = surface->parent) != NULL)
(parent->surface_type != GDK_SURFACE_ROOT))
surface = parent; surface = parent;
return surface; return surface;
@ -4763,8 +4744,7 @@ update_cursor (GdkDisplay *display,
the cursor is inherited from the parent */ the cursor is inherited from the parent */
while (cursor_surface->cursor == NULL && while (cursor_surface->cursor == NULL &&
!g_hash_table_contains (cursor_surface->device_cursor, device) && !g_hash_table_contains (cursor_surface->device_cursor, device) &&
(parent = cursor_surface->parent) != NULL && (parent = cursor_surface->parent) != NULL)
parent->surface_type != GDK_SURFACE_ROOT)
cursor_surface = parent; cursor_surface = parent;
cursor = g_hash_table_lookup (cursor_surface->device_cursor, device); cursor = g_hash_table_lookup (cursor_surface->device_cursor, device);
@ -5284,9 +5264,6 @@ _gdk_windowing_got_event (GdkDisplay *display,
} }
#endif #endif
if (event_surface->surface_type == GDK_SURFACE_ROOT)
goto out;
if (event->any.type == GDK_ENTER_NOTIFY) if (event->any.type == GDK_ENTER_NOTIFY)
_gdk_display_set_surface_under_pointer (display, device, event_surface); _gdk_display_set_surface_under_pointer (display, device, event_surface);
else if (event->any.type == GDK_LEAVE_NOTIFY) 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"); g_object_notify (G_OBJECT (surface), "state");
break; break;
case GDK_SURFACE_FOREIGN: case GDK_SURFACE_FOREIGN:
case GDK_SURFACE_ROOT:
case GDK_SURFACE_CHILD: case GDK_SURFACE_CHILD:
default: default:
break; break;

View File

@ -42,8 +42,6 @@ typedef struct _GdkGeometry GdkGeometry;
/** /**
* GdkSurfaceType: * 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_TOPLEVEL: toplevel window (used to implement #GtkWindow)
* @GDK_SURFACE_CHILD: child surface (used to implement e.g. #GtkEntry) * @GDK_SURFACE_CHILD: child surface (used to implement e.g. #GtkEntry)
* @GDK_SURFACE_TEMP: override redirect temporary surface (used to implement * @GDK_SURFACE_TEMP: override redirect temporary surface (used to implement
@ -57,7 +55,6 @@ typedef struct _GdkGeometry GdkGeometry;
*/ */
typedef enum typedef enum
{ {
GDK_SURFACE_ROOT,
GDK_SURFACE_TOPLEVEL, GDK_SURFACE_TOPLEVEL,
GDK_SURFACE_CHILD, GDK_SURFACE_CHILD,
GDK_SURFACE_TEMP, GDK_SURFACE_TEMP,

View File

@ -184,8 +184,7 @@ traverse_to_toplevel (GdkSurface *surface,
gdouble xf = x; gdouble xf = x;
gdouble yf = y; gdouble yf = y;
while ((parent = surface->parent) != NULL && while ((parent = surface->parent) != NULL)
(gdk_surface_get_surface_type (parent) != GDK_SURFACE_ROOT))
{ {
gdk_surface_coords_to_parent (surface, xf, yf, &xf, &yf); gdk_surface_coords_to_parent (surface, xf, yf, &xf, &yf);
surface = parent; surface = parent;