FIX: wxDisplay crash on wxNOT_FOUND

Change-Id: If7b936d361873e20fb71b7fc35c9d270cd39a763
This commit is contained in:
chunmao.guo 2022-08-12 13:11:03 +08:00 committed by Lane.Wei
parent d4ddd8f470
commit af54a34567
5 changed files with 8 additions and 8 deletions

View file

@ -493,7 +493,7 @@ void BBLTopbar::OnFullScreen(wxAuiToolBarEvent& event)
m_frame->Restore();
}
else {
wxDisplay display(wxDisplay::GetFromWindow(this));
wxDisplay display(this);
auto size = display.GetClientArea().GetSize();
m_frame->SetMaxSize(size + wxSize{16, 16});
m_normalRect = m_frame->GetRect();
@ -524,7 +524,7 @@ void BBLTopbar::OnMouseLeftDClock(wxMouseEvent& mouse)
m_frame->Restore();
}
else {
wxDisplay display(wxDisplay::GetFromWindow(this));
wxDisplay display(this);
auto size = display.GetClientArea().GetSize();
m_frame->SetMaxSize(size + wxSize{16, 16});
m_normalRect = m_frame->GetRect();

View file

@ -2911,7 +2911,7 @@ ObjectTableDialog::ObjectTableDialog(wxWindow* parent, Plater* platerObj, Model
wxSize panel_size = m_obj_panel->get_init_size();
g_max_size_from_parent = maxSize;
if ((maxSize.GetWidth() == -1) || (maxSize.GetHeight() == -1)) {
wxDisplay display(wxDisplay::GetFromWindow(this));
wxDisplay display(this);
//auto drect = display.GetGeometry();
wxRect client_area = display.GetClientArea ();
g_max_size_from_parent.SetWidth(client_area.GetWidth());

View file

@ -342,7 +342,7 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, BORDERLESS_FRAME_
// BBS: fix taskbar overlay on windows
#ifdef WIN32
auto setMaxSize = [this]() {
wxDisplay display(wxDisplay::GetFromWindow(this));
wxDisplay display(this);
auto size = display.GetClientArea().GetSize();
// 8 pixels shadow
SetMaxSize(size + wxSize{16, 16});
@ -353,7 +353,7 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, BORDERLESS_FRAME_
});
setMaxSize();
this->Bind(wxEVT_MAXIMIZE, [this](auto &e) {
wxDisplay display(wxDisplay::GetFromWindow(this));
wxDisplay display(this);
auto pos = display.GetClientArea().GetPosition();
Move(pos - wxPoint{8, 8});
e.Skip();

View file

@ -141,7 +141,7 @@ bool MarkdownTip::ShowTip(wxPoint pos, std::string const &tip, std::string const
this->Hide();
}
if (_tipView->GetParent() == this) {
wxSize size = wxDisplay(wxDisplay::GetFromWindow(this)).GetClientArea().GetSize();
wxSize size = wxDisplay(this).GetClientArea().GetSize();
_requestPos = pos;
if (pos.y + this->GetSize().y > size.y)
pos.y = size.y - this->GetSize().y;
@ -254,7 +254,7 @@ void MarkdownTip::OnTitleChanged(wxWebViewEvent& event)
return;
_lastHeight = height;
height *= 1.25; height += 50;
wxSize size = wxDisplay(wxDisplay::GetFromWindow(this)).GetClientArea().GetSize();
wxSize size = wxDisplay(this).GetClientArea().GetSize();
if (height > size.y)
height = size.y;
wxPoint pos = _requestPos;

View file

@ -354,7 +354,7 @@ void DropDown::autoPosition()
}
if (GetPosition().y > pos.y) {
// may exceed
auto drect = wxDisplay(wxDisplay::GetFromWindow(GetParent())).GetGeometry();
auto drect = wxDisplay(GetParent()).GetGeometry();
if (GetPosition().y + size.y + 10 > drect.GetBottom()) {
if (use_content_width && texts.size() <= 15) size.x += 6;
size.y = drect.GetBottom() - GetPosition().y - 10;