| --- randr/rrpointer.c.orig 2014-07-11 17:19:45.474378252 -0700 |
| +++ randr/rrpointer.c 2014-07-11 17:21:03.954375699 -0700 |
| @@ -77,21 +77,22 @@ |
| |
| if (x < crtc->x) |
| dx = crtc->x - x; |
| - else if (x > crtc->x + scan_width) |
| - dx = x - (crtc->x + scan_width); |
| + else if (x > crtc->x + scan_width - 1) |
| + dx = crtc->x + (scan_width - 1) - x; |
| else |
| dx = 0; |
| if (y < crtc->y) |
| dy = crtc->y - y; |
| - else if (y > crtc->y + scan_height) |
| - dy = y - (crtc->y + scan_height); |
| + else if (y > crtc->y + scan_height - 1) |
| + dy = crtc->y + (scan_height - 1) - y; |
| else |
| dy = 0; |
| - dist = dx + dy; |
| + dist = abs(dx) + abs(dy); |
| if (!nearest || dist < best) { |
| nearest = crtc; |
| best_dx = dx; |
| best_dy = dy; |
| + best = dist; |
| } |
| } |
| if (best_dx || best_dy) |