mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 16:26:39 +00:00
waylandsink: Emit "map" signal boarder surface is ready
This allows gtkwaylandsink to queue a draw of its gtk widget at the correct time, avoiding a race. Signed-off-by: Colin Kinloch <colin.kinloch@collabora.com> Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4722>
This commit is contained in:
parent
6c522e4982
commit
82c449ce00
2 changed files with 18 additions and 0 deletions
|
@ -461,6 +461,17 @@ scrollable_window_adjustment_changed_cb (GtkAdjustment * adjustment,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
wl_window_map_cb (GstWlWindow * wl_window, GstGtkWaylandSink * self)
|
||||||
|
{
|
||||||
|
GstGtkWaylandSinkPrivate *priv =
|
||||||
|
gst_gtk_wayland_sink_get_instance_private (self);
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (self, "waylandsink surface is ready");
|
||||||
|
|
||||||
|
gtk_gst_base_widget_queue_draw (GTK_GST_BASE_WIDGET (priv->gtk_widget));
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setup_wl_window (GstGtkWaylandSink * self)
|
setup_wl_window (GstGtkWaylandSink * self)
|
||||||
{
|
{
|
||||||
|
@ -487,6 +498,8 @@ setup_wl_window (GstGtkWaylandSink * self)
|
||||||
wl_surface, &priv->render_lock);
|
wl_surface, &priv->render_lock);
|
||||||
gst_wl_window_set_rotate_method (priv->wl_window,
|
gst_wl_window_set_rotate_method (priv->wl_window,
|
||||||
priv->current_rotate_method);
|
priv->current_rotate_method);
|
||||||
|
g_signal_connect_object (priv->wl_window, "map",
|
||||||
|
G_CALLBACK (wl_window_map_cb), self, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* In order to position the subsurface correctly within a scrollable widget,
|
/* In order to position the subsurface correctly within a scrollable widget,
|
||||||
|
|
|
@ -79,6 +79,7 @@ G_DEFINE_TYPE_WITH_CODE (GstWlWindow, gst_wl_window, G_TYPE_OBJECT,
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
CLOSED,
|
CLOSED,
|
||||||
|
MAP,
|
||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -155,6 +156,9 @@ gst_wl_window_class_init (GstWlWindowClass * klass)
|
||||||
|
|
||||||
signals[CLOSED] = g_signal_new ("closed", G_TYPE_FROM_CLASS (gobject_class),
|
signals[CLOSED] = g_signal_new ("closed", G_TYPE_FROM_CLASS (gobject_class),
|
||||||
G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, G_TYPE_NONE, 0);
|
G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, G_TYPE_NONE, 0);
|
||||||
|
signals[MAP] = g_signal_new ("map", G_TYPE_FROM_CLASS (gobject_class),
|
||||||
|
G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, G_TYPE_NONE, 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -509,6 +513,7 @@ gst_wl_window_render (GstWlWindow * self, GstWlBuffer * buffer,
|
||||||
gst_wl_window_update_borders (self);
|
gst_wl_window_update_borders (self);
|
||||||
wl_surface_commit (priv->area_surface_wrapper);
|
wl_surface_commit (priv->area_surface_wrapper);
|
||||||
priv->is_area_surface_mapped = TRUE;
|
priv->is_area_surface_mapped = TRUE;
|
||||||
|
g_signal_emit (self, signals[MAP], 0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* clear both video and parent surfaces */
|
/* clear both video and parent surfaces */
|
||||||
|
|
Loading…
Reference in a new issue