2015-06-21 10:33:46 -05:00
/*
Simple DirectMedia Layer
2023-01-09 11:41:41 -06:00
Copyright ( C ) 1997 - 2023 Sam Lantinga < slouken @ libsdl . org >
2015-06-21 10:33:46 -05:00
This software is provided ' as - is ' , without any express or implied
warranty . In no event will the authors be held liable for any damages
arising from the use of this software .
Permission is granted to anyone to use this software for any purpose ,
including commercial applications , and to alter it and redistribute it
freely , subject to the following restrictions :
1. The origin of this software must not be misrepresented ; you must not
claim that you wrote the original software . If you use this software
in a product , an acknowledgment in the product documentation would be
appreciated but is not required .
2. Altered source versions must be plainly marked as such , and must not be
misrepresented as being the original software .
3. This notice may not be removed or altered from any source distribution .
*/
2022-11-29 20:34:15 -06:00
# include "SDL_internal.h"
2015-06-21 10:33:46 -05:00
# if SDL_VIDEO_DRIVER_X11
# include "SDL_x11video.h"
# include "../../events/SDL_keyboard_c.h"
2022-10-14 00:40:24 -05:00
# include "../../events/SDL_scancode_tables_c.h"
2015-06-21 10:33:46 -05:00
# include <X11/keysym.h>
2015-08-14 10:23:31 -05:00
# include <X11/XKBlib.h>
2015-06-21 10:33:46 -05:00
2021-09-23 13:07:38 -05:00
# include "../../events/imKStoUCS.h"
2022-11-04 11:27:36 -05:00
# include "../../events/SDL_keysym_to_scancode_c.h"
2015-06-21 10:33:46 -05:00
2016-10-27 19:28:58 -05:00
# ifdef X_HAVE_UTF8_STRING
# include <locale.h>
# endif
2022-10-14 00:40:24 -05:00
static SDL_ScancodeTable scancode_set [ ] = {
SDL_SCANCODE_TABLE_DARWIN ,
SDL_SCANCODE_TABLE_XFREE86_1 ,
SDL_SCANCODE_TABLE_XFREE86_2 ,
SDL_SCANCODE_TABLE_XVNC ,
2015-06-21 10:33:46 -05:00
} ;
2022-10-14 00:40:24 -05:00
/* This function only correctly maps letters and numbers for keyboards in US QWERTY layout */
2022-11-30 14:51:59 -06:00
static SDL_Scancode X11_KeyCodeToSDLScancode ( _THIS , KeyCode keycode )
2015-06-21 10:33:46 -05:00
{
2022-11-04 11:27:36 -05:00
const KeySym keysym = X11_KeyCodeToSym ( _this , keycode , 0 ) ;
2015-06-21 10:33:46 -05:00
if ( keysym = = NoSymbol ) {
return SDL_SCANCODE_UNKNOWN ;
}
2022-11-04 11:27:36 -05:00
return SDL_GetScancodeFromKeySym ( keysym , keycode ) ;
2015-06-21 10:33:46 -05:00
}
2022-11-30 14:51:59 -06:00
static Uint32 X11_KeyCodeToUcs4 ( _THIS , KeyCode keycode , unsigned char group )
2016-10-03 05:35:34 -05:00
{
KeySym keysym = X11_KeyCodeToSym ( _this , keycode , group ) ;
if ( keysym = = NoSymbol ) {
return 0 ;
}
2021-09-23 13:07:38 -05:00
return SDL_KeySymToUcs4 ( keysym ) ;
2016-10-03 05:35:34 -05:00
}
KeySym
X11_KeyCodeToSym ( _THIS , KeyCode keycode , unsigned char group )
2015-06-21 10:33:46 -05:00
{
2023-01-29 15:30:55 -06:00
SDL_VideoData * data = _this - > driverdata ;
2015-06-21 10:33:46 -05:00
KeySym keysym ;
# if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
2016-10-01 16:22:10 -05:00
if ( data - > xkb ) {
2022-11-30 14:51:59 -06:00
int num_groups = XkbKeyNumGroups ( data - > xkb , keycode ) ;
2016-10-01 16:22:10 -05:00
unsigned char info = XkbKeyGroupInfo ( data - > xkb , keycode ) ;
2022-11-30 14:51:59 -06:00
2016-10-01 16:22:10 -05:00
if ( num_groups & & group > = num_groups ) {
2022-11-30 14:51:59 -06:00
2016-10-01 16:22:10 -05:00
int action = XkbOutOfRangeGroupAction ( info ) ;
2022-11-30 14:51:59 -06:00
2016-10-01 16:22:10 -05:00
if ( action = = XkbRedirectIntoRange ) {
2022-12-01 15:07:03 -06:00
group = XkbOutOfRangeGroupNumber ( info ) ;
if ( group > = num_groups ) {
2016-10-01 16:22:10 -05:00
group = 0 ;
}
} else if ( action = = XkbClampIntoRange ) {
group = num_groups - 1 ;
} else {
group % = num_groups ;
}
}
2016-10-03 05:35:34 -05:00
keysym = X11_XkbKeycodeToKeysym ( data - > display , keycode , group , 0 ) ;
2016-10-01 16:22:10 -05:00
} else {
2016-10-03 05:35:34 -05:00
keysym = X11_XKeycodeToKeysym ( data - > display , keycode , 0 ) ;
2016-10-01 16:22:10 -05:00
}
2015-06-21 10:33:46 -05:00
# else
2016-10-01 16:22:10 -05:00
keysym = X11_XKeycodeToKeysym ( data - > display , keycode , 0 ) ;
2015-06-21 10:33:46 -05:00
# endif
2016-10-03 05:35:34 -05:00
return keysym ;
2015-06-21 10:33:46 -05:00
}
2022-11-30 14:51:59 -06:00
int X11_InitKeyboard ( _THIS )
2015-06-21 10:33:46 -05:00
{
2023-01-29 15:30:55 -06:00
SDL_VideoData * data = _this - > driverdata ;
2015-06-21 10:33:46 -05:00
int i = 0 ;
int j = 0 ;
int min_keycode , max_keycode ;
2022-11-30 14:51:59 -06:00
struct
{
2015-06-21 10:33:46 -05:00
SDL_Scancode scancode ;
KeySym keysym ;
int value ;
} fingerprint [ ] = {
{ SDL_SCANCODE_HOME , XK_Home , 0 } ,
{ SDL_SCANCODE_PAGEUP , XK_Prior , 0 } ,
{ SDL_SCANCODE_UP , XK_Up , 0 } ,
{ SDL_SCANCODE_LEFT , XK_Left , 0 } ,
{ SDL_SCANCODE_DELETE , XK_Delete , 0 } ,
{ SDL_SCANCODE_KP_ENTER , XK_KP_Enter , 0 } ,
} ;
int best_distance ;
int best_index ;
int distance ;
2018-10-20 20:35:48 -05:00
Bool xkb_repeat = 0 ;
2015-06-21 10:33:46 -05:00
2016-10-03 05:35:34 -05:00
# if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
{
2016-10-27 19:28:58 -05:00
int xkb_major = XkbMajorVersion ;
int xkb_minor = XkbMinorVersion ;
2021-11-10 14:46:54 -06:00
if ( X11_XkbQueryExtension ( data - > display , NULL , & data - > xkb_event , NULL , & xkb_major , & xkb_minor ) ) {
2016-10-27 19:28:58 -05:00
data - > xkb = X11_XkbGetMap ( data - > display , XkbAllClientInfoMask , XkbUseCoreKbd ) ;
}
/* This will remove KeyRelease events for held keys */
X11_XkbSetDetectableAutoRepeat ( data - > display , True , & xkb_repeat ) ;
}
# endif
2022-11-30 14:51:59 -06:00
2016-10-27 19:28:58 -05:00
/* Open a connection to the X input manager */
# ifdef X_HAVE_UTF8_STRING
if ( SDL_X11_HAVE_UTF8 ) {
2022-11-30 14:51:59 -06:00
/* Set the locale, and call XSetLocaleModifiers before XOpenIM so that
2016-10-27 19:28:58 -05:00
Compose keys will work correctly . */
char * prev_locale = setlocale ( LC_ALL , NULL ) ;
2022-11-30 14:51:59 -06:00
char * prev_xmods = X11_XSetLocaleModifiers ( NULL ) ;
2016-10-27 19:28:58 -05:00
const char * new_xmods = " " ;
const char * env_xmods = SDL_getenv ( " XMODIFIERS " ) ;
SDL_bool has_dbus_ime_support = SDL_FALSE ;
if ( prev_locale ) {
prev_locale = SDL_strdup ( prev_locale ) ;
}
if ( prev_xmods ) {
prev_xmods = SDL_strdup ( prev_xmods ) ;
}
/* IBus resends some key events that were filtered by XFilterEvents
when it is used via XIM which causes issues . Prevent this by forcing
2022-11-30 14:51:59 -06:00
@ im = none if XMODIFIERS contains @ im = ibus . IBus can still be used via
2016-10-27 19:28:58 -05:00
the DBus implementation , which also has support for pre - editing . */
if ( env_xmods & & SDL_strstr ( env_xmods , " @im=ibus " ) ! = NULL ) {
has_dbus_ime_support = SDL_TRUE ;
}
if ( env_xmods & & SDL_strstr ( env_xmods , " @im=fcitx " ) ! = NULL ) {
has_dbus_ime_support = SDL_TRUE ;
}
if ( has_dbus_ime_support | | ! xkb_repeat ) {
new_xmods = " @im=none " ;
}
2022-12-01 15:07:03 -06:00
( void ) setlocale ( LC_ALL , " " ) ;
2016-10-27 19:28:58 -05:00
X11_XSetLocaleModifiers ( new_xmods ) ;
data - > im = X11_XOpenIM ( data - > display , NULL , data - > classname , data - > classname ) ;
2016-10-03 05:35:34 -05:00
2016-10-27 19:28:58 -05:00
/* Reset the locale + X locale modifiers back to how they were,
locale first because the X locale modifiers depend on it . */
2022-12-01 15:07:03 -06:00
( void ) setlocale ( LC_ALL , prev_locale ) ;
2016-10-27 19:28:58 -05:00
X11_XSetLocaleModifiers ( prev_xmods ) ;
if ( prev_locale ) {
SDL_free ( prev_locale ) ;
}
if ( prev_xmods ) {
SDL_free ( prev_xmods ) ;
}
}
# endif
2015-06-21 10:33:46 -05:00
/* Try to determine which scancodes are being used based on fingerprint */
best_distance = SDL_arraysize ( fingerprint ) + 1 ;
best_index = - 1 ;
X11_XDisplayKeycodes ( data - > display , & min_keycode , & max_keycode ) ;
for ( i = 0 ; i < SDL_arraysize ( fingerprint ) ; + + i ) {
2022-10-14 00:40:24 -05:00
fingerprint [ i ] . value = X11_XKeysymToKeycode ( data - > display , fingerprint [ i ] . keysym ) - min_keycode ;
2015-06-21 10:33:46 -05:00
}
for ( i = 0 ; i < SDL_arraysize ( scancode_set ) ; + + i ) {
2022-10-14 00:40:24 -05:00
int table_size ;
const SDL_Scancode * table = SDL_GetScancodeTable ( scancode_set [ i ] , & table_size ) ;
2015-06-21 10:33:46 -05:00
distance = 0 ;
for ( j = 0 ; j < SDL_arraysize ( fingerprint ) ; + + j ) {
2022-10-14 00:40:24 -05:00
if ( fingerprint [ j ] . value < 0 | | fingerprint [ j ] . value > = table_size ) {
2015-06-21 10:33:46 -05:00
distance + = 1 ;
2022-10-14 00:40:24 -05:00
} else if ( table [ fingerprint [ j ] . value ] ! = fingerprint [ j ] . scancode ) {
2015-06-21 10:33:46 -05:00
distance + = 1 ;
}
}
if ( distance < best_distance ) {
best_distance = distance ;
best_index = i ;
}
}
2022-10-14 01:23:55 -05:00
if ( best_index < 0 | | best_distance > 2 ) {
/* This is likely to be SDL_SCANCODE_TABLE_XFREE86_2 with remapped keys, double check a rarely remapped value */
int fingerprint_value = X11_XKeysymToKeycode ( data - > display , 0x1008FF5B /* XF86Documents */ ) - min_keycode ;
if ( fingerprint_value = = 235 ) {
for ( i = 0 ; i < SDL_arraysize ( scancode_set ) ; + + i ) {
if ( scancode_set [ i ] = = SDL_SCANCODE_TABLE_XFREE86_2 ) {
best_index = i ;
best_distance = 0 ;
break ;
}
}
}
}
2015-06-21 10:33:46 -05:00
if ( best_index > = 0 & & best_distance < = 2 ) {
2022-10-14 00:40:24 -05:00
SDL_Keycode default_keymap [ SDL_NUM_SCANCODES ] ;
int table_size ;
const SDL_Scancode * table = SDL_GetScancodeTable ( scancode_set [ best_index ] , & table_size ) ;
2015-06-21 10:33:46 -05:00
# ifdef DEBUG_KEYBOARD
2022-10-14 00:40:24 -05:00
SDL_Log ( " Using scancode set %d, min_keycode = %d, max_keycode = %d, table_size = %d \n " , best_index , min_keycode , max_keycode , table_size ) ;
2015-06-21 10:33:46 -05:00
# endif
2022-10-14 00:40:24 -05:00
/* This should never happen, but just in case... */
if ( table_size > ( SDL_arraysize ( data - > key_layout ) - min_keycode ) ) {
table_size = ( SDL_arraysize ( data - > key_layout ) - min_keycode ) ;
}
SDL_memcpy ( & data - > key_layout [ min_keycode ] , table , sizeof ( SDL_Scancode ) * table_size ) ;
2015-06-21 10:33:46 -05:00
2022-10-14 00:40:24 -05:00
/* Scancodes represent physical locations on the keyboard, unaffected by keyboard mapping.
However , there are a number of extended scancodes that have no standard location , so use
the X11 mapping for all non - character keys .
*/
SDL_GetDefaultKeymap ( default_keymap ) ;
2015-06-21 10:33:46 -05:00
for ( i = min_keycode ; i < = max_keycode ; + + i ) {
2022-10-14 00:40:24 -05:00
SDL_Scancode scancode = X11_KeyCodeToSDLScancode ( _this , i ) ;
# ifdef DEBUG_KEYBOARD
{
KeySym sym ;
sym = X11_KeyCodeToSym ( _this , ( KeyCode ) i , 0 ) ;
SDL_Log ( " code = %d, sym = 0x%X (%s) " , i - min_keycode ,
2022-11-30 14:51:59 -06:00
( unsigned int ) sym , sym = = NoSymbol ? " NoSymbol " : X11_XKeysymToString ( sym ) ) ;
2022-10-14 00:40:24 -05:00
}
# endif
if ( scancode = = data - > key_layout [ i ] ) {
continue ;
}
2022-10-14 00:50:57 -05:00
if ( default_keymap [ scancode ] > = SDLK_SCANCODE_MASK ) {
2022-10-14 00:40:24 -05:00
/* Not a character key, safe to remap */
# ifdef DEBUG_KEYBOARD
SDL_Log ( " Changing scancode, was %d (%s), now %d (%s) \n " , data - > key_layout [ i ] , SDL_GetScancodeName ( data - > key_layout [ i ] ) , scancode , SDL_GetScancodeName ( scancode ) ) ;
# endif
2015-06-21 10:33:46 -05:00
data - > key_layout [ i ] = scancode ;
}
}
2022-10-14 00:40:24 -05:00
} else {
# ifdef DEBUG_SCANCODES
SDL_Log ( " Keyboard layout unknown, please report the following to the SDL forums/mailing list (https://discourse.libsdl.org/): \n " ) ;
# endif
/* Determine key_layout - only works on US QWERTY layout */
for ( i = min_keycode ; i < = max_keycode ; + + i ) {
SDL_Scancode scancode = X11_KeyCodeToSDLScancode ( _this , i ) ;
# ifdef DEBUG_SCANCODES
{
KeySym sym ;
sym = X11_KeyCodeToSym ( _this , ( KeyCode ) i , 0 ) ;
SDL_Log ( " code = %d, sym = 0x%X (%s) " , i - min_keycode ,
2022-11-30 14:51:59 -06:00
( unsigned int ) sym , sym = = NoSymbol ? " NoSymbol " : X11_XKeysymToString ( sym ) ) ;
2022-10-14 00:40:24 -05:00
}
if ( scancode = = SDL_SCANCODE_UNKNOWN ) {
SDL_Log ( " scancode not found \n " ) ;
} else {
SDL_Log ( " scancode = %d (%s) \n " , scancode , SDL_GetScancodeName ( scancode ) ) ;
}
# endif
data - > key_layout [ i ] = scancode ;
}
2015-06-21 10:33:46 -05:00
}
2022-07-31 15:34:03 -05:00
X11_UpdateKeymap ( _this , SDL_FALSE ) ;
2015-06-21 10:33:46 -05:00
SDL_SetScancodeName ( SDL_SCANCODE_APPLICATION , " Menu " ) ;
2016-10-07 20:57:40 -05:00
# ifdef SDL_USE_IME
SDL_IME_Init ( ) ;
2015-06-21 10:33:46 -05:00
# endif
2022-03-24 12:09:45 -05:00
X11_ReconcileKeyboardState ( _this ) ;
2015-06-21 10:33:46 -05:00
return 0 ;
}
2022-11-30 14:51:59 -06:00
void X11_UpdateKeymap ( _THIS , SDL_bool send_event )
2015-06-21 10:33:46 -05:00
{
2023-01-29 15:30:55 -06:00
SDL_VideoData * data = _this - > driverdata ;
2015-06-21 10:33:46 -05:00
int i ;
SDL_Scancode scancode ;
SDL_Keycode keymap [ SDL_NUM_SCANCODES ] ;
2015-08-14 10:23:31 -05:00
unsigned char group = 0 ;
2015-06-21 10:33:46 -05:00
SDL_GetDefaultKeymap ( keymap ) ;
2016-10-03 05:35:34 -05:00
2015-08-14 10:23:31 -05:00
# if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
2016-10-03 05:35:34 -05:00
if ( data - > xkb ) {
2016-10-01 16:54:05 -05:00
XkbStateRec state ;
2016-10-03 05:35:34 -05:00
X11_XkbGetUpdatedMap ( data - > display , XkbAllClientInfoMask , data - > xkb ) ;
2016-10-01 16:22:10 -05:00
2015-08-14 22:38:40 -05:00
if ( X11_XkbGetState ( data - > display , XkbUseCoreKbd , & state ) = = Success ) {
group = state . group ;
}
2015-08-14 22:30:46 -05:00
}
2015-08-14 10:23:31 -05:00
# endif
2015-06-21 10:33:46 -05:00
for ( i = 0 ; i < SDL_arraysize ( data - > key_layout ) ; i + + ) {
Uint32 key ;
/* Make sure this is a valid scancode */
scancode = data - > key_layout [ i ] ;
if ( scancode = = SDL_SCANCODE_UNKNOWN ) {
continue ;
}
/* See if there is a UCS keycode for this scancode */
2016-10-03 05:35:34 -05:00
key = X11_KeyCodeToUcs4 ( _this , ( KeyCode ) i , group ) ;
2015-06-21 10:33:46 -05:00
if ( key ) {
keymap [ scancode ] = key ;
} else {
2016-10-03 05:35:34 -05:00
SDL_Scancode keyScancode = X11_KeyCodeToSDLScancode ( _this , ( KeyCode ) i ) ;
2015-06-21 10:33:46 -05:00
switch ( keyScancode ) {
2022-11-30 14:51:59 -06:00
case SDL_SCANCODE_RETURN :
keymap [ scancode ] = SDLK_RETURN ;
break ;
case SDL_SCANCODE_ESCAPE :
keymap [ scancode ] = SDLK_ESCAPE ;
break ;
case SDL_SCANCODE_BACKSPACE :
keymap [ scancode ] = SDLK_BACKSPACE ;
break ;
case SDL_SCANCODE_TAB :
keymap [ scancode ] = SDLK_TAB ;
break ;
case SDL_SCANCODE_DELETE :
keymap [ scancode ] = SDLK_DELETE ;
break ;
default :
keymap [ scancode ] = SDL_SCANCODE_TO_KEYCODE ( keyScancode ) ;
break ;
2015-06-21 10:33:46 -05:00
}
}
}
2022-07-31 15:34:03 -05:00
SDL_SetKeymap ( 0 , keymap , SDL_NUM_SCANCODES , send_event ) ;
2015-06-21 10:33:46 -05:00
}
2022-11-30 14:51:59 -06:00
void X11_QuitKeyboard ( _THIS )
2015-06-21 10:33:46 -05:00
{
2023-01-29 15:30:55 -06:00
SDL_VideoData * data = _this - > driverdata ;
2016-10-01 16:22:10 -05:00
# if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
if ( data - > xkb ) {
2016-11-01 12:48:59 -05:00
X11_XkbFreeKeyboard ( data - > xkb , 0 , True ) ;
2016-10-03 05:35:34 -05:00
data - > xkb = NULL ;
2016-10-01 16:22:10 -05:00
}
# endif
2016-10-07 20:57:40 -05:00
# ifdef SDL_USE_IME
SDL_IME_Quit ( ) ;
2015-06-21 10:33:46 -05:00
# endif
}
2022-11-30 14:51:59 -06:00
static void X11_ResetXIM ( _THIS )
2016-10-17 23:37:26 -05:00
{
# ifdef X_HAVE_UTF8_STRING
2023-01-29 15:30:55 -06:00
SDL_VideoData * videodata = _this - > driverdata ;
2016-10-17 23:37:26 -05:00
int i ;
if ( videodata & & videodata - > windowlist ) {
for ( i = 0 ; i < videodata - > numwindows ; + + i ) {
SDL_WindowData * data = videodata - > windowlist [ i ] ;
if ( data & & data - > ic ) {
/* Clear any partially entered dead keys */
char * contents = X11_Xutf8ResetIC ( data - > ic ) ;
if ( contents ) {
X11_XFree ( contents ) ;
}
}
}
}
# endif
}
2022-11-30 14:51:59 -06:00
void X11_StartTextInput ( _THIS )
2015-06-21 10:33:46 -05:00
{
2016-10-17 23:37:26 -05:00
X11_ResetXIM ( _this ) ;
2015-06-21 10:33:46 -05:00
}
2022-11-30 14:51:59 -06:00
void X11_StopTextInput ( _THIS )
2015-06-21 10:33:46 -05:00
{
2016-10-17 23:37:26 -05:00
X11_ResetXIM ( _this ) ;
2016-10-07 20:57:40 -05:00
# ifdef SDL_USE_IME
SDL_IME_Reset ( ) ;
2015-06-21 10:33:46 -05:00
# endif
}
2023-02-06 13:24:12 -06:00
int X11_SetTextInputRect ( _THIS , const SDL_Rect * rect )
2015-06-21 10:33:46 -05:00
{
2016-10-07 20:57:40 -05:00
# ifdef SDL_USE_IME
SDL_IME_UpdateTextRect ( rect ) ;
2015-06-21 10:33:46 -05:00
# endif
2023-02-06 13:24:12 -06:00
return 0 ;
2015-06-21 10:33:46 -05:00
}
2022-11-13 11:45:13 -06:00
SDL_bool
X11_HasScreenKeyboardSupport ( _THIS )
{
2023-01-29 15:30:55 -06:00
SDL_VideoData * videodata = _this - > driverdata ;
2022-11-13 11:45:13 -06:00
return videodata - > is_steam_deck ;
}
2022-11-30 14:51:59 -06:00
void X11_ShowScreenKeyboard ( _THIS , SDL_Window * window )
2022-11-13 11:45:13 -06:00
{
2023-01-29 15:30:55 -06:00
SDL_VideoData * videodata = _this - > driverdata ;
2022-11-13 11:45:13 -06:00
if ( videodata - > is_steam_deck ) {
/* For more documentation of the URL parameters, see:
* https : //partner.steamgames.com/doc/api/ISteamUtils#ShowFloatingGamepadTextInput
*/
char deeplink [ 128 ] ;
2022-12-01 15:07:03 -06:00
( void ) SDL_snprintf ( deeplink , sizeof deeplink ,
" steam://open/keyboard?XPosition=0&YPosition=0&Width=0&Height=0&Mode=%d " ,
SDL_GetHintBoolean ( SDL_HINT_RETURN_KEY_HIDES_IME , SDL_FALSE ) ? 0 : 1 ) ;
2022-11-13 11:45:13 -06:00
SDL_OpenURL ( deeplink ) ;
videodata - > steam_keyboard_open = SDL_TRUE ;
}
}
2022-11-30 14:51:59 -06:00
void X11_HideScreenKeyboard ( _THIS , SDL_Window * window )
2022-11-13 11:45:13 -06:00
{
2023-01-29 15:30:55 -06:00
SDL_VideoData * videodata = _this - > driverdata ;
2022-11-13 11:45:13 -06:00
if ( videodata - > is_steam_deck ) {
SDL_OpenURL ( " steam://close/keyboard " ) ;
videodata - > steam_keyboard_open = SDL_FALSE ;
}
}
2022-11-15 12:56:44 -06:00
SDL_bool
X11_IsScreenKeyboardShown ( _THIS , SDL_Window * window )
2022-11-13 11:45:13 -06:00
{
2023-01-29 15:30:55 -06:00
SDL_VideoData * videodata = _this - > driverdata ;
2022-11-13 11:45:13 -06:00
return videodata - > steam_keyboard_open ;
}
2015-06-21 10:33:46 -05:00
# endif /* SDL_VIDEO_DRIVER_X11 */