aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/output.c
diff options
context:
space:
mode:
authorLibravatar Simon Ser <contact@emersion.fr>2019-11-17 00:24:19 +0100
committerLibravatar Drew DeVault <sir@cmpwn.com>2019-11-21 11:19:00 -0500
commit1d3cbe9f278297fffa83e4e0c99d8ba46903cc3e (patch)
tree7d34bc02a4b205d4ffba77760064b6d9e70894a7 /sway/desktop/output.c
parentAdd support for wlr_keyboard_group (diff)
downloadsway-1d3cbe9f278297fffa83e4e0c99d8ba46903cc3e.tar.gz
sway-1d3cbe9f278297fffa83e4e0c99d8ba46903cc3e.tar.zst
sway-1d3cbe9f278297fffa83e4e0c99d8ba46903cc3e.zip
Use new presentation-time helper
This has the advantage to (1) reduce boilerplate and (2) make us correctly handle wlr_output_event_present.commit_seq.
Diffstat (limited to 'sway/desktop/output.c')
-rw-r--r--sway/desktop/output.c21
1 files changed, 2 insertions, 19 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index dea087c6..400f1d66 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -498,7 +498,8 @@ static bool scan_out_fullscreen_view(struct sway_output *output,
498 return false; 498 return false;
499 } 499 }
500 500
501 wlr_presentation_surface_sampled(server.presentation, surface); 501 wlr_presentation_surface_sampled_on_output(server.presentation, surface,
502 wlr_output);
502 503
503 if (!wlr_output_attach_buffer(wlr_output, surface->buffer)) { 504 if (!wlr_output_attach_buffer(wlr_output, surface->buffer)) {
504 return false; 505 return false;
@@ -842,14 +843,6 @@ static void handle_scale(struct wl_listener *listener, void *data) {
842 update_output_manager_config(output->server); 843 update_output_manager_config(output->server);
843} 844}
844 845
845static void send_presented_iterator(struct sway_output *output, struct sway_view *view,
846 struct wlr_surface *surface, struct wlr_box *box, float rotation,
847 void *data) {
848 struct wlr_presentation_event *event = data;
849 wlr_presentation_send_surface_presented(server.presentation,
850 surface, event);
851}
852
853static void handle_present(struct wl_listener *listener, void *data) { 846static void handle_present(struct wl_listener *listener, void *data) {
854 struct sway_output *output = wl_container_of(listener, output, present); 847 struct sway_output *output = wl_container_of(listener, output, present);
855 struct wlr_output_event_present *output_event = data; 848 struct wlr_output_event_present *output_event = data;
@@ -860,16 +853,6 @@ static void handle_present(struct wl_listener *listener, void *data) {
860 853
861 output->last_presentation = *output_event->when; 854 output->last_presentation = *output_event->when;
862 output->refresh_nsec = output_event->refresh; 855 output->refresh_nsec = output_event->refresh;
863
864 struct wlr_presentation_event event = {
865 .output = output->wlr_output,
866 .tv_sec = (uint64_t)output_event->when->tv_sec,
867 .tv_nsec = (uint32_t)output_event->when->tv_nsec,
868 .refresh = (uint32_t)output_event->refresh,
869 .seq = (uint64_t)output_event->seq,
870 .flags = output_event->flags,
871 };
872 output_for_each_surface(output, send_presented_iterator, &event);
873} 856}
874 857
875void handle_new_output(struct wl_listener *listener, void *data) { 858void handle_new_output(struct wl_listener *listener, void *data) {