[PATCH] Support for animated cursors

Juan Lang juan.lang at gmail.com
Tue Aug 28 16:47:15 CDT 2007


> Ok, attached, and fixed an issue with setting delay on the last frame.

+static ANIHEADER *anih;
+static LPBYTE *ani_frames;
+static DWORD ani_frame_idx;
+
+static void decodeRIFF(LPBYTE bytes, DWORD size)
+{
+    CK *chunk = (CK*)bytes;
+    CKSIZE sizeWithPad = chunk->ckSize % 2 ? chunk->ckSize + 1 : chunk->ckSize;
+    switch(chunk->ckID)
+    {
+    case 0x46464952:  /* RIFF */
+        decodeRIFF(chunk->ckData + 4, chunk->ckSize - 4);

Like Henri already said, you really can't use globals for anih,
ani_frames, and ani_frame_idx.  These should be in a structure, and
decodeRIFF should write into that structure, not into globals.  The
structure should then be associated with the icon.

+                    HICON hNextIcon = CreateIconFromResourceEx(
&bits[entry->dwDIBOffset], entry->dwDIBSize, TRUE, 0x00030000, 0, 0, 0
);

This may be obvious to other, but certainly not to me:  what does
0x00030000 mean?  You need to use symbolic constants here.

+        /*if (CURSORICONINFO_NEXT(info) && !animate_timer_started) {
+            animate_timer_started = TRUE;
+            SetTimer(NULL, 0, 55, animate_cursor);
+        }*/

Please don't include dead code.
--Juan



More information about the wine-devel mailing list