summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Waters <matthew@centricular.com>2016-07-01 00:15:55 +1000
committerMatthew Waters <matthew@centricular.com>2016-08-19 16:05:33 +1000
commite6b93e18d3e46503f070275a74ef67c122f709ee (patch)
tree3855a6fcecb39d089cd4d1131f2d35666a91bc5c
parentd31a6f8756967b12cbe16d21699d9129a32a5600 (diff)
gl/examples/fxtest: fix up for wayland support
- Pass the wayland display to gst - Redrawing on resize is no longer needed.
-rw-r--r--tests/examples/gl/gtk/fxtest/fxtest.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/examples/gl/gtk/fxtest/fxtest.c b/tests/examples/gl/gtk/fxtest/fxtest.c
index 4b60b543f..8b56b969f 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);