aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/cursor.c
diff options
context:
space:
mode:
authorLibravatar Rouven Czerwinski <rouven@czerwinskis.de>2019-01-07 13:19:47 +0100
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-01-07 10:30:19 -0500
commitfde900861af742f4078ace5720ddd5b02eeb0bac (patch)
treeac7ed6d556751f6871e328ef9ad7dedf7666063b /sway/input/cursor.c
parentMerge pull request #3381 from oscarwcl/swayidle-inhibit-sleep (diff)
downloadsway-fde900861af742f4078ace5720ddd5b02eeb0bac.tar.gz
sway-fde900861af742f4078ace5720ddd5b02eeb0bac.tar.zst
sway-fde900861af742f4078ace5720ddd5b02eeb0bac.zip
cursor: move unhide and timeout retrieval into separate functions
The unhide and timeout retrieval functions are needed in a later commit. No functional changes.
Diffstat (limited to 'sway/input/cursor.c')
-rw-r--r--sway/input/cursor.c35
1 files changed, 23 insertions, 12 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) {
621 return 1; 621 return 1;
622} 622}
623 623
624void cursor_handle_activity(struct sway_cursor *cursor) { 624int cursor_get_timeout(struct sway_cursor *cursor){
625 struct seat_config *sc = seat_get_config(cursor->seat); 625 struct seat_config *sc = seat_get_config(cursor->seat);
626 if (!sc) { 626 if (!sc) {
627 sc = seat_get_config_by_name("*"); 627 sc = seat_get_config_by_name("*");
@@ -630,20 +630,31 @@ void cursor_handle_activity(struct sway_cursor *cursor) {
630 if (timeout < 0) { 630 if (timeout < 0) {
631 timeout = 0; 631 timeout = 0;
632 } 632 }
633 wl_event_source_timer_update(cursor->hide_source, timeout); 633 return timeout;
634}
635
636void cursor_handle_activity(struct sway_cursor *cursor) {
637 wl_event_source_timer_update(
638 cursor->hide_source, cursor_get_timeout(cursor));
634 639
635 wlr_idle_notify_activity(server.idle, cursor->seat->wlr_seat); 640 wlr_idle_notify_activity(server.idle, cursor->seat->wlr_seat);
636 if (cursor->hidden) { 641 if (cursor->hidden) {
637 cursor->hidden = false; 642 cursor_unhide(cursor);
638 if (cursor->image_surface) { 643 }
639 cursor_set_image_surface(cursor, cursor->image_surface, 644}
640 cursor->hotspot_x, cursor->hotspot_y, 645
641 cursor->image_client); 646void cursor_unhide(struct sway_cursor *cursor) {
642 } else { 647 cursor->hidden = false;
643 const char *image = cursor->image; 648 if (cursor->image_surface) {
644 cursor->image = NULL; 649 cursor_set_image_surface(cursor,
645 cursor_set_image(cursor, image, cursor->image_client); 650 cursor->image_surface,
646 } 651 cursor->hotspot_x,
652 cursor->hotspot_y,
653 cursor->image_client);
654 } else {
655 const char *image = cursor->image;
656 cursor->image = NULL;
657 cursor_set_image(cursor, image, cursor->image_client);
647 } 658 }
648} 659}
649 660