summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@neko.keithp.com>2006-11-07 01:29:51 -0800
committerKeith Packard <keithp@neko.keithp.com>2006-11-07 01:29:51 -0800
commit1dcda4f3c56214464c0b6123fea6daa69aae69fc (patch)
treec6bc9951e7479bf442e396b71f6e083fa193e1b5
parentc20d3bf7533da0bf26beaf7d8c359d18edbd70e8 (diff)
Avoid dereferencing sprite.screen when Xinerama is not running. (#8925)
With Xinerama support built into the X server but not in use, sprite.screen is NULL and yet the SyntheticMotion macro would dereference it. Avoid that by just passing sprite.screen to PostSyntheticMotion which can then dereference it when Xinerama is enabled. Also, define PostSyntheticMotion in dixevents.h and include dixevents.h in getevents.c
-rw-r--r--dix/events.c3
-rw-r--r--dix/getevents.c8
-rw-r--r--include/dixevents.h4
3 files changed, 10 insertions, 5 deletions
diff --git a/dix/events.c b/dix/events.c
index 3b1a0aaf4..ce053b347 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -327,11 +327,10 @@ static CARD8 criticalEvents[32] =
#ifdef PANORAMIX
static void ConfineToShape(RegionPtr shape, int *px, int *py);
-extern void PostSyntheticMotion(int x, int y, int screenNum, int time);
static void PostNewCursor(void);
#define SyntheticMotion(x, y) \
- PostSyntheticMotion(x, y, sprite.screen->myNum, \
+ PostSyntheticMotion(x, y, sprite.screen, \
syncEvents.playingEvents ? \
syncEvents.time.milliseconds : \
currentTime.milliseconds);
diff --git a/dix/getevents.c b/dix/getevents.c
index b19a73fa6..1d9502802 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -38,6 +38,7 @@
#include "dixstruct.h"
#include "globals.h"
+#include "dixevents.h"
#include "mipointer.h"
@@ -758,7 +759,7 @@ SwitchCorePointer(DeviceIntPtr pDev)
* to shift the pointer to get it inside the new bounds.
*/
void
-PostSyntheticMotion(int x, int y, int screenNum, unsigned long time)
+PostSyntheticMotion(int x, int y, ScreenPtr pScreen, unsigned long time)
{
xEvent xE;
@@ -767,8 +768,8 @@ PostSyntheticMotion(int x, int y, int screenNum, unsigned long time)
will translate from sprite screen to screen 0 upon reentry
to the DIX layer. */
if (!noPanoramiXExtension) {
- x += panoramiXdataPtr[0].x - panoramiXdataPtr[screenNum].x;
- y += panoramiXdataPtr[0].y - panoramiXdataPtr[screenNum].y;
+ x += panoramiXdataPtr[0].x - panoramiXdataPtr[pScreen->myNum].x;
+ y += panoramiXdataPtr[0].y - panoramiXdataPtr[pScreen->myNum].y;
}
#endif
@@ -776,6 +777,7 @@ PostSyntheticMotion(int x, int y, int screenNum, unsigned long time)
xE.u.u.type = MotionNotify;
xE.u.keyButtonPointer.rootX = x;
xE.u.keyButtonPointer.rootY = y;
+ xE.u.keyButtonPointer.time = time;
(*inputInfo.pointer->public.processInputProc)(&xE, inputInfo.pointer, 1);
}
diff --git a/include/dixevents.h b/include/dixevents.h
index 2a9458f08..c78fb0e85 100644
--- a/include/dixevents.h
+++ b/include/dixevents.h
@@ -102,4 +102,8 @@ extern int ProcUngrabButton(ClientPtr /* client */);
extern int ProcRecolorCursor(ClientPtr /* client */);
+#ifdef PANORAMIX
+extern void PostSyntheticMotion(int x, int y, ScreenPtr pScreen, unsigned long time);
+#endif
+
#endif /* DIXEVENTS_H */