From 8d30ef7d43a9bbe2aabd275b39303b0fb96468d9 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Mon, 25 May 2009 12:27:46 +0200 Subject: [PATCH] Add a border_color parameter to simplewindow_init() All callers immediately called simplewindow_border_color_set() anyway. Signed-off-by: Uli Schlachter --- swindow.c | 11 +++++++---- swindow.h | 2 +- titlebar.c | 5 ++--- wibox.c | 3 +-- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/swindow.c b/swindow.c index 2591e342..d06a7066 100644 --- a/swindow.c +++ b/swindow.c @@ -73,11 +73,12 @@ simplewindow_init(simple_window_t *sw, int phys_screen, area_t geometry, uint16_t border_width, + const xcolor_t *border_color, orientation_t orientation, const xcolor_t *fg, const xcolor_t *bg) { xcb_screen_t *s = xutil_screen_get(globalconf.connection, phys_screen); - uint32_t create_win_val[3]; + uint32_t create_win_val[4]; const uint32_t gc_mask = XCB_GC_FOREGROUND | XCB_GC_BACKGROUND; const uint32_t gc_values[2] = { s->black_pixel, s->white_pixel }; @@ -96,10 +97,12 @@ simplewindow_init(simple_window_t *sw, sw->orientation = orientation; sw->ctx.fg = *fg; sw->ctx.bg = *bg; + sw->border.color = *border_color; create_win_val[0] = XCB_BACK_PIXMAP_PARENT_RELATIVE; - create_win_val[1] = 1; - create_win_val[2] = XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT + create_win_val[1] = border_color->pixel; + create_win_val[2] = 1; + create_win_val[3] = XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW | XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE @@ -109,7 +112,7 @@ simplewindow_init(simple_window_t *sw, xcb_create_window(globalconf.connection, s->root_depth, sw->window, s->root, sw->geometries.internal.x, sw->geometries.internal.y, sw->geometries.internal.width, sw->geometries.internal.height, border_width, XCB_COPY_FROM_PARENT, s->root_visual, - XCB_CW_BACK_PIXMAP | XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK, + XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL | XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK, create_win_val); sw->pixmap = xcb_generate_id(globalconf.connection); diff --git a/swindow.h b/swindow.h index a51969e4..9df3fd19 100644 --- a/swindow.h +++ b/swindow.h @@ -55,7 +55,7 @@ typedef struct simple_window_t } simple_window_t; void simplewindow_init(simple_window_t *s, - int, area_t, uint16_t, + int, area_t, uint16_t, const xcolor_t *, orientation_t, const xcolor_t *, const xcolor_t *); void simplewindow_wipe(simple_window_t *); diff --git a/titlebar.c b/titlebar.c index c79a7a0a..cb495888 100644 --- a/titlebar.c +++ b/titlebar.c @@ -274,9 +274,8 @@ titlebar_client_attach(client_t *c) titlebar_geometry_compute(c, titlebar_geometry_remove(c->titlebar, 0, c->geometry), &wingeom); simplewindow_init(&t->sw, c->phys_screen, - wingeom, 0, t->sw.orientation, - &t->sw.ctx.fg, &t->sw.ctx.bg); - simplewindow_border_color_set(&t->sw, &t->sw.border.color); + wingeom, 0, &t->sw.border.color, + t->sw.orientation, &t->sw.ctx.fg, &t->sw.ctx.bg); t->need_update = true; diff --git a/wibox.c b/wibox.c index e006f5e0..f958164b 100644 --- a/wibox.c +++ b/wibox.c @@ -431,11 +431,10 @@ wibox_attach(screen_t *s) simplewindow_init(&wibox->sw, phys_screen, wibox->sw.geometry, wibox->sw.border.width, + &wibox->sw.border.color, wibox->sw.orientation, &wibox->sw.ctx.fg, &wibox->sw.ctx.bg); - simplewindow_border_color_set(&wibox->sw, &wibox->sw.border.color); - simplewindow_cursor_set(&wibox->sw, xcursor_new(globalconf.connection, xcursor_font_fromstr(wibox->cursor))); if(wibox->isvisible)