[PATCH 09/11] user32: Moved some code into it's own method.

Florian Köberle florian at fkoeberle.de
Tue Jan 20 06:52:41 CST 2009


The same functionaltiy is requried at other places too.
Introducing this method allows code sharing.
---
 dlls/user32/nonclient.c    |   47 +++++++++++++++++++++++++------------------
 dlls/user32/user_private.h |    1 +
 2 files changed, 28 insertions(+), 20 deletions(-)

diff --git a/dlls/user32/nonclient.c b/dlls/user32/nonclient.c
index 708ed80..f2d67e2 100644
--- a/dlls/user32/nonclient.c
+++ b/dlls/user32/nonclient.c
@@ -62,6 +62,32 @@ WINE_DEFAULT_DEBUG_CHANNEL(nonclient);
 #define HAS_MENU(w)  ((((w)->dwStyle & (WS_CHILD | WS_POPUP)) != WS_CHILD) && ((w)->wIDmenu != 0))
 
 
+
+int NC_CalculateBorder(DWORD style, DWORD exStyle)
+{
+    int border;
+    if ((exStyle & (WS_EX_STATICEDGE|WS_EX_DLGMODALFRAME)) ==
+        WS_EX_STATICEDGE)
+    {
+        border = 1; /* for the outer frame always present */
+    }
+    else
+    {
+        border = 0;
+        if ((exStyle & WS_EX_DLGMODALFRAME) ||
+            (style & (WS_THICKFRAME|WS_DLGFRAME))) border = 2; /* outer */
+    }
+    if (style & WS_THICKFRAME)
+        border +=  ( GetSystemMetrics (SM_CXFRAME)
+                   - GetSystemMetrics (SM_CXDLGFRAME)); /* The resize border */
+    if ((style & (WS_BORDER|WS_DLGFRAME)) ||
+        (exStyle & WS_EX_DLGMODALFRAME))
+        border++; /* The other border */
+
+    return border;
+}
+
+
 /******************************************************************************
  * NC_AdjustRectOuter
  *
@@ -84,26 +110,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(nonclient);
 static void
 NC_AdjustRectOuter (LPRECT rect, DWORD style, BOOL menu, DWORD exStyle)
 {
-    int adjust;
-    if(style & WS_ICONIC) return;
-
-    if ((exStyle & (WS_EX_STATICEDGE|WS_EX_DLGMODALFRAME)) ==
-        WS_EX_STATICEDGE)
-    {
-        adjust = 1; /* for the outer frame always present */
-    }
-    else
-    {
-        adjust = 0;
-        if ((exStyle & WS_EX_DLGMODALFRAME) ||
-            (style & (WS_THICKFRAME|WS_DLGFRAME))) adjust = 2; /* outer */
-    }
-    if (style & WS_THICKFRAME)
-        adjust +=  ( GetSystemMetrics (SM_CXFRAME)
-                   - GetSystemMetrics (SM_CXDLGFRAME)); /* The resize border */
-    if ((style & (WS_BORDER|WS_DLGFRAME)) ||
-        (exStyle & WS_EX_DLGMODALFRAME))
-        adjust++; /* The other border */
+    int adjust = NC_CalculateBorder(style,exStyle);
 
     InflateRect (rect, adjust, adjust);
 
diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h
index f1a6585..6b5c930 100644
--- a/dlls/user32/user_private.h
+++ b/dlls/user32/user_private.h
@@ -249,6 +249,7 @@ extern BOOL map_wparam_AtoW( UINT message, WPARAM *wparam, enum wm_char_mapping
 extern LRESULT MSG_SendInternalMessageTimeout( DWORD dest_pid, DWORD dest_tid,
                                                UINT msg, WPARAM wparam, LPARAM lparam,
                                                UINT flags, UINT timeout, PDWORD_PTR res_ptr ) DECLSPEC_HIDDEN;
+extern int NC_CalculateBorder(DWORD style, DWORD exStyle) DECLSPEC_HIDDEN;
 extern HPEN SYSCOLOR_GetPen( INT index ) DECLSPEC_HIDDEN;
 extern void SYSPARAMS_Init(void) DECLSPEC_HIDDEN;
 extern void USER_CheckNotLock(void) DECLSPEC_HIDDEN;
-- 
1.5.4.3




More information about the wine-patches mailing list