diff --git a/hw/xnest/Xnest.h b/hw/xnest/Xnest.h index 8fd0066c2..d24491206 100644 --- a/hw/xnest/Xnest.h +++ b/hw/xnest/Xnest.h @@ -68,6 +68,7 @@ typedef XID KeySym64; #endif /*_XSERVER64*/ #include +#include #include #include #include diff --git a/hw/xnest/xcb.c b/hw/xnest/xcb.c index a93628886..18fbc09ff 100644 --- a/hw/xnest/xcb.c +++ b/hw/xnest/xcb.c @@ -10,8 +10,11 @@ #include #include +#include "include/gc.h" + #include "Xnest.h" #include "xnest-xcb.h" +#include "XNGC.h" #include "Display.h" @@ -29,3 +32,15 @@ void xnest_upstream_setup(void) { xcb_screen_next (&iter); xnestUpstreamInfo.screenInfo = iter.data; } + +/* retrieve upstream GC XID for our xserver GC */ +uint32_t xnest_upstream_gc(GCPtr pGC) { + if (pGC == NULL) return 0; + + xnestPrivGC *priv = dixLookupPrivate(&(pGC)->devPrivates, xnestGCPrivateKey); + if ((priv == NULL) || (priv->gc == NULL)) return 0; + + // make sure Xlib's GC cache is written out before using (server side) GC. + XFlushGC(xnestDisplay, priv->gc); + return priv->gc->gid; +} diff --git a/hw/xnest/xnest-xcb.h b/hw/xnest/xnest-xcb.h index 391e84d22..3c35e04dc 100644 --- a/hw/xnest/xnest-xcb.h +++ b/hw/xnest/xnest-xcb.h @@ -19,4 +19,7 @@ extern struct xnest_upstream_info xnestUpstreamInfo; /* fetch upstream connection's xcb setup data */ void xnest_upstream_setup(void); +/* retrieve upstream GC XID for our xserver GC */ +uint32_t xnest_upstream_gc(GCPtr pGC); + #endif /* __XNEST__XCB_H */