Commit graph

2625 commits

Author SHA1 Message Date
Jos Dehaes
e61d58e54d desktop: only apply raise-on-focus delay to sloppy-focus
The raise_on_focus_delay is meant to dampen z-order churn from
focus-follows-mouse cursor passes. Applying it to every focus
change meant explicit actions (alt-tab cycle finish, Focus action,
xdg/xwayland activation, view map, etc.) also waited for the delay
before raising, which felt laggy.

Route all non-sloppy-focus callers through an immediate raise and
keep the timer-based raise only for desktop_focus_view_or_surface(),
which is the sloppy-focus entry point.
2026-04-28 20:33:09 +01:00
Jos Dehaes
9661ed4285 server: cancel pending auto-raise on config reload
If the user disables raiseOnFocus or lowers raiseOnFocusDelay while
a raise is queued, the queued raise should not fire against the new
config. Cancel it in reload_config_and_theme() before rereading the
rc.xml.
2026-04-28 20:33:09 +01:00
Jos Dehaes
ecc5565686 view: cancel pending auto-raise on view destroy
The pending_auto_raise_view pointer would become dangling if the
view it references is destroyed before the timer fires. Clear it
in view_destroy() alongside the existing active_view cleanup.
2026-04-28 20:33:09 +01:00
Jos Dehaes
28908adfbe desktop: implement delayed auto-raise timer logic
When raiseOnFocus is enabled and raiseOnFocusDelay is > 0, defer
view_move_to_front() until a wl_event_loop timer elapses instead of
raising immediately. The pending view/timer pair lives on struct
server so that at most one raise can be pending per compositor.

Semantics:
  delay_ms == 0            : immediate raise (preserves prior behavior)
  delay_ms >  0, hover A   : schedule raise of A after delay_ms
  another hover before     : timer is reset and the new view becomes
    expiry                   the pending one (brief flyby hovers do
                             not stack up raises)
  focus change, raise=false: pending raise is cancelled

This is most useful with followMouse to avoid brief passes of the
cursor stacking up z-order changes.
2026-04-28 20:33:09 +01:00
Jos Dehaes
7b3f37725f rcxml: add raiseOnFocusDelay option
Add a new <focus><raiseOnFocusDelay> element accepting an integer in
milliseconds. The default of 0 preserves the current behavior (raise
immediately when raiseOnFocus is enabled).

The new field is carried as uint32_t raise_on_focus_delay_ms on
struct rcxml. This commit only adds the parser and default; the
actual delay logic follows in a subsequent commit.
2026-04-28 20:33:09 +01:00
diniamo
5c7bfe3c67 Add onbutton scrollMethod, scrollButton 2026-04-27 20:55:55 +01:00
tokyo4j
7d264c907f src/cycle/cycle.c: fix typo 2026-04-26 19:07:23 +09:00
Thorbjørn Lindeijer
5f668a82ee interactive: allow resize on fully maximized views
Some checks failed
labwc.github.io / notify (push) Has been cancelled
Modifier+right-drag resize was silently ignored on fully maximized views
because of an early-return guard in interactive_begin(). The axis-specific
un-maximization logic introduced in #3043 already handles partial
maximization correctly; extend that to the VIEW_AXIS_BOTH case so both
axes are cleared while keeping the current geometry as the starting point
of the resize.

Move already permits dragging maximized views, so this also removes an
asymmetry between the move and resize paths.

Fixes: #3524
2026-04-19 13:37:13 +01:00
Yannis Drougas
c5ea41e876 Add overrideInhibition to keyboard.keybind
Some checks failed
labwc.github.io / notify (push) Has been cancelled
2026-04-14 22:33:49 +01:00
yuiiio
4c7a9960a4 osd-thumbnail: fix failed to get client texture
Use wlr_client_buffer->texture directly instead of wlr_texture_from_buffer.
All buffers in content_tree are wlr_client_buffer.

wlr_texture_from_buffer calls client_buffer_begin_data_ptr_access which
fails when client_buffer->source == NULL (client released buffer early,
e.g. wl_shm foot-terminal).
2026-04-15 00:26:10 +09:00
Johan Malm
da37e97a45 Add action ToggleShowDesktop
Some checks are pending
labwc.github.io / notify (push) Waiting to run
2026-04-13 21:59:09 +01:00
Tobias Bengfort
8b32422b93 rcxml: allow to restrict privileged interfaces
Some checks failed
labwc.github.io / notify (push) Has been cancelled
2026-04-11 16:34:11 +02:00
Johan Malm
c8bb3381a4 Add key state OSD for debugging
Some checks are pending
labwc.github.io / notify (push) Waiting to run
Add action `DebugToggleKeyStateIndicator` to show in the top-left corner
the pressed, bound, pressed-sent keys as well as modifiers.

