summaryrefslogtreecommitdiff
path: root/tests/icles/stress-xoverlay.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/icles/stress-xoverlay.c')
-rw-r--r--tests/icles/stress-xoverlay.c44
1 files changed, 31 insertions, 13 deletions
diff --git a/tests/icles/stress-xoverlay.c b/tests/icles/stress-xoverlay.c
index 63d8bb06..8dcaaef6 100644
--- a/tests/icles/stress-xoverlay.c
+++ b/tests/icles/stress-xoverlay.c
@@ -33,7 +33,7 @@
static GMainLoop *loop;
static Display *disp;
-static Window root, win;
+static Window root, win = 0;
static GC gc;
static gint width = 320, height = 240, x = 0, y = 0;
static gint disp_width, disp_height;
@@ -111,10 +111,37 @@ toggle_events (GstXOverlay * ov)
return TRUE;
}
+static gboolean
+cycle_window (GstXOverlay * ov)
+{
+ XGCValues values;
+ Window old_win = win;
+ GC old_gc = gc;
+
+ win = XCreateSimpleWindow (disp, root, 0, 0, width, height, 0, 0, 0);
+
+ XSetWindowBackgroundPixmap (disp, win, None);
+
+ gc = XCreateGC (disp, win, 0, &values);
+
+ XMapRaised (disp, win);
+
+ XSync (disp, FALSE);
+
+ gst_x_overlay_set_xwindow_id (ov, win);
+
+ if (old_win) {
+ XDestroyWindow (disp, old_win);
+ XFreeGC (disp, old_gc);
+ XSync (disp, FALSE);
+ }
+
+ return TRUE;
+}
+
static GstBusSyncReply
create_window (GstBus * bus, GstMessage * message, GstPipeline * pipeline)
{
- XGCValues values;
const GstStructure *s;
GstXOverlay *ov = NULL;
@@ -127,20 +154,11 @@ create_window (GstBus * bus, GstMessage * message, GstPipeline * pipeline)
g_print ("Creating our own window\n");
- win = XCreateSimpleWindow (disp, root, 0, 0, width, height, 0, 0, 0);
-
- XSetWindowBackgroundPixmap (disp, win, None);
-
- gc = XCreateGC (disp, win, 0, &values);
-
- XMapRaised (disp, win);
-
- XSync (disp, FALSE);
-
- gst_x_overlay_set_xwindow_id (ov, win);
+ cycle_window (ov);
g_timeout_add (50, (GSourceFunc) resize_window, pipeline);
g_timeout_add (50, (GSourceFunc) move_window, pipeline);
+ g_timeout_add (100, (GSourceFunc) cycle_window, ov);
g_timeout_add (2000, (GSourceFunc) toggle_events, ov);
return GST_BUS_DROP;