diff options
author | Simon Ser <contact@emersion.fr> | 2021-01-28 16:19:15 +0100 |
---|---|---|
committer | Simon Zeni <simon@bl4ckb0ne.ca> | 2022-11-15 11:05:47 -0500 |
commit | 907ca48a612971fd6ab43afb47554c77551fbddf (patch) | |
tree | 6aa9276452b00c990aae643dd2b178d66e8a260c | |
parent | input/seat: locally compute drag icon offset (diff) | |
download | sway-907ca48a612971fd6ab43afb47554c77551fbddf.tar.gz sway-907ca48a612971fd6ab43afb47554c77551fbddf.tar.zst sway-907ca48a612971fd6ab43afb47554c77551fbddf.zip |
Listen to the output request_state event
References: https://github.com/swaywm/wlroots/pull/2693
-rw-r--r-- | include/sway/output.h | 1 | ||||
-rw-r--r-- | sway/desktop/output.c | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/include/sway/output.h b/include/sway/output.h index 7ccaa09c..5af5b731 100644 --- a/include/sway/output.h +++ b/include/sway/output.h | |||
@@ -48,6 +48,7 @@ struct sway_output { | |||
48 | struct wl_listener damage; | 48 | struct wl_listener damage; |
49 | struct wl_listener frame; | 49 | struct wl_listener frame; |
50 | struct wl_listener needs_frame; | 50 | struct wl_listener needs_frame; |
51 | struct wl_listener request_state; | ||
51 | 52 | ||
52 | struct { | 53 | struct { |
53 | struct wl_signal disable; | 54 | struct wl_signal disable; |
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 81a20e25..04bddf86 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -806,6 +806,7 @@ static void handle_destroy(struct wl_listener *listener, void *data) { | |||
806 | wl_list_remove(&output->damage.link); | 806 | wl_list_remove(&output->damage.link); |
807 | wl_list_remove(&output->frame.link); | 807 | wl_list_remove(&output->frame.link); |
808 | wl_list_remove(&output->needs_frame.link); | 808 | wl_list_remove(&output->needs_frame.link); |
809 | wl_list_remove(&output->request_state.link); | ||
809 | 810 | ||
810 | wlr_damage_ring_finish(&output->damage_ring); | 811 | wlr_damage_ring_finish(&output->damage_ring); |
811 | 812 | ||
@@ -893,6 +894,13 @@ static void handle_present(struct wl_listener *listener, void *data) { | |||
893 | output->refresh_nsec = output_event->refresh; | 894 | output->refresh_nsec = output_event->refresh; |
894 | } | 895 | } |
895 | 896 | ||
897 | static void handle_request_state(struct wl_listener *listener, void *data) { | ||
898 | struct sway_output *output = | ||
899 | wl_container_of(listener, output, request_state); | ||
900 | const struct wlr_output_event_request_state *event = data; | ||
901 | wlr_output_commit_state(output->wlr_output, event->state); | ||
902 | } | ||
903 | |||
896 | static unsigned int last_headless_num = 0; | 904 | static unsigned int last_headless_num = 0; |
897 | 905 | ||
898 | void handle_new_output(struct wl_listener *listener, void *data) { | 906 | void handle_new_output(struct wl_listener *listener, void *data) { |
@@ -950,6 +958,8 @@ void handle_new_output(struct wl_listener *listener, void *data) { | |||
950 | output->frame.notify = handle_frame; | 958 | output->frame.notify = handle_frame; |
951 | wl_signal_add(&wlr_output->events.needs_frame, &output->needs_frame); | 959 | wl_signal_add(&wlr_output->events.needs_frame, &output->needs_frame); |
952 | output->needs_frame.notify = handle_needs_frame; | 960 | output->needs_frame.notify = handle_needs_frame; |
961 | wl_signal_add(&wlr_output->events.request_state, &output->request_state); | ||
962 | output->request_state.notify = handle_request_state; | ||
953 | 963 | ||
954 | output->repaint_timer = wl_event_loop_add_timer(server->wl_event_loop, | 964 | output->repaint_timer = wl_event_loop_add_timer(server->wl_event_loop, |
955 | output_repaint_timer_handler, output); | 965 | output_repaint_timer_handler, output); |