This should help fault find issues like #2771 and #3238

Based-on: #3262
Co-authored-by: @tokyo4j
2026-04-10 21:19:11 +01:00
Manuel Barrio Linares
3ec20044b5 server: add support for color-management-v1 and color-representation-manager-v1 2026-04-10 12:59:44 +02:00
John Lindgren
90c38e2681 xdg: set initial position a hair earlier to fix window rules
Partially reverts: 3f223fe5b0
("xdg: unify initial positioning logic")
2026-04-07 20:05:00 +02:00
Jens Peters
a893b1ab50 input: fix tablet tool tilt motion
Tilt axis are not relative.
2026-04-06 22:10:10 +01:00
Consolatis
c9b4da2ce2 osd-thumbnail: handle buffer allocation failure
Fixes: #3489
2026-04-02 22:10:30 +02:00
Consolatis
8c6faa010f make wlroots libinput backend optional 2026-03-31 22:58:49 +02:00
Consolatis
dfbea3e156 make wlroots session backend optional 2026-03-31 22:58:49 +02:00
Consolatis
046d055ac0 make wlroots DRM backend optional 2026-03-31 22:58:49 +02:00
Johan Malm
fe1955fb27 Stop generating wayland-protocols server headers
We still need to generate wlr-protocols server headers, as well as
client headers and code.

References:
- https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/5075
- https://github.com/swaywm/sway/pull/8838
2026-03-31 20:51:49 +02:00
Jens Peters
0d049552bc input: support tablet tool pressure range configuration
Needs wlroots 0.20.0.
2026-03-31 19:56:07 +02:00
GlassOnTin
9a8154836c keyboard: use XKB_CONTEXT_NO_SECURE_GETENV on Android
Android's bionic libc implements secure_getenv() as a function that
always returns NULL because app processes don't have AT_SECURE set.
This prevents xkbcommon from reading XKB_DEFAULT_LAYOUT and other
environment variables when resolving keyboard layouts.

Use XKB_CONTEXT_NO_SECURE_GETENV on Android so xkbcommon falls back
to regular getenv(), which works correctly in the Android app
environment.
2026-03-30 22:25:35 +01:00
tokyo4j
3128f50a25 xwayland: remove atom synchronization
It was used to get window icon via _NET_WM_ICON, which is now
implemented by wlroots 0.20. Anyone who needs another atom can revert
this commit and add atoms in the `atoms` array.
2026-03-30 11:55:37 +02:00
tokyo4j
cdee4ba5f1 xwayland: use wlr_xwayland_surface_fetch_icon() 2026-03-30 11:55:37 +02:00
Christopher Snowhill
cee5712877 chase wlroots: wlr_scene_set_gamma_control_manager_v1
Ref: 515275ee7214bf91f8a758b660093eb4b932195a
(wlr_scene: Introduce wlr_scene_set_gamma_control_manager_v1)

This wlroots change eliminates the need for separate event tracking for gamma
control application.

v2: Fix code style
v3: Rebase now that 0.20 is merged
2026-03-30 11:18:53 +02:00
tokyo4j
647e9b7658 Drop cosmic-workspace and use wlroots implementation of ext-workspace-v1 2026-03-30 10:29:04 +02:00
Manuel Barrio Linares
76f166ae42 chase wlroots: wlr_xwayland_set_cursor now takes a wlr_buffer (MR 5230)
Ref: 84d603acc06a45dd3c3a4b2cf1fd08b2933ca2b5
(xwayland: take wlr_buffer in wlr_xwayland_set_cursor())

Ref: 6ae54dca23064e897b393283887986e5719a747f
(xwayland: lock new buffer instead of the old one)

Co-Authored-By: Consolatis

This wlroots change fixes a potential UAF which we dealt with in labwc.
We can thus remove the workaround completely.
2026-03-29 15:58:13 +01:00
tokyo4j
863863fc7c chase wlroots: ime: don't use data in kb grab destroy handler (MR 5170)
Ref: 06275103f249cd2954630e59383342e102a6c1a3
(input-method-v2: Destroy keyboard grab before input method)

