mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-15 06:59:43 -05:00
types/wlr_xcursor_manager: Add caching textures
This commit is contained in:
parent
2fcb2b95fc
commit
c5bd304795
5 changed files with 98 additions and 37 deletions
|
|
@ -13,6 +13,8 @@
|
|||
#include <wlr/types/wlr_cursor.h>
|
||||
#include <wlr/xcursor.h>
|
||||
|
||||
struct wlr_renderer;
|
||||
|
||||
/**
|
||||
* An XCursor theme at a particular scale factor of the base size.
|
||||
*/
|
||||
|
|
@ -32,6 +34,9 @@ struct wlr_xcursor_manager {
|
|||
char *name;
|
||||
uint32_t size;
|
||||
struct wl_list scaled_themes; // wlr_xcursor_manager_theme::link
|
||||
|
||||
struct wlr_renderer *renderer;
|
||||
struct wl_listener renderer_destroy;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -39,7 +44,7 @@ struct wlr_xcursor_manager {
|
|||
* (for use when scale=1).
|
||||
*/
|
||||
struct wlr_xcursor_manager *wlr_xcursor_manager_create(const char *name,
|
||||
uint32_t size);
|
||||
uint32_t size, struct wlr_renderer *renderer);
|
||||
|
||||
void wlr_xcursor_manager_destroy(struct wlr_xcursor_manager *manager);
|
||||
|
||||
|
|
@ -57,4 +62,20 @@ int wlr_xcursor_manager_load(struct wlr_xcursor_manager *manager,
|
|||
struct wlr_xcursor *wlr_xcursor_manager_get_xcursor(
|
||||
struct wlr_xcursor_manager *manager, const char *name, float scale);
|
||||
|
||||
/**
|
||||
* Retrieves the cached texture of this xcursor image from the
|
||||
* wlr_xcursor_manager.
|
||||
*
|
||||
* The wlr_xcursor_manager must have been created with a wlr_renderer and the
|
||||
* wlr_xcursor_image must have come from a wlr_xcursor returned from
|
||||
* wlr_xcursor_manager_get_xcursor.
|
||||
*
|
||||
* The returned texture is owned by the xcursor manager. You should not save or
|
||||
* destroy it.
|
||||
* The manager makes use of the wlr_xcursor_image.userdata field. You must not
|
||||
* modify this field yourself.
|
||||
*/
|
||||
struct wlr_texture *wlr_xcursor_manager_get_texture(
|
||||
struct wlr_xcursor_manager *manager, struct wlr_xcursor_image *image);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ struct wlr_xcursor_image {
|
|||
uint32_t hotspot_y; /* hot spot y (must be inside image) */
|
||||
uint32_t delay; /* animation delay to next frame (ms) */
|
||||
uint8_t *buffer;
|
||||
void *userdata;
|
||||
};
|
||||
|
||||
struct wlr_xcursor {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue