Win ECreateWinFromXwin(Window xwin) { Win win; Window rr; int x, y; unsigned int w, h, bw, depth; if (!XGetGeometry(disp, xwin, &rr, &x, &y, &w, &h, &bw, &depth)) return NULL; win = EXidCreate(); if (!win) return NULL; win->xwin = xwin; win->x = x; win->y = y; win->w = w; win->h = h; win->depth = depth; win->visual = WinGetVisual(VROOT); win->cmap = WinGetCmap(VROOT); #if DEBUG_XWIN Eprintf("EXidWFX: %p %#lx\n", win, win->xwin); #endif return win; }
void _xft_FdcSetColor(TextState * ts, unsigned int color) { FontCtxXft *fdc = (FontCtxXft *) ts->fdc; XRenderColor xrc; COLOR32_TO_ARGB16(color, xrc.alpha, xrc.red, xrc.green, xrc.blue); XftColorAllocValue(disp, WinGetVisual(fdc->win), WinGetCmap(fdc->win), &xrc, &(fdc->xftc)); }
int _xft_FdcInit(TextState * ts, Win win, EX_Drawable draw) { FontCtxXft *fdc = (FontCtxXft *) ts->fdc; fdc->win = win; fdc->draw = draw; fdc->xftd = XftDrawCreate(disp, draw, WinGetVisual(win), WinGetCmap(win)); if (!fdc->xftd) return -1; return 0; }