public void
onKeyDown (int keyCode, KeyEvent event)
{
- int state, state_1;
+ int state, state_1, num_lock_flag;
long serial;
String characters;
state = eventModifiers (event);
+ /* Num Lock and Scroll Lock aren't supported by systems older than
+ Android 3.0. */
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
+ num_lock_flag = (KeyEvent.META_NUM_LOCK_ON
+ | KeyEvent.META_SCROLL_LOCK_ON);
+ else
+ num_lock_flag = 0;
+
/* Ignore meta-state understood by Emacs for now, or key presses
such as Ctrl+C and Meta+C will not be recognized as an ASCII
key press event. */
state_1
= state & ~(KeyEvent.META_ALT_MASK | KeyEvent.META_CTRL_MASK
- | KeyEvent.META_SYM_ON | KeyEvent.META_META_MASK);
+ | KeyEvent.META_SYM_ON | KeyEvent.META_META_MASK
+ | num_lock_flag);
synchronized (eventStrings)
{
public void
onKeyUp (int keyCode, KeyEvent event)
{
- int state, state_1, unicode_char;
+ int state, state_1, unicode_char, num_lock_flag;
long time;
/* Compute the event's modifier mask. */
state = eventModifiers (event);
+ /* Num Lock and Scroll Lock aren't supported by systems older than
+ Android 3.0. */
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
+ num_lock_flag = (KeyEvent.META_NUM_LOCK_ON
+ | KeyEvent.META_SCROLL_LOCK_ON);
+ else
+ num_lock_flag = 0;
+
/* Ignore meta-state understood by Emacs for now, or key presses
such as Ctrl+C and Meta+C will not be recognized as an ASCII
key press event. */
state_1
= state & ~(KeyEvent.META_ALT_MASK | KeyEvent.META_CTRL_MASK
- | KeyEvent.META_SYM_ON | KeyEvent.META_META_MASK);
+ | KeyEvent.META_SYM_ON | KeyEvent.META_META_MASK
+ | num_lock_flag);
unicode_char = getEventUnicodeChar (event, state_1);