@@ -70,6 +70,8 @@ static void send_unicode(int unicode);
70
70
static void set_clipboard_text (const char * text );
71
71
static Bool sdlScreenButtons = FALSE;
72
72
static void setScreenButtons (int mouseX );
73
+ static enum sdlKeyboardType_t { KB_NATIVE = 0 , KB_BUILTIN = 1 , KB_BOTH = 2 } ;
74
+ enum sdlKeyboardType_t sdlKeyboardType = KB_NATIVE ;
73
75
74
76
KdKeyboardInfo * sdlKeyboard = NULL ;
75
77
KdPointerInfo * sdlPointer = NULL ;
@@ -216,6 +218,12 @@ static Bool sdlScreenInit(KdScreenInfo *screen)
216
218
sdlScreenButtons = SDL_ANDROID_GetScreenKeyboardButtonShown (SDL_ANDROID_SCREENKEYBOARD_BUTTON_0 );
217
219
setScreenButtons (10000 );
218
220
221
+ if (getenv ("XSDL_BUILTIN_KEYBOARD" ) != NULL )
222
+ sdlKeyboardType = (enum sdlKeyboardType_t ) atoi (getenv ("XSDL_BUILTIN_KEYBOARD" ));
223
+ unsetenv ("XSDL_BUILTIN_KEYBOARD" );
224
+
225
+ printf ("sdlScreenButtons %d sdlKeyboardType %d\n" , sdlScreenButtons , sdlKeyboardType );
226
+
219
227
return sdlMapFramebuffer (screen );
220
228
}
221
229
@@ -705,18 +713,21 @@ static void sdlPollInput(void)
705
713
// SDL_ANDROID_ToggleScreenKeyboardWithoutTextInput();
706
714
static int keyboard = 0 ;
707
715
keyboard ++ ;
708
- if (keyboard > 1 )
716
+ if (keyboard > 1 || ( sdlKeyboardType != KB_BOTH && keyboard > 0 ) )
709
717
keyboard = 0 ;
710
718
SDL_HideScreenKeyboard (NULL );
711
719
//SDL_Delay(150);
712
720
SDL_Flip (SDL_GetVideoSurface ());
713
721
if (keyboard == 0 )
714
722
{
715
723
SDL_Delay (100 );
716
- SDL_ANDROID_ToggleScreenKeyboardWithoutTextInput ();
724
+ if (sdlKeyboardType == KB_NATIVE || sdlKeyboardType == KB_BOTH )
725
+ SDL_ANDROID_ToggleScreenKeyboardWithoutTextInput ();
726
+ if (sdlKeyboardType == KB_BUILTIN )
727
+ SDL_ANDROID_ToggleInternalScreenKeyboard (SDL_KEYBOARD_QWERTY );
717
728
SDL_Flip (SDL_GetVideoSurface ());
718
729
}
719
- if (keyboard == 1 )
730
+ if (keyboard == 1 && sdlKeyboardType == KB_BOTH )
720
731
{
721
732
SDL_Delay (100 );
722
733
SDL_ANDROID_ToggleInternalScreenKeyboard (SDL_KEYBOARD_QWERTY );
@@ -1090,13 +1101,11 @@ void setScreenButtons(int mouseX)
1090
1101
#ifdef __ANDROID__
1091
1102
//printf ("setScreenButtons: kbShown %d sdlScreenButtons %d alignLeft %d", SDL_IsScreenKeyboardShown(NULL), sdlScreenButtons, mouseX > (((unsigned)SDL_GetVideoSurface()->w) >> 3));
1092
1103
1093
- return ; // Disable screen buttons, we now have built-in SDL keyboard with sticky Ctrl/Alt/Shift keys
1094
-
1095
1104
if ( SDL_ANDROID_GetScreenKeyboardRedefinedByUser () )
1096
1105
return ;
1097
1106
1098
1107
int kbShown = SDL_IsScreenKeyboardShown (NULL );
1099
- if (!sdlScreenButtons && ! kbShown )
1108
+ if (!sdlScreenButtons )
1100
1109
{
1101
1110
if (SDL_ANDROID_GetScreenKeyboardButtonShown (SDL_ANDROID_SCREENKEYBOARD_BUTTON_0 ))
1102
1111
{
0 commit comments