Restructure and organize the code.
It was removed and simplified some conditionals. We don't need test for pDev->isMaster inside xf86CursorSetCursor() because only MD enters there. In the last chunk, ScreenPriv fields were being assigned without need, so that code was wrapped inside the conditional to avoid it. I also tried to make the identation more sane in some parts that I touched. Signed-off-by: Tiago Vignatti <vignatti@c3sl.ufpr.br> Minor modification, part of the original patch led to cursors not being updated properly when controlled through XTest. Signed-off-by: Peter Hutterer <peter@cs.unisa.edu.au>
This commit is contained in:
parent
5af90025fe
commit
622d7c1d89
|
@ -299,43 +299,36 @@ xf86CursorSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs,
|
||||||
xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
|
xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
|
||||||
&pScreen->devPrivates, xf86CursorScreenKey);
|
&pScreen->devPrivates, xf86CursorScreenKey);
|
||||||
xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr;
|
xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr;
|
||||||
miPointerScreenPtr PointPriv;
|
miPointerScreenPtr PointPriv = (miPointerScreenPtr)dixLookupPrivate(
|
||||||
|
&pScreen->devPrivates, miPointerScreenKey);
|
||||||
|
|
||||||
|
|
||||||
|
if (pCurs == NullCursor) { /* means we're supposed to remove the cursor */
|
||||||
|
if (ScreenPriv->SWCursor)
|
||||||
|
(*ScreenPriv->spriteFuncs->SetCursor)(pDev, pScreen, NullCursor,
|
||||||
|
x, y);
|
||||||
|
else if (ScreenPriv->isUp) {
|
||||||
|
xf86SetCursor(pScreen, NullCursor, x, y);
|
||||||
|
ScreenPriv->isUp = FALSE;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* only update for VCP, otherwise we get cursor jumps when removing a
|
/* only update for VCP, otherwise we get cursor jumps when removing a
|
||||||
sprite. The second cursor is never HW rendered anyway. */
|
sprite. The second cursor is never HW rendered anyway. */
|
||||||
if (pDev == inputInfo.pointer ||
|
if (pDev == inputInfo.pointer)
|
||||||
(!pDev->isMaster && pDev->u.master == inputInfo.pointer))
|
|
||||||
{
|
{
|
||||||
ScreenPriv->CurrentCursor = pCurs;
|
ScreenPriv->CurrentCursor = pCurs;
|
||||||
ScreenPriv->x = x;
|
ScreenPriv->x = x;
|
||||||
ScreenPriv->y = y;
|
ScreenPriv->y = y;
|
||||||
ScreenPriv->CursorToRestore = NULL;
|
ScreenPriv->CursorToRestore = NULL;
|
||||||
|
ScreenPriv->HotX = pCurs->bits->xhot;
|
||||||
|
ScreenPriv->HotY = pCurs->bits->yhot;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!infoPtr->pScrn->vtSema)
|
if (!infoPtr->pScrn->vtSema)
|
||||||
ScreenPriv->SavedCursor = pCurs;
|
ScreenPriv->SavedCursor = pCurs;
|
||||||
|
|
||||||
if (pCurs == NullCursor) { /* means we're supposed to remove the cursor */
|
|
||||||
if (ScreenPriv->SWCursor)
|
|
||||||
(*ScreenPriv->spriteFuncs->SetCursor)(pDev, pScreen, NullCursor,
|
|
||||||
x, y);
|
|
||||||
else if
|
|
||||||
(ScreenPriv->isUp) {
|
|
||||||
xf86SetCursor(pScreen, NullCursor, x, y);
|
|
||||||
ScreenPriv->isUp = FALSE;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pDev == inputInfo.pointer ||
|
|
||||||
(!pDev->isMaster && pDev->u.master == inputInfo.pointer))
|
|
||||||
{
|
|
||||||
ScreenPriv->HotX = pCurs->bits->xhot;
|
|
||||||
ScreenPriv->HotY = pCurs->bits->yhot;
|
|
||||||
}
|
|
||||||
|
|
||||||
PointPriv = (miPointerScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
|
|
||||||
miPointerScreenKey);
|
|
||||||
if (!(ScreenPriv->SWCursor & XF86_FORCE_SW_CURSOR))
|
if (!(ScreenPriv->SWCursor & XF86_FORCE_SW_CURSOR))
|
||||||
{
|
{
|
||||||
if (infoPtr->pScrn->vtSema && (ScreenPriv->ForceHWCursorCount || ((
|
if (infoPtr->pScrn->vtSema && (ScreenPriv->ForceHWCursorCount || ((
|
||||||
|
@ -346,18 +339,18 @@ xf86CursorSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs,
|
||||||
#endif
|
#endif
|
||||||
(pCurs->bits->height <= infoPtr->MaxHeight) &&
|
(pCurs->bits->height <= infoPtr->MaxHeight) &&
|
||||||
(pCurs->bits->width <= infoPtr->MaxWidth) &&
|
(pCurs->bits->width <= infoPtr->MaxWidth) &&
|
||||||
(!infoPtr->UseHWCursor || (*infoPtr->UseHWCursor)(pScreen, pCurs))))))
|
(!infoPtr->UseHWCursor || (*infoPtr->UseHWCursor)(pScreen, pCurs))))))
|
||||||
{
|
{
|
||||||
|
|
||||||
if (ScreenPriv->SWCursor) /* remove the SW cursor */
|
if (ScreenPriv->SWCursor) /* remove the SW cursor */
|
||||||
(*ScreenPriv->spriteFuncs->SetCursor)(pDev, pScreen, NullCursor, x, y);
|
(*ScreenPriv->spriteFuncs->SetCursor)(pDev, pScreen, NullCursor, x, y);
|
||||||
|
|
||||||
xf86SetCursor(pScreen, pCurs, x, y);
|
xf86SetCursor(pScreen, pCurs, x, y);
|
||||||
ScreenPriv->SWCursor = FALSE;
|
ScreenPriv->SWCursor = FALSE;
|
||||||
ScreenPriv->isUp = TRUE;
|
ScreenPriv->isUp = TRUE;
|
||||||
PointPriv->waitForUpdate = !infoPtr->pScrn->silkenMouse;
|
PointPriv->waitForUpdate = !infoPtr->pScrn->silkenMouse;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user