win32u: Move NtUserShowCursor implementation from user32.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-12-03 12:55:30 +01:00 committed by Alexandre Julliard
parent 7b42697124
commit c87925bae3
9 changed files with 79 additions and 29 deletions

View File

@ -1933,33 +1933,6 @@ HCURSOR WINAPI DECLSPEC_HOTPATCH SetCursor( HCURSOR hCursor /* [in] Handle of cu
return hOldCursor; return hOldCursor;
} }
/***********************************************************************
* ShowCursor (USER32.@)
*/
INT WINAPI DECLSPEC_HOTPATCH ShowCursor( BOOL bShow )
{
HCURSOR cursor;
int increment = bShow ? 1 : -1;
int count;
SERVER_START_REQ( set_cursor )
{
req->flags = SET_CURSOR_COUNT;
req->show_count = increment;
wine_server_call( req );
cursor = wine_server_ptr_handle( reply->prev_handle );
count = reply->prev_count + increment;
}
SERVER_END_REQ;
TRACE("%d, count=%d\n", bShow, count );
if (bShow && !count) USER_Driver->pSetCursor( cursor );
else if (!bShow && count == -1) USER_Driver->pSetCursor( 0 );
return count;
}
/*********************************************************************** /***********************************************************************
* GetCursor (USER32.@) * GetCursor (USER32.@)
*/ */

View File

@ -736,7 +736,7 @@
@ stdcall SetWindowsHookExW(long long long long) @ stdcall SetWindowsHookExW(long long long long)
@ stdcall SetWindowsHookW(long ptr) @ stdcall SetWindowsHookW(long ptr)
@ stdcall ShowCaret(long) @ stdcall ShowCaret(long)
@ stdcall ShowCursor(long) @ stdcall -import ShowCursor(long) NtUserShowCursor
@ stdcall ShowOwnedPopups(long long) @ stdcall ShowOwnedPopups(long long)
@ stdcall ShowScrollBar(long long long) @ stdcall ShowScrollBar(long long long)
@ stub ShowStartGlass @ stub ShowStartGlass

View File

@ -13,6 +13,7 @@ C_SRCS = \
brush.c \ brush.c \
clipboard.c \ clipboard.c \
clipping.c \ clipping.c \
cursoricon.c \
dc.c \ dc.c \
dib.c \ dib.c \
dibdrv/bitblt.c \ dibdrv/bitblt.c \

63
dlls/win32u/cursoricon.c Normal file
View File

@ -0,0 +1,63 @@
/*
* Cursor and icon support
*
* Copyright 1995 Alexandre Julliard
* Copyright 1996 Martin Von Loewis
* Copyright 1997 Alex Korobka
* Copyright 1998 Turchanov Sergey
* Copyright 2007 Henri Verbeet
* Copyright 2009 Vincent Povirk for CodeWeavers
* Copyright 2016 Dmitry Timoshkov
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#if 0
#pragma makedep unix
#endif
#include "win32u_private.h"
#include "wine/server.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(cursor);
/***********************************************************************
* NtUserShowCursor (win32u.@)
*/
INT WINAPI NtUserShowCursor( BOOL show )
{
HCURSOR cursor;
int increment = show ? 1 : -1;
int count;
SERVER_START_REQ( set_cursor )
{
req->flags = SET_CURSOR_COUNT;
req->show_count = increment;
wine_server_call( req );
cursor = wine_server_ptr_handle( reply->prev_handle );
count = reply->prev_count + increment;
}
SERVER_END_REQ;
TRACE("%d, count=%d\n", show, count );
if (show && !count) user_driver->pSetCursor( cursor );
else if (!show && count == -1) user_driver->pSetCursor( 0 );
return count;
}

View File

@ -1032,6 +1032,11 @@ static BOOL CDECL loaderdrv_EnumDisplaySettingsEx( LPCWSTR name, DWORD num, LPDE
return load_driver()->pEnumDisplaySettingsEx( name, num, mode, flags ); return load_driver()->pEnumDisplaySettingsEx( name, num, mode, flags );
} }
static void CDECL loaderdrv_SetCursor( HCURSOR cursor )
{
load_driver()->pSetCursor( cursor );
}
static void CDECL loaderdrv_UpdateClipboard(void) static void CDECL loaderdrv_UpdateClipboard(void)
{ {
load_driver()->pUpdateClipboard(); load_driver()->pUpdateClipboard();
@ -1055,6 +1060,7 @@ static const struct user_driver_funcs lazy_load_driver =
.pChangeDisplaySettingsEx = loaderdrv_ChangeDisplaySettingsEx, .pChangeDisplaySettingsEx = loaderdrv_ChangeDisplaySettingsEx,
.pEnumDisplaySettingsEx = loaderdrv_EnumDisplaySettingsEx, .pEnumDisplaySettingsEx = loaderdrv_EnumDisplaySettingsEx,
.pUpdateDisplayDevices = loaderdrv_UpdateDisplayDevices, .pUpdateDisplayDevices = loaderdrv_UpdateDisplayDevices,
.pSetCursor = loaderdrv_SetCursor,
.pUpdateClipboard = loaderdrv_UpdateClipboard, .pUpdateClipboard = loaderdrv_UpdateClipboard,
.pScrollDC = nulldrv_ScrollDC, .pScrollDC = nulldrv_ScrollDC,
}; };

