mirror of
https://github.com/fltk/fltk.git
synced 2026-02-05 15:59:50 +08:00
Have FLTK use libdecor at version > 0.2.2
- 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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user