[gtk/present-toplevel-2: 58/79] wayland: Stop tracking orphan dialogs



commit d1fbfa08989b66794a157d622e308d0d2c497db0
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Mar 6 12:38:13 2020 -0800

    wayland: Stop tracking orphan dialogs
    
    Wayland has no concept of transient-for-group. If we want to
    support that, add proper proper protocol for it, don't hack it
    in this like.

 gdk/wayland/gdkdisplay-wayland.h |  3 --
 gdk/wayland/gdksurface-wayland.c | 65 ----------------------------------------
 2 files changed, 68 deletions(-)
---
diff --git a/gdk/wayland/gdkdisplay-wayland.h b/gdk/wayland/gdkdisplay-wayland.h
index aa5797a331..a8e4364787 100644
--- a/gdk/wayland/gdkdisplay-wayland.h
+++ b/gdk/wayland/gdkdisplay-wayland.h
@@ -123,9 +123,6 @@ struct _GdkWaylandDisplay
 
   GList *event_queues;
 
-  /* Keep a list of orphaned dialogs (i.e. without parent) */
-  GList *orphan_dialogs;
-
   GList *current_popups;
   GList *current_grabbing_popups;
 
diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c
index ceaa72bc2f..412f9c066c 100644
--- a/gdk/wayland/gdksurface-wayland.c
+++ b/gdk/wayland/gdksurface-wayland.c
@@ -255,17 +255,6 @@ gdk_wayland_surface_thaw_state (GdkSurface *surface)
   g_assert (!impl->display_server.xdg_popup);
 }
 
-static void
-_gdk_wayland_screen_add_orphan_dialog (GdkSurface *surface)
-{
-  GdkWaylandDisplay *display_wayland =
-    GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
-
-  if (!g_list_find (display_wayland->orphan_dialogs, surface))
-    display_wayland->orphan_dialogs =
-      g_list_prepend (display_wayland->orphan_dialogs, surface);
-}
-
 static void
 _gdk_wayland_surface_save_size (GdkSurface *surface)
 {
@@ -954,37 +943,6 @@ gdk_wayland_surface_sync_parent_of_imported (GdkSurface *surface)
                                   impl->display_server.wl_surface);
 }
 
-static void
-gdk_wayland_surface_update_dialogs (GdkSurface *surface)
-{
-  GdkWaylandDisplay *display_wayland =
-    GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
-  GList *l;
-
-  if (!display_wayland->orphan_dialogs)
-    return;
-
-  for (l = display_wayland->orphan_dialogs; l; l = l->next)
-    {
-      GdkSurface *w = l->data;
-      GdkWaylandSurface *impl;
-
-      if (!GDK_IS_WAYLAND_SURFACE (w))
-        continue;
-
-      impl = GDK_WAYLAND_SURFACE (w);
-      if (w == surface)
-       continue;
-      if (impl->hint != GDK_SURFACE_TYPE_HINT_DIALOG)
-        continue;
-      if (impl->transient_for)
-        continue;
-
-      /* Update the parent relationship only for dialogs without transients */
-      gdk_wayland_surface_sync_parent (w, surface);
-    }
-}
-
 static void
 gdk_wayland_surface_sync_title (GdkSurface *surface)
 {
@@ -1274,10 +1232,6 @@ gdk_wayland_surface_configure_toplevel (GdkSurface *surface)
     default:
       g_assert_not_reached ();
     }
-
-  if (impl->hint != GDK_SURFACE_TYPE_HINT_DIALOG &&
-      new_state & GDK_SURFACE_STATE_FOCUSED)
-    gdk_wayland_surface_update_dialogs (surface);
 }
 
 static void
@@ -1635,9 +1589,6 @@ gdk_wayland_surface_create_xdg_toplevel (GdkSurface *surface)
   maybe_set_gtk_surface_dbus_properties (surface);
   maybe_set_gtk_surface_modal (surface);
 
-  if (impl->hint == GDK_SURFACE_TYPE_HINT_DIALOG)
-    _gdk_wayland_screen_add_orphan_dialog (surface);
-
   gdk_profiler_add_mark (g_get_monotonic_time (), 0, "wayland", "surface commit");
   wl_surface_commit (impl->display_server.wl_surface);
 }
@@ -2547,10 +2498,6 @@ gdk_wayland_surface_hide_surface (GdkSurface *surface)
       g_slist_free (impl->display_server.outputs);
       impl->display_server.outputs = NULL;
 
-      if (impl->hint == GDK_SURFACE_TYPE_HINT_DIALOG && !impl->transient_for)
-        display_wayland->orphan_dialogs =
-          g_list_remove (display_wayland->orphan_dialogs, surface);
-
       g_clear_pointer (&impl->popup.layout, gdk_popup_layout_unref);
     }
 
@@ -3297,9 +3244,6 @@ gdk_wayland_surface_set_transient_for (GdkSurface *surface,
                                        GdkSurface *parent)
 {
   GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
-  GdkWaylandDisplay *display_wayland =
-    GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
-  GdkSurface *previous_parent;
 
   g_assert (parent == NULL ||
             gdk_surface_get_display (surface) == gdk_surface_get_display (parent));
@@ -3312,17 +3256,8 @@ gdk_wayland_surface_set_transient_for (GdkSurface *surface,
 
   unset_transient_for_exported (surface);
 
-  previous_parent = impl->transient_for;
   impl->transient_for = parent;
 
-  if (impl->hint == GDK_SURFACE_TYPE_HINT_DIALOG)
-    {
-      if (!parent)
-        _gdk_wayland_screen_add_orphan_dialog (surface);
-      else if (!previous_parent)
-        display_wayland->orphan_dialogs =
-          g_list_remove (display_wayland->orphan_dialogs, surface);
-    }
   gdk_wayland_surface_sync_parent (surface, NULL);
 }
 


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