kathenas / rpms / mutter

Forked from rpms/mutter 5 years ago
Clone

Blame SOURCES/0008-wayland-gtk-shell-Handle-requests-after-toplevel-was.patch

776610
From 8ddbe9d98bb02145fea898a2a85bbb49f2e85f5b Mon Sep 17 00:00:00 2001
776610
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
776610
Date: Wed, 25 Jul 2018 12:20:57 +0200
776610
Subject: [PATCH 8/8] wayland/gtk-shell: Handle requests after toplevel was
776610
 unmanaged
776610
776610
As with xdg-toplevel, a gtk-surface can be unmanaged by the compositor
776610
without the client knowing about it, meaning the client may still send
776610
updates and make requests. Handle this gracefully by ignoring them. The
776610
client needs to reset all the state anyway, if it wants to remap the
776610
same surface.
776610
776610
https://gitlab.gnome.org/GNOME/mutter/issues/240
776610
(cherry picked from commit ca5b27baf517f00354ff8811ba204fd90f1ddb38)
776610
---
776610
 src/wayland/meta-wayland-gtk-shell.c | 29 ++++++++++++++++++----------
776610
 1 file changed, 19 insertions(+), 10 deletions(-)
776610
776610
diff --git a/src/wayland/meta-wayland-gtk-shell.c b/src/wayland/meta-wayland-gtk-shell.c
776610
index 0ef9b83ff..474595b18 100644
776610
--- a/src/wayland/meta-wayland-gtk-shell.c
776610
+++ b/src/wayland/meta-wayland-gtk-shell.c
776610
@@ -71,15 +71,13 @@ gtk_surface_set_dbus_properties (struct wl_client   *client,
776610
 {
776610
   MetaWaylandGtkSurface *gtk_surface = wl_resource_get_user_data (resource);
776610
   MetaWaylandSurface *surface = gtk_surface->surface;
776610
+  MetaWindow *window;
776610
 
776610
-  /* Broken client, let it die instead of us */
776610
-  if (!surface->window)
776610
-    {
776610
-      meta_warning ("meta-wayland-surface: set_dbus_properties called with invalid window!\n");
776610
-      return;
776610
-    }
776610
+  window = surface->window;
776610
+  if (!window)
776610
+    return;
776610
 
776610
-  meta_window_set_gtk_dbus_properties (surface->window,
776610
+  meta_window_set_gtk_dbus_properties (window,
776610
                                        application_id,
776610
                                        unique_bus_name,
776610
                                        app_menu_path,
776610
@@ -94,12 +92,17 @@ gtk_surface_set_modal (struct wl_client   *client,
776610
 {
776610
   MetaWaylandGtkSurface *gtk_surface = wl_resource_get_user_data (resource);
776610
   MetaWaylandSurface *surface = gtk_surface->surface;
776610
+  MetaWindow *window;
776610
+
776610
+  window = surface->window;
776610
+  if (!window)
776610
+    return;
776610
 
776610
   if (gtk_surface->is_modal)
776610
     return;
776610
 
776610
   gtk_surface->is_modal = TRUE;
776610
-  meta_window_set_type (surface->window, META_WINDOW_MODAL_DIALOG);
776610
+  meta_window_set_type (window, META_WINDOW_MODAL_DIALOG);
776610
 }
776610
 
776610
 static void
776610
@@ -108,12 +111,17 @@ gtk_surface_unset_modal (struct wl_client   *client,
776610
 {
776610
   MetaWaylandGtkSurface *gtk_surface = wl_resource_get_user_data (resource);
776610
   MetaWaylandSurface *surface = gtk_surface->surface;
776610
+  MetaWindow *window;
776610
+
776610
+  window = surface->window;
776610
+  if (!window)
776610
+    return;
776610
 
776610
   if (!gtk_surface->is_modal)
776610
     return;
776610
 
776610
   gtk_surface->is_modal = FALSE;
776610
-  meta_window_set_type (surface->window, META_WINDOW_NORMAL);
776610
+  meta_window_set_type (window, META_WINDOW_NORMAL);
776610
 }
776610
 
776610
 static void
776610
@@ -123,8 +131,9 @@ gtk_surface_present (struct wl_client   *client,
776610
 {
776610
   MetaWaylandGtkSurface *gtk_surface = wl_resource_get_user_data (resource);
776610
   MetaWaylandSurface *surface = gtk_surface->surface;
776610
-  MetaWindow *window = surface->window;
776610
+  MetaWindow *window;
776610
 
776610
+  window = surface->window;
776610
   if (!window)
776610
     return;
776610
 
776610
-- 
776610
2.19.0
776610