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.
This commit is contained in:
Robert Bragg 2011-05-05 20:41:01 +01:00
parent ccd0079b57
commit 680c173947

View File

@ -1641,9 +1641,14 @@ guint32
cogl_onscreen_x11_get_window_xid (CoglOnscreen *onscreen) cogl_onscreen_x11_get_window_xid (CoglOnscreen *onscreen)
{ {
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
const CoglWinsysVtable *winsys = _cogl_framebuffer_get_winsys (framebuffer);
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); return winsys->onscreen_x11_get_window_xid (onscreen);
}
} }
guint32 guint32