Bug 480314

Summary: Remote keyboard fail to enter Chinese characters
Product: [Applications] kdeconnect Reporter: Harold Z <zhangzhigang1996>
Component: commonAssignee: Albert Vaca Cintora <albertvaka>
Status: REPORTED ---    
Severity: normal CC: andrew.g.r.holmes, chen73559
Priority: NOR    
Version First Reported In: 23.08.4   
Target Milestone: ---   
Platform: Kubuntu   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Harold Z 2024-01-25 11:34:00 UTC
SUMMARY
***
Remote keyboard fail to enter Chinese characters
***


STEPS TO REPRODUCE
1. Change the input method into kde remote keyboard
2. Input one Chinese character
3. input something on the text field on laptop

OBSERVED RESULT

The numbers and letters on keyboard can be input while Chinese characters and emoticon are remain in the text field and not send from the phone.

EXPECTED RESULT

Input a Chinese characters can be show in the laptor side

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: kubuntu 22.04
(available in About System)
KDE Plasma Version: 5.27.5
KDE Frameworks Version: 5.106
Qt Version: 5.15.10

ADDITIONAL INFORMATION
Comment 1 Harold Z 2024-01-25 11:42:47 UTC
Add debug code:


diff --git a/plugins/mousepad/waylandremoteinput.cpp b/plugins/mousepad/waylandremoteinput.cpp
index eb10810b..e1e816ec 100644
--- a/plugins/mousepad/waylandremoteinput.cpp
+++ b/plugins/mousepad/waylandremoteinput.cpp
@@ -6,7 +6,7 @@
  */
 
 #include "waylandremoteinput.h"
-
+#include <iostream>
 #include <QDebug>
 #include <QSizeF>
 
@@ -197,6 +197,10 @@ bool WaylandRemoteInput::handlePacket(const NetworkPacket &np)
     const QString key = np.get<QString>(QStringLiteral("key"), QLatin1String(""));
     const int specialKey = np.get<int>(QStringLiteral("specialKey"), 0);
 
