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 | |
parent | input/keyboard: wlr_keyboard_group enter and leave (diff) | |
download | sway-20deb8ec1696cba0da50165e3c128895e2f44cdf.tar.gz sway-20deb8ec1696cba0da50165e3c128895e2f44cdf.tar.zst sway-20deb8ec1696cba0da50165e3c128895e2f44cdf.zip |
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.
-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, | |||
220 | struct sway_container *cont = node && node->type == N_CONTAINER ? | 220 | struct sway_container *cont = node && node->type == N_CONTAINER ? |
221 | node->sway_container : NULL; | 221 | node->sway_container : NULL; |
222 | 222 | ||
223 | if (cont) { | 223 | if (wlr_surface_is_layer_surface(surface)) { |
224 | // Handle tapping a layer surface | ||
225 | struct wlr_layer_surface_v1 *layer = | ||
226 | wlr_layer_surface_v1_from_wlr_surface(surface); | ||
227 | if (layer->current.keyboard_interactive) { | ||
228 | seat_set_focus_layer(seat, layer); | ||
229 | } | ||
230 | } else if (cont) { | ||
224 | bool is_floating_or_child = container_is_floating_or_child(cont); | 231 | bool is_floating_or_child = container_is_floating_or_child(cont); |
225 | bool is_fullscreen_or_child = container_is_fullscreen_or_child(cont); | 232 | bool is_fullscreen_or_child = container_is_fullscreen_or_child(cont); |
226 | struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat->wlr_seat); | 233 | 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, | |||
242 | return; | 249 | return; |
243 | } | 250 | } |
244 | 251 | ||
252 | // Handle tapping on a container surface | ||
253 | seat_set_focus_container(seat, cont); | ||
245 | seatop_begin_down(seat, node->sway_container, time_msec, sx, sy); | 254 | seatop_begin_down(seat, node->sway_container, time_msec, sx, sy); |
246 | } | 255 | } |
256 | #if HAVE_XWAYLAND | ||
257 | // Handle tapping on an xwayland unmanaged view | ||
258 | else if (wlr_surface_is_xwayland_surface(surface)) { | ||
259 | struct wlr_xwayland_surface *xsurface = | ||
260 | wlr_xwayland_surface_from_wlr_surface(surface); | ||
261 | if (xsurface->override_redirect && | ||
262 | wlr_xwayland_or_surface_wants_focus(xsurface)) { | ||
263 | struct wlr_xwayland *xwayland = server.xwayland.wlr_xwayland; | ||
264 | wlr_xwayland_set_seat(xwayland, seat->wlr_seat); | ||
265 | seat_set_focus_surface(seat, xsurface->surface, false); | ||
266 | } | ||
267 | } | ||
268 | #endif | ||
247 | 269 | ||
248 | wlr_tablet_v2_tablet_tool_notify_down(tool->tablet_v2_tool); | 270 | wlr_tablet_v2_tablet_tool_notify_down(tool->tablet_v2_tool); |
249 | wlr_tablet_tool_v2_start_implicit_grab(tool->tablet_v2_tool); | 271 | wlr_tablet_tool_v2_start_implicit_grab(tool->tablet_v2_tool); |