static GstBusSyncReply
create_window (GstBus * bus, GstMessage * message, GtkWidget * widget)
{
+ if (gst_gtk_handle_need_context (bus, message, NULL))
+ return GST_BUS_DROP;
+
/* ignore anything but 'prepare-window-handle' element messages */
if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
return GST_BUS_PASS;
}
static gboolean
+resize_cb (GtkWidget * widget, GdkEvent * event, gpointer data)
+{
+ GtkAllocation allocation;
+ GstVideoOverlay *overlay =
+ GST_VIDEO_OVERLAY (gst_bin_get_by_interface (GST_BIN (data),
+ GST_TYPE_VIDEO_OVERLAY));
+
+ gtk_widget_get_allocation (widget, &allocation);
+ gst_video_overlay_set_render_rectangle (overlay, allocation.x, allocation.y,
+ allocation.width, allocation.height);
+ gst_object_unref (overlay);
+
+ return G_SOURCE_CONTINUE;
+}
+
+static gboolean
expose_cb (GtkWidget * widget, gpointer unused, gpointer data)
{
GstVideoOverlay *overlay =
gtk_container_add (GTK_CONTAINER (window), vbox);
g_signal_connect (screen, "draw", G_CALLBACK (expose_cb), pipeline);
- g_signal_connect (screen, "configure-event", G_CALLBACK (expose_cb),
+ g_signal_connect (screen, "configure-event", G_CALLBACK (resize_cb),
pipeline);
gtk_widget_realize (screen);