From aa51d1965f4613a5193ff22864ac42971cf880bd Mon Sep 17 00:00:00 2001 From: Rodrigo Faselli <162915171+RF47@users.noreply.github.com> Date: Sun, 5 Apr 2026 07:53:41 -0300 Subject: [PATCH] Don't steal focus from text inputs on mouse (#12834) In GLCanvas3D::on_mouse, avoid calling SetFocus when the currently focused window is a text input control (wxTextCtrl, wxComboBox or wxSpinCtrl). This prevents deselection bugs when the mouse leaves the window while a text control is focused. Also commented out explicit wx text-control includes near the top of the file. Only TextCtrl needed cleaning Removed unused wxWidgets header includes. Update GLCanvas3D.cpp Co-authored-by: yw4z Co-authored-by: yw4z --- src/slic3r/GUI/GLCanvas3D.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index a19bed05a8..334643a201 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -4277,7 +4277,10 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) 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()) + //But don't steal focus from text input controls. + wxWindow* focused = wxWindow::FindFocus(); + bool focus_in_text_ctrl = dynamic_cast(focused) != nullptr; + if (top_level_wnd != nullptr && top_level_wnd->IsActive() && !focus_in_text_ctrl) m_canvas->SetFocus(); } m_mouse.position = pos.cast();