diff options
author | Tudor Brindus <me@tbrindus.ca> | 2020-06-14 00:01:31 -0400 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2020-06-16 17:58:13 +0200 |
commit | 20deb8ec1696cba0da50165e3c128895e2f44cdf (patch) | |
tree | 2b7577493ab96a2531e4bdccb231f6de34f6e238 /sway/input | |
parent | 33aa59d4c6d4aaf907091f5fcc967b1f9b1a0fd8 (diff) |
input/tablet: focus appropriate node on tip down
This commit makes tablet input more usable when `focus_follows_mouse` is
set to `no`.
Previously, tapping down on surfaces that bound tablet input would not
switch focus, whereas tapping on surfaces that didn't (and hence went
through pointer emulation) did.
Diffstat (limited to 'sway/input')
-rw-r--r-- | sway/input/seatop_default.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/sway/input/seatop_default.c b/sway/input/seatop_default.c index 6e3c7744..50d618d8 100644 --- a/sway/input/seatop_default.c +++ b/sway/input/seatop_default.c @@ -220,7 +220,14 @@ static void handle_tablet_tool_tip(struct sway_seat *seat, struct sway_container *cont = node && node->type == N_CONTAINER ? node->sway_container : NULL; - if (cont) { + if (wlr_surface_is_layer_surface(surface)) { + // Handle tapping a layer surface + struct wlr_layer_surface_v1 *layer = + wlr_layer_surface_v1_from_wlr_surface(surface); + if (layer->current.keyboard_interactive) { + seat_set_focus_layer(seat, layer); + } + } else if (cont) { bool is_floating_or_child = container_is_floating_or_child(cont); bool is_fullscreen_or_child = container_is_fullscreen_or_child(cont); struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat->wlr_seat); @@ -242,8 +249,23 @@ static void handle_tablet_tool_tip(struct sway_seat *seat, return; } + // Handle tapping on a container surface + seat_set_focus_container(seat, cont); seatop_begin_down(seat, node->sway_container, time_msec, sx, sy); } +#if HAVE_XWAYLAND + // Handle tapping on an xwayland unmanaged view + else if (wlr_surface_is_xwayland_surface(surface)) { + struct wlr_xwayland_surface *xsurface = + wlr_xwayland_surface_from_wlr_surface(surface); + if (xsurface->override_redirect && + wlr_xwayland_or_surface_wants_focus(xsurface)) { + struct wlr_xwayland *xwayland = server.xwayland.wlr_xwayland; + wlr_xwayland_set_seat(xwayland, seat->wlr_seat); + seat_set_focus_surface(seat, xsurface->surface, false); + } + } +#endif wlr_tablet_v2_tablet_tool_notify_down(tool->tablet_v2_tool); wlr_tablet_tool_v2_start_implicit_grab(tool->tablet_v2_tool); |