Skip to content

Commit

Permalink
more keybd fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
elfmz committed Nov 18, 2024
1 parent 2f38afe commit 9d4d3fe
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
15 changes: 14 additions & 1 deletion WinPort/src/Backend/TTY/TTYInputSequenceParserExts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,13 +378,26 @@ size_t TTYInputSequenceParser::TryParseAsKittyEscapeSequence(const char *s, size
if ((modif_state & KITTY_MOD_CAPSLOCK) && !(modif_state & KITTY_MOD_SHIFT)) {
// it's weird, but kitty can not give us uppercase utf8 in caps lock mode
// ("text-as-codepoints" mode should solve it, but it is not working for cyrillic chars for unknown reason)
ir.Event.KeyEvent.uChar.UnicodeChar = towupper(ir.Event.KeyEvent.uChar.UnicodeChar);
// ir.Event.KeyEvent.uChar.UnicodeChar = towupper(ir.Event.KeyEvent.uChar.UnicodeChar);
WINPORT(CharUpperBuff)(&ir.Event.KeyEvent.uChar.UnicodeChar, 1);
}

ir.Event.KeyEvent.bKeyDown = (event_type != KITTY_EVT_KEYUP) ? 1 : 0;

ir.Event.KeyEvent.wRepeatCount = 0;

if ((ir.Event.KeyEvent.dwControlKeyState & LEFT_ALT_PRESSED) ||
(ir.Event.KeyEvent.dwControlKeyState & RIGHT_ALT_PRESSED)) {
switch (ir.Event.KeyEvent.wVirtualKeyCode) {
case VK_ESCAPE: case VK_DELETE: case VK_BACK: case VK_TAB: case VK_RETURN: case VK_SPACE:
break;
default:
if (ir.Event.KeyEvent.uChar.UnicodeChar > 0) {
WINPORT(CharUpperBuff)(&ir.Event.KeyEvent.uChar.UnicodeChar, 1);
}
}
}

_ir_pending.emplace_back(ir);

if (!_using_extension) {
Expand Down
5 changes: 3 additions & 2 deletions WinPort/src/Backend/WX/wxMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1621,8 +1621,8 @@ void WinPortPanel::OnChar( wxKeyEvent& event )
ir.Event.KeyEvent.wVirtualKeyCode = ir_tmp.Event.KeyEvent.wVirtualKeyCode;
ir.Event.KeyEvent.wVirtualScanCode = ir_tmp.Event.KeyEvent.wVirtualScanCode;
ir.Event.KeyEvent.dwControlKeyState = ir_tmp.Event.KeyEvent.dwControlKeyState;

ir.Event.KeyEvent.dwControlKeyState |= LEFT_ALT_PRESSED;
WINPORT(CharUpperBuff)(&ir.Event.KeyEvent.uChar.UnicodeChar, 1);
}
#endif

Expand All @@ -1632,11 +1632,12 @@ void WinPortPanel::OnChar( wxKeyEvent& event )
ir.Event.KeyEvent.bKeyDown = FALSE;
wxConsoleInputShim::Enqueue(&ir, 1);

_enqueued_in_onchar = true;

#if !defined(__WXOSX__)
// avoid double up event in ResetInputState()
wxKeyEvent keyEventCopy = _key_tracker.LastKeydown();
_key_tracker.OnKeyUp(keyEventCopy);
_enqueued_in_onchar = true;
#endif
}
//event.Skip();
Expand Down

0 comments on commit 9d4d3fe

Please sign in to comment.