SDL: pressing Back will hide built-in keyboard

This commit is contained in:
Sergii Pylypenko
2015-11-05 22:27:01 +02:00
parent ad9bbd68f3
commit b2061d76e8
6 changed files with 29 additions and 14 deletions

View File

@@ -908,11 +908,18 @@ public class MainActivity extends Activity
@Override
public boolean onKeyDown(int keyCode, final KeyEvent event)
{
if( keyCode == KeyEvent.KEYCODE_BACK && (event.getSource() & InputDevice.SOURCE_MOUSE)== InputDevice.SOURCE_MOUSE )
if( keyCode == KeyEvent.KEYCODE_BACK )
{
// Stupid Samsung and stupid Acer remaps right mouse button to BACK key
DemoGLSurfaceView.nativeMouseButtonsPressed(2, 1);
return true;
if( (event.getSource() & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE )
{
// Stupid Samsung and stupid Acer remaps right mouse button to BACK key
DemoGLSurfaceView.nativeMouseButtonsPressed(2, 1);
return true;
}
else if( keyboardWithoutTextInputShown )
{
return true;
}
}
if( _screenKeyboard != null && _screenKeyboard.onKeyDown(keyCode, event) )
return true;
@@ -936,11 +943,19 @@ public class MainActivity extends Activity
@Override
public boolean onKeyUp(int keyCode, final KeyEvent event)
{
if( keyCode == KeyEvent.KEYCODE_BACK && (event.getSource() & InputDevice.SOURCE_MOUSE)== InputDevice.SOURCE_MOUSE )
if( keyCode == KeyEvent.KEYCODE_BACK )
{
// Stupid Samsung and stupid Acer remaps right mouse button to BACK key
DemoGLSurfaceView.nativeMouseButtonsPressed(2, 0);
return true;
if( (event.getSource() & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE )
{
// Stupid Samsung and stupid Acer remaps right mouse button to BACK key
DemoGLSurfaceView.nativeMouseButtonsPressed(2, 0);
return true;
}
else if( keyboardWithoutTextInputShown )
{
showScreenKeyboardWithoutTextInputField(0); // Hide keyboard
return true;
}
}
if( _screenKeyboard != null && _screenKeyboard.onKeyUp(keyCode, event) )
return true;

View File

@@ -85,7 +85,7 @@ CompatibilityHacksTextInputEmulatesHwKeyboard=n
# 1 - Simple QWERTY keyboard, no function keys, no arrow keys
# 2 - Commodore 64 keyboard
# 3 - Amiga keyboard
TextInputKeyboard=3
TextInputKeyboard=1
# Hack for broken devices: prevent audio chopping, by sleeping a bit after pushing each audio chunk (y)/(n)
CompatibilityHacksPreventAudioChopping=n

View File

@@ -681,7 +681,7 @@ int main(int argc, char* argv[])
__android_log_print(ANDROID_LOG_INFO, "Ballfield", "SDL key event: evt %s state %s key %4d %12s scancode %4d mod %2d unicode %d", evt.type == SDL_KEYUP ? "UP " : "DOWN" , evt.key.state == SDL_PRESSED ? "PRESSED " : "RELEASED", (int)evt.key.keysym.sym, SDL_GetKeyName(evt.key.keysym.sym), (int)evt.key.keysym.scancode, (int)evt.key.keysym.mod, (int)evt.key.keysym.unicode);
if(evt.key.keysym.sym == SDLK_ESCAPE)
return 0;
if( evt.key.state == SDL_PRESSED )
if( evt.key.state == SDL_RELEASED )
{
if(evt.key.keysym.sym == SDLK_0)
SDL_ANDROID_SetScreenKeyboardButtonShown(SDL_ANDROID_SCREENKEYBOARD_BUTTON_2, 1);

View File

@@ -7,10 +7,10 @@ AppName="XServer XSDL"
AppFullName=x.org.server
# Application version code (integer)
AppVersionCode=11137
AppVersionCode=11138
# Application user-visible version name (string)
AppVersionName="1.11.37"
AppVersionName="1.11.38"
# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...'
# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu