1*4882a593SmuzhiyunFrom 6bd2665d8c15d6ea098c61ca78e00ec051c10ae7 Mon Sep 17 00:00:00 2001
2*4882a593SmuzhiyunFrom: Jeffy Chen <jeffy.chen@rock-chips.com>
3*4882a593SmuzhiyunDate: Mon, 19 Oct 2020 18:13:23 +0800
4*4882a593SmuzhiyunSubject: [PATCH 35/93] HACK: xdg-shell: Don't abort when client size
5*4882a593Smuzhiyun mismatched
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunThere's a race in qtwayland might causing size mismatch, let's
8*4882a593Smuzhiyunworkaround it here for now.
9*4882a593Smuzhiyun
10*4882a593SmuzhiyunSigned-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
11*4882a593Smuzhiyun---
12*4882a593Smuzhiyun libweston/desktop/xdg-shell.c | 38 +++++++++++------------------------
13*4882a593Smuzhiyun 1 file changed, 12 insertions(+), 26 deletions(-)
14*4882a593Smuzhiyun
15*4882a593Smuzhiyundiff --git a/libweston/desktop/xdg-shell.c b/libweston/desktop/xdg-shell.c
16*4882a593Smuzhiyunindex 636dc29..293b852 100644
17*4882a593Smuzhiyun--- a/libweston/desktop/xdg-shell.c
18*4882a593Smuzhiyun+++ b/libweston/desktop/xdg-shell.c
19*4882a593Smuzhiyun@@ -741,37 +741,23 @@ weston_desktop_xdg_toplevel_committed(struct weston_desktop_xdg_toplevel *toplev
20*4882a593Smuzhiyun 	if (toplevel->next.state.maximized &&
21*4882a593Smuzhiyun 	    (toplevel->next.size.width != geometry.width ||
22*4882a593Smuzhiyun 	     toplevel->next.size.height != geometry.height)) {
23*4882a593Smuzhiyun-		struct weston_desktop_client *client =
24*4882a593Smuzhiyun-			weston_desktop_surface_get_client(toplevel->base.desktop_surface);
25*4882a593Smuzhiyun-		struct wl_resource *client_resource =
26*4882a593Smuzhiyun-			weston_desktop_client_get_resource(client);
27*4882a593Smuzhiyun-
28*4882a593Smuzhiyun-		wl_resource_post_error(client_resource,
29*4882a593Smuzhiyun-				       XDG_WM_BASE_ERROR_INVALID_SURFACE_STATE,
30*4882a593Smuzhiyun-				       "xdg_surface geometry (%" PRIi32 " x %" PRIi32 ") "
31*4882a593Smuzhiyun-				       "does not match the configured maximized state (%" PRIi32 " x %" PRIi32 ")",
32*4882a593Smuzhiyun-				       geometry.width, geometry.height,
33*4882a593Smuzhiyun-				       toplevel->next.size.width,
34*4882a593Smuzhiyun-				       toplevel->next.size.height);
35*4882a593Smuzhiyun-		return;
36*4882a593Smuzhiyun+		weston_desktop_xdg_surface_schedule_configure(&toplevel->base);
37*4882a593Smuzhiyun+		weston_log("xdg_surface buffer (%" PRIi32 " x %" PRIi32 ") "
38*4882a593Smuzhiyun+			   "does not match the configured maximized state (%" PRIi32 " x %" PRIi32 ")",
39*4882a593Smuzhiyun+			   geometry.width, geometry.height,
40*4882a593Smuzhiyun+			   toplevel->next.size.width,
41*4882a593Smuzhiyun+			   toplevel->next.size.height);
42*4882a593Smuzhiyun 	}
43*4882a593Smuzhiyun
44*4882a593Smuzhiyun 	if (toplevel->next.state.fullscreen &&
45*4882a593Smuzhiyun 	    (toplevel->next.size.width < geometry.width ||
46*4882a593Smuzhiyun 	     toplevel->next.size.height < geometry.height)) {
47*4882a593Smuzhiyun-		struct weston_desktop_client *client =
48*4882a593Smuzhiyun-			weston_desktop_surface_get_client(toplevel->base.desktop_surface);
49*4882a593Smuzhiyun-		struct wl_resource *client_resource =
50*4882a593Smuzhiyun-			weston_desktop_client_get_resource(client);
51*4882a593Smuzhiyun-
52*4882a593Smuzhiyun-		wl_resource_post_error(client_resource,
53*4882a593Smuzhiyun-				       XDG_WM_BASE_ERROR_INVALID_SURFACE_STATE,
54*4882a593Smuzhiyun-				       "xdg_surface geometry (%" PRIi32 " x %" PRIi32 ") "
55*4882a593Smuzhiyun-				       "is larger than the configured fullscreen state (%" PRIi32 " x %" PRIi32 ")",
56*4882a593Smuzhiyun-				       geometry.width, geometry.height,
57*4882a593Smuzhiyun-				       toplevel->next.size.width,
58*4882a593Smuzhiyun-				       toplevel->next.size.height);
59*4882a593Smuzhiyun-		return;
60*4882a593Smuzhiyun+		weston_desktop_xdg_surface_schedule_configure(&toplevel->base);
61*4882a593Smuzhiyun+		weston_log("xdg_surface geometry (%" PRIi32 " x %" PRIi32 ") "
62*4882a593Smuzhiyun+			   "is larger than the configured fullscreen state (%" PRIi32 " x %" PRIi32 ")",
63*4882a593Smuzhiyun+			   geometry.width, geometry.height,
64*4882a593Smuzhiyun+			   toplevel->next.size.width,
65*4882a593Smuzhiyun+			   toplevel->next.size.height);
66*4882a593Smuzhiyun 	}
67*4882a593Smuzhiyun
68*4882a593Smuzhiyun 	toplevel->current.state = toplevel->next.state;
69*4882a593Smuzhiyun--
70*4882a593Smuzhiyun2.20.1
71*4882a593Smuzhiyun
72