From 80c119a8734fca3718d603196289ed3a9f65ccbc Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Fri, 7 Sep 2007 17:25:10 +0200 Subject: [PATCH] remove global var screen, compute it --- config.c | 4 +--- event.c | 3 +-- jdwm.c | 13 ++++++------- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/config.c b/config.c index 937b4b73..012e08d4 100644 --- a/config.c +++ b/config.c @@ -133,8 +133,6 @@ name_func_lookup(const char *funcname, const NameFuncLink * list) return NULL; } -/** \todo remove screen */ -extern int screen; /** \todo remove dc */ extern DC dc; @@ -153,7 +151,7 @@ uicb_reload(Display *disp, jdwm_config *jdwmconf, const char *arg __attribute__ p_delete(&jdwmconf->selected_tags); p_delete(&jdwmconf->layouts); p_delete(&jdwmconf->tag_layouts); - parse_config(disp, screen, &dc, jdwmconf); + parse_config(disp, DefaultScreen(disp), &dc, jdwmconf); } /** Set default configuration diff --git a/event.c b/event.c index a4f9197d..e086622f 100644 --- a/event.c +++ b/event.c @@ -13,7 +13,6 @@ #include "layouts/floating.h" /* extern */ -extern int screen; /* screen geometry */ extern int wax, way, wah, waw; /* windowarea geometry */ extern Window barwin; extern DC dc; /* global draw context */ @@ -239,7 +238,7 @@ handle_event_configurenotify(XEvent * e, jdwm_config *jdwmconf) DisplayWidth(e->xany.display, DefaultScreen(e->xany.display)) = ev->width; DisplayHeight(e->xany.display, DefaultScreen(e->xany.display)) = ev->height; XFreePixmap(e->xany.display, dc.drawable); - dc.drawable = XCreatePixmap(e->xany.display, DefaultRootWindow(e->xany.display), DisplayWidth(e->xany.display, DefaultScreen(e->xany.display)), jdwmconf->statusbar.height, DefaultDepth(e->xany.display, screen)); + dc.drawable = XCreatePixmap(e->xany.display, DefaultRootWindow(e->xany.display), DisplayWidth(e->xany.display, DefaultScreen(e->xany.display)), jdwmconf->statusbar.height, DefaultDepth(e->xany.display, DefaultScreen(e->xany.display))); XResizeWindow(e->xany.display, barwin, DisplayWidth(e->xany.display, DefaultScreen(e->xany.display)), jdwmconf->statusbar.height); updatebarpos(e->xany.display, jdwmconf->statusbar); arrange(e->xany.display, jdwmconf); diff --git a/jdwm.c b/jdwm.c index fa5be544..a220539a 100644 --- a/jdwm.c +++ b/jdwm.c @@ -18,7 +18,7 @@ #include "layout.h" #include "tag.h" -int screen, sx, sy, wax, way, waw, wah; +int sx, sy, wax, way, waw, wah; Atom wmatom[WMLast], netatom[NetLast]; Client *clients = NULL; Client *sel = NULL; @@ -176,14 +176,14 @@ setup(Display *disp, jdwm_config *jdwmconf) wa.background_pixmap = ParentRelative; wa.event_mask = ButtonPressMask | ExposureMask; barwin = XCreateWindow(disp, DefaultRootWindow(disp), sx, sy, DisplayWidth(disp, DefaultScreen(disp)), jdwmconf->statusbar.height, 0, - DefaultDepth(disp, screen), CopyFromParent, - DefaultVisual(disp, screen), + DefaultDepth(disp, DefaultScreen(disp)), CopyFromParent, + DefaultVisual(disp, DefaultScreen(disp)), CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); XDefineCursor(disp, barwin, cursor[CurNormal]); updatebarpos(disp, jdwmconf->statusbar); XMapRaised(disp, barwin); /* pixmap for everything */ - dc.drawable = XCreatePixmap(disp, DefaultRootWindow(disp), DisplayWidth(disp, DefaultScreen(disp)), jdwmconf->statusbar.height, DefaultDepth(disp, screen)); + dc.drawable = XCreatePixmap(disp, DefaultRootWindow(disp), DisplayWidth(disp, DefaultScreen(disp)), jdwmconf->statusbar.height, DefaultDepth(disp, DefaultScreen(disp))); dc.gc = XCreateGC(disp, DefaultRootWindow(disp), 0, 0); XSetLineAttributes(disp, dc.gc, 1, LineSolid, CapButt, JoinMiter); if(!dc.font.set) @@ -285,8 +285,7 @@ main(int argc, char *argv[]) if(!(dpy = XOpenDisplay(NULL))) eprint("jdwm: cannot open display\n"); xfd = ConnectionNumber(dpy); - screen = DefaultScreen(dpy); - root = RootWindow(dpy, screen); + root = RootWindow(dpy, DefaultScreen(dpy)); XSetErrorHandler(xerrorstart); /* this causes an error if some other window manager is running */ @@ -300,7 +299,7 @@ main(int argc, char *argv[]) XSetErrorHandler(NULL); xerrorxlib = XSetErrorHandler(xerror); XSync(dpy, False); - parse_config(dpy, screen, &dc, &jdwmconf); + parse_config(dpy, DefaultScreen(dpy), &dc, &jdwmconf); setup(dpy, &jdwmconf); drawstatus(dpy, &jdwmconf); scan(dpy, &jdwmconf);