labwc/include/common/surface-helpers.h
Johan Malm a5fcbfaf72 cursor: process layer subsurfaces in cursor_button_press()
...to give keyboard focus to layer-shell clients if exclusive or on-demand
interactivity is set, so that menu popups can be navigated with the
keyboard. This still only works if the client is in top (or overlay)
layers. Support for bottom and background to be done as a separate patch
set.

Revert 06b19f0 to process layer-shell subsurfaces in
`cursor_button_press()`, but only when their parent layer-shell surface
has keyboard interactivity.

Fix bug in `get_cursor_context()` which resulted in layer-surfaces not
being detected correctly.

Background:

Commit 06b19f0 (issue #1131) disabled processing of layer-shell
subsurfaces in cursor_button_press() because when pressing a task in
Waybar (Gtk panel using layer-shell subsurfaces) the foreign-toplevel
minimize-raise action did not work correctly as the action logic relied on
the recipient window being activated and by clicking on the panel, the
panel itself was both surface-focusd and activated (and thus the window
de-activated).

The un-intended consequence was that by not responding to layer-subsurface
cursor buttons presses, layer-shell clients (such as panels) were not
given keyboard focus if they indeed wanted it by setting exclusive or
on-demand keyboard interactivity.

The good news is that that following @jlindgren90's refactoring (various)
the only place where we call `view_set_actived()` is in
`focus_change_notify()` in `seat.c` and we now only do it for views
(bb8f0bc).

Another side-effect (positive) of 06b19f0 was that a Waybar dnd bug was
fixed (pointer-serial-number validation failure).

Have tested with sfwbar, waybar and tint (test-panel) the following
results:
- Minimize-raise works even when on-demand keyboard interactivity is set
- Keyboard interactivity is given popup-menus (sfwbar and tint) when the
  panels are in the top layer (support for bottom will be as a separate
  patch set)
- Waybar dnd still works (even when hard-coding keyboard-interactivity)

References:
- bb8f0bc960
- 40ce95a68c/src/seat.c (L481-L483)
- 40ce95a68c/src/dnd.c (L24)
- https://github.com/johanmalm/tint

Fixes: #1572
2024-03-09 00:44:19 +01:00

16 lines
477 B
C

/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef LABWC_SURFACE_HELPERS_H
#define LABWC_SURFACE_HELPERS_H
struct wlr_surface;
struct wlr_layer_surface_v1;
/**
* subsurface_parent_layer() - Get wlr_layer_surface from layer-subsurface
* @wlr_surface: The wlr_surface of the wlr_subsurface for which to get the
* layer-surface.
*/
struct wlr_layer_surface_v1 *subsurface_parent_layer(
struct wlr_surface *wlr_surface);
#endif /* LABWC_SURFACE_HELPERS_H */