From 2030995f6bc17304ea7a2709efe22e1c51d5c217 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Fri, 15 Dec 2023 15:48:47 +0100 Subject: Wayland+libdecor: iImprove fl_is_surface_gtk_titlebar() --- libdecor/build/fl_libdecor-plugins.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/libdecor/build/fl_libdecor-plugins.c b/libdecor/build/fl_libdecor-plugins.c index 0169d01ce..39f34429d 100644 --- a/libdecor/build/fl_libdecor-plugins.c +++ b/libdecor/build/fl_libdecor-plugins.c @@ -328,17 +328,12 @@ struct libdecor { // copied from libdecor.c /* Returns whether surface is a GTK-titlebar created by libdecor-gtk */ bool fl_is_surface_gtk_titlebar(struct wl_surface *surface, struct libdecor *context) { - static enum plugin_kind kind = UNKNOWN; - if (!context || (kind != UNKNOWN && kind != GTK3)) return false; - struct libdecor_plugin_gtk *lpg = (struct libdecor_plugin_gtk *)context->plugin; - if (kind == UNKNOWN && !wl_list_empty(&lpg->visible_frame_list)) { - kind = get_plugin_kind(NULL); - if (kind != GTK3) return false; - } + if (!context || get_plugin_kind(NULL) != GTK3) return false; // loop over all decorations created by libdecor-gtk - struct libdecor_frame_gtk *frame; - wl_list_for_each(frame, &lpg->visible_frame_list, link) { - if (frame->headerbar.wl_surface == surface) return true; + struct libdecor_frame *frame; + wl_list_for_each(frame, &context->frames, link) { + struct libdecor_frame_gtk *frame_gtk = (struct libdecor_frame_gtk*)frame; + if (frame_gtk->headerbar.wl_surface == surface) return true; } return false; } -- cgit v1.2.3