wxMediaCtrl wayland support: resize video in expose_event_callback

the Move handler apparently misses some resize events, so move the
gst_player_video_overlay_video_renderer_set_render_rectangle call
to expose_event_callback.
This is kept as a separate commit because it would be more efficient
to keep it in Move once we can catch that initial size change, so
this commit can get reverted then.
This commit is contained in:
Dominique Martinet
2021-06-09 15:38:24 +09:00
parent 0080aa6086
commit e3db863a0e

View File

@@ -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