From 51379e065be1c5b9032f0df940c6241fb5649e5a Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Wed, 19 Dec 2007 15:40:03 +1100 Subject: [PATCH] Clean interface of statusbar_update_position. --- event.c | 2 +- statusbar.c | 42 ++++++++++++++++++++++++++---------------- statusbar.h | 2 +- 3 files changed, 28 insertions(+), 18 deletions(-) diff --git a/event.c b/event.c index 5bfa5c809..80b86fe9d 100644 --- a/event.c +++ b/event.c @@ -208,7 +208,7 @@ handle_event_configurenotify(XEvent * e) globalconf.screens[screen].statusbar->width, globalconf.screens[screen].statusbar->height); - statusbar_update_position(e->xany.display, globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding); + statusbar_update_position(screen); arrange(screen); } } diff --git a/statusbar.c b/statusbar.c index 780e406cf..2928e2e2d 100644 --- a/statusbar.c +++ b/statusbar.c @@ -172,37 +172,49 @@ statusbar_init(int screen) widget_calculate_alignments(statusbar->widgets); - statusbar_update_position(globalconf.display, - statusbar, - &globalconf.screens[screen].padding); + statusbar_update_position(screen); XMapRaised(globalconf.display, statusbar->window); } void -statusbar_update_position(Display *disp, Statusbar *statusbar, Padding *padding) +statusbar_update_position(int screen) { XEvent ev; - ScreenInfo *si = get_screen_info(statusbar->screen, NULL, padding); + Statusbar *statusbar = globalconf.screens[screen].statusbar; + ScreenInfo *si = get_screen_info(statusbar->screen, + NULL, + &globalconf.screens[screen].padding); - XMapRaised(disp, statusbar->window); + XMapRaised(globalconf.display, statusbar->window); switch (statusbar->position) { default: - XMoveWindow(disp, statusbar->window, si[statusbar->screen].x_org, si[statusbar->screen].y_org); + XMoveWindow(globalconf.display, + statusbar->window, + si[statusbar->screen].x_org, + si[statusbar->screen].y_org); break; case BarRight: - XMoveWindow(disp, statusbar->window, si[statusbar->screen].x_org + (si[statusbar->screen].width - statusbar->height), si[statusbar->screen].y_org); + XMoveWindow(globalconf.display, + statusbar->window, + si[statusbar->screen].x_org + + (si[statusbar->screen].width - + statusbar->height), + si[statusbar->screen].y_org); break; case BarBot: - XMoveWindow(disp, statusbar->window, si[statusbar->screen].x_org, si[statusbar->screen].height - statusbar->height); + XMoveWindow(globalconf.display, + statusbar->window, + si[statusbar->screen].x_org, + si[statusbar->screen].height - statusbar->height); break; case BarOff: - XUnmapWindow(disp, statusbar->window); + XUnmapWindow(globalconf.display, statusbar->window); break; } p_delete(&si); - XSync(disp, False); - while(XCheckMaskEvent(disp, EnterWindowMask, &ev)); + XSync(globalconf.display, False); + while(XCheckMaskEvent(globalconf.display, EnterWindowMask, &ev)); } int @@ -231,7 +243,7 @@ uicb_statusbar_toggle(int screen, char *arg __attribute__ ((unused))) globalconf.screens[screen].statusbar->position = (globalconf.screens[screen].statusbar->dposition == BarOff) ? BarTop : globalconf.screens[screen].statusbar->dposition; else globalconf.screens[screen].statusbar->position = BarOff; - statusbar_update_position(globalconf.display, globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding); + statusbar_update_position(screen); arrange(screen); } @@ -246,9 +258,7 @@ uicb_statusbar_set_position(int screen, char *arg) globalconf.screens[screen].statusbar->dposition = globalconf.screens[screen].statusbar->position = statusbar_get_position_from_str(arg); - statusbar_update_position(globalconf.display, - globalconf.screens[screen].statusbar, - &globalconf.screens[screen].padding); + statusbar_update_position(screen); } // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/statusbar.h b/statusbar.h index 6d7629f69..13c6f6ad3 100644 --- a/statusbar.h +++ b/statusbar.h @@ -27,7 +27,7 @@ void statusbar_init(int); void statusbar_draw(int); int statusbar_get_position_from_str(const char *); -void statusbar_update_position(Display *, Statusbar*, Padding *); +void statusbar_update_position(int); UICB_PROTO(uicb_statusbar_toggle); UICB_PROTO(uicb_statusbar_set_position);