diff options
author | xdavidwu <xdavidwuph@gmail.com> | 2019-08-31 20:25:58 +0800 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-08-31 23:13:12 +0900 |
commit | 07d7af593d89e56cad664fe03673ccb79da21380 (patch) | |
tree | 962021b0639a1d72c7b145e263e12ab780facd23 | |
parent | seat: avoid unneeded reloading xcursor theme (diff) | |
download | sway-07d7af593d89e56cad664fe03673ccb79da21380.tar.gz sway-07d7af593d89e56cad664fe03673ccb79da21380.tar.zst sway-07d7af593d89e56cad664fe03673ccb79da21380.zip |
seat: set cursor image only if no pointer cap previously
This make seat_update_capabilities set cursor image only if
there was no pointer cap before update. This avoid resetting
cursor to left_ptr if an input device is removed.
-rw-r--r-- | sway/input/seat.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c index 6a899124..4da8e937 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -516,6 +516,7 @@ struct sway_seat *seat_create(const char *seat_name) { | |||
516 | 516 | ||
517 | static void seat_update_capabilities(struct sway_seat *seat) { | 517 | static void seat_update_capabilities(struct sway_seat *seat) { |
518 | uint32_t caps = 0; | 518 | uint32_t caps = 0; |
519 | uint32_t previous_caps = seat->wlr_seat->capabilities; | ||
519 | struct sway_seat_device *seat_device; | 520 | struct sway_seat_device *seat_device; |
520 | wl_list_for_each(seat_device, &seat->devices, link) { | 521 | wl_list_for_each(seat_device, &seat->devices, link) { |
521 | switch (seat_device->input_device->wlr_device->type) { | 522 | switch (seat_device->input_device->wlr_device->type) { |
@@ -545,7 +546,9 @@ static void seat_update_capabilities(struct sway_seat *seat) { | |||
545 | wlr_seat_set_capabilities(seat->wlr_seat, caps); | 546 | wlr_seat_set_capabilities(seat->wlr_seat, caps); |
546 | } else { | 547 | } else { |
547 | wlr_seat_set_capabilities(seat->wlr_seat, caps); | 548 | wlr_seat_set_capabilities(seat->wlr_seat, caps); |
548 | cursor_set_image(seat->cursor, "left_ptr", NULL); | 549 | if ((previous_caps & WL_SEAT_CAPABILITY_POINTER) == 0) { |
550 | cursor_set_image(seat->cursor, "left_ptr", NULL); | ||
551 | } | ||
549 | } | 552 | } |
550 | } | 553 | } |
551 | 554 | ||