drawstatusbar does not need display as arg

This commit is contained in:
Julien Danjou 2007-10-15 18:19:33 +02:00
parent 5b130bd18d
commit 17bc4dc9a7
6 changed files with 24 additions and 24 deletions

View File

@ -320,7 +320,7 @@ main(int argc, char *argv[])
initstatusbar(awesomeconf->display, awesomeconf->screen, &awesomeconf->statusbar, initstatusbar(awesomeconf->display, awesomeconf->screen, &awesomeconf->statusbar,
awesomeconf->cursor[CurNormal], awesomeconf->font, awesomeconf->cursor[CurNormal], awesomeconf->font,
awesomeconf->layouts, awesomeconf->nlayouts); awesomeconf->layouts, awesomeconf->nlayouts);
drawstatusbar(dpy, &awesomeconf[screen]); drawstatusbar(&awesomeconf[screen]);
} }
netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);

View File

@ -323,7 +323,7 @@ focus(Display *disp, Client * c, Bool selscreen, awesome_config *awesomeconf)
if(!selscreen) if(!selscreen)
return; return;
*awesomeconf->client_sel = c; *awesomeconf->client_sel = c;
drawstatusbar(disp, awesomeconf); drawstatusbar(awesomeconf);
if(*awesomeconf->client_sel) if(*awesomeconf->client_sel)
{ {
XSetInputFocus(awesomeconf->display, (*awesomeconf->client_sel)->win, RevertToPointerRoot, CurrentTime); XSetInputFocus(awesomeconf->display, (*awesomeconf->client_sel)->win, RevertToPointerRoot, CurrentTime);

View File

@ -375,7 +375,7 @@ handle_event_expose(XEvent * e, awesome_config *awesomeconf)
if(!ev->count) if(!ev->count)
for(screen = 0; screen < get_screen_count(e->xany.display); screen++) for(screen = 0; screen < get_screen_count(e->xany.display); screen++)
if(awesomeconf[screen].statusbar.window == ev->window) if(awesomeconf[screen].statusbar.window == ev->window)
drawstatusbar(e->xany.display, &awesomeconf[screen]); drawstatusbar(&awesomeconf[screen]);
} }
void void
@ -486,7 +486,7 @@ handle_event_propertynotify(XEvent * e, awesome_config *awesomeconf)
{ {
updatetitle(c); updatetitle(c);
if(c == *awesomeconf->client_sel) if(c == *awesomeconf->client_sel)
drawstatusbar(e->xany.display, &awesomeconf[c->screen]); drawstatusbar(&awesomeconf[c->screen]);
} }
} }
} }

View File

