| Summary: | pipe(|) char can not be input by jp keyboard, because the key between hat(^) and BS does not work. | ||
|---|---|---|---|
| Product: | [Applications] krdc | Reporter: | H. Matsuura <h-pineinlet.kd1> |
| Component: | RDP | Assignee: | Urs Wolfer <uwolfer> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | ctrlaltca |
| Priority: | NOR | ||
| Version First Reported In: | 25.12.0 | ||
| Target Milestone: | --- | ||
| Platform: | Neon | ||
| OS: | Linux | ||
| Latest Commit: | https://invent.kde.org/network/krdc/-/commit/d44f24e1f5114d307a16148878274d9e9456a80c | Version Fixed/Implemented In: | 25.12.2 |
| Sentry Crash Report: | |||
|
Description
H. Matsuura
2026-01-06 19:30:41 UTC
When connecting with the following command in FreerRDP version 3.10.3, the key functioned correctly. xfreerdp3 /v:192.168.2.65 (192.168.2.65 is the target Windows 11 Pro machine) I noticed the code starting at line 140 in the following FreeRDP code for Japanese keyboards. https://github.com/FreeRDP/FreeRDP/blob/master/libfreerdp/core/freerdp.c I cloned KRDC from GitHub and tried modifying line 575 onwards in rdpsession.cpp as follows, but it didn't work. if (!freerdp_settings_set_uint32(settings, FreeRDP_KeyboardLayout, preferences->rdpKeyboardLayout())) { return -1; } qCInfo(KRDC) << "Keyboard Layout:" << preferences->rdpKeyboardLayout(); switch ((unsigned int) preferences->rdpKeyboardLayout()) { case KBD_JAPANESE: case KBD_JAPANESE_INPUT_SYSTEM_MS_IME2002: qInfo() << "JAPANESE Keyboard"; if(!freerdp_settings_set_uint32(settings, FreeRDP_KeyboardType, WINPR_KBD_TYPE_JAPANESE)) { return -1; } if(!freerdp_settings_set_uint32(settings, FreeRDP_KeyboardSubType, 2)) { return -1; } break; default: break; } Please let me know if there's anything else I should check. In addition to the previous fix, modifying the start of the RdpSession::sendEvent function in the rdpsession.cpp file as follows enable the key to work.
(Other keys that previously didn't work, such as “Muhenkan” and “Henkan”, now function.)
However, I'm not sure that this approach—get the key type with freerdp_settings_get_uint32 every time this event occurs—is optimal.
If it seems acceptable, I'll clean up the code and submit a merge request.
bool RdpSession::sendEvent(QEvent *event, QWidget *source)
{
auto input = m_context.rdp->input;
auto settings = m_context.rdp->settings;
auto keytype = freerdp_settings_get_uint32(settings, FreeRDP_KeyboardType);
switch (event->type()) {
case QEvent::KeyPress:
case QEvent::KeyRelease: {
if (m_needKeyStateSync) {
m_needKeyStateSync = false;
syncKeyState();
}
auto keyEvent = static_cast<QKeyEvent *>(event);
const DWORD vc = GetVirtualKeyCodeFromKeycode(keyEvent->nativeScanCode(), WINPR_KEYCODE_TYPE_XKB);
//const DWORD code = GetVirtualScanCodeFromVirtualKeyCode(vc, WINPR_KBD_TYPE_IBM_ENHANCED);
const DWORD code = GetVirtualScanCodeFromVirtualKeyCode(vc, keytype);
freerdp_input_send_keyboard_event_ex(input, keyEvent->type() == QEvent::KeyPress, keyEvent->isAutoRepeat(), code);
return true;
}
case QEvent::MouseButtonPress:
(the rest is omitted.)
A possibly relevant merge request was started @ https://invent.kde.org/network/krdc/-/merge_requests/221 Thank you Mr. Matsuura for debugging this issue! Otherway it would have been really hard for me, not owning a japanese keyboard. Your patch has been submitted as MR https://invent.kde.org/network/krdc/-/merge_requests/221 Please note that it only includes the second patch from Comment 2 (https://bugs.kde.org/show_bug.cgi?id=514241#c2) , since the patch from Comment 1 (https://bugs.kde.org/show_bug.cgi?id=514241#c1) is already available upstream: https://github.com/FreeRDP/FreeRDP/blob/c120c768254e807db17145184568b9c4b96f0611/libfreerdp/core/freerdp.c#L140 From my tests it doesn't break anything on western layouts (I tested it_IT, en_US and fr_FR) and the additional call to freerdp_settings_get_uint32() causes no additional overhead. Thank you for submitting the merge request. Also, as you mentioned, I've confirmed that it works correctly even without the patch in Comment 1, so I wanted to let you know. Git commit 9cbf7050569570347928604f2887e270545b0f17 by Fabio Bas. Committed on 13/01/2026 at 09:44. Pushed by ctrlaltca into branch 'master'. Rdp: set the correct keyboardType; fix local input of some chars on japanese keyboards. M +2 -1 rdp/rdpsession.cpp https://invent.kde.org/network/krdc/-/commit/9cbf7050569570347928604f2887e270545b0f17 Thank you for the confirmation, I've merged the patch and backported to the stable branch so that it will be available on next version 25.12.2 (released on February 2) Git commit d44f24e1f5114d307a16148878274d9e9456a80c by Fabio Bas. Committed on 13/01/2026 at 15:54. Pushed by ctrlaltca into branch 'release/25.12'. Rdp: set the correct keyboardType; fix local input of some chars on japanese keyboards. (cherry picked from commit 9cbf7050569570347928604f2887e270545b0f17) Co-authored-by: Fabio Bas <ctrlaltca@gmail.com> M +2 -1 rdp/rdpsession.cpp https://invent.kde.org/network/krdc/-/commit/d44f24e1f5114d307a16148878274d9e9456a80c |