From 17bc4dc9a7f5d87cf398e62ef58e41744b3710d6 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Mon, 15 Oct 2007 18:19:33 +0200 Subject: [PATCH] drawstatusbar does not need display as arg --- awesome.c | 2 +- client.c | 2 +- event.c | 4 ++-- layout.c | 4 ++-- statusbar.c | 34 +++++++++++++++++----------------- statusbar.h | 2 +- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/awesome.c b/awesome.c index 6f6658fa..00358fb8 100644 --- a/awesome.c +++ b/awesome.c @@ -320,7 +320,7 @@ main(int argc, char *argv[]) initstatusbar(awesomeconf->display, awesomeconf->screen, &awesomeconf->statusbar, awesomeconf->cursor[CurNormal], awesomeconf->font, awesomeconf->layouts, awesomeconf->nlayouts); - drawstatusbar(dpy, &awesomeconf[screen]); + drawstatusbar(&awesomeconf[screen]); } netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); diff --git a/client.c b/client.c index cbb0ebf1..5d5209c2 100644 --- a/client.c +++ b/client.c @@ -323,7 +323,7 @@ focus(Display *disp, Client * c, Bool selscreen, awesome_config *awesomeconf) if(!selscreen) return; *awesomeconf->client_sel = c; - drawstatusbar(disp, awesomeconf); + drawstatusbar(awesomeconf); if(*awesomeconf->client_sel) { XSetInputFocus(awesomeconf->display, (*awesomeconf->client_sel)->win, RevertToPointerRoot, CurrentTime); diff --git a/event.c b/event.c index 6037b554..33c6fda2 100644 --- a/event.c +++ b/event.c @@ -375,7 +375,7 @@ handle_event_expose(XEvent * e, awesome_config *awesomeconf) if(!ev->count) for(screen = 0; screen < get_screen_count(e->xany.display); screen++) if(awesomeconf[screen].statusbar.window == ev->window) - drawstatusbar(e->xany.display, &awesomeconf[screen]); + drawstatusbar(&awesomeconf[screen]); } void @@ -486,7 +486,7 @@ handle_event_propertynotify(XEvent * e, awesome_config *awesomeconf) { updatetitle(c); if(c == *awesomeconf->client_sel) - drawstatusbar(e->xany.display, &awesomeconf[c->screen]); + drawstatusbar(&awesomeconf[c->screen]); } } } diff --git a/layout.c b/layout.c index 938ffdd9..3d6273d9 100644 --- a/layout.c +++ b/layout.c @@ -119,7 +119,7 @@ restack(Display * disp, awesome_config *awesomeconf) XEvent ev; XWindowChanges wc; - drawstatusbar(disp, awesomeconf); + drawstatusbar(awesomeconf); if(!*awesomeconf->client_sel) return; if(awesomeconf->allow_lower_floats) @@ -195,7 +195,7 @@ uicb_setlayout(awesome_config * awesomeconf, if(*awesomeconf->client_sel) arrange(awesomeconf->display, awesomeconf); else - drawstatusbar(awesomeconf->display, awesomeconf); + drawstatusbar(awesomeconf); saveawesomeprops(awesomeconf); diff --git a/statusbar.c b/statusbar.c index dccf319f..1a080a6f 100644 --- a/statusbar.c +++ b/statusbar.c @@ -46,18 +46,18 @@ isoccupied(Client **head, unsigned int t, int screen) } void -drawstatusbar(Display *disp, awesome_config * awesomeconf) +drawstatusbar(awesome_config * awesomeconf) { int z, i, x = 0, y = 0, w; for(i = 0; i < awesomeconf->ntags; i++) { - w = textwidth(disp, awesomeconf->font, + w = textwidth(awesomeconf->display, awesomeconf->font, awesomeconf->tags[i].name, a_strlen(awesomeconf->tags[i].name)) + awesomeconf->font->height; if(awesomeconf->tags[i].selected) { - drawtext(disp, awesomeconf->phys_screen, + drawtext(awesomeconf->display, awesomeconf->phys_screen, x, y, w, awesomeconf->statusbar.height, awesomeconf->statusbar.drawable, @@ -66,7 +66,7 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf) awesomeconf->font, awesomeconf->tags[i].name, awesomeconf->colors_selected); if(isoccupied(awesomeconf->clients, i, awesomeconf->screen)) - drawrectangle(disp, awesomeconf->phys_screen, + drawrectangle(awesomeconf->display, awesomeconf->phys_screen, x, y, (awesomeconf->font->height + 2) / 4, (awesomeconf->font->height + 2) / 4, @@ -78,7 +78,7 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf) } else { - drawtext(disp, awesomeconf->phys_screen, + drawtext(awesomeconf->display, awesomeconf->phys_screen, x, y, w, awesomeconf->statusbar.height, awesomeconf->statusbar.drawable, @@ -87,7 +87,7 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf) awesomeconf->font, awesomeconf->tags[i].name, awesomeconf->colors_normal); if(isoccupied(awesomeconf->clients, i, awesomeconf->screen)) - drawrectangle(disp, awesomeconf->phys_screen, + drawrectangle(awesomeconf->display, awesomeconf->phys_screen, x, y, (awesomeconf->font->height + 2) / 4, (awesomeconf->font->height + 2) / 4, @@ -99,7 +99,7 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf) } x += w; } - drawtext(disp, awesomeconf->phys_screen, + drawtext(awesomeconf->display, awesomeconf->phys_screen, x, y, awesomeconf->statusbar.txtlayoutwidth, awesomeconf->statusbar.height, awesomeconf->statusbar.drawable, @@ -108,7 +108,7 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf) awesomeconf->font, awesomeconf->current_layout->symbol, awesomeconf->colors_normal); z = x + awesomeconf->statusbar.txtlayoutwidth; - w = textwidth(disp, awesomeconf->font, awesomeconf->statustext, a_strlen(awesomeconf->statustext)) + w = textwidth(awesomeconf->display, awesomeconf->font, awesomeconf->statustext, a_strlen(awesomeconf->statustext)) + awesomeconf->font->height; x = awesomeconf->statusbar.width - w; if(x < z) @@ -116,7 +116,7 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf) x = z; w = awesomeconf->statusbar.width - z; } - drawtext(disp, awesomeconf->phys_screen, + drawtext(awesomeconf->display, awesomeconf->phys_screen, x, y, w, awesomeconf->statusbar.height, awesomeconf->statusbar.drawable, @@ -129,7 +129,7 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf) x = z; if(*awesomeconf->client_sel) { - drawtext(disp, awesomeconf->phys_screen, + drawtext(awesomeconf->display, awesomeconf->phys_screen, x, y, w, awesomeconf->statusbar.height, awesomeconf->statusbar.drawable, @@ -138,7 +138,7 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf) awesomeconf->font, (*awesomeconf->client_sel)->name, awesomeconf->colors_selected); if((*awesomeconf->client_sel)->isfloating) - drawcircle(disp, awesomeconf->phys_screen, + drawcircle(awesomeconf->display, awesomeconf->phys_screen, x, y, (awesomeconf->font->height + 2) / 4, awesomeconf->statusbar.drawable, @@ -151,7 +151,7 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf) { char buf[256]; snprintf(buf, sizeof(buf), "nmaster: %d ncol: %d mwfact: %.2lf", awesomeconf->nmaster, awesomeconf->ncol, awesomeconf->mwfact); - drawtext(disp, awesomeconf->phys_screen, + drawtext(awesomeconf->display, awesomeconf->phys_screen, x, y, w, awesomeconf->statusbar.height, awesomeconf->statusbar.drawable, @@ -161,7 +161,7 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf) buf, awesomeconf->colors_normal); } else - drawtext(disp, awesomeconf->phys_screen, + drawtext(awesomeconf->display, awesomeconf->phys_screen, x, y, w, awesomeconf->statusbar.height, awesomeconf->statusbar.drawable, @@ -170,10 +170,10 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf) awesomeconf->font, NULL, awesomeconf->colors_normal); } - XCopyArea(disp, awesomeconf->statusbar.drawable, - awesomeconf->statusbar.window, DefaultGC(disp, awesomeconf->phys_screen), 0, 0, + XCopyArea(awesomeconf->display, awesomeconf->statusbar.drawable, + awesomeconf->statusbar.window, DefaultGC(awesomeconf->display, awesomeconf->phys_screen), 0, 0, awesomeconf->statusbar.width, awesomeconf->statusbar.height, 0, 0); - XSync(disp, False); + XSync(awesomeconf->display, False); } void @@ -258,6 +258,6 @@ uicb_setstatustext(awesome_config *awesomeconf, const char *arg) return; a_strncpy(awesomeconf->statustext, sizeof(awesomeconf->statustext), arg, a_strlen(arg)); - drawstatusbar(awesomeconf->display, awesomeconf); + drawstatusbar(awesomeconf); } // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 diff --git a/statusbar.h b/statusbar.h index 3c4d365f..61bc4907 100644 --- a/statusbar.h +++ b/statusbar.h @@ -25,7 +25,7 @@ #include "common.h" void initstatusbar(Display *, int, Statusbar *, Cursor, XftFont *, Layout *, int); -void drawstatusbar(Display *, awesome_config *); +void drawstatusbar(awesome_config *); void updatebarpos(Display *, Statusbar); UICB_PROTO(uicb_togglebar);