Merge branch 'blender-v3.5-release'

This commit is contained in:
Campbell Barton 2023-03-22 12:25:26 +11:00
commit d3bab78d05
1 changed files with 19 additions and 1 deletions

View File

@ -4275,8 +4275,26 @@ static void gwl_seat_capability_pointer_enable(GWL_Seat *seat)
seat->cursor.visible = true;
seat->cursor.wl_buffer = nullptr;
if (!get_cursor_settings(seat->cursor.theme_name, seat->cursor.theme_size)) {
seat->cursor.theme_name = std::string();
/* Use environment variables, falling back to defaults.
* These environment variables are used by enough WAYLAND applications
* that it makes sense to check them (see `Xcursor` man page). */
const char *env;
env = getenv("XCURSOR_THEME");
seat->cursor.theme_name = std::string(env ? env : "");
env = getenv("XCURSOR_SIZE");
seat->cursor.theme_size = default_cursor_size;
if (env && (*env != '\0')) {
char *env_end = nullptr;
/* While clamping is not needed on the WAYLAND side,
* GHOST's internal logic may get confused by negative values, so ensure it's at least 1. */
const long value = strtol(env, &env_end, 10);
if ((*env_end == '\0') && (value > 0)) {
seat->cursor.theme_size = int(value);
}
}
}
wl_pointer_add_listener(seat->wl_pointer, &pointer_listener, seat);