xserver: Branch 'master' - 5 commits
Peter Hutterer
whot at kemper.freedesktop.org
Mon Feb 9 20:29:18 PST 2009
dix/events.c | 383 ++++++++++++++++++++++++-----------------------------------
1 file changed, 157 insertions(+), 226 deletions(-)
New commits:
commit 5b2bbffc12cd7d29e4200943f8736bd6336ae4aa
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Fri Jan 30 16:46:27 2009 +1000
dix: deduplicate SyntheticMotion.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/dix/events.c b/dix/events.c
index 97d7730..77badfd 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -402,15 +402,21 @@ static CARD8 criticalEvents[32] =
0x7c, 0x30, 0x40 /* key, button, expose, and configure events */
};
+static void
+SyntheticMotion(DeviceIntPtr dev, int x, int y) {
+ int screenno = 0;
+
#ifdef PANORAMIX
-static void PostNewCursor(DeviceIntPtr pDev);
+ if (!noPanoramiXExtension)
+ screenno = dev->spriteInfo->sprite->screen->myNum;
+#endif
+ PostSyntheticMotion(dev, x, y, screenno,
+ (syncEvents.playingEvents) ? syncEvents.time.milliseconds : currentTime.milliseconds);
-#define SyntheticMotion(dev, x, y) \
- PostSyntheticMotion(dev, x, y, noPanoramiXExtension ? 0 : \
- dev->spriteInfo->sprite->screen->myNum, \
- syncEvents.playingEvents ? \
- syncEvents.time.milliseconds : \
- currentTime.milliseconds);
+}
+
+#ifdef PANORAMIX
+static void PostNewCursor(DeviceIntPtr pDev);
static Bool
XineramaSetCursorPosition(
@@ -550,14 +556,6 @@ XineramaConfineCursorToWindow(DeviceIntPtr pDev,
CheckPhysLimits(pDev, pSprite->current, generateEvents, FALSE, NULL);
}
-#else
-#define SyntheticMotion(dev, x, y) \
- PostSyntheticMotion(dev, x, y, \
- 0, \
- syncEvents.playingEvents ? \
- syncEvents.time.milliseconds : \
- currentTime.milliseconds);
-
#endif /* PANORAMIX */
void
commit 34820f9c1304891bebb4bff6a492288aec4fc0d1
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Fri Jan 30 16:37:19 2009 +1000
dix: remove XineramaChangeToCursor.
It's nearly identical to ChangeToCursor now anyway.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/dix/events.c b/dix/events.c
index c05f27d..97d7730 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -550,24 +550,6 @@ XineramaConfineCursorToWindow(DeviceIntPtr pDev,
CheckPhysLimits(pDev, pSprite->current, generateEvents, FALSE, NULL);
}
-
-static void
-XineramaChangeToCursor(DeviceIntPtr pDev, CursorPtr cursor)
-{
- SpritePtr pSprite = pDev->spriteInfo->sprite;
-
- if (cursor != pSprite->current)
- {
- if ((pSprite->current->bits->xhot != cursor->bits->xhot) ||
- (pSprite->current->bits->yhot != cursor->bits->yhot))
- CheckPhysLimits(pDev, cursor, FALSE, FALSE, NULL);
- (*pSprite->screen->DisplayCursor)(pDev, pSprite->screen, cursor);
- FreeCursor(pSprite->current, (Cursor)0);
- pSprite->current = cursor;
- pSprite->current->refcnt++;
- }
-}
-
#else
#define SyntheticMotion(dev, x, y) \
PostSyntheticMotion(dev, x, y, \
@@ -849,13 +831,7 @@ static void
ChangeToCursor(DeviceIntPtr pDev, CursorPtr cursor)
{
SpritePtr pSprite = pDev->spriteInfo->sprite;
-
-#ifdef PANORAMIX
- if(!noPanoramiXExtension) {
- XineramaChangeToCursor(pDev, cursor);
- return;
- }
-#endif
+ ScreenPtr pScreen;
if (cursor != pSprite->current)
{
@@ -863,9 +839,15 @@ ChangeToCursor(DeviceIntPtr pDev, CursorPtr cursor)
(pSprite->current->bits->yhot != cursor->bits->yhot))
CheckPhysLimits(pDev, cursor, FALSE, pSprite->confined,
(ScreenPtr)NULL);
- (*pSprite->hotPhys.pScreen->DisplayCursor) (pDev,
- pSprite->hotPhys.pScreen,
- cursor);
+#ifdef PANORAMIX
+ /* XXX: is this really necessary?? (whot) */
+ if (!noPanoramiXExtension)
+ pScreen = pSprite->screen;
+ else
+#endif
+ pScreen = pSprite->hotPhys.pScreen;
+
+ (*pScreen->DisplayCursor)(pDev, pScreen, cursor);
FreeCursor(pSprite->current, (Cursor)0);
pSprite->current = cursor;
pSprite->current->refcnt++;
commit 942eae6868b8b0f343b6aa921ddf77e8bb70798a
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Fri Jan 30 16:25:22 2009 +1000
dix: Remove XineramaCheckPhysLimits.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/dix/events.c b/dix/events.c
index a3f6978..c05f27d 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -216,6 +216,11 @@ Mask DontPropagateMasks[DNPMCOUNT];
static int DontPropagateRefCnts[DNPMCOUNT];
static void CheckVirtualMotion( DeviceIntPtr pDev, QdEventPtr qe, WindowPtr pWin);
+static void CheckPhysLimits(DeviceIntPtr pDev,
+ CursorPtr cursor,
+ Bool generateEvents,
+ Bool confineToScreen,
+ ScreenPtr pScreen);
/**
* Main input device struct.
@@ -472,49 +477,6 @@ XineramaConstrainCursor(DeviceIntPtr pDev)
(* pScreen->ConstrainCursor)(pDev, pScreen, &newBox);
}
-static void
-XineramaCheckPhysLimits(
- DeviceIntPtr pDev,
- CursorPtr cursor,
- Bool generateEvents
-){
- HotSpot new;
- SpritePtr pSprite = pDev->spriteInfo->sprite;
-
- if (!cursor)
- return;
-
- new = pSprite->hotPhys;
-
- /* I don't care what the DDX has to say about it */
- pSprite->physLimits = pSprite->hotLimits;
-
- /* constrain the pointer to those limits */
- if (new.x < pSprite->physLimits.x1)
- new.x = pSprite->physLimits.x1;
- else
- if (new.x >= pSprite->physLimits.x2)
- new.x = pSprite->physLimits.x2 - 1;
- if (new.y < pSprite->physLimits.y1)
- new.y = pSprite->physLimits.y1;
- else
- if (new.y >= pSprite->physLimits.y2)
- new.y = pSprite->physLimits.y2 - 1;
-
- if (pSprite->hotShape) /* more work if the shape is a mess */
- ConfineToShape(pDev, pSprite->hotShape, &new.x, &new.y);
-
- if((new.x != pSprite->hotPhys.x) || (new.y != pSprite->hotPhys.y))
- {
- XineramaSetCursorPosition (pDev, new.x, new.y, generateEvents);
- if (!generateEvents)
- SyntheticMotion(pDev, new.x, new.y);
- }
-
- /* Tell DDX what the limits are */
- XineramaConstrainCursor(pDev);
-}
-
static Bool
XineramaSetWindowPntrs(DeviceIntPtr pDev, WindowPtr pWin)
@@ -585,8 +547,7 @@ XineramaConfineCursorToWindow(DeviceIntPtr pDev,
pSprite->confined = FALSE;
pSprite->confineWin = (pWin == WindowTable[0]) ? NullWindow : pWin;
- XineramaCheckPhysLimits(pDev, pSprite->current,
- generateEvents);
+ CheckPhysLimits(pDev, pSprite->current, generateEvents, FALSE, NULL);
}
@@ -599,7 +560,7 @@ XineramaChangeToCursor(DeviceIntPtr pDev, CursorPtr cursor)
{
if ((pSprite->current->bits->xhot != cursor->bits->xhot) ||
(pSprite->current->bits->yhot != cursor->bits->yhot))
- XineramaCheckPhysLimits(pDev, cursor, FALSE);
+ CheckPhysLimits(pDev, cursor, FALSE, FALSE, NULL);
(*pSprite->screen->DisplayCursor)(pDev, pSprite->screen, cursor);
FreeCursor(pSprite->current, (Cursor)0);
pSprite->current = cursor;
@@ -684,8 +645,8 @@ CheckPhysLimits(
DeviceIntPtr pDev,
CursorPtr cursor,
Bool generateEvents,
- Bool confineToScreen,
- ScreenPtr pScreen)
+ Bool confineToScreen, /* unused if PanoramiX on */
+ ScreenPtr pScreen) /* unused if PanoramiX on */
{
HotSpot new;
SpritePtr pSprite = pDev->spriteInfo->sprite;
@@ -693,14 +654,24 @@ CheckPhysLimits(
if (!cursor)
return;
new = pSprite->hotPhys;
- if (pScreen)
- new.pScreen = pScreen;
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension)
+ /* I don't care what the DDX has to say about it */
+ pSprite->physLimits = pSprite->hotLimits;
else
- pScreen = new.pScreen;
- (*pScreen->CursorLimits) (pDev, pScreen, cursor, &pSprite->hotLimits,
- &pSprite->physLimits);
- pSprite->confined = confineToScreen;
- (* pScreen->ConstrainCursor)(pDev, pScreen, &pSprite->physLimits);
+#endif
+ {
+ if (pScreen)
+ new.pScreen = pScreen;
+ else
+ pScreen = new.pScreen;
+ (*pScreen->CursorLimits) (pDev, pScreen, cursor, &pSprite->hotLimits,
+ &pSprite->physLimits);
+ pSprite->confined = confineToScreen;
+ (* pScreen->ConstrainCursor)(pDev, pScreen, &pSprite->physLimits);
+ }
+
+ /* constrain the pointer to those limits */
if (new.x < pSprite->physLimits.x1)
new.x = pSprite->physLimits.x1;
else
@@ -716,13 +687,26 @@ CheckPhysLimits(
if ((pScreen != pSprite->hotPhys.pScreen) ||
(new.x != pSprite->hotPhys.x) || (new.y != pSprite->hotPhys.y))
{
- if (pScreen != pSprite->hotPhys.pScreen)
- pSprite->hotPhys = new;
- (*pScreen->SetCursorPosition)
- (pDev, pScreen, new.x, new.y, generateEvents);
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension)
+ XineramaSetCursorPosition (pDev, new.x, new.y, generateEvents);
+#endif
+ else
+ {
+ if (pScreen != pSprite->hotPhys.pScreen)
+ pSprite->hotPhys = new;
+ (*pScreen->SetCursorPosition)
+ (pDev, pScreen, new.x, new.y, generateEvents);
+ }
if (!generateEvents)
- SyntheticMotion(pDev, new.x, new.y);
+ SyntheticMotion(pDev, new.x, new.y);
}
+
+#ifdef PANORAMIX
+ /* Tell DDX what the limits are */
+ if (!noPanoramiXExtension)
+ XineramaConstrainCursor(pDev);
+#endif
}
static void
commit bf044f6d10ad9f2baca91a2f04e82dc1af2657cd
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Fri Jan 30 16:14:54 2009 +1000
dix: reduce redunancy in XineramaConfineCursorToWindow.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/dix/events.c b/dix/events.c
index 62b31c4..a3f6978 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -549,52 +549,44 @@ XineramaConfineCursorToWindow(DeviceIntPtr pDev,
{
SpritePtr pSprite = pDev->spriteInfo->sprite;
- if (syncEvents.playingEvents)
- {
- CheckVirtualMotion(pDev, (QdEventPtr)NULL, pWin);
- SyntheticMotion(pDev, pSprite->hot.x, pSprite->hot.y);
- }
- else
- {
- int x, y, off_x, off_y, i;
+ int x, y, off_x, off_y, i;
- if(!XineramaSetWindowPntrs(pDev, pWin))
- return;
+ if(!XineramaSetWindowPntrs(pDev, pWin))
+ return;
- i = PanoramiXNumScreens - 1;
+ i = PanoramiXNumScreens - 1;
- REGION_COPY(pSprite->screen, &pSprite->Reg1,
- &pSprite->windows[i]->borderSize);
- off_x = panoramiXdataPtr[i].x;
- off_y = panoramiXdataPtr[i].y;
+ REGION_COPY(pSprite->screen, &pSprite->Reg1,
+ &pSprite->windows[i]->borderSize);
+ off_x = panoramiXdataPtr[i].x;
+ off_y = panoramiXdataPtr[i].y;
- while(i--) {
- x = off_x - panoramiXdataPtr[i].x;
- y = off_y - panoramiXdataPtr[i].y;
+ while(i--) {
+ x = off_x - panoramiXdataPtr[i].x;
+ y = off_y - panoramiXdataPtr[i].y;
- if(x || y)
- REGION_TRANSLATE(pSprite->screen, &pSprite->Reg1, x, y);
+ if(x || y)
+ REGION_TRANSLATE(pSprite->screen, &pSprite->Reg1, x, y);
- REGION_UNION(pSprite->screen, &pSprite->Reg1, &pSprite->Reg1,
- &pSprite->windows[i]->borderSize);
+ REGION_UNION(pSprite->screen, &pSprite->Reg1, &pSprite->Reg1,
+ &pSprite->windows[i]->borderSize);
- off_x = panoramiXdataPtr[i].x;
- off_y = panoramiXdataPtr[i].y;
- }
+ off_x = panoramiXdataPtr[i].x;
+ off_y = panoramiXdataPtr[i].y;
+ }
- pSprite->hotLimits = *REGION_EXTENTS(pSprite->screen, &pSprite->Reg1);
+ pSprite->hotLimits = *REGION_EXTENTS(pSprite->screen, &pSprite->Reg1);
- if(REGION_NUM_RECTS(&pSprite->Reg1) > 1)
- pSprite->hotShape = &pSprite->Reg1;
- else
- pSprite->hotShape = NullRegion;
+ if(REGION_NUM_RECTS(&pSprite->Reg1) > 1)
+ pSprite->hotShape = &pSprite->Reg1;
+ else
+ pSprite->hotShape = NullRegion;
- pSprite->confined = FALSE;
- pSprite->confineWin = (pWin == WindowTable[0]) ? NullWindow : pWin;
+ pSprite->confined = FALSE;
+ pSprite->confineWin = (pWin == WindowTable[0]) ? NullWindow : pWin;
- XineramaCheckPhysLimits(pDev, pSprite->current,
- generateEvents);
- }
+ XineramaCheckPhysLimits(pDev, pSprite->current,
+ generateEvents);
}
@@ -835,13 +827,6 @@ ConfineCursorToWindow(DeviceIntPtr pDev, WindowPtr pWin, Bool generateEvents, Bo
ScreenPtr pScreen = pWin->drawable.pScreen;
SpritePtr pSprite = pDev->spriteInfo->sprite;
-#ifdef PANORAMIX
- if(!noPanoramiXExtension) {
- XineramaConfineCursorToWindow(pDev, pWin, generateEvents);
- return;
- }
-#endif
-
if (syncEvents.playingEvents)
{
CheckVirtualMotion(pDev, (QdEventPtr)NULL, pWin);
@@ -849,6 +834,12 @@ ConfineCursorToWindow(DeviceIntPtr pDev, WindowPtr pWin, Bool generateEvents, Bo
}
else
{
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension) {
+ XineramaConfineCursorToWindow(pDev, pWin, generateEvents);
+ return;
+ }
+#endif
pSprite->hotLimits = *REGION_EXTENTS( pScreen, &pWin->borderSize);
pSprite->hotShape = wBoundingShape(pWin) ? &pWin->borderSize
: NullRegion;
commit cdce5699f085e717ee1a2ed8390746dfcb9ddadf
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Fri Jan 30 16:09:23 2009 +1000
dix: Get rid of XineramaCheckVirtualMotion.
Yes, this is an ugly piece mess of #ifdefs, but it beats having two nearly
identical functions.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/dix/events.c b/dix/events.c
index f1fe3f6..62b31c4 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -215,6 +215,7 @@ CallbackListPtr DeviceEventCallback;
Mask DontPropagateMasks[DNPMCOUNT];
static int DontPropagateRefCnts[DNPMCOUNT];
+static void CheckVirtualMotion( DeviceIntPtr pDev, QdEventPtr qe, WindowPtr pWin);
/**
* Main input device struct.
@@ -542,75 +543,6 @@ XineramaSetWindowPntrs(DeviceIntPtr pDev, WindowPtr pWin)
}
static void
-XineramaCheckVirtualMotion(
- DeviceIntPtr pDev,
- QdEventPtr qe,
- WindowPtr pWin)
-{
- SpritePtr pSprite = pDev->spriteInfo->sprite;
-
- if (qe)
- {
- pSprite->hot.pScreen = qe->pScreen; /* should always be Screen 0 */
- pSprite->hot.x = qe->event->u.keyButtonPointer.rootX;
- pSprite->hot.y = qe->event->u.keyButtonPointer.rootY;
- pWin = pDev->deviceGrab.grab ? pDev->deviceGrab.grab->confineTo :
- NullWindow;
- }
- if (pWin)
- {
- int x, y, off_x, off_y, i;
- BoxRec lims;
-
- if(!XineramaSetWindowPntrs(pDev, pWin))
- return;
-
- i = PanoramiXNumScreens - 1;
-
- REGION_COPY(pSprite->screen, &pSprite->Reg2,
- &pSprite->windows[i]->borderSize);
- off_x = panoramiXdataPtr[i].x;
- off_y = panoramiXdataPtr[i].y;
-
- while(i--) {
- x = off_x - panoramiXdataPtr[i].x;
- y = off_y - panoramiXdataPtr[i].y;
-
- if(x || y)
- REGION_TRANSLATE(pSprite->screen, &pSprite->Reg2, x, y);
-
- REGION_UNION(pSprite->screen, &pSprite->Reg2, &pSprite->Reg2,
- &pSprite->windows[i]->borderSize);
-
- off_x = panoramiXdataPtr[i].x;
- off_y = panoramiXdataPtr[i].y;
- }
-
- lims = *REGION_EXTENTS(pSprite->screen, &pSprite->Reg2);
-
- if (pSprite->hot.x < lims.x1)
- pSprite->hot.x = lims.x1;
- else if (pSprite->hot.x >= lims.x2)
- pSprite->hot.x = lims.x2 - 1;
- if (pSprite->hot.y < lims.y1)
- pSprite->hot.y = lims.y1;
- else if (pSprite->hot.y >= lims.y2)
- pSprite->hot.y = lims.y2 - 1;
-
- if (REGION_NUM_RECTS(&pSprite->Reg2) > 1)
- ConfineToShape(pDev, &pSprite->Reg2,
- &pSprite->hot.x, &pSprite->hot.y);
-
- if (qe)
- {
- qe->pScreen = pSprite->hot.pScreen;
- qe->event->u.keyButtonPointer.rootX = pSprite->hot.x;
- qe->event->u.keyButtonPointer.rootY = pSprite->hot.y;
- }
- }
-}
-
-static void
XineramaConfineCursorToWindow(DeviceIntPtr pDev,
WindowPtr pWin,
Bool generateEvents)
@@ -619,7 +551,7 @@ XineramaConfineCursorToWindow(DeviceIntPtr pDev,
if (syncEvents.playingEvents)
{
- XineramaCheckVirtualMotion(pDev, (QdEventPtr)NULL, pWin);
+ CheckVirtualMotion(pDev, (QdEventPtr)NULL, pWin);
SyntheticMotion(pDev, pSprite->hot.x, pSprite->hot.y);
}
else
@@ -808,13 +740,8 @@ CheckVirtualMotion(
WindowPtr pWin)
{
SpritePtr pSprite = pDev->spriteInfo->sprite;
+ RegionPtr reg = NULL;
-#ifdef PANORAMIX
- if(!noPanoramiXExtension) {
- XineramaCheckVirtualMotion(pDev, qe, pWin);
- return;
- }
-#endif
if (qe)
{
pSprite->hot.pScreen = qe->pScreen;
@@ -826,11 +753,43 @@ CheckVirtualMotion(
{
BoxRec lims;
- if (pSprite->hot.pScreen != pWin->drawable.pScreen)
- {
- pSprite->hot.pScreen = pWin->drawable.pScreen;
- pSprite->hot.x = pSprite->hot.y = 0;
- }
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ int x, y, off_x, off_y, i;
+
+ if(!XineramaSetWindowPntrs(pDev, pWin))
+ return;
+
+ i = PanoramiXNumScreens - 1;
+
+ REGION_COPY(pSprite->screen, &pSprite->Reg2,
+ &pSprite->windows[i]->borderSize);
+ off_x = panoramiXdataPtr[i].x;
+ off_y = panoramiXdataPtr[i].y;
+
+ while(i--) {
+ x = off_x - panoramiXdataPtr[i].x;
+ y = off_y - panoramiXdataPtr[i].y;
+
+ if(x || y)
+ REGION_TRANSLATE(pSprite->screen, &pSprite->Reg2, x, y);
+
+ REGION_UNION(pSprite->screen, &pSprite->Reg2, &pSprite->Reg2,
+ &pSprite->windows[i]->borderSize);
+
+ off_x = panoramiXdataPtr[i].x;
+ off_y = panoramiXdataPtr[i].y;
+ }
+ } else
+#endif
+ {
+ if (pSprite->hot.pScreen != pWin->drawable.pScreen)
+ {
+ pSprite->hot.pScreen = pWin->drawable.pScreen;
+ pSprite->hot.x = pSprite->hot.y = 0;
+ }
+ }
+
lims = *REGION_EXTENTS(pWin->drawable.pScreen, &pWin->borderSize);
if (pSprite->hot.x < lims.x1)
pSprite->hot.x = lims.x1;
@@ -840,9 +799,23 @@ CheckVirtualMotion(
pSprite->hot.y = lims.y1;
else if (pSprite->hot.y >= lims.y2)
pSprite->hot.y = lims.y2 - 1;
- if (wBoundingShape(pWin))
- ConfineToShape(pDev, &pWin->borderSize,
- &pSprite->hot.x, &pSprite->hot.y);
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension)
+ {
+ if (REGION_NUM_RECTS(&pSprite->Reg2) > 1)
+ reg = &pSprite->Reg2;
+
+ } else
+#endif
+ {
+ if (wBoundingShape(pWin))
+ reg = &pWin->borderSize;
+ }
+
+ if (reg)
+ ConfineToShape(pDev, reg, &pSprite->hot.x, &pSprite->hot.y);
+
if (qe)
{
qe->pScreen = pSprite->hot.pScreen;
@@ -850,7 +823,10 @@ CheckVirtualMotion(
qe->event->u.keyButtonPointer.rootY = pSprite->hot.y;
}
}
- RootWindow(pDev) = WindowTable[pSprite->hot.pScreen->myNum];
+#ifdef PANORAMIX
+ if (noPanoramiXExtension) /* No typo. Only set the root win if disabled */
+#endif
+ RootWindow(pDev) = WindowTable[pSprite->hot.pScreen->myNum];
}
static void
More information about the xorg-commit
mailing list