From fafff5c1d1190516ac540ea1fd49e0357a6292c4 Mon Sep 17 00:00:00 2001 From: "liz.li" Date: Tue, 22 Nov 2022 14:20:06 +0800 Subject: [PATCH] FIX:fix search dialog cannot dismiss when alt+tab Change-Id: I2fd0099685ce80e72f6214643b35535c274f7e22 --- src/slic3r/GUI/Search.cpp | 7 ++++++- src/slic3r/GUI/Tab.cpp | 1 - 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/Search.cpp b/src/slic3r/GUI/Search.cpp index 77df47810e..d4eb1f4269 100644 --- a/src/slic3r/GUI/Search.cpp +++ b/src/slic3r/GUI/Search.cpp @@ -623,6 +623,7 @@ void SearchDialog::Popup(wxPoint position /*= wxDefaultPosition*/) //const std::string &line = searcher->search_string(); //searcher->search(into_u8(line), true); wxPopupTransientWindow::Popup(); + search_line->SetFocus(); update_list(); } @@ -638,7 +639,11 @@ void SearchDialog::OnDismiss() { } void SearchDialog::Dismiss() { auto pos = wxGetMousePosition(); - if (!m_event_tag->GetScreenRect().Contains(pos) && !this->GetScreenRect().Contains(pos) && !m_search_item_tag->GetScreenRect().Contains(pos)) { + + if (!search_line->HasFocus() && !this->HasFocus()) { + Die(); + } + else if (!m_event_tag->GetScreenRect().Contains(pos) && !this->GetScreenRect().Contains(pos) && !m_search_item_tag->GetScreenRect().Contains(pos)) { Die(); } } diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 02f10fdc5c..988847d18e 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -325,7 +325,6 @@ void Tab::create_preset_tab() this->GetParent()->Layout(); wxGetApp().plater()->search(false, m_type, m_top_panel->GetParent(), m_search_input, m_btn_search); - m_search_input->SetFocus(); Thaw(); });