aboutsummarylogtreecommitdiffstats
path: root/dwm.c
diff options
context:
space:
mode:
authorAnselm R Garbe2014-08-11 07:24:29 +0200
committerAnselm R Garbe2014-08-11 07:24:29 +0200
commit978e4fe2294528f5c7f2f5b2c025c795c3daf413 (patch)
treedb3f84ddb87c4afc300e83d5453a5da3cf18f566 /dwm.c
parent7a4ac239b65ec067916a07e645df50cc998954fd (diff)
downloadaur-978e4fe2294528f5c7f2f5b2c025c795c3daf413.tar.gz
applied Hiltjo's resize/move limitation
"Limit the amount of updates when resizing or moving a window in floating mode to 60 times per second. This makes resizing and moving alot smoother and by limiting it it also uses alot less resources on my machine.
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/dwm.c b/dwm.c
index ffc8864472ee..f896170c043f 100644
--- a/dwm.c
+++ b/dwm.c
@@ -1123,6 +1123,7 @@ movemouse(const Arg *arg) {
Client *c;
Monitor *m;
XEvent ev;
+ Time lasttime = 0;
if(!(c = selmon->sel))
return;
@@ -1145,6 +1146,10 @@ movemouse(const Arg *arg) {
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
@@ -1264,11 +1269,11 @@ resizeclient(Client *c, int x, int y, int w, int h) {
void
resizemouse(const Arg *arg) {
- int ocx, ocy;
- int nw, nh;
+ int ocx, ocy, nw, nh;
Client *c;
Monitor *m;
XEvent ev;
+ Time lasttime = 0;
if(!(c = selmon->sel))
return;
@@ -1290,6 +1295,10 @@ resizemouse(const Arg *arg) {
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