From a04527882248a43f9ecdc1cd2886659f8a97f526 Mon Sep 17 00:00:00 2001 From: Weixuan Xiao Date: Thu, 28 Apr 2022 12:40:53 +0000 Subject: [PATCH] Fix and improve unicode input on macOS and Windows Unicode text input from remote devices gives random texts because the plugin mistook the text encoding. Insert a Unicode 16 bits character each time instead of a UTF-8 character. The API accepts the `UniChar` Unicode characters: ```c void CGEventKeyboardSetUnicodeString(CGEventRef event, UniCharCount stringLength, const UniChar *unicodeString); ``` from https://developer.apple.com/documentation/coregraphics/1456028-cgeventkeyboardsetunicodestring. --- plugins/mousepad/macosremoteinput.mm | 10 ++++------ plugins/mousepad/windowsremoteinput.cpp | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/plugins/mousepad/macosremoteinput.mm b/plugins/mousepad/macosremoteinput.mm index 79dcb8129..e93e03b43 100644 --- a/plugins/mousepad/macosremoteinput.mm +++ b/plugins/mousepad/macosremoteinput.mm @@ -178,16 +178,14 @@ bool MacOSRemoteInput::handlePacket(const NetworkPacket& np) CFRelease(specialKeyDownEvent); CFRelease(specialKeyUpEvent); } else { - for (int i=0;i