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.
This commit is contained in:
Noisyfox
2026-08-13 16:34:42 +08:00
parent 936900d4d8
commit 2d9a3be88f
2 changed files with 7 additions and 6 deletions

View File

@@ -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();

View File

@@ -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);
}