summaryrefslogtreecommitdiffstats
path: root/dwm.c
diff options
context:
space:
mode:
authorAnselm R Garbe <garbeam@gmail.com>2014-08-11 07:24:29 +0200
committerAnselm R Garbe <garbeam@gmail.com>2014-08-11 07:24:29 +0200
commit3d1090ba896319368c4771b88d325fcee368a608 (patch)
tree7fc1223b206fd8b57eac0059425ed35bb69af65b /dwm.c
parentsame as before with dwm.c as well (diff)
downloaddwm-3d1090ba896319368c4771b88d325fcee368a608.tar.gz
dwm-3d1090ba896319368c4771b88d325fcee368a608.zip
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 ffc8864..f896170 100644
--- a/dwm.c
+++ b/dwm.c
@@ -1123,6 +1123,7 @@ movemouse(const Arg *arg) {
1123 Client *c; 1123 Client *c;
1124 Monitor *m; 1124 Monitor *m;
1125 XEvent ev; 1125 XEvent ev;
1126 Time lasttime = 0;
1126 1127
1127 if(!(c = selmon->sel)) 1128 if(!(c = selmon->sel))
1128 return; 1129 return;
@@ -1145,6 +1146,10 @@ movemouse(const Arg *arg) {
1145 handler[ev.type](&ev); 1146 handler[ev.type](&ev);
1146 break; 1147 break;
1147 case MotionNotify: 1148 case MotionNotify:
1149 if ((ev.xmotion.time - lasttime) <= (1000 / 60))
1150 continue;
1151 lasttime = ev.xmotion.time;
1152
1148 nx = ocx + (ev.xmotion.x - x); 1153 nx = ocx + (ev.xmotion.x - x);
1149 ny = ocy + (ev.xmotion.y - y); 1154 ny = ocy + (ev.xmotion.y - y);
1150 if(nx >= selmon->wx && nx <= selmon->wx + selmon->ww 1155 if(nx >= selmon->wx && nx <= selmon->wx + selmon->ww
@@ -1264,11 +1269,11 @@ resizeclient(Client *c, int x, int y, int w, int h) {
1264 1269
1265void 1270void
1266resizemouse(const Arg *arg) { 1271resizemouse(const Arg *arg) {
1267 int ocx, ocy; 1272 int ocx, ocy, nw, nh;
1268 int nw, nh;
1269 Client *c; 1273 Client *c;
1270 Monitor *m; 1274 Monitor *m;
1271 XEvent ev; 1275 XEvent ev;
1276 Time lasttime = 0;
1272 1277
1273 if(!(c = selmon->sel)) 1278 if(!(c = selmon->sel))
1274 return; 1279 return;
@@ -1290,6 +1295,10 @@ resizemouse(const Arg *arg) {
1290 handler[ev.type](&ev); 1295 handler[ev.type](&ev);
1291 break; 1296 break;
1292 case MotionNotify: 1297 case MotionNotify:
1298 if ((ev.xmotion.time - lasttime) <= (1000 / 60))
1299 continue;
1300 lasttime = ev.xmotion.time;
1301
1293 nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1); 1302 nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1);
1294 nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1); 1303 nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1);
1295 if(c->mon->wx + nw >= selmon->wx && c->mon->wx + nw <= selmon->wx + selmon->ww 1304 if(c->mon->wx + nw >= selmon->wx && c->mon->wx + nw <= selmon->wx + selmon->ww