Skip to content

Don't steal focus from text inputs on mouse#12834

Merged
yw4z merged 2 commits into
OrcaSlicer:mainfrom
RF47:dont-steal-focus
Apr 5, 2026
Merged

Don't steal focus from text inputs on mouse#12834
yw4z merged 2 commits into
OrcaSlicer:mainfrom
RF47:dont-steal-focus

Conversation

@RF47

@RF47 RF47 commented Mar 18, 2026

Copy link
Copy Markdown
Collaborator

Description

This fix a bug introduced in 382cf57
When moving the mouse over the 3D viewport, the focus was lost on the selected text.

Fix #12823

@RF47 RF47 added the bug-fix label Mar 18, 2026
@RF47 RF47 requested a review from Copilot March 18, 2026 22:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a regression where moving the mouse into the 3D viewport could steal focus from sidebar text inputs, causing selected text to be deselected (Issue #12823).

Changes:

  • Adds a guard in GLCanvas3D::on_mouse() to avoid focusing the 3D canvas when a text-input-like control currently has focus.
  • Introduces focus-type checks using dynamic_cast against common wxWidgets input controls.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/slic3r/GUI/GLCanvas3D.cpp Outdated
Comment thread src/slic3r/GUI/GLCanvas3D.cpp Outdated
Comment thread src/slic3r/GUI/GLCanvas3D.cpp Outdated
@RF47 RF47 requested a review from SoftFever March 26, 2026 14:33
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 <[email protected]>
@RF47 RF47 force-pushed the dont-steal-focus branch from 8be2f2d to 3e1b48f Compare March 30, 2026 11:13
@yw4z

yw4z commented Apr 5, 2026

Copy link
Copy Markdown
Collaborator

LGTM thanks

@yw4z yw4z merged commit aa51d19 into OrcaSlicer:main Apr 5, 2026
17 checks passed
@RF47 RF47 deleted the dont-steal-focus branch April 5, 2026 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[2.3.2-dev] Selection in sidebar removed when mouse moves out of sidebar

3 participants