Commit graph

3362 commits

Author SHA1 Message Date
Johan Malm
eecb5d0947 labwc-config(5): clarify touchpad and touchscreen sections
Some checks are pending
labwc.github.io / notify (push) Waiting to run
2025-12-07 09:32:04 -05:00
John Lindgren
2f37002498 cursor: don't synthesize relative motion events from absolute events
It seems to have been inherited behavior from tinywl, but it's not clear
what purpose it serves, and it causes a couple of issues:

- A new absolute position that's discontinuous with the previous cursor
  position can produce unexpectedly large relative motion deltas. This
  can occur for example when multiple input devices are active, or in
  nested/VM scenarios when the pointer leaves the windowed output and
  re-enters at a different point.

- When the cursor position is locked via constraint, the computed deltas
  continue to get larger as the absolute event position diverges further
  from the locked position. This led to the mouse pointer going crazy in
  applications that use the relative events, such as games under Wine/
  Wayland.
2025-12-07 01:35:22 -05:00
John Lindgren
10a3281322 osd-classic: initialize struct fields in order 2025-12-07 14:55:32 +09:00
John Lindgren
1b22bf3d5a osd-classic: remove unused variable (buf) 2025-12-07 14:55:32 +09:00
John Lindgren
11959c5c5e rcxml: declare variable at initialization 2025-12-07 14:55:32 +09:00
John Lindgren
a1d8ebc0de node: update node_descriptor_create() comment 2025-12-07 14:55:32 +09:00
Johan Malm
a1119f0cb2 docs/rc.xml: populate <theme><name> to avoid empty string 2025-12-07 14:54:19 +09:00
John Lindgren
61096463fe cursor: allow movement until entering the constraint surface
Fixes an issue where the cursor would get stuck (immovable) outside the
window of a Wine/Wayland game, if it was already outside when the game
started (common with a 4:3 game on a 16:9 screen). Now one can manually
move the cursor into the game window, at which point it becomes locked.

This is a minimal/interim fix. Ideally we should warp the cursor into
the constraint area automatically, but that would be a bit more work.

