Commit 0885c7cc authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Move NtUserGetCursorFrameInfo implementation from user32.

parent 745b6a30
......@@ -1835,59 +1835,10 @@ HICON WINAPI LoadIconA(HINSTANCE hInstance, LPCSTR name)
* Success: Handle to a frame of the cursor (specified by istep)
* Failure: NULL cursor (0)
*/
HCURSOR WINAPI GetCursorFrameInfo(HCURSOR hCursor, DWORD reserved, DWORD istep, DWORD *rate_jiffies, DWORD *num_steps)
HCURSOR WINAPI GetCursorFrameInfo( HCURSOR handle, DWORD reserved, DWORD istep,
DWORD *rate_jiffies, DWORD *num_steps )
{
struct cursoricon_object *ptr;
HCURSOR ret = 0;
UINT icon_steps;
if (rate_jiffies == NULL || num_steps == NULL) return 0;
if (!(ptr = get_icon_ptr( hCursor ))) return 0;
TRACE("%p => %d %d %p %p\n", hCursor, reserved, istep, rate_jiffies, num_steps);
if (reserved != 0)
FIXME("Second parameter non-zero (%d), please report this!\n", reserved);
icon_steps = get_icon_steps(ptr);
if (istep < icon_steps || !ptr->is_ani)
{
UINT icon_frames = 1;
if (ptr->is_ani)
icon_frames = ptr->ani.num_frames;
if (ptr->is_ani && icon_frames > 1)
ret = ptr->ani.frames[istep];
else
ret = hCursor;
if (icon_frames == 1)
{
*rate_jiffies = 0;
*num_steps = 1;
}
else if (icon_steps == 1)
{
*num_steps = ~0;
*rate_jiffies = ptr->delay;
}
else if (istep < icon_steps)
{
struct cursoricon_object *frame;
*num_steps = icon_steps;
frame = get_icon_ptr( ptr->ani.frames[istep] );
if (ptr->ani.num_steps == 1)
*num_steps = ~0;
else
*num_steps = ptr->ani.num_steps;
*rate_jiffies = frame->delay;
release_user_handle_ptr( frame );
}
}
release_user_handle_ptr( ptr );
return ret;
return NtUserGetCursorFrameInfo( handle, istep, rate_jiffies, num_steps );
}
/**********************************************************************
......
......@@ -438,3 +438,59 @@ BOOL WINAPI NtUserGetIconSize( HICON handle, UINT step, LONG *width, LONG *heigh
release_user_handle_ptr( obj );
return TRUE;
}
/**********************************************************************
* NtUserGetCursorFrameInfo (win32u.@)
*/
HCURSOR WINAPI NtUserGetCursorFrameInfo( HCURSOR cursor, DWORD istep, DWORD *rate_jiffies,
DWORD *num_steps )
{
struct cursoricon_object *obj;
HCURSOR ret = 0;
UINT icon_steps;
if (!rate_jiffies || !num_steps) return 0;
if (!(obj = get_icon_ptr( cursor ))) return 0;
TRACE( "%p => %d %p %p\n", cursor, istep, rate_jiffies, num_steps );
icon_steps = obj->is_ani ? obj->ani.num_steps : 1;
if (istep < icon_steps || !obj->is_ani)
{
UINT icon_frames = 1;
if (obj->is_ani)
icon_frames = obj->ani.num_frames;
if (obj->is_ani && icon_frames > 1)
ret = obj->ani.frames[istep];
else
ret = cursor;
if (icon_frames == 1)
{
*rate_jiffies = 0;
*num_steps = 1;
}
else if (icon_steps == 1)
{
*num_steps = ~0;
*rate_jiffies = obj->delay;
}
else if (istep < icon_steps)
{
struct cursoricon_object *frame;
*num_steps = icon_steps;
frame = get_icon_ptr( obj->ani.frames[istep] );
if (obj->ani.num_steps == 1)
*num_steps = ~0;
else
*num_steps = obj->ani.num_steps;
*rate_jiffies = frame->delay;
release_user_handle_ptr( frame );
}
}
release_user_handle_ptr( obj );
return ret;
}
......@@ -114,6 +114,7 @@ static void * const syscalls[] =
NtUserGetClipboardSequenceNumber,
NtUserGetClipboardViewer,
NtUserGetCursor,
NtUserGetCursorFrameInfo,
NtUserGetDoubleClickTime,
NtUserGetDpiForMonitor,
NtUserGetForegroundWindow,
......
......@@ -184,6 +184,8 @@ static void test_cursoricon(void)
{
BYTE bmp_bits[1024];
LONG width, height;
DWORD rate, steps;
HCURSOR frame;
HANDLE handle;
unsigned int i;
BOOL ret;
......@@ -204,6 +206,12 @@ static void test_cursoricon(void)
ok( width == 16, "width = %ld\n", width );
ok( height == 32, "height = %ld\n", height );
frame = NtUserGetCursorFrameInfo( handle, 0, &rate, &steps );
ok( frame != NULL, "NtUserGetCursorFrameInfo failed: %lu\n", GetLastError() );
ok( frame == handle, "frame != handle\n" );
ok( rate == 0, "rate = %lu\n", rate );
ok( steps == 1, "steps = %lu\n", steps );
ret = NtUserDestroyCursor( handle, 0 );
ok( ret, "NtUserDestroyIcon failed: %lu\n", GetLastError() );
......
......@@ -913,7 +913,7 @@
@ stub NtUserGetCurrentDpiInfoForWindow
@ stub NtUserGetCurrentInputMessageSource
@ stdcall -syscall NtUserGetCursor()
@ stub NtUserGetCursorFrameInfo
@ stdcall -syscall NtUserGetCursorFrameInfo(long long ptr ptr)
@ stub NtUserGetCursorInfo
@ stub NtUserGetDC
@ stub NtUserGetDCEx
......
......@@ -101,6 +101,7 @@
SYSCALL_ENTRY( NtUserGetClipboardSequenceNumber ) \
SYSCALL_ENTRY( NtUserGetClipboardViewer ) \
SYSCALL_ENTRY( NtUserGetCursor ) \
SYSCALL_ENTRY( NtUserGetCursorFrameInfo ) \
SYSCALL_ENTRY( NtUserGetDoubleClickTime ) \
SYSCALL_ENTRY( NtUserGetDpiForMonitor ) \
SYSCALL_ENTRY( NtUserGetForegroundWindow ) \
......
......@@ -289,6 +289,16 @@ NTSTATUS WINAPI wow64_NtUserGetIconSize( UINT *args )
return NtUserGetIconSize( handle, step, width, height );
}
NTSTATUS WINAPI wow64_NtUserGetCursorFrameInfo( UINT *args )
{
HCURSOR cursor = get_ptr( &args );
DWORD istep = get_ulong( &args );
DWORD *rate_jiffies = get_ptr( &args );
DWORD *num_steps = get_ptr( &args );
return HandleToUlong( NtUserGetCursorFrameInfo( cursor, istep, rate_jiffies, num_steps ));
}
NTSTATUS WINAPI wow64_NtUserAttachThreadInput( UINT *args )
{
DWORD from = get_ulong( &args );
......
......@@ -199,6 +199,8 @@ HWND WINAPI NtUserGetClipboardOwner(void);
DWORD WINAPI NtUserGetClipboardSequenceNumber(void);
HWND WINAPI NtUserGetClipboardViewer(void);
HCURSOR WINAPI NtUserGetCursor(void);
HCURSOR WINAPI NtUserGetCursorFrameInfo( HCURSOR hCursor, DWORD istep, DWORD *rate_jiffies,
DWORD *num_steps );
LONG WINAPI NtUserGetDisplayConfigBufferSizes( UINT32 flags, UINT32 *num_path_info,
UINT32 *num_mode_info );
UINT WINAPI NtUserGetDoubleClickTime(void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment