diff options
author | Brian Ashworth <bosrsf04@gmail.com> | 2018-12-27 00:32:15 -0500 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2018-12-30 14:17:24 +0100 |
commit | 4d88c957905e7f6b2c8188d218ca22b3e6986fe4 (patch) | |
tree | 5f34ad1667607315cfbcb786ce71845a36595d82 /sway/input/cursor.c | |
parent | Verify seat fallback settings on reload (diff) | |
download | sway-4d88c957905e7f6b2c8188d218ca22b3e6986fe4.tar.gz sway-4d88c957905e7f6b2c8188d218ca22b3e6986fe4.tar.zst sway-4d88c957905e7f6b2c8188d218ca22b3e6986fe4.zip |
hide_cursor: change to a seat subcommand
This makes hide_cursor a seat subcommand, which allows for seat specific
timeouts.
Diffstat (limited to 'sway/input/cursor.c')
-rw-r--r-- | sway/input/cursor.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 22c5b075..f8302ddf 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c | |||
@@ -597,9 +597,17 @@ static int hide_notify(void *data) { | |||
597 | return 1; | 597 | return 1; |
598 | } | 598 | } |
599 | 599 | ||
600 | static void handle_activity(struct sway_cursor *cursor) { | 600 | void cursor_handle_activity(struct sway_cursor *cursor) { |
601 | wl_event_source_timer_update(cursor->hide_source, | 601 | struct seat_config *sc = seat_get_config(cursor->seat); |
602 | config->hide_cursor_timeout); | 602 | if (!sc) { |
603 | sc = seat_get_config_by_name("*"); | ||
604 | } | ||
605 | int timeout = sc ? sc->hide_cursor_timeout : 0; | ||
606 | if (timeout < 0) { | ||
607 | timeout = 0; | ||
608 | } | ||
609 | wl_event_source_timer_update(cursor->hide_source, timeout); | ||
610 | |||
603 | wlr_idle_notify_activity(server.idle, cursor->seat->wlr_seat); | 611 | wlr_idle_notify_activity(server.idle, cursor->seat->wlr_seat); |
604 | if (cursor->hidden) { | 612 | if (cursor->hidden) { |
605 | cursor->hidden = false; | 613 | cursor->hidden = false; |
@@ -709,7 +717,7 @@ static void handle_cursor_motion(struct wl_listener *listener, void *data) { | |||
709 | wlr_cursor_move(cursor->cursor, event->device, | 717 | wlr_cursor_move(cursor->cursor, event->device, |
710 | event->delta_x, event->delta_y); | 718 | event->delta_x, event->delta_y); |
711 | cursor_send_pointer_motion(cursor, event->time_msec); | 719 | cursor_send_pointer_motion(cursor, event->time_msec); |
712 | handle_activity(cursor); | 720 | cursor_handle_activity(cursor); |
713 | transaction_commit_dirty(); | 721 | transaction_commit_dirty(); |
714 | } | 722 | } |
715 | 723 | ||
@@ -720,7 +728,7 @@ static void handle_cursor_motion_absolute( | |||
720 | struct wlr_event_pointer_motion_absolute *event = data; | 728 | struct wlr_event_pointer_motion_absolute *event = data; |
721 | wlr_cursor_warp_absolute(cursor->cursor, event->device, event->x, event->y); | 729 | wlr_cursor_warp_absolute(cursor->cursor, event->device, event->x, event->y); |
722 | cursor_send_pointer_motion(cursor, event->time_msec); | 730 | cursor_send_pointer_motion(cursor, event->time_msec); |
723 | handle_activity(cursor); | 731 | cursor_handle_activity(cursor); |
724 | transaction_commit_dirty(); | 732 | transaction_commit_dirty(); |
725 | } | 733 | } |
726 | 734 | ||
@@ -1009,7 +1017,7 @@ static void handle_cursor_button(struct wl_listener *listener, void *data) { | |||
1009 | struct wlr_event_pointer_button *event = data; | 1017 | struct wlr_event_pointer_button *event = data; |
1010 | dispatch_cursor_button(cursor, event->device, | 1018 | dispatch_cursor_button(cursor, event->device, |
1011 | event->time_msec, event->button, event->state); | 1019 | event->time_msec, event->button, event->state); |
1012 | handle_activity(cursor); | 1020 | cursor_handle_activity(cursor); |
1013 | transaction_commit_dirty(); | 1021 | transaction_commit_dirty(); |
1014 | } | 1022 | } |
1015 | 1023 | ||
@@ -1119,7 +1127,7 @@ static void handle_cursor_axis(struct wl_listener *listener, void *data) { | |||
1119 | struct sway_cursor *cursor = wl_container_of(listener, cursor, axis); | 1127 | struct sway_cursor *cursor = wl_container_of(listener, cursor, axis); |
1120 | struct wlr_event_pointer_axis *event = data; | 1128 | struct wlr_event_pointer_axis *event = data; |
1121 | dispatch_cursor_axis(cursor, event); | 1129 | dispatch_cursor_axis(cursor, event); |
1122 | handle_activity(cursor); | 1130 | cursor_handle_activity(cursor); |
1123 | transaction_commit_dirty(); | 1131 | transaction_commit_dirty(); |
1124 | } | 1132 | } |
1125 | 1133 | ||