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
This commit is contained in:
Keith Packard 2006-11-07 01:29:51 -08:00
parent c20d3bf753
commit 1dcda4f3c5
3 changed files with 10 additions and 5 deletions

View File

@ -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);

View File

@ -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);
}

View File

@ -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 */