@Override
public void processUnicodeKey(int unicodeKey) {
- LibFreeRDP.sendUnicodeKeyEvent(session.getInstance(), unicodeKey);
+ LibFreeRDP.sendUnicodeKeyEvent(session.getInstance(), unicodeKey, true);
+ LibFreeRDP.sendUnicodeKeyEvent(session.getInstance(), unicodeKey, false);
}
@Override
private static native boolean freerdp_send_key_event(long inst, int keycode, boolean down);
- private static native boolean freerdp_send_unicodekey_event(long inst, int keycode);
+ private static native boolean freerdp_send_unicodekey_event(long inst, int keycode, boolean down);
private static native boolean freerdp_send_clipboard_data(long inst, String data);
return freerdp_send_key_event(inst, keycode, down);
}
- public static boolean sendUnicodeKeyEvent(long inst, int keycode) {
- return freerdp_send_unicodekey_event(inst, keycode);
+ public static boolean sendUnicodeKeyEvent(long inst, int keycode, boolean down) {
+ return freerdp_send_unicodekey_event(inst, keycode, down);
}
public static boolean sendClipboardData(long inst, String data) {
free(event);
}
-ANDROID_EVENT_KEY* android_event_unicodekey_new(UINT16 key)
+ANDROID_EVENT_KEY* android_event_unicodekey_new(UINT16 flags, UINT16 key)
{
ANDROID_EVENT_KEY* event;
event = (ANDROID_EVENT_KEY*) calloc(1, sizeof(ANDROID_EVENT_KEY));
return NULL;
event->type = EVENT_TYPE_KEY_UNICODE;
+ event->flags = flags;
event->scancode = key;
return event;
}
FREERDP_LOCAL ANDROID_EVENT_KEY* android_event_key_new(int flags,
UINT16 scancode);
-FREERDP_LOCAL ANDROID_EVENT_KEY* android_event_unicodekey_new(UINT16 key);
+FREERDP_LOCAL ANDROID_EVENT_KEY* android_event_unicodekey_new(UINT16 flags, UINT16 key);
FREERDP_LOCAL ANDROID_EVENT_CURSOR* android_event_cursor_new(UINT16 flags,
UINT16 x, UINT16 y);
FREERDP_LOCAL ANDROID_EVENT* android_event_disconnect_new(void);
}
static jboolean JNICALL jni_freerdp_send_unicodekey_event(
- JNIEnv* env, jclass cls, jlong instance, jint keycode)
+ JNIEnv* env, jclass cls, jlong instance, jint keycode, jboolean down)
{
ANDROID_EVENT* event;
freerdp* inst = (freerdp*)instance;
- event = (ANDROID_EVENT*) android_event_unicodekey_new(keycode);
+ UINT16 flags = (down == JNI_TRUE) ? 0 : KBD_FLAGS_RELEASE;
+ event = (ANDROID_EVENT*) android_event_unicodekey_new(flags, keycode);
if (!event)
return JNI_FALSE;
static BOOL input_send_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
{
wStream* s;
- UINT16 keyboardFlags = 0;
rdpRdp* rdp;
if (!input || !input->context)
}
rdp = input->context->rdp;
- /*
- * According to the specification, the slow path Unicode Keyboard Event
- * (TS_UNICODE_KEYBOARD_EVENT) contains KBD_FLAGS_RELEASE flag when key
- * is released, but contains no flags when it is pressed.
- * This is different from the slow path Keyboard Event
- * (TS_KEYBOARD_EVENT) which does contain KBD_FLAGS_DOWN flag when the
- * key is pressed.
- * There is no KBD_FLAGS_EXTENDED flag in TS_UNICODE_KEYBOARD_EVENT.
- */
- keyboardFlags |= (flags & KBD_FLAGS_RELEASE) ? KBD_FLAGS_RELEASE : 0;
s = rdp_client_input_pdu_init(rdp, INPUT_EVENT_UNICODE);
if (!s)