From f2eb53ebaac719b67f882af4c67264ca7887cd16 Mon Sep 17 00:00:00 2001 From: rblumen <141589963+rblumen@users.noreply.github.com> Date: Sat, 21 Nov 2026 14:00:03 -0500 Subject: [PATCH] Keep the cloud login dialog on screen and make it resizable (#17721) The Orca Cloud and Bambu Cloud login dialog had a fixed size of 650x840 DIP. At 150% scaling on a 1080p screen it was taller than the work area, so its title bar was off screen and it could not be moved or closed. The size is now clamped to the work area of the display the main window is on, and after centering the dialog is moved to stay inside that area. The dialog is also resizable, and the webview fills it when it is resized. --- src/slic3r/GUI/WebUserLoginDialog.cpp | 31 ++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/WebUserLoginDialog.cpp b/src/slic3r/GUI/WebUserLoginDialog.cpp index de236addd5..6af5d05548 100644 --- a/src/slic3r/GUI/WebUserLoginDialog.cpp +++ b/src/slic3r/GUI/WebUserLoginDialog.cpp @@ -19,6 +19,7 @@ #include "slic3r/Utils/NetworkAgent.hpp" #include "libslic3r_version.h" +#include #include #include #include @@ -31,6 +32,9 @@ #include #include #include +#include +#include +#include #include #include @@ -108,7 +112,8 @@ int ZUserLogin::ensure_loopback_port() } ZUserLogin::ZUserLogin(std::shared_ptr cloud_agent) - : wxDialog((wxWindow*) (wxGetApp().mainframe), wxID_ANY, "OrcaSlicer"), m_cloud_agent(cloud_agent) + : wxDialog((wxWindow*) (wxGetApp().mainframe), wxID_ANY, "OrcaSlicer", wxDefaultPosition, wxDefaultSize, + wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER), m_cloud_agent(cloud_agent) { SetBackgroundColour(*wxWHITE); @@ -183,6 +188,13 @@ ZUserLogin::ZUserLogin(std::shared_ptr cloud_agent) m_browser->Hide(); m_browser->SetSize(0, 0); + // The webview fills the dialog, so it follows the dialog when the user resizes it. + // Plain SetSizer: the webview is still hidden and 0x0 here, so fitting would collapse the dialog; + // the size is set explicitly below. + auto* browser_sizer = new wxBoxSizer(wxVERTICAL); + browser_sizer->Add(m_browser, 1, wxEXPAND); + SetSizer(browser_sizer); + // Connect the webview events Bind(wxEVT_WEBVIEW_NAVIGATING, &ZUserLogin::OnNavigationRequest, this, m_browser->GetId()); Bind(wxEVT_WEBVIEW_NAVIGATED, &ZUserLogin::OnNavigationComplete, this, m_browser->GetId()); @@ -196,10 +208,23 @@ ZUserLogin::ZUserLogin(std::shared_ptr cloud_agent) // UI SetTitle(_L("Login")); // Set a more sensible size for web browsing - wxSize pSize = FromDIP(wxSize(650, 840)); - SetSize(pSize); + // The preferred size can exceed the work area (e.g. 840 DIP at 150% on a 1080p screen), + // which would push the title bar off screen, so clamp it to the display the dialog is on. + const wxRect work_area = wxDisplay(GetParent()).GetClientArea(); + const int margin = FromDIP(20); + const wxSize max_size(std::max(1, work_area.GetWidth() - margin), std::max(1, work_area.GetHeight() - margin)); + + const wxSize pSize = FromDIP(wxSize(650, 840)); + SetMinSize(wxSize(std::min(FromDIP(400), max_size.GetWidth()), std::min(FromDIP(400), max_size.GetHeight()))); + SetSize(wxSize(std::min(pSize.GetWidth(), max_size.GetWidth()), std::min(pSize.GetHeight(), max_size.GetHeight()))); CentreOnParent(); + + // Keep the whole dialog, title bar included, inside the work area. + wxRect rect = GetRect(); + rect.x = std::max(work_area.GetLeft(), std::min(rect.x, work_area.GetRight() + 1 - rect.width)); + rect.y = std::max(work_area.GetTop(), std::min(rect.y, work_area.GetBottom() + 1 - rect.height)); + Move(rect.GetPosition()); } wxGetApp().UpdateDlgDarkUI(this); }