mirror of
https://github.com/swaywm/sway.git
synced 2026-04-22 06:46:27 -04:00
input/tablet: add seatop_down entry for tablet input
Currently, when tablet input exits a window during an implicit grab, it passes focus to another window. For instance, this is problematic when trying to drag a scrollbar, and exiting the window — the scrollbar motion stops. Additionally, without `focus_follows_mouse no`, the tablet passes focus to whatever surface it goes over regardless of if there is an active implicit. If the tablet is over a surface that does not bind tablet handlers, sway will fall back to pointer emulation, and all of this works fine. It probably should have consistent behavior between emulated and not-emulated input, though. This commit adds a condition for entering seatop_down when a tablet's tool tip goes down, and exiting when it goes up. Since events won't be routed through seatop_default, this prevents windows losing focus during implicit grabs. Closes #5302.
This commit is contained in:
parent
c632d47bf8
commit
5d13f647f9
5 changed files with 73 additions and 1 deletions
|
|
@ -198,6 +198,25 @@ static void state_add_button(struct seatop_default_event *e, uint32_t button) {
|
|||
* Functions used by handle_button /
|
||||
*--------------------------------*/
|
||||
|
||||
static void handle_tablet_tool_tip(struct sway_seat *seat,
|
||||
struct sway_tablet_tool *tool, uint32_t time_msec,
|
||||
enum wlr_tablet_tool_tip_state state) {
|
||||
if (state != WLR_TABLET_TOOL_TIP_DOWN) {
|
||||
return;
|
||||
}
|
||||
|
||||
struct sway_cursor *cursor = seat->cursor;
|
||||
|
||||
struct wlr_surface *surface = NULL;
|
||||
double sx, sy;
|
||||
struct sway_node *node = node_at_coords(seat,
|
||||
cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy);
|
||||
|
||||
if (surface && node && node->type == N_CONTAINER) {
|
||||
seatop_begin_down(seat, node->sway_container, time_msec, sx, sy);
|
||||
}
|
||||
}
|
||||
|
||||
static void handle_button(struct sway_seat *seat, uint32_t time_msec,
|
||||
struct wlr_input_device *device, uint32_t button,
|
||||
enum wlr_button_state state) {
|
||||
|
|
@ -649,6 +668,7 @@ static const struct sway_seatop_impl seatop_impl = {
|
|||
.button = handle_button,
|
||||
.pointer_motion = handle_pointer_motion,
|
||||
.pointer_axis = handle_pointer_axis,
|
||||
.tablet_tool_tip = handle_tablet_tool_tip,
|
||||
.tablet_tool_motion = handle_tablet_tool_motion,
|
||||
.rebase = handle_rebase,
|
||||
.allow_set_cursor = true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue