mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-18 14:32:36 +00:00
CAD: give the keyboard back when the action bar hides (snaporca-ehrm)
Ported from snaporca ace5778d4c. See that commit for the measurements. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
31548a230d
commit
7920e55413
@@ -10533,6 +10533,23 @@ void DesignPanel::update_action_bar()
|
||||
|| m_ui_mode == UiMode::Constrain
|
||||
|| (m_viewport && m_viewport->moving_body());
|
||||
s->Show(m_tb_action, active, true);
|
||||
// HIDING THE BAR ORPHANS THE KEYBOARD, and that is the "app does not consent to sketch"
|
||||
// report. The ✓/✗ live in this bar, so the click that confirms a feature leaves focus on a
|
||||
// button that this very call then hides. wx does not hand that focus anywhere useful, and
|
||||
// wxEVT_CHAR_HOOK is bound on THIS PANEL — it is delivered to the focused window and
|
||||
// propagates up the parent chain, so with focus outside the panel every Design shortcut
|
||||
// stops arriving. Measured on the rig: after Confirm, shift+S produced ZERO CHAR_HOOK lines
|
||||
// (not even the modifier), while X kept focus on the main window throughout — so it was
|
||||
// never a window-manager problem. One bare canvas click restored it, which is exactly the
|
||||
// workaround users found and reported as "shift+s works but it is not intuitive".
|
||||
// The canvas is the right owner of the keyboard in this tab, so give it back explicitly.
|
||||
if (!active && m_viewport != nullptr) {
|
||||
wxWindow* f = wxWindow::FindFocus();
|
||||
bool in_bar = (f == nullptr);
|
||||
for (wxWindow* w = f; w != nullptr && !in_bar; w = w->GetParent())
|
||||
if (w == m_toolbar) in_bar = true; // the bar is a sizer; its buttons parent to m_toolbar
|
||||
if (in_bar) m_viewport->SetFocus();
|
||||
}
|
||||
m_toolbar->Layout();
|
||||
m_toolbar->FitInside(); // refresh scroll range when the action bar shows/hides
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user