Make wlr_xcursor_manager_load() return a bool
This is currently inconsistent with the rest of the library and a bit of a footgun for new compositors. However, this breaks the API in a very unfortunate way for existing compositors.
This commit is contained in:
parent
2988ebb6f3
commit
666498db01
|
@ -46,7 +46,7 @@ void wlr_xcursor_manager_destroy(struct wlr_xcursor_manager *manager);
|
||||||
/**
|
/**
|
||||||
* Ensures an xcursor theme at the given scale factor is loaded in the manager.
|
* Ensures an xcursor theme at the given scale factor is loaded in the manager.
|
||||||
*/
|
*/
|
||||||
int wlr_xcursor_manager_load(struct wlr_xcursor_manager *manager,
|
bool wlr_xcursor_manager_load(struct wlr_xcursor_manager *manager,
|
||||||
float scale);
|
float scale);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -32,27 +32,27 @@ void wlr_xcursor_manager_destroy(struct wlr_xcursor_manager *manager) {
|
||||||
free(manager);
|
free(manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wlr_xcursor_manager_load(struct wlr_xcursor_manager *manager,
|
bool wlr_xcursor_manager_load(struct wlr_xcursor_manager *manager,
|
||||||
float scale) {
|
float scale) {
|
||||||
struct wlr_xcursor_manager_theme *theme;
|
struct wlr_xcursor_manager_theme *theme;
|
||||||
wl_list_for_each(theme, &manager->scaled_themes, link) {
|
wl_list_for_each(theme, &manager->scaled_themes, link) {
|
||||||
if (theme->scale == scale) {
|
if (theme->scale == scale) {
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
theme = calloc(1, sizeof(struct wlr_xcursor_manager_theme));
|
theme = calloc(1, sizeof(struct wlr_xcursor_manager_theme));
|
||||||
if (theme == NULL) {
|
if (theme == NULL) {
|
||||||
return 1;
|
return false;
|
||||||
}
|
}
|
||||||
theme->scale = scale;
|
theme->scale = scale;
|
||||||
theme->theme = wlr_xcursor_theme_load(manager->name, manager->size * scale);
|
theme->theme = wlr_xcursor_theme_load(manager->name, manager->size * scale);
|
||||||
if (theme->theme == NULL) {
|
if (theme->theme == NULL) {
|
||||||
free(theme);
|
free(theme);
|
||||||
return 1;
|
return false;
|
||||||
}
|
}
|
||||||
wl_list_insert(&manager->scaled_themes, &theme->link);
|
wl_list_insert(&manager->scaled_themes, &theme->link);
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_xcursor *wlr_xcursor_manager_get_xcursor(
|
struct wlr_xcursor *wlr_xcursor_manager_get_xcursor(
|
||||||
|
|
Loading…
Reference in New Issue