Commit graph

3291 commits

Author SHA1 Message Date
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
tokyo4j
92ee5083f0 osd: split to osd.c and osd-classic.c 2025-08-29 20:42:01 +01:00
tokyo4j
57a1ea6cb5 Move osd.c and osd-field.c into src/osd 2025-08-29 20:42:01 +01:00
tokyo4j
f347a818e3 ssd: clean up scene management
Our codebase for ssd scenes has grown with a lot of technical debts:
- We needed to call `ssd_get_part()` everywhere to get the scene node of a
  ssd part. We then needed to cast it to `wlr_scene_rect` and
  `wlr_scene_buffer`. This bloated our codebase and even blocked
  duplicated button types in `<titlebar><layout>`.
- `ssd_get_part_type()` was a dirty hack. It compared parent, grandparent
  and grandgrandparent of a node with each subtree in the ssd to get the
  part type of the node.

To resolve this issues, this commit changes how ssd scenes are managed:
- Access scene rects and scene buffers just as a member of `struct ssd`.
- `ssd_part` is now a attachment to a scene node that can be accessed via
  node_descriptor->data, with a new node-descriptor type
  `LAB_NODE_DESC_SSD_PART`. `LAB_NODE_DESC_SSD_BUTTON` is unified into it.

Now the scene graph under ssd->tree looks like below. The parentheses
indicate the type of ssd_part attached to the node:

ssd->tree (LAB_SSD_NONE)
+--titlebar (LAB_SSD_PART_TITLEBAR)
|  +--inactive
|  |  +--background bar
|  |  +--left corner
|  |  +--right corner
|  |  +--title (LAB_SSD_PART_TITLE)
|  |  +--iconify button (LAB_SSD_BUTTON_ICONIFY)
|  |  |  +--normal close icon image
|  |  |  +--hovered close icon image
|  |  |  +--...
|  |  +--window icon (LAB_SSD_BUTTON_WINDOW_ICON)
|  |  |  +--window icon image
|  |  +--...
|  +--active
|     +--...
+--border
|  +--inactive
|  |  +--top
|  |  +--...
|  +--active
|     +--top
|     +--...
+--shadow
|  +--inactive
|  |  +--top
|  |  +--...
|  +--active
|     +--top
|     +--...
+--extents
   +--top
   +--...

When hovering on SSD, `get_cursor_context()` traverses this scene node
from the leaf. If it finds a `ssd_part` attached to the node, it returns
`ssd_part_type` that represents the resizing direction, button types or
`Title`/`Titlebar`.
2025-08-28 21:06:51 +01:00
tokyo4j
aa3dbb4f85 ssd-extents: factor out resize_extent_within_usable() 2025-08-28 21:06:51 +01:00
tokyo4j
a59f98525e ssd-titlebar: create title buffer in ssd_titlebar_create() 2025-08-28 21:06:51 +01:00
Johan Malm
da90e62346 NEWS.md: interim update 2025-08-27 21:58:05 +01:00
John Lindgren
c8943ca242 seat: improve debug logging when configuring input devices
Some checks failed
labwc.github.io / notify (push) Has been cancelled
I needed to debug an input configuration issue and found the debug
output not-super-helpful, so I made some improvements:

- Print the name and "sysname" (e.g. event11) of the device being
  configured. Note that the name alone isn't enough since there can
  be multiple identically-named devices.

- Print the config category matched for each device.

- Print the config values (if any) being applied. For enums, only the
  numeric value is printed since I'm lazy.

