[v3 1/2] user32: Implement GetWindowDisplayAffinity.

Andrew Wesie awesie at gmail.com
Mon Jun 26 15:23:24 CDT 2017


Signed-off-by: Andrew Wesie <awesie at gmail.com>
---
 dlls/user32/user32.spec |  2 ++
 dlls/user32/win.c       | 67 +++++++++++++++++++++++++++++++++++++++++++++++++
 dlls/user32/win.h       |  1 +
 include/winuser.h       |  6 +++++
 4 files changed, 76 insertions(+)

diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec
index 4514877..65e6296 100644
--- a/dlls/user32/user32.spec
+++ b/dlls/user32/user32.spec
@@ -385,6 +385,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)
@@ -688,6 +689,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)
diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index cbf2237..d63d0f1 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -3986,3 +3986,70 @@ BOOL WINAPI RegisterTouchWindow(HWND hwnd, ULONG flags)
     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     return FALSE;
 }
+
+/*****************************************************************************
+ *              GetWindowDisplayAffinity (USER32.@)
+ */
+BOOL WINAPI GetWindowDisplayAffinity(HWND hwnd, DWORD *affinity)
+{
+    WND * wndPtr;
+
+    if (!(wndPtr = WIN_GetPtr(hwnd)) || wndPtr == WND_DESKTOP)
+    {
+        SetLastError( ERROR_INVALID_PARAMETER );
+        return FALSE;
+    }
+
+    if (wndPtr == WND_OTHER_PROCESS)
+    {
+        FIXME( "(%p %p): stub\n", hwnd, affinity );
+        SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
+        return FALSE;
+    }
+
+    *affinity = wndPtr->affinity;
+    WIN_ReleasePtr(wndPtr);
+    return TRUE;
+}
+
+/*****************************************************************************
+ *              SetWindowDisplayAffinity (USER32.@)
+ */
+BOOL WINAPI SetWindowDisplayAffinity(HWND hwnd, DWORD affinity)
+{
+    BOOL ret;
+    WND * wndPtr;
+
+    if (!(wndPtr = WIN_GetPtr(hwnd)))
+    {
+        SetLastError( ERROR_INVALID_PARAMETER );
+        return FALSE;
+    }
+
+    if (wndPtr == WND_DESKTOP)
+    {
+        SetLastError( ERROR_ACCESS_DENIED );
+        return FALSE;
+    }
+
+    if (wndPtr == WND_OTHER_PROCESS)
+    {
+        FIXME( "(%p %08x): stub\n", hwnd, affinity );
+        SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
+        return FALSE;
+    }
+
+    if (affinity & ~WDA_MONITOR)
+    {
+        SetLastError( ERROR_INVALID_PARAMETER );
+        ret = FALSE;
+    }
+    else
+    {
+        wndPtr->affinity = affinity;
+        ret = TRUE;
+    }
+
+    WIN_ReleasePtr(wndPtr);
+    return ret;
+}
diff --git a/dlls/user32/win.h b/dlls/user32/win.h
index f728d19..8a95b4e 100644
--- a/dlls/user32/win.h
+++ b/dlls/user32/win.h
@@ -57,6 +57,7 @@ typedef struct tagWND
     UINT_PTR       wIDmenu;       /* ID or hmenu (from CreateWindow) */
     DWORD          helpContext;   /* Help context ID */
     UINT           flags;         /* Misc. flags (see below) */
+    DWORD          affinity;      /* Window display affinity */
     HMENU          hSysMenu;      /* window's copy of System Menu */
     HICON          hIcon;         /* window's icon */
     HICON          hIconSmall;    /* window's small icon */
diff --git a/include/winuser.h b/include/winuser.h
index 0d6c5d6..d5c8af5 100644
--- a/include/winuser.h
+++ b/include/winuser.h
@@ -3304,6 +3304,10 @@ typedef enum ORIENTATION_PREFERENCE {
     ORIENTATION_PREFERENCE_PORTRAIT_FLIPPED  = 0x8
 } ORIENTATION_PREFERENCE;
 
+/* GetWindowDisplayAffinity flags */
+#define WDA_NONE    0x00000000
+#define WDA_MONITOR 0x00000001
+
 #if defined(_WINGDI_) && !defined(NOGDI)
 WINUSERAPI LONG        WINAPI ChangeDisplaySettingsA(LPDEVMODEA,DWORD);
 WINUSERAPI LONG        WINAPI ChangeDisplaySettingsW(LPDEVMODEW,DWORD);
@@ -3728,6 +3732,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);
@@ -4022,6 +4027,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)
-- 
2.7.4




More information about the wine-patches mailing list