mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2024-11-21 22:52:20 +00:00
backend/wayland: don't request a state too early
An xdg_toplevel configure sequence ends with xdg_surface.configure. Wait for it before relaying the request to the guest compositor.
This commit is contained in:
parent
a62dfebf10
commit
94e7165e85
@ -744,7 +744,22 @@ static void xdg_surface_handle_configure(void *data,
|
||||
output->configured = true;
|
||||
xdg_surface_ack_configure(xdg_surface, serial);
|
||||
|
||||
// nothing else?
|
||||
int32_t req_width = output->wlr_output.width;
|
||||
int32_t req_height = output->wlr_output.height;
|
||||
if (output->requested_width > 0) {
|
||||
req_width = output->requested_width;
|
||||
output->requested_width = 0;
|
||||
}
|
||||
if (output->requested_height > 0) {
|
||||
req_height = output->requested_height;
|
||||
output->requested_height = 0;
|
||||
}
|
||||
|
||||
struct wlr_output_state state;
|
||||
wlr_output_state_init(&state);
|
||||
wlr_output_state_set_custom_mode(&state, req_width, req_height, 0);
|
||||
wlr_output_send_request_state(&output->wlr_output, &state);
|
||||
wlr_output_state_finish(&state);
|
||||
}
|
||||
|
||||
static const struct xdg_surface_listener xdg_surface_listener = {
|
||||
@ -757,15 +772,12 @@ static void xdg_toplevel_handle_configure(void *data,
|
||||
struct wlr_wl_output *output = data;
|
||||
assert(output && output->xdg_toplevel == xdg_toplevel);
|
||||
|
||||
if (width == 0 || height == 0) {
|
||||
return;
|
||||
if (width > 0) {
|
||||
output->requested_width = width;
|
||||
}
|
||||
if (height > 0) {
|
||||
output->requested_height = height;
|
||||
}
|
||||
|
||||
struct wlr_output_state state;
|
||||
wlr_output_state_init(&state);
|
||||
wlr_output_state_set_custom_mode(&state, width, height, 0);
|
||||
wlr_output_send_request_state(&output->wlr_output, &state);
|
||||
wlr_output_state_finish(&state);
|
||||
}
|
||||
|
||||
static void xdg_toplevel_handle_close(void *data,
|
||||
|
@ -92,6 +92,9 @@ struct wlr_wl_output {
|
||||
|
||||
char *title;
|
||||
|
||||
// 0 if not requested
|
||||
int32_t requested_width, requested_height;
|
||||
|
||||
bool configured;
|
||||
uint32_t enter_serial;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user