diff options
author | Simon Ser <contact@emersion.fr> | 2023-06-05 15:31:57 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2023-06-15 18:28:43 +0200 |
commit | da04b066ea037be0fdc5d79ac6b214fea6f2d3c5 (patch) | |
tree | 1480693c9f8224b8c3b38abd61dfd4da102b882c /include | |
parent | 58a2f8bd5cbff646905752f5ecc0fa92533496fc (diff) |
cursor: add wlr_cursor_set_xcursor()
This keeps track of the last set XCursor. If it hasn't changed,
skip the texture upload.
In the future, support for animated XCursors can be added.
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3436
Diffstat (limited to 'include')
-rw-r--r-- | include/wlr/types/wlr_cursor.h | 9 | ||||
-rw-r--r-- | include/wlr/types/wlr_xcursor_manager.h | 2 |
2 files changed, 11 insertions, 0 deletions
diff --git a/include/wlr/types/wlr_cursor.h b/include/wlr/types/wlr_cursor.h index 06ae2f1f..f3c7e970 100644 --- a/include/wlr/types/wlr_cursor.h +++ b/include/wlr/types/wlr_cursor.h @@ -14,6 +14,7 @@ #include <wlr/types/wlr_output.h> struct wlr_input_device; +struct wlr_xcursor_manager; /** * wlr_cursor implements the behavior of the "cursor", that is, the image on the @@ -147,6 +148,14 @@ void wlr_cursor_set_image(struct wlr_cursor *cur, const uint8_t *pixels, int32_t hotspot_y, float scale); /** + * Set the cursor image from an XCursor theme. + * + * The image will be loaded from the struct wlr_xcursor_manager. + */ +void wlr_cursor_set_xcursor(struct wlr_cursor *cur, + struct wlr_xcursor_manager *manager, const char *name); + +/** * Set the cursor surface. The surface can be committed to update the cursor * image. The surface position is subtracted from the hotspot. A NULL surface * commit hides the cursor. diff --git a/include/wlr/types/wlr_xcursor_manager.h b/include/wlr/types/wlr_xcursor_manager.h index f7781ca6..7d7b19ab 100644 --- a/include/wlr/types/wlr_xcursor_manager.h +++ b/include/wlr/types/wlr_xcursor_manager.h @@ -62,6 +62,8 @@ struct wlr_xcursor *wlr_xcursor_manager_get_xcursor( * scale factors. struct wlr_cursor will take over from this point and ensure * the correct cursor is used on each output, assuming a * struct wlr_output_layout is attached to it. + * + * Deprecated: wlr_cursor_set_xcursor() should be used instead. */ void wlr_xcursor_manager_set_cursor_image(struct wlr_xcursor_manager *manager, const char *name, struct wlr_cursor *cursor); |