diff --git a/include/win.h b/include/win.h index 637b90c3559..1198ddb0755 100644 --- a/include/win.h +++ b/include/win.h @@ -226,4 +226,8 @@ extern LRESULT WINAPI EditWndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP extern LRESULT WINAPI ListBoxWndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ); extern LRESULT WINAPI ComboLBWndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ); +/* generic method that returns TRUE if the window properties ask for a + window manager type of border */ +extern BOOL WIN_WindowNeedsWMBorder( DWORD style, DWORD exStyle ); + #endif /* __WINE_WIN_H */ diff --git a/windows/nonclient.c b/windows/nonclient.c index 0ba158fbe3c..8e37d09225c 100644 --- a/windows/nonclient.c +++ b/windows/nonclient.c @@ -74,6 +74,21 @@ static HBITMAP16 hbitmapRestoreD = 0; #define ON_BOTTOM_BORDER(hit) \ (((hit) == HTBOTTOM) || ((hit) == HTBOTTOMLEFT) || ((hit) == HTBOTTOMRIGHT)) +/*********************************************************************** + * WIN_WindowNeedsWMBorder + * + * This method defines the rules for a window to have a WM border, + * caption... It is used for consitency purposes. + */ +BOOL WIN_WindowNeedsWMBorder( DWORD style, DWORD exStyle ) +{ + if (!(style & WS_CHILD) && Options.managed && + (((style & WS_CAPTION) == WS_CAPTION) || + (style & WS_THICKFRAME) || + (exStyle & WS_EX_DLGMODALFRAME))) return TRUE; + return FALSE; +} + /*********************************************************************** * NC_AdjustRect * @@ -88,9 +103,7 @@ static void NC_AdjustRect( LPRECT16 rect, DWORD style, BOOL menu, if(style & WS_ICONIC) return; /* Decide if the window will be managed (see CreateWindowEx) */ - if (!(Options.managed && !(style & WS_CHILD) && - ((style & (WS_DLGFRAME | WS_THICKFRAME)) || - (exStyle & WS_EX_DLGMODALFRAME)))) + if (!WIN_WindowNeedsWMBorder(style, exStyle)) { if (HAS_THICKFRAME( style, exStyle )) InflateRect16( rect, GetSystemMetrics(SM_CXFRAME), GetSystemMetrics(SM_CYFRAME) ); @@ -156,9 +169,7 @@ NC_AdjustRectOuter95 (LPRECT16 rect, DWORD style, BOOL menu, DWORD exStyle) if(style & WS_ICONIC) return; /* Decide if the window will be managed (see CreateWindowEx) */ - if (!(Options.managed && !(style & WS_CHILD) && - ((style & (WS_DLGFRAME | WS_THICKFRAME)) || - (exStyle & WS_EX_DLGMODALFRAME)))) + if (!WIN_WindowNeedsWMBorder(style, exStyle)) { if (HAS_THICKFRAME( style, exStyle )) InflateRect16( rect, GetSystemMetrics(SM_CXFRAME), GetSystemMetrics(SM_CYFRAME) ); diff --git a/windows/x11drv/wnd.c b/windows/x11drv/wnd.c index 96ed420d272..8a43fdf5ad0 100644 --- a/windows/x11drv/wnd.c +++ b/windows/x11drv/wnd.c @@ -188,9 +188,7 @@ BOOL X11DRV_WND_CreateWindow(WND *wndPtr, CLASS *classPtr, CREATESTRUCTA *cs, BO /* Create "managed" windows only if a title bar or resizable */ /* frame is required. */ - if (Options.managed && ( ((cs->style & WS_CAPTION) == WS_CAPTION) || - (cs->style & WS_THICKFRAME) || - (cs->dwExStyle & WS_EX_DLGMODALFRAME))) + if (WIN_WindowNeedsWMBorder(cs->style, cs->dwExStyle)) { win_attr.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask | PointerMotionMask |