diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Overlay.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/Overlay.cpp b/src/Overlay.cpp index c8e8b8f..f542374 100644 --- a/src/Overlay.cpp +++ b/src/Overlay.cpp @@ -772,9 +772,32 @@ namespace gsr { if(cursor_size <= 1) cursor_size = 24; - XcursorImage *cursor_image = XcursorShapeLoadImage(XC_left_ptr, cursor_theme, cursor_size); + XcursorImage *cursor_image = nullptr; + for(int cursor_size_test : {cursor_size, 24}) { + 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) + 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)); + XFlush(xi_display); return; } |