i3-input: eliminate xcb_change_gc_single usage with C99
This commit is contained in:
parent
4f57d49318
commit
0086bcb2b4
|
@ -92,13 +92,13 @@ static int handle_expose(void *data, xcb_connection_t *conn, xcb_expose_event_t
|
||||||
|
|
||||||
/* re-draw the background */
|
/* re-draw the background */
|
||||||
xcb_rectangle_t border = {0, 0, 500, font_height + 8}, inner = {2, 2, 496, font_height + 8 - 4};
|
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_change_gc(conn, pixmap_gc, XCB_GC_FOREGROUND, (uint32_t[]){ get_colorpixel(conn, "#FF0000") });
|
||||||
xcb_poly_fill_rectangle(conn, pixmap, pixmap_gc, 1, &border);
|
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_change_gc(conn, pixmap_gc, XCB_GC_FOREGROUND, (uint32_t[]){ get_colorpixel(conn, "#000000") });
|
||||||
xcb_poly_fill_rectangle(conn, pixmap, pixmap_gc, 1, &inner);
|
xcb_poly_fill_rectangle(conn, pixmap, pixmap_gc, 1, &inner);
|
||||||
|
|
||||||
/* restore font color */
|
/* restore font color */
|
||||||
xcb_change_gc_single(conn, pixmap_gc, XCB_GC_FOREGROUND, get_colorpixel(conn, "#FFFFFF"));
|
xcb_change_gc(conn, pixmap_gc, XCB_GC_FOREGROUND, (uint32_t[]){ get_colorpixel(conn, "#FFFFFF") });
|
||||||
uint8_t *con = concat_strings(glyphs_ucs, input_position);
|
uint8_t *con = concat_strings(glyphs_ucs, input_position);
|
||||||
char *full_text = (char*)con;
|
char *full_text = (char*)con;
|
||||||
if (prompt != NULL) {
|
if (prompt != NULL) {
|
||||||
|
@ -374,7 +374,7 @@ int main(int argc, char *argv[]) {
|
||||||
xcb_set_input_focus(conn, XCB_INPUT_FOCUS_POINTER_ROOT, win, XCB_CURRENT_TIME);
|
xcb_set_input_focus(conn, XCB_INPUT_FOCUS_POINTER_ROOT, win, XCB_CURRENT_TIME);
|
||||||
|
|
||||||
/* Create graphics context */
|
/* Create graphics context */
|
||||||
xcb_change_gc_single(conn, pixmap_gc, XCB_GC_FONT, font_id);
|
xcb_change_gc(conn, pixmap_gc, XCB_GC_FONT, (uint32_t[]){ font_id });
|
||||||
|
|
||||||
/* Grab the keyboard to get all input */
|
/* Grab the keyboard to get all input */
|
||||||
xcb_flush(conn);
|
xcb_flush(conn);
|
||||||
|
|
|
@ -20,14 +20,6 @@
|
||||||
|
|
||||||
#include "i3-input.h"
|
#include "i3-input.h"
|
||||||
|
|
||||||
/*
|
|
||||||
* Convenience-wrapper around xcb_change_gc which saves us declaring a variable
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void xcb_change_gc_single(xcb_connection_t *conn, xcb_gcontext_t gc, uint32_t mask, uint32_t value) {
|
|
||||||
xcb_change_gc(conn, gc, mask, &value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns the colorpixel to use for the given hex color (think of HTML).
|
* Returns the colorpixel to use for the given hex color (think of HTML).
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue