diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2023-12-15 15:48:47 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2023-12-15 15:48:47 +0100 |
| commit | 2030995f6bc17304ea7a2709efe22e1c51d5c217 (patch) | |
| tree | 80f9dfa4bf805c629957ee0c695029c465d42dcc | |
| parent | 04a5098a58bf6456252d09ee9406ff519cca6ddc (diff) | |
Wayland+libdecor: iImprove fl_is_surface_gtk_titlebar()
| -rw-r--r-- | libdecor/build/fl_libdecor-plugins.c | 15 |
1 files 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; } |
