mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-21 09:52:11 +00:00
Fix Linux data-view dropdown popup parenting (#13721)
Delay opening the object-list filament dropdown on wxGTK until the editor window is mapped, avoiding popup creation without a valid native toplevel. Also set the GTK transient parent for dropdown popups created from data-view cell editors.
This commit is contained in:
@@ -324,9 +324,18 @@ wxWindow* BitmapChoiceRenderer::CreateEditorCtrl(wxWindow* parent, wxRect labelR
|
||||
else
|
||||
c_editor->SetSelection(atoi(data.GetText().c_str()) - 1);
|
||||
|
||||
// Open the dropdown immediately when the editor is focused.
|
||||
c_editor->Bind(wxEVT_SET_FOCUS, [c_editor](wxFocusEvent& evt) {
|
||||
#ifdef __WXGTK__
|
||||
// On wxGTK the data-view editor may receive focus before its native
|
||||
// window is mapped. Opening the popup one event later avoids creating
|
||||
// the GTK popup without a valid toplevel parent.
|
||||
c_editor->CallAfter([c_editor]() {
|
||||
if (c_editor->IsShownOnScreen())
|
||||
c_editor->ForceDropdownOpen();
|
||||
});
|
||||
#else
|
||||
c_editor->ForceDropdownOpen();
|
||||
#endif
|
||||
evt.Skip();
|
||||
});
|
||||
|
||||
@@ -392,4 +401,3 @@ wxSize TextRenderer::GetSize() const
|
||||
return GetTextExtent(m_value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user