diff --git a/awesome.c b/awesome.c index 5f62d768..d28b4b36 100644 --- a/awesome.c +++ b/awesome.c @@ -184,6 +184,7 @@ xerrorstart(Display * dsply __attribute__ ((unused)), XErrorEvent * ee __attribu void uicb_quit(Display *disp __attribute__ ((unused)), + DC *drawcontext __attribute__ ((unused)), awesome_config *awesomeconf __attribute__((unused)), const char *arg __attribute__ ((unused))) { diff --git a/awesome.h b/awesome.h index a6162686..cbde5225 100644 --- a/awesome.h +++ b/awesome.h @@ -29,7 +29,7 @@ enum Bool gettextprop(Display *, Window, Atom, char *, unsigned int); /* return text property, UTF-8 compliant */ void updatebarpos(Display *, Statusbar); /* updates the bar position */ -void uicb_quit(Display *, awesome_config *, const char *); /* quit awesome nicely */ +void uicb_quit(Display *, DC *, awesome_config *, const char *); /* quit awesome nicely */ int xerror(Display *, XErrorEvent *); /* awesome's X error handler */ int get_windows_area_x(Statusbar); int get_windows_area_y(Statusbar); diff --git a/client.c b/client.c index e878048e..00c70ac9 100644 --- a/client.c +++ b/client.c @@ -297,6 +297,7 @@ focus(Display *disp, DC *drawcontext, Client * c, Bool selscreen, awesome_config */ void uicb_killclient(Display *disp __attribute__ ((unused)), + DC *drawcontext __attribute__ ((unused)), awesome_config *awesomeconf __attribute__ ((unused)), const char *arg __attribute__ ((unused))) { @@ -481,6 +482,7 @@ resize(Client * c, int x, int y, int w, int h, Bool sizehints) void uicb_moveresize(Display *disp __attribute__ ((unused)), + DC *drawcontext __attribute__ ((unused)), awesome_config *awesomeconf, const char *arg) { @@ -637,6 +639,7 @@ updatesizehints(Client * c) void uicb_settrans(Display *disp __attribute__ ((unused)), + DC *drawcontext __attribute__ ((unused)), awesome_config *awesomeconf __attribute__ ((unused)), const char *arg) { diff --git a/client.h b/client.h index 64f9fbb5..1aea89c6 100644 --- a/client.h +++ b/client.h @@ -60,8 +60,8 @@ void unmanage(Client *, DC *, long, awesome_config *); /* unmanage c */ void updatesizehints(Client *); /* update the size hint variables of c */ void updatetitle(Client *); /* update the name of c */ void saveprops(Client * c, int); /* saves client properties */ -void uicb_killclient(Display *, awesome_config *, const char *); /* kill client */ -void uicb_moveresize(Display *, awesome_config *, const char *); /* move and resize window */ -void uicb_settrans(Display *, awesome_config *, const char *); +void uicb_killclient(Display *, DC *, awesome_config *, const char *); /* kill client */ +void uicb_moveresize(Display *, DC *, awesome_config *, const char *); /* move and resize window */ +void uicb_settrans(Display *, DC *, awesome_config *, const char *); #endif diff --git a/config.h b/config.h index d1e33edf..bf783e8a 100644 --- a/config.h +++ b/config.h @@ -69,7 +69,7 @@ typedef struct { unsigned long mod; KeySym keysym; - void (*func) (Display *, awesome_config *, const char *); + void (*func) (Display *, DC *, awesome_config *, const char *); const char *arg; } Key; diff --git a/event.c b/event.c index 02a1a8cd..b9ae2f41 100644 --- a/event.c +++ b/event.c @@ -155,22 +155,22 @@ handle_event_buttonpress(XEvent * e, awesome_config *awesomeconf) if(ev->button == Button1) { if(ev->state & awesomeconf->modkey) - uicb_tag(e->xany.display, awesomeconf, awesomeconf->tags[i]); + uicb_tag(e->xany.display, &dc, awesomeconf, awesomeconf->tags[i]); else - uicb_view(e->xany.display, awesomeconf, awesomeconf->tags[i]); + uicb_view(e->xany.display, &dc, awesomeconf, awesomeconf->tags[i]); } else if(ev->button == Button3) { if(ev->state & awesomeconf->modkey) - uicb_toggletag(e->xany.display, awesomeconf, awesomeconf->tags[i]); + uicb_toggletag(e->xany.display, &dc, awesomeconf, awesomeconf->tags[i]); else - uicb_toggleview(e->xany.display, awesomeconf, awesomeconf->tags[i]); + uicb_toggleview(e->xany.display, &dc, awesomeconf, awesomeconf->tags[i]); } return; } } if((ev->x < x + awesomeconf->statusbar.width) && ev->button == Button1) - uicb_setlayout(e->xany.display, awesomeconf, NULL); + uicb_setlayout(e->xany.display, &dc, awesomeconf, NULL); } else if((c = getclient(ev->window))) { @@ -179,23 +179,23 @@ handle_event_buttonpress(XEvent * e, awesome_config *awesomeconf) return; if(ev->button == Button1 && (IS_ARRANGE(floating) || c->isfloating)) { - restack(e->xany.display, awesomeconf); + restack(e->xany.display, &dc, awesomeconf); movemouse(c, awesomeconf); } else if(ev->button == Button2) - uicb_zoom(e->xany.display, awesomeconf, NULL); + uicb_zoom(e->xany.display, &dc, awesomeconf, NULL); else if(ev->button == Button3 && (IS_ARRANGE(floating) || c->isfloating) && !c->isfixed) { - restack(e->xany.display, awesomeconf); + restack(e->xany.display, &dc, awesomeconf); resizemouse(c, awesomeconf); } } else if(DefaultRootWindow(e->xany.display) == ev->window && !sel) { if(ev->button == Button4) - uicb_tag_viewnext(e->xany.display, awesomeconf, NULL); + uicb_tag_viewnext(e->xany.display, &dc, awesomeconf, NULL); else if(ev->button == Button5) - uicb_tag_viewprev(e->xany.display, awesomeconf, NULL); + uicb_tag_viewprev(e->xany.display, &dc, awesomeconf, NULL); } } @@ -313,7 +313,7 @@ handle_event_keypress(XEvent * e, awesome_config *awesomeconf) for(i = 0; i < awesomeconf->nkeys; i++) if(keysym == awesomeconf->keys[i].keysym && CLEANMASK(awesomeconf->keys[i].mod) == CLEANMASK(ev->state) && awesomeconf->keys[i].func) - awesomeconf->keys[i].func(e->xany.display, awesomeconf, awesomeconf->keys[i].arg); + awesomeconf->keys[i].func(e->xany.display, &dc, awesomeconf, awesomeconf->keys[i].arg); } void diff --git a/layout.c b/layout.c index 7ebe2c23..e6ce2528 100644 --- a/layout.c +++ b/layout.c @@ -29,10 +29,9 @@ /* extern */ extern Client *clients, *sel; /* global client list */ -extern DC dc; void -arrange(Display * disp, DC *drawcontext, awesome_config *awesomeconf) +arrange(Display * disp, DC *drawcontext, awesome_config *awesomeconf) { Client *c; @@ -43,11 +42,12 @@ arrange(Display * disp, DC *drawcontext, awesome_config *awesomeconf) ban(c); awesomeconf->current_layout->arrange(disp, awesomeconf); focus(disp, drawcontext, NULL, True, awesomeconf); - restack(disp, awesomeconf); + restack(disp, drawcontext, awesomeconf); } void uicb_focusnext(Display *disp __attribute__ ((unused)), + DC *drawcontext, awesome_config * awesomeconf, const char *arg __attribute__ ((unused))) { @@ -60,13 +60,14 @@ uicb_focusnext(Display *disp __attribute__ ((unused)), for(c = clients; c && !isvisible(c, awesomeconf->selected_tags, awesomeconf->ntags); c = c->next); if(c) { - focus(c->display, &dc, c, True, awesomeconf); - restack(c->display, awesomeconf); + focus(c->display, drawcontext, c, True, awesomeconf); + restack(c->display, drawcontext, awesomeconf); } } void uicb_focusprev(Display *disp __attribute__ ((unused)), + DC *drawcontext, awesome_config *awesomeconf, const char *arg __attribute__ ((unused))) { @@ -82,8 +83,8 @@ uicb_focusprev(Display *disp __attribute__ ((unused)), } if(c) { - focus(c->display, &dc, c, True, awesomeconf); - restack(c->display, awesomeconf); + focus(c->display, drawcontext, c, True, awesomeconf); + restack(c->display, drawcontext, awesomeconf); } } @@ -103,13 +104,13 @@ loadawesomeprops(Display *disp, awesome_config * awesomeconf) } void -restack(Display * disp, awesome_config *awesomeconf) +restack(Display * disp, DC * drawcontext, awesome_config *awesomeconf) { Client *c; XEvent ev; XWindowChanges wc; - drawstatus(disp, &dc, awesomeconf); + drawstatus(disp, drawcontext, awesomeconf); if(!sel) return; if(sel->isfloating || IS_ARRANGE(floating)) @@ -152,7 +153,10 @@ saveawesomeprops(Display *disp, awesome_config *awesomeconf) } void -uicb_setlayout(Display *disp, awesome_config * awesomeconf, const char *arg) +uicb_setlayout(Display *disp, + DC *drawcontext, + awesome_config * awesomeconf, + const char *arg) { int i, j; Client *c; @@ -174,9 +178,9 @@ uicb_setlayout(Display *disp, awesome_config * awesomeconf, const char *arg) c->ftview = True; if(sel) - arrange(disp, &dc, awesomeconf); + arrange(disp, drawcontext, awesomeconf); else - drawstatus(disp, &dc, awesomeconf); + drawstatus(disp, drawcontext, awesomeconf); saveawesomeprops(disp, awesomeconf); @@ -187,6 +191,7 @@ uicb_setlayout(Display *disp, awesome_config * awesomeconf, const char *arg) void uicb_togglebar(Display *disp, + DC *drawcontext, awesome_config *awesomeconf, const char *arg __attribute__ ((unused))) { @@ -195,11 +200,11 @@ uicb_togglebar(Display *disp, else awesomeconf->statusbar.position = BarOff; updatebarpos(disp, awesomeconf->statusbar); - arrange(disp, &dc, awesomeconf); + arrange(disp, drawcontext, awesomeconf); } static void -maximize(int x, int y, int w, int h, awesome_config *awesomeconf) +maximize(int x, int y, int w, int h, DC *drawcontext, awesome_config *awesomeconf) { XEvent ev; @@ -221,24 +226,28 @@ maximize(int x, int y, int w, int h, awesome_config *awesomeconf) else sel->isfloating = False; - drawstatus(sel->display, &dc, awesomeconf); + drawstatus(sel->display, drawcontext, awesomeconf); while(XCheckMaskEvent(sel->display, EnterWindowMask, &ev)); } void uicb_togglemax(Display *disp, + DC *drawcontext, awesome_config *awesomeconf, const char *arg __attribute__ ((unused))) { maximize(get_windows_area_x(awesomeconf->statusbar), get_windows_area_y(awesomeconf->statusbar), get_windows_area_width(disp, awesomeconf->statusbar) - 2 * awesomeconf->borderpx, - get_windows_area_height(disp, awesomeconf->statusbar) - 2 * awesomeconf->borderpx, awesomeconf); + get_windows_area_height(disp, awesomeconf->statusbar) - 2 * awesomeconf->borderpx, + drawcontext, + awesomeconf); } void uicb_toggleverticalmax(Display *disp, + DC *drawcontext, awesome_config *awesomeconf, const char *arg __attribute__ ((unused))) { @@ -247,12 +256,14 @@ uicb_toggleverticalmax(Display *disp, get_windows_area_y(awesomeconf->statusbar), sel->w, get_windows_area_height(disp, awesomeconf->statusbar) - 2 * awesomeconf->borderpx, + drawcontext, awesomeconf); } void uicb_togglehorizontalmax(Display *disp, + DC *drawcontext, awesome_config *awesomeconf, const char *arg __attribute__ ((unused))) { @@ -261,11 +272,13 @@ uicb_togglehorizontalmax(Display *disp, sel->y, get_windows_area_height(disp, awesomeconf->statusbar) - 2 * awesomeconf->borderpx, sel->h, + drawcontext, awesomeconf); } void uicb_zoom(Display *disp __attribute__ ((unused)), + DC *drawcontext __attribute__ ((unused)), awesome_config *awesomeconf, const char *arg __attribute__ ((unused))) { @@ -273,7 +286,7 @@ uicb_zoom(Display *disp __attribute__ ((unused)), return; detach(sel); attach(sel); - focus(sel->display, &dc, sel, True, awesomeconf); - arrange(sel->display, &dc, awesomeconf); + focus(sel->display, drawcontext, sel, True, awesomeconf); + arrange(sel->display, drawcontext, awesomeconf); } diff --git a/layout.h b/layout.h index bf7c2553..f98b4517 100644 --- a/layout.h +++ b/layout.h @@ -30,15 +30,15 @@ #define AWESOMEPROPS_ATOM(disp) XInternAtom(disp, "_AWESOME_PROPERTIES", False) void arrange(Display *, DC *, awesome_config *); /* arranges all windows depending on the layout in use */ -void restack(Display *, awesome_config *); /* restores z layers of all clients */ -void uicb_focusnext(Display *, awesome_config *, const char *); /* focuses next visible client */ -void uicb_focusprev(Display *, awesome_config *, const char *); /* focuses prev visible client */ -void uicb_setlayout(Display *, awesome_config *, const char *); /* sets layout, NULL means next layout */ -void uicb_togglebar(Display *, awesome_config *, const char *); /* shows/hides the bar */ -void uicb_togglemax(Display *, awesome_config *, const char *); /* toggles maximization of floating client */ -void uicb_toggleverticalmax(Display *, awesome_config *, const char *); -void uicb_togglehorizontalmax(Display *, awesome_config *, const char *); -void uicb_zoom(Display *, awesome_config *, const char *); /* set current window first in stack */ +void restack(Display *, DC *, awesome_config *); /* restores z layers of all clients */ +void uicb_focusnext(Display *, DC *, awesome_config *, const char *); /* focuses next visible client */ +void uicb_focusprev(Display *, DC *, awesome_config *, const char *); /* focuses prev visible client */ +void uicb_setlayout(Display *, DC *, awesome_config *, const char *); /* sets layout, NULL means next layout */ +void uicb_togglebar(Display *, DC *, awesome_config *, const char *); /* shows/hides the bar */ +void uicb_togglemax(Display *, DC *, awesome_config *, const char *); /* toggles maximization of floating client */ +void uicb_toggleverticalmax(Display *, DC *, awesome_config *, const char *); +void uicb_togglehorizontalmax(Display *, DC *, awesome_config *, const char *); +void uicb_zoom(Display *, DC *, awesome_config *, const char *); /* set current window first in stack */ void loadawesomeprops(Display *, awesome_config *); void saveawesomeprops(Display *disp, awesome_config *); diff --git a/tag.c b/tag.c index aaacf2dc..f4d9ca31 100644 --- a/tag.c +++ b/tag.c @@ -26,7 +26,6 @@ #include "tag.h" extern Client *sel; /* global client list */ -extern DC dc; static Regs *regs = NULL; @@ -144,7 +143,10 @@ isvisible(Client * c, Bool * tags, int ntags) * \ingroup ui_callback */ void -uicb_tag(Display *disp, awesome_config *awesomeconf, const char *arg) +uicb_tag(Display *disp, + DC *drawcontext, + awesome_config *awesomeconf, + const char *arg) { int i; @@ -156,7 +158,7 @@ uicb_tag(Display *disp, awesome_config *awesomeconf, const char *arg) if(i >= 0 && i < awesomeconf->ntags) sel->tags[i] = True; saveprops(sel, awesomeconf->ntags); - arrange(disp, &dc, awesomeconf); + arrange(disp, drawcontext, awesomeconf); } /** Toggle floating state of a client @@ -166,6 +168,7 @@ uicb_tag(Display *disp, awesome_config *awesomeconf, const char *arg) */ void uicb_togglefloating(Display *disp, + DC *drawcontext, awesome_config * awesomeconf, const char *arg __attribute__ ((unused))) { @@ -184,7 +187,7 @@ uicb_togglefloating(Display *disp, sel->rh = sel->h; } saveprops(sel, awesomeconf->ntags); - arrange(disp, &dc, awesomeconf); + arrange(disp, drawcontext, awesomeconf); } /** Toggle tag view @@ -194,6 +197,7 @@ uicb_togglefloating(Display *disp, */ void uicb_toggletag(Display *disp, + DC *drawcontext, awesome_config *awesomeconf, const char *arg) { @@ -208,7 +212,7 @@ uicb_toggletag(Display *disp, if(j == awesomeconf->ntags) sel->tags[i] = True; saveprops(sel, awesomeconf->ntags); - arrange(disp, &dc, awesomeconf); + arrange(disp, drawcontext, awesomeconf); } /** Add a tag to viewed tags @@ -218,6 +222,7 @@ uicb_toggletag(Display *disp, */ void uicb_toggleview(Display *disp, + DC *drawcontext, awesome_config *awesomeconf, const char *arg) { @@ -230,7 +235,7 @@ uicb_toggleview(Display *disp, if(j == awesomeconf->ntags) awesomeconf->selected_tags[i] = True; /* cannot toggle last view */ saveawesomeprops(disp, awesomeconf); - arrange(disp, &dc, awesomeconf); + arrange(disp, drawcontext, awesomeconf); } /** View tag @@ -241,6 +246,7 @@ uicb_toggleview(Display *disp, */ void uicb_view(Display *disp, + DC *drawcontext, awesome_config *awesomeconf, const char *arg) { @@ -258,7 +264,7 @@ uicb_view(Display *disp, awesomeconf->current_layout = awesomeconf->tag_layouts[i]; } saveawesomeprops(disp, awesomeconf); - arrange(disp, &dc, awesomeconf); + arrange(disp, drawcontext, awesomeconf); } /** View previously selected tags @@ -269,6 +275,7 @@ uicb_view(Display *disp, */ void uicb_viewprevtags(Display * disp, + DC *drawcontext, awesome_config *awesomeconf, const char *arg __attribute__ ((unused))) { @@ -281,7 +288,7 @@ uicb_viewprevtags(Display * disp, awesomeconf->selected_tags[i] = awesomeconf->prev_selected_tags[i]; awesomeconf->prev_selected_tags[i] = t; } - arrange(disp, &dc, awesomeconf); + arrange(disp, drawcontext, awesomeconf); } /** View next tag @@ -291,6 +298,7 @@ uicb_viewprevtags(Display * disp, */ void uicb_tag_viewnext(Display *disp, + DC * drawcontext, awesome_config *awesomeconf, const char *arg __attribute__ ((unused))) { @@ -307,7 +315,7 @@ uicb_tag_viewnext(Display *disp, firsttag = 0; awesomeconf->selected_tags[firsttag] = True; saveawesomeprops(disp, awesomeconf); - arrange(disp, &dc, awesomeconf); + arrange(disp, drawcontext, awesomeconf); } /** View previous tag @@ -317,6 +325,7 @@ uicb_tag_viewnext(Display *disp, */ void uicb_tag_viewprev(Display *disp, + DC *drawcontext, awesome_config *awesomeconf, const char *arg __attribute__ ((unused))) { @@ -333,5 +342,5 @@ uicb_tag_viewprev(Display *disp, firsttag = awesomeconf->ntags - 1; awesomeconf->selected_tags[firsttag] = True; saveawesomeprops(disp, awesomeconf); - arrange(disp, &dc, awesomeconf); + arrange(disp, drawcontext, awesomeconf); } diff --git a/tag.h b/tag.h index 99dda31a..446f305d 100644 --- a/tag.h +++ b/tag.h @@ -31,14 +31,14 @@ void compileregs(Rule *, int); /* initialize regexps of rules defined in config.h */ Bool isvisible(Client *, Bool *, int); void applyrules(Client * c, awesome_config *); /* applies rules to c */ -void uicb_tag(Display *, awesome_config *, const char *); /* tags sel with arg's index */ -void uicb_togglefloating(Display *, awesome_config *, const char *); /* toggles sel between floating/tiled state */ -void uicb_toggletag(Display *, awesome_config *, const char *); /* toggles sel tags with arg's index */ -void uicb_toggleview(Display *, awesome_config *, const char *); /* toggles the tag with arg's index (in)visible */ -void uicb_view(Display *, awesome_config *, const char *); /* views the tag with arg's index */ -void uicb_viewprevtags(Display *, awesome_config *, const char *); -void uicb_tag_viewnext(Display *, awesome_config *, const char *); /* view only tag just after the first selected */ -void uicb_tag_viewprev(Display *, awesome_config *, const char *); /* view only tag just before the first selected */ +void uicb_tag(Display *, DC *, awesome_config *, const char *); /* tags sel with arg's index */ +void uicb_togglefloating(Display *, DC *, awesome_config *, const char *); /* toggles sel between floating/tiled state */ +void uicb_toggletag(Display *, DC *, awesome_config *, const char *); /* toggles sel tags with arg's index */ +void uicb_toggleview(Display *, DC *, awesome_config *, const char *); /* toggles the tag with arg's index (in)visible */ +void uicb_view(Display *, DC *, awesome_config *, const char *); /* views the tag with arg's index */ +void uicb_viewprevtags(Display *, DC *, awesome_config *, const char *); +void uicb_tag_viewnext(Display *, DC *, awesome_config *, const char *); /* view only tag just after the first selected */ +void uicb_tag_viewprev(Display *, DC *, awesome_config *, const char *); /* view only tag just before the first selected */ typedef struct {