[gtk+] wayland: Track orphaned dialogs per display
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] wayland: Track orphaned dialogs per display
- Date: Tue, 26 Apr 2016 12:38:37 +0000 (UTC)
commit 145b626c2f87a04223cc1902e317214144f1dfd5
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Tue Apr 26 11:46:25 2016 +0800
wayland: Track orphaned dialogs per display
Don't track all orphaned dialogs globally, as mixing them up with each
other would in most cases trigger errors when we try to pass bogus
values to Wayland requests.
https://bugzilla.gnome.org/show_bug.cgi?id=765474
gdk/wayland/gdkdisplay-wayland.h | 3 +++
gdk/wayland/gdkwindow-wayland.c | 31 ++++++++++++++++++++++---------
2 files changed, 25 insertions(+), 9 deletions(-)
---
diff --git a/gdk/wayland/gdkdisplay-wayland.h b/gdk/wayland/gdkdisplay-wayland.h
index 412c660..a6cd14f 100644
--- a/gdk/wayland/gdkdisplay-wayland.h
+++ b/gdk/wayland/gdkdisplay-wayland.h
@@ -84,6 +84,9 @@ struct _GdkWaylandDisplay
GHashTable *known_globals;
GList *on_has_globals_closures;
+ /* Keep a list of orphaned dialogs (i.e. without parent) */
+ GList *orphan_dialogs;
+
struct wl_cursor_theme *scaled_cursor_themes[GDK_WAYLAND_THEME_SCALES_COUNT];
gchar *cursor_theme_name;
int cursor_theme_size;
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index a646cb3..eac2e22 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -191,14 +191,15 @@ _gdk_window_impl_wayland_init (GdkWindowImplWayland *impl)
impl->saved_height = -1;
}
-/* Keep a list of orphaned dialogs (i.e. without parent) */
-static GList *orphan_dialogs;
-
static void
_gdk_wayland_screen_add_orphan_dialog (GdkWindow *window)
{
- if (!g_list_find (orphan_dialogs, window))
- orphan_dialogs = g_list_prepend (orphan_dialogs, window);
+ GdkWaylandDisplay *display_wayland =
+ GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
+
+ if (!g_list_find (display_wayland->orphan_dialogs, window))
+ display_wayland->orphan_dialogs =
+ g_list_prepend (display_wayland->orphan_dialogs, window);
}
static void
@@ -953,6 +954,9 @@ gdk_wayland_window_sync_parent (GdkWindow *window,
GdkWindowImplWayland *impl_parent = NULL;
struct xdg_surface *parent_surface;
+ g_assert (parent == NULL ||
+ gdk_window_get_display (window) == gdk_window_get_display (parent));
+
if (!impl->display_server.xdg_surface)
return;
@@ -978,12 +982,14 @@ gdk_wayland_window_sync_parent (GdkWindow *window,
static void
gdk_wayland_window_update_dialogs (GdkWindow *window)
{
+ GdkWaylandDisplay *display_wayland =
+ GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
GList *l;
- if (!orphan_dialogs)
+ if (!display_wayland->orphan_dialogs)
return;
- for (l = orphan_dialogs; l; l = l->next)
+ for (l = display_wayland->orphan_dialogs; l; l = l->next)
{
GdkWindow *w = l->data;
GdkWindowImplWayland *impl;
@@ -1830,7 +1836,8 @@ gdk_wayland_window_hide_surface (GdkWindow *window)
impl->display_server.outputs = NULL;
if (impl->hint == GDK_WINDOW_TYPE_HINT_DIALOG && !impl->transient_for)
- orphan_dialogs = g_list_remove (orphan_dialogs, window);
+ display_wayland->orphan_dialogs =
+ g_list_remove (display_wayland->orphan_dialogs, window);
}
_gdk_wayland_window_clear_saved_size (window);
@@ -2291,8 +2298,13 @@ gdk_wayland_window_set_transient_for (GdkWindow *window,
GdkWindow *parent)
{
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
+ GdkWaylandDisplay *display_wayland =
+ GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
GdkWindow *previous_parent;
+ g_assert (parent == NULL ||
+ gdk_window_get_display (window) == gdk_window_get_display (parent));
+
if (check_transient_for_loop (window, parent))
{
g_warning ("Setting %p transient for %p would create a loop", window, parent);
@@ -2310,7 +2322,8 @@ gdk_wayland_window_set_transient_for (GdkWindow *window,
if (!parent)
_gdk_wayland_screen_add_orphan_dialog (window);
else if (!previous_parent)
- orphan_dialogs = g_list_remove (orphan_dialogs, window);
+ display_wayland->orphan_dialogs =
+ g_list_remove (display_wayland->orphan_dialogs, window);
}
gdk_wayland_window_sync_parent (window, NULL);
if (should_map_as_subsurface (window) &&
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]