From 061049dd732cae1a3368eeaffb69158366c9f116 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Fri, 1 Jul 2016 00:15:55 +1000 Subject: [PATCH] gl/examples/fxtest: fix up for wayland support - Pass the wayland display to gst - Redrawing on resize is no longer needed. --- tests/examples/gl/gtk/fxtest/fxtest.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/tests/examples/gl/gtk/fxtest/fxtest.c b/tests/examples/gl/gtk/fxtest/fxtest.c index 4b60b54..8b56b96 100644 --- a/tests/examples/gl/gtk/fxtest/fxtest.c +++ b/tests/examples/gl/gtk/fxtest/fxtest.c @@ -40,6 +40,9 @@ 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; @@ -98,6 +101,22 @@ end_stream_cb (GstBus * bus, GstMessage * message, GstElement * pipeline) } 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 = @@ -330,7 +349,7 @@ main (gint argc, gchar * argv[]) 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); -- 2.7.4