Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | repair Android onscreen keyboard handling (broken since [b46b660d5e]) |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
ebc1f80f21b297743e2c2f29236d86cf |
User & Date: | chw 2016-12-02 09:00:00.630 |
Context
2016-12-02
| ||
19:13 | start NFC support in borg command, NDEF tags only, for now check-in: 1e5315f4df user: chw tags: trunk | |
09:00 | repair Android onscreen keyboard handling (broken since [b46b660d5e]) check-in: ebc1f80f21 user: chw tags: trunk | |
08:57 | add tcl upstream changes check-in: b0c1c5f75f user: chw tags: trunk | |
Changes
Changes to src/org/libsdl/app/SDLActivity.java.
︙ | ︙ | |||
441 442 443 444 445 446 447 | // The sizes will be set to useful values when the keyboard is shown again. mTextEdit.setLayoutParams(new RelativeLayout.LayoutParams(0, 0)); InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(mTextEdit.getWindowToken(), 0); restoreSystemUI(); } break; | | < | 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 | // The sizes will be set to useful values when the keyboard is shown again. mTextEdit.setLayoutParams(new RelativeLayout.LayoutParams(0, 0)); InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(mTextEdit.getWindowToken(), 0); restoreSystemUI(); } break; case COMMAND_SET_KEEP_SCREEN_ON: { Window window = ((Activity) context).getWindow(); if (window != null) { if ((msg.obj instanceof Integer) && (((Integer) msg.obj).intValue() != 0)) { window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } else { window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } |
︙ | ︙ | |||
1355 1356 1357 1358 1359 1360 1361 | int action = event.getActionMasked(); int pointerFingerId; int mouseButton; int i = -1; float x,y,p; // !!! FIXME: dump this SDK check after 2.0.4 ships and require API14. | | | 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 | int action = event.getActionMasked(); int pointerFingerId; int mouseButton; int i = -1; float x,y,p; // !!! FIXME: dump this SDK check after 2.0.4 ships and require API14. if (event.getSource() == InputDevice.SOURCE_MOUSE && (Build.VERSION.SDK_INT >= 14 || SDLActivity.mSeparateMouseAndTouch)) { if (Build.VERSION.SDK_INT < 14) { mouseButton = 1; // all mouse buttons are the left button } else { try { mouseButton = (Integer) event.getClass().getMethod("getButtonState").invoke(event); } catch(Exception e) { mouseButton = 1; // oh well. |
︙ | ︙ | |||
1498 1499 1500 1501 1502 1503 1504 | return true; } @Override public boolean onKey(View v, int keyCode, KeyEvent event) { // This handles the hardware keyboard input | > > > > > > > | > > | < | > > | 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 | return true; } @Override public boolean onKey(View v, int keyCode, KeyEvent event) { // This handles the hardware keyboard input boolean ctrl = false; boolean lalt = (event.getMetaState() & KeyEvent.META_ALT_LEFT_ON) != 0; if (Build.VERSION.SDK_INT >= 11) { ctrl = SDLCtrlKey.pressed(event); } else { ctrl = (event.getMetaState() & KeyEvent.META_CTRL_MASK) != 0; } if (!lalt && !ctrl && event.isPrintingKey()) { if (event.getAction() == KeyEvent.ACTION_DOWN) { int ch = event.getUnicodeChar(); if (ch != 0) { ic.commitText(String.valueOf((char) ch), 1); return true; } } } if (event.getAction() == KeyEvent.ACTION_DOWN) { SDLActivity.onNativeKeyDown(keyCode); return true; } else if (event.getAction() == KeyEvent.ACTION_UP) { SDLActivity.onNativeKeyUp(keyCode); |
︙ | ︙ | |||
1564 1565 1566 1567 1568 1569 1570 | /* * This handles the keycodes from soft keyboard (and IME-translated * input from hardkeyboard) */ int keyCode = event.getKeyCode(); if (event.getAction() == KeyEvent.ACTION_DOWN) { | > > > > > > > > | > > | > > | 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 | /* * This handles the keycodes from soft keyboard (and IME-translated * input from hardkeyboard) */ int keyCode = event.getKeyCode(); if (event.getAction() == KeyEvent.ACTION_DOWN) { boolean ctrl = false; boolean lalt = (event.getMetaState() & KeyEvent.META_ALT_LEFT_ON) != 0; if (Build.VERSION.SDK_INT >= 11) { ctrl = SDLCtrlKey.pressed(event); } else { ctrl = (event.getMetaState() & KeyEvent.META_CTRL_MASK) != 0; } if (!lalt && !ctrl && event.isPrintingKey()) { int ch = event.getUnicodeChar(); if (ch != 0) { commitText(String.valueOf((char) ch), 1); return true; } } SDLActivity.onNativeKeyDown(keyCode); return true; } else if (event.getAction() == KeyEvent.ACTION_UP) { SDLActivity.onNativeKeyUp(keyCode); return true; |
︙ | ︙ | |||
1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 | @Override public void onPrimaryClipChanged() { SDLActivity.onNativeClipboardChanged(); } } /* A null joystick handler for API level < 12 devices (the accelerometer is handled separately) */ class SDLJoystickHandler { /** * Handles given MotionEvent. * @param event the event to be handled. | > > > > > > > > > | 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 | @Override public void onPrimaryClipChanged() { SDLActivity.onNativeClipboardChanged(); } } class SDLCtrlKey { public static boolean pressed(KeyEvent event) { return event.isCtrlPressed() || event.isSymPressed() || event.isMetaPressed() || event.isFunctionPressed(); } } /* A null joystick handler for API level < 12 devices (the accelerometer is handled separately) */ class SDLJoystickHandler { /** * Handles given MotionEvent. * @param event the event to be handled. |
︙ | ︙ |