From e570fa8346a44c1624199fa9cc2c364070049af0 Mon Sep 17 00:00:00 2001 From: Twan van Laarhoven Date: Sat, 23 May 2020 14:58:54 +0200 Subject: [PATCH] Disable scrollbars for dropdown lists. wxGTK doesn't support them at all, we would have to do it manually. For now disabling scrolling mostly fixes #51 --- src/gui/drop_down_list.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gui/drop_down_list.cpp b/src/gui/drop_down_list.cpp index 5fe3a07b..883fa62d 100644 --- a/src/gui/drop_down_list.cpp +++ b/src/gui/drop_down_list.cpp @@ -77,7 +77,7 @@ DropDownList::DropDownList(Window* parent, bool is_submenu, ValueViewer* viewer) dc.SetFont(*wxNORMAL_FONT); int h; dc.GetTextExtent(_("X"), 0, &h); - item_size.height = h + 2; + item_size.height = h + 2.0; } DropDownList::~DropDownList() { @@ -135,6 +135,9 @@ void DropDownList::show(bool in_place, wxPoint pos, RealRect* rect) { SetVirtualSize(virtual_size); item_size.width = virtual_size.width - marginW * 2; // is there enough room for all items, or do we need a scrollbar? +#if !defined(__WXGTK__) + // Note: wxGTK doesn't support scrollbars on popup windows + // For now we disable them to not make MSE crash int room_below = wxGetDisplaySize().y - border_size.height - pos.y - parent_height - 50; int max_height = max(300, room_below); if (size.height > max_height) { @@ -144,6 +147,7 @@ void DropDownList::show(bool in_place, wxPoint pos, RealRect* rect) { } else { SetScrollbar(wxVERTICAL,0,0,0,false); } +#endif // move & resize SetSize(add_diagonal(size, border_size)); Position(pos, wxSize(0, parent_height));