[PATCH 1/2] render/input: set anicursor hooks to control rendering

Tiago Vignatti tiago.vignatti at nokia.com
Tue Aug 25 07:03:15 PDT 2009


Introduces AnimCursorStart and AnimCursorStop to put animated cursors out of
the rendering. This is useful on invisible cursor environments like
touchscreen user interfaces.

Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
---
 render/animcur.c    |   43 +++++++++++++++++++++++++++++++++++++++++++
 render/picturestr.h |    6 ++++++
 2 files changed, 49 insertions(+), 0 deletions(-)

diff --git a/render/animcur.c b/render/animcur.c
index e7bc4e5..2590f73 100644
--- a/render/animcur.c
+++ b/render/animcur.c
@@ -439,3 +439,46 @@ AnimCursorCreate (CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *pp
     *ppCursor = pCursor;
     return Success;
 }
+
+void
+AnimCursorStop(ScreenPtr pScreen)
+{
+    AnimCurScreenPtr    as = GetAnimCurScreen(pScreen);
+
+    Unwrap(as, pScreen, CloseScreen);
+    Unwrap(as, pScreen, BlockHandler);
+    Unwrap(as, pScreen, CursorLimits);
+    Unwrap(as, pScreen, DisplayCursor);
+    Unwrap(as, pScreen, SetCursorPosition);
+    Unwrap(as, pScreen, RealizeCursor);
+    Unwrap(as, pScreen, UnrealizeCursor);
+    Unwrap(as, pScreen, RecolorCursor);
+    SetAnimCurScreen(pScreen,0);
+    xfree(as);
+}
+
+void
+AnimCursorStart(ScreenPtr pScreen)
+{
+    AnimCurScreenPtr    as;
+
+    as = (AnimCurScreenPtr) xalloc (sizeof (AnimCurScreenRec));
+    if (!as)
+        FatalError("AnimCursor: failed to allocate memory\n");
+
+    /* AnimCursorStart can be stacked without problems. For this we do a
+     * comparision on BlockHandler function, guaranteeing that such function
+     * will not point to ifself. Address function comparision is not the best
+     * way, but eh... */
+    if (pScreen->BlockHandler != AnimCurScreenBlockHandler) {
+        Wrap(as, pScreen, CloseScreen, AnimCurCloseScreen);
+        Wrap(as, pScreen, BlockHandler, AnimCurScreenBlockHandler);
+        Wrap(as, pScreen, CursorLimits, AnimCurCursorLimits);
+        Wrap(as, pScreen, DisplayCursor, AnimCurDisplayCursor);
+        Wrap(as, pScreen, SetCursorPosition, AnimCurSetCursorPosition);
+        Wrap(as, pScreen, RealizeCursor, AnimCurRealizeCursor);
+        Wrap(as, pScreen, UnrealizeCursor, AnimCurUnrealizeCursor);
+        Wrap(as, pScreen, RecolorCursor, AnimCurRecolorCursor);
+        SetAnimCurScreen(pScreen,as);
+    }
+}
diff --git a/render/picturestr.h b/render/picturestr.h
index 6a1cc06..01d4100 100644
--- a/render/picturestr.h
+++ b/render/picturestr.h
@@ -623,6 +623,12 @@ extern _X_EXPORT void RenderExtensionInit (void);
 extern _X_EXPORT Bool
 AnimCurInit (ScreenPtr pScreen);
 
+extern _X_EXPORT void
+AnimCursorStart (ScreenPtr pScreen);
+
+extern _X_EXPORT void
+AnimCursorStop (ScreenPtr pScreen);
+
 extern _X_EXPORT int
 AnimCursorCreate (CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *ppCursor, ClientPtr client, XID cid);
 
-- 
1.5.6.3



More information about the xorg-devel mailing list