From 7a5b7aa37881690e26a01aada6ffcf668d0df52f Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Wed, 24 Sep 2025 20:16:37 +0100 Subject: [PATCH 01/10] rcxml.h: minor tweaks to order of variables --- include/config/rcxml.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/config/rcxml.h b/include/config/rcxml.h index e3b7bf06..b1c28d12 100644 --- a/include/config/rcxml.h +++ b/include/config/rcxml.h @@ -71,11 +71,12 @@ struct rcxml { enum tearing_mode allow_tearing; bool auto_enable_outputs; bool reuse_output_mode; - enum lab_placement_policy placement_policy; bool xwayland_persistence; bool primary_selection; char *prompt_command; + /* placement */ + enum lab_placement_policy placement_policy; int placement_cascade_offset_x; int placement_cascade_offset_y; From 6bbdc3c6dc3ba5bfd3702454325723b975845d2b Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Thu, 25 Sep 2025 19:24:52 +0100 Subject: [PATCH 02/10] Remove unused function menu_call_actions() --- include/menu/menu.h | 12 ------------ src/menu/menu.c | 9 --------- 2 files changed, 21 deletions(-) diff --git a/include/menu/menu.h b/include/menu/menu.h index a4d236d6..f65ff9a3 100644 --- a/include/menu/menu.h +++ b/include/menu/menu.h @@ -100,18 +100,6 @@ void menu_open_root(struct menu *menu, int x, int y); */ void menu_process_cursor_motion(struct wlr_scene_node *node); -/** - * menu_call_actions - call actions associated with a menu node - * - * If menuitem connected to @node does not just open a submenu: - * - associated actions will be called - * - server->menu_current will be closed - * - server->menu_current will be set to NULL - * - * Returns true if actions have actually been executed - */ -bool menu_call_actions(struct wlr_scene_node *node); - /** * menu_close_root- close root menu * diff --git a/src/menu/menu.c b/src/menu/menu.c index 455035ec..fca755b2 100644 --- a/src/menu/menu.c +++ b/src/menu/menu.c @@ -1544,15 +1544,6 @@ menu_process_cursor_motion(struct wlr_scene_node *node) menu_process_item_selection(item); } -bool -menu_call_actions(struct wlr_scene_node *node) -{ - assert(node && node->data); - struct menuitem *item = node_menuitem_from_node(node); - - return menu_execute_item(item); -} - void menu_close_root(struct server *server) { From 0bf2678f9dc2b3ca55881c1dcf3a60b36182988d Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Thu, 25 Sep 2025 19:25:51 +0100 Subject: [PATCH 03/10] Remove unused function scaled_font_buffer_set_max_width() --- include/scaled-buffer/scaled-font-buffer.h | 8 -------- src/scaled-buffer/scaled-font-buffer.c | 14 -------------- 2 files changed, 22 deletions(-) diff --git a/include/scaled-buffer/scaled-font-buffer.h b/include/scaled-buffer/scaled-font-buffer.h index 6953f9da..a5e95087 100644 --- a/include/scaled-buffer/scaled-font-buffer.h +++ b/include/scaled-buffer/scaled-font-buffer.h @@ -73,12 +73,4 @@ void scaled_font_buffer_update(struct scaled_font_buffer *self, const char *text int max_width, struct font *font, const float *color, const float *bg_color); -/** - * Update the max width of an existing auto scaling font buffer - * and force a new render. - * - * No steps are taken to detect if its actually required to render a new buffer. - */ -void scaled_font_buffer_set_max_width(struct scaled_font_buffer *self, int max_width); - #endif /* LABWC_SCALED_FONT_BUFFER_H */ diff --git a/src/scaled-buffer/scaled-font-buffer.c b/src/scaled-buffer/scaled-font-buffer.c index 61fd5db3..bb93fc67 100644 --- a/src/scaled-buffer/scaled-font-buffer.c +++ b/src/scaled-buffer/scaled-font-buffer.c @@ -139,17 +139,3 @@ scaled_font_buffer_update(struct scaled_font_buffer *self, const char *text, scaled_buffer_request_update(self->scaled_buffer, self->width, self->height); } - -void -scaled_font_buffer_set_max_width(struct scaled_font_buffer *self, int max_width) -{ - self->max_width = max_width; - - int computed_height; - font_get_buffer_size(self->max_width, self->text, &self->font, - &self->width, &computed_height); - self->height = (self->fixed_height > 0) ? - self->fixed_height : computed_height; - scaled_buffer_request_update(self->scaled_buffer, - self->width, self->height); -} From 139a5f0383b9e10d93d6d25c85c5abe7b4670877 Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Thu, 25 Sep 2025 19:27:01 +0100 Subject: [PATCH 04/10] Remove unused function output_max_scale() --- include/output.h | 7 ------- src/output.c | 14 -------------- 2 files changed, 21 deletions(-) diff --git a/include/output.h b/include/output.h index 413b43c5..ceccaf9f 100644 --- a/include/output.h +++ b/include/output.h @@ -70,11 +70,4 @@ void handle_output_power_manager_set_mode(struct wl_listener *listener, void *data); void output_enable_adaptive_sync(struct output *output, bool enabled); -/** - * output_max_scale() - get maximum scale factor of all usable outputs. - * Used when loading/rendering resources (e.g. icons) that may be - * displayed on any output. - */ -float output_max_scale(struct server *server); - #endif // LABWC_OUTPUT_H diff --git a/src/output.c b/src/output.c index 22e9fc4e..8345c653 100644 --- a/src/output.c +++ b/src/output.c @@ -1142,17 +1142,3 @@ output_enable_adaptive_sync(struct output *output, bool enabled) enabled ? "en" : "dis", output->wlr_output->name); } } - -float -output_max_scale(struct server *server) -{ - /* Never return less than 1, in case outputs are disabled */ - float scale = 1; - struct output *output; - wl_list_for_each(output, &server->outputs, link) { - if (output_is_usable(output)) { - scale = MAX(scale, output->wlr_output->scale); - } - } - return scale; -} From 34e52a40c740de0fb150e31871ce80e464e319ef Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Thu, 25 Sep 2025 19:33:55 +0100 Subject: [PATCH 05/10] Remove unused function node_layer_popup_from_node() --- include/node.h | 7 ------- src/node.c | 9 --------- 2 files changed, 16 deletions(-) diff --git a/include/node.h b/include/node.h index d6d177f0..bfad1373 100644 --- a/include/node.h +++ b/include/node.h @@ -45,13 +45,6 @@ struct view *node_view_from_node(struct wlr_scene_node *wlr_scene_node); struct lab_layer_surface *node_layer_surface_from_node( struct wlr_scene_node *wlr_scene_node); -/** - * node_layer_popup_from_node - return lab_layer_popup struct from node - * @wlr_scene_node: wlr_scene_node from which to return data - */ -struct lab_layer_popup *node_layer_popup_from_node( - struct wlr_scene_node *wlr_scene_node); - /** * node_menuitem_from_node - return menuitem struct from node * @wlr_scene_node: wlr_scene_node from which to return data diff --git a/src/node.c b/src/node.c index 025789e8..ce4fb040 100644 --- a/src/node.c +++ b/src/node.c @@ -50,15 +50,6 @@ node_layer_surface_from_node(struct wlr_scene_node *wlr_scene_node) return (struct lab_layer_surface *)node_descriptor->data; } -struct lab_layer_popup * -node_layer_popup_from_node(struct wlr_scene_node *wlr_scene_node) -{ - assert(wlr_scene_node->data); - struct node_descriptor *node_descriptor = wlr_scene_node->data; - assert(node_descriptor->type == LAB_NODE_LAYER_POPUP); - return (struct lab_layer_popup *)node_descriptor->data; -} - struct menuitem * node_menuitem_from_node(struct wlr_scene_node *wlr_scene_node) { From ee87b4fc30914eca576e70c3fd6afa0a0ac77972 Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Thu, 25 Sep 2025 19:35:22 +0100 Subject: [PATCH 06/10] Remove unused function trim_last_field() --- include/common/string-helpers.h | 9 --------- src/common/string-helpers.c | 9 --------- 2 files changed, 18 deletions(-) diff --git a/include/common/string-helpers.h b/include/common/string-helpers.h index 0509d33c..35c994b2 100644 --- a/include/common/string-helpers.h +++ b/include/common/string-helpers.h @@ -15,15 +15,6 @@ bool string_null_or_empty(const char *s); */ bool str_space_only(const char *s); -/** - * trim_last_field() - Trim last field of string splitting on provided delim - * @buf: string to trim - * @delim: delimitator - * - * Example: With delim='_' and buf="foo_bar_baz" the return value is "foo_bar" - */ -void trim_last_field(char *buf, char delim); - /** * string_strip - strip white space left and right * Note: this function does a left skip, so the returning pointer cannot be diff --git a/src/common/string-helpers.c b/src/common/string-helpers.c index a0d73034..13fe6f68 100644 --- a/src/common/string-helpers.c +++ b/src/common/string-helpers.c @@ -20,15 +20,6 @@ string_null_or_empty(const char *s) return !s || !*s; } -void -trim_last_field(char *buf, char delim) -{ - char *p = strrchr(buf, delim); - if (p) { - *p = '\0'; - } -} - static void rtrim(char *s) { From bdc8e1c546f76be969b6da9ee9f5054c1f2566eb Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Thu, 25 Sep 2025 19:36:37 +0100 Subject: [PATCH 07/10] Remove unused function lab_xml_get_node() --- include/common/xml.h | 1 - src/common/xml.c | 6 ------ 2 files changed, 7 deletions(-) diff --git a/include/common/xml.h b/include/common/xml.h index 8b49d0e4..16c319ec 100644 --- a/include/common/xml.h +++ b/include/common/xml.h @@ -30,7 +30,6 @@ void lab_xml_expand_dotted_attributes(xmlNode *root); /* Returns true if the node only contains a string or is empty */ bool lab_xml_node_is_leaf(xmlNode *node); -bool lab_xml_get_node(xmlNode *node, const char *key, xmlNode **dst_node); bool lab_xml_get_string(xmlNode *node, const char *key, char *s, size_t len); bool lab_xml_get_int(xmlNode *node, const char *key, int *i); bool lab_xml_get_bool(xmlNode *node, const char *key, bool *b); diff --git a/src/common/xml.c b/src/common/xml.c index 4868d7ed..7e089267 100644 --- a/src/common/xml.c +++ b/src/common/xml.c @@ -164,12 +164,6 @@ get_node(xmlNode *node, const char *key, xmlNode **dst_node, bool leaf_only) return false; } -bool -lab_xml_get_node(xmlNode *node, const char *key, xmlNode **dst_node) -{ - return get_node(node, key, dst_node, /* leaf_only */ false); -} - bool lab_xml_get_string(xmlNode *node, const char *key, char *s, size_t len) { From 1692c47fa08038640ef0a6442182320e68540149 Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Thu, 25 Sep 2025 19:38:13 +0100 Subject: [PATCH 08/10] Remove unused function key_state_nr_pressed_keys() --- include/input/key-state.h | 1 - src/input/key-state.c | 6 ------ 2 files changed, 7 deletions(-) diff --git a/include/input/key-state.h b/include/input/key-state.h index c53a4b10..d9971b74 100644 --- a/include/input/key-state.h +++ b/include/input/key-state.h @@ -24,6 +24,5 @@ void key_state_store_pressed_key_as_bound(uint32_t keycode); bool key_state_corresponding_press_event_was_bound(uint32_t keycode); void key_state_bound_key_remove(uint32_t keycode); int key_state_nr_bound_keys(void); -int key_state_nr_pressed_keys(void); #endif /* LABWC_KEY_STATE_H */ diff --git a/src/input/key-state.c b/src/input/key-state.c index def6b72c..492f7b0f 100644 --- a/src/input/key-state.c +++ b/src/input/key-state.c @@ -84,9 +84,3 @@ key_state_nr_bound_keys(void) { return bound.size; } - -int -key_state_nr_pressed_keys(void) -{ - return pressed.size; -} From 26bd02d45730ccfa99bccb786a9a07e0aa32fd04 Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Wed, 24 Sep 2025 20:25:27 +0100 Subject: [PATCH 09/10] Add translate.h for HAVE_NLS includes/defines ...to shrink labwc.h footprint --- include/labwc.h | 7 ------- include/translate.h | 14 ++++++++++++++ src/action-prompt-command.c | 2 +- src/config/rcxml.c | 1 + src/desktop-entry.c | 1 + src/main.c | 1 + src/menu/menu.c | 1 + 7 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 include/translate.h diff --git a/include/labwc.h b/include/labwc.h index 72dbe687..c75b1e39 100644 --- a/include/labwc.h +++ b/include/labwc.h @@ -7,13 +7,6 @@ #include "common/set.h" #include "input/cursor.h" #include "overlay.h" -#if HAVE_NLS -#include -#include -#define _ gettext -#else -#define _(s) (s) -#endif #define XCURSOR_DEFAULT "left_ptr" #define XCURSOR_SIZE 24 diff --git a/include/translate.h b/include/translate.h new file mode 100644 index 00000000..f7fc51e2 --- /dev/null +++ b/include/translate.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef LABWC_TRANSLATE_H +#define LABWC_TRANSLATE_H +#include "config.h" + +#if HAVE_NLS +#include +#include +#define _ gettext +#else +#define _(s) (s) +#endif + +#endif /* LABWC_TRANSLATE_H */ diff --git a/src/action-prompt-command.c b/src/action-prompt-command.c index 65bd0b49..faad41c9 100644 --- a/src/action-prompt-command.c +++ b/src/action-prompt-command.c @@ -5,8 +5,8 @@ #include #include "action.h" #include "common/buf.h" -#include "labwc.h" /* for gettext */ #include "theme.h" +#include "translate.h" enum { LAB_PROMPT_NONE = 0, diff --git a/src/config/rcxml.c b/src/config/rcxml.c index 162f3f1d..89293c43 100644 --- a/src/config/rcxml.c +++ b/src/config/rcxml.c @@ -33,6 +33,7 @@ #include "osd.h" #include "regions.h" #include "ssd.h" +#include "translate.h" #include "view.h" #include "window-rules.h" #include "workspaces.h" diff --git a/src/desktop-entry.c b/src/desktop-entry.c index 60cff28e..7aefa77e 100644 --- a/src/desktop-entry.c +++ b/src/desktop-entry.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only #include "desktop-entry.h" +#include #include #include #include diff --git a/src/main.c b/src/main.c index 068829dc..755a0a0c 100644 --- a/src/main.c +++ b/src/main.c @@ -11,6 +11,7 @@ #include "config/session.h" #include "labwc.h" #include "theme.h" +#include "translate.h" #include "menu/menu.h" struct rcxml rc = { 0 }; diff --git a/src/menu/menu.c b/src/menu/menu.c index fca755b2..0e23e850 100644 --- a/src/menu/menu.c +++ b/src/menu/menu.c @@ -29,6 +29,7 @@ #include "scaled-buffer/scaled-font-buffer.h" #include "scaled-buffer/scaled-icon-buffer.h" #include "theme.h" +#include "translate.h" #include "view.h" #include "workspaces.h" From c9030dcc5b321abb2afb3a38d00b795081c8fe4d Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Fri, 26 Sep 2025 17:52:13 +0100 Subject: [PATCH 10/10] CI: fix broken FreeBSD CI by setting -Dlibsfdo:b_ndebug=false MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ...because with with meson setup build -Dbuildtype=release -Db_ndebug=true \ --werror --force-fallback-for=libsfdo we get the following warning: In file included from ../subprojects/libsfdo/common/dirs.c:5: ../subprojects/libsfdo/include/common/membuild.h: In function ‘sfdo_membuild_validate’: ../subprojects/libsfdo/include/common/membuild.h:29:65: error: unused parameter ‘membuild’ [-Werror=unused-parameter] 29 | static inline void sfdo_membuild_validate(struct sfdo_membuild *membuild) { ...because `sfdo_membuild_validate()` contains nothing but an `assert()` and that therefore results in an `unused-parameter` warning with `NDEBUG`. https://gitlab.freedesktop.org/vyivel/libsfdo/-/blob/main/include/common/membuild.h?ref_type=heads#L30 --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b0ff3053..2b76b4d2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -168,6 +168,7 @@ jobs: meson setup build-gcc-release -Dxwayland=enabled \ -Dbuildtype=release -Db_ndebug=true --werror meson configure build-gcc-release -Dwlroots:b_ndebug=false || true + meson configure build-gcc-release -Dlibsfdo:b_ndebug=false || true meson compile -C build-gcc-release ' | $TARGET @@ -190,6 +191,7 @@ jobs: meson setup build-clang-release -Dxwayland=enabled \ -Dbuildtype=release -Db_ndebug=true --werror meson configure build-clang-release -Dwlroots:b_ndebug=false || true + meson configure build-clang-release -Dlibsfdo:b_ndebug=false || true meson compile -C build-clang-release ' | $TARGET