diff --git a/documentation/src/bundled-libs.dox b/documentation/src/bundled-libs.dox index 18237b9ea2388cd3a9c2b78930658e26404a6f1e..8ec6d02eb18640a160990ba376c5d3b80f5068ca 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 December 5, 2024): +Current versions of bundled libraries (as of February 14, 2025): Library Version/git commit Release date FLTK Version -------------------------------------------------------------------------- jpeg jpeg-9f 2024-01-14 1.4.0 nanosvg 7aeda550a8 [1] 2023-12-02 1.4.0 png libpng-1.6.44 2024-09-12 1.4.1 zlib zlib-1.3.1 2024-01-22 1.4.0 - libdecor c2bd8ad6 [2] 2024-05-31 1.4.0 + libdecor f7cd7ffd [2] 2025-01-21 1.4.2 -------------------------------------------------------------------------- Previous versions of bundled libraries (FLTK 1.3.x): diff --git a/libdecor/src/libdecor.c b/libdecor/src/libdecor.c index 3ede71280e5fa0364d15468da6da5088f32c4b4a..75033afecfb9e627d892fac9c6fb1bc3f816d169 100644 --- a/libdecor/src/libdecor.c +++ b/libdecor/src/libdecor.c @@ -124,6 +124,7 @@ struct libdecor_frame_private { enum libdecor_window_state window_state; + bool has_decoration_mode; enum zxdg_toplevel_decoration_v1_mode decoration_mode; enum libdecor_capabilities capabilities; @@ -504,7 +505,13 @@ toplevel_decoration_configure( struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1, uint32_t mode) { - ((struct libdecor_frame_private *)(data))->decoration_mode = mode; + struct libdecor_frame_private *frame_priv = (struct libdecor_frame_private *)data; + /* Ignore any _configure calls after the first, they will be + * from our set_mode call. */ + if (!frame_priv->has_decoration_mode) { + frame_priv->has_decoration_mode = true; + frame_priv->decoration_mode = mode; + } } static const struct zxdg_toplevel_decoration_v1_listener @@ -640,9 +647,9 @@ libdecor_frame_unref(struct libdecor_frame *frame) struct libdecor_plugin *plugin = context->plugin; if (context->decoration_manager && frame_priv->toplevel_decoration) { - zxdg_toplevel_decoration_v1_destroy(frame_priv->toplevel_decoration); - frame_priv->toplevel_decoration = NULL; - } + zxdg_toplevel_decoration_v1_destroy(frame_priv->toplevel_decoration); + frame_priv->toplevel_decoration = NULL; + } wl_list_remove(&frame->link); @@ -684,24 +691,21 @@ libdecor_frame_set_visibility(struct libdecor_frame *frame, frame_priv->visible = visible; - /* enable/disable decorations that are managed by the compositor, - * only xdg-decoration version 2 and above allows to toggle decoration */ + /* enable/disable decorations that are managed by the compositor. + * Note that, as of xdg_decoration v1, this is just a hint and there is + * no reliable way of disabling all decorations. In practice this should + * work but per spec this is not guaranteed. + * + * See also: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/17 + */ if (context->decoration_manager && - zxdg_decoration_manager_v1_get_version(context->decoration_manager) > 1) { - if (frame_priv->visible && - frame_priv->toplevel_decoration == NULL) { - /* - request to SHOW decorations - * - decorations are NOT HANDLED - * => create new decorations for already mapped surface */ - libdecor_frame_create_xdg_decoration(frame_priv); - } else if (!frame_priv->visible && - frame_priv->toplevel_decoration != NULL) { - /* - request to HIDE decorations - * - decorations are HANDLED - * => destroy decorations */ - zxdg_toplevel_decoration_v1_destroy(frame_priv->toplevel_decoration); - frame_priv->toplevel_decoration = NULL; - } + frame_priv->toplevel_decoration && + frame_priv->has_decoration_mode && + frame_priv->decoration_mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE) { + zxdg_toplevel_decoration_v1_set_mode(frame_priv->toplevel_decoration, + frame->priv->visible + ? ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE + : ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE); } /* enable/disable decorations that are managed by a plugin */ diff --git a/libdecor/src/plugins/gtk/libdecor-gtk.c b/libdecor/src/plugins/gtk/libdecor-gtk.c index 7ce38ddc698c6c0100c46814474985b848947f7c..813b764e36b8ba8b62d24b78be22f0dee76b7c82 100644 --- a/libdecor/src/plugins/gtk/libdecor-gtk.c +++ b/libdecor/src/plugins/gtk/libdecor-gtk.c @@ -2915,6 +2915,12 @@ libdecor_plugin_new(struct libdecor *context) struct libdecor_plugin_gtk *plugin_gtk; struct wl_display *wl_display; +#ifdef HAVE_GETTID + /* Only support running on the main thread. */ + if (getpid () != gettid ()) + return NULL; +#endif + plugin_gtk = zalloc(sizeof *plugin_gtk); libdecor_plugin_init(&plugin_gtk->plugin, context,