summaryrefslogtreecommitdiff
path: root/randr/rrpointer.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter@cs.unisa.edu.au>2007-01-28 17:18:57 +1030
committerPeter Hutterer <whot@hyena.localdomain>2007-01-28 17:18:57 +1030
commit15a81b6325d359990017b8e9f17ce18a7eff1354 (patch)
treec1709b4d65e052be7dbfbb1c2d96cb2b99d6d884 /randr/rrpointer.c
parent3759254c0967ae83bdcbf097d9e8a58733c8e6f9 (diff)
parentcc3d66d4a53fee8f1d940bb8c7f032c94b9c25f6 (diff)
Merge branch 'master'
Diffstat (limited to 'randr/rrpointer.c')
-rw-r--r--randr/rrpointer.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/randr/rrpointer.c b/randr/rrpointer.c
index b9ee3bce2..bf9031543 100644
--- a/randr/rrpointer.c
+++ b/randr/rrpointer.c
@@ -35,11 +35,15 @@ static Bool
RRCrtcContainsPosition (RRCrtcPtr crtc, int x, int y)
{
RRModePtr mode = crtc->mode;
-
+ int scan_width, scan_height;
+
if (!mode)
return FALSE;
- if (crtc->x <= x && x < crtc->x + mode->mode.width &&
- crtc->y <= y && y < crtc->y + mode->mode.height)
+
+ RRCrtcGetScanoutSize (crtc, &scan_width, &scan_height);
+
+ if (crtc->x <= x && x < crtc->x + scan_width &&
+ crtc->y <= y && y < crtc->y + scan_height)
return TRUE;
return FALSE;
}
@@ -55,28 +59,32 @@ RRPointerToNearestCrtc (ScreenPtr pScreen, int x, int y, RRCrtcPtr skip)
RRCrtcPtr nearest = NULL;
int best = 0;
int best_dx = 0, best_dy = 0;
-
+
for (c = 0; c < pScrPriv->numCrtcs; c++)
{
RRCrtcPtr crtc = pScrPriv->crtcs[c];
RRModePtr mode = crtc->mode;
int dx, dy;
int dist;
+ int scan_width, scan_height;
if (!mode)
continue;
if (crtc == skip)
continue;
+
+ RRCrtcGetScanoutSize (crtc, &scan_width, &scan_height);
+
if (x < crtc->x)
dx = crtc->x - x;
- else if (x > crtc->x + mode->mode.width)
- dx = x - (crtc->x + mode->mode.width);
+ else if (x > crtc->x + scan_width)
+ dx = x - (crtc->x + scan_width);
else
dx = 0;
if (y < crtc->y)
dy = crtc->y - x;
- else if (y > crtc->y + mode->mode.height)
- dy = y - (crtc->y + mode->mode.height);
+ else if (y > crtc->y + scan_height)
+ dy = y - (crtc->y + scan_height);
else
dy = 0;
dist = dx + dy;