summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Zhao <yang@yangman.ca>2009-05-04 20:38:27 (GMT)
committerMatthias Hopf <mhopf@suse.de>2009-05-06 10:04:55 (GMT)
commit4be5f7152f71c292f16b6e30c59c07b282ea4772 (patch)
treebf7984aed1fdd0209be28b997d1a845dcde44744
parent669e0befdf73a6e1502b0f499a4a9d2122929854 (diff)
Cursor: Fix remaning corruption cases
Port of f668cc06cd7f338888a7dce1507026af0e9e36ad to new code Found by Alex: Apparently the cursor image cannot end on a multiple of 128 pixels. Also, for panning, the end of the cursor image cannot extend past the end of the viewport. Signed-off-by: Yang Zhao <yang@yangman.ca>
-rw-r--r--src/rhd_cursor.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/rhd_cursor.c b/src/rhd_cursor.c
index 751c614..91c320b 100644
--- a/src/rhd_cursor.c
+++ b/src/rhd_cursor.c
@@ -649,8 +649,9 @@ rhdCrtcHideCursor(struct rhdCrtc *Crtc)
void
rhdCrtcSetCursorPosition(struct rhdCrtc *Crtc, int x, int y)
{
+ RHDPtr rhdPtr = RHDPTRI(Crtc);
struct rhdCursor *Cursor = Crtc->Cursor;
- int hotx, hoty;
+ int hotx, hoty, width, cursor_end, frame_end;
Cursor->X = x;
Cursor->Y = y;
@@ -669,6 +670,36 @@ rhdCrtcSetCursorPosition(struct rhdCrtc *Crtc, int x, int y)
}
lockCursor (Cursor, TRUE);
+
+ /* Work around rare corruption cases by adjusting cursor size;
+ * related to bug #13405
+ * For dual-screen:
+ * - Cursor's right-edge must not end on multiples of 128px.
+ * - For panning, cursor image cannot horizontally extend past end of viewport.
+ */
+ if (rhdPtr->Crtc[0]->Active && rhdPtr->Crtc[1]->Active) {
+ width = Cursor->Width;
+ cursor_end = x + width;
+ frame_end = Crtc->X + Crtc->Width;
+
+ if (cursor_end > frame_end) {
+ width -= cursor_end - frame_end;
+ cursor_end = x + width;
+ }
+ if (! (cursor_end & 0x7f)) {
+ width--;
+ }
+ /* If the cursor is effectively invisible, move it out of visible area */
+ if (width <= 0) {
+ width = 1;
+ x = 0;
+ y = Crtc->Y + Crtc->Height;
+ hotx = 0;
+ hoty = 0;
+ }
+ setCursorSize(Cursor, width, Cursor->Height);
+ }
+
setCursorPos (Cursor, x, y, hotx, hoty);
lockCursor (Cursor, FALSE);
}