+    if (!key.isEmpty()) {
+        std::cout << "key.toStdString:" << key.toStdString() << std::endl;
+    }
+
     if (isSingleClick || isDoubleClick || isMiddleClick || isRightClick || isSingleHold || isSingleRelease || isScroll || !key.isEmpty() || specialKey) {
         if (isSingleClick) {
             s_session->iface->NotifyPointerButton(s_session->m_xdpPath, {}, BTN_LEFT, 1);
@@ -241,10 +245,13 @@ bool WaylandRemoteInput::handlePacket(const NetworkPacket &np)
             } else if (!key.isEmpty()) {
                 for (const QChar character : key) {
                     const auto keysym = xkb_utf32_to_keysym(character.toLower().unicode());
+                    std::cout << "zzg:xkb_utf32_to_keysym:[" << character.toLower().unicode() << "],[" << keysym << ']' << std::endl;
                     if (keysym != XKB_KEY_NoSymbol) {
+                        std::cout << "zzg:xkb_utf32_to_keysym:[keysym != XKB_KEY_NoSymbol]" << std::endl;
                         s_session->iface->NotifyKeyboardKeysym(s_session->m_xdpPath, {}, keysym, 1).waitForFinished();
                         s_session->iface->NotifyKeyboardKeysym(s_session->m_xdpPath, {}, keysym, 0).waitForFinished();
                     } else {
+                        std::cout << "zzg:xkb_utf32_to_keysym:[Cannot send character]" << std::endl;
                         qCDebug(KDECONNECT_PLUGIN_MOUSEPAD) << "Cannot send character" << character;
                     }
                 }




log:

key.toStdString:hello
zzg:xkb_utf32_to_keysym:[104],[104]
zzg:xkb_utf32_to_keysym:[keysym != XKB_KEY_NoSymbol]
zzg:xkb_utf32_to_keysym:[101],[101]
zzg:xkb_utf32_to_keysym:[keysym != XKB_KEY_NoSymbol]
zzg:xkb_utf32_to_keysym:[108],[108]
zzg:xkb_utf32_to_keysym:[keysym != XKB_KEY_NoSymbol]
zzg:xkb_utf32_to_keysym:[108],[108]
zzg:xkb_utf32_to_keysym:[keysym != XKB_KEY_NoSymbol]
zzg:xkb_utf32_to_keysym:[111],[111]
zzg:xkb_utf32_to_keysym:[keysym != XKB_KEY_NoSymbol]
key.toStdString:你好
zzg:xkb_utf32_to_keysym:[20320],[16797536]
zzg:xkb_utf32_to_keysym:[keysym != XKB_KEY_NoSymbol]
zzg:xkb_utf32_to_keysym:[22909],[16800125]
zzg:xkb_utf32_to_keysym:[keysym != XKB_KEY_NoSymbol]
key.toStdString:👌🏻
zzg:xkb_utf32_to_keysym:[55357],[16832573]
zzg:xkb_utf32_to_keysym:[keysym != XKB_KEY_NoSymbol]
zzg:xkb_utf32_to_keysym:[56396],[16833612]
zzg:xkb_utf32_to_keysym:[keysym != XKB_KEY_NoSymbol]
zzg:xkb_utf32_to_keysym:[55356],[16832572]
zzg:xkb_utf32_to_keysym:[keysym != XKB_KEY_NoSymbol]
zzg:xkb_utf32_to_keysym:[57339],[16834555]
zzg:xkb_utf32_to_keysym:[keysym != XKB_KEY_NoSymbol]
key.toStdString:👌🏻👌🏻👌🏻
zzg:xkb_utf32_to_keysym:[55357],[16832573]
zzg:xkb_utf32_to_keysym:[keysym != XKB_KEY_NoSymbol]
zzg:xkb_utf32_to_keysym:[56396],[16833612]
zzg:xkb_utf32_to_keysym:[keysym != XKB_KEY_NoSymbol]
zzg:xkb_utf32_to_keysym:[55356],[16832572]
zzg:xkb_utf32_to_keysym:[keysym != XKB_KEY_NoSymbol]
zzg:xkb_utf32_to_keysym:[57339],[16834555]
zzg:xkb_utf32_to_keysym:[keysym != XKB_KEY_NoSymbol]
zzg:xkb_utf32_to_keysym:[55357],[16832573]
zzg:xkb_utf32_to_keysym:[keysym != XKB_KEY_NoSymbol]
zzg:xkb_utf32_to_keysym:[56396],[16833612]
zzg:xkb_utf32_to_keysym:[keysym != XKB_KEY_NoSymbol]
zzg:xkb_utf32_to_keysym:[55356],[16832572]
zzg:xkb_utf32_to_keysym:[keysym != XKB_KEY_NoSymbol]
zzg:xkb_utf32_to_keysym:[57339],[16834555]
zzg:xkb_utf32_to_keysym:[keysym != XKB_KEY_NoSymbol]
zzg:xkb_utf32_to_keysym:[55357],[16832573]
zzg:xkb_utf32_to_keysym:[keysym != XKB_KEY_NoSymbol]
zzg:xkb_utf32_to_keysym:[56396],[16833612]
zzg:xkb_utf32_to_keysym:[keysym != XKB_KEY_NoSymbol]
zzg:xkb_utf32_to_keysym:[55356],[16832572]
zzg:xkb_utf32_to_keysym:[keysym != XKB_KEY_NoSymbol]
zzg:xkb_utf32_to_keysym:[57339],[16834555]
zzg:xkb_utf32_to_keysym:[keysym != XKB_KEY_NoSymbol]
Comment 2 Harold Z 2024-01-25 11:58:11 UTC
In xdg-desktop-portal-1.16.0, add debug code, Correct message can be received.

diff --git a/src/remote-desktop.c b/src/remote-desktop.c
index f450d69..104e502 100644
--- a/src/remote-desktop.c
+++ b/src/remote-desktop.c
@@ -17,7 +17,7 @@
  */
 
 #include "config.h"
-
+#include <stdio.h>
 #include "remote-desktop.h"
 #include "screen-cast.h"
 #include "request.h"
@@ -1141,6 +1141,7 @@ handle_notify_keyboard_keysym (XdpDbusRemoteDesktop *object,
       return G_DBUS_METHOD_INVOCATION_HANDLED;
     }
   options = g_variant_builder_end (&options_builder);
+  printf("xxxxxxxxxxxxxxxxxxxxxxxxxxxxx:keysym:[%d]\n", keysym);
 
   xdp_dbus_impl_remote_desktop_call_notify_keyboard_keysym (impl,
                                                             session->id,
Comment 3 Harold Z 2024-01-25 12:05:51 UTC
Using kdeconnect 23.0.8 on Windows 11, can input normally, and you can also use voice input on the mobile phone.
Comment 4 Harold Z 2024-01-25 12:08:46 UTC
The kde connect version used by Android phones is 1.29.0
Comment 5 Harold Z 2024-01-26 02:23:37 UTC
The system uses the wayland protocol.
Comment 6 Alan 2024-01-27 11:58:08 UTC
(In reply to Harold Z from comment #3)
> Using kdeconnect 23.0.8 on Windows 11, can input normally, and you can also
> use voice input on the mobile phone.

Do you mean inputting from windows to android? Using 23.8.4 on Windows 10, I tried inputing some chinese characters with Microsoft IME and Android side could not receive it
Comment 7 Alan 2024-01-27 12:08:14 UTC
Maybe the problem is rooted from the interaction with input method?  On Windows kdeconnect coult not handle the strings from input method.
Comment 8 Harold Z 2024-01-29 06:18:32 UTC
(In reply to Alan from comment #6)
> (In reply to Harold Z from comment #3)
> > Using kdeconnect 23.0.8 on Windows 11, can input normally, and you can also
> > use voice input on the mobile phone.
> 
> Do you mean inputting from windows to android? Using 23.8.4 on Windows 10, I
> tried inputing some chinese characters with Microsoft IME and Android side
> could not receive it


Sorry for not describing the problem clearly.
I mean is inputting from android to Windows.