win32u: Move NtUserFlashWindowEx 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 2022-03-09 15:19:47 +01:00 committed by Alexandre Julliard
parent e3b1d818af
commit 516249001f
13 changed files with 96 additions and 72 deletions

View File

@ -156,10 +156,6 @@ static void CDECL nulldrv_DestroyWindow( HWND hwnd )
{ {
} }
static void CDECL nulldrv_FlashWindowEx( FLASHWINFO *info )
{
}
static void CDECL nulldrv_GetDC( HDC hdc, HWND hwnd, HWND top_win, const RECT *win_rect, static void CDECL nulldrv_GetDC( HDC hdc, HWND hwnd, HWND top_win, const RECT *win_rect,
const RECT *top_rect, DWORD flags ) const RECT *top_rect, DWORD flags )
{ {
@ -267,11 +263,6 @@ static BOOL CDECL loaderdrv_CreateWindow( HWND hwnd )
return load_driver()->pCreateWindow( hwnd ); return load_driver()->pCreateWindow( hwnd );
} }
static void CDECL loaderdrv_FlashWindowEx( FLASHWINFO *info )
{
load_driver()->pFlashWindowEx( info );
}
static void CDECL loaderdrv_GetDC( HDC hdc, HWND hwnd, HWND top_win, const RECT *win_rect, static void CDECL loaderdrv_GetDC( HDC hdc, HWND hwnd, HWND top_win, const RECT *win_rect,
const RECT *top_rect, DWORD flags ) const RECT *top_rect, DWORD flags )
{ {
@ -323,7 +314,7 @@ static struct user_driver_funcs lazy_load_driver =
loaderdrv_CreateDesktopWindow, loaderdrv_CreateDesktopWindow,
loaderdrv_CreateWindow, loaderdrv_CreateWindow,
nulldrv_DestroyWindow, nulldrv_DestroyWindow,
loaderdrv_FlashWindowEx, NULL,
loaderdrv_GetDC, loaderdrv_GetDC,
nulldrv_MsgWaitForMultipleObjectsEx, nulldrv_MsgWaitForMultipleObjectsEx,
nulldrv_ReleaseDC, nulldrv_ReleaseDC,
@ -373,7 +364,6 @@ void CDECL __wine_set_user_driver( const struct user_driver_funcs *funcs, UINT v
SET_USER_FUNC(CreateDesktopWindow); SET_USER_FUNC(CreateDesktopWindow);
SET_USER_FUNC(CreateWindow); SET_USER_FUNC(CreateWindow);
SET_USER_FUNC(DestroyWindow); SET_USER_FUNC(DestroyWindow);
SET_USER_FUNC(FlashWindowEx);
SET_USER_FUNC(GetDC); SET_USER_FUNC(GetDC);
SET_USER_FUNC(MsgWaitForMultipleObjectsEx); SET_USER_FUNC(MsgWaitForMultipleObjectsEx);
SET_USER_FUNC(ReleaseDC); SET_USER_FUNC(ReleaseDC);

View File

@ -245,7 +245,7 @@
@ stdcall FindWindowExW(long long wstr wstr) @ stdcall FindWindowExW(long long wstr wstr)
@ stdcall FindWindowW(wstr wstr) @ stdcall FindWindowW(wstr wstr)
@ stdcall FlashWindow(long long) @ stdcall FlashWindow(long long)
@ stdcall FlashWindowEx(ptr) @ stdcall FlashWindowEx(ptr) NtUserFlashWindowEx
@ stdcall FrameRect(long ptr long) @ stdcall FrameRect(long ptr long)
@ stdcall FreeDDElParam(long long) @ stdcall FreeDDElParam(long long)
@ stdcall GetActiveWindow() @ stdcall GetActiveWindow()

View File

@ -140,6 +140,7 @@ static const struct user_callbacks user_funcs =
GetWindowRect, GetWindowRect,
RedrawWindow, RedrawWindow,
SendMessageTimeoutW, SendMessageTimeoutW,
SendMessageW,
WindowFromDC, WindowFromDC,
free_dce, free_dce,
MSG_SendInternalMessageTimeout, MSG_SendInternalMessageTimeout,

View File

@ -3230,67 +3230,9 @@ BOOL WINAPI FlashWindow( HWND hWnd, BOOL bInvert )
finfo.uCount = 1; finfo.uCount = 1;
finfo.dwTimeout = 0; finfo.dwTimeout = 0;
finfo.hwnd = hWnd; finfo.hwnd = hWnd;
return FlashWindowEx( &finfo ); return NtUserFlashWindowEx( &finfo );
} }
/*******************************************************************
* FlashWindowEx (USER32.@)
*/
BOOL WINAPI FlashWindowEx( PFLASHWINFO pfinfo )
{
WND *wndPtr;
TRACE( "%p\n", pfinfo );
if (!pfinfo)
{
SetLastError( ERROR_NOACCESS );
return FALSE;
}
if (!pfinfo->hwnd || pfinfo->cbSize != sizeof(FLASHWINFO) || !IsWindow( pfinfo->hwnd ))
{
SetLastError( ERROR_INVALID_PARAMETER );
return FALSE;
}
FIXME( "%p - semi-stub\n", pfinfo );
if (IsIconic( pfinfo->hwnd ))
{
RedrawWindow( pfinfo->hwnd, 0, 0, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_FRAME );
wndPtr = WIN_GetPtr( pfinfo->hwnd );
if (!wndPtr || wndPtr == WND_OTHER_PROCESS || wndPtr == WND_DESKTOP) return FALSE;
if (pfinfo->dwFlags && !(wndPtr->flags & WIN_NCACTIVATED))
{
wndPtr->flags |= WIN_NCACTIVATED;
}
else
{
wndPtr->flags &= ~WIN_NCACTIVATED;
}
WIN_ReleasePtr( wndPtr );
USER_Driver->pFlashWindowEx( pfinfo );
return TRUE;
}
else
{
WPARAM wparam;
HWND hwnd = pfinfo->hwnd;
wndPtr = WIN_GetPtr( hwnd );
if (!wndPtr || wndPtr == WND_OTHER_PROCESS || wndPtr == WND_DESKTOP) return FALSE;
hwnd = wndPtr->obj.handle; /* make it a full handle */
if (pfinfo->dwFlags) wparam = !(wndPtr->flags & WIN_NCACTIVATED);
else wparam = (hwnd == NtUserGetForegroundWindow());
WIN_ReleasePtr( wndPtr );
SendMessageW( hwnd, WM_NCACTIVATE, wparam, 0 );
USER_Driver->pFlashWindowEx( pfinfo );
return wparam;
}
}
/******************************************************************* /*******************************************************************
* GetWindowContextHelpId (USER32.@) * GetWindowContextHelpId (USER32.@)

View File

@ -1032,6 +1032,11 @@ static void CDECL loaderdrv_UpdateDisplayDevices( const struct gdi_device_manage
load_driver()->pUpdateDisplayDevices( manager, force, param ); load_driver()->pUpdateDisplayDevices( manager, force, param );
} }
static void CDECL loaderdrv_FlashWindowEx( FLASHWINFO *info )
{
load_driver()->pFlashWindowEx( info );
}
static const struct vulkan_funcs * CDECL loaderdrv_wine_get_vulkan_driver( UINT version ) static const struct vulkan_funcs * CDECL loaderdrv_wine_get_vulkan_driver( UINT version )
{ {
return load_driver()->pwine_get_vulkan_driver( version ); return load_driver()->pwine_get_vulkan_driver( version );
@ -1062,6 +1067,7 @@ static const struct user_driver_funcs lazy_load_driver =
.pEnumDisplaySettingsEx = loaderdrv_EnumDisplaySettingsEx, .pEnumDisplaySettingsEx = loaderdrv_EnumDisplaySettingsEx,
.pUpdateDisplayDevices = loaderdrv_UpdateDisplayDevices, .pUpdateDisplayDevices = loaderdrv_UpdateDisplayDevices,
/* windowing functions */ /* windowing functions */
.pFlashWindowEx = loaderdrv_FlashWindowEx,
.pMsgWaitForMultipleObjectsEx = nulldrv_MsgWaitForMultipleObjectsEx, .pMsgWaitForMultipleObjectsEx = nulldrv_MsgWaitForMultipleObjectsEx,
.pScrollDC = nulldrv_ScrollDC, .pScrollDC = nulldrv_ScrollDC,
.pWindowMessage = nulldrv_WindowMessage, .pWindowMessage = nulldrv_WindowMessage,

View File

@ -1164,6 +1164,7 @@ static struct unix_funcs unix_funcs =
NtUserEnumDisplayDevices, NtUserEnumDisplayDevices,
NtUserEnumDisplayMonitors, NtUserEnumDisplayMonitors,
NtUserEnumDisplaySettings, NtUserEnumDisplaySettings,
NtUserFlashWindowEx,
NtUserGetAsyncKeyState, NtUserGetAsyncKeyState,
NtUserGetClassInfoEx, NtUserGetClassInfoEx,
NtUserGetCursorInfo, NtUserGetCursorInfo,

View File

@ -101,3 +101,11 @@ BOOL WINAPI NtUserGetGUIThreadInfo( DWORD id, GUITHREADINFO *info )
SERVER_END_REQ; SERVER_END_REQ;
return ret; return ret;
} }
/* see SendMessageW */
LRESULT send_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
{
/* FIXME: move implementation from user32 */
if (!user_callbacks) return 0;
return user_callbacks->pSendMessageW( hwnd, msg, wparam, lparam );
}

