Commit graph

3291 commits

Author SHA1 Message Date
Johan Malm
286005e121 Privatize rcxml_parse_xml() 2025-09-29 20:22:46 +01:00
Johan Malm
040e25f38e Privatize private view_get_root() 2025-09-29 20:22:46 +01:00
Johan Malm
27f3097f8f build: add 'sections' option to show unused functions 2025-09-29 20:22:46 +01:00
tokyo4j
c5cd1f691d CI: use libwlroots-0.19-dev build-dep for Debian 2025-09-29 19:41:32 +01:00
tokyo4j
46bd1fef95 CI: add unit tests 2025-09-29 19:41:32 +01:00
tokyo4j
7e27f78662 test/xml: use xmlBufferContent()
xmlBuffer->content has been deprecated.
2025-09-29 19:41:32 +01:00
tokyo4j
1043a9becc test: fix build error in t/xml.c
38a1a9b broke `t/xml.c` due to `macros.h` requiring `wlr/version.h`.
This commit fixes it by adding `wlroots` as a direct dependency of the
test executables.
2025-09-29 19:41:32 +01:00
Johan Malm
94c980c6be action: fix UAF when using prompt during reconfigure
Reported-by: @jlindgren90

Fixes #3106
2025-09-26 21:25:34 +01:00
Johan Malm
c9030dcc5b CI: fix broken FreeBSD CI by setting -Dlibsfdo:b_ndebug=false
...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
2025-09-26 19:06:21 +02:00
Johan Malm
26bd02d457 Add translate.h for HAVE_NLS includes/defines
...to shrink labwc.h footprint
2025-09-26 10:43:23 -04:00
Johan Malm
1692c47fa0 Remove unused function key_state_nr_pressed_keys() 2025-09-26 10:41:21 -04:00
Johan Malm
bdc8e1c546 Remove unused function lab_xml_get_node() 2025-09-26 10:41:21 -04:00
Johan Malm
ee87b4fc30 Remove unused function trim_last_field() 2025-09-26 10:41:21 -04:00
Johan Malm
34e52a40c7 Remove unused function node_layer_popup_from_node() 2025-09-26 10:41:21 -04:00
Johan Malm
139a5f0383 Remove unused function output_max_scale() 2025-09-26 10:41:21 -04:00
Johan Malm
0bf2678f9d Remove unused function scaled_font_buffer_set_max_width() 2025-09-26 10:41:21 -04:00
Johan Malm
6bbdc3c6dc Remove unused function menu_call_actions() 2025-09-26 10:41:21 -04:00
Johan Malm
7a5b7aa378 rcxml.h: minor tweaks to order of variables 2025-09-25 21:12:36 +01:00
Johan Malm
5fdebedcd9 labwc-config(5): document <promptCommand>
Some checks failed
labwc.github.io / notify (push) Has been cancelled
2025-09-24 20:13:51 +01:00
Johan Malm
5765586636 config: add <core><promptCommand>
...to enable configuration of the action prompt command.

Also set some better defaults for labnag.

The new default command is:

    labnag \
        --message '%m' \
        --button-dismiss '%n' \
        --button-dismiss '%y' \
        --background '%b' \
        --text '%t' \
        --border '%t' \
        --border-bottom '%t' \
        --button-background '%b' \
        --button-text '%t' \
        --border-bottom-size 1 \
        --button-border-size 3 \
        --timeout 0

...where the conversion specifiers are defined as follows:

    %m: the `<prompt>` message option
    %n: _("No")
    %y: _("Yes")
    %b: osd.bg.color
    %t: osd.label.text.color

This config options also enables the use of a different dialog client, for
example like this:

    <core>
      <promptCommand>zenity --question --text="%m"</promptCommand>
    </core>
2025-09-24 20:13:51 +01:00
Johan Malm
7028e65154 labnag: fix segfault caused by providing --timeout as long option 2025-09-24 20:13:51 +01:00
tokyo4j
ebce406b11 font: remove 4px padding on the right
Added `menu.items.padding.x` padding between item text and arrow instead.

Replaced `if (!string)` with `if (string_null_or_empty(string))` in
`font_extents()` just as a minor optimization.
2025-09-22 18:23:33 +01:00
Johan Malm
141f932efa README.md: remove high-level scope summary
...as it is very old and not relevant anymore.
2025-09-21 20:50:59 +09:00
tokyo4j
24f39e3a41 default-bindings.h: set combine="yes" for SnapToEdge keybinds
Some checks failed
labwc.github.io / notify (push) Has been cancelled
2025-09-19 16:23:23 +09:00
tokyo4j
2ac48116e1 action: allow SnapToEdge to combine two cardinal directions
This patch adds `combine` argument to (Toggle)SnapToEdge actions.
This allows to snap a window to e.g. up-left by running two actions:
- `<action name="SnapToEdge" direction="left" combine="yes" />`
- `<action name="SnapToEdge" direction="up" combine="yes" />`

Then running `<action name="SnapToEdge" direction="down" combine="yes" />`
snaps it to left again. This behavior is almost the same as KWin, except
that snapping a up-right-tiled window to right doesn't move it to the
right-adjacent output, but makes it right-tiled first.
2025-09-19 16:23:23 +09:00
tokyo4j
af6a0df231 view: remove an obsolete code in view_snap_to_edge()
We no longer need to call view_apply_tiled_geometry() there, since we now
clear view->tiled when dragging a tiled window since 9f51384.
2025-09-19 16:23:23 +09:00
Johan Malm
0db3b9309b libsfdo.wrap: update revision to v0.1.4 2025-09-18 23:42:53 +02:00
Johan Malm
387e62d87b README.md: remove yambar reference as discontinued 2025-09-17 22:38:35 +02:00
cunlem
c6503e299f Update labwc-actions.5.scd
Some checks failed
labwc.github.io / notify (push) Has been cancelled
2025-09-16 20:27:02 +01:00
Johan Malm
268ef857db NEWS.md: interim update 2025-09-16 20:21:10 +01:00
tokyo4j
f09ace51bf view: fix <query monitor="current|left|right" />
Before this commit, <else> branch was always executed with
monitor="current", monitor="left" or monitor="right" queries.

