summaryrefslogtreecommitdiff
path: root/src/i830_cursor.c
diff options
context:
space:
mode:
authorEric Anholt <anholt@FreeBSD.org>2006-07-11 14:05:38 -0700
committerEric Anholt <anholt@FreeBSD.org>2006-07-11 14:05:38 -0700
commit05bcbadd130524694e11e372d54cb419cea566cc (patch)
tree92f8066651b697a04447293e660ac2dcee317849 /src/i830_cursor.c
parentb65f18b05a5fba506b71293b495cab95197037ac (diff)
Avoid NULL dereference if cursor position changes during a mode change.
Diffstat (limited to 'src/i830_cursor.c')
-rw-r--r--src/i830_cursor.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/i830_cursor.c b/src/i830_cursor.c
index b3736490..2cb069cc 100644
--- a/src/i830_cursor.c
+++ b/src/i830_cursor.c
@@ -1,4 +1,4 @@
-
+/* -*- c-basic-offset: 3 -*- */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
@@ -398,9 +398,15 @@ I830SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
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;
+ /* Clamp the cursor position to the visible screen area. Ignore this if we
+ * are doing motion (with SilkenMouse) while the currentMode being changed.
+ */
+ if (pScrn->currentMode != NULL) {
+ 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;