From 95c8acc31e53f2b98a97ca421621fd8a9cb72cfd Mon Sep 17 00:00:00 2001
From: Jules Aguillon
Date: Sun, 6 Feb 2022 23:01:35 +0100
Subject: Add the Meta key
Currently using the diamond symbol like the history meta key: https://en.wikipedia.org/wiki/Meta_key
However, this key is actually interpreted as the Super/Windows key but
Android calls it "meta" internally.
---
res/xml/qwerty.xml | 2 +-
srcs/juloo.keyboard2/KeyEventHandler.java | 4 +++-
srcs/juloo.keyboard2/KeyValue.java | 2 ++
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/res/xml/qwerty.xml b/res/xml/qwerty.xml
index 73b41a5..0402292 100644
--- a/res/xml/qwerty.xml
+++ b/res/xml/qwerty.xml
@@ -35,7 +35,7 @@
-
+
diff --git a/srcs/juloo.keyboard2/KeyEventHandler.java b/srcs/juloo.keyboard2/KeyEventHandler.java
index 39e56d5..dad6642 100644
--- a/srcs/juloo.keyboard2/KeyEventHandler.java
+++ b/srcs/juloo.keyboard2/KeyEventHandler.java
@@ -24,7 +24,7 @@ class KeyEventHandler implements Config.IKeyEventHandler
case KeyValue.EVENT_CHANGE_METHOD: _recv.switchToNextInputMethod(); return;
case KeyValue.EVENT_ACTION: _recv.performAction(); return;
default:
- if ((flags & (KeyValue.FLAG_CTRL | KeyValue.FLAG_ALT)) != 0)
+ if ((flags & (KeyValue.FLAG_CTRL | KeyValue.FLAG_ALT | KeyValue.FLAG_META)) != 0)
handleMetaKeyUp(key, flags);
else if (key.char_ != KeyValue.CHAR_NONE)
_recv.commitChar(key.char_);
@@ -56,6 +56,8 @@ class KeyEventHandler implements Config.IKeyEventHandler
meta |= KeyEvent.META_ALT_LEFT_ON | KeyEvent.META_ALT_ON;
if ((flags & KeyValue.FLAG_SHIFT) != 0)
meta |= KeyEvent.META_SHIFT_LEFT_ON | KeyEvent.META_SHIFT_ON;
+ if ((flags & KeyValue.FLAG_META) != 0)
+ meta |= KeyEvent.META_META_LEFT_ON | KeyEvent.META_META_ON;
_recv.sendKeyEvent(key.eventCode, meta);
}
diff --git a/srcs/juloo.keyboard2/KeyValue.java b/srcs/juloo.keyboard2/KeyValue.java
index 7addcb2..5461f9f 100644
--- a/srcs/juloo.keyboard2/KeyValue.java
+++ b/srcs/juloo.keyboard2/KeyValue.java
@@ -32,6 +32,7 @@ class KeyValue
public static final int FLAG_SHIFT = (1 << 11);
public static final int FLAG_ALT = (1 << 12);
public static final int FLAG_FN = (1 << 13);
+ public static final int FLAG_META = (1 << 14);
// Accent flags
public static final int FLAG_ACCENT1 = (1 << 16); // Grave
@@ -159,6 +160,7 @@ class KeyValue
addModifierKey("superscript", "◌͆", FLAG_ACCENT_SUPERSCRIPT);
addModifierKey("subscript", "◌̺", FLAG_ACCENT_SUBSCRIPT);
addModifierKey("fn", "Fn", FLAG_FN);
+ addModifierKey("meta", "◆", FLAG_META);
addCharKey('a', KeyEvent.KEYCODE_A);
addCharKey('b', KeyEvent.KEYCODE_B);
--
cgit v1.2.3