Piotr Caban : user32: Add helper for setting WS_EX_WINDOWEDGE flag.

Alexandre Julliard julliard at winehq.org
Thu Oct 7 16:21:21 CDT 2021


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

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Thu Oct  7 16:33:55 2021 +0200

user32: Add helper for setting WS_EX_WINDOWEDGE flag.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/win.c | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index d261968d742..a1464f01345 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -1461,6 +1461,20 @@ static void map_dpi_create_struct( CREATESTRUCTW *cs, UINT dpi_from, UINT dpi_to
     cs->cy = MulDiv( cs->cy, dpi_to, dpi_from );
 }
 
+/***********************************************************************
+ *           fix_exstyle
+ */
+static DWORD fix_exstyle( DWORD style, DWORD exstyle )
+{
+    if ((exstyle & WS_EX_DLGMODALFRAME) ||
+            (!(exstyle & WS_EX_STATICEDGE) &&
+             (style & (WS_DLGFRAME | WS_THICKFRAME))))
+        exstyle |= WS_EX_WINDOWEDGE;
+    else
+        exstyle &= ~WS_EX_WINDOWEDGE;
+    return exstyle;
+}
+
 /***********************************************************************
  *           WIN_CreateWindowEx
  *
@@ -1596,13 +1610,7 @@ HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module,
     }
 
     WIN_FixCoordinates(cs, &sw); /* fix default coordinates */
-
-    if ((cs->dwExStyle & WS_EX_DLGMODALFRAME) ||
-        ((!(cs->dwExStyle & WS_EX_STATICEDGE)) &&
-          (cs->style & (WS_DLGFRAME | WS_THICKFRAME))))
-        cs->dwExStyle |= WS_EX_WINDOWEDGE;
-    else
-        cs->dwExStyle &= ~WS_EX_WINDOWEDGE;
+    cs->dwExStyle = fix_exstyle(cs->style, cs->dwExStyle);
 
     /* Create the window structure */
 
@@ -2622,13 +2630,7 @@ LONG_PTR WIN_SetWindowLong( HWND hwnd, INT offset, UINT size, LONG_PTR newval, B
         if (!(wndPtr = WIN_GetPtr( hwnd )) || wndPtr == WND_OTHER_PROCESS) return 0;
         /* WS_EX_TOPMOST can only be changed through SetWindowPos */
         newval = (style.styleNew & ~WS_EX_TOPMOST) | (wndPtr->dwExStyle & WS_EX_TOPMOST);
-        /* WS_EX_WINDOWEDGE depends on some other styles */
-        if (newval & WS_EX_DLGMODALFRAME)
-            newval |= WS_EX_WINDOWEDGE;
-        else if (!(newval & WS_EX_STATICEDGE) && (wndPtr->dwStyle & (WS_DLGFRAME | WS_THICKFRAME)))
-            newval |= WS_EX_WINDOWEDGE;
-        else
-            newval &= ~WS_EX_WINDOWEDGE;
+        newval = fix_exstyle(wndPtr->dwStyle, newval);
         break;
     case GWLP_HWNDPARENT:
         if (wndPtr->parent == GetDesktopWindow())




More information about the wine-cvs mailing list