Commit graph

60 commits

Author SHA1 Message Date
John Lindgren
a036d985d7 common: rename array-size.h to macros.h 2023-10-21 12:37:42 +01:00
Johan Malm
cf72d01f0c layers: remove redundant function argument 2023-10-16 17:10:09 -04:00
Johan Malm
8d3b15576b Add ARRAY_SIZE() macro 2023-09-19 22:03:59 +01:00
Johan Malm
4a531daef8 config: support <margin top="" bottom="" left="" right="" output="" /> 2023-06-26 06:04:07 +01:00
Johan Malm
6f3043b08d layer: improve keyboard-interactivity
- Process layer-shell keyboard interactivity in the map and commit
  handlers only, rather than in layers_arrange(). This allows handling of
  the layer-surface that emitted the event rather than iterating over all
  surfaces in the output layer-tree, and therefore avoids having to guess
  which surface should have keyboard preference (and it might not be the
  last one added to the list which was the assumption previously).

- Prevent seat_focus_surface() from setting keyboard focus if a layer-shell
  surface with exclusive keyboard-interactivity has the focus.

- Set cursor_context type for layer-surfaces without node-descriptors
  in order to set keyboard focus correctly in cursor_button_press().

Tested satisfactorily with xfce4-panel and gtk-layer-demo.

Fixes #725 and #704
2023-01-29 14:31:49 +00:00
John Lindgren
ed31381eb8 output: Add output_update_usable_area/all_usable_areas()
Move the desktop_arrange_all_views() call outside layers_arrange() into
a new function, output_update_usable_area().  The new function currently
does exactly what layers_arrange() used to, but will be expanded in a
later commit.

Add output_update_all_usable_areas(), which is the same as calling
output_update_usable_area() for each output, but only calls
desktop_arrange_all_views() once.

Rebased and slightly modified by @Consolatis
2023-01-06 14:51:46 +01:00
Consolatis
0d8b459912 src/layers.c: destroy layer surface on output loss 2023-01-03 19:46:31 +00:00
Consolatis
a4c1c4815e src/layers.c: ensure layers_arrange() is only called with an output set 2023-01-03 19:46:31 +00:00
Consolatis
c241d89c7c src/layers.c: remove new_popup handler on node destruction 2023-01-03 19:46:31 +00:00
Consolatis
cd645318e7 src/layers.c: prevent crash with no outputs available 2023-01-03 19:46:31 +00:00
Consolatis
84b3df4ef2 src/layers.c: minor simplification 2023-01-01 18:15:37 +00:00
Johan Malm
15781a394c layer: s/struct wlr_box/output->usable_area/
...because Linux kernel style prefers `sizeof(*foo)` over
`sizeof(struct foo)`.
2022-12-29 23:18:08 +01:00
Johan Malm
7037ea4e8f layer: rename signal-handler functions to handle_*
...rather than *_notify to comply with naming convention agreed on in
CONTRIBUTING.md
2022-12-29 23:18:08 +01:00
Johan Malm
349a38e676 layer: get struct output from wlr_output user-data
...rather than output_from_wlr_output()
2022-12-29 23:18:08 +01:00
Johan Malm
73df50a1c8 layer: s/layers_above_shell/layers_above_views/ 2022-12-29 23:18:08 +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
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
Johan Malm
e45e2c7e60 Fix coding style 2022-11-03 23:01:52 +01:00
Consolatis
89ad0b808f s/wl_list_insert(list.prev...)/wl_list_append(list...)/ 2022-10-05 19:50:36 +01:00
John Lindgren
a54d378e6c common: Add znew/znew_n() macros 2022-09-18 15:25:19 -04:00
John Lindgren
cb40cdc36c common: Add additional memory utilities (xzalloc() etc.) 2022-09-17 10:57:30 -04:00
John Lindgren
b8c3fdaef9 seat: Listen for destroy signal of pressed.surface 2022-09-13 15:57:20 -04:00
John Lindgren
7c6c018f43 cursor: Fix out-of-surface movement for unmanaged surfaces 2022-09-02 05:12:34 +02:00
Consolatis
921c877f79 src/cursor.c: Keep sending motion events for out-of-layer-surface
Previously, motion events for a cursor which had been pressed on a surface
and then moved out of the surface were only sent for XDG and X11 surfaces.

This patch includes layer surfaces as well.

Fixes #483
2022-08-16 19:31:16 +01:00
Consolatis
992089e901 src/layers.c: Prevent re-arranging views if usable_area didn't change 2022-07-02 12:43:23 +01:00
Consolatis
f4aa6118e9 src/layers.c: Adjust views based on usable_area changes 2022-06-30 20:41:54 +01:00
Consus
ef3dbbf29a Fix usable area calculation
Currently if a surface with exclusive zone is created prior to regular
surfaces, the size of the exclusize zone does not affect the usable area
for regular surfaces. This for example results in notifications being
rendered over the statusbar.

This commit fixes the issue by handling the surfaces with exclusive
zones first.

Fixes #420.
2022-06-28 21:38:42 +01:00
Consolatis
5f38d5ec55 src/layers.c: Update output for popup after forced move
Fixes #369
2022-06-17 06:08:06 +01:00
Consolatis
08518513cc Chase wlroots: scene_node.state is now inlined
Chases wlroots cb2dbc327e4d695c2a60a386e116a7dc20b29107
wlr_scene: Inline wlr_scene_node_state
2022-06-07 07:13:37 +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
bb2a98645b layer: handle output_destroy.notify without crash
Steps to reproduce crash:
- run nested with two outputs (e.g. WLR_WL_OUTPUTS=2 ./build/labwc)
- start panel on one output (e.g. waybar)
- close that output

Backtrace pointed to output_destroy_notify() at ../src/layers.c:92

Reported-by: @Consolatis
2022-04-24 22:24:47 +01:00
Johan Malm
801a04a647 layers: always unmap on destroy
This sets seat->focused_layer to NULL if appropriate.
2022-03-07 20:54:22 +00:00
Johan Malm
852a6f02fa layers: fix layer_popup_tree implementation 2022-03-06 16:48:39 +00:00
Johan Malm
6fd400b493 layers: put popups in separate node-tree
This allows popups to be rendered above views and other layers. Without
this, the popups of a layer-shell application in the bottom layer would
render below views, which does not seem right. For example, consider the
case of a panel with right-click popups.
2022-03-03 17:56:38 +00:00
Johan Malm
34bd1fb6da layers: unconstrain popups correctly
...to show popups when using @Consolatis's example panel

https://github.com/Consolatis/wl_framework
2022-03-03 17:53:26 +00:00
Johan Malm
30298228e3 Rename node-descriptor.c to node.c
...in anticipation of adding helpers like node_view_from_node()
2022-03-02 21:07:04 +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
99361d6ad8 layers.c: fix coding style 2022-03-02 20:23:20 +00:00
Johan Malm
a1d93cc97c layers: position each layer_tree correctly relative to its output 2022-03-02 20:21:57 +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
6488b933fa layers.c: set output->usable_area 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
5747ede20d layers: fix clang warning
...for unused variables.

We should damage the surface really, but this will soon be
overtaken by events when wlr_scene is implemented.
2021-11-13 21:36:33 +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
ebb632419b *.c: add SPDX-License-Identifier 2021-09-24 21:45:48 +01:00
Johan Malm
329ca691da layer-shell: chase wlr_layer_surface refactor 2021-09-24 20:51:12 +01:00
Johan Malm
cce3c8cda0 src/: fix coding style 2021-09-21 22:05:56 +01:00