diff --git a/i3-input/i3-input.h b/i3-input/i3-input.h index 300cb335..3cdcbb78 100644 --- a/i3-input/i3-input.h +++ b/i3-input/i3-input.h @@ -19,6 +19,5 @@ char *convert_utf8_to_ucs2(char *input, int *real_strlen); uint32_t get_mod_mask(xcb_connection_t *conn, uint32_t keycode); xcb_window_t open_input_window(xcb_connection_t *conn, uint32_t width, uint32_t height); int get_font_id(xcb_connection_t *conn, char *pattern, int *font_height); -void xcb_change_gc_single(xcb_connection_t *conn, xcb_gcontext_t gc, uint32_t mask, uint32_t value); #endif diff --git a/include/xcb.h b/include/xcb.h index ef6ed197..9660939d 100644 --- a/include/xcb.h +++ b/include/xcb.h @@ -68,14 +68,6 @@ i3Font load_font(const char *pattern, bool fallback); xcb_window_t create_window(xcb_connection_t *conn, Rect r, uint16_t window_class, enum xcursor_cursor_t cursor, bool map, uint32_t mask, uint32_t *values); -/** - * Changes a single value in the graphic context (so one doesn’t have to - * define an array of values) - * - */ -void xcb_change_gc_single(xcb_connection_t *conn, xcb_gcontext_t gc, - uint32_t mask, uint32_t value); - /** * Draws a line from x,y to to_x,to_y using the given color * diff --git a/src/sighandler.c b/src/sighandler.c index 61e5d4a9..a029422b 100644 --- a/src/sighandler.c +++ b/src/sighandler.c @@ -41,13 +41,13 @@ static int sig_draw_window(xcb_window_t win, int width, int height, int font_hei /* re-draw the background */ xcb_rectangle_t border = { 0, 0, width, height}, inner = { 2, 2, width - 4, height - 4}; - xcb_change_gc_single(conn, pixmap_gc, XCB_GC_FOREGROUND, get_colorpixel("#FF0000")); + xcb_change_gc(conn, pixmap_gc, XCB_GC_FOREGROUND, (uint32_t[]){ get_colorpixel("#FF0000") }); xcb_poly_fill_rectangle(conn, pixmap, pixmap_gc, 1, &border); - xcb_change_gc_single(conn, pixmap_gc, XCB_GC_FOREGROUND, get_colorpixel("#000000")); + xcb_change_gc(conn, pixmap_gc, XCB_GC_FOREGROUND, (uint32_t[]){ get_colorpixel("#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("#FFFFFF")); + xcb_change_gc(conn, pixmap_gc, XCB_GC_FOREGROUND, (uint32_t[]){ get_colorpixel("#FFFFFF") }); for (int i = 0; i < sizeof(crash_text) / sizeof(char*); i++) { int text_len = strlen(crash_text[i]); @@ -170,7 +170,7 @@ void handle_signal(int sig, siginfo_t *info, void *data) { xcb_create_gc(conn, pixmap_gc, pixmap, 0, 0); /* Create graphics context */ - xcb_change_gc_single(conn, pixmap_gc, XCB_GC_FONT, config.font.id); + 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); diff --git a/src/x.c b/src/x.c index 246cbe49..1acb7f3b 100644 --- a/src/x.c +++ b/src/x.c @@ -354,7 +354,7 @@ void x_draw_decoration(Con *con) { ); #endif - xcb_change_gc_single(conn, con->pm_gc, XCB_GC_FOREGROUND, config.client.background); + xcb_change_gc(conn, con->pm_gc, XCB_GC_FOREGROUND, (uint32_t[]) { config.client.background }); xcb_poly_fill_rectangle(conn, con->pixmap, con->pm_gc, sizeof(background) / sizeof(xcb_rectangle_t), background); } @@ -371,7 +371,7 @@ void x_draw_decoration(Con *con) { * (left, bottom and right part). We don’t just fill the whole * rectangle because some childs are not freely resizable and we want * their background color to "shine through". */ - xcb_change_gc_single(conn, con->pm_gc, XCB_GC_FOREGROUND, p->color->background); + xcb_change_gc(conn, con->pm_gc, XCB_GC_FOREGROUND, (uint32_t[]){ p->color->background }); xcb_rectangle_t borders[] = { { 0, 0, br.x, r->height }, { 0, r->height + br.height + br.y, r->width, r->height }, @@ -391,12 +391,12 @@ void x_draw_decoration(Con *con) { goto copy_pixmaps; /* 4: paint the bar */ - xcb_change_gc_single(conn, parent->pm_gc, XCB_GC_FOREGROUND, p->color->background); + xcb_change_gc(conn, parent->pm_gc, XCB_GC_FOREGROUND, (uint32_t[]){ p->color->background }); xcb_rectangle_t drect = { con->deco_rect.x, con->deco_rect.y, con->deco_rect.width, con->deco_rect.height }; xcb_poly_fill_rectangle(conn, parent->pixmap, parent->pm_gc, 1, &drect); /* 5: draw two unconnected lines in border color */ - xcb_change_gc_single(conn, parent->pm_gc, XCB_GC_FOREGROUND, p->color->border); + xcb_change_gc(conn, parent->pm_gc, XCB_GC_FOREGROUND, (uint32_t[]){ p->color->border }); Rect *dr = &(con->deco_rect); xcb_segment_t segments[] = { { dr->x, dr->y, diff --git a/src/xcb.c b/src/xcb.c index 577c023d..587f18b3 100644 --- a/src/xcb.c +++ b/src/xcb.c @@ -108,23 +108,15 @@ xcb_window_t create_window(xcb_connection_t *conn, Rect dims, uint16_t window_cl return result; } -/* - * Changes a single value in the graphic context (so one doesn’t have to define an array of values) - * - */ -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); -} - /* * Draws a line from x,y to to_x,to_y using the given color * */ void xcb_draw_line(xcb_connection_t *conn, xcb_drawable_t drawable, xcb_gcontext_t gc, uint32_t colorpixel, uint32_t x, uint32_t y, uint32_t to_x, uint32_t to_y) { - xcb_change_gc_single(conn, gc, XCB_GC_FOREGROUND, colorpixel); - xcb_point_t points[] = {{x, y}, {to_x, to_y}}; - xcb_poly_line(conn, XCB_COORD_MODE_ORIGIN, drawable, gc, 2, points); + xcb_change_gc(conn, gc, XCB_GC_FOREGROUND, (uint32_t[]){ colorpixel }); + xcb_poly_line(conn, XCB_COORD_MODE_ORIGIN, drawable, gc, 2, + (xcb_point_t[]) { {x, y}, {to_x, to_y} }); } /* @@ -133,7 +125,7 @@ void xcb_draw_line(xcb_connection_t *conn, xcb_drawable_t drawable, xcb_gcontext */ void xcb_draw_rect(xcb_connection_t *conn, xcb_drawable_t drawable, xcb_gcontext_t gc, uint32_t colorpixel, uint32_t x, uint32_t y, uint32_t width, uint32_t height) { - xcb_change_gc_single(conn, gc, XCB_GC_FOREGROUND, colorpixel); + xcb_change_gc(conn, gc, XCB_GC_FOREGROUND, (uint32_t[]){ colorpixel }); xcb_rectangle_t rect = {x, y, width, height}; xcb_poly_fill_rectangle(conn, drawable, gc, 1, &rect); }