diff --git a/hw/xnest/Cursor.c b/hw/xnest/Cursor.c index 28e289366..7f6caa175 100644 --- a/hw/xnest/Cursor.c +++ b/hw/xnest/Cursor.c @@ -43,19 +43,16 @@ xnestCursorFuncRec xnestCursorFuncs = { NULL }; Bool xnestRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) { - unsigned long valuemask; - XGCValues values; + uint32_t valuemask = XCB_GC_FUNCTION | XCB_GC_PLANE_MASK | XCB_GC_FOREGROUND + | XCB_GC_BACKGROUND | XCB_GC_CLIP_MASK; - valuemask = GCFunction | - GCPlaneMask | GCForeground | GCBackground | GCClipMask; + XnGCValues values = { + .function = XCB_GX_COPY, + .plane_mask = ((unsigned long)~0L), + .foreground = 1L, + }; - values.function = GXcopy; - values.plane_mask = AllPlanes; - values.foreground = 1L; - values.background = 0L; - values.clip_mask = XCB_PIXMAP_NONE; - - XChangeGC(xnestDisplay, xnestBitmapGC, valuemask, &values); + xnChangeGC(xnestUpstreamInfo.conn, xnestBitmapGC->gid, values, valuemask); uint32_t const winId = xnestDefaultWindows[pScreen->myNum]; diff --git a/hw/xnest/GC.c b/hw/xnest/GC.c index a1328f96d..41addf51b 100644 --- a/hw/xnest/GC.c +++ b/hw/xnest/GC.c @@ -29,6 +29,7 @@ is" without express or implied warranty. #include "region.h" #include "Xnest.h" +#include "xnest-xcb.h" #include "Display.h" #include "XNGC.h" @@ -95,7 +96,7 @@ xnestValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable) void xnestChangeGC(GCPtr pGC, unsigned long mask) { - XGCValues values; + XnGCValues values; if (mask & GCFunction) values.function = pGC->alu; @@ -174,7 +175,7 @@ xnestChangeGC(GCPtr pGC, unsigned long mask) values.arc_mode = pGC->arcMode; if (mask) - XChangeGC(xnestDisplay, xnestGC(pGC), mask, &values); + xnChangeGC(xnestUpstreamInfo.conn, xnestUpstreamGC(pGC), values, mask); } void diff --git a/hw/xnest/xcb.c b/hw/xnest/xcb.c index f9c1c065a..041d2ae82 100644 --- a/hw/xnest/xcb.c +++ b/hw/xnest/xcb.c @@ -115,3 +115,37 @@ void xnestEncodeKeyboardControl(XnKeyboardControl ctrl, long mask, uint32_t *val if (mask & KBAutoRepeatMode) *value++ = ctrl.auto_repeat_mode; } + +void xnChangeGC(xcb_connection_t *conn, uint32_t gc, XnGCValues gcval, uint32_t mask) +{ + char value_list[128] = { 0 }; + char *walk = value_list; + +#define EXTRA_VALUE(flag,val) if (mask & flag) { *((uint32_t*)walk) = gcval.val; walk+=4; } + EXTRA_VALUE(GCFunction, function); + EXTRA_VALUE(GCPlaneMask, plane_mask); + EXTRA_VALUE(GCForeground, foreground); + EXTRA_VALUE(GCBackground, background); + EXTRA_VALUE(GCLineWidth, line_width); + EXTRA_VALUE(GCLineStyle, line_style); + EXTRA_VALUE(GCCapStyle, cap_style); + EXTRA_VALUE(GCJoinStyle, join_style); + EXTRA_VALUE(GCFillStyle, fill_style); + EXTRA_VALUE(GCFillRule, fill_rule); + EXTRA_VALUE(GCTile, tile); + EXTRA_VALUE(GCStipple, stipple); + EXTRA_VALUE(GCTileStipXOrigin, ts_x_origin); + EXTRA_VALUE(GCTileStipYOrigin, ts_y_origin); + EXTRA_VALUE(GCFont, font); + EXTRA_VALUE(GCSubwindowMode, subwindow_mode); + EXTRA_VALUE(GCGraphicsExposures, graphics_exposures); + EXTRA_VALUE(GCClipXOrigin, clip_x_origin); + EXTRA_VALUE(GCClipYOrigin, clip_y_origin); + EXTRA_VALUE(GCClipMask, clip_mask); + EXTRA_VALUE(GCDashOffset, dash_offset); + EXTRA_VALUE(GCDashList, dashes); + EXTRA_VALUE(GCArcMode, arc_mode); +#undef EXTRA_VALUE + + xcb_change_gc(conn, gc, mask, value_list); +} diff --git a/hw/xnest/xnest-xcb.h b/hw/xnest/xnest-xcb.h index 28e0afcde..c849f0386 100644 --- a/hw/xnest/xnest-xcb.h +++ b/hw/xnest/xnest-xcb.h @@ -65,4 +65,34 @@ typedef struct { void xnestEncodeKeyboardControl(XnKeyboardControl ctrl, long mask, uint32_t *value); +typedef struct { + int function; /* logical operation */ + unsigned long plane_mask;/* plane mask */ + unsigned long foreground;/* foreground pixel */ + unsigned long background;/* background pixel */ + int line_width; /* line width */ + int line_style; /* LineSolid, LineOnOffDash, LineDoubleDash */ + int cap_style; /* CapNotLast, CapButt, + CapRound, CapProjecting */ + int join_style; /* JoinMiter, JoinRound, JoinBevel */ + int fill_style; /* FillSolid, FillTiled, + FillStippled, FillOpaqueStippled */ + int fill_rule; /* EvenOddRule, WindingRule */ + int arc_mode; /* ArcChord, ArcPieSlice */ + xcb_pixmap_t tile; /* tile pixmap for tiling operations */ + xcb_pixmap_t stipple; /* stipple 1 plane pixmap for stippling */ + int ts_x_origin; /* offset for tile or stipple operations */ + int ts_y_origin; + xcb_font_t font; /* default text font for text operations */ + int subwindow_mode; /* ClipByChildren, IncludeInferiors */ + Bool graphics_exposures;/* boolean, should exposures be generated */ + int clip_x_origin; /* origin for clipping */ + int clip_y_origin; + xcb_pixmap_t clip_mask; /* bitmap clipping; other calls for rects */ + int dash_offset; /* patterned/dashed line information */ + char dashes; +} XnGCValues; + +void xnChangeGC(xcb_connection_t *conn, uint32_t gc, XnGCValues gcval, uint32_t mask); + #endif /* __XNEST__XCB_H */