For example:

<action name="If">
  <query monitor="current" />
  <then>
    <action />
  </then>
  <else>
    <action />
  </else>
</action>
2025-09-15 03:45:05 +09:00
John Lindgren
d54051d9c1 clang-format: tweak to match existing code a little better
"clang-format -i src/view.c" before:
  1 file changed, 204 insertions(+), 169 deletions(-)

"clang-format -i src/view.c" after:
  1 file changed, 181 insertions(+), 146 deletions(-)
2025-09-13 12:06:52 +01:00
John Lindgren
5ce20b2b95 rcxml: use const char* for string literals 2025-09-13 12:06:52 +01:00
John Lindgren
072d45d4b2 osd-thumbnail: put designated initializers in order 2025-09-13 12:06:52 +01:00
John Lindgren
0ce10f6afa interactive: add braces around case containing declaration 2025-09-13 12:06:52 +01:00
John Lindgren
bca0ec07ac rcxml: use fixed arrays for rc.title_buttons_*
These are just lists of enum lab_node_type, with a bounded size and
no middle-insertions/removals, so linked lists are overkill.

Also, the use of wl_list_for_each[_reverse] just to access the first or
last entry in the list (corner button) was weird.
2025-09-13 12:06:52 +01:00
thatonecoder (formerly Coccocoa's Helper)
e17ec0203c CONTRIBUTING.md: fix some typos, lots of Oxford commas
The primary change is “Github”/“github” ⇾ “GitHub”, but there are plenty of others.
2025-09-11 21:15:44 +01:00
Johan Malm
f2639226c7 labwc-config(5): add example for autoEnableOutputs
Some checks failed
labwc.github.io / notify (push) Has been cancelled
...with inspiration from example in #3059 by @jlindgren90
2025-09-09 21:34:22 +01:00
tokyo4j
9f7e532852 desktop: refactor get_cursor_context()
This patch should not change any behaviors.

This clarifies the semantics of cursor_context returned by
get_cursor_context() as I described in cursor.h; when cursor is on a
subsurface (e.g. xdg/x11/layer/session-lock), the returned ctx.surface
and ctx.node points to the subsurface rather than its parent.
2025-09-09 18:50:20 +09:00
tokyo4j
3a3b873d0e desktop: let get_cursor_context() return layer-popup subsurface
With this change, when a layer-popup has a subsurface and cursor is on
it, wl_pointer.enter/motion events are sent to the subsurface rather
than its parent layer-popup surface. I think this follows wayland spec
more closely.

Tested with my demo: https://github.com/tokyo4j/wayland-demo/tree/layer-popup
2025-09-09 18:50:20 +09:00
tokyo4j
3d670b772d desktop: don't use LAB_NODE_LAYER_SUBSURFACE node type
Instead, set ctx.type = LAB_NODE_LAYER_SURFACE for both layer-surfaces
and layer-subsurfaces.

This patch preserves the existing behaviors:
- Pressing a subsurface of an on-demand layer-surface gives pointer
  focus to the subsurface, but gives keyboard focus to the parent
  layer-surface (related: a5fcbfaf).
- Pressing a subsurface of a layer-surface doesn't close a popup
  (related: a89bcc3c).
2025-09-09 18:50:20 +09:00
tokyo4j
574b20fbff ssd: attach LAB_NODE_SSD_ROOT to ssd->tree
This doesn't change any behaviors.

Attaching LAB_NODE_NONE node-descriptor to ssd->tree looks strange, this
patch uses new LAB_NODE_SSD_ROOT instead. The node-descriptor attached to
ssd->tree is needed for get_cursor_context() to detect cursor hovering on
borders/extents.

I also updated get_cursor_context() to make my intent clearer.
2025-09-08 15:46:36 +09:00
tokyo4j
b9b23f5931 output: remove node descriptors 2025-09-08 15:46:36 +09:00
tokyo4j
fb3dcb7959 scaled-buffer: remove *_from_node() functions 2025-09-08 15:46:36 +09:00
tokyo4j
3923b27384 desktop.c: don't print errors when cursor is on resize-indicator
In f347a81, I thought there are only window contents and SSD under
`view->scene_tree` and forgot about the resize-indicator.

I also refactored the logic around it:
- Remove `ret.node->type == WLR_SCENE_NODE_BUFFER` check since it's
  already done by `lab_wlr_surface_from_node()`
- Eliminate duplicated call to `lab_wlr_surface_from_node()`
2025-09-07 22:00:01 +01:00
Consolatis
b02d7d0e18 src/output.c: restore drm lease include
Introduced in #3062.

Its usage is guarded by a wlroots version check
which prevented the CI to detect the issue.

When compiled with a wlroots version > 0.19.0
(like the chase 0.20 PR) the error shows up.
2025-09-08 00:51:22 +09:00
John Lindgren
d2ce31fcc9 tree-wide: use forward declarations for wlr types 2025-09-07 19:34:30 +09:00
John Lindgren
b00873a988 src: remove unused #includes (via include-what-you-use) 2025-09-07 19:34:30 +09:00
John Lindgren
7c185c1a85 include: reduce unnecessary #includes 2025-09-07 19:34:30 +09:00
John Lindgren
e9f17dc4a2 array: use die_if_null() from common/mem.c 2025-09-07 19:17:18 +09:00