aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/cursor.c
diff options
context:
space:
mode:
authorLibravatar Ian Fan <ianfan0@gmail.com>2018-09-24 12:29:47 +0100
committerLibravatar Ian Fan <ianfan0@gmail.com>2018-09-24 12:34:09 +0100
commita10fef9ae8ca66ad98fb837f163f5c3bbe19d0b9 (patch)
treef3a72db45939b53815022735f1a0c7231ef79330 /sway/input/cursor.c
parentseat: only show cursor if pointer configured (diff)
downloadsway-a10fef9ae8ca66ad98fb837f163f5c3bbe19d0b9.tar.gz
sway-a10fef9ae8ca66ad98fb837f163f5c3bbe19d0b9.tar.zst
sway-a10fef9ae8ca66ad98fb837f163f5c3bbe19d0b9.zip
cursor: allow cursor_set_image to accept a NULL image to hide cursor
Diffstat (limited to 'sway/input/cursor.c')
-rw-r--r--sway/input/cursor.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index 5111e8e5..8c9f65ab 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -1006,8 +1006,7 @@ static void handle_touch_down(struct wl_listener *listener, void *data) {
1006 if (seat_is_input_allowed(seat, surface)) { 1006 if (seat_is_input_allowed(seat, surface)) {
1007 wlr_seat_touch_notify_down(wlr_seat, surface, event->time_msec, 1007 wlr_seat_touch_notify_down(wlr_seat, surface, event->time_msec,
1008 event->touch_id, sx, sy); 1008 event->touch_id, sx, sy);
1009 cursor->image_client = NULL; 1009 cursor_set_image(cursor, NULL, NULL);
1010 wlr_cursor_set_image(cursor->cursor, NULL, 0, 0, 0, 0, 0, 0);
1011 } 1010 }
1012} 1011}
1013 1012
@@ -1175,11 +1174,13 @@ static void handle_request_set_cursor(struct wl_listener *listener,
1175 1174
1176void cursor_set_image(struct sway_cursor *cursor, const char *image, 1175void cursor_set_image(struct sway_cursor *cursor, const char *image,
1177 struct wl_client *client) { 1176 struct wl_client *client) {
1178 if (!cursor->image || strcmp(cursor->image, image) != 0) { 1177 if (!image) {
1178 wlr_cursor_set_image(cursor->cursor, NULL, 0, 0, 0, 0, 0, 0);
1179 } else if (!cursor->image || strcmp(cursor->image, image) != 0) {
1179 wlr_xcursor_manager_set_cursor_image(cursor->xcursor_manager, image, 1180 wlr_xcursor_manager_set_cursor_image(cursor->xcursor_manager, image,
1180 cursor->cursor); 1181 cursor->cursor);
1181 cursor->image = image;
1182 } 1182 }
1183 cursor->image = image;
1183 cursor->image_client = client; 1184 cursor->image_client = client;
1184} 1185}
1185 1186