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, | |||
306 | 306 | ||
307 | enum sway_input_idle_source idle_source = idle_source_from_device(device); | 307 | enum sway_input_idle_source idle_source = idle_source_from_device(device); |
308 | seat_idle_notify_activity(cursor->seat, idle_source); | 308 | seat_idle_notify_activity(cursor->seat, idle_source); |
309 | if (cursor->hidden && idle_source != IDLE_SOURCE_TOUCH) { | 309 | if (idle_source != IDLE_SOURCE_TOUCH) { |
310 | cursor_unhide(cursor); | 310 | cursor_unhide(cursor); |
311 | } | 311 | } |
312 | } | 312 | } |
313 | 313 | ||
314 | void cursor_unhide(struct sway_cursor *cursor) { | 314 | void cursor_unhide(struct sway_cursor *cursor) { |
315 | if (!cursor->hidden) { | ||
316 | return; | ||
317 | } | ||
318 | |||
315 | cursor->hidden = false; | 319 | cursor->hidden = false; |
316 | if (cursor->image_surface) { | 320 | if (cursor->image_surface) { |
317 | cursor_set_image_surface(cursor, | 321 | cursor_set_image_surface(cursor, |
@@ -1141,18 +1145,19 @@ struct sway_cursor *sway_cursor_create(struct sway_seat *seat) { | |||
1141 | 1145 | ||
1142 | /** | 1146 | /** |
1143 | * Warps the cursor to the middle of the container argument. | 1147 | * Warps the cursor to the middle of the container argument. |
1144 | * Does nothing if the cursor is already inside the container. | 1148 | * Does nothing if the cursor is already inside the container and `force` is |
1145 | * If container is NULL, returns without doing anything. | 1149 | * false. If container is NULL, returns without doing anything. |
1146 | */ | 1150 | */ |
1147 | void cursor_warp_to_container(struct sway_cursor *cursor, | 1151 | void cursor_warp_to_container(struct sway_cursor *cursor, |
1148 | struct sway_container *container) { | 1152 | struct sway_container *container, bool force) { |
1149 | if (!container) { | 1153 | if (!container) { |
1150 | return; | 1154 | return; |
1151 | } | 1155 | } |
1152 | 1156 | ||
1153 | struct wlr_box box; | 1157 | struct wlr_box box; |
1154 | container_get_box(container, &box); | 1158 | container_get_box(container, &box); |
1155 | if (wlr_box_contains_point(&box, cursor->cursor->x, cursor->cursor->y)) { | 1159 | if (!force && wlr_box_contains_point(&box, cursor->cursor->x, |
1160 | cursor->cursor->y)) { | ||
1156 | return; | 1161 | return; |
1157 | } | 1162 | } |
1158 | 1163 | ||
@@ -1160,6 +1165,7 @@ void cursor_warp_to_container(struct sway_cursor *cursor, | |||
1160 | double y = container->y + container->height / 2.0; | 1165 | double y = container->y + container->height / 2.0; |
1161 | 1166 | ||
1162 | wlr_cursor_warp(cursor->cursor, NULL, x, y); | 1167 | wlr_cursor_warp(cursor->cursor, NULL, x, y); |
1168 | cursor_unhide(cursor); | ||
1163 | } | 1169 | } |
1164 | 1170 | ||
1165 | /** | 1171 | /** |
@@ -1176,6 +1182,7 @@ void cursor_warp_to_workspace(struct sway_cursor *cursor, | |||
1176 | double y = workspace->y + workspace->height / 2.0; | 1182 | double y = workspace->y + workspace->height / 2.0; |
1177 | 1183 | ||
1178 | wlr_cursor_warp(cursor->cursor, NULL, x, y); | 1184 | wlr_cursor_warp(cursor->cursor, NULL, x, y); |
1185 | cursor_unhide(cursor); | ||
1179 | } | 1186 | } |
1180 | 1187 | ||
1181 | uint32_t get_mouse_bindsym(const char *name, char **error) { | 1188 | 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) { | |||
1477 | } | 1477 | } |
1478 | 1478 | ||
1479 | if (focus->type == N_CONTAINER) { | 1479 | if (focus->type == N_CONTAINER) { |
1480 | cursor_warp_to_container(seat->cursor, focus->sway_container); | 1480 | cursor_warp_to_container(seat->cursor, focus->sway_container, false); |
1481 | } else { | 1481 | } else { |
1482 | cursor_warp_to_workspace(seat->cursor, focus->sway_workspace); | 1482 | cursor_warp_to_workspace(seat->cursor, focus->sway_workspace); |
1483 | } | 1483 | } |
1484 | if (seat->cursor->hidden){ | ||
1485 | cursor_unhide(seat->cursor); | ||
1486 | } | ||
1487 | } | 1484 | } |
1488 | 1485 | ||
1489 | void seatop_unref(struct sway_seat *seat, struct sway_container *con) { | 1486 | void seatop_unref(struct sway_seat *seat, struct sway_container *con) { |