enum { ColBorder, ColFG, ColBG, ColLast }; /* color */
enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */
enum { WMProtocols, WMDelete, WMName, WMState, WMLast };/* default atoms */
enum { ColBorder, ColFG, ColBG, ColLast }; /* color */
enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */
enum { WMProtocols, WMDelete, WMName, WMState, WMLast };/* default atoms */
+enum { ClkLtSymbol = -1, ClkStatusText = -2, ClkWinTitle = -3,
+ ClkClientWin = -4, ClkRootWin = -5, ClkLast = -6};/* clicks */
static void manage(Window w, XWindowAttributes *wa);
static void mappingnotify(XEvent *e);
static void maprequest(XEvent *e);
static void manage(Window w, XWindowAttributes *wa);
static void mappingnotify(XEvent *e);
static void maprequest(XEvent *e);
static Client *nexttiled(Client *c);
static void propertynotify(XEvent *e);
static void quit(const Arg *arg);
static void resize(Client *c, int x, int y, int w, int h, Bool sizehints);
static Client *nexttiled(Client *c);
static void propertynotify(XEvent *e);
static void quit(const Arg *arg);
static void resize(Client *c, int x, int y, int w, int h, Bool sizehints);
/* compile-time check if all tags fit into an uint bit array. */
struct NumTags { char limitexceeded[sizeof(uint) * 8 < LENGTH(tags) ? -1 : 1]; };
/* compile-time check if all tags fit into an uint bit array. */
struct NumTags { char limitexceeded[sizeof(uint) * 8 < LENGTH(tags) ? -1 : 1]; };
- if(ev->x < x) {
- mask = 1 << i;
- if(ev->button == Button1) {
- if(ev->state & MODKEY)
- tag((Arg*)&mask);
- else
- view((Arg*)&mask);
- }
- else if(ev->button == Button3) {
- if(ev->state & MODKEY)
- toggletag((Arg*)&mask);
- else
- toggleview((Arg*)&mask);
- }
- return;
- }
- }
- if(ev->x < x + blw) {
- if(ev->button == Button1)
- togglelayout(NULL);
- else if(ev->button == Button3)
- togglemax(NULL);
+ if(i < LENGTH(tags) || ev->x <= x)
+ click = i - 1;
+ else if(ev->x < x + blw)
+ click = ClkLtSymbol;
+ else if(ev->x > wx + ww - TEXTW(stext))
+ click = ClkStatusText;
+ else
+ click = ClkWinTitle;
- else if((c = getclient(ev->window))) {
- focus(c);
- if(CLEANMASK(ev->state) != MODKEY || (ismax && !c->isfixed))
- return;
- if(ev->button == Button1)
- movemouse(c);
- else if(ev->button == Button2)
- togglefloating(NULL);
- else if(ev->button == Button3 && !c->isfixed)
- resizemouse(c);
- }
+ else if((c = getclient(ev->window)))
+ click = ClkClientWin;
+
+ for(i = 0; i < LENGTH(buttons); i++)
+ if(click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button && CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state))
+ buttons[i].func(&buttons[i].arg);
int x1, y1, ocx, ocy, di, nx, ny;
uint dui;
int x1, y1, ocx, ocy, di, nx, ny;
uint dui;
None, cursor[CurMove], CurrentTime) != GrabSuccess)
return;
XQueryPointer(dpy, root, &dummy, &dummy, &x1, &y1, &di, &di, &dui);
None, cursor[CurMove], CurrentTime) != GrabSuccess)
return;
XQueryPointer(dpy, root, &dummy, &dummy, &x1, &y1, &di, &di, &dui);
+ if(x1 < c->x || x1 > c->x + c->w || y1 < c->y || y1 > c->y + c->h) {
+ XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, 0, 0);
+ x1 = c->x + 1;
+ y1 = c->y + 1;
+ }
sw = DisplayWidth(dpy, screen);
sh = DisplayHeight(dpy, screen);
bh = dc.font.height + 2;
sw = DisplayWidth(dpy, screen);
sh = DisplayHeight(dpy, screen);
bh = dc.font.height + 2;
|EnterWindowMask|LeaveWindowMask|StructureNotifyMask;
XChangeWindowAttributes(dpy, root, CWEventMask|CWCursor, &wa);
XSelectInput(dpy, root, wa.event_mask);
|EnterWindowMask|LeaveWindowMask|StructureNotifyMask;
XChangeWindowAttributes(dpy, root, CWEventMask|CWCursor, &wa);
XSelectInput(dpy, root, wa.event_mask);
/* window area geometry */
if(XineramaIsActive(dpy)) {
info = XineramaQueryScreens(dpy, &i);
/* window area geometry */
if(XineramaIsActive(dpy)) {
info = XineramaQueryScreens(dpy, &i);
- wx = info[0].x_org;
- wy = showbar && topbar ? info[0].y_org + bh : info[0].y_org;
- ww = info[0].width;
- wh = showbar ? info[0].height - bh : info[0].height;
+ wx = info[xidx].x_org;
+ wy = showbar && topbar ? info[xidx].y_org + bh : info[xidx].y_org;
+ ww = info[xidx].width;
+ wh = showbar ? info[xidx].height - bh : info[xidx].height;