...and on unmap.
Add `try_to_focus_next_layer_or_toplevel()` which does the following
(in order of precedence):
- Give focus to last added overlay/top layer-shell client with exclusive
interactivity on the output nearest the pointer (normally the one where
the users is currently working). The reason for not considering clients
on all outputs is that giving focus to a client on another output may be
confusing to the user.
- Give focus to topmost toplevel if one exists (this was done previously
anyway).
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.
Need to handle new unified mapping, where mapping is attached to the
wlr_surface objects instead of their parents. Also, most of them require
a new associate event for xsurface objects, their surface member will be
NULL before this event is received.
Refactored by jlindgren:
- add struct mappable
- unify map/unmap logic
- 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
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
...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
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
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.
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
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.