2018-07-13 14:40:56 +02:00
|
|
|
/*
|
|
|
|
* This an unstable interface of wlroots. No guarantees are made regarding the
|
|
|
|
* future consistency of this API.
|
|
|
|
*/
|
|
|
|
#ifndef WLR_USE_UNSTABLE
|
|
|
|
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
|
|
|
|
#endif
|
|
|
|
|
2017-11-12 11:10:56 +01:00
|
|
|
#ifndef WLR_TYPES_WLR_XCURSOR_MANAGER_H
|
|
|
|
#define WLR_TYPES_WLR_XCURSOR_MANAGER_H
|
|
|
|
|
2019-07-27 10:53:54 +02:00
|
|
|
#include <wayland-server-core.h>
|
2017-11-12 11:10:56 +01:00
|
|
|
#include <wlr/types/wlr_cursor.h>
|
|
|
|
#include <wlr/xcursor.h>
|
|
|
|
|
|
|
|
/**
|
2018-02-02 02:30:18 +01:00
|
|
|
* An XCursor theme at a particular scale factor of the base size.
|
2017-11-12 11:10:56 +01:00
|
|
|
*/
|
|
|
|
struct wlr_xcursor_manager_theme {
|
2017-12-15 01:00:03 +01:00
|
|
|
float scale;
|
2017-11-12 11:10:56 +01:00
|
|
|
struct wlr_xcursor_theme *theme;
|
|
|
|
struct wl_list link;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2022-05-24 18:46:59 +02:00
|
|
|
* struct wlr_xcursor_manager dynamically loads xcursor themes at sizes necessary
|
|
|
|
* for use on outputs at arbitrary scale factors. You should call
|
|
|
|
* wlr_xcursor_manager_load() for each output you will show your cursor on, with
|
2018-02-02 02:30:18 +01:00
|
|
|
* the scale factor parameter set to that output's scale factor.
|
2017-11-12 11:10:56 +01:00
|
|
|
*/
|
|
|
|
struct wlr_xcursor_manager {
|
|
|
|
char *name;
|
|
|
|
uint32_t size;
|
|
|
|
struct wl_list scaled_themes; // wlr_xcursor_manager_theme::link
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2018-02-02 02:30:18 +01:00
|
|
|
* Creates a new XCursor manager with the given xcursor theme name and base size
|
|
|
|
* (for use when scale=1).
|
2017-11-12 11:10:56 +01:00
|
|
|
*/
|
|
|
|
struct wlr_xcursor_manager *wlr_xcursor_manager_create(const char *name,
|
|
|
|
uint32_t size);
|
|
|
|
|
|
|
|
void wlr_xcursor_manager_destroy(struct wlr_xcursor_manager *manager);
|
|
|
|
|
2018-02-02 02:30:18 +01:00
|
|
|
/**
|
|
|
|
* Ensures an xcursor theme at the given scale factor is loaded in the manager.
|
|
|
|
*/
|
2020-05-14 17:45:42 +02:00
|
|
|
bool wlr_xcursor_manager_load(struct wlr_xcursor_manager *manager,
|
2017-12-15 01:00:03 +01:00
|
|
|
float scale);
|
2017-11-12 11:10:56 +01:00
|
|
|
|
2018-02-02 02:30:18 +01:00
|
|
|
/**
|
|
|
|
* Retrieves a wlr_xcursor reference for the given cursor name at the given
|
2022-05-24 18:46:59 +02:00
|
|
|
* scale factor, or NULL if this struct wlr_xcursor_manager has not loaded a
|
|
|
|
* cursor theme at the requested scale.
|
2018-02-02 02:30:18 +01:00
|
|
|
*/
|
2017-11-12 11:10:56 +01:00
|
|
|
struct wlr_xcursor *wlr_xcursor_manager_get_xcursor(
|
2017-12-15 01:00:03 +01:00
|
|
|
struct wlr_xcursor_manager *manager, const char *name, float scale);
|
2017-11-12 11:10:56 +01:00
|
|
|
|
|
|
|
/**
|
2022-05-24 18:46:59 +02:00
|
|
|
* Set a struct wlr_cursor's cursor image to the specified cursor name for all
|
|
|
|
* 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.
|
2017-11-12 11:10:56 +01:00
|
|
|
*/
|
|
|
|
void wlr_xcursor_manager_set_cursor_image(struct wlr_xcursor_manager *manager,
|
|
|
|
const char *name, struct wlr_cursor *cursor);
|
|
|
|
|
|
|
|
#endif
|