From: Armin Novak Date: Thu, 7 Feb 2019 14:58:55 +0000 (+0100) Subject: Fixed unicode key down and up messages. X-Git-Tag: 2.0.0~495^2~24 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=281dd2206126d8ab2b194008764d7a86686d0e58;p=platform%2Fupstream%2Ffreerdp.git Fixed unicode key down and up messages. --- diff --git a/client/Android/Studio/freeRDPCore/src/main/java/com/freerdp/freerdpcore/presentation/SessionActivity.java b/client/Android/Studio/freeRDPCore/src/main/java/com/freerdp/freerdpcore/presentation/SessionActivity.java index 81cb993..c148c71 100644 --- a/client/Android/Studio/freeRDPCore/src/main/java/com/freerdp/freerdpcore/presentation/SessionActivity.java +++ b/client/Android/Studio/freeRDPCore/src/main/java/com/freerdp/freerdpcore/presentation/SessionActivity.java @@ -726,7 +726,8 @@ public class SessionActivity extends AppCompatActivity implements @Override public void processUnicodeKey(int unicodeKey) { - LibFreeRDP.sendUnicodeKeyEvent(session.getInstance(), unicodeKey); + LibFreeRDP.sendUnicodeKeyEvent(session.getInstance(), unicodeKey, true); + LibFreeRDP.sendUnicodeKeyEvent(session.getInstance(), unicodeKey, false); } @Override diff --git a/client/Android/Studio/freeRDPCore/src/main/java/com/freerdp/freerdpcore/services/LibFreeRDP.java b/client/Android/Studio/freeRDPCore/src/main/java/com/freerdp/freerdpcore/services/LibFreeRDP.java index d01e8db..686b5c2 100644 --- a/client/Android/Studio/freeRDPCore/src/main/java/com/freerdp/freerdpcore/services/LibFreeRDP.java +++ b/client/Android/Studio/freeRDPCore/src/main/java/com/freerdp/freerdpcore/services/LibFreeRDP.java @@ -82,7 +82,7 @@ public class LibFreeRDP { 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); @@ -357,8 +357,8 @@ public class LibFreeRDP { 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) { diff --git a/client/Android/android_event.c b/client/Android/android_event.c index de04157..7b764ac 100644 --- a/client/Android/android_event.c +++ b/client/Android/android_event.c @@ -195,7 +195,7 @@ static void android_event_key_free(ANDROID_EVENT_KEY* event) 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)); @@ -204,6 +204,7 @@ ANDROID_EVENT_KEY* android_event_unicodekey_new(UINT16 key) return NULL; event->type = EVENT_TYPE_KEY_UNICODE; + event->flags = flags; event->scancode = key; return event; } diff --git a/client/Android/android_event.h b/client/Android/android_event.h index 584d672..1110a87 100644 --- a/client/Android/android_event.h +++ b/client/Android/android_event.h @@ -67,7 +67,7 @@ FREERDP_LOCAL BOOL android_check_handle(freerdp* inst); 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); diff --git a/client/Android/android_freerdp.c b/client/Android/android_freerdp.c index f4a70e7..00d4489 100644 --- a/client/Android/android_freerdp.c +++ b/client/Android/android_freerdp.c @@ -975,11 +975,12 @@ static jboolean JNICALL jni_freerdp_send_key_event( } 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; diff --git a/libfreerdp/core/input.c b/libfreerdp/core/input.c index e199ae9..216817d 100644 --- a/libfreerdp/core/input.c +++ b/libfreerdp/core/input.c @@ -130,7 +130,6 @@ static void input_write_unicode_keyboard_event(wStream* s, UINT16 flags, UINT16 static BOOL input_send_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code) { wStream* s; - UINT16 keyboardFlags = 0; rdpRdp* rdp; if (!input || !input->context) @@ -143,16 +142,6 @@ static BOOL input_send_unicode_keyboard_event(rdpInput* input, UINT16 flags, UIN } 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)