The change to apply_constraint() just turns an assert-failure into a
safe no-op return, since the function is now entered for "locked" as
well as "confined" constraint types.
2025-12-06 11:04:41 -05:00
elviosak
94d33f9119
snapping: replace <snapping><range> with <snapping><range inner="" outer=""> (#3241)
Some checks failed
labwc.github.io / notify (push) Has been cancelled
<inner>/<outer> configure the size of snapping area on output edges with/without adjacent outputs.
2025-12-06 16:09:28 +09:00
Standreas
4d47b68aae
docs/rc.xml.all: add scrollMethod option 2025-12-05 19:46:18 +01:00
tokyo4j
06505d24c8 rcxml: discourage empty strings in rc.xml configuration
Some checks failed
labwc.github.io / notify (push) Has been cancelled
Background:
I rewrote the config parser in 9462457..2f414a4, but it broke certain
configurations by changing how empty strings are handled: they were mostly
just ignored before my parser rewrite, but after that, they are
interpreted as just empty strings (output="" is considered as 'output named ""').

Though that was unintentional, I believe ignoring empty strings was not a
good idea in the first place, as we already allow empty strings for
certain configurations (e.g. `<desktop prefix="">`), which makes the
parser's behavior inconsistent.

Change:
So let's clarify that we intend to read empty strings as empty strings.
As a preparation, this commit adds warnings for empty strings we are
currently ignoring, so that users can be informed that we intend to just
read empty strings (e.g. `<theme name="">`) as empty strings in the future.
I removed existing empty strings in `rc.xml.all` to avoid warnings when
reading it.
2025-12-04 05:02:26 +09:00
Maik Broemme
a5db8e477a Add directional options to Resize action:
This introduces an optional "direction" argument to the Resize action,
mirroring Fluxbox's StartResizing [corner] behavior.

Supported values (case-insensitive) are:
up-left, up, up-right, left, right, down-left, down, down-right.

If no direction is specified, the existing behavior is preserved and the
resize edges are inferred from the current pointer position. The action
documentation has been updated to describe the new argument.
2025-12-04 03:01:27 +09:00
John Lindgren
d748dc78bc xwayland: flush XCB connection to mitigate race between Raise and input
Some checks are pending
labwc.github.io / notify (push) Waiting to run
2025-12-02 19:50:03 +01:00
tokyo4j
c4277ab507 cycle: update config to <osd output="all|cursor|focused">
I think `<windowSwitcher><osd output="keyboard">` is a bit unclear and
hard to interpret as "show OSD in the output with keyboard focus". Also,
we use "cursor" instead of "pointer" in other configurations like
`<placement policy="cursor">` and `<action name="ShowMenu" atCursor="">`.

So let's replace `output="all|pointer|keyboard"` with
`output="all|cursor|focused"`. In documentation, I reordered them to
`output="all|focused|cursor"` as "focused" feels like a bit more
sophisticated and general policy.
2025-12-02 17:09:54 +01:00
tokyo4j
71d29cbebb cycle: some minor updates to documentation and deprecation warnings 2025-12-02 17:09:54 +01:00
tokyo4j
499c910954 src/interactive.c: fix typo 2025-12-02 21:05:12 +09:00
John Lindgren
ba60f4d5d0 xdg: don't send xdg_wm_base::ping on creation of new surface
Although this wasn't causing any known issues, here too we weren't
handling the ping_timeout event, so it seems useless.
2025-12-02 09:21:42 +01:00
John Lindgren
d20d5675f5 xwayland: don't send _NET_WM_PING to new windows
No one remembers why we were doing this, and we do not handle the
ping_timeout event, so it seems pointless. Also it appears to confuse
some older X clients.
2025-12-02 09:21:42 +01:00
John Lindgren
7f7b5f57ec xdg: center small fullscreen views and add black background fill 2025-12-02 14:57:41 +09:00
John Lindgren
96617311cd view: use wlr_output_layout_get_box() 2025-12-02 14:57:41 +09:00
John Lindgren
27aa8173f3 view: move view_moved() out of view_impl_apply_geometry() 2025-12-02 14:57:41 +09:00
John Lindgren
5ea617a393 box: factor out box_center() 2025-12-02 14:57:41 +09:00
tokyo4j
9f5ff391cc cycle: remember cycled window list in server->cycle.views
This allows changing the cycled order in the future, e.g. focused order vs
created order.

Functionally, this commit also changes the initially selected window;
before this commit, the previous/next of the topmost window was always
selected, but now the previous/next of the active window is selected first
if it is in the cycled list. This won't change behaviors for most users,
but this ensures that the user can go back to the focused window with
Alt-Tab + Alt-Shift-Tab even when it is not the topmost window.

This commit fixes the TODO in the previous commit by trying to preserve
the selected view when a view is destroyed during window cycling.
2025-11-30 21:33:46 +00:00
tokyo4j
b6c1a9ea59 cycle: clarify the lifecycle of window switcher
This commit clarifies the lifecycle of the window switcher (cycle) by:
- init_cycle(): initializes the window switcher (e.g. OSD).
- update_cycle(): updates the window switcher states including OSD,
  preview and outlines.
- destroy_cycle(): clears all the window switcher states.

This commit temporarily regresses by not trying to preserve the selected
view when a view is destroyed. This will be addressed in the next commit.
2025-11-30 21:33:46 +00:00
tokyo4j
1783b805e1 cycle: factor out get_osd_impl() 2025-11-30 21:33:46 +00:00
tokyo4j
7527717caa cycle: move & rename destroy_osd_scenes() 2025-11-30 21:33:46 +00:00
tokyo4j
2b28c41b23 cycle: use dummy node to remember the scene position of previewed window
With this approach, we only need to store cycle->dummy_node instead of
cycle->preview_anchor and cycle->preview_parent and we don't need to care
about annoying cases like when the previewed window has no siblings or
when a window tracked by cycle->preview_anchor is destroyed.
2025-11-30 20:56:34 +09:00
tokyo4j
c1f3286cfe src/cycle/cycle.c: remove node->enabled check before _set_enabled()
wlr_scene_node_set_enabled() just returns early when it doesn't change
enabled state.
2025-11-30 20:56:34 +09:00
tokyo4j
e4ebc30c90 cursor: update focus on entering SSD if followMouse=yes
This fixes a known regression in 885919fc that cursor entering the
titlebar (and other SSD parts) doesn't update the keyboard focus even when
followMouse=yes.
2025-11-30 20:55:54 +09:00
tokyo4j
7fb060e88c cursor: clarify the semantics of update_pressed_surface()
This should not change any behaviors. This is mainly just a preparation
for the next commit.
2025-11-30 20:55:54 +09:00
tokyo4j
acb3da7903 cursor: generalize seat->pressed
This commit moduralize seat_{set,reset}_pressed() into
cursor_context_save() so that we can also have seat->hovered later.
2025-11-30 20:55:54 +09:00
tokyo4j
4fcb873f6f Use "cycle" instead of "osd" across the codebase
We were using the word "osd" to describe the window switcher, but it can
be used with on-screen display (OSD) disabled by
`<windowSwitcher><osd show="false">`. Let's use "cycle" instead to avoid
confusion.
2025-11-30 16:20:16 +09:00
tokyo4j
65cc2e40ba Rename osd.{h,c} to cycle.{h,c} 2025-11-30 16:20:16 +09:00
John Lindgren
35b3980a5b xwayland: hide content tree at re-map if shaded 2025-11-27 01:26:55 -05:00
John Lindgren
8bd20f19dc view: add defensive checks for null content_tree 2025-11-27 01:26:55 -05:00
John Lindgren
b1e7282995 xwayland-unmanaged: remove obsolete workaround 2025-11-27 01:26:55 -05:00
John Lindgren
b9da216bde xwayland: associate/dissociate/map/unmap cleanups
- connect/disconnect map handlers in set_surface()
- call set_surface() at time of associate/dissociate

This separates the concepts of "associate" and "map" more clearly.

It's no longer necessary to listen for wlr_surface "destroy" event,
because dissociate is always received first.

Also, view->content_tree is now destroyed and set to NULL at unmap.
Previously, we relied on wlr_scene to destroy it automatically when
the surface was destroyed, but kept a potentially dangling pointer in
view->content_tree until next map. Similar change for unmanaged.

v2: comment updates
2025-11-27 01:26:55 -05:00
tokyo4j
4b0903cfa9 view: deduplicate foreign-toplevel creation code 2025-11-27 01:26:55 -05:00
tokyo4j
3c0e010c58 Remove view_impl->map and view_impl->unmap
jlindgren: data parameter to handle_unmap() is NULL
2025-11-27 01:26:55 -05:00
John Lindgren
e96f4a032b output: avoid use of wlr_scene_output.WLR_PRIVATE.index
We were only using it to allow quick bitset comparisons of sets of
outputs (such as view->outputs). We can maintain our own bit IDs for
this purpose and avoid using the private wlroots field.

Note: from my reading of wlr_scene_output_create(), it appears to
always take the lowest unused index, resulting in aggressive re-use of
index values when outputs are disconnected and reconnected. I've tried
to make re-use as infrequent as possible. This could theoretically
reduce the chance of a mix-up in view_update_outputs(), although I'm
not aware of any practical scenario where it matters.

v2: prevent adding more than 64 outputs
2025-11-26 06:49:17 +01:00
Consolatis
6521067171 CI: add pcre2 dep for FreeBSD to work around git error 2025-11-23 03:50:11 +01:00
John Lindgren
b5e2eb216e view: separate (un)minimize and (un)map logic
Map/unmap logic is currently re-used for minimize/unminimize, but lots
of it doesn't actually apply in that case. This is both confusing and
creates some extra complexity, such as:

 - extra "client_request" parameter to unmap(), in which case it has to
   still do some cleanup even if view->mapped is already false

 - various "view->mapped || view->minimized" checks when we really just
   mean "is the view mapped"

To clean this all up, let's put the logic that really is common into
a new view_update_visiblity() function, and stop using map/unmap for
minimize/unminimize.

Note that this changes the meaning of "view->mapped", which used to
mean "mapped and not minimized" but now really just means "mapped".
I left some "view->mapped" conditions as-is (rather than changing to
"view->mapped && !view->minimized") where it seemed to make sense.

v2: add view_update_visibility() as suggested by tokyo4j
2025-11-21 14:01:48 +09:00
John Lindgren
20087e89b2 wlr-foreign: set all initial states correctly
Two were missing: "minimized" and "activated".

At least "minimized" can be set before map, so the initial state needs
to be read and set on the foreign-toplevel.

I think in the current code, the foreign-toplevel is always created
before a view is activated, but for future-proofing, let's not rely
on this, and set "activated" as well. There's no harm since wlroots
optimizes away any redundant state changes.
2025-11-18 07:06:07 +01:00
Johan Malm
077a5c970a NEWS.md: interim update 2025-11-16 19:14:11 +00:00
John Lindgren
8ced055cb9 xwayland: remove obsolete (since wlroots 0.17) NULL check
Since d7dc6e01b4 ("Chase wlroots: Unified mapping"), the map event
is emitted by the wlr_surface itself, thus it cannot be NULL.

Change the "if" to an "assert" accordingly.
2025-11-15 12:19:31 +01:00
Hiroaki Yamamoto
b35b935ab1
cursor: remove unneeded process_cursor_motion_out_of_surface() 2025-11-15 12:14:26 +01:00
John Lindgren
9f4178955a xdg: make use of xdg_toplevel_view_get_parent() 2025-11-13 00:07:11 +01:00
John Lindgren
5543affe35 view: factor out view_impl_init_foreign_toplevel() 2025-11-13 00:07:11 +01:00
John Lindgren
51c2003ed8 xdg: remove unnecessary cast 2025-11-13 00:07:11 +01:00
David Turner
d15152b27b seat: Call configure_libinput() for keyboards
Call configure_libinput() for keyboards in new_keyboard() and
seat_reconfigure().

This allows the use of the sendEventsMode configuration option on
keyboards in order to disable keyboard input, for example:

    <libinput>
        <device category="  RPI Wired Keyboard 1">
            <sendEventsMode>no</sendEventsMode>
        </device>
    </libinput>
2025-11-12 23:59:29 +01:00