tinywl: don't send configures to uninitialized xdg_surfaces

This commit is contained in:
Kirill Primak 2023-11-23 16:10:54 +03:00
parent 1f64f3925c
commit 1cc7ab3e29

View file

@ -751,22 +751,28 @@ static void xdg_toplevel_request_resize(
static void xdg_toplevel_request_maximize( static void xdg_toplevel_request_maximize(
struct wl_listener *listener, void *data) { struct wl_listener *listener, void *data) {
/* This event is raised when a client would like to maximize itself, /* This event is raised when a client would like to maximize itself,
* typically because the user clicked on the maximize button on * typically because the user clicked on the maximize button on client-side
* client-side decorations. tinywl doesn't support maximization, but * decorations. tinywl doesn't support maximization, but to conform to
* to conform to xdg-shell protocol we still must send a configure. * xdg-shell protocol we still must send a configure.
* wlr_xdg_surface_schedule_configure() is used to send an empty reply. */ * 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 = struct tinywl_toplevel *toplevel =
wl_container_of(listener, toplevel, request_maximize); wl_container_of(listener, toplevel, request_maximize);
if (toplevel->xdg_toplevel->base->initial_commit) {
wlr_xdg_surface_schedule_configure(toplevel->xdg_toplevel->base); wlr_xdg_surface_schedule_configure(toplevel->xdg_toplevel->base);
} }
}
static void xdg_toplevel_request_fullscreen( static void xdg_toplevel_request_fullscreen(
struct wl_listener *listener, void *data) { struct wl_listener *listener, void *data) {
/* Just as with request_maximize, we must send a configure here. */ /* Just as with request_maximize, we must send a configure here. */
struct tinywl_toplevel *toplevel = struct tinywl_toplevel *toplevel =
wl_container_of(listener, toplevel, request_fullscreen); wl_container_of(listener, toplevel, request_fullscreen);
if (toplevel->xdg_toplevel->base->initial_commit) {
wlr_xdg_surface_schedule_configure(toplevel->xdg_toplevel->base); wlr_xdg_surface_schedule_configure(toplevel->xdg_toplevel->base);
} }
}
static void server_new_xdg_toplevel(struct wl_listener *listener, void *data) { static void server_new_xdg_toplevel(struct wl_listener *listener, void *data) {
/* This event is raised when a client creates a new toplevel (application window). */ /* This event is raised when a client creates a new toplevel (application window). */