Commit graph

3213 commits

Author SHA1 Message Date
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
John Lindgren
a29bf5366f idle_manager: remove unused parameter and field
wlr_seat isn't used anywhere.
2025-09-07 19:17:18 +09:00
Weblate
2b26a2c73f Translation updates from weblate
Co-authored-by: virtual-hand <handvirtual@tutamail.com>
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/pt_BR/
Translation: Labwc/labwc
2025-09-06 16:39:14 -04:00
John Lindgren
d14f5ca228 ssd: update comments referencing ssd_part/ssd_part_type 2025-09-06 16:00:20 -04:00
John Lindgren
f129571779 ssd: unify struct ssd_part with struct node_descriptor
struct ssd_part and struct node_descriptor seem to have essentially the
same purpose: tag a wlr_scene_node with some extra data indicating what
we're using it for.

Also, as with enum ssd_part_type (now lab_node_type), ssd_part is used
for several types of nodes that are not part of SSD.

So instead of the current chaining (node_descriptor -> ssd_part), let's
flatten/unify the two structs.

In detail:

- First, merge node_descriptor_type into lab_node_type.
- Add a separate view pointer in node_descriptor, since in the case of
  SSD buttons we need separate view and button data pointers.
- Rename ssd_part_button to simply ssd_button. It no longer contains
  an ssd_part as base.
- Add node_try_ssd_button_from_node() which replaces
  node_ssd_part_from_node() + button_try_from_ssd_part().
- Factor out ssd_button_free() to be called in node descriptor destroy.
- Finally, get_cursor_context() needs a little reorganization to handle
  the unified structs.

Overall, this simplifies the code a bit, and in my opinion makes it
easier to understand. No functional change intended.
2025-09-06 16:00:20 -04:00
John Lindgren
ba426e2271 ssd: eliminate ssd_hover_state (addressing a FIXME) 2025-09-06 16:00:20 -04:00
John Lindgren
1188534876 common: add node-type.c/h (renaming ssd_part_type to lab_node_type)
ssd_part_type contains several node types that are not actually part of
server-side decorations (ROOT, MENU, OSD, etc.)

Rename it accordingly and move it to a common location, along with some
related conversion/comparison functions.
2025-09-06 16:00:20 -04:00
John Lindgren
502473f343 theme: fix spelling of LAB_BS_HOVERED 2025-09-06 16:00:20 -04:00
tokyo4j
98c77cd6a7 ssd-titlebar: don't bind ssd_part to ssd->tree
Fixes up f347a81. This mistake didn't cause misbehaviors because the
ssd_part bound to ssd->tree is just a placeholder to let
get_cursor_context() call ssd_get_resizing_type() when the cursor is on
border/extents.
2025-09-06 16:00:20 -04:00
tokyo4j
130bbc9e6f view.c: remove cruft in view_apply_maximized_geometry() 2025-09-05 03:41:21 +09:00
Johan Malm
a9f927047a default-bindings.h: focus & raise on border press
...because it is probably what most people expect and it makes the
behavior consistent with that of Openbox.

Fixes: #3039
2025-09-04 15:54:37 +09:00
Johan Malm
f1f8782bb0 labnag: s/nag/labnag/ in usage string
Fixes #3051
2025-09-04 00:21:15 +02:00
tokyo4j
074b27fd47 scaled-scene-buffer: restructure source files
Some checks failed
labwc.github.io / notify (push) Has been cancelled
- Rename `scaled_scene_buffer` to `scaled_buffer`. This makes it clear
  that `scaled_{font,img,icon}_buffers` are implementations of it.
- Move the files from `src/common` to `src/scaled-buffer` as
  `scaled_icon_buffer` heavily depends on `server` and `view` etc.
2025-09-02 21:31:19 +01:00
tokyo4j
02be24bf59 mousebind: support Border context
This new context includes `Top`...`BRCorner` and makes it easier to modify
the mousebinds bound to them.
2025-09-02 21:29:10 +01:00
Johan Malm
b5b257092d NEWS.md: link from TOC to each section 2025-09-02 08:14:39 +09:00
John Lindgren
f9f4219ed4 interactive: un-maximize only axes that are being resized
When resizing in only one axis (horizontal/vertical), there's no reason
to un-maximize the other axis.

