|
|
776610 |
From a22cb8832de7ff7323f87888afd91a3b94629530 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 13:24:20 +0200
|
|
|
776610 |
Subject: [PATCH 7/8] wayland/legacy-xdg-shell: Handle requests after toplevel
|
|
|
776610 |
was unmanaged
|
|
|
776610 |
|
|
|
776610 |
As with xdg-toplevel proper, a legacy xdg-toplevel can be unmanaged by
|
|
|
776610 |
the compositor without the client knowing about it, meaning the client
|
|
|
776610 |
may still send updates and make requests. Handle this gracefully by
|
|
|
776610 |
ignoring them. The client needs to reassign the surface the legacy
|
|
|
776610 |
xdg-toplevel role again, if it wants to remap the same surface, meaning
|
|
|
776610 |
all state would be reset anyway.
|
|
|
776610 |
|
|
|
776610 |
Closes: https://gitlab.gnome.org/GNOME/mutter/issues/240
|
|
|
776610 |
(cherry picked from commit 64df6276881c5f42c6d2054d556d8cd391f7ee70)
|
|
|
776610 |
---
|
|
|
776610 |
src/wayland/meta-wayland-legacy-xdg-shell.c | 93 +++++++++++++++++----
|
|
|
776610 |
1 file changed, 79 insertions(+), 14 deletions(-)
|
|
|
776610 |
|
|
|
776610 |
diff --git a/src/wayland/meta-wayland-legacy-xdg-shell.c b/src/wayland/meta-wayland-legacy-xdg-shell.c
|
|
|
776610 |
index 861270193..addd0855f 100644
|
|
|
776610 |
--- a/src/wayland/meta-wayland-legacy-xdg-shell.c
|
|
|
776610 |
+++ b/src/wayland/meta-wayland-legacy-xdg-shell.c
|
|
|
776610 |
@@ -185,6 +185,11 @@ zxdg_toplevel_v6_set_parent (struct wl_client *client,
|
|
|
776610 |
{
|
|
|
776610 |
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
|
|
|
776610 |
MetaWindow *transient_for = NULL;
|
|
|
776610 |
+ MetaWindow *window;
|
|
|
776610 |
+
|
|
|
776610 |
+ window = surface->window;
|
|
|
776610 |
+ if (!window)
|
|
|
776610 |
+ return;
|
|
|
776610 |
|
|
|
776610 |
if (parent_resource)
|
|
|
776610 |
{
|
|
|
776610 |
@@ -194,7 +199,7 @@ zxdg_toplevel_v6_set_parent (struct wl_client *client,
|
|
|
776610 |
transient_for = parent_surface->window;
|
|
|
776610 |
}
|
|
|
776610 |
|
|
|
776610 |
- meta_window_set_transient_for (surface->window, transient_for);
|
|
|
776610 |
+ meta_window_set_transient_for (window, transient_for);
|
|
|
776610 |
}
|
|
|
776610 |
|
|
|
776610 |
static void
|
|
|
776610 |
@@ -203,11 +208,16 @@ zxdg_toplevel_v6_set_title (struct wl_client *client,
|
|
|
776610 |
const char *title)
|
|
|
776610 |
{
|
|
|
776610 |
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
|
|
|
776610 |
+ MetaWindow *window;
|
|
|
776610 |
+
|
|
|
776610 |
+ window = surface->window;
|
|
|
776610 |
+ if (!window)
|
|
|
776610 |
+ return;
|
|
|
776610 |
|
|
|
776610 |
if (!g_utf8_validate (title, -1, NULL))
|
|
|
776610 |
title = "";
|
|
|
776610 |
|
|
|
776610 |
- meta_window_set_title (surface->window, title);
|
|
|
776610 |
+ meta_window_set_title (window, title);
|
|
|
776610 |
}
|
|
|
776610 |
|
|
|
776610 |
static void
|
|
|
776610 |
@@ -216,11 +226,16 @@ zxdg_toplevel_v6_set_app_id (struct wl_client *client,
|
|
|
776610 |
const char *app_id)
|
|
|
776610 |
{
|
|
|
776610 |
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
|
|
|
776610 |
+ MetaWindow *window;
|
|
|
776610 |
+
|
|
|
776610 |
+ window = surface->window;
|
|
|
776610 |
+ if (!window)
|
|
|
776610 |
+ return;
|
|
|
776610 |
|
|
|
776610 |
if (!g_utf8_validate (app_id, -1, NULL))
|
|
|
776610 |
app_id = "";
|
|
|
776610 |
|
|
|
776610 |
- meta_window_set_wm_class (surface->window, app_id, app_id);
|
|
|
776610 |
+ meta_window_set_wm_class (window, app_id, app_id);
|
|
|
776610 |
}
|
|
|
776610 |
|
|
|
776610 |
static void
|
|
|
776610 |
@@ -233,15 +248,20 @@ zxdg_toplevel_v6_show_window_menu (struct wl_client *client,
|
|
|
776610 |
{
|
|
|
776610 |
MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);
|
|
|
776610 |
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
|
|
|
776610 |
+ MetaWindow *window;
|
|
|
776610 |
int monitor_scale;
|
|
|
776610 |
|
|
|
776610 |
+ window = surface->window;
|
|
|
776610 |
+ if (!window)
|
|
|
776610 |
+ return;
|
|
|
776610 |
+
|
|
|
776610 |
if (!meta_wayland_seat_get_grab_info (seat, surface, serial, FALSE, NULL, NULL))
|
|
|
776610 |
return;
|
|
|
776610 |
|
|
|
776610 |
- monitor_scale = surface->window->monitor->scale;
|
|
|
776610 |
- meta_window_show_menu (surface->window, META_WINDOW_MENU_WM,
|
|
|
776610 |
- surface->window->buffer_rect.x + (x * monitor_scale),
|
|
|
776610 |
- surface->window->buffer_rect.y + (y * monitor_scale));
|
|
|
776610 |
+ monitor_scale = window->monitor->scale;
|
|
|
776610 |
+ meta_window_show_menu (window, META_WINDOW_MENU_WM,
|
|
|
776610 |
+ window->buffer_rect.x + (x * monitor_scale),
|
|
|
776610 |
+ window->buffer_rect.y + (y * monitor_scale));
|
|
|
776610 |
}
|
|
|
776610 |
|
|
|
776610 |
static void
|
|
|
776610 |
@@ -252,8 +272,13 @@ zxdg_toplevel_v6_move (struct wl_client *client,
|
|
|
776610 |
{
|
|
|
776610 |
MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);
|
|
|
776610 |
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
|
|
|
776610 |
+ MetaWindow *window;
|
|
|
776610 |
gfloat x, y;
|
|
|
776610 |
|
|
|
776610 |
+ window = surface->window;
|
|
|
776610 |
+ if (!window)
|
|
|
776610 |
+ return;
|
|
|
776610 |
+
|
|
|
776610 |
if (!meta_wayland_seat_get_grab_info (seat, surface, serial, TRUE, &x, &y))
|
|
|
776610 |
return;
|
|
|
776610 |
|
|
|
776610 |
@@ -292,9 +317,14 @@ zxdg_toplevel_v6_resize (struct wl_client *client,
|
|
|
776610 |
{
|
|
|
776610 |
MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);
|
|
|
776610 |
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
|
|
|
776610 |
+ MetaWindow *window;
|
|
|
776610 |
gfloat x, y;
|
|
|
776610 |
MetaGrabOp grab_op;
|
|
|
776610 |
|
|
|
776610 |
+ window = surface->window;
|
|
|
776610 |
+ if (!window)
|
|
|
776610 |
+ return;
|
|
|
776610 |
+
|
|
|
776610 |
if (!meta_wayland_seat_get_grab_info (seat, surface, serial, TRUE, &x, &y))
|
|
|
776610 |
return;
|
|
|
776610 |
|
|
|
776610 |
@@ -309,6 +339,11 @@ zxdg_toplevel_v6_set_max_size (struct wl_client *client,
|
|
|
776610 |
int32_t height)
|
|
|
776610 |
{
|
|
|
776610 |
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
|
|
|
776610 |
+ MetaWindow *window;
|
|
|
776610 |
+
|
|
|
776610 |
+ window = surface->window;
|
|
|
776610 |
+ if (!window)
|
|
|
776610 |
+ return;
|
|
|
776610 |
|
|
|
776610 |
if (width < 0 || height < 0)
|
|
|
776610 |
{
|
|
|
776610 |
@@ -331,6 +366,11 @@ zxdg_toplevel_v6_set_min_size (struct wl_client *client,
|
|
|
776610 |
int32_t height)
|
|
|
776610 |
{
|
|
|
776610 |
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
|
|
|
776610 |
+ MetaWindow *window;
|
|
|
776610 |
+
|
|
|
776610 |
+ window = surface->window;
|
|
|
776610 |
+ if (!window)
|
|
|
776610 |
+ return;
|
|
|
776610 |
|
|
|
776610 |
if (width < 0 || height < 0)
|
|
|
776610 |
{
|
|
|
776610 |
@@ -351,9 +391,14 @@ zxdg_toplevel_v6_set_maximized (struct wl_client *client,
|
|
|
776610 |
struct wl_resource *resource)
|
|
|
776610 |
{
|
|
|
776610 |
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
|
|
|
776610 |
+ MetaWindow *window;
|
|
|
776610 |
|
|
|
776610 |
- meta_window_force_placement (surface->window, TRUE);
|
|
|
776610 |
- meta_window_maximize (surface->window, META_MAXIMIZE_BOTH);
|
|
|
776610 |
+ window = surface->window;
|
|
|
776610 |
+ if (!window)
|
|
|
776610 |
+ return;
|
|
|
776610 |
+
|
|
|
776610 |
+ meta_window_force_placement (window, TRUE);
|
|
|
776610 |
+ meta_window_maximize (window, META_MAXIMIZE_BOTH);
|
|
|
776610 |
}
|
|
|
776610 |
|
|
|
776610 |
static void
|
|
|
776610 |
@@ -361,8 +406,13 @@ zxdg_toplevel_v6_unset_maximized (struct wl_client *client,
|
|
|
776610 |
struct wl_resource *resource)
|
|
|
776610 |
{
|
|
|
776610 |
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
|
|
|
776610 |
+ MetaWindow *window;
|
|
|
776610 |
+
|
|
|
776610 |
+ window = surface->window;
|
|
|
776610 |
+ if (!window)
|
|
|
776610 |
+ return;
|
|
|
776610 |
|
|
|
776610 |
- meta_window_unmaximize (surface->window, META_MAXIMIZE_BOTH);
|
|
|
776610 |
+ meta_window_unmaximize (window, META_MAXIMIZE_BOTH);
|
|
|
776610 |
}
|
|
|
776610 |
|
|
|
776610 |
static void
|
|
|
776610 |
@@ -371,15 +421,20 @@ zxdg_toplevel_v6_set_fullscreen (struct wl_client *client,
|
|
|
776610 |
struct wl_resource *output_resource)
|
|
|
776610 |
{
|
|
|
776610 |
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
|
|
|
776610 |
+ MetaWindow *window;
|
|
|
776610 |
+
|
|
|
776610 |
+ window = surface->window;
|
|
|
776610 |
+ if (!window)
|
|
|
776610 |
+ return;
|
|
|
776610 |
|
|
|
776610 |
if (output_resource)
|
|
|
776610 |
{
|
|
|
776610 |
MetaWaylandOutput *output = wl_resource_get_user_data (output_resource);
|
|
|
776610 |
if (output)
|
|
|
776610 |
- meta_window_move_to_monitor (surface->window, output->logical_monitor->number);
|
|
|
776610 |
+ meta_window_move_to_monitor (window, output->logical_monitor->number);
|
|
|
776610 |
}
|
|
|
776610 |
|
|
|
776610 |
- meta_window_make_fullscreen (surface->window);
|
|
|
776610 |
+ meta_window_make_fullscreen (window);
|
|
|
776610 |
}
|
|
|
776610 |
|
|
|
776610 |
static void
|
|
|
776610 |
@@ -387,8 +442,13 @@ zxdg_toplevel_v6_unset_fullscreen (struct wl_client *client,
|
|
|
776610 |
struct wl_resource *resource)
|
|
|
776610 |
{
|
|
|
776610 |
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
|
|
|
776610 |
+ MetaWindow *window;
|
|
|
776610 |
+
|
|
|
776610 |
+ window = surface->window;
|
|
|
776610 |
+ if (!window)
|
|
|
776610 |
+ return;
|
|
|
776610 |
|
|
|
776610 |
- meta_window_unmake_fullscreen (surface->window);
|
|
|
776610 |
+ meta_window_unmake_fullscreen (window);
|
|
|
776610 |
}
|
|
|
776610 |
|
|
|
776610 |
static void
|
|
|
776610 |
@@ -396,8 +456,13 @@ zxdg_toplevel_v6_set_minimized (struct wl_client *client,
|
|
|
776610 |
struct wl_resource *resource)
|
|
|
776610 |
{
|
|
|
776610 |
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
|
|
|
776610 |
+ MetaWindow *window;
|
|
|
776610 |
+
|
|
|
776610 |
+ window = surface->window;
|
|
|
776610 |
+ if (!window)
|
|
|
776610 |
+ return;
|
|
|
776610 |
|
|
|
776610 |
- meta_window_minimize (surface->window);
|
|
|
776610 |
+ meta_window_minimize (window);
|
|
|
776610 |
}
|
|
|
776610 |
|
|
|
776610 |
static const struct zxdg_toplevel_v6_interface meta_wayland_zxdg_toplevel_v6_interface = {
|
|
|
776610 |
--
|
|
|
776610 |
2.19.0
|
|
|
776610 |
|