Implement set_font_colors.

This paves the way for other font rendering backends. Fonts and
colors shouldn't be specified manually from now on.
This commit is contained in:
Fernando Tarlá Cardoso Lemos
2011-11-14 20:20:18 -02:00
committed by Michael Stapelberg
parent eafc7af606
commit 344c04af12
8 changed files with 63 additions and 68 deletions

View File

@ -47,11 +47,11 @@ static int sig_draw_window(xcb_window_t win, int width, int height, int font_hei
xcb_poly_fill_rectangle(conn, pixmap, pixmap_gc, 1, &inner);
/* restore font color */
xcb_change_gc(conn, pixmap_gc, XCB_GC_FOREGROUND, (uint32_t[]){ get_colorpixel("#FFFFFF") });
set_font_colors(pixmap_gc, get_colorpixel("#FFFFFF"), get_colorpixel("#000000"));
for (int i = 0; i < sizeof(crash_text) / sizeof(char*); i++) {
draw_text(crash_text[i], strlen(crash_text[i]), false,
pixmap, pixmap_gc, 8, 3 + (i - 1) * font_height);
draw_text(crash_text[i], strlen(crash_text[i]), false, pixmap, pixmap_gc,
8, 3 + (i - 1) * font_height, width - 16);
}
/* Copy the contents of the pixmap to the real window */
@ -165,9 +165,6 @@ void handle_signal(int sig, siginfo_t *info, void *data) {
xcb_create_pixmap(conn, root_depth, pixmap, win, width, height);
xcb_create_gc(conn, pixmap_gc, pixmap, 0, 0);
/* Create graphics context */
xcb_change_gc(conn, pixmap_gc, XCB_GC_FONT, (uint32_t[]){ config.font.id });
/* Grab the keyboard to get all input */
xcb_grab_keyboard(conn, false, win, XCB_CURRENT_TIME, XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC);