static void xftfont_get_colors (struct frame *f, struct face *face, GC gc, struct xftface_info *xftface_info, XftColor *fg, XftColor *bg) { if (xftface_info && face->gc == gc) { *fg = xftface_info->xft_fg; if (bg) *bg = xftface_info->xft_bg; } else { XGCValues xgcv; bool fg_done = 0, bg_done = 0; block_input (); XGetGCValues (FRAME_X_DISPLAY (f), gc, GCForeground | GCBackground, &xgcv); if (xftface_info) { if (xgcv.foreground == face->foreground) *fg = xftface_info->xft_fg, fg_done = 1; else if (xgcv.foreground == face->background) *fg = xftface_info->xft_bg, fg_done = 1; if (! bg) bg_done = 1; else if (xgcv.background == face->background) *bg = xftface_info->xft_bg, bg_done = 1; else if (xgcv.background == face->foreground) *bg = xftface_info->xft_fg, bg_done = 1; } if (! (fg_done & bg_done)) { XColor colors[2]; colors[0].pixel = fg->pixel = xgcv.foreground; if (bg) colors[1].pixel = bg->pixel = xgcv.background; XQueryColors (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), colors, bg ? 2 : 1); fg->color.alpha = 0xFFFF; fg->color.red = colors[0].red; fg->color.green = colors[0].green; fg->color.blue = colors[0].blue; if (bg) { bg->color.alpha = 0xFFFF; bg->color.red = colors[1].red; bg->color.green = colors[1].green; bg->color.blue = colors[1].blue; } } unblock_input (); } }
static XftDraw * xftfont_get_xft_draw (struct frame *f) { XftDraw *xft_draw = font_get_frame_data (f, &xftfont_driver); if (! xft_draw) { block_input (); xft_draw= XftDrawCreate (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), FRAME_X_VISUAL (f), FRAME_X_COLORMAP (f)); unblock_input (); eassert (xft_draw != NULL); font_put_frame_data (f, &xftfont_driver, xft_draw); } return xft_draw; }
static XftDraw * xftfont_get_xft_draw (FRAME_PTR f) { XftDraw *xft_draw = font_get_frame_data (f, &xftfont_driver); if (! xft_draw) { BLOCK_INPUT; xft_draw= XftDrawCreate (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), FRAME_X_VISUAL (f), FRAME_X_COLORMAP (f)); UNBLOCK_INPUT; if (! xft_draw) abort (); font_put_frame_data (f, &xftfont_driver, xft_draw); } return xft_draw; }