mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 22:20:24 +00:00
Merge branch 'wayland-cursor-theme' into 'master'
wayland: Look for cursor themes in $HOME Closes #4080 See merge request GNOME/gtk!3708
This commit is contained in:
commit
3a5983e387
@ -991,6 +991,26 @@ gdk_wayland_display_get_toplevel_surfaces (GdkDisplay *display)
|
||||
return GDK_WAYLAND_DISPLAY (display)->toplevels;
|
||||
}
|
||||
|
||||
static struct wl_cursor_theme *
|
||||
try_load_theme (GdkWaylandDisplay *display_wayland,
|
||||
const char *dir,
|
||||
gboolean dotdir,
|
||||
const char *name,
|
||||
int size)
|
||||
{
|
||||
struct wl_cursor_theme *theme = NULL;
|
||||
char *path;
|
||||
|
||||
path = g_build_filename (dir, dotdir ? ".icons" : "icons", name, "cursors", NULL);
|
||||
|
||||
if (g_file_test (path, G_FILE_TEST_IS_DIR))
|
||||
theme = wl_cursor_theme_create (path, size, display_wayland->shm);
|
||||
|
||||
g_free (path);
|
||||
|
||||
return theme;
|
||||
}
|
||||
|
||||
static struct wl_cursor_theme *
|
||||
get_cursor_theme (GdkWaylandDisplay *display_wayland,
|
||||
const char *name,
|
||||
@ -1000,16 +1020,18 @@ get_cursor_theme (GdkWaylandDisplay *display_wayland,
|
||||
struct wl_cursor_theme *theme = NULL;
|
||||
int i;
|
||||
|
||||
theme = try_load_theme (display_wayland, g_get_user_data_dir (), FALSE, name, size);
|
||||
if (theme)
|
||||
return theme;
|
||||
|
||||
theme = try_load_theme (display_wayland, g_get_home_dir (), TRUE, name, size);
|
||||
if (theme)
|
||||
return theme;
|
||||
|
||||
xdg_data_dirs = g_get_system_data_dirs ();
|
||||
for (i = 0; xdg_data_dirs[i]; i++)
|
||||
{
|
||||
char *path = g_build_filename (xdg_data_dirs[i], "icons", name, "cursors", NULL);
|
||||
|
||||
if (g_file_test (path, G_FILE_TEST_IS_DIR))
|
||||
theme = wl_cursor_theme_create (path, size, display_wayland->shm);
|
||||
|
||||
g_free (path);
|
||||
|
||||
theme = try_load_theme (display_wayland, xdg_data_dirs[i], FALSE, name, size);
|
||||
if (theme)
|
||||
return theme;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user