Commit graph

1190 commits

Author SHA1 Message Date
Jack Zeal
362c3e1b47 Add osd.border.type and osd.border.bevel-width options 2026-04-01 20:40:21 -07:00
Jack Zeal
773996f1ee add window.*.border.type and window.*.border.bevel-width options 2026-04-01 20:18:43 -07:00
Jack Zeal
b07165f154 Ensure we use all details of borders when caching them 2026-04-01 19:43:20 -07:00
Jack Zeal
fe44a2e9b3 Reuse common code for raised and sunken bevels 2026-04-01 19:39:24 -07:00
Jack Zeal
6ae186edc5
Merge branch 'master' into master 2026-04-01 05:27:23 +00:00
Jens Peters
0d049552bc input: support tablet tool pressure range configuration
Needs wlroots 0.20.0.
2026-03-31 19:56:07 +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
Consolatis
f2867e5f0a [wip] keep wlr_buffers around 2026-03-29 14:27:00 +02:00
Jack Zeal
d80dd2470b Centralize buffer preparation and standardize placement 2026-03-28 09:01:21 -07: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
Jack Zeal
0be9082ea8 Add bevels to the window size/position box 2026-03-27 23:37:18 -07:00
Jack Zeal
536847cb5b Use cache for title bar double beveled borders 2026-03-27 20:57:28 -07:00
Jack Zeal
2a0ff0d5b4 Initial use of a centralized caching border generator 2026-03-27 20:24:24 -07:00
Jack Zeal
f7d2be37ea Clean up codesniffer issues 2026-03-26 21:50:55 -07:00
Jack Zeal
25b5ad08e4 Handle the highlights on the window switcher with a different bevel that doesn't involve leaving crumbs 2026-03-26 19:35:38 -07:00
Jack Zeal
69e372cc5f Sharp borders and flag-controlled bevels for the menus/dialogues 2026-03-25 21:08:20 -07:00
Jack Zeal
effc16fc05 Window bevel depth is now configurable 2026-03-25 20:03:01 -07:00
Jack Zeal
4ff1832eb3 Gate beveled borders behind border.beveled theme option 2026-03-23 22:14:28 -07:00
Jack Zeal
7897807941 Draw beveled windowed borders, inspired by jlindgren https://github.com/labwc/labwc/pull/3382/files 2026-03-23 20:43:26 -07: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
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
Consolatis
4faab834f9 xwayland: make X11 always-on-top request opt-in
Fixes: #3441
2026-03-15 13:09:05 +01:00
tokyo4j
3bb4ccd22d view: save view->last_placement on initial positioning
Fix a regression introduced in 3f223fe5 where output layout changes may
move xdg views outside of the output layout with the error:
`view has no last placement info`. This happens also for X11 views if
they don't specify its own geometry on map.

Recent changes introduced `view->last_placement` which is used to
restore view positions after layout changes. This is supposed to be
updated when a view is mapped or manually moved by the user.

However, 3f223fe5 replaced `view_place_by_policy()` with
`view_compute_position_by_policy()` in the xdg view map handler. Unlike
`view_place_by_policy()`, this function does not update
`view->last_placement`, leaving it unset at the time of output layout
changes.

Therefore, this patch adds explicit calls to `view_save_last_placement()`
in the map handler to ensure `view->last_placement` is always set for
mapped views.
2026-03-10 21:05:53 +09:00
tokyo4j
00f63622b5 interactive: subtle refactor to interactive_set_grab_context()
- Add `server` argument to `interactive_set_grab_context()` to clarify
  it updates something in `server`.
- Add `const` qualifier to `ctx` argument of
  `interactive_set_grab_context()` and `cursor_get_resize_edges()`