Background:

My MR in wlroots (!5107) stopped emitting `wlr_input_method_v2`
on its `commit`/`destroy` events, but didn't stop emitting
`wlr_input_method_keyboard_grab_v2` on its `destroy` event. That was
because `handle_keyboard_grab_destroy()` was called *after*
`handle_input_method_destroy()` for some reason, which caused segfault
when dereferencing `relay->input_method.keyboard_grab` in
`handle_keyboard_grab_destroy()`.

MR 5170 reversed this weired order of destroy handler calls, and finally
stopped emitting `wlr_input_method_keyboard_grab_v2` on its `destroy`
event.
2026-03-29 15:58:13 +01:00
Consolatis
5f8a6395a1 chase wlroots: ime: rename to new_input_method (MR 5107)
Ref: 06aacb2a6fd237a5e1062d611909432bbcf5b566
(input-method: rename input_method event to new_input_method)
2026-03-29 15:58:13 +01:00
Christopher Snowhill
511ed69c53 chase wlroots: add wl_fixes interface (MR 4685)
Ref: 812675ba34ce612e9294e8a9814b1baf4b4775d4
(fixes: add implementation)
2026-03-29 15:58:13 +01:00
Consolatis
0c24252c85 chase wlroots: ime: rename to new_text_input (MR 5032)
Ref: 536100488fc4c64528786801860f96cfa1a55765
(text-input-v3: Name new text input event correctly)
2026-03-29 15:58:13 +01:00
John Lindgren
3ce6328f6d xwayland: set initial view state + geometry in handle_associate()
Empirically, the associate event is always seen just after map_request
but before surface map. Window properties are also read by wlroots just
before emitting associate. So after some trial and error, this seems to
be the best place to set initial view states and compute initial
placement.

Fixes initial positioning of "urxvt -g -0-0".

urxvt placement regressed in:
9903331995
("xwayland: rework setting initial geometry from surface")

map_request handler was added ~2 years ago in:
c9018da4c4
("xwayland: set initial geometry in map_request handler")

I'm not sure if the map_request handler was incorrect from day one,
or if something changed in wlroots and/or Xwayland since then.
2026-03-28 14:59:29 +00:00
Daniel Lublin
fee38bceca Handle xwayland not started (when HAVE_XWAYLAND, but lacking the binary)
Closes https://github.com/labwc/labwc/issues/434
2026-03-24 19:40:49 +00:00
Tomi Ollila
4e25347791 use X macros to fill up enum action_type and const char *action_names[]
To make it harder to have these 2 data structures go out of sync.

No functional change.

To understand X macros better, visit:
- https://en.wikipedia.org/wiki/X_macro
- https://philliptrudeau.com/blog/x-macro
2026-03-24 19:35:38 +00:00
John Lindgren
9903331995 xwayland: rework setting initial geometry from surface
The basic idea is to set the initial geometry from the surface exactly
once, just before we need it, i.e. either (1) when mapping the view or
(2) right before processing an initial maximize/fullscreen request.

I've consolidated various parts of the initial geometry setup to take
place at this point (in ensure_initial_geometry_and_output()).

The main motivation is to have a valid, adjusted floating geometry for
the view *before* saving the natural geometry when processing an initial
maximize/fullscreen request. This reduces code duplication and addresses
a FIXME in set_initial_position(), as well as fixing an issue where the
natural geometry could exceed the usable output area.

Some other minor changes:

- The initial output is now set directly from the surface geometry if
  the "application/user-set position" hint is given. This is unlikely
  to matter in practice, but theoretically an initially maximized view
  could now appear on a different (application-chosen) output.

- Floating view size is now constrained to the usable area even if a
  position hint is set. It seemed inconsistent that `xterm -g 200x200`
  was constrained but `xterm -g 200x200+0+0` was not.
