From fce69b8be98eff9a2adcd96f3b761365cce680bf Mon Sep 17 00:00:00 2001 From: Keith Smith Date: Tue, 8 Sep 2026 08:50:01 -0600 Subject: [PATCH] Forward Tab/Shift+Tab to remote sessions instead of local focus navigation QWidget's default handling intercepts Tab/Shift+Tab for focus-chain navigation before they ever reach keyPressEvent(), so pressing Tab in an RDP session moved focus to the OrbitHub UI (e.g. the Show Events button) instead of reaching the remote machine. KodoTerm (SSH) already overrides focusNextPrevChild() to opt out of this; RdpDisplayWidget and TerminalView did not. Both already handle Key_Tab in their own keyPressEvent, so this is enough to let it reach them. Co-Authored-By: Claude Sonnet 5 --- src/rdp_display_widget.cpp | 8 ++++++++ src/rdp_display_widget.h | 1 + src/terminal_view.cpp | 8 ++++++++ src/terminal_view.h | 1 + 4 files changed, 18 insertions(+) diff --git a/src/rdp_display_widget.cpp b/src/rdp_display_widget.cpp index 121e6f7..85349f2 100644 --- a/src/rdp_display_widget.cpp +++ b/src/rdp_display_widget.cpp @@ -173,6 +173,14 @@ void RdpDisplayWidget::keyReleaseEvent(QKeyEvent* event) event->accept(); } +bool RdpDisplayWidget::focusNextPrevChild(bool next) +{ + Q_UNUSED(next); + // Tab/Shift+Tab must reach keyPressEvent() and be forwarded to the + // remote session instead of moving focus to the next local widget. + return false; +} + void RdpDisplayWidget::mousePressEvent(QMouseEvent* event) { if (event == nullptr) { diff --git a/src/rdp_display_widget.h b/src/rdp_display_widget.h index d9861d1..74599b1 100644 --- a/src/rdp_display_widget.h +++ b/src/rdp_display_widget.h @@ -40,6 +40,7 @@ protected: void mouseReleaseEvent(QMouseEvent* event) override; void mouseMoveEvent(QMouseEvent* event) override; void wheelEvent(QWheelEvent* event) override; + bool focusNextPrevChild(bool next) override; private: enum class CursorMode { diff --git a/src/terminal_view.cpp b/src/terminal_view.cpp index e2f34a2..14a34d7 100644 --- a/src/terminal_view.cpp +++ b/src/terminal_view.cpp @@ -219,6 +219,14 @@ void TerminalView::focusInEvent(QFocusEvent* event) moveCursor(QTextCursor::End); } +bool TerminalView::focusNextPrevChild(bool next) +{ + Q_UNUSED(next); + // Tab/Shift+Tab must reach keyPressEvent() and be forwarded to the + // remote session instead of moving focus to the next local widget. + return false; +} + void TerminalView::resizeEvent(QResizeEvent* event) { QTextEdit::resizeEvent(event); diff --git a/src/terminal_view.h b/src/terminal_view.h index c534072..610cbdb 100644 --- a/src/terminal_view.h +++ b/src/terminal_view.h @@ -29,6 +29,7 @@ protected: void keyPressEvent(QKeyEvent* event) override; void focusInEvent(QFocusEvent* event) override; void resizeEvent(QResizeEvent* event) override; + bool focusNextPrevChild(bool next) override; private: struct ThemePalette {