output: Implement request_state event listener

wlroots backends no longer change state on their own, and instead send a
request_state event. Monitor this event and apply any state we receive.
This commit is contained in:
Kenny Levinsen 2023-11-25 12:29:57 +01:00 committed by Simon Ser
parent c9d2f3afac
commit 63c0887664
2 changed files with 15 additions and 0 deletions

View file

@ -191,6 +191,17 @@ handle_output_commit(struct wl_listener *listener, void *data)
} }
} }
static void
handle_output_request_state(struct wl_listener *listener, void *data)
{
struct cg_output *output = wl_container_of(listener, output, request_state);
struct wlr_output_event_request_state *event = data;
if (wlr_output_commit_state(output->wlr_output, event->state)) {
update_output_manager_config(output->server);
}
}
void void
handle_output_layout_change(struct wl_listener *listener, void *data) handle_output_layout_change(struct wl_listener *listener, void *data)
{ {
@ -224,6 +235,7 @@ output_destroy(struct cg_output *output)
wl_list_remove(&output->destroy.link); wl_list_remove(&output->destroy.link);
wl_list_remove(&output->commit.link); wl_list_remove(&output->commit.link);
wl_list_remove(&output->request_state.link);
wl_list_remove(&output->frame.link); wl_list_remove(&output->frame.link);
wl_list_remove(&output->link); wl_list_remove(&output->link);
@ -272,6 +284,8 @@ handle_new_output(struct wl_listener *listener, void *data)
output->commit.notify = handle_output_commit; output->commit.notify = handle_output_commit;
wl_signal_add(&wlr_output->events.commit, &output->commit); wl_signal_add(&wlr_output->events.commit, &output->commit);
output->request_state.notify = handle_output_request_state;
wl_signal_add(&wlr_output->events.request_state, &output->request_state);
output->destroy.notify = handle_output_destroy; output->destroy.notify = handle_output_destroy;
wl_signal_add(&wlr_output->events.destroy, &output->destroy); wl_signal_add(&wlr_output->events.destroy, &output->destroy);
output->frame.notify = handle_output_frame; output->frame.notify = handle_output_frame;

View file

@ -13,6 +13,7 @@ struct cg_output {
struct wlr_scene_output *scene_output; struct wlr_scene_output *scene_output;
struct wl_listener commit; struct wl_listener commit;
struct wl_listener request_state;
struct wl_listener destroy; struct wl_listener destroy;
struct wl_listener frame; struct wl_listener frame;