mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-04-05 16:22:03 +02:00
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:
@@ -4277,7 +4277,10 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
||||
p = p->GetParent();
|
||||
auto *top_level_wnd = dynamic_cast<wxTopLevelWindow*>(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<wxTextCtrl*>(focused) != nullptr;
|
||||
if (top_level_wnd != nullptr && top_level_wnd->IsActive() && !focus_in_text_ctrl)
|
||||
m_canvas->SetFocus();
|
||||
}
|
||||
m_mouse.position = pos.cast<double>();
|
||||
|
||||
Reference in New Issue
Block a user