From d715bb760ce185c4bf0dd82c18288f573f3d60b6 Mon Sep 17 00:00:00 2001 From: HanifKoh <76276251+HanifKoh@users.noreply.github.com> Date: Sun, 11 Oct 2026 04:40:56 +0800 Subject: [PATCH] Let Plugin Windows Be Maximized on X11 (#16335) wxGTK types every wxDialog as a dialog window, and Mutter offers no maximize for anything but a normal window, so the maximize button and shortcut did nothing on GNOME under X11. Modeless plugin windows are now normal windows, kept off the taskbar as before. Modal ones stay dialogs so the window manager keeps routing focus from the main window to them. --- src/slic3r/GUI/WebDialog.cpp | 15 +++++++++++++++ src/slic3r/GUI/WebDialog.hpp | 4 ++++ src/slic3r/plugin/host/PluginHostUi.cpp | 1 + 3 files changed, 20 insertions(+) diff --git a/src/slic3r/GUI/WebDialog.cpp b/src/slic3r/GUI/WebDialog.cpp index 509ccefdee..97ea52677e 100644 --- a/src/slic3r/GUI/WebDialog.cpp +++ b/src/slic3r/GUI/WebDialog.cpp @@ -13,6 +13,10 @@ #include #include +#ifdef __WXGTK__ +#include +#endif + namespace Slic3r { namespace GUI { WebDialog::WebDialog(wxWindow* parent, @@ -52,6 +56,17 @@ WebDialog::WebDialog(wxWindow* parent, Bind(wxEVT_CLOSE_WINDOW, &WebDialog::on_close_window, this); } +void WebDialog::use_normal_window_type() +{ +#ifdef __WXGTK__ + // wxGTK types every wxDialog as a dialog, and Mutter offers no maximize for anything but a + // normal window. Mutter also stops hiding a normal window from the taskbar, so keep it hidden + // as a dialog with a parent is everywhere else. + gtk_window_set_type_hint(GTK_WINDOW(m_widget), GDK_WINDOW_TYPE_HINT_NORMAL); + gtk_window_set_skip_taskbar_hint(GTK_WINDOW(m_widget), TRUE); +#endif +} + void WebDialog::add_user_scripts() { if (wxWebView* wv = browser()) { diff --git a/src/slic3r/GUI/WebDialog.hpp b/src/slic3r/GUI/WebDialog.hpp index e1cfda0701..650259c2b0 100644 --- a/src/slic3r/GUI/WebDialog.hpp +++ b/src/slic3r/GUI/WebDialog.hpp @@ -62,6 +62,10 @@ public: bool is_open() const { return m_open; } + // Lets a modeless window be maximized on X11; call before Show(). Modal ones stay dialogs so the + // window manager keeps routing focus from the parent to them. + void use_normal_window_type(); + // The payload submitted via window.orca.submit() (modal use), if any. const std::optional& result() const { return m_result; } diff --git a/src/slic3r/plugin/host/PluginHostUi.cpp b/src/slic3r/plugin/host/PluginHostUi.cpp index 84988b2dff..15fe24b2c5 100644 --- a/src/slic3r/plugin/host/PluginHostUi.cpp +++ b/src/slic3r/plugin/host/PluginHostUi.cpp @@ -399,6 +399,7 @@ py::object ui_create_window(const std::string& html, const std::string& title, i if (UiRegistry::instance().is_open(new_id)) dlg->Destroy(); } else { + dlg->use_normal_window_type(); dlg->Show(); } });