diff --git a/awesome.c b/awesome.c index c3ec95f5..ddfe3a68 100644 --- a/awesome.c +++ b/awesome.c @@ -197,6 +197,7 @@ xerrorstart(Display * dsply __attribute__ ((unused)), XErrorEvent * ee __attribu void uicb_quit(Display *disp __attribute__ ((unused)), + int screen __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 d7977d79..83a2557a 100644 --- a/awesome.h +++ b/awesome.h @@ -24,7 +24,7 @@ #include "config.h" -void uicb_quit(Display *, DC *, awesome_config *, const char *); /* quit awesome nicely */ +void uicb_quit(Display *, int, DC *, awesome_config *, const char *); /* quit awesome nicely */ int xerror(Display *, XErrorEvent *); /* awesome's X error handler */ int __attribute__ ((deprecated)) get_windows_area_x(Statusbar); int __attribute__ ((deprecated)) get_windows_area_y(Statusbar); diff --git a/client.c b/client.c index c17cf386..feb65764 100644 --- a/client.c +++ b/client.c @@ -301,6 +301,7 @@ focus(Display *disp, int screen, DC *drawcontext, Client * c, Bool selscreen, aw */ void uicb_killclient(Display *disp __attribute__ ((unused)), + int screen __attribute__ ((unused)), DC *drawcontext __attribute__ ((unused)), awesome_config *awesomeconf __attribute__ ((unused)), const char *arg __attribute__ ((unused))) @@ -490,6 +491,7 @@ resize(Client * c, int x, int y, int w, int h, Bool sizehints) void uicb_moveresize(Display *disp __attribute__ ((unused)), + int screen __attribute__ ((unused)), DC *drawcontext __attribute__ ((unused)), awesome_config *awesomeconf, const char *arg) @@ -658,6 +660,7 @@ set_shape(Client *c) void uicb_settrans(Display *disp __attribute__ ((unused)), + int screen __attribute__ ((unused)), DC *drawcontext __attribute__ ((unused)), awesome_config *awesomeconf __attribute__ ((unused)), const char *arg) diff --git a/client.h b/client.h index 12a3e10e..061239df 100644 --- a/client.h +++ b/client.h @@ -62,8 +62,8 @@ 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 set_shape(Client *); -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 *); +void uicb_killclient(Display *, int, DC *, awesome_config *, const char *); /* kill client */ +void uicb_moveresize(Display *, int, DC *, awesome_config *, const char *); /* move and resize window */ +void uicb_settrans(Display *, int, DC *, awesome_config *, const char *); #endif diff --git a/config.h b/config.h index 4ccaae84..5c9f40c6 100644 --- a/config.h +++ b/config.h @@ -72,7 +72,7 @@ typedef struct { unsigned long mod; KeySym keysym; - void (*func) (Display *, DC *, awesome_config *, const char *); + void (*func) (Display *, int, DC *, awesome_config *, const char *); const char *arg; } Key; diff --git a/event.c b/event.c index 4ad0bf16..7a456b3a 100644 --- a/event.c +++ b/event.c @@ -159,22 +159,22 @@ handle_event_buttonpress(XEvent * e, awesome_config *awesomeconf) if(ev->button == Button1) { if(ev->state & awesomeconf->modkey) - uicb_tag(e->xany.display, &dc, awesomeconf, awesomeconf->tags[i]); + uicb_tag(e->xany.display, awesomeconf->statusbar.screen, &dc, awesomeconf, awesomeconf->tags[i]); else - uicb_view(e->xany.display, &dc, awesomeconf, awesomeconf->tags[i]); + uicb_view(e->xany.display, awesomeconf->statusbar.screen, &dc, awesomeconf, awesomeconf->tags[i]); } else if(ev->button == Button3) { if(ev->state & awesomeconf->modkey) - uicb_toggletag(e->xany.display, &dc, awesomeconf, awesomeconf->tags[i]); + uicb_toggletag(e->xany.display, awesomeconf->statusbar.screen, &dc, awesomeconf, awesomeconf->tags[i]); else - uicb_toggleview(e->xany.display, &dc, awesomeconf, awesomeconf->tags[i]); + uicb_toggleview(e->xany.display, awesomeconf->statusbar.screen, &dc, awesomeconf, awesomeconf->tags[i]); } return; } } if((ev->x < x + awesomeconf->statusbar.width) && ev->button == Button1) - uicb_setlayout(e->xany.display, &dc, awesomeconf, NULL); + uicb_setlayout(e->xany.display, awesomeconf->statusbar.screen, &dc, awesomeconf, NULL); } else if((c = getclient(ev->window))) { @@ -187,7 +187,7 @@ handle_event_buttonpress(XEvent * e, awesome_config *awesomeconf) movemouse(c, awesomeconf); } else if(ev->button == Button2) - uicb_zoom(e->xany.display, &dc, awesomeconf, NULL); + uicb_zoom(e->xany.display, c->screen, &dc, awesomeconf, NULL); else if(ev->button == Button3 && (IS_ARRANGE(floating) || c->isfloating) && !c->isfixed) { restack(e->xany.display, c->screen, &dc, awesomeconf); @@ -199,9 +199,9 @@ handle_event_buttonpress(XEvent * e, awesome_config *awesomeconf) if(RootWindow(e->xany.display, i) == ev->window) { if(ev->button == Button4) - uicb_tag_viewnext(e->xany.display, &dc, awesomeconf, NULL); + uicb_tag_viewnext(e->xany.display, i, &dc, awesomeconf, NULL); else if(ev->button == Button5) - uicb_tag_viewprev(e->xany.display, &dc, awesomeconf, NULL); + uicb_tag_viewprev(e->xany.display, i, &dc, awesomeconf, NULL); } } @@ -317,15 +317,24 @@ handle_event_expose(XEvent * e, awesome_config *awesomeconf) void handle_event_keypress(XEvent * e, awesome_config *awesomeconf) { - int i; + int i, screen, x, y, d; + unsigned int m; KeySym keysym; XKeyEvent *ev = &e->xkey; + Window dummy; keysym = XKeycodeToKeysym(e->xany.display, (KeyCode) ev->keycode, 0); 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, &dc, awesomeconf, awesomeconf->keys[i].arg); + { + if(sel) + awesomeconf->keys[i].func(e->xany.display, sel->screen, &dc, awesomeconf, awesomeconf->keys[i].arg); + else + for(screen = 0; screen < ScreenCount(e->xany.display); screen++) + if(XQueryPointer(e->xany.display, RootWindow(e->xany.display, screen), &dummy, &dummy, &y, &x, &d, &d, &m)) + awesomeconf->keys[i].func(e->xany.display, screen, &dc, awesomeconf, awesomeconf->keys[i].arg); + } } void diff --git a/layout.c b/layout.c index 2166637b..3c30c4e6 100644 --- a/layout.c +++ b/layout.c @@ -49,6 +49,7 @@ arrange(Display * disp, int screen, DC *drawcontext, awesome_config *awesomeconf void uicb_focusnext(Display *disp __attribute__ ((unused)), + int screen __attribute__ ((unused)), DC *drawcontext, awesome_config * awesomeconf, const char *arg __attribute__ ((unused))) @@ -69,6 +70,7 @@ uicb_focusnext(Display *disp __attribute__ ((unused)), void uicb_focusprev(Display *disp __attribute__ ((unused)), + int screen __attribute__ ((unused)), DC *drawcontext, awesome_config *awesomeconf, const char *arg __attribute__ ((unused))) @@ -156,6 +158,7 @@ saveawesomeprops(Display *disp, int screen, awesome_config *awesomeconf) void uicb_setlayout(Display *disp, + int screen, DC *drawcontext, awesome_config * awesomeconf, const char *arg) @@ -180,11 +183,11 @@ uicb_setlayout(Display *disp, c->ftview = True; if(sel) - arrange(disp, DefaultScreen(disp), drawcontext, awesomeconf); + arrange(disp, screen, drawcontext, awesomeconf); else drawstatusbar(disp, DefaultScreen(disp), drawcontext, awesomeconf); - saveawesomeprops(disp, DefaultScreen(disp), awesomeconf); + saveawesomeprops(disp, screen, awesomeconf); for(j = 0; j < awesomeconf->ntags; j++) if (awesomeconf->selected_tags[j]) @@ -221,6 +224,7 @@ maximize(int x, int y, int w, int h, DC *drawcontext, awesome_config *awesomecon void uicb_togglemax(Display *disp, + int screen __attribute__ ((unused)), DC *drawcontext, awesome_config *awesomeconf, const char *arg __attribute__ ((unused))) @@ -235,6 +239,7 @@ uicb_togglemax(Display *disp, void uicb_toggleverticalmax(Display *disp, + int screen __attribute__ ((unused)), DC *drawcontext, awesome_config *awesomeconf, const char *arg __attribute__ ((unused))) @@ -251,6 +256,7 @@ uicb_toggleverticalmax(Display *disp, void uicb_togglehorizontalmax(Display *disp, + int screen __attribute__ ((unused)), DC *drawcontext, awesome_config *awesomeconf, const char *arg __attribute__ ((unused))) @@ -266,6 +272,7 @@ uicb_togglehorizontalmax(Display *disp, void uicb_zoom(Display *disp __attribute__ ((unused)), + int screen __attribute__ ((unused)), DC *drawcontext __attribute__ ((unused)), awesome_config *awesomeconf, const char *arg __attribute__ ((unused))) diff --git a/layout.h b/layout.h index eccea162..6581aeb2 100644 --- a/layout.h +++ b/layout.h @@ -31,13 +31,13 @@ void arrange(Display *, int, DC *, awesome_config *); /* arranges all windows depending on the layout in use */ void restack(Display *, int, 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_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 uicb_focusnext(Display *, int, DC *, awesome_config *, const char *); /* focuses next visible client */ +void uicb_focusprev(Display *, int, DC *, awesome_config *, const char *); /* focuses prev visible client */ +void uicb_setlayout(Display *, int, DC *, awesome_config *, const char *); /* sets layout, NULL means next layout */ +void uicb_togglemax(Display *, int, DC *, awesome_config *, const char *); /* toggles maximization of floating client */ +void uicb_toggleverticalmax(Display *, int, DC *, awesome_config *, const char *); +void uicb_togglehorizontalmax(Display *, int, DC *, awesome_config *, const char *); +void uicb_zoom(Display *, int, DC *, awesome_config *, const char *); /* set current window first in stack */ void loadawesomeprops(Display *, int, awesome_config *); void saveawesomeprops(Display *disp, int, awesome_config *); diff --git a/layouts/tile.c b/layouts/tile.c index e44b68c9..b52e4e3e 100644 --- a/layouts/tile.c +++ b/layouts/tile.c @@ -33,6 +33,7 @@ extern Client *sel, *clients; void uicb_setnmaster(Display *disp, + int screen, DC * drawcontext, awesome_config *awesomeconf, const char * arg) @@ -43,11 +44,12 @@ uicb_setnmaster(Display *disp, if((awesomeconf->nmaster = (int) compute_new_value_from_arg(arg, (double) awesomeconf->nmaster)) < 0) awesomeconf->nmaster = 0; - arrange(disp, DefaultScreen(disp), drawcontext, awesomeconf); + arrange(disp, screen, drawcontext, awesomeconf); } void uicb_setncols(Display *disp, + int screen, DC * drawcontext, awesome_config *awesomeconf, const char * arg) @@ -58,12 +60,13 @@ uicb_setncols(Display *disp, if((awesomeconf->ncols = (int) compute_new_value_from_arg(arg, (double) awesomeconf->ncols)) < 1) awesomeconf->ncols = 1; - arrange(disp, DefaultScreen(disp), drawcontext, awesomeconf); + arrange(disp, screen, drawcontext, awesomeconf); } void uicb_setmwfact(Display *disp, - DC *drawcontext, + int screen, + DC *drawcontext, awesome_config * awesomeconf, const char *arg) { @@ -75,7 +78,7 @@ uicb_setmwfact(Display *disp, else if(awesomeconf->mwfact > 0.9) awesomeconf->mwfact = 0.9; - arrange(disp, DefaultScreen(disp), drawcontext, awesomeconf); + arrange(disp, screen, drawcontext, awesomeconf); } static void diff --git a/layouts/tile.h b/layouts/tile.h index 138544bf..c7bee2bb 100644 --- a/layouts/tile.h +++ b/layouts/tile.h @@ -25,9 +25,9 @@ #include -void uicb_setnmaster(Display *, DC *, awesome_config *, const char *); /* change number of master windows */ -void uicb_setncols(Display *, DC *, awesome_config *, const char *); -void uicb_setmwfact(Display *, DC *, awesome_config *, const char *); /* sets master width factor */ +void uicb_setnmaster(Display *, int, DC *, awesome_config *, const char *); /* change number of master windows */ +void uicb_setncols(Display *, int, DC *, awesome_config *, const char *); +void uicb_setmwfact(Display *, int, DC *, awesome_config *, const char *); /* sets master width factor */ void tile(Display *, awesome_config *); void tileleft(Display *, awesome_config *); diff --git a/statusbar.c b/statusbar.c index 7ca49b28..dd5a01fe 100644 --- a/statusbar.c +++ b/statusbar.c @@ -140,6 +140,7 @@ updatebarpos(Display *disp, Statusbar statusbar) void uicb_togglebar(Display *disp, + int screen, DC *drawcontext, awesome_config *awesomeconf, const char *arg __attribute__ ((unused))) @@ -149,6 +150,6 @@ uicb_togglebar(Display *disp, else awesomeconf->statusbar.position = BarOff; updatebarpos(disp, awesomeconf->statusbar); - arrange(disp, DefaultScreen(disp), drawcontext, awesomeconf); + arrange(disp, screen, drawcontext, awesomeconf); } diff --git a/statusbar.h b/statusbar.h index 6924affa..370d8f4c 100644 --- a/statusbar.h +++ b/statusbar.h @@ -27,6 +27,6 @@ void initstatusbar(Display *, int, DC *, Statusbar *); void drawstatusbar(Display *, int, DC *, awesome_config *); void updatebarpos(Display *, Statusbar); -void uicb_togglebar(Display *, DC *, awesome_config *, const char *); +void uicb_togglebar(Display *, int, DC *, awesome_config *, const char *); #endif diff --git a/tag.c b/tag.c index 3bd14843..8bc9a0a4 100644 --- a/tag.c +++ b/tag.c @@ -145,6 +145,7 @@ isvisible(Client * c, Bool * tags, int ntags) */ void uicb_tag(Display *disp, + int screen, DC *drawcontext, awesome_config *awesomeconf, const char *arg) @@ -159,7 +160,7 @@ uicb_tag(Display *disp, if(i >= 0 && i < awesomeconf->ntags) sel->tags[i] = True; saveprops(sel, awesomeconf->ntags); - arrange(disp, DefaultScreen(disp), drawcontext, awesomeconf); + arrange(disp, screen, drawcontext, awesomeconf); } /** Toggle floating state of a client @@ -169,6 +170,7 @@ uicb_tag(Display *disp, */ void uicb_togglefloating(Display *disp, + int screen, DC *drawcontext, awesome_config * awesomeconf, const char *arg __attribute__ ((unused))) @@ -188,7 +190,7 @@ uicb_togglefloating(Display *disp, sel->rh = sel->h; } saveprops(sel, awesomeconf->ntags); - arrange(disp, DefaultScreen(disp), drawcontext, awesomeconf); + arrange(disp, screen, drawcontext, awesomeconf); } /** Toggle tag view @@ -198,6 +200,7 @@ uicb_togglefloating(Display *disp, */ void uicb_toggletag(Display *disp, + int screen, DC *drawcontext, awesome_config *awesomeconf, const char *arg) @@ -213,7 +216,7 @@ uicb_toggletag(Display *disp, if(j == awesomeconf->ntags) sel->tags[i] = True; saveprops(sel, awesomeconf->ntags); - arrange(disp, DefaultScreen(disp), drawcontext, awesomeconf); + arrange(disp, screen, drawcontext, awesomeconf); } /** Add a tag to viewed tags @@ -223,6 +226,7 @@ uicb_toggletag(Display *disp, */ void uicb_toggleview(Display *disp, + int screen, DC *drawcontext, awesome_config *awesomeconf, const char *arg) @@ -236,7 +240,7 @@ uicb_toggleview(Display *disp, if(j == awesomeconf->ntags) awesomeconf->selected_tags[i] = True; /* cannot toggle last view */ saveawesomeprops(disp, DefaultScreen(disp), awesomeconf); - arrange(disp, DefaultScreen(disp), drawcontext, awesomeconf); + arrange(disp, screen, drawcontext, awesomeconf); } /** View tag @@ -247,6 +251,7 @@ uicb_toggleview(Display *disp, */ void uicb_view(Display *disp, + int screen, DC *drawcontext, awesome_config *awesomeconf, const char *arg) @@ -264,8 +269,8 @@ uicb_view(Display *disp, awesomeconf->selected_tags[i] = True; awesomeconf->current_layout = awesomeconf->tag_layouts[i]; } - saveawesomeprops(disp, DefaultScreen(disp), awesomeconf); - arrange(disp, DefaultScreen(disp), drawcontext, awesomeconf); + saveawesomeprops(disp, screen, awesomeconf); + arrange(disp, screen, drawcontext, awesomeconf); } /** View previously selected tags @@ -276,6 +281,7 @@ uicb_view(Display *disp, */ void uicb_viewprevtags(Display * disp, + int screen, DC *drawcontext, awesome_config *awesomeconf, const char *arg __attribute__ ((unused))) @@ -289,7 +295,7 @@ uicb_viewprevtags(Display * disp, awesomeconf->selected_tags[i] = awesomeconf->prev_selected_tags[i]; awesomeconf->prev_selected_tags[i] = t; } - arrange(disp, DefaultScreen(disp), drawcontext, awesomeconf); + arrange(disp, screen, drawcontext, awesomeconf); } /** View next tag @@ -299,6 +305,7 @@ uicb_viewprevtags(Display * disp, */ void uicb_tag_viewnext(Display *disp, + int screen, DC * drawcontext, awesome_config *awesomeconf, const char *arg __attribute__ ((unused))) @@ -315,8 +322,8 @@ uicb_tag_viewnext(Display *disp, if(++firsttag >= awesomeconf->ntags) firsttag = 0; awesomeconf->selected_tags[firsttag] = True; - saveawesomeprops(disp, DefaultScreen(disp), awesomeconf); - arrange(disp, DefaultScreen(disp), drawcontext, awesomeconf); + saveawesomeprops(disp, screen, awesomeconf); + arrange(disp, screen, drawcontext, awesomeconf); } /** View previous tag @@ -326,6 +333,7 @@ uicb_tag_viewnext(Display *disp, */ void uicb_tag_viewprev(Display *disp, + int screen __attribute__ ((unused)), DC *drawcontext, awesome_config *awesomeconf, const char *arg __attribute__ ((unused))) @@ -342,6 +350,6 @@ uicb_tag_viewprev(Display *disp, if(--firsttag < 0) firsttag = awesomeconf->ntags - 1; awesomeconf->selected_tags[firsttag] = True; - saveawesomeprops(disp, DefaultScreen(disp), awesomeconf); - arrange(disp, DefaultScreen(disp), drawcontext, awesomeconf); + saveawesomeprops(disp, screen, awesomeconf); + arrange(disp, screen, drawcontext, awesomeconf); } diff --git a/tag.h b/tag.h index 446f305d..f8dd5aa3 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 *, 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 */ +void uicb_tag(Display *, int, DC *, awesome_config *, const char *); /* tags sel with arg's index */ +void uicb_togglefloating(Display *, int, DC *, awesome_config *, const char *); /* toggles sel between floating/tiled state */ +void uicb_toggletag(Display *, int, DC *, awesome_config *, const char *); /* toggles sel tags with arg's index */ +void uicb_toggleview(Display *, int, DC *, awesome_config *, const char *); /* toggles the tag with arg's index (in)visible */ +void uicb_view(Display *, int, DC *, awesome_config *, const char *); /* views the tag with arg's index */ +void uicb_viewprevtags(Display *, int, DC *, awesome_config *, const char *); +void uicb_tag_viewnext(Display *, int, DC *, awesome_config *, const char *); /* view only tag just after the first selected */ +void uicb_tag_viewprev(Display *, int, DC *, awesome_config *, const char *); /* view only tag just before the first selected */ typedef struct { diff --git a/util.c b/util.c index b247b7e1..d6b5f56d 100644 --- a/util.c +++ b/util.c @@ -43,9 +43,10 @@ eprint(const char *fmt, ...) void uicb_spawn(Display * disp, - DC *drawcontext __attribute__ ((unused)), - awesome_config * awesomeconf __attribute__ ((unused)), - const char *arg) + int screen __attribute__ ((unused)), + DC *drawcontext __attribute__ ((unused)), + awesome_config * awesomeconf __attribute__ ((unused)), + const char *arg) { static char *shell = NULL; diff --git a/util.h b/util.h index c73a59b1..7bdc0344 100644 --- a/util.h +++ b/util.h @@ -119,7 +119,7 @@ static inline char *a_strdup(const char *s) } void eprint(const char *, ...) __attribute__ ((noreturn)) __attribute__ ((format(printf, 1, 2))); -void uicb_spawn(Display *, DC *, awesome_config *, const char *); +void uicb_spawn(Display *, int, DC *, awesome_config *, const char *); Bool xgettextprop(Display *, Window, Atom, char *, unsigned int); double compute_new_value_from_arg(const char *, double);