aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Primak <vyivel@eclair.cafe>2023-11-23 16:10:54 +0300
committerKirill Primak <vyivel@eclair.cafe>2023-12-07 12:43:39 +0300
commit1cc7ab3e2927d6efb7659905ad4cdd37d816e436 (patch)
tree0efc713371125cd265c0bfbf77456cf9c53d60bd
parent1f64f3925c384e9bf20ad813ee3a9195403606ea (diff)
tinywl: don't send configures to uninitialized xdg_surfaces
-rw-r--r--tinywl/tinywl.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/tinywl/tinywl.c b/tinywl/tinywl.c
index 1dfca170..d620e682 100644
--- a/tinywl/tinywl.c
+++ b/tinywl/tinywl.c
@@ -751,13 +751,17 @@ static void xdg_toplevel_request_resize(
static void xdg_toplevel_request_maximize(
struct wl_listener *listener, void *data) {
/* This event is raised when a client would like to maximize itself,
- * typically because the user clicked on the maximize button on
- * client-side decorations. tinywl doesn't support maximization, but
- * to conform to xdg-shell protocol we still must send a configure.
- * wlr_xdg_surface_schedule_configure() is used to send an empty reply. */
+ * typically because the user clicked on the maximize button on client-side
+ * decorations. tinywl doesn't support maximization, but to conform to
+ * xdg-shell protocol we still must send a configure.
+ * wlr_xdg_surface_schedule_configure() is used to send an empty reply.
+ * However, if the request was sent before an initial commit, we don't do
+ * anything and let the client finish the initial surface setup. */
struct tinywl_toplevel *toplevel =
wl_container_of(listener, toplevel, request_maximize);
- wlr_xdg_surface_schedule_configure(toplevel->xdg_toplevel->base);
+ if (toplevel->xdg_toplevel->base->initial_commit) {
+ wlr_xdg_surface_schedule_configure(toplevel->xdg_toplevel->base);
+ }
}
static void xdg_toplevel_request_fullscreen(
@@ -765,7 +769,9 @@ static void xdg_toplevel_request_fullscreen(
/* Just as with request_maximize, we must send a configure here. */
struct tinywl_toplevel *toplevel =
wl_container_of(listener, toplevel, request_fullscreen);
- wlr_xdg_surface_schedule_configure(toplevel->xdg_toplevel->base);
+ if (toplevel->xdg_toplevel->base->initial_commit) {
+ wlr_xdg_surface_schedule_configure(toplevel->xdg_toplevel->base);
+ }
}
static void server_new_xdg_toplevel(struct wl_listener *listener, void *data) {