Skip to content

Commit

Permalink
adding SDL_HINT_WEBOS_CLOUDGAME_ACTIVE
Browse files Browse the repository at this point in the history
  • Loading branch information
mariotaku committed Jan 14, 2024
1 parent c8cc292 commit a18683e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions include/SDL_hints.h
Original file line number Diff line number Diff line change
Expand Up @@ -2473,6 +2473,14 @@ extern "C" {
* \brief A variable that decides whether to disable cursor calibration.
*/
#define SDL_HINT_WEBOS_CURSOR_CALIBRATION_DISABLE "SDL_HINT_WEBOS_CURSOR_CALIBRATION_DISABLE"
/**
* \brief A variable that decides whether to let SDL handle input from game controllers.
*
* Since webOS 8.3.0, input from game controllers is mapped to navigation / volume control keys by default.
* This change is useful, but can cause doubled input. SDL disables this behavior by default to let developers
* handle game controller input by themselves. But the behavior can be disabled by setting this hint to "false".
*/
#define SDL_HINT_WEBOS_CLOUDGAME_ACTIVE "SDL_HINT_WEBOS_CLOUDGAME_ACTIVE"

/**
* \brief An enumeration of hint priorities
Expand Down
6 changes: 6 additions & 0 deletions src/video/wayland/SDL_waylandwebos.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ int WaylandWebOS_SetupSurface(_THIS, SDL_WindowData *data)
if(SDL_GetHintBoolean(SDL_HINT_WEBOS_CURSOR_CALIBRATION_DISABLE, SDL_FALSE)) {
wl_webos_shell_surface_set_property(data->shell_surface.webos.webos, "restore_cursor_position", "true");
}
if(SDL_GetHintBoolean(SDL_HINT_WEBOS_CLOUDGAME_ACTIVE, SDL_TRUE)) {
wl_webos_shell_surface_set_property(data->shell_surface.webos.webos, "cloudgame_active", "true");
}
if ((hintValue = SDL_GetHint(SDL_HINT_WEBOS_CURSOR_FREQUENCY)) != NULL) {
if (SDL_strtol(hintValue, NULL, 10) > 0) {
wl_webos_shell_surface_set_property(data->shell_surface.webos.webos, "cursor_fps", hintValue);
Expand Down Expand Up @@ -203,6 +206,9 @@ static void WindowHintsCallback(void *userdata, const char *name, const char *ol
} else if (SDL_strcmp(name, SDL_HINT_WEBOS_CURSOR_CALIBRATION_DISABLE) == 0) {
wl_webos_shell_surface_set_property(win_data->shell_surface.webos.webos, "restore_cursor_position",
SDL_GetStringBoolean(newValue, SDL_FALSE) ? "true" : "false");
} else if (SDL_strcmp(name, SDL_HINT_WEBOS_CLOUDGAME_ACTIVE) == 0) {
wl_webos_shell_surface_set_property(win_data->shell_surface.webos.webos, "cloudgame_active",
SDL_GetStringBoolean(newValue, SDL_TRUE) ? "true" : "false");
} else if (SDL_strcmp(name, SDL_HINT_WEBOS_CURSOR_FREQUENCY) == 0) {
if (SDL_strtol(newValue, NULL, 10) > 0) {
wl_webos_shell_surface_set_property(win_data->shell_surface.webos.webos, "cursor_fps", newValue);
Expand Down

0 comments on commit a18683e

Please sign in to comment.