mirror of
https://repo.dec05eba.com/gpu-screen-recorder-ui
synced 2026-01-31 01:13:04 +09:00
Use bundled cursor if cursor fails to load
This commit is contained in:
@@ -39,7 +39,7 @@ This program has to grab all keyboards and create a virtual keyboard (`gsr-ui vi
|
||||
This might cause issues for you if you use input remapping software. To workaround this you can go into settings and select "Only grab virtual devices"
|
||||
|
||||
# License
|
||||
This software is licensed under GPL3.0-only. Files under `fonts/` directory belong to the Noto Sans Google fonts project and they are licensed under `SIL Open Font License`.
|
||||
This software is licensed under GPL3.0-only. Files under `fonts/` directory belong to the Noto Sans Google fonts project and they are licensed under `SIL Open Font License`. `images/default.cur` it part of the [Adwaita icon theme](https://gitlab.gnome.org/GNOME/adwaita-icon-theme/-/tree/master) which is licensed under `Creative Commons Attribution-Share Alike 3.0`.
|
||||
|
||||
# Demo
|
||||
[](https://www.youtube.com/watch?v=SOqXusCTXXA)
|
||||
|
||||
BIN
images/default.cur
Normal file
BIN
images/default.cur
Normal file
Binary file not shown.
@@ -774,15 +774,26 @@ namespace gsr {
|
||||
|
||||
XcursorImage *cursor_image = nullptr;
|
||||
for(int cursor_size_test : {cursor_size, 24}) {
|
||||
for(const char *cursor_theme_test : {cursor_theme, "default"}) {
|
||||
for(const char *cursor_theme_test : {cursor_theme, "default", "Adwaita"}) {
|
||||
for(unsigned int shape : {XC_left_ptr, XC_arrow}) {
|
||||
cursor_image = XcursorShapeLoadImage(shape, cursor_theme_test, cursor_size_test);
|
||||
if(cursor_image)
|
||||
break;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
if(!cursor_image) {
|
||||
fprintf(stderr, "Error: failed to get cursor, loading bundled default cursor instead\n");
|
||||
const std::string default_cursor_path = resources_path + "images/default.cur";
|
||||
for(int cursor_size_test : {cursor_size, 24}) {
|
||||
cursor_image = XcursorFilenameLoadImage(default_cursor_path.c_str(), cursor_size_test);
|
||||
if(cursor_image)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!cursor_image) {
|
||||
fprintf(stderr, "Error: failed to get cursor\n");
|
||||
XFixesShowCursor(xi_display, DefaultRootWindow(xi_display));
|
||||
|
||||
Reference in New Issue
Block a user