From 27d7067762b07796689d0375fb5728aa8267b9c0 Mon Sep 17 00:00:00 2001 From: Jason Francis Date: Wed, 14 Aug 2019 14:20:11 -0400 Subject: [PATCH] Force roundtrip after applying settings --- src/main.c | 5 ++++- src/outputs.c | 5 ++++- src/wdisplays.h | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index e679ce8..704cfa4 100644 --- a/src/main.c +++ b/src/main.c @@ -150,7 +150,10 @@ static gboolean send_apply(gpointer data) { wl_list_insert(outputs, &output->link); fill_output_from_form(output, GTK_WIDGET(form_iter->data)); } - wd_apply_state(state, outputs); + GdkWindow *window = gtk_widget_get_window(state->stack); + GdkDisplay *display = gdk_window_get_display(window); + struct wl_display *wl_display = gdk_wayland_display_get_wl_display(display); + wd_apply_state(state, outputs, wl_display); state->apply_pending = false; return FALSE; } diff --git a/src/outputs.c b/src/outputs.c index 522b619..f9edcd5 100644 --- a/src/outputs.c +++ b/src/outputs.c @@ -100,7 +100,8 @@ static const struct zwlr_output_configuration_v1_listener config_listener = { .cancelled = config_handle_cancelled, }; -void wd_apply_state(struct wd_state *state, struct wl_list *new_outputs) { +void wd_apply_state(struct wd_state *state, struct wl_list *new_outputs, + struct wl_display *display) { struct zwlr_output_configuration_v1 *config = zwlr_output_manager_v1_create_configuration(state->output_manager, state->serial); @@ -154,6 +155,8 @@ void wd_apply_state(struct wd_state *state, struct wl_list *new_outputs) { } zwlr_output_configuration_v1_apply(config); + + wl_display_roundtrip(display); } static void wd_frame_destroy(struct wd_frame *frame) { diff --git a/src/wdisplays.h b/src/wdisplays.h index feb5dd1..fa6a346 100644 --- a/src/wdisplays.h +++ b/src/wdisplays.h @@ -281,7 +281,7 @@ void wd_add_output_management_listener(struct wd_state *state, struct wl_display /* * Sends updated display configuration back to the compositor. */ -void wd_apply_state(struct wd_state *state, struct wl_list *new_outputs); +void wd_apply_state(struct wd_state *state, struct wl_list *new_outputs, struct wl_display *display); /* * Queues capture of the next frame of all screens.