summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-05-20 15:22:28 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-05-20 15:22:28 +0200
commit9c9ce66d05c23a3f12ce3e28c98564fc2189e2c3 (patch)
tree934062482a9ea87f32979d0357dfa55ab7047097 /src
parentf8bdf2cd8747cd6a17428db5c93adf03e05c571b (diff)
Wayland under FreeBSD: fix support of GL windows.
Diffstat (limited to 'src')
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx
index f4e6fbff0..dc35dc3c3 100644
--- a/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx
@@ -241,13 +241,20 @@ void Fl_Wayland_Gl_Window_Driver::make_current_before() {
egl_surface = eglCreateWindowSurface(egl_display, g->egl_conf, egl_window, NULL);
//fprintf(stderr, "Created egl surface=%p at scale=%d\n", egl_surface, win->scale);
wl_surface_set_buffer_scale(surface, win->scale);
+//TODO It's still not entirely clear how to map a GL window
+// in a compositor-independent way.
bool done = false;
- struct wl_callback *callback = wl_surface_frame(surface);
- wl_surface_commit(surface);
- wl_callback_add_listener(callback, &gl_surface_frame_listener, &done);
- while (!done) {
- wl_display_dispatch(Fl_Wayland_Screen_Driver::wl_display);
+ bool special = (Fl_Wayland_Screen_Driver::compositor == Fl_Wayland_Screen_Driver::unspecified);
+ if (!special) {
+ struct wl_callback *callback = wl_surface_frame(surface);
+ wl_surface_commit(surface);
+ wl_callback_add_listener(callback, &gl_surface_frame_listener, &done);
+ }
+ int count = 0;
+ while (!done && count < 5) {
+ wl_display_roundtrip(Fl_Wayland_Screen_Driver::wl_display);
eglSwapBuffers(Fl_Wayland_Gl_Window_Driver::egl_display, egl_surface);
+ if (special) count++;
}
}
}