diff --git a/src/slic3r/GUI/MarkdownTip.cpp b/src/slic3r/GUI/MarkdownTip.cpp index 0ceee2a278..b056ed6364 100644 --- a/src/slic3r/GUI/MarkdownTip.cpp +++ b/src/slic3r/GUI/MarkdownTip.cpp @@ -146,8 +146,10 @@ bool MarkdownTip::ShowTip(wxPoint pos, std::string const &tip, std::string const if (_tipView->GetParent() == this) { wxSize size = wxDisplay(this).GetClientArea().GetSize(); _requestPos = pos; + // Ensure display size is valid + if (size.y <= 0) size.y = 600; if (pos.y + this->GetSize().y > size.y) - pos.y = size.y - this->GetSize().y; + pos.y = std::max(0, size.y - this->GetSize().y); this->SetPosition(pos); if (tipChanged || _hide) { _hide = false; @@ -258,11 +260,15 @@ void MarkdownTip::OnTitleChanged(wxWebViewEvent& event) _lastHeight = height; height *= 1.25; height += 50; wxSize size = wxDisplay(this).GetClientArea().GetSize(); + // Ensure display size is valid + if (size.y <= 0) size.y = 600; if (height > size.y) height = size.y; wxPoint pos = _requestPos; if (pos.y + height > size.y) - pos.y = size.y - height; + pos.y = std::max(0, size.y - height); + // Ensure height is valid + if (height <= 0) height = 100; this->SetSize({ 400, (int)height }); this->SetPosition(pos); } diff --git a/src/slic3r/GUI/Widgets/DropDown.cpp b/src/slic3r/GUI/Widgets/DropDown.cpp index 380d23bff4..6ec0265564 100644 --- a/src/slic3r/GUI/Widgets/DropDown.cpp +++ b/src/slic3r/GUI/Widgets/DropDown.cpp @@ -365,15 +365,15 @@ void DropDown::messureSize() } szContent.y *= std::min((size_t)15, texts.size()); szContent.y += texts.size() > 15 ? rowSize.y / 2 : 0; -#ifdef __WXGTK__ - // GTK requires width >= -1 and height > 0 for gtk_window_resize/set_size_request - if (szContent.x < 1) szContent.x = 1; - if (szContent.y < 1) szContent.y = 1; -#endif wxWindow::SetSize(szContent); #ifdef __WXGTK__ // Gtk has a wrapper window for popup widget - gtk_window_resize (GTK_WINDOW (m_widget), szContent.x, szContent.y); + // Fix for GNOME Platform 48 X11 backend: ensure size is valid before calling gtk_window_resize + int gtk_width = szContent.x; + int gtk_height = szContent.y; + if (gtk_width <= 0) gtk_width = 100; + if (gtk_height <= 0) gtk_height = 100; + gtk_window_resize(GTK_WINDOW(m_widget), gtk_width, gtk_height); #endif need_sync = false; } diff --git a/src/slic3r/GUI/Widgets/DropDown.hpp b/src/slic3r/GUI/Widgets/DropDown.hpp index e3cf9b4531..24507cb776 100644 --- a/src/slic3r/GUI/Widgets/DropDown.hpp +++ b/src/slic3r/GUI/Widgets/DropDown.hpp @@ -30,7 +30,7 @@ class DropDown : public PopupWindow wxSize textSize; wxSize iconSize; - wxSize rowSize; + wxSize rowSize{100, 30}; // Initialize with default values StateHandler state_handler; StateColor text_color;