-
-
Notifications
You must be signed in to change notification settings - Fork 378
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1ed4c7b
commit 844a78a
Showing
4 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2015 - 2024 Rime community | ||
* SPDX-License-Identifier: GPL-3.0-or-later | ||
*/ | ||
|
||
package com.osfans.trime.core | ||
|
||
data class RimeKeyEvent( | ||
val value: Int, | ||
val modifiers: Int, | ||
val repr: String, | ||
) { | ||
val keyVal by lazy { KeyValue(value) } | ||
|
||
val keyModifiers by lazy { KeyModifiers.of(modifiers) } | ||
|
||
override fun toString() = repr | ||
|
||
companion object { | ||
val None = RimeKeyEvent(0, 0, "0x0000") | ||
|
||
@JvmStatic | ||
external fun parse(repr: String): RimeKeyEvent | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// SPDX-FileCopyrightText: 2015 - 2024 Rime community | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
#include <rime/key_event.h> | ||
|
||
#include "jni-utils.h" | ||
|
||
extern "C" JNIEXPORT jobject JNICALL | ||
Java_com_osfans_trime_core_RimeKeyEvent_parse(JNIEnv *env, jclass clazz, | ||
jstring repr) { | ||
rime::KeyEvent ke; | ||
ke.Parse(*CString(env, repr)); | ||
return env->NewObject(GlobalRef->KeyEvent, GlobalRef->KeyEventInit, | ||
ke.keycode(), ke.modifier(), *JString(env, ke.repr())); | ||
} |