From 5a32469303412381e05854a55ed6fc0936c66c4e Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Wed, 21 Mar 2018 00:55:59 +0100 Subject: surface: Remove GSK_SURFACE_ROOT Root surface have been dead for a while now, no need to keep the enum value around. --- gdk/gdkdisplay.c | 1 - gdk/gdksurface.c | 52 ++++++++++++++-------------------------------------- gdk/gdksurface.h | 3 --- gdk/gdksurfaceimpl.c | 3 +-- 4 files changed, 15 insertions(+), 44 deletions(-) (limited to 'gdk') diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c index d8ca382e9e..93449e99be 100644 --- a/gdk/gdkdisplay.c +++ b/gdk/gdkdisplay.c @@ -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; diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c index 5fe656be2e..5c7233bf23 100644 --- a/gdk/gdksurface.c +++ b/gdk/gdksurface.c @@ -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; diff --git a/gdk/gdksurface.h b/gdk/gdksurface.h index 3a46e40b56..3f19c746ea 100644 --- a/gdk/gdksurface.h +++ b/gdk/gdksurface.h @@ -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, diff --git a/gdk/gdksurfaceimpl.c b/gdk/gdksurfaceimpl.c index e73d11748a..f5c7330198 100644 --- a/gdk/gdksurfaceimpl.c +++ b/gdk/gdksurfaceimpl.c @@ -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; -- cgit v1.2.1