mirror of
https://github.com/wizbright/waybox.git
synced 2025-10-29 05:40:20 -04:00
react to wlroots changes
This commit is contained in:
parent
e4b603a082
commit
bf0f9215dc
3 changed files with 20 additions and 0 deletions
|
|
@ -26,6 +26,7 @@ struct wb_output {
|
|||
|
||||
struct wl_listener destroy;
|
||||
struct wl_listener frame;
|
||||
struct wl_listener request_state;
|
||||
|
||||
struct wl_list link;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue