Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Greek accent/dead key support #1240

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion app/src/main/assets/layouts/greek.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
{ "label": "η" },
{ "label": "ξ" },
{ "label": "κ" },
{ "label": "λ" }
{ "label": "λ" },
{ "$": "shift_state_selector",
"shiftedManual": { "code": 776, "label": "¨", "isDeadKey": true },
"default": { "code": 769, "label": "´", "isDeadKey": true }
}
],
[
{ "label": "ζ" },
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/helium314/keyboard/event/Event.kt
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ class Event private constructor(
}

// This creates an input event for a dead character. @see {@link #FLAG_DEAD}
@JvmStatic
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.
return Event(EVENT_TYPE_INPUT_KEYPRESS, null, codePoint, keyCode, metaState,
Constants.EXTERNAL_KEYBOARD_COORDINATE, Constants.EXTERNAL_KEYBOARD_COORDINATE,
Expand Down
10 changes: 9 additions & 1 deletion app/src/main/java/helium314/keyboard/latin/LatinIME.java
Original file line number Diff line number Diff line change
Expand Up @@ -1494,7 +1494,15 @@ public void onCodeInput(final int codePoint, final int metaState, final int x, f
// 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.createDeadEvent(codePoint, 0, metaState, null);
} else {
event = createSoftwareKeypressEvent(codePoint, metaState, keyX, keyY, isKeyRepeat);
}

onEvent(event);
}

Expand Down
Loading