xvimagesink: init geometry when setting new xid
authorStefan Kost <ensonic@users.sf.net>
Tue, 13 Apr 2010 13:20:10 +0000 (16:20 +0300)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Wed, 14 Apr 2010 14:19:19 +0000 (15:19 +0100)
Don't rely on expose event to query geomentry after new xid is set.

Fixes #615647.

sys/xvimage/xvimagesink.c

index 6b0383c..8298a9a 100644 (file)
@@ -2789,12 +2789,24 @@ gst_xvimagesink_set_xwindow_id (GstXOverlay * overlay, XID xwindow_id)
           GST_VIDEO_SINK_HEIGHT (xvimagesink));
     }
   } else {
+    XWindowAttributes attr;
+
     xwindow = g_new0 (GstXWindow, 1);
     xwindow->win = xwindow_id;
 
     /* Set the event we want to receive and create a GC */
     g_mutex_lock (xvimagesink->x_lock);
+
+    XGetWindowAttributes (xvimagesink->xcontext->disp, xwindow->win, &attr);
+
+    xwindow->width = attr.width;
+    xwindow->height = attr.height;
     xwindow->internal = FALSE;
+    if (!xvimagesink->have_render_rect) {
+      xvimagesink->render_rect.x = xvimagesink->render_rect.y = 0;
+      xvimagesink->render_rect.w = attr.width;
+      xvimagesink->render_rect.h = attr.height;
+    }
     if (xvimagesink->handle_events) {
       XSelectInput (xvimagesink->xcontext->disp, xwindow->win, ExposureMask |
           StructureNotifyMask | PointerMotionMask | KeyPressMask |