diff options
| -rw-r--r-- | config.def.h | 2 | ||||
| -rw-r--r-- | config.mk | 8 | ||||
| -rw-r--r-- | dwm.c | 28 |
3 files changed, 26 insertions, 12 deletions
diff --git a/config.def.h b/config.def.h index 706cfa9..7c19b2f 100644 --- a/config.def.h +++ b/config.def.h | |||
| @@ -13,6 +13,8 @@ static unsigned int snap = 32; /* snap pixel */ | |||
| 13 | static Bool showbar = True; /* False means no bar */ | 13 | static Bool showbar = True; /* False means no bar */ |
| 14 | static Bool topbar = True; /* False means bottom bar */ | 14 | static Bool topbar = True; /* False means bottom bar */ |
| 15 | static Bool readin = True; /* False means do not read stdin */ | 15 | static Bool readin = True; /* False means do not read stdin */ |
| 16 | static Bool usegrab = False; /* True means grabbing the X server | ||
| 17 | during mouse-based resizals */ | ||
| 16 | 18 | ||
| 17 | /* tagging */ | 19 | /* tagging */ |
| 18 | static const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; | 20 | static const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; |
| @@ -1,5 +1,5 @@ | |||
| 1 | # dwm version | 1 | # dwm version |
| 2 | VERSION = 5.2 | 2 | VERSION = 5.3 |
| 3 | 3 | ||
| 4 | # Customize below to fit your system | 4 | # Customize below to fit your system |
| 5 | 5 | ||
| @@ -10,9 +10,9 @@ MANPREFIX = ${PREFIX}/share/man | |||
| 10 | X11INC = /usr/X11R6/include | 10 | X11INC = /usr/X11R6/include |
| 11 | X11LIB = /usr/X11R6/lib | 11 | X11LIB = /usr/X11R6/lib |
| 12 | 12 | ||
| 13 | # Xinerama, comment if you don't want it | 13 | # Xinerama, un-comment if you want it |
| 14 | XINERAMALIBS = -L${X11LIB} -lXinerama | 14 | #XINERAMALIBS = -L${X11LIB} -lXinerama |
| 15 | XINERAMAFLAGS = -DXINERAMA | 15 | #XINERAMAFLAGS = -DXINERAMA |
| 16 | 16 | ||
| 17 | # includes and libs | 17 | # includes and libs |
| 18 | INCS = -I. -I/usr/include -I${X11INC} | 18 | INCS = -I. -I/usr/include -I${X11INC} |
| @@ -53,8 +53,8 @@ | |||
| 53 | #define MIN(a, b) ((a) < (b) ? (a) : (b)) | 53 | #define MIN(a, b) ((a) < (b) ? (a) : (b)) |
| 54 | #define MAXTAGLEN 16 | 54 | #define MAXTAGLEN 16 |
| 55 | #define MOUSEMASK (BUTTONMASK|PointerMotionMask) | 55 | #define MOUSEMASK (BUTTONMASK|PointerMotionMask) |
| 56 | #define WIDTH(x) ((x)->w + 2*(x)->bw) | 56 | #define WIDTH(x) ((x)->w + 2 * (x)->bw) |
| 57 | #define HEIGHT(x) ((x)->h + 2*(x)->bw) | 57 | #define HEIGHT(x) ((x)->h + 2 * (x)->bw) |
| 58 | #define TAGMASK ((int)((1LL << LENGTH(tags)) - 1)) | 58 | #define TAGMASK ((int)((1LL << LENGTH(tags)) - 1)) |
| 59 | #define TEXTW(x) (textnw(x, strlen(x)) + dc.font.height) | 59 | #define TEXTW(x) (textnw(x, strlen(x)) + dc.font.height) |
| 60 | 60 | ||
| @@ -932,7 +932,7 @@ monocle(void) { | |||
| 932 | Client *c; | 932 | Client *c; |
| 933 | 933 | ||
| 934 | for(c = nexttiled(clients); c; c = nexttiled(c->next)) | 934 | for(c = nexttiled(clients); c; c = nexttiled(c->next)) |
| 935 | resize(c, wx, wy, ww - 2*c->bw, wh - 2*c->bw, resizehints); | 935 | resize(c, wx, wy, ww - 2 * c->bw, wh - 2 * c->bw, resizehints); |
| 936 | } | 936 | } |
| 937 | 937 | ||
| 938 | void | 938 | void |
| @@ -952,6 +952,8 @@ movemouse(const Arg *arg) { | |||
| 952 | None, cursor[CurMove], CurrentTime) != GrabSuccess) | 952 | None, cursor[CurMove], CurrentTime) != GrabSuccess) |
| 953 | return; | 953 | return; |
| 954 | XQueryPointer(dpy, root, &dummy, &dummy, &x, &y, &di, &di, &dui); | 954 | XQueryPointer(dpy, root, &dummy, &dummy, &x, &y, &di, &di, &dui); |
| 955 | if(usegrab) | ||
| 956 | XGrabServer(dpy); | ||
| 955 | do { | 957 | do { |
| 956 | XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev); | 958 | XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev); |
| 957 | switch (ev.type) { | 959 | switch (ev.type) { |
| @@ -961,7 +963,6 @@ movemouse(const Arg *arg) { | |||
| 961 | handler[ev.type](&ev); | 963 | handler[ev.type](&ev); |
| 962 | break; | 964 | break; |
| 963 | case MotionNotify: | 965 | case MotionNotify: |
| 964 | XSync(dpy, False); | ||
| 965 | nx = ocx + (ev.xmotion.x - x); | 966 | nx = ocx + (ev.xmotion.x - x); |
| 966 | ny = ocy + (ev.xmotion.y - y); | 967 | ny = ocy + (ev.xmotion.y - y); |
| 967 | if(snap && nx >= wx && nx <= wx + ww | 968 | if(snap && nx >= wx && nx <= wx + ww |
| @@ -983,6 +984,8 @@ movemouse(const Arg *arg) { | |||
| 983 | } | 984 | } |
| 984 | } | 985 | } |
| 985 | while(ev.type != ButtonRelease); | 986 | while(ev.type != ButtonRelease); |
| 987 | if(usegrab) | ||
| 988 | XUngrabServer(dpy); | ||
| 986 | XUngrabPointer(dpy, CurrentTime); | 989 | XUngrabPointer(dpy, CurrentTime); |
| 987 | } | 990 | } |
| 988 | 991 | ||
| @@ -1121,6 +1124,8 @@ resizemouse(const Arg *arg) { | |||
| 1121 | None, cursor[CurResize], CurrentTime) != GrabSuccess) | 1124 | None, cursor[CurResize], CurrentTime) != GrabSuccess) |
| 1122 | return; | 1125 | return; |
| 1123 | XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1); | 1126 | XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1); |
| 1127 | if(usegrab) | ||
| 1128 | XGrabServer(dpy); | ||
| 1124 | do { | 1129 | do { |
| 1125 | XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev); | 1130 | XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev); |
| 1126 | switch(ev.type) { | 1131 | switch(ev.type) { |
| @@ -1130,7 +1135,6 @@ resizemouse(const Arg *arg) { | |||
| 1130 | handler[ev.type](&ev); | 1135 | handler[ev.type](&ev); |
| 1131 | break; | 1136 | break; |
| 1132 | case MotionNotify: | 1137 | case MotionNotify: |
| 1133 | XSync(dpy, False); | ||
| 1134 | nw = MAX(ev.xmotion.x - ocx - 2*c->bw + 1, 1); | 1138 | nw = MAX(ev.xmotion.x - ocx - 2*c->bw + 1, 1); |
| 1135 | nh = MAX(ev.xmotion.y - ocy - 2*c->bw + 1, 1); | 1139 | nh = MAX(ev.xmotion.y - ocy - 2*c->bw + 1, 1); |
| 1136 | 1140 | ||
| @@ -1146,6 +1150,8 @@ resizemouse(const Arg *arg) { | |||
| 1146 | } | 1150 | } |
| 1147 | } | 1151 | } |
| 1148 | while(ev.type != ButtonRelease); | 1152 | while(ev.type != ButtonRelease); |
| 1153 | if(usegrab) | ||
| 1154 | XUngrabServer(dpy); | ||
| 1149 | XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1); | 1155 | XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1); |
| 1150 | XUngrabPointer(dpy, CurrentTime); | 1156 | XUngrabPointer(dpy, CurrentTime); |
| 1151 | while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); | 1157 | while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); |
| @@ -1435,7 +1441,7 @@ tile(void) { | |||
| 1435 | /* master */ | 1441 | /* master */ |
| 1436 | c = nexttiled(clients); | 1442 | c = nexttiled(clients); |
| 1437 | mw = mfact * ww; | 1443 | mw = mfact * ww; |
| 1438 | resize(c, wx, wy, (n == 1 ? ww : mw) - 2*c->bw, wh - 2*c->bw, resizehints); | 1444 | resize(c, wx, wy, (n == 1 ? ww : mw) - 2 * c->bw, wh - 2 * c->bw, resizehints); |
| 1439 | 1445 | ||
| 1440 | if(--n == 0) | 1446 | if(--n == 0) |
| 1441 | return; | 1447 | return; |
| @@ -1449,8 +1455,14 @@ tile(void) { | |||
| 1449 | h = wh; | 1455 | h = wh; |
| 1450 | 1456 | ||
| 1451 | for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) { | 1457 | for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) { |
| 1452 | resize(c, x, y, w - 2*c->bw, /* remainder */ ((i + 1 == n) | 1458 | if(i + 1 == n) { /* remainder */ |
| 1453 | ? wy + wh - y : h) - 2*c->bw, resizehints); | 1459 | if(wy + wh - y < bh) |
| 1460 | resize(c, x, y, w - 2 * c->bw, wy + wh - y - 2 * c->bw, False); | ||
| 1461 | else | ||
| 1462 | resize(c, x, y, w - 2 * c->bw, wy + wh - y - 2 * c->bw, resizehints); | ||
| 1463 | } | ||
| 1464 | else | ||
| 1465 | resize(c, x, y, w - 2 * c->bw, h - 2 * c->bw, resizehints); | ||
| 1454 | if(h != wh) | 1466 | if(h != wh) |
| 1455 | y = c->y + HEIGHT(c); | 1467 | y = c->y + HEIGHT(c); |
| 1456 | } | 1468 | } |
