summaryrefslogtreecommitdiff
path: root/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2024-01-18 08:10:33 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2024-01-18 08:10:33 +0100
commitb7fba465cec78b00a46a47ebd3f8f231b5feb5ee (patch)
treeb4dc9b1261b24e5d4aa24757fa1718c69dbd486a /src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx
parent554bccbecdc2acdc73fd1ff851c541839ed8b523 (diff)
Wayland: throttle resize operations also for top-level GL windows
Member cb of struct wld_buffer is replaced by member frame_cb of struct wld_window. This allows frame_cb to be used both for non-GL and for top-level GL windows.
Diffstat (limited to 'src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx')
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx
index aec93283b..473afd810 100644
--- a/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx
@@ -397,6 +397,18 @@ static void delayed_scissor(Fl_Wayland_Gl_Window_Driver *dr) {
}*/
+static void surface_frame_done(void *data, struct wl_callback *cb, uint32_t time) {
+ struct wld_window *xid = (struct wld_window *)data;
+ wl_callback_destroy(cb);
+ xid->frame_cb = NULL;
+}
+
+
+static const struct wl_callback_listener surface_frame_listener = {
+ .done = surface_frame_done,
+};
+
+
void Fl_Wayland_Gl_Window_Driver::resize(int is_a_resize, int W, int H) {
if (!egl_window) return;
float f = Fl::screen_scale(pWindow->screen_num());
@@ -406,6 +418,11 @@ void Fl_Wayland_Gl_Window_Driver::resize(int is_a_resize, int W, int H) {
int W2, H2;
wl_egl_window_get_attached_size(egl_window, &W2, &H2);
if (W2 != W || H2 != H) {
+ struct wld_window *xid = fl_wl_xid(pWindow);
+ if (xid->kind == Fl_Wayland_Window_Driver::DECORATED && !xid->frame_cb) {
+ xid->frame_cb = wl_surface_frame(xid->wl_surface);
+ wl_callback_add_listener(xid->frame_cb, &surface_frame_listener, xid);
+ }
wl_egl_window_resize(egl_window, W, H, 0, 0);
}
/* CONTROL_LEAKING_SUB_GL_WINDOWS