cursor: use layer_try_set_focus() on press

This means that the logic described in 2ff026b will be used when a
layer-surface is pressed on with a cursor button. For example, a surface
with on-demand keyboard interactivity will not steal focus from a client
with exclusive keyboard interactivity.
This commit is contained in:
Johan Malm 2024-03-09 10:48:52 +00:00 committed by Johan Malm
parent 045dd8a378
commit 06bf71162e

View file

@ -18,6 +18,7 @@
#include "input/gestures.h"
#include "input/touch.h"
#include "labwc.h"
#include "layers.h"
#include "menu/menu.h"
#include "regions.h"
#include "resistance.h"
@ -970,14 +971,14 @@ cursor_button_press(struct seat *seat, uint32_t button,
struct wlr_layer_surface_v1 *layer =
wlr_layer_surface_v1_try_from_wlr_surface(ctx.surface);
if (layer && layer->current.keyboard_interactive) {
seat_set_focus_layer(seat, layer);
layer_try_set_focus(seat, layer);
}
} else if (ctx.type == LAB_SSD_LAYER_SUBSURFACE) {
wlr_log(WLR_DEBUG, "press on layer-subsurface");
struct wlr_layer_surface_v1 *layer =
subsurface_parent_layer(ctx.surface);
if (layer && layer->current.keyboard_interactive) {
seat_set_focus_layer(seat, layer);
layer_try_set_focus(seat, layer);
}
#ifdef HAVE_XWAYLAND
} else if (ctx.type == LAB_SSD_UNMANAGED) {