mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-14 18:37:17 +00:00
wineandroid: Set the window cursor immediately in SetCursor.
This commit is contained in:
parent
4b968267c1
commit
b17b77c707
|
@ -1448,42 +1448,33 @@ static BOOL get_icon_info( HICON handle, ICONINFOEXW *ret )
|
||||||
*/
|
*/
|
||||||
void ANDROID_SetCursor( HWND hwnd, HCURSOR handle )
|
void ANDROID_SetCursor( HWND hwnd, HCURSOR handle )
|
||||||
{
|
{
|
||||||
static HCURSOR last_cursor;
|
if (handle)
|
||||||
static DWORD last_cursor_change;
|
|
||||||
|
|
||||||
if (InterlockedExchangePointer( (void **)&last_cursor, handle ) != handle ||
|
|
||||||
NtGetTickCount() - last_cursor_change > 100)
|
|
||||||
{
|
{
|
||||||
last_cursor_change = NtGetTickCount();
|
unsigned int width = 0, height = 0, *bits = NULL;
|
||||||
|
ICONINFOEXW info;
|
||||||
|
int id;
|
||||||
|
|
||||||
if (handle)
|
if (!get_icon_info( handle, &info )) return;
|
||||||
|
|
||||||
|
if (!(id = get_cursor_system_id( &info )))
|
||||||
{
|
{
|
||||||
unsigned int width = 0, height = 0, *bits = NULL;
|
HDC hdc = NtGdiCreateCompatibleDC( 0 );
|
||||||
ICONINFOEXW info;
|
bits = get_bitmap_argb( hdc, info.hbmColor, info.hbmMask, &width, &height );
|
||||||
int id;
|
NtGdiDeleteObjectApp( hdc );
|
||||||
|
|
||||||
if (!get_icon_info( handle, &info )) return;
|
/* make sure hotspot is valid */
|
||||||
|
if (info.xHotspot >= width || info.yHotspot >= height)
|
||||||
if (!(id = get_cursor_system_id( &info )))
|
|
||||||
{
|
{
|
||||||
HDC hdc = NtGdiCreateCompatibleDC( 0 );
|
info.xHotspot = width / 2;
|
||||||
bits = get_bitmap_argb( hdc, info.hbmColor, info.hbmMask, &width, &height );
|
info.yHotspot = height / 2;
|
||||||
NtGdiDeleteObjectApp( hdc );
|
|
||||||
|
|
||||||
/* make sure hotspot is valid */
|
|
||||||
if (info.xHotspot >= width || info.yHotspot >= height)
|
|
||||||
{
|
|
||||||
info.xHotspot = width / 2;
|
|
||||||
info.yHotspot = height / 2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ioctl_set_cursor( id, width, height, info.xHotspot, info.yHotspot, bits );
|
|
||||||
free( bits );
|
|
||||||
NtGdiDeleteObjectApp( info.hbmColor );
|
|
||||||
NtGdiDeleteObjectApp( info.hbmMask );
|
|
||||||
}
|
}
|
||||||
else ioctl_set_cursor( 0, 0, 0, 0, 0, NULL );
|
ioctl_set_cursor( id, width, height, info.xHotspot, info.yHotspot, bits );
|
||||||
|
free( bits );
|
||||||
|
NtGdiDeleteObjectApp( info.hbmColor );
|
||||||
|
NtGdiDeleteObjectApp( info.hbmMask );
|
||||||
}
|
}
|
||||||
|
else ioctl_set_cursor( 0, 0, 0, 0, 0, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue