user32: Add stubs for GetWindowDisplayAffinity and SetWindowDisplayAffinity.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Michael Müller 2018-03-09 03:01:33 +00:00 committed by Alexandre Julliard
parent afe14ab9b0
commit 76f135e599
6 changed files with 132 additions and 4 deletions

View File

@ -24,7 +24,7 @@
@ stdcall GetPropW(long wstr) user32.GetPropW
@ stdcall GetShellWindow() user32.GetShellWindow
@ stdcall GetWindow(long long) user32.GetWindow
@ stub GetWindowDisplayAffinity
@ stdcall GetWindowDisplayAffinity(long ptr) user32.GetWindowDisplayAffinity
@ stdcall GetWindowInfo(long ptr) user32.GetWindowInfo
@ stdcall GetWindowPlacement(long ptr) user32.GetWindowPlacement
@ stdcall GetWindowRect(long ptr) user32.GetWindowRect
@ -43,7 +43,7 @@
@ stdcall SetLayeredWindowAttributes(ptr long long long) user32.SetLayeredWindowAttributes
@ stdcall SetParent(long long) user32.SetParent
@ stdcall SetPropW(long wstr long) user32.SetPropW
@ stub SetWindowDisplayAffinity
@ stdcall SetWindowDisplayAffinity(long long) user32.SetWindowDisplayAffinity
@ stdcall SetWindowPos(long long long long long long long) user32.SetWindowPos
@ stdcall SetWindowTextW(long wstr) user32.SetWindowTextW
@ stdcall SetWindowsHookExW(long long long long) user32.SetWindowsHookExW

View File

@ -24,7 +24,7 @@
@ stdcall GetPropW(long wstr) user32.GetPropW
@ stdcall GetShellWindow() user32.GetShellWindow
@ stdcall GetWindow(long long) user32.GetWindow
@ stub GetWindowDisplayAffinity
@ stdcall GetWindowDisplayAffinity(long ptr) user32.GetWindowDisplayAffinity
@ stdcall GetWindowInfo(long ptr) user32.GetWindowInfo
@ stdcall GetWindowPlacement(long ptr) user32.GetWindowPlacement
@ stdcall GetWindowRect(long ptr) user32.GetWindowRect
@ -43,7 +43,7 @@
@ stdcall SetLayeredWindowAttributes(ptr long long long) user32.SetLayeredWindowAttributes
@ stdcall SetParent(long long) user32.SetParent
@ stdcall SetPropW(long wstr long) user32.SetPropW
@ stub SetWindowDisplayAffinity
@ stdcall SetWindowDisplayAffinity(long long) user32.SetWindowDisplayAffinity
@ stdcall SetWindowPos(long long long long long long long) user32.SetWindowPos
@ stdcall SetWindowTextW(long wstr) user32.SetWindowTextW
@ stdcall SetWindowsHookExW(long long long long) user32.SetWindowsHookExW

View File

