summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2023-05-03 08:50:19 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2023-05-03 08:50:19 +0200
commita94fed77e4c6f6b4528eb79ef01edf370de62d13 (patch)
tree683e24b83dc6254486147cb950008dc078cda321 /src/drivers
parent9ffeef76975579e0d838ea781a64ec66b92c9851 (diff)
Wayland: clearer procedure to complete initialisation of screen data
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Screen_Driver.H1
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx10
2 files changed, 10 insertions, 1 deletions
diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H
index aeacf033d..c20477dba 100644
--- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H
+++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H
@@ -73,6 +73,7 @@ public:
struct wl_output *wl_output;
int wld_scale; // Wayland scale factor
float gui_scale; // FLTK scale factor
+ bool done;
struct wl_list link;
};
diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
index ed9ae1313..3c08492a8 100644
--- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
@@ -977,6 +977,7 @@ static void output_done(void *data, struct wl_output *wl_output)
}
xp = xp->next;
}
+ output->done = true;
Fl_Wayland_Screen_Driver *scr_driver = (Fl_Wayland_Screen_Driver*)Fl::screen_driver();
if (scr_driver->seat) try_update_cursor(scr_driver->seat);
@@ -1082,7 +1083,6 @@ static void registry_handle_global(void *user_data, struct wl_registry *wl_regis
wl_output_add_listener(output->wl_output, &output_listener, output);
wl_list_insert(&(scr_driver->outputs), &output->link);
scr_driver->screen_count_set( wl_list_length(&(scr_driver->outputs)) );
- wl_display_roundtrip(scr_driver->wl_display); // important
//fprintf(stderr, "wl_output: id=%d wl_output=%p screen_count()=%d\n", id, output->wl_output, Fl::screen_count());
} else if (strcmp(interface, xdg_wm_base_interface.name) == 0) {
@@ -1107,6 +1107,7 @@ static void registry_handle_global(void *user_data, struct wl_registry *wl_regis
output->wld_scale = 1;
output->gui_scale = 1.f;
output->width = 1440; output->height = 900;
+ output->done = true;
wl_list_insert(&(scr_driver->outputs), &output->link);
scr_driver->screen_count_set(1);
}
@@ -1172,8 +1173,15 @@ Fl_Wayland_Screen_Driver::Fl_Wayland_Screen_Driver() : Fl_Unix_Screen_Driver() {
static void sync_done(void *data, struct wl_callback *cb, uint32_t time) {
+ // runs after all calls to registry_handle_global()
*(struct wl_callback **)data = NULL;
wl_callback_destroy(cb);
+ // keep processing until output_done() has run for each screen
+ Fl_Wayland_Screen_Driver *scr_driver = (Fl_Wayland_Screen_Driver*)Fl::screen_driver();
+ Fl_Wayland_Screen_Driver::output *output;
+ wl_list_for_each(output, &scr_driver->outputs, link) { // each screen of the system
+ while (!output->done) wl_display_dispatch(scr_driver->wl_display);
+ }
}