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 <yw4z@outlook.com>
Co-authored-by: yw4z <ywsyildiz@gmail.com>
This commit is contained in:
Rodrigo Faselli
2026-04-05 07:53:41 -03:00
committed by GitHub
parent 362ddec743
commit aa51d1965f

View File

@@ -4277,7 +4277,10 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
p = p->GetParent(); p = p->GetParent();
auto *top_level_wnd = dynamic_cast<wxTopLevelWindow*>(p); auto *top_level_wnd = dynamic_cast<wxTopLevelWindow*>(p);
//Orca: Set focus so hotkeys like 'tab' work when a notification is shown. //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<wxTextCtrl*>(focused) != nullptr;
if (top_level_wnd != nullptr && top_level_wnd->IsActive() && !focus_in_text_ctrl)
m_canvas->SetFocus(); m_canvas->SetFocus();
} }
m_mouse.position = pos.cast<double>(); m_mouse.position = pos.cast<double>();