mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-31 13:57:07 +00:00
feature fix linux crash question.
This commit is contained in:
@@ -146,8 +146,10 @@ bool MarkdownTip::ShowTip(wxPoint pos, std::string const &tip, std::string const
|
|||||||
if (_tipView->GetParent() == this) {
|
if (_tipView->GetParent() == this) {
|
||||||
wxSize size = wxDisplay(this).GetClientArea().GetSize();
|
wxSize size = wxDisplay(this).GetClientArea().GetSize();
|
||||||
_requestPos = pos;
|
_requestPos = pos;
|
||||||
|
// Ensure display size is valid
|
||||||
|
if (size.y <= 0) size.y = 600;
|
||||||
if (pos.y + this->GetSize().y > size.y)
|
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);
|
this->SetPosition(pos);
|
||||||
if (tipChanged || _hide) {
|
if (tipChanged || _hide) {
|
||||||
_hide = false;
|
_hide = false;
|
||||||
@@ -258,11 +260,15 @@ void MarkdownTip::OnTitleChanged(wxWebViewEvent& event)
|
|||||||
_lastHeight = height;
|
_lastHeight = height;
|
||||||
height *= 1.25; height += 50;
|
height *= 1.25; height += 50;
|
||||||
wxSize size = wxDisplay(this).GetClientArea().GetSize();
|
wxSize size = wxDisplay(this).GetClientArea().GetSize();
|
||||||
|
// Ensure display size is valid
|
||||||
|
if (size.y <= 0) size.y = 600;
|
||||||
if (height > size.y)
|
if (height > size.y)
|
||||||
height = size.y;
|
height = size.y;
|
||||||
wxPoint pos = _requestPos;
|
wxPoint pos = _requestPos;
|
||||||
if (pos.y + height > size.y)
|
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->SetSize({ 400, (int)height });
|
||||||
this->SetPosition(pos);
|
this->SetPosition(pos);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -365,15 +365,15 @@ void DropDown::messureSize()
|
|||||||
}
|
}
|
||||||
szContent.y *= std::min((size_t)15, texts.size());
|
szContent.y *= std::min((size_t)15, texts.size());
|
||||||
szContent.y += texts.size() > 15 ? rowSize.y / 2 : 0;
|
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);
|
wxWindow::SetSize(szContent);
|
||||||
#ifdef __WXGTK__
|
#ifdef __WXGTK__
|
||||||
// Gtk has a wrapper window for popup widget
|
// 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
|
#endif
|
||||||
need_sync = false;
|
need_sync = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class DropDown : public PopupWindow
|
|||||||
|
|
||||||
wxSize textSize;
|
wxSize textSize;
|
||||||
wxSize iconSize;
|
wxSize iconSize;
|
||||||
wxSize rowSize;
|
wxSize rowSize{100, 30}; // Initialize with default values
|
||||||
|
|
||||||
StateHandler state_handler;
|
StateHandler state_handler;
|
||||||
StateColor text_color;
|
StateColor text_color;
|
||||||
|
|||||||
Reference in New Issue
Block a user