From bf0f9215dcea76294406ad13f18deba2f53bd1d5 Mon Sep 17 00:00:00 2001 From: Keith Bowes Date: Thu, 8 Dec 2022 16:50:15 -0500 Subject: [PATCH] react to wlroots changes --- include/waybox/output.h | 1 + waybox/layer_shell.c | 4 ++++ waybox/output.c | 15 +++++++++++++++ 3 files changed, 20 insertions(+) diff --git a/include/waybox/output.h b/include/waybox/output.h index b11bcfd..323bb4d 100644 --- a/include/waybox/output.h +++ b/include/waybox/output.h @@ -26,6 +26,7 @@ struct wb_output { struct wl_listener destroy; struct wl_listener frame; + struct wl_listener request_state; struct wl_list link; }; diff --git a/waybox/layer_shell.c b/waybox/layer_shell.c index ece945c..0800e3c 100644 --- a/waybox/layer_shell.c +++ b/waybox/layer_shell.c @@ -360,7 +360,11 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) { } void init_layer_shell(struct wb_server *server) { +#if WLR_CHECK_VERSION(0, 17, 0) + server->layer_shell = wlr_layer_shell_v1_create(server->wl_display, 4); +#else server->layer_shell = wlr_layer_shell_v1_create(server->wl_display); +#endif server->new_layer_surface.notify = handle_layer_shell_surface; wl_signal_add(&server->layer_shell->events.new_surface, &server->new_layer_surface); diff --git a/waybox/output.c b/waybox/output.c index 3bd99bb..e69edec 100644 --- a/waybox/output.c +++ b/waybox/output.c @@ -26,11 +26,22 @@ void output_frame_notify(struct wl_listener *listener, void *data) { wlr_scene_output_send_frame_done(scene_output, &now); } +#if WLR_CHECK_VERSION(0, 17, 0) +void output_request_state_notify(struct wl_listener *listener, void *data) { + struct wb_output *output = wl_container_of(listener, output, request_state); + const struct wlr_output_event_request_state *event = data; + wlr_output_commit_state(output->wlr_output, event->state); +} +#endif + void output_destroy_notify(struct wl_listener *listener, void *data) { struct wb_output *output = wl_container_of(listener, output, destroy); wl_list_remove(&output->destroy.link); wl_list_remove(&output->frame.link); +#if WLR_CHECK_VERSION(0, 17, 0) + wl_list_remove(&output->request_state.link); +#endif /* Frees the layers */ size_t num_layers = sizeof(output->layers) / sizeof(struct wlr_scene_node *); @@ -91,6 +102,10 @@ void new_output_notify(struct wl_listener *listener, void *data) { wl_signal_add(&wlr_output->events.destroy, &output->destroy); output->frame.notify = output_frame_notify; wl_signal_add(&wlr_output->events.frame, &output->frame); +#if WLR_CHECK_VERSION(0, 17, 0) + output->request_state.notify = output_request_state_notify; + wl_signal_add(&wlr_output->events.request_state, &output->request_state); +#endif /* Adds this to the output layout. The add_auto function arranges outputs * from left-to-right in the order they appear. A more sophisticated