View File

@ -34,6 +34,7 @@ struct user_callbacks
BOOL (WINAPI *pGetWindowRect)( HWND hwnd, LPRECT rect ); BOOL (WINAPI *pGetWindowRect)( HWND hwnd, LPRECT rect );
BOOL (WINAPI *pRedrawWindow)( HWND, const RECT*, HRGN, UINT ); BOOL (WINAPI *pRedrawWindow)( HWND, const RECT*, HRGN, UINT );
LRESULT (WINAPI *pSendMessageTimeoutW)( HWND, UINT, WPARAM, LPARAM, UINT, UINT, PDWORD_PTR ); LRESULT (WINAPI *pSendMessageTimeoutW)( HWND, UINT, WPARAM, LPARAM, UINT, UINT, PDWORD_PTR );
LRESULT (WINAPI *pSendMessageW)( HWND, UINT, WPARAM, LPARAM );
HWND (WINAPI *pWindowFromDC)( HDC ); HWND (WINAPI *pWindowFromDC)( HDC );
void (WINAPI *free_dce)( struct dce *dce, HWND hwnd ); void (WINAPI *free_dce)( struct dce *dce, HWND hwnd );
LRESULT (WINAPI *send_ll_message)( DWORD, DWORD, UINT, WPARAM, LPARAM, UINT, UINT, PDWORD_PTR ); LRESULT (WINAPI *send_ll_message)( DWORD, DWORD, UINT, WPARAM, LPARAM, UINT, UINT, PDWORD_PTR );

