mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-12-01 01:12:59 -05:00
Fix renaming in the Design tab ending as soon as it starts on Linux
This commit is contained in:
1 parent
fa029465a3
commit
070f377eb2
2 files changed
+7
-1
No files matched your search
@@ -126,8 +126,12 @@ DesignRowList::DesignRowList(wxWindow* parent, int max_visible, bool selectable,
|
||||
#endif
|
||||
e.Skip();
|
||||
});
|
||||
// The editor sits on a row position a new client size may have moved. A size event that changes
|
||||
// nothing leaves it open: wxGTK sends one to every parent of a window whose font is set, as the
|
||||
// editor's is when it opens, and closing then would end the rename as soon as it starts.
|
||||
Bind(wxEVT_SIZE, [this](wxSizeEvent& e) {
|
||||
end_rename(true); // the editor sits on a row position the new size may have moved
|
||||
if (GetClientSize() != m_edit_client_size)
|
||||
end_rename(true);
|
||||
e.Skip();
|
||||
});
|
||||
measure_row();
|
||||
@@ -230,6 +234,7 @@ void DesignRowList::open_editor(int row)
|
||||
const int h = std::max(rc.height, m_editor->GetBestSize().y);
|
||||
const int y = std::clamp(rc.y + (rc.height - h) / 2, 0, std::max(0, GetClientSize().y - h));
|
||||
m_editor->SetSize(rc.x - FromDIP(2), y, rc.width + FromDIP(2), h);
|
||||
m_edit_client_size = GetClientSize();
|
||||
m_edit_row = row;
|
||||
m_editor->Show();
|
||||
m_editor->SetFocus();
|
||||
|
||||
@@ -123,6 +123,7 @@ private:
|
||||
Hit m_pressed; // action cell under the last left press
|
||||
wxTextCtrl* m_editor{nullptr}; // created on the first rename, then reused
|
||||
int m_edit_row{wxNOT_FOUND};
|
||||
wxSize m_edit_client_size; // the client size the editor was placed in
|
||||
};
|
||||
|
||||
}} // namespace Slic3r::GUI
|
||||
|
||||
Reference in new issue
Block a user