From 5acbfce264d600bf32c37dc385a73fd46ee031f0 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 29 Feb 2020 12:25:51 -0500 Subject: wayland: Stop abusing type hints Instead of misusing window type hints, introduce a private flag for drag surfaces. --- gdk/wayland/gdkdrag-wayland.c | 12 ------------ gdk/wayland/gdkprivate-wayland.h | 2 ++ gdk/wayland/gdksurface-wayland.c | 14 +++++++++++++- 3 files changed, 15 insertions(+), 13 deletions(-) (limited to 'gdk/wayland') diff --git a/gdk/wayland/gdkdrag-wayland.c b/gdk/wayland/gdkdrag-wayland.c index b0430b025d..320ae27a9a 100644 --- a/gdk/wayland/gdkdrag-wayland.c +++ b/gdk/wayland/gdkdrag-wayland.c @@ -197,18 +197,6 @@ gdk_wayland_drag_class_init (GdkWaylandDragClass *klass) drag_class->cancel = gdk_wayland_drag_cancel; } -static GdkSurface * -create_dnd_surface (GdkDisplay *display) -{ - GdkSurface *surface; - - surface = gdk_surface_new_temp (display, &(GdkRectangle) { 0, 0, 100, 100 }); - - gdk_surface_set_type_hint (surface, GDK_SURFACE_TYPE_HINT_DND); - - return surface; -} - static inline GdkDragAction _wl_to_gdk_actions (uint32_t dnd_actions) { diff --git a/gdk/wayland/gdkprivate-wayland.h b/gdk/wayland/gdkprivate-wayland.h index f472bf7759..6ea1a1ae6e 100644 --- a/gdk/wayland/gdkprivate-wayland.h +++ b/gdk/wayland/gdkprivate-wayland.h @@ -199,5 +199,7 @@ void gdk_wayland_surface_restore_shortcuts (GdkSurface *surface, void gdk_wayland_surface_update_scale (GdkSurface *surface); +GdkSurface * create_dnd_surface (GdkDisplay *display); + #endif /* __GDK_PRIVATE_WAYLAND_H__ */ diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c index 526b07f567..e6de133833 100644 --- a/gdk/wayland/gdksurface-wayland.c +++ b/gdk/wayland/gdksurface-wayland.c @@ -97,6 +97,7 @@ struct _GdkWaylandSurface unsigned int pending_commit : 1; unsigned int awaiting_frame : 1; unsigned int awaiting_frame_frozen : 1; + unsigned int is_drag_surface : 1; GdkSurfaceTypeHint hint; GdkSurface *transient_for; GdkSurface *popup_parent; @@ -2363,7 +2364,7 @@ should_be_mapped (GdkSurface *surface) if (surface->surface_type == GDK_SURFACE_TEMP && surface->x < 0 && surface->y < 0) return FALSE; - if (impl->hint == GDK_SURFACE_TYPE_HINT_DND) + if (impl->is_drag_surface) return FALSE; return TRUE; @@ -4392,3 +4393,14 @@ gdk_wayland_surface_restore_shortcuts (GdkSurface *surface, g_hash_table_remove (impl->shortcuts_inhibitors, seat); } +GdkSurface * +create_dnd_surface (GdkDisplay *display) +{ + GdkSurface *surface; + + surface = gdk_surface_new_temp (display, &(GdkRectangle) { 0, 0, 100, 100 }); + + GDK_WAYLAND_SURFACE (surface)->is_drag_surface = TRUE; + + return surface; +} -- cgit v1.2.1