mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
layer: do not focus on-demand clients in commit-handler
...because we should only try to focus them as part of normal input handling semantics, for example when receiving a cursor-button-press.
This commit is contained in:
parent
e67e8d6ed0
commit
6990ff713b
1 changed files with 26 additions and 0 deletions
26
src/layers.c
26
src/layers.c
|
|
@ -228,6 +228,13 @@ layer_try_set_focus(struct seat *seat, struct wlr_layer_surface_v1 *layer_surfac
|
|||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
is_on_demand(struct wlr_layer_surface_v1 *layer_surface)
|
||||
{
|
||||
return layer_surface->current.keyboard_interactive ==
|
||||
ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND;
|
||||
}
|
||||
|
||||
static void
|
||||
handle_surface_commit(struct wl_listener *listener, void *data)
|
||||
{
|
||||
|
|
@ -252,9 +259,28 @@ handle_surface_commit(struct wl_listener *listener, void *data)
|
|||
}
|
||||
/* Process keyboard-interactivity change */
|
||||
if (committed & WLR_LAYER_SURFACE_V1_STATE_KEYBOARD_INTERACTIVITY) {
|
||||
/*
|
||||
* On-demand interactivity should only be honoured through
|
||||
* normal focus semantics (for example by surface receiving
|
||||
* cursor-button-press).
|
||||
*/
|
||||
if (is_on_demand(layer_surface)) {
|
||||
struct seat *seat = &layer->server->seat;
|
||||
if (seat->focused_layer == layer_surface) {
|
||||
/*
|
||||
* Must be change from EXCLUSIVE to ON_DEMAND,
|
||||
* so we should give us focus.
|
||||
*/
|
||||
struct server *server = layer->server;
|
||||
try_to_focus_next_layer_or_toplevel(server);
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
/* Handle EXCLUSIVE and NONE requests */
|
||||
struct seat *seat = &layer->server->seat;
|
||||
layer_try_set_focus(seat, layer_surface);
|
||||
}
|
||||
out:
|
||||
|
||||
if (committed || layer->mapped != layer_surface->surface->mapped) {
|
||||
layer->mapped = layer_surface->surface->mapped;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue