xf86-video-intel: src/i830_cursor.c

Michel Daenzer daenzer at kemper.freedesktop.org
Tue Oct 17 14:30:32 EEST 2006


 src/i830_cursor.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

New commits:
diff-tree 5ac927d6f05ba6f9608d7e758cbac66e8b3a9db1 (from adae75ef2f8a655a699e982ca8f26b934dbe950a)
Author: Michel Dänzer <michel at tungstengraphics.com>
Date:   Tue Oct 17 13:27:40 2006 +0200

    Don't crash if SetCursorPosition is called with pScrn->currentMode == NULL.
    
    This allows the driver to work with servers that don't have the fix for this
    that was only recently pushed to git.

diff --git a/src/i830_cursor.c b/src/i830_cursor.c
index c5c904c..8343b6b 100644
--- a/src/i830_cursor.c
+++ b/src/i830_cursor.c
@@ -520,11 +520,17 @@ I830SetCursorPosition(ScrnInfoPtr pScrn,
    x -= pScrn->frameX0;
    y -= pScrn->frameY0;
 
-   /* Clamp the cursor position to the visible screen area */
-   if (x >= pScrn->currentMode->HDisplay) x = pScrn->currentMode->HDisplay - 1;
-   if (y >= pScrn->currentMode->VDisplay) y = pScrn->currentMode->VDisplay - 1;
-   if (x <= -I810_CURSOR_X) x = -I810_CURSOR_X + 1;
-   if (y <= -I810_CURSOR_Y) y = -I810_CURSOR_Y + 1;
+   if (pScrn->currentMode) {
+      /* Clamp the cursor position to the visible screen area */
+      if (x >= pScrn->currentMode->HDisplay) x = pScrn->currentMode->HDisplay - 1;
+      if (y >= pScrn->currentMode->VDisplay) y = pScrn->currentMode->VDisplay - 1;
+      if (x <= -I810_CURSOR_X) x = -I810_CURSOR_X + 1;
+      if (y <= -I810_CURSOR_Y) y = -I810_CURSOR_Y + 1;
+   } else {
+      /* Can't ensure the cursor will be visible, so hide it */
+      hide = TRUE;
+      show = FALSE;
+   }
 
 #if 0
    /*



More information about the xorg-commit mailing list