[PATCH 1/2] Add API to update setting of waitForUpdate screen private in miPointer

Peter Hutterer peter.hutterer at who-t.net
Thu Jul 1 17:53:48 PDT 2010


On Thu, Jun 03, 2010 at 07:00:53PM -0700, Alan Coopersmith wrote:
> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
> ---
>  hw/xfree86/ramdac/xf86Cursor.c |   12 ++++--------
>  mi/mipointer.c                 |   16 ++++++++++++++++
>  mi/mipointer.h                 |    5 +++++
>  3 files changed, 25 insertions(+), 8 deletions(-)
> 
> diff --git a/hw/xfree86/ramdac/xf86Cursor.c b/hw/xfree86/ramdac/xf86Cursor.c
> index 2bbcb9c..aaaad79 100644
> --- a/hw/xfree86/ramdac/xf86Cursor.c
> +++ b/hw/xfree86/ramdac/xf86Cursor.c
> @@ -243,8 +243,6 @@ xf86CursorSwitchMode(int index, DisplayModePtr mode, int flags)
>      ScreenPtr pScreen = screenInfo.screens[index];
>      xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
>  	&pScreen->devPrivates, xf86CursorScreenKey);
> -    miPointerScreenPtr PointPriv = (miPointerScreenPtr)dixLookupPrivate(
> -	&pScreen->devPrivates, miPointerScreenKey);
>  
>      if (ScreenPriv->isUp) {
>  	xf86SetCursor(pScreen, NullCursor, ScreenPriv->x, ScreenPriv->y);
> @@ -259,7 +257,7 @@ xf86CursorSwitchMode(int index, DisplayModePtr mode, int flags)
>       * ensure the cursor is repainted by miPointerWarpCursor().
>       */
>      ScreenPriv->CursorToRestore = ScreenPriv->CurrentCursor;
> -    PointPriv->waitForUpdate = FALSE;	/* Force cursor repaint */
> +    miPointerSetWaitForUpdate(pScreen, FALSE);	/* Force cursor repaint */
>  
>      return ret;
>  }
> @@ -300,9 +298,6 @@ xf86CursorSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs,
>      xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
>  	&pScreen->devPrivates, xf86CursorScreenKey);
>      xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr;
> -    miPointerScreenPtr PointPriv = (miPointerScreenPtr)dixLookupPrivate(
> -    &pScreen->devPrivates, miPointerScreenKey);
> -
>  
>      if (pCurs == NullCursor) {	/* means we're supposed to remove the cursor */
>          if (ScreenPriv->SWCursor ||
> @@ -353,11 +348,12 @@ xf86CursorSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs,
>  	    xf86SetCursor(pScreen, pCurs, x, y);
>  	    ScreenPriv->SWCursor = FALSE;
>  	    ScreenPriv->isUp = TRUE;
> -	    PointPriv->waitForUpdate = !infoPtr->pScrn->silkenMouse;
> +
> +	    miPointerSetWaitForUpdate(pScreen, !infoPtr->pScrn->silkenMouse);
>  	    return;
>  	}
>  
> -        PointPriv->waitForUpdate = TRUE;
> +        miPointerSetWaitForUpdate(pScreen, TRUE);
>  
>          if (ScreenPriv->isUp) {
>              /* Remove the HW cursor, or make it transparent */
> diff --git a/mi/mipointer.c b/mi/mipointer.c
> index 296c57f..e5f810e 100644
> --- a/mi/mipointer.c
> +++ b/mi/mipointer.c
> @@ -448,6 +448,22 @@ miPointerGetScreen(DeviceIntPtr pDev)
>      return (pPointer) ? pPointer->pScreen : NULL;
>  }
>  
> +/* Controls whether the cursor image should be updated immediately when
> +   moved (FALSE) or if something else will be responsible for updating
> +   it later (TRUE).  Returns current setting.
> +   Caller is responsible for calling OsBlockSignal first.
> +*/
> +Bool
> +miPointerSetWaitForUpdate(ScreenPtr pScreen, Bool wait)
> +{
> +    SetupScreen(pScreen);
> +    Bool prevWait = pScreenPriv->waitForUpdate;
> +
> +    pScreenPriv->waitForUpdate = wait;
> +    return prevWait;
> +}
> +
> +
>  /* Move the pointer on the current screen,  and update the sprite. */
>  static void
>  miPointerMoved (DeviceIntPtr pDev, ScreenPtr pScreen,
> diff --git a/mi/mipointer.h b/mi/mipointer.h
> index 22575ea..76f2ef0 100644
> --- a/mi/mipointer.h
> +++ b/mi/mipointer.h
> @@ -139,6 +139,11 @@ extern _X_EXPORT void miPointerSetPosition(
>  extern _X_EXPORT void miPointerUpdateSprite(
>      DeviceIntPtr pDev);
>  
> +/* Sets whether the sprite should be updated immediately on pointer moves */
> +extern _X_EXPORT Bool miPointerSetWaitForUpdate(
> +    ScreenPtr pScreen,
> +    Bool wait);
> +
>  extern _X_EXPORT DevPrivateKey miPointerScreenKey;
>  
>  #endif /* MIPOINTER_H */
> -- 
> 1.5.6.5

Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
for both. I've pulled them in, will send them to keith.

Cheers,
  Peter


More information about the xorg-devel mailing list