diff options
author | Eric Anholt <eric@anholt.net> | 2007-01-18 13:13:25 -0800 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2007-01-18 13:13:46 -0800 |
commit | 8759f4d89a141f7d69f1894ec3059ba6bd1cf86b (patch) | |
tree | 3f967e3b69ff1eea726635a47bf4cfd5cc69e9af /src/i830_cursor.c | |
parent | b296cd9b8f63ab80e8fe46fcfcdba2e9af846468 (diff) |
Partially deal with cursor rotation.
The remaining issue is having a cursor image per CRTC so that the cursors can
be rotated on the independently rotated CRTCs.
Diffstat (limited to 'src/i830_cursor.c')
-rw-r--r-- | src/i830_cursor.c | 67 |
1 files changed, 34 insertions, 33 deletions
diff --git a/src/i830_cursor.c b/src/i830_cursor.c index 5e7a21a1..364320e8 100644 --- a/src/i830_cursor.c +++ b/src/i830_cursor.c @@ -456,49 +456,50 @@ I830SetCursorPosition(ScrnInfoPtr pScrn, int x, int y) I830Ptr pI830 = I830PTR(pScrn); CARD32 temp; Bool inrange; - int oldx = x, oldy = y; - int hotspotx = 0, hotspoty = 0; + int root_x = x, root_y = y; int pipe; - oldx += pScrn->frameX0; /* undo what xf86HWCurs did */ - oldy += pScrn->frameY0; - - switch (pI830->rotation) { - case RR_Rotate_0: - x = oldx; - y = oldy; - break; - case RR_Rotate_90: - x = oldy; - y = pScrn->pScreen->width - oldx; - hotspoty = I810_CURSOR_X; - break; - case RR_Rotate_180: - x = pScrn->pScreen->width - oldx; - y = pScrn->pScreen->height - oldy; - hotspotx = I810_CURSOR_X; - hotspoty = I810_CURSOR_Y; - break; - case RR_Rotate_270: - x = pScrn->pScreen->height - oldy; - y = oldx; - hotspotx = I810_CURSOR_Y; - break; - } - - x -= hotspotx; - y -= hotspoty; + root_x = x + pScrn->frameX0; /* undo what xf86HWCurs did */ + root_y = y + pScrn->frameY0; for (pipe = 0; pipe < xf86_config->num_crtc; pipe++) { - xf86CrtcPtr crtc = xf86_config->crtc[pipe]; + xf86CrtcPtr crtc = xf86_config->crtc[pipe]; DisplayModePtr mode = &crtc->mode; - int thisx = x - crtc->x; - int thisy = y - crtc->y; + int thisx; + int thisy; + int hotspotx = 0, hotspoty = 0; if (!crtc->enabled) continue; + /* XXX: deal with hotspot issues */ + switch (crtc->rotation) { + case RR_Rotate_0: + thisx = (root_x - crtc->x); + thisy = (root_y - crtc->y); + break; + case RR_Rotate_90: + thisx = (root_y - crtc->y); + thisy = mode->VDisplay - (root_x - crtc->x); + /*hotspoty = I810_CURSOR_X;*/ + break; + case RR_Rotate_180: + thisx = mode->HDisplay - (root_x - crtc->x); + thisy = mode->VDisplay - (root_y - crtc->y); + /*hotspotx = I810_CURSOR_X; + hotspoty = I810_CURSOR_Y;*/ + break; + case RR_Rotate_270: + thisx = mode->VDisplay - (root_y - crtc->y); + thisy = (root_x - crtc->x); + /*hotspotx = I810_CURSOR_Y;*/ + break; + } + + thisx -= hotspotx; + thisy -= hotspoty; + /* * There is a screen display problem when the cursor position is set * wholely outside of the viewport. We trap that here, turning the |