diff options
Diffstat (limited to 'sway/input')
-rw-r--r-- | sway/input/cursor.c | 17 | ||||
-rw-r--r-- | sway/input/seat.c | 5 |
2 files changed, 13 insertions, 9 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 9ad4900b..5c883924 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -306,12 +306,16 @@ void cursor_handle_activity(struct sway_cursor *cursor, enum sway_input_idle_source idle_source = idle_source_from_device(device); seat_idle_notify_activity(cursor->seat, idle_source); - if (cursor->hidden && idle_source != IDLE_SOURCE_TOUCH) { + if (idle_source != IDLE_SOURCE_TOUCH) { cursor_unhide(cursor); } } void cursor_unhide(struct sway_cursor *cursor) { + if (!cursor->hidden) { + return; + } + cursor->hidden = false; if (cursor->image_surface) { cursor_set_image_surface(cursor, @@ -1141,18 +1145,19 @@ struct sway_cursor *sway_cursor_create(struct sway_seat *seat) { /** * Warps the cursor to the middle of the container argument. - * Does nothing if the cursor is already inside the container. - * If container is NULL, returns without doing anything. + * Does nothing if the cursor is already inside the container and `force` is + * false. If container is NULL, returns without doing anything. */ void cursor_warp_to_container(struct sway_cursor *cursor, - struct sway_container *container) { + struct sway_container *container, bool force) { if (!container) { return; } struct wlr_box box; container_get_box(container, &box); - if (wlr_box_contains_point(&box, cursor->cursor->x, cursor->cursor->y)) { + if (!force && wlr_box_contains_point(&box, cursor->cursor->x, + cursor->cursor->y)) { return; } @@ -1160,6 +1165,7 @@ void cursor_warp_to_container(struct sway_cursor *cursor, double y = container->y + container->height / 2.0; wlr_cursor_warp(cursor->cursor, NULL, x, y); + cursor_unhide(cursor); } /** @@ -1176,6 +1182,7 @@ void cursor_warp_to_workspace(struct sway_cursor *cursor, double y = workspace->y + workspace->height / 2.0; wlr_cursor_warp(cursor->cursor, NULL, x, y); + cursor_unhide(cursor); } uint32_t get_mouse_bindsym(const char *name, char **error) { diff --git a/sway/input/seat.c b/sway/input/seat.c index e178c08a..24d7e903 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -1477,13 +1477,10 @@ void seat_consider_warp_to_focus(struct sway_seat *seat) { } if (focus->type == N_CONTAINER) { - cursor_warp_to_container(seat->cursor, focus->sway_container); + cursor_warp_to_container(seat->cursor, focus->sway_container, false); } else { cursor_warp_to_workspace(seat->cursor, focus->sway_workspace); } - if (seat->cursor->hidden){ - cursor_unhide(seat->cursor); - } } void seatop_unref(struct sway_seat *seat, struct sway_container *con) { |