mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-26 09:36:50 +00:00
Greek accent/dead key support (#1240)
Greek accent/dead key support: simplify by making every combining accent key a dead key --------- Co-authored-by: Helium314 <helium314@mailbox.org>
This commit is contained in:
parent
4638709db5
commit
0076f04639
3 changed files with 22 additions and 3 deletions
|
@ -23,7 +23,11 @@
|
|||
{ "label": "η" },
|
||||
{ "label": "ξ" },
|
||||
{ "label": "κ" },
|
||||
{ "label": "λ" }
|
||||
{ "label": "λ" },
|
||||
{ "$": "shift_state_selector",
|
||||
"shiftedManual": { "code": 776, "label": "¨" },
|
||||
"default": { "code": 769, "label": "´" }
|
||||
}
|
||||
],
|
||||
[
|
||||
{ "label": "ζ" },
|
||||
|
|
|
@ -146,12 +146,19 @@ class Event private constructor(
|
|||
}
|
||||
|
||||
// This creates an input event for a dead character. @see {@link #FLAG_DEAD}
|
||||
fun createDeadEvent(codePoint: Int, keyCode: Int, metaState: Int, next: Event?): Event { // TODO: add an argument or something if we ever create a software layout with dead keys.
|
||||
fun createDeadEvent(codePoint: Int, keyCode: Int, metaState: Int, next: Event?): Event {
|
||||
return Event(EVENT_TYPE_INPUT_KEYPRESS, null, codePoint, keyCode, metaState,
|
||||
Constants.EXTERNAL_KEYBOARD_COORDINATE, Constants.EXTERNAL_KEYBOARD_COORDINATE,
|
||||
null, FLAG_DEAD, next)
|
||||
}
|
||||
|
||||
// This creates an input event for a dead character. @see {@link #FLAG_DEAD}
|
||||
@JvmStatic
|
||||
fun createSoftwareDeadEvent(codePoint: Int, keyCode: Int, metaState: Int, x: Int, y: Int, next: Event?): Event {
|
||||
return Event(EVENT_TYPE_INPUT_KEYPRESS, null, codePoint, keyCode, metaState, x, y,
|
||||
null, FLAG_DEAD, next)
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an input event with nothing but a code point. This is the most basic possible input
|
||||
* event; it contains no information on many things the IME requires to function correctly,
|
||||
|
|
|
@ -1496,7 +1496,15 @@ public class LatinIME extends InputMethodService implements
|
|||
// this transformation, it should be done already before calling onEvent.
|
||||
final int keyX = mainKeyboardView.getKeyX(x);
|
||||
final int keyY = mainKeyboardView.getKeyY(y);
|
||||
final Event event = createSoftwareKeypressEvent(codePoint, metaState, keyX, keyY, isKeyRepeat);
|
||||
final Event event;
|
||||
|
||||
// checking if the character is a combining accent
|
||||
if (0x300 <= codePoint && codePoint <= 0x35b) {
|
||||
event = Event.createSoftwareDeadEvent(codePoint, 0, metaState, x, y, null);
|
||||
} else {
|
||||
event = createSoftwareKeypressEvent(codePoint, metaState, keyX, keyY, isKeyRepeat);
|
||||
}
|
||||
|
||||
onEvent(event);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue