abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2/Keyboard2.java
diff options
context:
space:
mode:
authorJules Aguillon2022-02-22 19:32:16 +0100
committerJules Aguillon2022-02-22 19:32:16 +0100
commit14dabb6f519275a800f1fbf13620f420555b0d0c (patch)
treed757a0deeaba8639e75635b05dcb038159436b43 /srcs/juloo.keyboard2/Keyboard2.java
parent84bce23fec5a551839d621f9ac20ba2127f01e29 (diff)
downloadunexpected-keyboard-14dabb6f519275a800f1fbf13620f420555b0d0c.tar.gz
unexpected-keyboard-14dabb6f519275a800f1fbf13620f420555b0d0c.zip
Send key events for the modifiers
Before sending a key event while modifiers are active, send events for the modifier keys. Some applications don't look at the "metaState" flags but instead keep track of the up and down events for the modifiers. For example, the basic text views that are in every applications correctly handle the "metaState" flags except for one binding: Selecting text with the arrows while pressing shift.
Diffstat (limited to 'srcs/juloo.keyboard2/Keyboard2.java')
-rw-r--r--srcs/juloo.keyboard2/Keyboard2.java6
1 files changed, 2 insertions, 4 deletions
diff --git a/srcs/juloo.keyboard2/Keyboard2.java b/srcs/juloo.keyboard2/Keyboard2.java
index 0ce3af8..44b36a1 100644
--- a/srcs/juloo.keyboard2/Keyboard2.java
+++ b/srcs/juloo.keyboard2/Keyboard2.java
@@ -256,14 +256,12 @@ public class Keyboard2 extends InputMethodService
_keyboardView.setKeyboard(getLayout(res_id));
}
- public void sendKeyEvent(int eventCode, int meta)
+ public void sendKeyEvent(int eventAction, int eventCode, int meta)
{
InputConnection conn = getCurrentInputConnection();
if (conn == null)
return;
- KeyEvent event = new KeyEvent(1, 1, KeyEvent.ACTION_DOWN, eventCode, 0, meta);
- conn.sendKeyEvent(event);
- conn.sendKeyEvent(KeyEvent.changeAction(event, KeyEvent.ACTION_UP));
+ conn.sendKeyEvent(new KeyEvent(1, 1, eventAction, eventCode, 0, meta));
}
public void showKeyboardConfig()