Add a border_color parameter to simplewindow_init()

All callers immediately called simplewindow_border_color_set() anyway.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2009-05-25 12:27:46 +02:00 committed by Julien Danjou
parent ac2d026d59
commit 8d30ef7d43
4 changed files with 11 additions and 10 deletions

View File

@ -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);

View File

@ -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 *);

View File

@ -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;

View File

@ -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)