diff --git a/src/unix/mediactrl_gstplayer.cpp b/src/unix/mediactrl_gstplayer.cpp index 606ac7271f..f8f84374e7 100644 --- a/src/unix/mediactrl_gstplayer.cpp +++ b/src/unix/mediactrl_gstplayer.cpp @@ -142,7 +142,24 @@ expose_event_callback(GtkWidget* widget, GdkEventExpose* event, wxGStreamerMedia // GST Doesn't redraw automatically while paused // Plus, the video sometimes doesn't redraw when it looses focus // or is painted over so we just tell it to redraw... - gst_player_video_overlay_video_renderer_expose(GST_PLAYER_VIDEO_OVERLAY_VIDEO_RENDERER(be->m_video_renderer)); + gst_player_video_overlay_video_renderer_expose( + GST_PLAYER_VIDEO_OVERLAY_VIDEO_RENDERER(be->m_video_renderer) + ); +#ifdef __WXGTK3__ + GdkWindow* window = gtk_widget_get_window(widget); + if (strcmp("GdkWaylandWindow", g_type_name(G_TYPE_FROM_INSTANCE(window))) == 0) + { + // on wayland we need to place the video + int x, y; + GtkAllocation allocation; + gdk_window_get_origin(window, &x, &y); + gtk_widget_get_allocation(widget, &allocation); + gst_player_video_overlay_video_renderer_set_render_rectangle( + GST_PLAYER_VIDEO_OVERLAY_VIDEO_RENDERER(be->m_video_renderer), + x, y, allocation.width, allocation.height + ); + } +#endif } else { @@ -524,22 +541,10 @@ wxLongLong wxGStreamerMediaBackend::GetDuration() void wxGStreamerMediaBackend::Move(int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(w), int WXUNUSED(h)) { - /* GTK+ on X11 does not require explicitely setting the video size. - * Other toolkits might need to do something similar to GTK wayland too. + /* Nothing to be done here, at least for GTK+. For other toolkits we might + * have to call + * gst_player_video_overlay_video_renderer_set_render_rectangle() here */ -#ifdef __WXGTK3__ - GdkWindow* window = gtk_widget_get_window(m_ctrl->m_wxwindow); - if (window && strcmp("GdkWaylandWindow", g_type_name(G_TYPE_FROM_INSTANCE(window))) == 0) { - int x, y; - GtkAllocation allocation; - gdk_window_get_origin(window, &x, &y); - gtk_widget_get_allocation(m_ctrl->m_wxwindow, &allocation); - gst_player_video_overlay_video_renderer_set_render_rectangle( - GST_PLAYER_VIDEO_OVERLAY_VIDEO_RENDERER(m_video_renderer), - x, y, allocation.width, allocation.height - ); - } -#endif } wxSize wxGStreamerMediaBackend::GetVideoSize() const