@ -67,6 +67,8 @@ static BOOL (WINAPI *pFlashWindowEx)( PFLASHWINFO pfwi );
static DWORD (WINAPI *pSetLayout)(HDC hdc, DWORD layout);
static DWORD (WINAPI *pGetLayout)(HDC hdc);
static BOOL (WINAPI *pMirrorRgn)(HWND hwnd, HRGN hrgn);
static BOOL (WINAPI *pGetWindowDisplayAffinity)(HWND hwnd, DWORD *affinity);
static BOOL (WINAPI *pSetWindowDisplayAffinity)(HWND hwnd, DWORD affinity);
static BOOL test_lbuttondown_flag;
static DWORD num_gettext_msgs;
@ -10415,6 +10417,88 @@ if (!is_wine) /* FIXME: remove once Wine is fixed */
DestroyWindow(owner);
}
static void test_display_affinity( HWND win )
{
DWORD affinity;
BOOL ret, dwm;
LONG styleex;
if (!pGetWindowDisplayAffinity || !pSetWindowDisplayAffinity)
{
win_skip("GetWindowDisplayAffinity or SetWindowDisplayAffinity missing\n");
return;
}
ret = pGetWindowDisplayAffinity(NULL, NULL);
ok(!ret, "GetWindowDisplayAffinity succeeded\n");
ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "Expected ERROR_INVALID_WINDOW_HANDLE, got %u\n", GetLastError());
ret = pGetWindowDisplayAffinity(NULL, &affinity);
ok(!ret, "GetWindowDisplayAffinity succeeded\n");
ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "Expected ERROR_INVALID_WINDOW_HANDLE, got %u\n", GetLastError());
ret = pGetWindowDisplayAffinity(win, NULL);
ok(!ret, "GetWindowDisplayAffinity succeeded\n");
ok(GetLastError() == ERROR_NOACCESS, "Expected ERROR_NOACCESS, got %u\n", GetLastError());
styleex = GetWindowLongW(win, GWL_EXSTYLE);
SetWindowLongW(win, GWL_EXSTYLE, styleex & ~WS_EX_LAYERED);
affinity = 0xdeadbeef;
ret = pGetWindowDisplayAffinity(win, &affinity);
ok(ret, "GetWindowDisplayAffinity failed with %u\n", GetLastError());
ok(affinity == WDA_NONE, "Expected WDA_NONE, got 0x%x\n", affinity);
/* Windows 7 fails with ERROR_NOT_ENOUGH_MEMORY when dwm compositing is disabled */
ret = pSetWindowDisplayAffinity(win, WDA_MONITOR);
ok(ret || GetLastError() == ERROR_NOT_ENOUGH_MEMORY,
"SetWindowDisplayAffinity failed with %u\n", GetLastError());
dwm = ret;
affinity = 0xdeadbeef;
ret = pGetWindowDisplayAffinity(win, &affinity);
ok(ret, "GetWindowDisplayAffinity failed with %u\n", GetLastError());
if (dwm) ok(affinity == WDA_MONITOR, "Expected WDA_MONITOR, got 0x%x\n", affinity);
else ok(affinity == WDA_NONE, "Expected WDA_NONE, got 0x%x\n", affinity);
ret = pSetWindowDisplayAffinity(win, WDA_NONE);
ok(ret || GetLastError() == ERROR_NOT_ENOUGH_MEMORY,
"SetWindowDisplayAffinity failed with %u\n", GetLastError());
affinity = 0xdeadbeef;
ret = pGetWindowDisplayAffinity(win, &affinity);
ok(ret, "GetWindowDisplayAffinity failed with %u\n", GetLastError());
ok(affinity == WDA_NONE, "Expected WDA_NONE, got 0x%x\n", affinity);
SetWindowLongW(win, GWL_EXSTYLE, styleex | WS_EX_LAYERED);
affinity = 0xdeadbeef;
ret = pGetWindowDisplayAffinity(win, &affinity);
ok(ret, "GetWindowDisplayAffinity failed with %u\n", GetLastError());
ok(affinity == WDA_NONE, "Expected WDA_NONE, got 0x%x\n", affinity);
ret = pSetWindowDisplayAffinity(win, WDA_MONITOR);
ok(ret || GetLastError() == ERROR_NOT_ENOUGH_MEMORY,
"SetWindowDisplayAffinity failed with %u\n", GetLastError());
affinity = 0xdeadbeef;
ret = pGetWindowDisplayAffinity(win, &affinity);
ok(ret, "GetWindowDisplayAffinity failed with %u\n", GetLastError());
if (dwm) ok(affinity == WDA_MONITOR, "Expected WDA_MONITOR, got 0x%x\n", affinity);
else ok(affinity == WDA_NONE, "Expected WDA_NONE, got 0x%x\n", affinity);
ret = pSetWindowDisplayAffinity(win, WDA_NONE);
ok(ret || GetLastError() == ERROR_NOT_ENOUGH_MEMORY,
"SetWindowDisplayAffinity failed with %u\n", GetLastError());
affinity = 0xdeadbeef;
ret = pGetWindowDisplayAffinity(win, &affinity);
ok(ret, "GetWindowDisplayAffinity failed with %u\n", GetLastError());
ok(affinity == WDA_NONE, "Expected WDA_NONE, got 0x%x\n", affinity);
SetWindowLongW(win, GWL_EXSTYLE, styleex);
}
START_TEST(win)
{
char **argv;
@ -10439,6 +10523,8 @@ START_TEST(win)
pGetLayout = (void *)GetProcAddress( gdi32, "GetLayout" );
pSetLayout = (void *)GetProcAddress( gdi32, "SetLayout" );
pMirrorRgn = (void *)GetProcAddress( gdi32, "MirrorRgn" );
pGetWindowDisplayAffinity = (void *)GetProcAddress( user32, "GetWindowDisplayAffinity" );
pSetWindowDisplayAffinity = (void *)GetProcAddress( user32, "SetWindowDisplayAffinity" );
if (argc==4 && !strcmp(argv[2], "create_children"))
{
@ -10563,6 +10649,7 @@ START_TEST(win)
test_deferwindowpos();
test_LockWindowUpdate(hwndMain);
test_desktop();
test_display_affinity(hwndMain);
test_hide_window();
test_minimize_window(hwndMain);

View File

@ -388,6 +388,7 @@
@ stdcall GetWindow(long long)
@ stdcall GetWindowContextHelpId(long)
@ stdcall GetWindowDC(long)
@ stdcall GetWindowDisplayAffinity(long ptr)
@ stdcall GetWindowInfo(long ptr)
@ stdcall GetWindowLongA(long long)
@ stdcall -arch=win64 GetWindowLongPtrA(long long)
@ -691,6 +692,7 @@
@ stdcall SetUserObjectSecurity(long ptr ptr)
@ stdcall SetWinEventHook(long long long ptr long long long)
@ stdcall SetWindowContextHelpId(long long)
@ stdcall SetWindowDisplayAffinity(long long)
@ stub SetWindowFullScreenState
@ stdcall SetWindowLongA(long long long)
@ stdcall -arch=win64 SetWindowLongPtrA(long long long)

View File

@ -4029,3 +4029,37 @@ BOOL WINAPI GetGestureInfo(HGESTUREINFO handle, PGESTUREINFO ptr)
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/*****************************************************************************
* GetWindowDisplayAffinity (USER32.@)
*/
BOOL WINAPI GetWindowDisplayAffinity(HWND hwnd, DWORD *affinity)
{
FIXME("(%p, %p): stub\n", hwnd, affinity);
if (!hwnd || !affinity)
{
SetLastError(hwnd ? ERROR_NOACCESS : ERROR_INVALID_WINDOW_HANDLE);
return FALSE;
}
*affinity = WDA_NONE;
return TRUE;
}
/*****************************************************************************
* SetWindowDisplayAffinity (USER32.@)
*/
BOOL WINAPI SetWindowDisplayAffinity(HWND hwnd, DWORD affinity)
{
FIXME("(%p, %u): stub\n", hwnd, affinity);
if (!hwnd)
{
SetLastError(ERROR_INVALID_WINDOW_HANDLE);
return FALSE;
}
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}

View File

@ -2533,6 +2533,9 @@ typedef struct tagMINIMIZEDMETRICS {
int iArrange;
} MINIMIZEDMETRICS, *PMINIMIZEDMETRICS, *LPMINIMIZEDMETRICS;
/* Window affinity */
#define WDA_NONE 0x0
#define WDA_MONITOR 0x1
/* Window scrolling */
#define SW_SCROLLCHILDREN 0x0001
@ -3771,6 +3774,7 @@ WINUSERAPI BOOL WINAPI GetUserObjectSecurity(HANDLE,PSECURITY_INFORMATION
WINUSERAPI HWND WINAPI GetWindow(HWND,UINT);
WINUSERAPI DWORD WINAPI GetWindowContextHelpId(HWND);
WINUSERAPI HDC WINAPI GetWindowDC(HWND);
WINUSERAPI BOOL WINAPI GetWindowDisplayAffinity(HWND,DWORD*);
WINUSERAPI BOOL WINAPI GetWindowInfo(HWND, PWINDOWINFO);
WINUSERAPI LONG WINAPI GetWindowLongA(HWND,INT);
WINUSERAPI LONG WINAPI GetWindowLongW(HWND,INT);
@ -4073,6 +4077,7 @@ WINUSERAPI BOOL WINAPI SetUserObjectInformationW(HANDLE,INT,LPVOID,DWORD)
#define SetUserObjectInformation WINELIB_NAME_AW(SetUserObjectInformation)
WINUSERAPI BOOL WINAPI SetUserObjectSecurity(HANDLE,PSECURITY_INFORMATION,PSECURITY_DESCRIPTOR);
WINUSERAPI BOOL WINAPI SetWindowContextHelpId(HWND,DWORD);
WINUSERAPI BOOL WINAPI SetWindowDisplayAffinity(HWND,DWORD);
WINUSERAPI LONG WINAPI SetWindowLongA(HWND,INT,LONG);
WINUSERAPI LONG WINAPI SetWindowLongW(HWND,INT,LONG);
#define SetWindowLong WINELIB_NAME_AW(SetWindowLong)