scan() and cleanup take DC as arg

This commit is contained in:
Julien Danjou 2007-09-12 17:43:14 +02:00
parent e0994f834e
commit 95a5bb3cdd
1 changed files with 12 additions and 12 deletions

View File

@ -47,21 +47,21 @@ static int (*xerrorxlib) (Display *, XErrorEvent *);
static Bool readin = True, running = True; static Bool readin = True, running = True;
static void static void
cleanup(Display *disp, awesome_config *awesomeconf) cleanup(Display *disp, DC *drawcontext, awesome_config *awesomeconf)
{ {
close(STDIN_FILENO); close(STDIN_FILENO);
while(stack) while(stack)
{ {
unban(stack); unban(stack);
unmanage(stack, &dc, NormalState, awesomeconf); unmanage(stack, drawcontext, NormalState, awesomeconf);
} }
if(dc.font.set) if(drawcontext->font.set)
XFreeFontSet(disp, dc.font.set); XFreeFontSet(disp, drawcontext->font.set);
else else
XFreeFont(disp, dc.font.xfont); XFreeFont(disp, drawcontext->font.xfont);
XUngrabKey(disp, AnyKey, AnyModifier, DefaultRootWindow(disp)); XUngrabKey(disp, AnyKey, AnyModifier, DefaultRootWindow(disp));
XFreePixmap(disp, dc.drawable); XFreePixmap(disp, drawcontext->drawable);
XFreeGC(disp, dc.gc); XFreeGC(disp, drawcontext->gc);
XDestroyWindow(disp, awesomeconf->statusbar.window); XDestroyWindow(disp, awesomeconf->statusbar.window);
XFreeCursor(disp, cursor[CurNormal]); XFreeCursor(disp, cursor[CurNormal]);
XFreeCursor(disp, cursor[CurResize]); XFreeCursor(disp, cursor[CurResize]);
@ -90,7 +90,7 @@ getstate(Display *disp, Window w)
} }
static void static void
scan(Display *disp, awesome_config *awesomeconf) scan(Display *disp, DC *drawcontext, awesome_config *awesomeconf)
{ {
unsigned int i, num; unsigned int i, num;
Window *wins, d1, d2; Window *wins, d1, d2;
@ -104,7 +104,7 @@ scan(Display *disp, awesome_config *awesomeconf)
|| wa.override_redirect || XGetTransientForHint(disp, wins[i], &d1)) || wa.override_redirect || XGetTransientForHint(disp, wins[i], &d1))
continue; continue;
if(wa.map_state == IsViewable || getstate(disp, wins[i]) == IconicState) if(wa.map_state == IsViewable || getstate(disp, wins[i]) == IconicState)
manage(disp, &dc, wins[i], &wa, awesomeconf); manage(disp, drawcontext, wins[i], &wa, awesomeconf);
} }
/* now the transients */ /* now the transients */
for(i = 0; i < num; i++) for(i = 0; i < num; i++)
@ -113,7 +113,7 @@ scan(Display *disp, awesome_config *awesomeconf)
continue; continue;
if(XGetTransientForHint(disp, wins[i], &d1) if(XGetTransientForHint(disp, wins[i], &d1)
&& (wa.map_state == IsViewable || getstate(disp, wins[i]) == IconicState)) && (wa.map_state == IsViewable || getstate(disp, wins[i]) == IconicState))
manage(disp, &dc, wins[i], &wa, awesomeconf); manage(disp, drawcontext, wins[i], &wa, awesomeconf);
} }
if(wins) if(wins)
XFree(wins); XFree(wins);
@ -301,7 +301,7 @@ main(int argc, char *argv[])
parse_config(dpy, DefaultScreen(dpy), &dc, &awesomeconf); parse_config(dpy, DefaultScreen(dpy), &dc, &awesomeconf);
setup(dpy, &dc, &awesomeconf); setup(dpy, &dc, &awesomeconf);
drawstatus(dpy, &dc, &awesomeconf); drawstatus(dpy, &dc, &awesomeconf);
scan(dpy, &awesomeconf); scan(dpy, &dc, &awesomeconf);
XSync(dpy, False); XSync(dpy, False);
void (*handler[LASTEvent]) (XEvent *, awesome_config *) = void (*handler[LASTEvent]) (XEvent *, awesome_config *) =
@ -364,7 +364,7 @@ main(int argc, char *argv[])
(handler[ev.type]) (&ev, &awesomeconf); /* call handler */ (handler[ev.type]) (&ev, &awesomeconf); /* call handler */
} }
} }
cleanup(dpy, &awesomeconf); cleanup(dpy, &dc, &awesomeconf);
XCloseDisplay(dpy); XCloseDisplay(dpy);
return 0; return 0;