From 2d9a3be88f5cc48b3293606fb159f11cb94c405f Mon Sep 17 00:00:00 2001 From: Noisyfox Date: Thu, 13 Aug 2026 16:34:42 +0800 Subject: [PATCH] FIX: GTK video window resize ran in a free function without member access wxMediaCtrl_OnSize referenced wxMediaCtrl2's private m_gtk_video_window, which does not compile on Linux/GTK. Move the resizing into wxMediaCtrl2::DoSetSize where the member is in scope. --- src/slic3r/GUI/MediaPlayCtrl.cpp | 6 ------ src/slic3r/GUI/wxMediaCtrl2.cpp | 7 +++++++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/slic3r/GUI/MediaPlayCtrl.cpp b/src/slic3r/GUI/MediaPlayCtrl.cpp index dc1f95b88b..71fbcb054b 100644 --- a/src/slic3r/GUI/MediaPlayCtrl.cpp +++ b/src/slic3r/GUI/MediaPlayCtrl.cpp @@ -828,12 +828,6 @@ bool MediaPlayCtrl::get_stream_url(std::string *url) void wxMediaCtrl_OnSize(wxWindow * ctrl, wxSize const & videoSize, int width, int height) { -#if defined(__LINUX__) && defined(__WXGTK__) - if (m_gtk_video_window) { - const wxSize client_size = GetClientSize(); - m_gtk_video_window->SetSize(0, 0, client_size.GetWidth(), client_size.GetHeight()); - } -#endif wxSize size = videoSize; if (!size.IsFullySpecified()) size = {16, 9}; int maxHeight = (width * size.GetHeight() + size.GetHeight() - 1) / size.GetWidth(); diff --git a/src/slic3r/GUI/wxMediaCtrl2.cpp b/src/slic3r/GUI/wxMediaCtrl2.cpp index 6a2e07d8d6..6ab9ec5913 100644 --- a/src/slic3r/GUI/wxMediaCtrl2.cpp +++ b/src/slic3r/GUI/wxMediaCtrl2.cpp @@ -604,6 +604,13 @@ void wxMediaCtrl2::DoSetSize(int x, int y, int width, int height, int sizeFlags) { wxWindow::DoSetSize(x, y, width, height, sizeFlags); if (sizeFlags & wxSIZE_USE_EXISTING) return; +#if defined(__LINUX__) && defined(__WXGTK__) + // Keep the native GStreamer video window filling the client area. + if (m_gtk_video_window) { + const wxSize client_size = GetClientSize(); + m_gtk_video_window->SetSize(0, 0, client_size.GetWidth(), client_size.GetHeight()); + } +#endif wxMediaCtrl_OnSize(this, m_video_size, width, height); }