- printf("expose!\n");
-
- /* re-draw the background */
- xcb_rectangle_t border = {0, 0, 500, font_height + 8}, inner = {2, 2, 496, font_height + 8 - 4};
- xcb_change_gc_single(conn, pixmap_gc, XCB_GC_FOREGROUND, get_colorpixel(conn, "#FF0000"));
- xcb_poly_fill_rectangle(conn, pixmap, pixmap_gc, 1, &border);
- xcb_change_gc_single(conn, pixmap_gc, XCB_GC_FOREGROUND, get_colorpixel(conn, "#000000"));
- xcb_poly_fill_rectangle(conn, pixmap, pixmap_gc, 1, &inner);
-
- /* restore font color */
- xcb_change_gc_single(conn, pixmap_gc, XCB_GC_FOREGROUND, get_colorpixel(conn, "#FFFFFF"));
- uint8_t *con = concat_strings(glyphs_ucs, input_position);
- char *full_text = (char*)con;
- if (prompt != NULL) {
- full_text = malloc((prompt_len + input_position) * 2 + 1);
- if (full_text == NULL)
- err(EXIT_FAILURE, "malloc() failed\n");
- memcpy(full_text, prompt, prompt_len * 2);
- memcpy(full_text + (prompt_len * 2), con, input_position * 2);
- }
- xcb_image_text_16(conn, input_position + prompt_len, pixmap, pixmap_gc, 4 /* X */,
- font_height + 2 /* Y = baseline of font */, (xcb_char2b_t*)full_text);
-
- /* Copy the contents of the pixmap to the real window */
- xcb_copy_area(conn, pixmap, win, pixmap_gc, 0, 0, 0, 0, /* */ 500, font_height + 8);
- xcb_flush(conn);
- free(con);
- if (prompt != NULL)
- free(full_text);
-
- return 1;
+ printf("expose!\n");
+
+ /* re-draw the background */
+ xcb_rectangle_t border = {0, 0, 500, font_height + 8}, inner = {2, 2, 496, font_height + 8 - 4};
+ xcb_change_gc_single(conn, pixmap_gc, XCB_GC_FOREGROUND, get_colorpixel(conn, "#FF0000"));
+ xcb_poly_fill_rectangle(conn, pixmap, pixmap_gc, 1, &border);
+ xcb_change_gc_single(conn, pixmap_gc, XCB_GC_FOREGROUND, get_colorpixel(conn, "#000000"));
+ xcb_poly_fill_rectangle(conn, pixmap, pixmap_gc, 1, &inner);
+
+ /* restore font color */
+ xcb_change_gc_single(conn, pixmap_gc, XCB_GC_FOREGROUND, get_colorpixel(conn, "#FFFFFF"));
+ uint8_t *con = concat_strings(glyphs_ucs, input_position);
+ char *full_text = (char*)con;
+ if (prompt != NULL) {
+ full_text = malloc((prompt_len + input_position) * 2 + 1);
+ if (full_text == NULL)
+ err(EXIT_FAILURE, "malloc() failed\n");
+ memcpy(full_text, prompt, prompt_len * 2);
+ memcpy(full_text + (prompt_len * 2), con, input_position * 2);
+ }
+ xcb_image_text_16(conn, input_position + prompt_len, pixmap, pixmap_gc, 4 /* X */,
+ font_height + 2 /* Y = baseline of font */, (xcb_char2b_t*)full_text);
+
+ /* Copy the contents of the pixmap to the real window */
+ xcb_copy_area(conn, pixmap, win, pixmap_gc, 0, 0, 0, 0, /* */ 500, font_height + 8);
+ xcb_flush(conn);
+ free(con);
+ if (prompt != NULL)
+ free(full_text);
+
+ return 1;