@ -119,7 +119,7 @@ restack(Display * disp, awesome_config *awesomeconf)
XEvent ev; XEvent ev;
XWindowChanges wc; XWindowChanges wc;
drawstatusbar(disp, awesomeconf); drawstatusbar(awesomeconf);
if(!*awesomeconf->client_sel) if(!*awesomeconf->client_sel)
return; return;
if(awesomeconf->allow_lower_floats) if(awesomeconf->allow_lower_floats)
@ -195,7 +195,7 @@ uicb_setlayout(awesome_config * awesomeconf,
if(*awesomeconf->client_sel) if(*awesomeconf->client_sel)
arrange(awesomeconf->display, awesomeconf); arrange(awesomeconf->display, awesomeconf);
else else
drawstatusbar(awesomeconf->display, awesomeconf); drawstatusbar(awesomeconf);
saveawesomeprops(awesomeconf); saveawesomeprops(awesomeconf);

View File

@ -46,18 +46,18 @@ isoccupied(Client **head, unsigned int t, int screen)
} }
void void
drawstatusbar(Display *disp, awesome_config * awesomeconf) drawstatusbar(awesome_config * awesomeconf)
{ {
int z, i, x = 0, y = 0, w; int z, i, x = 0, y = 0, w;
for(i = 0; i < awesomeconf->ntags; i++) 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->tags[i].name, a_strlen(awesomeconf->tags[i].name))
+ awesomeconf->font->height; + awesomeconf->font->height;
if(awesomeconf->tags[i].selected) if(awesomeconf->tags[i].selected)
{ {
drawtext(disp, awesomeconf->phys_screen, drawtext(awesomeconf->display, awesomeconf->phys_screen,
x, y, w, x, y, w,
awesomeconf->statusbar.height, awesomeconf->statusbar.height,
awesomeconf->statusbar.drawable, awesomeconf->statusbar.drawable,
@ -66,7 +66,7 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf)
awesomeconf->font, awesomeconf->font,
awesomeconf->tags[i].name, awesomeconf->colors_selected); awesomeconf->tags[i].name, awesomeconf->colors_selected);
if(isoccupied(awesomeconf->clients, i, awesomeconf->screen)) if(isoccupied(awesomeconf->clients, i, awesomeconf->screen))
drawrectangle(disp, awesomeconf->phys_screen, drawrectangle(awesomeconf->display, awesomeconf->phys_screen,
x, y, x, y,
(awesomeconf->font->height + 2) / 4, (awesomeconf->font->height + 2) / 4,
(awesomeconf->font->height + 2) / 4, (awesomeconf->font->height + 2) / 4,
@ -78,7 +78,7 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf)
} }
else else
{ {
drawtext(disp, awesomeconf->phys_screen, drawtext(awesomeconf->display, awesomeconf->phys_screen,
x, y, w, x, y, w,
awesomeconf->statusbar.height, awesomeconf->statusbar.height,
awesomeconf->statusbar.drawable, awesomeconf->statusbar.drawable,
@ -87,7 +87,7 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf)
awesomeconf->font, awesomeconf->font,
awesomeconf->tags[i].name, awesomeconf->colors_normal); awesomeconf->tags[i].name, awesomeconf->colors_normal);
if(isoccupied(awesomeconf->clients, i, awesomeconf->screen)) if(isoccupied(awesomeconf->clients, i, awesomeconf->screen))
drawrectangle(disp, awesomeconf->phys_screen, drawrectangle(awesomeconf->display, awesomeconf->phys_screen,
x, y, x, y,
(awesomeconf->font->height + 2) / 4, (awesomeconf->font->height + 2) / 4,
(awesomeconf->font->height + 2) / 4, (awesomeconf->font->height + 2) / 4,
@ -99,7 +99,7 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf)
} }
x += w; x += w;
} }
drawtext(disp, awesomeconf->phys_screen, drawtext(awesomeconf->display, awesomeconf->phys_screen,
x, y, awesomeconf->statusbar.txtlayoutwidth, x, y, awesomeconf->statusbar.txtlayoutwidth,
awesomeconf->statusbar.height, awesomeconf->statusbar.height,
awesomeconf->statusbar.drawable, awesomeconf->statusbar.drawable,
@ -108,7 +108,7 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf)
awesomeconf->font, awesomeconf->font,
awesomeconf->current_layout->symbol, awesomeconf->colors_normal); awesomeconf->current_layout->symbol, awesomeconf->colors_normal);
z = x + awesomeconf->statusbar.txtlayoutwidth; 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; + awesomeconf->font->height;
x = awesomeconf->statusbar.width - w; x = awesomeconf->statusbar.width - w;
if(x < z) if(x < z)
@ -116,7 +116,7 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf)
x = z; x = z;
w = awesomeconf->statusbar.width - z; w = awesomeconf->statusbar.width - z;
} }
drawtext(disp, awesomeconf->phys_screen, drawtext(awesomeconf->display, awesomeconf->phys_screen,
x, y, w, x, y, w,
awesomeconf->statusbar.height, awesomeconf->statusbar.height,
awesomeconf->statusbar.drawable, awesomeconf->statusbar.drawable,
@ -129,7 +129,7 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf)
x = z; x = z;
if(*awesomeconf->client_sel) if(*awesomeconf->client_sel)
{ {
drawtext(disp, awesomeconf->phys_screen, drawtext(awesomeconf->display, awesomeconf->phys_screen,
x, y, w, x, y, w,
awesomeconf->statusbar.height, awesomeconf->statusbar.height,
awesomeconf->statusbar.drawable, awesomeconf->statusbar.drawable,
@ -138,7 +138,7 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf)
awesomeconf->font, awesomeconf->font,
(*awesomeconf->client_sel)->name, awesomeconf->colors_selected); (*awesomeconf->client_sel)->name, awesomeconf->colors_selected);
if((*awesomeconf->client_sel)->isfloating) if((*awesomeconf->client_sel)->isfloating)
drawcircle(disp, awesomeconf->phys_screen, drawcircle(awesomeconf->display, awesomeconf->phys_screen,
x, y, x, y,
(awesomeconf->font->height + 2) / 4, (awesomeconf->font->height + 2) / 4,
awesomeconf->statusbar.drawable, awesomeconf->statusbar.drawable,
@ -151,7 +151,7 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf)
{ {
char buf[256]; char buf[256];
snprintf(buf, sizeof(buf), "nmaster: %d ncol: %d mwfact: %.2lf", awesomeconf->nmaster, awesomeconf->ncol, awesomeconf->mwfact); 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, x, y, w,
awesomeconf->statusbar.height, awesomeconf->statusbar.height,
awesomeconf->statusbar.drawable, awesomeconf->statusbar.drawable,
@ -161,7 +161,7 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf)
buf, awesomeconf->colors_normal); buf, awesomeconf->colors_normal);
} }
else else
drawtext(disp, awesomeconf->phys_screen, drawtext(awesomeconf->display, awesomeconf->phys_screen,
x, y, w, x, y, w,
awesomeconf->statusbar.height, awesomeconf->statusbar.height,
awesomeconf->statusbar.drawable, awesomeconf->statusbar.drawable,
@ -170,10 +170,10 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf)
awesomeconf->font, awesomeconf->font,
NULL, awesomeconf->colors_normal); NULL, awesomeconf->colors_normal);
} }
XCopyArea(disp, awesomeconf->statusbar.drawable, XCopyArea(awesomeconf->display, awesomeconf->statusbar.drawable,
awesomeconf->statusbar.window, DefaultGC(disp, awesomeconf->phys_screen), 0, 0, awesomeconf->statusbar.window, DefaultGC(awesomeconf->display, awesomeconf->phys_screen), 0, 0,
awesomeconf->statusbar.width, awesomeconf->statusbar.height, 0, 0); awesomeconf->statusbar.width, awesomeconf->statusbar.height, 0, 0);
XSync(disp, False); XSync(awesomeconf->display, False);
} }
void void
@ -258,6 +258,6 @@ uicb_setstatustext(awesome_config *awesomeconf, const char *arg)
return; return;
a_strncpy(awesomeconf->statustext, sizeof(awesomeconf->statustext), arg, a_strlen(arg)); 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 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99

View File

@ -25,7 +25,7 @@
#include "common.h" #include "common.h"
void initstatusbar(Display *, int, Statusbar *, Cursor, XftFont *, Layout *, int); void initstatusbar(Display *, int, Statusbar *, Cursor, XftFont *, Layout *, int);
void drawstatusbar(Display *, awesome_config *); void drawstatusbar(awesome_config *);
void updatebarpos(Display *, Statusbar); void updatebarpos(Display *, Statusbar);
UICB_PROTO(uicb_togglebar); UICB_PROTO(uicb_togglebar);