Commit fa3bd8f4 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Move NtUserGetForegroundWindow implementation from user32.

parent e557f48c
......@@ -161,7 +161,7 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus )
if (IsWindow(hwnd))
{
SendMessageW( hwnd, WM_NCACTIVATE, (hwnd == GetForegroundWindow()), (LPARAM)previous );
SendMessageW( hwnd, WM_NCACTIVATE, hwnd == NtUserGetForegroundWindow(), (LPARAM)previous );
SendMessageW( hwnd, WM_ACTIVATE,
MAKEWPARAM( mouse ? WA_CLICKACTIVE : WA_ACTIVE, IsIconic(hwnd) ),
(LPARAM)previous );
......@@ -371,23 +371,6 @@ HWND WINAPI GetFocus(void)
}
/*******************************************************************
* GetForegroundWindow (USER32.@)
*/
HWND WINAPI GetForegroundWindow(void)
{
HWND ret = 0;
SERVER_START_REQ( get_thread_input )
{
req->tid = 0;
if (!wine_server_call_err( req )) ret = wine_server_ptr_handle( reply->foreground );
}
SERVER_END_REQ;
return ret;
}
/***********************************************************************
* SetShellWindowEx (USER32.@)
* hwndShell = Progman[Program Manager]
......
......@@ -1876,7 +1876,7 @@ static LRESULT handle_internal_message( HWND hwnd, UINT msg, WPARAM wparam, LPAR
if (is_desktop_window( hwnd )) return 0;
return WIN_SetStyle(hwnd, wparam, lparam);
case WM_WINE_SETACTIVEWINDOW:
if (!wparam && GetForegroundWindow() == hwnd) return 0;
if (!wparam && NtUserGetForegroundWindow() == hwnd) return 0;
return (LRESULT)SetActiveWindow( (HWND)wparam );
case WM_WINE_KEYBOARD_LL_HOOK:
case WM_WINE_MOUSE_LL_HOOK:
......
......@@ -302,7 +302,7 @@
@ stdcall GetDpiForSystem()
@ stdcall GetDpiForWindow(long)
@ stdcall GetFocus()
@ stdcall GetForegroundWindow()
@ stdcall GetForegroundWindow() NtUserGetForegroundWindow
@ stdcall GetGestureConfig(long long long ptr ptr long)
@ stdcall GetGestureInfo(long ptr)
@ stdcall GetGUIThreadInfo(long ptr)
......
......@@ -97,7 +97,7 @@ static HPALETTE WINAPI UserSelectPalette( HDC hDC, HPALETTE hPal, BOOL bForceBac
HWND hwnd = WindowFromDC( hDC );
if (hwnd)
{
HWND hForeground = GetForegroundWindow();
HWND hForeground = NtUserGetForegroundWindow();
/* set primary palette if it's related to current active */
if (hForeground == hwnd || IsChild(hForeground,hwnd))
{
......
......@@ -3843,7 +3843,7 @@ BOOL WINAPI FlashWindowEx( PFLASHWINFO pfinfo )
hwnd = wndPtr->obj.handle; /* make it a full handle */
if (pfinfo->dwFlags) wparam = !(wndPtr->flags & WIN_NCACTIVATED);
else wparam = (hwnd == GetForegroundWindow());
else wparam = (hwnd == NtUserGetForegroundWindow());
WIN_ReleasePtr( wndPtr );
SendMessageW( hwnd, WM_NCACTIVATE, wparam, 0 );
......
......@@ -1640,7 +1640,7 @@ void WINPOS_ActivateOtherWindow(HWND hwnd)
}
done:
fg = GetForegroundWindow();
fg = NtUserGetForegroundWindow();
TRACE("win = %p fg = %p\n", hwndTo, fg);
if (!fg || (hwnd == fg))
{
......
......@@ -1004,3 +1004,19 @@ int WINAPI NtUserGetMouseMovePointsEx( UINT size, MOUSEMOVEPOINT *ptin, MOUSEMOV
return copied;
}
/*******************************************************************
* NtUserGetForegroundWindow (win32u.@)
*/
HWND WINAPI NtUserGetForegroundWindow(void)
{
HWND ret = 0;
SERVER_START_REQ( get_thread_input )
{
req->tid = 0;
if (!wine_server_call_err( req )) ret = wine_server_ptr_handle( reply->foreground );
}
SERVER_END_REQ;
return ret;
}
......@@ -115,6 +115,7 @@ static void * const syscalls[] =
NtUserGetCursor,
NtUserGetDoubleClickTime,
NtUserGetDpiForMonitor,
NtUserGetForegroundWindow,
NtUserGetKeyState,
NtUserGetKeyboardLayout,
NtUserGetKeyboardLayoutName,
......
......@@ -926,7 +926,7 @@
@ stub NtUserGetDpiForCurrentProcess
@ stdcall -syscall NtUserGetDpiForMonitor(long long ptr ptr)
@ stub NtUserGetExtendedPointerDeviceProperty
@ stub NtUserGetForegroundWindow
@ stdcall -syscall NtUserGetForegroundWindow()
@ stub NtUserGetGUIThreadInfo
@ stub NtUserGetGestureConfig
@ stub NtUserGetGestureExtArgs
......
......@@ -102,6 +102,7 @@
SYSCALL_ENTRY( NtUserGetCursor ) \
SYSCALL_ENTRY( NtUserGetDoubleClickTime ) \
SYSCALL_ENTRY( NtUserGetDpiForMonitor ) \
SYSCALL_ENTRY( NtUserGetForegroundWindow ) \
SYSCALL_ENTRY( NtUserGetKeyState ) \
SYSCALL_ENTRY( NtUserGetKeyboardLayout ) \
SYSCALL_ENTRY( NtUserGetKeyboardLayoutName ) \
......
......@@ -415,3 +415,8 @@ NTSTATUS WINAPI wow64_NtUserUnhookWindowsHookEx( UINT *args )
return NtUserUnhookWindowsHookEx( handle );
}
NTSTATUS WINAPI wow64_NtUserGetForegroundWindow( UINT *args )
{
return HandleToUlong( NtUserGetForegroundWindow() );
}
......@@ -156,6 +156,7 @@ LONG WINAPI NtUserGetDisplayConfigBufferSizes( UINT32 flags, UINT32 *num_path
UINT32 *num_mode_info );
UINT WINAPI NtUserGetDoubleClickTime(void);
BOOL WINAPI NtUserGetDpiForMonitor( HMONITOR monitor, UINT type, UINT *x, UINT *y );
HWND WINAPI NtUserGetForegroundWindow(void);
INT WINAPI NtUserGetKeyNameText( LONG lparam, WCHAR *buffer, INT size );
SHORT WINAPI NtUserGetKeyState( INT vkey );
HKL WINAPI NtUserGetKeyboardLayout( DWORD thread_id );
......
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