View File

@ -1182,6 +1182,7 @@ static struct unix_funcs unix_funcs =
NtUserIsClipboardFormatAvailable, NtUserIsClipboardFormatAvailable,
NtUserMapVirtualKeyEx, NtUserMapVirtualKeyEx,
NtUserScrollDC, NtUserScrollDC,
NtUserShowCursor,
NtUserToUnicodeEx, NtUserToUnicodeEx,
NtUserUnregisterHotKey, NtUserUnregisterHotKey,
NtUserVkKeyScanEx, NtUserVkKeyScanEx,

View File

@ -1258,7 +1258,7 @@
@ stub NtUserSetWindowsHookAW @ stub NtUserSetWindowsHookAW
@ stub NtUserSetWindowsHookEx @ stub NtUserSetWindowsHookEx
@ stub NtUserShowCaret @ stub NtUserShowCaret
@ stub NtUserShowCursor @ stdcall NtUserShowCursor(long)
@ stub NtUserShowScrollBar @ stub NtUserShowScrollBar
@ stub NtUserShowSystemCursor @ stub NtUserShowSystemCursor
@ stub NtUserShowWindow @ stub NtUserShowWindow

View File

@ -214,6 +214,7 @@ struct unix_funcs
UINT (WINAPI *pNtUserMapVirtualKeyEx)( UINT code, UINT type, HKL layout ); UINT (WINAPI *pNtUserMapVirtualKeyEx)( UINT code, UINT type, HKL layout );
BOOL (WINAPI *pNtUserScrollDC)( HDC hdc, INT dx, INT dy, const RECT *scroll, const RECT *clip, BOOL (WINAPI *pNtUserScrollDC)( HDC hdc, INT dx, INT dy, const RECT *scroll, const RECT *clip,
HRGN ret_update_rgn, RECT *update_rect ); HRGN ret_update_rgn, RECT *update_rect );
INT (WINAPI *pNtUserShowCursor)( BOOL show );
INT (WINAPI *pNtUserToUnicodeEx)( UINT virt, UINT scan, const BYTE *state, INT (WINAPI *pNtUserToUnicodeEx)( UINT virt, UINT scan, const BYTE *state,
WCHAR *str, int size, UINT flags, HKL layout ); WCHAR *str, int size, UINT flags, HKL layout );
BOOL (WINAPI *pNtUserUnregisterHotKey)( HWND hwnd, INT id ); BOOL (WINAPI *pNtUserUnregisterHotKey)( HWND hwnd, INT id );

View File

@ -676,6 +676,11 @@ BOOL WINAPI NtUserScrollDC( HDC hdc, INT dx, INT dy, const RECT *scroll, const R
return unix_funcs->pNtUserScrollDC( hdc, dx, dy, scroll, clip, ret_update_rgn, update_rect ); return unix_funcs->pNtUserScrollDC( hdc, dx, dy, scroll, clip, ret_update_rgn, update_rect );
} }
INT WINAPI NtUserShowCursor( BOOL show )
{
return unix_funcs->pNtUserShowCursor( show );
}
INT WINAPI NtUserToUnicodeEx( UINT virt, UINT scan, const BYTE *state, INT WINAPI NtUserToUnicodeEx( UINT virt, UINT scan, const BYTE *state,
WCHAR *str, int size, UINT flags, HKL layout ) WCHAR *str, int size, UINT flags, HKL layout )
{ {