Erich Hoover : winex11: Use GetCursorFrameInfo to obtain animated frame delay.
Module: wine Branch: master Commit: 2a026493415771e0560f26cb2e12518ffe1dc876 URL: http://source.winehq.org/git/wine.git/?a=commit;h=2a026493415771e0560f26cb2e... Author: Erich Hoover <ehoover(a)mines.edu> Date: Sat Mar 5 22:42:31 2011 -0700 winex11: Use GetCursorFrameInfo to obtain animated frame delay. --- dlls/winex11.drv/mouse.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index 7778203..a527a2e 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -296,6 +296,7 @@ static XcursorImage *create_xcursor_frame( HDC hdc, const ICONINFOEXW *iinfo, HA int width, int height, int istep ) { XcursorImage *image, *ret = NULL; + DWORD delay_jiffies, is_static; int x, y, i, has_alpha; XcursorPixel *ptr; @@ -310,7 +311,13 @@ static XcursorImage *create_xcursor_frame( HDC hdc, const ICONINFOEXW *iinfo, HA image->xhot = iinfo->xHotspot; image->yhot = iinfo->yHotspot; - image->delay = 100; /* TODO: find a way to get the proper delay */ + + /* TODO: Handle animated cursors that use multiple rates */ + image->delay = 100; /* fallback delay, 100 ms */ + if (GetCursorFrameInfo(icon, 0x0 /* unknown parameter */, 0 /* obtain first rate */, &delay_jiffies, &is_static) != 0) + image->delay = (100 * delay_jiffies) / 6; /* convert jiffies (1/60s) to milliseconds */ + else + WARN("Failed to retrieve animated cursor framerate.\n"); /* draw the cursor frame to a temporary buffer then copy it into the XcursorImage */ memset( color_bits, 0x00, color_size );
participants (1)
-
Alexandre Julliard