Jacek Caban : win32u: Move NtUserSetLayeredWindowAttributes implementation from user32.

Alexandre Julliard julliard at winehq.org
Thu Mar 10 16:10:16 CST 2022


Module: wine
Branch: master
Commit: 7e62ec6143db8ced4cc2f4d38b26103033b3a214
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=7e62ec6143db8ced4cc2f4d38b26103033b3a214

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Mar 10 14:33:11 2022 +0100

win32u: Move NtUserSetLayeredWindowAttributes implementation from user32.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/driver.c         | 12 +-----------
 dlls/user32/user32.spec      |  2 +-
 dlls/user32/win.c            | 29 -----------------------------
 dlls/win32u/driver.c         |  6 ++++++
 dlls/win32u/gdiobj.c         |  1 +
 dlls/win32u/win32u.spec      |  2 +-
 dlls/win32u/win32u_private.h |  1 +
 dlls/win32u/window.c         | 28 ++++++++++++++++++++++++++++
 dlls/win32u/wrappers.c       |  6 ++++++
 include/ntuser.h             |  1 +
 10 files changed, 46 insertions(+), 42 deletions(-)

diff --git a/dlls/user32/driver.c b/dlls/user32/driver.c
index 29e8db73206..e3db8299b48 100644
--- a/dlls/user32/driver.c
+++ b/dlls/user32/driver.c
@@ -108,10 +108,6 @@ static void CDECL nulldrv_SetFocus( HWND hwnd )
 {
 }
 
-static void CDECL nulldrv_SetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alpha, DWORD flags )
-{
-}
-
 static void CDECL nulldrv_SetParent( HWND hwnd, HWND parent, HWND old_parent )
 {
 }
@@ -187,11 +183,6 @@ static void CDECL loaderdrv_GetDC( HDC hdc, HWND hwnd, HWND top_win, const RECT
     load_driver()->pGetDC( hdc, hwnd, top_win, win_rect, top_rect, flags );
 }
 
-static void CDECL loaderdrv_SetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alpha, DWORD flags )
-{
-    load_driver()->pSetLayeredWindowAttributes( hwnd, key, alpha, flags );
-}
-
 static BOOL CDECL loaderdrv_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info,
                                                  const RECT *window_rect )
 {
@@ -234,7 +225,7 @@ static struct user_driver_funcs lazy_load_driver =
     NULL,
     nulldrv_SetCapture,
     nulldrv_SetFocus,
-    loaderdrv_SetLayeredWindowAttributes,
+    NULL,
     nulldrv_SetParent,
     NULL,
     nulldrv_SetWindowIcon,
@@ -281,7 +272,6 @@ void CDECL __wine_set_user_driver( const struct user_driver_funcs *funcs, UINT v
     SET_USER_FUNC(ReleaseDC);
     SET_USER_FUNC(SetCapture);
     SET_USER_FUNC(SetFocus);
-    SET_USER_FUNC(SetLayeredWindowAttributes);
     SET_USER_FUNC(SetParent);
     SET_USER_FUNC(SetWindowIcon);
     SET_USER_FUNC(SetWindowStyle);
diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec
index 00700224f4a..65eb0755f61 100644
--- a/dlls/user32/user32.spec
+++ b/dlls/user32/user32.spec
@@ -675,7 +675,7 @@
 @ stdcall SetInternalWindowPos(long long ptr ptr)
 @ stdcall SetKeyboardState(ptr) NtUserSetKeyboardState
 @ stdcall SetLastErrorEx(long long)
-@ stdcall SetLayeredWindowAttributes(ptr long long long)
+@ stdcall SetLayeredWindowAttributes(ptr long long long) NtUserSetLayeredWindowAttributes
 @ stdcall SetLogonNotifyWindow(long long)
 @ stdcall SetMenu(long long)
 @ stdcall SetMenuContextHelpId(long long)
diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index 885c06c90ca..554d35635c5 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -3251,35 +3251,6 @@ BOOL CDECL __wine_set_pixel_format( HWND hwnd, int format )
 }
 
 
-/*****************************************************************************
- *              SetLayeredWindowAttributes (USER32.@)
- */
-BOOL WINAPI SetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alpha, DWORD flags )
-{
-    BOOL ret;
-
-    TRACE("(%p,%08x,%d,%x)\n", hwnd, key, alpha, flags);
-
-    SERVER_START_REQ( set_window_layered_info )
-    {
-        req->handle = wine_server_user_handle( hwnd );
-        req->color_key = key;
-        req->alpha = alpha;
-        req->flags = flags;
-        ret = !wine_server_call_err( req );
-    }
-    SERVER_END_REQ;
-
-    if (ret)
-    {
-        USER_Driver->pSetLayeredWindowAttributes( hwnd, key, alpha, flags );
-        update_window_state( hwnd );
-    }
-
-    return ret;
-}
-
-
 /*****************************************************************************
  *              UpdateLayeredWindowIndirect  (USER32.@)
  */