View File

@ -883,7 +883,7 @@
@ stub NtUserFillWindow @ stub NtUserFillWindow
@ stdcall -syscall NtUserFindExistingCursorIcon(ptr ptr ptr) @ stdcall -syscall NtUserFindExistingCursorIcon(ptr ptr ptr)
@ stub NtUserFindWindowEx @ stub NtUserFindWindowEx
@ stub NtUserFlashWindowEx @ stdcall NtUserFlashWindowEx(ptr)
@ stub NtUserForceWindowToDpiForTest @ stub NtUserForceWindowToDpiForTest
@ stub NtUserFrostCrashedWindow @ stub NtUserFrostCrashedWindow
@ stub NtUserFunctionalizeDisplayConfig @ stub NtUserFunctionalizeDisplayConfig

View File

@ -202,6 +202,7 @@ struct unix_funcs
BOOL (WINAPI *pNtUserEnumDisplayMonitors)( HDC hdc, RECT *rect, MONITORENUMPROC proc, LPARAM lp ); BOOL (WINAPI *pNtUserEnumDisplayMonitors)( HDC hdc, RECT *rect, MONITORENUMPROC proc, LPARAM lp );
BOOL (WINAPI *pNtUserEnumDisplaySettings)( UNICODE_STRING *device, DWORD mode, BOOL (WINAPI *pNtUserEnumDisplaySettings)( UNICODE_STRING *device, DWORD mode,
DEVMODEW *dev_mode, DWORD flags ); DEVMODEW *dev_mode, DWORD flags );
BOOL (WINAPI *pNtUserFlashWindowEx)( FLASHWINFO *info );
SHORT (WINAPI *pNtUserGetAsyncKeyState)( INT key ); SHORT (WINAPI *pNtUserGetAsyncKeyState)( INT key );
ATOM (WINAPI *pNtUserGetClassInfoEx)( HINSTANCE instance, UNICODE_STRING *name, WNDCLASSEXW *wc, ATOM (WINAPI *pNtUserGetClassInfoEx)( HINSTANCE instance, UNICODE_STRING *name, WNDCLASSEXW *wc,
struct client_menu_name *menu_name, BOOL ansi ); struct client_menu_name *menu_name, BOOL ansi );
@ -277,6 +278,9 @@ extern LONG global_key_state_counter DECLSPEC_HIDDEN;
extern BOOL get_cursor_pos( POINT *pt ) DECLSPEC_HIDDEN; extern BOOL get_cursor_pos( POINT *pt ) DECLSPEC_HIDDEN;
extern DWORD get_input_state(void) DECLSPEC_HIDDEN; extern DWORD get_input_state(void) DECLSPEC_HIDDEN;
/* message.c */
extern LRESULT send_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) DECLSPEC_HIDDEN;
/* sysparams.c */ /* sysparams.c */
extern RECT get_display_rect( const WCHAR *display ) DECLSPEC_HIDDEN; extern RECT get_display_rect( const WCHAR *display ) DECLSPEC_HIDDEN;
extern UINT get_monitor_dpi( HMONITOR monitor ) DECLSPEC_HIDDEN; extern UINT get_monitor_dpi( HMONITOR monitor ) DECLSPEC_HIDDEN;

