[gtk/present-toplevel-2: 10/70] wayland: Stop abusing type hints



commit e865fe8996c221f20a98c47daca26a8be0d17145
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Feb 29 12:25:51 2020 -0500

    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(-)
---
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;
+}


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