2026-03-22 21:55:02 +00:00
John Lindgren
d4ad27e636 tree-wide: use rc.theme instead of server.theme
Having two global pointers to the same struct is redundant.
2026-03-22 10:16:42 +01:00
John Lindgren
9550bccef2 decorations: fix accidental rename
Fixes: 4f72e6775e
("tree-wide: rename g_server to just server")
2026-03-22 10:13:17 +01:00
John Lindgren
a2e0de7676 tree-wide: rename seat->seat to seat->wlr_seat for clarity
As we use "seat" to refer to the labwc struct, this makes it clearer
at a quick glance which code is using the wlr struct instead.
2026-03-22 00:56:49 +01:00
John Lindgren
4f72e6775e tree-wide: rename g_server to just server 2026-03-21 21:35:33 +00:00
John Lindgren
8d46da9db1 tree-wide: wrap a few extra-long lines 2026-03-21 21:35:33 +00:00
John Lindgren
cb49bddf63 tree-wide: auto-replace of (struct server *)
#!/bin/bash
    read -r -d '' EXPRS << EOF
    s/xwayland->server/xwayland->svr/g;

    s/\t*struct server \*server;\n//g;
    s/\t*struct server \*server =.*?;\n//gs;
    s/\t*.* = ([a-z_]*->)*server[;,]\n//g;
    s/\{\n\n/\{\n/g;
    s/\n\n+/\n\n/g;

    s/\(\s*struct server \*server\)/(void)/g;
    s/\(\s*struct server \*server,\s*/(/g;
    s/,\s*struct server \*server\)/)/g;
    s/,\s*struct server \*server,\s*/, /g;

    s/\(\s*([a-z_]*->)*server\)/()/g;
    s/\(\s*([a-z_]*->)*server,\s*/(/g;
    s/,\s*([a-z_]*->)*server\)/)/g;
    s/,\s*([a-z_]*->)*server,\s*/, /g;

    s/([a-z_]*->)*server->/g_server./g;

    s/xwayland->svr/xwayland->server/g;
    EOF

    find src include \( -name \*.c -o -name \*.h \) -exec \
        perl -0777 -i -pe "$EXPRS" \{\} \;
2026-03-21 21:35:33 +00:00
John Lindgren
60ac8f07bb tree-wide: add g_server global and prep for auto-replace 2026-03-21 21:35:33 +00:00
Consolatis
17d6c29037 xwayland: sync always-on-top to X11 2026-03-16 17:46:48 +01:00
Consolatis
3b6fe26301 view: add always-on-top signal 2026-03-16 17:46:48 +01:00
John Lindgren
16c5373be5 tree-wide: use die_if_null() for wlr_scene alloc failures
Some checks failed
labwc.github.io / notify (push) Has been cancelled
wlr_scene_*_create() functions all allocate memory via calloc() and
return NULL if the allocation fails. Previously, the failures were
handled in any of 3 different ways:

 - sending a wayland protocol error
 - exiting labwc with an error
 - segfault (no NULL check at all)

Since labwc does not attempt to survive heap exhaustion in other
allocation paths (such as `znew`), it seems more consistent to use the
same die_if_null() check used in those paths to exit with an error.

For the three most common create() functions (tree, rect, buffer),
add small lab_wlr_ wrappers to common/scene-helpers.
2026-03-15 21:26:37 +00:00
John Lindgren
c4effef0ec xwayland: fix missing title and icon with override-redirect toggle
When an X11 client clears override-redirect on a window (i.e. it
becomes "managed") without an unmap/map cycle, wlroots doesn't
re-emit the set_title/class/icon events. We need to synthesize
them to re-read the values from the surface.

From what I can tell, only older/misbehaving X11 clients would
actually do this (toggle override-redirect without unmap/map), so
this is perhaps a bit pedantic, but an easy fix anyway.
2026-03-15 19:40:26 +00:00
Consolatis
4faab834f9 xwayland: make X11 always-on-top request opt-in
Fixes: #3441
2026-03-15 13:09:05 +01:00
tokyo4j
a3646721bc view: clear view->{title,app_id} later in view_destroy()
...as it *feels* unsafe to call functions like `undecorate()` after
clearing view->{title,app_id}, which are expected to be non-NULL.
2026-03-11 19:30:50 +01:00
tokyo4j
ab60379c7f ssd-titlebar: update title buffer when title gets empty
Before this commit, ssd_update_title() returned early and the title was
not updated when the title gets empty. Furthermore, this caused the
title buffer to be misplaced outside of the titlebar when the window is
resized.

Reproducer:
1. Build and launch https://github.com/tokyo4j/wayland-demo/tree/repro-labwc-ssd-title-not-updated
2. One second later, the window title gets empty. But the title in
   SSD is not updated.
3. Un-minimize the window. Now the title buffer is misplaced outside of
   the titlebar.
2026-03-11 19:30:50 +01:00