aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-08-05 03:23:16 -0400
committerLibravatar Drew DeVault <sir@cmpwn.com>2019-08-06 11:31:12 +0900
commit56b5ad777cd033fe96af0cec7e89c21af766e8a4 (patch)
tree6394aca59aaa99424fe5d9a986b063afb6451ad6
parentcmd_swap: add floating support (diff)
downloadsway-56b5ad777cd033fe96af0cec7e89c21af766e8a4.tar.gz
sway-56b5ad777cd033fe96af0cec7e89c21af766e8a4.tar.zst
sway-56b5ad777cd033fe96af0cec7e89c21af766e8a4.zip
input/cursor: do not hide when buttons are pressed
This just adds a small quality of life improvement to the cursor hiding functionality. The cursor will no longer be hidden unless all buttons are released.
-rw-r--r--sway/input/cursor.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index 26e60cde..5739aafb 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -186,7 +186,12 @@ static int hide_notify(void *data) {
186 return 1; 186 return 1;
187} 187}
188 188
189int cursor_get_timeout(struct sway_cursor *cursor){ 189int cursor_get_timeout(struct sway_cursor *cursor) {
190 if (cursor->pressed_button_count > 0) {
191 // Do not hide cursor unless all buttons are released
192 return 0;
193 }
194
190 struct seat_config *sc = seat_get_config(cursor->seat); 195 struct seat_config *sc = seat_get_config(cursor->seat);
191 if (!sc) { 196 if (!sc) {
192 sc = seat_get_config_by_name("*"); 197 sc = seat_get_config_by_name("*");
@@ -299,7 +304,6 @@ void dispatch_cursor_button(struct sway_cursor *cursor,
299static void handle_cursor_button(struct wl_listener *listener, void *data) { 304static void handle_cursor_button(struct wl_listener *listener, void *data) {
300 struct sway_cursor *cursor = wl_container_of(listener, cursor, button); 305 struct sway_cursor *cursor = wl_container_of(listener, cursor, button);
301 struct wlr_event_pointer_button *event = data; 306 struct wlr_event_pointer_button *event = data;
302 cursor_handle_activity(cursor);
303 307
304 if (event->state == WLR_BUTTON_PRESSED) { 308 if (event->state == WLR_BUTTON_PRESSED) {
305 cursor->pressed_button_count++; 309 cursor->pressed_button_count++;
@@ -311,6 +315,7 @@ static void handle_cursor_button(struct wl_listener *listener, void *data) {
311 } 315 }
312 } 316 }
313 317
318 cursor_handle_activity(cursor);
314 dispatch_cursor_button(cursor, event->device, 319 dispatch_cursor_button(cursor, event->device,
315 event->time_msec, event->button, event->state); 320 event->time_msec, event->button, event->state);
316 transaction_commit_dirty(); 321 transaction_commit_dirty();