diff options
Diffstat (limited to 'sway/input')
-rw-r--r-- | sway/input/cursor.c | 35 | ||||
-rw-r--r-- | sway/input/input-manager.c | 2 | ||||
-rw-r--r-- | sway/input/seat.c | 4 |
3 files changed, 28 insertions, 13 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 66a9e435..510030ae 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -621,7 +621,7 @@ static int hide_notify(void *data) { return 1; } -void cursor_handle_activity(struct sway_cursor *cursor) { +int cursor_get_timeout(struct sway_cursor *cursor){ struct seat_config *sc = seat_get_config(cursor->seat); if (!sc) { sc = seat_get_config_by_name("*"); @@ -630,20 +630,31 @@ void cursor_handle_activity(struct sway_cursor *cursor) { if (timeout < 0) { timeout = 0; } - wl_event_source_timer_update(cursor->hide_source, timeout); + return timeout; +} + +void cursor_handle_activity(struct sway_cursor *cursor) { + wl_event_source_timer_update( + cursor->hide_source, cursor_get_timeout(cursor)); wlr_idle_notify_activity(server.idle, cursor->seat->wlr_seat); if (cursor->hidden) { - cursor->hidden = false; - if (cursor->image_surface) { - cursor_set_image_surface(cursor, cursor->image_surface, - cursor->hotspot_x, cursor->hotspot_y, - cursor->image_client); - } else { - const char *image = cursor->image; - cursor->image = NULL; - cursor_set_image(cursor, image, cursor->image_client); - } + cursor_unhide(cursor); + } +} + +void cursor_unhide(struct sway_cursor *cursor) { + cursor->hidden = false; + if (cursor->image_surface) { + cursor_set_image_surface(cursor, + cursor->image_surface, + cursor->hotspot_x, + cursor->hotspot_y, + cursor->image_client); + } else { + const char *image = cursor->image; + cursor->image = NULL; + cursor_set_image(cursor, image, cursor->image_client); } } diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c index 61087733..04e14355 100644 --- a/sway/input/input-manager.c +++ b/sway/input/input-manager.c @@ -49,7 +49,7 @@ char *input_device_get_identifier(struct wlr_input_device *device) { int vendor = device->vendor; int product = device->product; char *name = strdup(device->name); - name = strip_whitespace(name); + strip_whitespace(name); char *p = name; for (; *p; ++p) { diff --git a/sway/input/seat.c b/sway/input/seat.c index e8b2cdcf..41a3a4df 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -1237,4 +1237,8 @@ void seat_consider_warp_to_focus(struct sway_seat *seat) { } else { cursor_warp_to_workspace(seat->cursor, focus->sway_workspace); } + if (seat->cursor->hidden){ + cursor_unhide(seat->cursor); + wl_event_source_timer_update(seat->cursor->hide_source, cursor_get_timeout(seat->cursor)); + } } |