Supporting logic was landed in the previous commit and in ebd39dfe0d
(which fixed the client-initiated resize case), so all that remains is
to make a small change in interactive_begin().
2025-09-01 20:44:09 +01:00
John Lindgren
6d2140c4b7 view: expose view_set_maximized() instead of view_restore_to()
view_restore_to() (which is just set_maximized() + view_move_resize())
hasn't aged well and doesn't line up with typical usage anymore:

 - it's missing view_set_untiled(), which has to be called separately
 - it always forces view_move_resize() even when that's not needed
 - it doesn't allow un-maximizing only one axis (see next commit)
 - the fullscreen check is unnecessary (already checked in callers)

Eliminate it and just expose view_set_maximized() instead.

No functional change intended in this commit.
2025-09-01 20:44:09 +01:00
tokyo4j
72a5df16ea view: restore initially-maximized window position after unplug/plug
`update_last_layout_geometry()` stores `view->natural_geometry` in
`view->last_layout_geometry`, but it's empty for initially-maximized
windows, so their positions were not restored after outputs are
unplugged and plugged (also when VT switching in wlroots 0.19.0).

This commit sets the fallback natural geometry (at the center of the
output) so that initially-maximized windows reappears in the same output.
2025-09-01 20:16:37 +01:00
tokyo4j
e6b5d91b63 view: let view_set_fallback_natural_geometry() return wlr_box 2025-09-01 20:16:37 +01:00
tokyo4j
164b17c279 view: use fixed default window width
Now it's not very reasonable to determine the default window width based
on the titlebar geometry, as the titlebar can be shrunk to 1px.

Let's use the fixed value of 100px for simplification.
2025-09-01 20:13:00 +01:00
tokyo4j
6ed2617394 view.c: remove outdated comment
Since a5d89a2, xdg-shell views can request very small window geometry.
2025-09-01 20:13:00 +01:00
tokyo4j
66e26cd28a overlay: refactor
- Use a single `lab_scene_rect` for both overlay background and outlines,
  like I described in the TODO comment in ffd4005.
- Simplify the resource management by destroying the overlay tree when
  it's hidden. I think its overhead is pretty minimal.
- Share a single `lab_scene_rect` for both region/edge overlays.
2025-08-31 13:24:51 +01:00
tokyo4j
78d47c5c37 overlay.h: reduce included headers 2025-08-31 13:24:51 +01:00
01micko
d1a9529239 docs/labnag.1.scd: fix missed escape
Some checks failed
labwc.github.io / notify (push) Has been cancelled
2025-08-30 21:27:46 +09:00
01micko
f0ccbfed18 docs/labnag.1.scd: add a labnag example 2025-08-30 12:38:05 +01:00
01micko
3499f40a6b meson.build: move lab-sensible-terminal install routine.
Moved to clients/meson.build as per the comment in meson.build.
2025-08-30 11:14:07 +01:00
tokyo4j
a382389e5e scaled-icon-buffer: fix large client-side icon not being loaded
This commit fixes that client-side icons were not loaded when the rendered
icon size is larger than icon sizes from the client. This bug has become
more likely to happen due to the new thumnail-style window switcher.

The cause was `abs(INT_MIN)` becomes `INT_MIN` due to integer overflow.
2025-08-30 08:50:03 +01:00
tokyo4j
2e9292b7a3 osd: support window switcher with thumbnails
The new-style window switcher can be enabled with
<windowSwitcher style="thumbnail">.

New theme entries:

osd.window-switcher.style-thumbnail.width.max: 80%
osd.window-switcher.style-thumbnail.padding: 4
osd.window-switcher.style-thumbnail.item.width: 300
osd.window-switcher.style-thumbnail.item.height: 250
osd.window-switcher.style-thumbnail.item.padding: 10
osd.window-switcher.style-thumbnail.item.active.border.width: 2
osd.window-switcher.style-thumbnail.item.active.border.color: #589bda
osd.window-switcher.style-thumbnail.item.active.bg.color: #c7e2fc
osd.window-switcher.style-thumbnail.item.icon.size: 60
2025-08-29 20:42:01 +01:00
tokyo4j
6e2805f692 theme: move osd.window-switcher.* to osd.window-switcher.style-classic.*
Backward compatibility is preserved.
2025-08-29 20:42:01 +01:00