diff options
| author | Anselm R Garbe <garbeam@gmail.com> | 2014-08-11 07:24:29 +0200 |
|---|---|---|
| committer | Anselm R Garbe <garbeam@gmail.com> | 2014-08-11 07:24:29 +0200 |
| commit | 3d1090ba896319368c4771b88d325fcee368a608 (patch) | |
| tree | 7fc1223b206fd8b57eac0059425ed35bb69af65b | |
| parent | same as before with dwm.c as well (diff) | |
| download | dwm-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.
| -rw-r--r-- | LICENSE | 1 | ||||
| -rw-r--r-- | dwm.c | 13 |
2 files changed, 12 insertions, 2 deletions
| @@ -1,6 +1,7 @@ | |||
| 1 | MIT/X Consortium License | 1 | MIT/X Consortium License |
| 2 | 2 | ||
| 3 | © 2006-2014 Anselm R Garbe <anselm@garbe.us> | 3 | © 2006-2014 Anselm R Garbe <anselm@garbe.us> |
| 4 | © 2010-2014 Hiltjo Posthuma <hiltjo@codemadness.org> | ||
| 4 | © 2007-2011 Peter Hartlich <sgkkr at hartlich dot com> | 5 | © 2007-2011 Peter Hartlich <sgkkr at hartlich dot com> |
| 5 | © 2010-2011 Connor Lane Smith <cls@lubutu.com> | 6 | © 2010-2011 Connor Lane Smith <cls@lubutu.com> |
| 6 | © 2006-2009 Jukka Salmi <jukka at salmi dot ch> | 7 | © 2006-2009 Jukka Salmi <jukka at salmi dot ch> |
| @@ -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 | ||
| 1265 | void | 1270 | void |
| 1266 | resizemouse(const Arg *arg) { | 1271 | resizemouse(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 |
