opt: optimzie handle requestmonstate

This commit is contained in:
DreamMaoMao
2025-12-29 13:27:11 +08:00
parent f749500449
commit d3790e9c7a

View File

@@ -3344,9 +3344,31 @@ fullscreennotify(struct wl_listener *listener, void *data) {
} }
void requestmonstate(struct wl_listener *listener, void *data) { void requestmonstate(struct wl_listener *listener, void *data) {
struct wlr_output_event_request_state *event = data; /* This ensures nested backends can be resized */
wlr_output_commit_state(event->output, event->state); Monitor *m = wl_container_of(listener, m, request_state);
const struct wlr_output_event_request_state *event = data;
if (event->state->committed == WLR_OUTPUT_STATE_MODE) {
switch (event->state->mode_type) {
case WLR_OUTPUT_STATE_MODE_FIXED:
wlr_output_state_set_mode(&m->pending, event->state->mode);
break;
case WLR_OUTPUT_STATE_MODE_CUSTOM:
wlr_output_state_set_custom_mode(&m->pending,
event->state->custom_mode.width,
event->state->custom_mode.height,
event->state->custom_mode.refresh);
break;
}
updatemons(NULL, NULL); updatemons(NULL, NULL);
wlr_output_schedule_frame(m->wlr_output);
return;
}
if (!wlr_output_commit_state(m->wlr_output, event->state)) {
wlr_log(WLR_ERROR,
"Backend requested a new state that could not be applied");
}
} }
void inputdevice(struct wl_listener *listener, void *data) { void inputdevice(struct wl_listener *listener, void *data) {