From 87dec3af9c8bfcf3a125ba453d144cd642fa362c Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Wed, 7 Jun 2023 15:53:19 +0200 Subject: [PATCH] libdecor: update with upstream source code as of 2023-may-26 --- documentation/src/bundled-libs.dox | 4 +-- libdecor/src/plugins/cairo/libdecor-cairo.c | 23 ++++++++++-------- libdecor/src/plugins/gtk/libdecor-gtk.c | 27 ++++++++++++--------- 3 files changed, 30 insertions(+), 24 deletions(-) diff --git a/documentation/src/bundled-libs.dox b/documentation/src/bundled-libs.dox index d270bff0b..6d0c8e6b2 100644 --- a/documentation/src/bundled-libs.dox +++ b/documentation/src/bundled-libs.dox @@ -23,14 +23,14 @@ The nanosvg library is not affected. \section bundled-status Current status \code -Current versions of bundled libraries (as of May 2, 2023): +Current versions of bundled libraries (as of June 7, 2023): Library Version/git commit Release date FLTK Version -------------------------------------------------------------------------- jpeg jpeg-9e 2022-01-16 1.4.0 nanosvg abcd277ea4 [1] 2022-12-22 1.4.0 png libpng-1.6.39 2022-11-20 1.4.0 zlib zlib-1.2.13 2022-10-13 1.4.0 - libdecor db4e5084 [2] 2023-05-01 1.4.0 + libdecor 6ca6dac9 [2] 2023-05-26 1.4.0 -------------------------------------------------------------------------- Previous versions of bundled libraries (FLTK 1.3.x): diff --git a/libdecor/src/plugins/cairo/libdecor-cairo.c b/libdecor/src/plugins/cairo/libdecor-cairo.c index 6113066a3..5951e93b5 100644 --- a/libdecor/src/plugins/cairo/libdecor-cairo.c +++ b/libdecor/src/plugins/cairo/libdecor-cairo.c @@ -398,12 +398,15 @@ libdecor_plugin_cairo_destroy(struct libdecor_plugin *plugin) free(plugin_cairo->cursor_theme_name); - wl_shm_destroy(plugin_cairo->wl_shm); + if (plugin_cairo->wl_shm) + wl_shm_destroy(plugin_cairo->wl_shm); pango_font_description_free(plugin_cairo->font); - wl_compositor_destroy(plugin_cairo->wl_compositor); - wl_subcompositor_destroy(plugin_cairo->wl_subcompositor); + if (plugin_cairo->wl_compositor) + wl_compositor_destroy(plugin_cairo->wl_compositor); + if (plugin_cairo->wl_subcompositor) + wl_subcompositor_destroy(plugin_cairo->wl_subcompositor); libdecor_plugin_release(&plugin_cairo->plugin); free(plugin_cairo); @@ -2679,13 +2682,6 @@ globals_callback(void *user_data, wl_callback_destroy(callback); plugin_cairo->globals_callback = NULL; - - if (!has_required_globals(plugin_cairo)) { - libdecor_notify_plugin_error( - plugin_cairo->context, - LIBDECOR_ERROR_COMPOSITOR_INCOMPATIBLE, - "Compositor is missing required globals"); - } } static const struct wl_callback_listener globals_callback_listener = { @@ -2731,6 +2727,13 @@ libdecor_plugin_new(struct libdecor *context) wl_callback_add_listener(plugin_cairo->globals_callback, &globals_callback_listener, plugin_cairo); + wl_display_roundtrip(wl_display); + + if (!has_required_globals(plugin_cairo)) { + fprintf(stderr, "libdecor-cairo-WARNING: Could not get required globals\n"); + libdecor_plugin_cairo_destroy(&plugin_cairo->plugin); + return NULL; + } return &plugin_cairo->plugin; } diff --git a/libdecor/src/plugins/gtk/libdecor-gtk.c b/libdecor/src/plugins/gtk/libdecor-gtk.c index b0b1b2f36..2d9cdd7d4 100644 --- a/libdecor/src/plugins/gtk/libdecor-gtk.c +++ b/libdecor/src/plugins/gtk/libdecor-gtk.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include "libdecor-plugin.h" @@ -427,10 +428,13 @@ libdecor_plugin_gtk_destroy(struct libdecor_plugin *plugin) free(plugin_gtk->cursor_theme_name); - wl_shm_destroy(plugin_gtk->wl_shm); + if (plugin_gtk->wl_shm) + wl_shm_destroy(plugin_gtk->wl_shm); - wl_compositor_destroy(plugin_gtk->wl_compositor); - wl_subcompositor_destroy(plugin_gtk->wl_subcompositor); + if (plugin_gtk->wl_compositor) + wl_compositor_destroy(plugin_gtk->wl_compositor); + if (plugin_gtk->wl_subcompositor) + wl_subcompositor_destroy(plugin_gtk->wl_subcompositor); free(plugin_gtk); @@ -2100,6 +2104,7 @@ pointer_leave(void *data, if (frame_gtk) { frame_gtk->active = NULL; frame_gtk->hdr_focus.widget = NULL; + frame_gtk->hdr_focus.type = HEADER_NONE; draw_decoration(frame_gtk); libdecor_frame_toplevel_commit(&frame_gtk->frame); update_local_cursor(seat); @@ -2532,15 +2537,6 @@ globals_callback(void *user_data, wl_callback_destroy(callback); plugin_gtk->globals_callback = NULL; - - if (!has_required_globals(plugin_gtk)) { - struct libdecor *context = plugin_gtk->context; - - libdecor_notify_plugin_error( - context, - LIBDECOR_ERROR_COMPOSITOR_INCOMPATIBLE, - "Compositor is missing required globals"); - } } static const struct wl_callback_listener globals_callback_listener = { @@ -2580,6 +2576,13 @@ libdecor_plugin_new(struct libdecor *context) wl_callback_add_listener(plugin_gtk->globals_callback, &globals_callback_listener, plugin_gtk); + wl_display_roundtrip(wl_display); + + if (!has_required_globals(plugin_gtk)) { + fprintf(stderr, "libdecor-gtk-WARNING: Could not get required globals\n"); + libdecor_plugin_gtk_destroy(&plugin_gtk->plugin); + return NULL; + } /* setup GTK context */ gdk_set_allowed_backends("wayland");