Don't restrict snap in mousemove
5b238c8d
This also fixes a bug where client windows only switch to floating mode when the mouse is dragged in one specific direction.
1 file(s) · +11 −14
This also fixes a bug where client windows only switch to floating mode when the mouse is dragged in one specific direction.
| 1170 | 1170 | ||
| 1171 | 1171 | nx = ocx + (ev.xmotion.x - x); |
|
| 1172 | 1172 | ny = ocy + (ev.xmotion.y - y); |
|
| 1173 | - | if (nx >= selmon->wx && nx <= selmon->wx + selmon->ww |
|
| 1174 | - | && ny >= selmon->wy && ny <= selmon->wy + selmon->wh) { |
|
| 1175 | - | if (abs(selmon->wx - nx) < snap) |
|
| 1176 | - | nx = selmon->wx; |
|
| 1177 | - | else if (abs((selmon->wx + selmon->ww) - (nx + WIDTH(c))) < snap) |
|
| 1178 | - | nx = selmon->wx + selmon->ww - WIDTH(c); |
|
| 1179 | - | if (abs(selmon->wy - ny) < snap) |
|
| 1180 | - | ny = selmon->wy; |
|
| 1181 | - | else if (abs((selmon->wy + selmon->wh) - (ny + HEIGHT(c))) < snap) |
|
| 1182 | - | ny = selmon->wy + selmon->wh - HEIGHT(c); |
|
| 1183 | - | if (!c->isfloating && selmon->lt[selmon->sellt]->arrange |
|
| 1184 | - | && (abs(nx - c->x) > snap || abs(ny - c->y) > snap)) |
|
| 1185 | - | togglefloating(NULL); |
|
| 1186 | - | } |
|
| 1173 | + | if (abs(selmon->wx - nx) < snap) |
|
| 1174 | + | nx = selmon->wx; |
|
| 1175 | + | else if (abs((selmon->wx + selmon->ww) - (nx + WIDTH(c))) < snap) |
|
| 1176 | + | nx = selmon->wx + selmon->ww - WIDTH(c); |
|
| 1177 | + | if (abs(selmon->wy - ny) < snap) |
|
| 1178 | + | ny = selmon->wy; |
|
| 1179 | + | else if (abs((selmon->wy + selmon->wh) - (ny + HEIGHT(c))) < snap) |
|
| 1180 | + | ny = selmon->wy + selmon->wh - HEIGHT(c); |
|
| 1181 | + | if (!c->isfloating && selmon->lt[selmon->sellt]->arrange |
|
| 1182 | + | && (abs(nx - c->x) > snap || abs(ny - c->y) > snap)) |
|
| 1183 | + | togglefloating(NULL); |
|
| 1187 | 1184 | if (!selmon->lt[selmon->sellt]->arrange || c->isfloating) |
|
| 1188 | 1185 | resize(c, nx, ny, c->w, c->h, 1); |
|
| 1189 | 1186 | break; |