From 673fa2e09c178b6c49fddba53ca3d49ceb9bcd73 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Thu, 14 Dec 2023 07:55:31 +0100 Subject: FLTK implementation of the "GTK Shell" Wayland protocol - cont'd The loop over all libdecor-gtk decorations is now made using libdecor's data structures, rather than using FLTK's mapped window list. --- src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx index 26f85ede0..b1590e2de 100644 --- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx @@ -47,7 +47,7 @@ #include // for strerror() extern "C" { bool libdecor_get_cursor_settings(char **theme, int *size); - struct wl_surface *fl_headerbar_surface(struct libdecor_frame *frame); + bool fl_is_surface_gtk_titlebar(struct wl_surface *, struct libdecor *); } @@ -203,15 +203,9 @@ static void pointer_enter(void *data, struct wl_pointer *wl_pointer, uint32_t se struct wl_surface *surface, wl_fixed_t surface_x, wl_fixed_t surface_y) { Fl_Window *win = event_coords_from_surface(surface, surface_x, surface_y); if (!win && gtk_shell) { // check that surface is the headerbar of a GTK-decorated window - Fl_X *x = Fl_X::first; - while (x) { - struct wld_window *xid = (struct wld_window*)x->xid; - if (xid->kind == Fl_Wayland_Window_Driver::DECORATED && - surface == fl_headerbar_surface(xid->frame)) { - gtk_shell_surface = surface; - return; - } - x = x->next; + Fl_Wayland_Screen_Driver *scr_driver = (Fl_Wayland_Screen_Driver*)Fl::screen_driver(); + if (fl_is_surface_gtk_titlebar(surface, scr_driver->libdecor_context)) { + gtk_shell_surface = surface; } } if (!win) return; -- cgit v1.2.3