View File

@ -676,6 +676,11 @@ static LONG_PTR get_win_data( const void *ptr, UINT size )
} }
} }
static BOOL is_iconic( HWND hwnd )
{
return (get_window_long( hwnd, GWL_STYLE ) & WS_MINIMIZE) != 0;
}
static LONG_PTR get_window_long_size( HWND hwnd, INT offset, UINT size, BOOL ansi ) static LONG_PTR get_window_long_size( HWND hwnd, INT offset, UINT size, BOOL ansi )
{ {
LONG_PTR retval = 0; LONG_PTR retval = 0;
@ -990,6 +995,65 @@ INT WINAPI NtUserInternalGetWindowText( HWND hwnd, WCHAR *text, INT count )
return lstrlenW(text); return lstrlenW(text);
} }
/*******************************************************************
* NtUserFlashWindowEx (win32u.@)
*/
BOOL WINAPI NtUserFlashWindowEx( FLASHWINFO *info )
{
WND *win;
TRACE( "%p\n", info );
if (!info)
{
SetLastError( ERROR_NOACCESS );
return FALSE;
}
if (!info->hwnd || info->cbSize != sizeof(FLASHWINFO) || !is_window( info->hwnd ))
{
SetLastError( ERROR_INVALID_PARAMETER );
return FALSE;
}
FIXME( "%p - semi-stub\n", info );
if (is_iconic( info->hwnd ))
{
user_callbacks->pRedrawWindow( info->hwnd, 0, 0, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_FRAME );
win = get_win_ptr( info->hwnd );
if (!win || win == WND_OTHER_PROCESS || win == WND_DESKTOP) return FALSE;
if (info->dwFlags && !(win->flags & WIN_NCACTIVATED))
{
win->flags |= WIN_NCACTIVATED;
}
else
{
win->flags &= ~WIN_NCACTIVATED;
}
release_win_ptr( win );
user_driver->pFlashWindowEx( info );
return TRUE;
}
else
{
WPARAM wparam;
HWND hwnd = info->hwnd;
win = get_win_ptr( hwnd );
if (!win || win == WND_OTHER_PROCESS || win == WND_DESKTOP) return FALSE;
hwnd = win->obj.handle; /* make it a full handle */
if (info->dwFlags) wparam = !(win->flags & WIN_NCACTIVATED);
else wparam = (hwnd == NtUserGetForegroundWindow());
release_win_ptr( win );
send_message( hwnd, WM_NCACTIVATE, wparam, 0 );
user_driver->pFlashWindowEx( info );
return wparam;
}
}
/***************************************************************************** /*****************************************************************************
* NtUserCallHwnd (win32u.@) * NtUserCallHwnd (win32u.@)
*/ */

View File

@ -789,6 +789,12 @@ BOOL WINAPI NtUserEnumDisplaySettings( UNICODE_STRING *device, DWORD mode,
return unix_funcs->pNtUserEnumDisplaySettings( device, mode, dev_mode, flags ); return unix_funcs->pNtUserEnumDisplaySettings( device, mode, dev_mode, flags );
} }
BOOL WINAPI NtUserFlashWindowEx( FLASHWINFO *info )
{
if (!unix_funcs) return FALSE;
return unix_funcs->pNtUserFlashWindowEx( info );
}
SHORT WINAPI NtUserGetAsyncKeyState( INT key ) SHORT WINAPI NtUserGetAsyncKeyState( INT key )
{ {
if (!unix_funcs) return 0; if (!unix_funcs) return 0;

View File

@ -279,6 +279,7 @@ BOOL WINAPI NtUserEnumDisplaySettings( UNICODE_STRING *device, DWORD mode,
DEVMODEW *dev_mode, DWORD flags ); DEVMODEW *dev_mode, DWORD flags );
HICON WINAPI NtUserFindExistingCursorIcon( UNICODE_STRING *module, UNICODE_STRING *res_name, HICON WINAPI NtUserFindExistingCursorIcon( UNICODE_STRING *module, UNICODE_STRING *res_name,
void *desc ); void *desc );
BOOL WINAPI NtUserFlashWindowEx( FLASHWINFO *info );
HWND WINAPI NtUserGetAncestor( HWND hwnd, UINT type ); HWND WINAPI NtUserGetAncestor( HWND hwnd, UINT type );
SHORT WINAPI NtUserGetAsyncKeyState( INT key ); SHORT WINAPI NtUserGetAsyncKeyState( INT key );
ULONG WINAPI NtUserGetAtomName( ATOM atom, UNICODE_STRING *name ); ULONG WINAPI NtUserGetAtomName( ATOM atom, UNICODE_STRING *name );