- Don't print "pointer acceleration configured" if neither a pointer
  speed nor acceleration profile is configured (it's confusing).
2025-08-27 13:07:01 -04:00
John Lindgren
80b28f16c7 tree-wide: use enum types/constants where appropriate
- add LAB_WINDOW_TYPE_INVALID in place of literal -1
- document more clearly that enum lab_view_criteria is a bitset
- other one-off replacements of integer values/types for consistency

Note: variables of type enum lab_view_criteria are already used
extensively throughout the code to contain combinations of the declared
enum values. I am not introducing any new usage here, just changing the
single uint32_t to be consistent with all the other usages.
2025-08-28 01:33:23 +09:00
John Lindgren
ef766d16f0 common: flesh out enum lab_edge and prefer over wlr_edges/wlr_direction
I like the new common/edge.h. I don't like how inconsistently we use it.

Current situation:

 - enum wlr_edges and wlr_direction are designed to be used as bitset,
   and are defined compatibly

 - enum lab_edge is *also* designed to be used as bitset, but
   incompatible with the others (LEFT/RIGHT come before UP/DOWN)

 - we use an inconsistent mix of all three *AND* uint32_t (usually with
   the WLR_EDGE constants rather than the LAB_EDGE constants), and
   convert between them on an ad-hoc basis, sometimes implicitly

Let's clean this up:

 - reorder enum lab_edge to be compatible with the two wlr enums
   (check this by static_assert)

 - use TOP/BOTTOM naming rather than UP/DOWN (matches wlr_edges)

 - add constants for the remaining possible combinations of the 4 edges

 - use lab_edge for all internal edge/direction fields, consistently

 - add lab_edge_is_cardinal() as a sanity check before casting to
   enum wlr_direction, and then eliminate all of direction.c/h

Instead of "enum wlr_edges direction", we now have
"enum lab_edge direction" which is not that much better. At least we
are now clear that we're overloading one enum with two meanings.
2025-08-26 20:36:43 -04:00
David Barr
4d1be7eada
menu: add brackets around minimised window titles in client-list menu (#3002) 2025-08-26 21:08:31 +01:00
Rainer Kuemmerle
657c08aaa1 action: add toggle for GoToDesktop
Adds an option "toogle" to GoToDesktop.
In case the target is already where we are, we go back to the last desktop
instead.

Example of rc.xml

<keybind key="C-F1">
  <action name="GoToDesktop">
    <to>1</to>
    <toggle>yes</toggle>
  </action>
</keybind>
2025-08-26 21:03:06 +01:00
tokyo4j
55ee96761a window-rules: fix window rules not being applied
In 943f5751, I initialized heap-allocated `view_query` used for
`If` actions with `decoration=LAB_SSD_MODE_INVALID`, but I forgot to do
that for stack-allocated `view_query` used for window rules.
2025-08-25 23:42:00 +09:00
John Lindgren
ebd39dfe0d view: respect client-initiated resize of non-maximized axis
Some checks failed
labwc.github.io / notify (push) Has been cancelled
When implementing single-axis maximize some time ago, I made the
simplifying assumption that a view couldn't be resized while maximized
(even in only one axis). And indeed for compositor-initiated resize,
we always unmaximize the view first.

However, I didn't account for the client resizing the non-maximized
axis, which we can't (and shouldn't) prevent. When this happens, we
should also update the natural geometry of that single axis so that we
don't undo the resize when un-maximizing.

P.S. xdg-shell clients resizing the *maximized* axis is still an
unsolved problem, exacerbated by the fact that xdg-shell protocol
doesn't allow clients to even know about single-axis maximize.

P.P.S. the view_invalidate_last_layout_geometry() logic may need
similar updates, I'm not sure.
2025-08-24 23:05:59 +09:00
tokyo4j
888dbedeed ssd: allow hiding titlebar on maximization
<core disableMaximizedServerDecor="yes"> hides the titlebar when a window
is maximized.

Co-authored-by: @CosmicFusion
2025-08-24 12:41:41 +01:00
tokyo4j
943f5751ee view: unify ssd_enabled and ssd_titlebar_hidden to ssd_mode 2025-08-24 12:41:41 +01:00
tokyo4j
48ba23fc8d Add common/edge.c
Some checks failed
labwc.github.io / notify (push) Has been cancelled
2025-08-21 21:17:52 +01:00
01micko
1b575ce816 docs/labnag.1.scd: fix typo 2025-08-21 21:05:04 +01:00
John Lindgren
beb3c0fa09 config: add comment to enum lab_motion 2025-08-21 16:55:25 +09:00
John Lindgren
9d49d19cd2 include: add config/types.h 2025-08-21 16:55:25 +09:00
Marvin Dostal
6dea8c0dcc desktop-entry: fix partial string matching
Use the base instead of the full string for the comparison.
2025-08-20 21:15:35 +01:00
01micko
3ee12b1e95 clients/labnag.c: add newline to color errors. 2025-08-20 21:10:21 +01:00
01micko
35ec696bd9 docs/rc.xml.all: clean up libinput section.
- add alternative accepted values for [yes|no]
- re #3006
2025-08-20 02:47:33 +09:00