[cogl] framebuffer: in onscreen_x11_get_xid return foreign xids



commit 680c173947c5ff001b9fa780b39b39c21a31c884
Author: Robert Bragg <robert linux intel com>
Date:   Thu May 5 20:41:01 2011 +0100

    framebuffer: in onscreen_x11_get_xid return foreign xids
    
    If a foreign xid has been set on a CoglOnscreen then
    cogl_onscreen_x11_get_window_xid doesn't need to defer to the winsys to
    get the underlying window xid. This also means it's possible to read
    back the xid before the framebuffer is allocated which fixes a crash in
    the x11-foreign example app.

 cogl/cogl-framebuffer.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/cogl/cogl-framebuffer.c b/cogl/cogl-framebuffer.c
index daf817a..e4656f6 100644
--- a/cogl/cogl-framebuffer.c
+++ b/cogl/cogl-framebuffer.c
@@ -1641,9 +1641,14 @@ guint32
 cogl_onscreen_x11_get_window_xid (CoglOnscreen *onscreen)
 {
   CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
-  const CoglWinsysVtable *winsys = _cogl_framebuffer_get_winsys (framebuffer);
 
-  return winsys->onscreen_x11_get_window_xid (onscreen);
+  if (onscreen->foreign_xid)
+    return onscreen->foreign_xid;
+  else
+    {
+      const CoglWinsysVtable *winsys = _cogl_framebuffer_get_winsys (framebuffer);
+      return winsys->onscreen_x11_get_window_xid (onscreen);
+    }
 }
 
 guint32



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]