From 6d218f9abf6433de3d71b6afd1dc0c694f07e3c2 Mon Sep 17 00:00:00 2001 From: Hanif Koh Date: Sat, 10 Oct 2026 14:27:45 +0800 Subject: [PATCH] Let Plugin Windows Be Maximized on X11 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(); } });