diff --git a/dlls/win32u/driver.c b/dlls/win32u/driver.c
index f46436e524a..0e0c21c1eab 100644
--- a/dlls/win32u/driver.c
+++ b/dlls/win32u/driver.c
@@ -1137,6 +1137,11 @@ static void CDECL loaderdrv_FlashWindowEx( FLASHWINFO *info )
     load_driver()->pFlashWindowEx( info );
 }
 
+static void CDECL loaderdrv_SetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alpha, DWORD flags )
+{
+    load_driver()->pSetLayeredWindowAttributes( hwnd, key, alpha, flags );
+}
+
 static void CDECL loaderdrv_SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw )
 {
     load_driver()->pSetWindowRgn( hwnd, hrgn, redraw );
@@ -1174,6 +1179,7 @@ static const struct user_driver_funcs lazy_load_driver =
     /* windowing functions */
     .pCreateDesktopWindow = loaderdrv_CreateDesktopWindow,
     .pFlashWindowEx = loaderdrv_FlashWindowEx,
+    .pSetLayeredWindowAttributes = loaderdrv_SetLayeredWindowAttributes,
     .pSetWindowRgn = loaderdrv_SetWindowRgn,
     .pMsgWaitForMultipleObjectsEx = nulldrv_MsgWaitForMultipleObjectsEx,
     .pScrollDC = nulldrv_ScrollDC,
diff --git a/dlls/win32u/gdiobj.c b/dlls/win32u/gdiobj.c
index e5c320f8bcc..72d11667ce9 100644
--- a/dlls/win32u/gdiobj.c
+++ b/dlls/win32u/gdiobj.c
@@ -1188,6 +1188,7 @@ static struct unix_funcs unix_funcs =
     NtUserSetCursor,
     NtUserSetCursorIconData,
     NtUserSetCursorPos,
+    NtUserSetLayeredWindowAttributes,
     NtUserSetSysColors,
     NtUserSetWindowPos,
     NtUserSetWindowRgn,
diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec
index f011feb3ec7..cc1ee83167a 100644
--- a/dlls/win32u/win32u.spec
+++ b/dlls/win32u/win32u.spec
@@ -1203,7 +1203,7 @@
 @ stub NtUserSetInteractiveCtrlRotationAngle
 @ stub NtUserSetInternalWindowPos
 @ stdcall -syscall NtUserSetKeyboardState(ptr)
-@ stub NtUserSetLayeredWindowAttributes
+@ stdcall NtUserSetLayeredWindowAttributes(ptr long long long)
 @ stub NtUserSetMagnificationDesktopMagnifierOffsetsDWMUpdated
 @ stub NtUserSetManipulationInputTarget
 @ stub NtUserSetMenu
diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h
index f1e59055e02..40ac0d05fef 100644
--- a/dlls/win32u/win32u_private.h
+++ b/dlls/win32u/win32u_private.h
@@ -234,6 +234,7 @@ struct unix_funcs
     BOOL     (WINAPI *pNtUserSetCursorIconData)( HCURSOR cursor, UNICODE_STRING *module,
                                                  UNICODE_STRING *res_name, struct cursoricon_desc *desc );
     BOOL     (WINAPI *pNtUserSetCursorPos)( INT x, INT y );
+    BOOL     (WINAPI *pNtUserSetLayeredWindowAttributes)( HWND hwnd, COLORREF key, BYTE alpha, DWORD flags );
     BOOL     (WINAPI *pNtUserSetSysColors)( INT count, const INT *colors, const COLORREF *values );
     BOOL     (WINAPI *pNtUserSetWindowPos)( HWND hwnd, HWND after, INT x, INT y, INT cx, INT cy, UINT flags );
     int      (WINAPI *pNtUserSetWindowRgn)( HWND hwnd, HRGN hrgn, BOOL redraw );
diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c
index 35953143f37..d21cc0e6887 100644
--- a/dlls/win32u/window.c
+++ b/dlls/win32u/window.c
@@ -1309,6 +1309,34 @@ BOOL WINAPI NtUserGetLayeredWindowAttributes( HWND hwnd, COLORREF *key, BYTE *al
     return ret;
 }
 
+/*****************************************************************************
+ *           NtUserSetLayeredWindowAttributes (win32u.@)
+ */
+BOOL WINAPI NtUserSetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alpha, DWORD flags )
+{
+    BOOL ret;
+
+    TRACE( "(%p,%08x,%d,%x)\n", hwnd, key, alpha, flags );
+
+    SERVER_START_REQ( set_window_layered_info )
+    {
+        req->handle = wine_server_user_handle( hwnd );
+        req->color_key = key;
+        req->alpha = alpha;
+        req->flags = flags;
+        ret = !wine_server_call_err( req );
+    }
+    SERVER_END_REQ;
+
+    if (ret)
+    {
+        user_driver->pSetLayeredWindowAttributes( hwnd, key, alpha, flags );
+        update_window_state( hwnd );
+    }
+
+    return ret;
+}
+
 /***********************************************************************
  *           list_children_from_point
  *
diff --git a/dlls/win32u/wrappers.c b/dlls/win32u/wrappers.c
index b1c86949db2..40b5ea2d4cf 100644
--- a/dlls/win32u/wrappers.c
+++ b/dlls/win32u/wrappers.c
@@ -940,6 +940,12 @@ BOOL WINAPI NtUserSetCursorPos( INT x, INT y )
     return unix_funcs->pNtUserSetCursorPos( x, y );
 }
 
+BOOL WINAPI NtUserSetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alpha, DWORD flags )
+{
+    if (!unix_funcs) return FALSE;
+    return unix_funcs->pNtUserSetLayeredWindowAttributes( hwnd, key, alpha, flags );
+}
+
 BOOL WINAPI NtUserSetSysColors( INT count, const INT *colors, const COLORREF *values )
 {
     if (!unix_funcs) return FALSE;
diff --git a/include/ntuser.h b/include/ntuser.h
index 9a25fe72419..82bf5f89b74 100644
--- a/include/ntuser.h
+++ b/include/ntuser.h
@@ -367,6 +367,7 @@ BOOL    WINAPI NtUserSetCursorIconData( HCURSOR cursor, UNICODE_STRING *module,
                                         struct cursoricon_desc *desc );
 BOOL    WINAPI NtUserSetCursorPos( INT x, INT y );
 BOOL    WINAPI NtUserSetKeyboardState( BYTE *state );
+BOOL    WINAPI NtUserSetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alpha, DWORD flags );
 BOOL    WINAPI NtUserSetProcessDpiAwarenessContext( ULONG awareness, ULONG unknown );
 BOOL    WINAPI NtUserSetProcessWindowStation( HWINSTA handle );
 BOOL    WINAPI NtUserSetProp( HWND hwnd, const WCHAR *str, HANDLE handle );




More information about the wine-cvs mailing list