[2/3] user32: Implement GetWindowDisplayAffinity.

Andrew Wesie awesie at gmail.com
Fri Jun 23 18:01:53 CDT 2017


Signed-off-by: Andrew Wesie <awesie at gmail.com>
---
 dlls/user32/user32.spec |  2 ++
 dlls/user32/win.c       | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 include/winuser.h       |  6 ++++++
 3 files changed, 56 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..f530158 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -3986,3 +3986,51 @@ BOOL WINAPI RegisterTouchWindow(HWND hwnd, ULONG flags)
     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     return FALSE;
 }
+
+/*****************************************************************************
+ *              GetWindowDisplayAffinity (USER32.@)
+ */
+BOOL WINAPI GetWindowDisplayAffinity(HWND hwnd, DWORD *affinity)
+{
+    BOOL ret;
+
+    SERVER_START_REQ( set_window_info )
+    {
+        req->handle = wine_server_user_handle( hwnd );
+        req->flags  = 0; /* don't set anything, just retrieve */
+        req->extra_offset = -1;
+        if ((ret = !wine_server_call_err( req )))
+        {
+            *affinity = reply->old_affinity;
+        }
+    }
+    SERVER_END_REQ;
+
+    return ret;
+}
+
+/*****************************************************************************
+ *              SetWindowDisplayAffinity (USER32.@)
+ */
+BOOL WINAPI SetWindowDisplayAffinity(HWND hwnd, DWORD affinity)
+{
+    BOOL ret;
+
+    if (affinity & ~WDA_MONITOR)
+    {
+        SetLastError( ERROR_INVALID_PARAMETER );
+        return FALSE;
+    }
+
+    SERVER_START_REQ( set_window_info )
+    {
+        req->handle   = wine_server_user_handle( hwnd );
+        req->flags    = SET_WIN_AFFINITY;
+        req->affinity = affinity;
+        req->extra_offset = -1;
+        ret = !wine_server_call_err( req );
+    }
+    SERVER_END_REQ;
+
+    return ret;
+}
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