Xnest: use XIDs directly, instead of Xlib's GC
Now that no Xlib drawing functions used anymore, we can finally switch over to using GC XID's directly, instead of Xlib's GC struct. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
aee6eefbd4
commit
3aa6daef7e
|
@ -52,7 +52,7 @@ xnestRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
|
|||
.foreground = 1L,
|
||||
};
|
||||
|
||||
xnChangeGC(xnestUpstreamInfo.conn, xnestBitmapGC->gid, values, valuemask);
|
||||
xnChangeGC(xnestUpstreamInfo.conn, xnestBitmapGC, values, valuemask);
|
||||
|
||||
uint32_t const winId = xnestDefaultWindows[pScreen->myNum];
|
||||
|
||||
|
@ -67,7 +67,7 @@ xnestRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
|
|||
xcb_put_image(xnestUpstreamInfo.conn,
|
||||
XCB_IMAGE_FORMAT_XY_BITMAP,
|
||||
source,
|
||||
xnestBitmapGC->gid,
|
||||
xnestBitmapGC,
|
||||
pCursor->bits->width,
|
||||
pCursor->bits->height,
|
||||
0, // x
|
||||
|
@ -80,7 +80,7 @@ xnestRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
|
|||
xcb_put_image(xnestUpstreamInfo.conn,
|
||||
XCB_IMAGE_FORMAT_XY_BITMAP,
|
||||
mask,
|
||||
xnestBitmapGC->gid,
|
||||
xnestBitmapGC,
|
||||
pCursor->bits->width,
|
||||
pCursor->bits->height,
|
||||
0, // x
|
||||
|
|
|
@ -53,7 +53,7 @@ int xnestNumPixmapFormats;
|
|||
Drawable xnestDefaultDrawables[MAXDEPTH + 1];
|
||||
Pixmap xnestIconBitmap;
|
||||
Pixmap xnestScreenSaverPixmap;
|
||||
XlibGC xnestBitmapGC;
|
||||
uint32_t xnestBitmapGC;
|
||||
unsigned long xnestEventMask;
|
||||
|
||||
static int _X_NORETURN
|
||||
|
@ -157,7 +157,12 @@ xnestOpenDisplay(int argc, char *argv[])
|
|||
xnestDefaultDrawables[xnestPixmapFormats[i].depth] = pixmap;
|
||||
}
|
||||
|
||||
xnestBitmapGC = XCreateGC(xnestDisplay, xnestDefaultDrawables[1], 0L, NULL);
|
||||
xnestBitmapGC = xcb_generate_id(xnestUpstreamInfo.conn);
|
||||
xcb_create_gc(xnestUpstreamInfo.conn,
|
||||
xnestBitmapGC,
|
||||
xnestDefaultDrawables[1],
|
||||
0,
|
||||
NULL);
|
||||
|
||||
if (!(xnestUserGeometry & XValue))
|
||||
xnestX = 0;
|
||||
|
|
|
@ -35,7 +35,7 @@ extern int xnestNumPixmapFormats;
|
|||
extern Drawable xnestDefaultDrawables[MAXDEPTH + 1];
|
||||
extern Pixmap xnestIconBitmap;
|
||||
extern Pixmap xnestScreenSaverPixmap;
|
||||
extern XlibGC xnestBitmapGC;
|
||||
extern uint32_t xnestBitmapGC;
|
||||
extern unsigned long xnestEventMask;
|
||||
|
||||
void xnestOpenDisplay(int argc, char *argv[]);
|
||||
|
|
|
@ -81,9 +81,12 @@ xnestCreateGC(GCPtr pGC)
|
|||
|
||||
pGC->miTranslate = 1;
|
||||
|
||||
xnestGCPriv(pGC)->gc = XCreateGC(xnestDisplay,
|
||||
xnestDefaultDrawables[pGC->depth],
|
||||
0L, NULL);
|
||||
xnestGCPriv(pGC)->gc = xcb_generate_id(xnestUpstreamInfo.conn);
|
||||
xcb_create_gc(xnestUpstreamInfo.conn,
|
||||
xnestGCPriv(pGC)->gc,
|
||||
xnestDefaultDrawables[pGC->depth],
|
||||
0,
|
||||
NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -184,13 +187,16 @@ xnestChangeGC(GCPtr pGC, unsigned long mask)
|
|||
void
|
||||
xnestCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
|
||||
{
|
||||
XCopyGC(xnestDisplay, xnestGC(pGCSrc), mask, xnestGC(pGCDst));
|
||||
xcb_copy_gc(xnestUpstreamInfo.conn,
|
||||
xnestGC(pGCSrc),
|
||||
xnestGC(pGCDst),
|
||||
mask);
|
||||
}
|
||||
|
||||
void
|
||||
xnestDestroyGC(GCPtr pGC)
|
||||
{
|
||||
XFreeGC(xnestDisplay, xnestGC(pGC));
|
||||
xcb_free_gc(xnestUpstreamInfo.conn, xnestGC(pGC));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -20,10 +20,8 @@ is" without express or implied warranty.
|
|||
#include "include/gcstruct.h"
|
||||
#include "include/privates.h"
|
||||
|
||||
/* This file uses the GC definition form Xlib.h as XlibGC. */
|
||||
|
||||
typedef struct {
|
||||
XlibGC gc;
|
||||
uint32_t gc;
|
||||
} xnestPrivGC;
|
||||
|
||||
extern DevPrivateKeyRec xnestGCPrivateKeyRec;
|
||||
|
|
|
@ -38,11 +38,9 @@ uint32_t xnestUpstreamGC(GCPtr pGC) {
|
|||
if (pGC == NULL) return 0;
|
||||
|
||||
xnestPrivGC *priv = dixLookupPrivate(&(pGC)->devPrivates, xnestGCPrivateKey);
|
||||
if ((priv == NULL) || (priv->gc == NULL)) return 0;
|
||||
if (priv == 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;
|
||||
return priv->gc;
|
||||
}
|
||||
|
||||
void xnest_encode_window_attr(XnSetWindowAttr attr, uint32_t mask, uint32_t *values)
|
||||
|
|
Loading…
Reference in New Issue