2026-03-05 19:19:01 +09:00
John Lindgren
df73a97efa view: add/improve some comments 2026-03-05 19:06:59 +09:00
John Lindgren
5238dcaa08 view: factor out view_compute_position_by_policy() 2026-03-05 19:06:59 +09:00
John Lindgren
d4ca1dfb69 view: make view_move_to_cursor() static 2026-03-05 19:06:59 +09:00
John Lindgren
72cdd02eb1 xwayland: handle client close request 2026-03-02 17:58:33 +01:00
John Lindgren
079b3b8a10 xwayland: honor client request for always-on-top 2026-03-01 01:40:46 +01:00
John Lindgren
13200cc0d7 view: add view_set_layer() 2026-03-01 01:40:46 +01:00
Johan Malm
bdbb1be35a layer: focus popup rather than layer-shell surface
When a opening a layer-shell popup via IPC (like `lxVqt-qdbus openmenu` or
`xfce4-popup-applicationsmenu`), give keyboard focus to the popup, not the
parent layer-shell surface.

Written-by: @tokyo4j
2026-02-21 14:05:56 +00:00
Johan Malm
a277c35c3d layer: on popup destory, return focus
...to whoever had it before the popop

Co-authored-by: @tokyo4j
2026-02-21 14:05:56 +00:00
Johan Malm
180293e0bb Give keyboard focus to xdg-popups of unfocused layer-shell clients
...in support of enabling panel menus to be opened by keyboard shortcuts
and get keyboard focus so that they can be operated with the keyboard.

An example use-case is the xfce4-panel applications-menu being opened by
the command xfce4-popup-applicationmenu.
2026-02-21 14:05:56 +00:00
tokyo4j
a2eae22fc2 view: decouple always-on-top windows from the omnipresent state
Before this commit, always-on-{top,bottom} windows were always visible
on all workspaces (omnipresent) because the they were not in
per-workspace trees like normal windows.

This commit fixes this by introducing per-layer trees in
`struct workspace`.

I also added `enum view_layer` and `view->layer` for simplicity.
2026-02-12 14:44:20 +09:00
John Lindgren
a672e8a9fd interactive: set grab parameters at cursor press
Add interactive_set_grab_context() which is called when the mouse button
is first pressed, before interactive_begin(). This fixes two small issues:

- The cursor origin position for interactive move/resize was slightly
  off (depending on mouse resolution), because it was set after the
  mouse had already moved slightly. Now it's exact.

- If app- or keybind-initiated maximize (etc.) happened after the button
  press but before the mouse was moved, then interactive_begin() would
  still start move/resize even though the view might now be far away
  from the cursor. Now interactive_cancel() works as expected, even if
  called before interactive_begin().

Also, make sure to call interactive_cancel() for un-maximize as well.
2026-02-10 21:29:16 +00:00
Johan Malm
54554f43dd theme: add option window.button.hover.bg.color 2026-02-08 18:45:48 +00:00
tokyo4j
12b6d05481 view: fix error messages on region or usable area changes
f58b532 implemented output-relative position saving/restoring on output
un-plugging/re-plugging. It worked as follows:

1. Store the output-relative view geometry in `view->last_placement`
  (if not set) before adding/removing an output from the layout.
2. After adding/removing an output, call `view_adjust_for_layout_change()`
  after the layout change to restore the output-relative view geometry
  based on `view->last_placement`.

However, it didn't consider `view_adjust_for_layout_change()` being
called from other places such as `regions_reconfigure()` and
`output_update_all_usable_areas()`, causing an error message "view has
no last placement info". This can happen when a panel is mapped or
unmapped, or on Reconfigure.

This commit fixes it by changing the life cycle of
`view->last_placement`. It used to be set only before output layout
changes and cleared on user-initiated moves/resizes, but now it is set
and updated on user-initiated moves/resizes. I think this is more
intuitive, too.
2026-02-04 19:14:51 +09:00
tokyo4j
7fabc6afe3 string-helpers: update comments for str_equal() 2026-02-04 19:14:51 +09:00
tokyo4j
55a256f2fa desktop: use for_each_view() in desktop_topmost_focusable_view()
Fixes a regression in 83b619c2 that the bottom-most view is focused
when when an exclusive layer surface (e.g. fuzzel) is unfocused.

Also, added some comments to clarify the order.
2026-01-31 17:16:13 +01:00