From 82bd0b66522dbdfcfe6274157bb2eaedd3c8051e Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Fri, 15 Mar 2024 09:43:35 +0100 Subject: Have FLTK use libdecor at version > 0.2.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - it's no longer necessary to take care of the change in the layout of "struct libdecor" between versions ≤ 0.2.2 and > 0.2.2 of libdecor - version > 0.2.2 contains MR131, that is, it defines LIBDECOR_WINDOW_STATE_RESIZING so the hack to emulate it is no longer necessary - CMake option FLTK_USE_SYSTEM_LIBDECOR now requires libdecor version > 0.2.2 to be activated, otherwise the bundled libdecor is used - what will be the libdecor version after 0.2.2 (0.2.3? 0.3.0?) is not known as of today --- libdecor/build/fl_libdecor-plugins.c | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) (limited to 'libdecor') diff --git a/libdecor/build/fl_libdecor-plugins.c b/libdecor/build/fl_libdecor-plugins.c index fbf4eb657..1e73d736a 100644 --- a/libdecor/build/fl_libdecor-plugins.c +++ b/libdecor/build/fl_libdecor-plugins.c @@ -301,23 +301,6 @@ unsigned char *fl_libdecor_titlebar_buffer(struct libdecor_frame *frame, } -// When the libdecor version after 0.2.2 will be released, support of older versions -// will be removed from FLTK. LIBDECOR_MR131 stuff also will be removed. -struct libdecor_022 { // for libdecor versions ≤ 0.2.2 - int ref_count; - const struct libdecor_interface *iface; - struct libdecor_plugin *plugin; - bool plugin_ready; - struct wl_display *wl_display; - struct wl_registry *wl_registry; - struct xdg_wm_base *xdg_wm_base; - struct zxdg_decoration_manager_v1 *decoration_manager; - struct wl_callback *init_callback; - bool init_done; - bool has_error; - struct wl_list frames; -}; - struct libdecor { // copied from libdecor.c, for libdecor versions > 0.2.2 int ref_count; const struct libdecor_interface *iface; @@ -338,18 +321,9 @@ struct libdecor { // copied from libdecor.c, for libdecor versions > 0.2.2 /* Returns whether surface is a GTK-titlebar created by libdecor-gtk */ bool fl_is_surface_gtk_titlebar(struct wl_surface *surface, struct libdecor *context) { if (!context || get_plugin_kind(NULL) != GTK3) return false; - static void *new_symbol = NULL; - static bool first = true; - if (first) { - first = false; - // new_symbol is NULL for libdecor versions ≤ 0.2.2 - new_symbol = dlsym(RTLD_DEFAULT, "libdecor_frame_get_user_data"); - } - struct wl_list *frames_addr = (new_symbol ? &context->frames : - &(((struct libdecor_022*)context)->frames) ); // loop over all decorations created by libdecor-gtk struct libdecor_frame *frame; - wl_list_for_each(frame, frames_addr, link) { + 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; } -- cgit v1.2.3