Xinqi Bao's Git
projects
/
dwm.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
applied Hiltjo's resize/move limitation
[dwm.git]
/
dwm.c
diff --git
a/dwm.c
b/dwm.c
index
6f716e9
..
f896170
100644
(file)
--- a/
dwm.c
+++ b/
dwm.c
@@
-1123,6
+1123,7
@@
movemouse(const Arg *arg) {
Client *c;
Monitor *m;
XEvent ev;
Client *c;
Monitor *m;
XEvent ev;
+ Time lasttime = 0;
if(!(c = selmon->sel))
return;
if(!(c = selmon->sel))
return;
@@
-1145,6
+1146,10
@@
movemouse(const Arg *arg) {
handler[ev.type](&ev);
break;
case MotionNotify:
handler[ev.type](&ev);
break;
case MotionNotify:
+ if ((ev.xmotion.time - lasttime) <= (1000 / 60))
+ continue;
+ lasttime = ev.xmotion.time;
+
nx = ocx + (ev.xmotion.x - x);
ny = ocy + (ev.xmotion.y - y);
if(nx >= selmon->wx && nx <= selmon->wx + selmon->ww
nx = ocx + (ev.xmotion.x - x);
ny = ocy + (ev.xmotion.y - y);
if(nx >= selmon->wx && nx <= selmon->wx + selmon->ww
@@
-1264,11
+1269,11
@@
resizeclient(Client *c, int x, int y, int w, int h) {
void
resizemouse(const Arg *arg) {
void
resizemouse(const Arg *arg) {
- int ocx, ocy;
- int nw, nh;
+ int ocx, ocy, nw, nh;
Client *c;
Monitor *m;
XEvent ev;
Client *c;
Monitor *m;
XEvent ev;
+ Time lasttime = 0;
if(!(c = selmon->sel))
return;
if(!(c = selmon->sel))
return;
@@
-1290,6
+1295,10
@@
resizemouse(const Arg *arg) {
handler[ev.type](&ev);
break;
case MotionNotify:
handler[ev.type](&ev);
break;
case MotionNotify:
+ if ((ev.xmotion.time - lasttime) <= (1000 / 60))
+ continue;
+ lasttime = ev.xmotion.time;
+
nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1);
nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1);
if(c->mon->wx + nw >= selmon->wx && c->mon->wx + nw <= selmon->wx + selmon->ww
nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1);
nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1);
if(c->mon->wx + nw >= selmon->wx && c->mon->wx + nw <= selmon->wx + selmon->ww
@@
-1542,6
+1551,7
@@
setup(void) {
XChangeWindowAttributes(dpy, root, CWEventMask|CWCursor, &wa);
XSelectInput(dpy, root, wa.event_mask);
grabkeys();
XChangeWindowAttributes(dpy, root, CWEventMask|CWCursor, &wa);
XSelectInput(dpy, root, wa.event_mask);
grabkeys();
+ focus(NULL);
}
void
}
void
@@
-2045,7
+2055,7
@@
zoom(const Arg *arg) {
int
main(int argc, char *argv[]) {
if(argc == 2 && !strcmp("-v", argv[1]))
int
main(int argc, char *argv[]) {
if(argc == 2 && !strcmp("-v", argv[1]))
- die("dwm-"VERSION", © 2006-201
2
dwm engineers, see LICENSE for details\n");
+ die("dwm-"VERSION", © 2006-201
4
dwm engineers, see LICENSE for details\n");
else if(argc != 1)
die("usage: dwm [-v]\n");
if(!setlocale(LC_CTYPE, "") || !XSupportsLocale())
else if(argc != 1)
die("usage: dwm [-v]\n");
if(!setlocale(LC_CTYPE, "") || !XSupportsLocale())