From 220402b717951d3bdcce79783319eef6bbee9da4 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 15 Jun 2023 18:40:33 +0200 Subject: [PATCH] cursor: add wlr_cursor_unset_image() It's pretty awkward to call wlr_cursor_set_image() with 6 zeroes. Hide that awkwardness in wlroots. --- include/wlr/types/wlr_cursor.h | 5 +++++ types/wlr_cursor.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/include/wlr/types/wlr_cursor.h b/include/wlr/types/wlr_cursor.h index f3c7e970..a4c2e731 100644 --- a/include/wlr/types/wlr_cursor.h +++ b/include/wlr/types/wlr_cursor.h @@ -147,6 +147,11 @@ void wlr_cursor_set_image(struct wlr_cursor *cur, const uint8_t *pixels, int32_t stride, uint32_t width, uint32_t height, int32_t hotspot_x, int32_t hotspot_y, float scale); +/** + * Hide the cursor image. + */ +void wlr_cursor_unset_image(struct wlr_cursor *cur); + /** * Set the cursor image from an XCursor theme. * diff --git a/types/wlr_cursor.c b/types/wlr_cursor.c index cce37e81..8b568e38 100644 --- a/types/wlr_cursor.c +++ b/types/wlr_cursor.c @@ -425,6 +425,10 @@ void wlr_cursor_set_image(struct wlr_cursor *cur, const uint8_t *pixels, } } +void wlr_cursor_unset_image(struct wlr_cursor *cur) { + wlr_cursor_set_image(cur, NULL, 0, 0, 0, 0, 0, 0); +} + void wlr_cursor_set_xcursor(struct wlr_cursor *cur, struct wlr_xcursor_manager *manager, const char *name) { struct wlr_cursor_output_cursor *output_cursor;