[mutter/wip/texture-purge-on-nvidia: 39/66] wayland/gtk-shell: Handle requests after toplevel was unmanaged



commit 2eac9ce318583da5325ded720ce28571649baef6
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Wed Jul 25 12:20:57 2018 +0200

    wayland/gtk-shell: Handle requests after toplevel was unmanaged
    
    As with xdg-toplevel, a gtk-surface can be unmanaged by the compositor
    without the client knowing about it, meaning the client may still send
    updates and make requests. Handle this gracefully by ignoring them. The
    client needs to reset all the state anyway, if it wants to remap the
    same surface.
    
    https://gitlab.gnome.org/GNOME/mutter/issues/240
    (cherry picked from commit ca5b27baf517f00354ff8811ba204fd90f1ddb38)

 src/wayland/meta-wayland-gtk-shell.c | 29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)
---
diff --git a/src/wayland/meta-wayland-gtk-shell.c b/src/wayland/meta-wayland-gtk-shell.c
index 891109a69..58375674a 100644
--- a/src/wayland/meta-wayland-gtk-shell.c
+++ b/src/wayland/meta-wayland-gtk-shell.c
@@ -71,15 +71,13 @@ gtk_surface_set_dbus_properties (struct wl_client   *client,
 {
   MetaWaylandGtkSurface *gtk_surface = wl_resource_get_user_data (resource);
   MetaWaylandSurface *surface = gtk_surface->surface;
+  MetaWindow *window;
 
-  /* Broken client, let it die instead of us */
-  if (!surface->window)
-    {
-      meta_warning ("meta-wayland-surface: set_dbus_properties called with invalid window!\n");
-      return;
-    }
+  window = surface->window;
+  if (!window)
+    return;
 
-  meta_window_set_gtk_dbus_properties (surface->window,
+  meta_window_set_gtk_dbus_properties (window,
                                        application_id,
                                        unique_bus_name,
                                        app_menu_path,
@@ -94,12 +92,17 @@ gtk_surface_set_modal (struct wl_client   *client,
 {
   MetaWaylandGtkSurface *gtk_surface = wl_resource_get_user_data (resource);
   MetaWaylandSurface *surface = gtk_surface->surface;
+  MetaWindow *window;
+
+  window = surface->window;
+  if (!window)
+    return;
 
   if (gtk_surface->is_modal)
     return;
 
   gtk_surface->is_modal = TRUE;
-  meta_window_set_type (surface->window, META_WINDOW_MODAL_DIALOG);
+  meta_window_set_type (window, META_WINDOW_MODAL_DIALOG);
 }
 
 static void
@@ -108,12 +111,17 @@ gtk_surface_unset_modal (struct wl_client   *client,
 {
   MetaWaylandGtkSurface *gtk_surface = wl_resource_get_user_data (resource);
   MetaWaylandSurface *surface = gtk_surface->surface;
+  MetaWindow *window;
+
+  window = surface->window;
+  if (!window)
+    return;
 
   if (!gtk_surface->is_modal)
     return;
 
   gtk_surface->is_modal = FALSE;
-  meta_window_set_type (surface->window, META_WINDOW_NORMAL);
+  meta_window_set_type (window, META_WINDOW_NORMAL);
 }
 
 static void
@@ -123,8 +131,9 @@ gtk_surface_present (struct wl_client   *client,
 {
   MetaWaylandGtkSurface *gtk_surface = wl_resource_get_user_data (resource);
   MetaWaylandSurface *surface = gtk_surface->surface;
-  MetaWindow *window = surface->window;
+  MetaWindow *window;
 
+  window = surface->window;
   if (!window)
     return;
 


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