Commit graph

27 commits

Author SHA1 Message Date
John Lindgren
d2ce31fcc9 tree-wide: use forward declarations for wlr types 2025-09-07 19:34:30 +09:00
tokyo4j
6f70cd0d6e layers: don't send configure events in unmap handler
Alternative to 7bf08af which was reverted in the previous commit.

7bf08af fixed the problem that layer-shell clients are terminated when
it's unmapped, by sending configure events in node-destroy handler
rather than in unmap handler. But it caused a UAF bug when an output
with layer-shell clients is destroyed.

So this patch fixes the original issue by simply skipping the surface in
arrange_one_layer() if it's being unmapped.
2025-06-27 22:03:37 +01:00
tokyo4j
cc0fe78ceb Revert "layers: arrange layers on destroy"
This reverts commit 7bf08af210.
2025-06-27 22:03:37 +01:00
Consolatis
30248e1ba3 Destroy xdg_popups when its parent is destroyed
Fixes: #2845
2025-06-18 20:19:48 +01:00
Johan Malm
7bf08af210 layers: arrange layers on destroy
...rather than unmap because that is the approach of sway and it also
avoids wshowkeys crashing.

Fixes: #1153
2025-06-02 22:00:43 +01:00
Consolatis
9e6aaa689a project wide: clean up event listeners on shutdown
This ensures all event listeners are removed before the emitting
wlroots object is being destroyed. This will be enforced with asserts
in wlroots 0.19 but there is no reason to not do it right now either.

This change in wlroots 0.19 is implemented via commit
8f56f7ca43257cc05c7c4eb57a0f541e05cf9a79
"Assert (almost all) signals have no attached listeners on destroy"
2025-03-13 17:33:51 +09:00
tokyo4j
e707e16130 layer: update pointer focus on popup destruction
Same as previous commit
2024-12-20 00:43:06 +09:00
John Lindgren
a98f2635ea xdg: support xdg-shell v3 with popup repositioning
See https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3514
which added support on the wlroots side.

We now re-run popup positioning (for both xdg-shell and layer-shell
popups) when the "reposition" event is received. This allows popups that
change size (such as qmpanel's applications menu) to be positioned
correctly.

xdg-shell v3 also gives the compositor some additional "hints" for popup
positioning (reactive, parent_size, and parent_configure_serial) which
are available but we don't make use of currently.
2024-07-01 20:16:31 +01:00
Johan Malm
36058a63e2 layer: change logic for giving keyboard-interactivity
Use the following logic:
 - Exclusive: Grant regardless of layer (previously it was only given if
   in top or overlay layers) AND grant if in the same or higher layer
   (nearer overlay) compared with other clients with exclusive
   interactivity.
 - On-demand: Grant only if no other layer-shell client has exclusive
   keyboard interactivity. Previously it was treated the same as
   exclusive.
 - None: Unset focus if the commit associated with the 'none' came from
   the currently focused layer. Previously it was just unset regardless.
2024-03-17 21:18:47 +00:00
Consolatis
598ab9bcff src/layers.c: delay popup unconstrain until after first commit
Fixes: #1372
2024-02-25 11:49:03 +00:00
Tomi Ollila
7ad5200f2e includes: identifier consistency in include guards
Made all header files to have LABWC_ prefix in include guard identifers.

Converted from __LABWC_ in 35 include/ files.
Converted from __LAB_ in 5 include/ files.
Added LABWC prefix to 3 include/ files.
Added include guards to 3 include/ files.

The double underscores were removed since according to C standard
those "are always reserved for any use".
2023-05-13 22:29:21 +01:00
Johan Malm
f01071e72c layer: remove wl_list layers[] from struct output
...and just use `struct wlr_scene_tree *layer_tree[]`
2022-12-29 23:18:08 +01:00
Johan Malm
e7346f71c0 include/layers.h: remove redundant struct wlr_box geo 2022-12-29 23:18:08 +01:00
Johan Malm
9dbac2e06f layer: use scene-graph API more fully
...and thus simplify the usage of wlr_scene_node_at(). Specifically:

- desktop.c: in get_cursor_context() use node-description for
  layer-surfaces and layer-popups. This lays the foundations for a
  pointer-enter-event being sent when a new layer-surfaces appears under
  the pointer (even if the pointer doesn not move).

- layers.c:

  * Iterate over `struct wlr_scene_tree *layer_tree[]` rather than
    `struct wl_list layers[]` when arranging layers to avoid surfaces
    being out of sync with nodes

  * Set signal handlers after scene node creation to avoid configure
    race conditions

  * Handle scene-node destroy event rather than event of
    `struct wlr_layer_surface_v1`

  * Arrange layers on map and unmap

  * Handle client request for layer-change

Fixes issue #667
2022-12-29 23:18:08 +01:00
Consolatis
2ed7a10779 Chase wlroots: every scene_node parent is now a tree
Chases wlroots ccd0f85c2a36308e35b153c7f9653abac7659af3
wlr_scene: Only allow parenting on a wlr_scene_tree
2022-06-07 07:13:37 +01:00
Johan Malm
852a6f02fa layers: fix layer_popup_tree implementation 2022-03-06 16:48:39 +00:00
Johan Malm
d3918eec0a layers: only define LAB_NR_LAYERS locally where needed 2022-03-02 20:39:46 +00:00
Johan Malm
98d5fd483d layers: s/arrange_layers/layers_arrange/
Because we like to start public function names with the name of the
file.

Move prototype from labwc.h to layers.h
2022-03-02 20:29:29 +00:00
Johan Malm
49e8658a7b layer: support popups 2022-02-26 22:36:16 +00:00
Johan Malm
f26b61137d layers.h: define LAB_NR_LAYERS (4) 2022-02-23 21:47:01 +00:00
Johan Malm
688abf7db1 Handle layers under the scene-graph API
This excludes popups.
2022-02-23 21:47:01 +00:00
Johan Malm
b79744e7b0 Chase wlroots master
We need it for wlr_scene_layer_surface_v1_create()
2022-02-23 21:47:01 +00:00
Johan Malm
e227de1346 Add SPDX identifiers 2021-11-13 21:56:53 +00:00
Johan Malm
174e82a608 layers: support popups 2021-10-20 22:32:46 +01:00
Johan Malm
73b8f06a26 layer-shell: fix commit handler (issue #71)
On commit, do not arrange layers unless the layer shell-specific state
changed or the layer was (un)mapped.

Chase swaywm/sway@5fd5d643 and swaywm/wlroots@754f40f9
2021-10-15 19:14:07 +01:00
Johan Malm
a26fd5a75b layers: handle top layer unmap/destroy better
On losing top layer focus, set focus on topmost mapped view.
2020-10-31 15:09:13 +00:00
Johan Malm
a4c22f7c4d Add partial support for layer-shell
We can now run swaybg and waybar
2020-09-30 17:18:20 +01:00