From 382cf57166deac2a466f225311dc4575ecd11780 Mon Sep 17 00:00:00 2001 From: SoftFever Date: Tue, 10 Mar 2026 15:57:15 +0800 Subject: [PATCH] QoL: Fix hotkeys blocked in Prepare view when notification is shown (#12715) Fix hotkeys blocked in Prepare view when notification is shown Restore SetFocus() in the GLCanvas3D mouse-entering handler so the canvas reclaims wxWidget keyboard focus whenever the mouse enters it (provided the main window is active). Without this, clicking a sidebar control or a UI update triggered by slicing could leave the canvas without focus, causing hotkeys like Tab to stop working until the user clicked the canvas or dismissed the notification. --- src/slic3r/GUI/GLCanvas3D.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 452c4301a3..2eff0298c9 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -4277,15 +4277,16 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) m_canvas->SetFocus(); if (evt.Entering()) { -//#if defined(__WXMSW__) || defined(__linux__) -// // On Windows and Linux needs focus in order to catch key events - // Set focus in order to remove it from sidebar fields + // Set focus in order to remove it from sidebar fields and ensure hotkeys work if (m_canvas != nullptr) { - // Only set focus, if the top level window of this canvas is active. + // Only set focus if the top level window of this canvas is active. auto p = dynamic_cast(evt.GetEventObject()); while (p->GetParent()) p = p->GetParent(); auto *top_level_wnd = dynamic_cast(p); + //Orca: Set focus so hotkeys like 'tab' work when a notification is shown. + if (top_level_wnd != nullptr && top_level_wnd->IsActive()) + m_canvas->SetFocus(); m_mouse.position = pos.cast(); m_tooltip_enabled = false; // 1) forces a frame render to ensure that m_hover_volume_idxs is updated even when the user right clicks while @@ -4297,7 +4298,6 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) m_tooltip_enabled = true; } m_mouse.set_start_position_2D_as_invalid(); -//#endif } else if (evt.Leaving()) { // to remove hover on objects when the mouse goes out of this canvas