Windows with WS_EX_TOOLWINDOW Should Not Have Min/Max Buttons (Resend)
Robert Shearman
rob at codeweavers.com
Sun Oct 17 13:46:31 CDT 2004
Tested with controlspy which allows the styles of a window to be
adjusted. The patch makes sense because there is no way that the min/max
buttons would fit into the half-height title bar.
Changelog:
Windows with WS_EX_TOOLWINDOW style should not have min/max buttons.
-------------- next part --------------
Index: wine/windows/nonclient.c
===================================================================
RCS file: /home/wine/wine/windows/nonclient.c,v
retrieving revision 1.125
diff -u -p -r1.125 nonclient.c
--- wine/windows/nonclient.c 25 Sep 2004 00:29:59 -0000 1.125
+++ wine/windows/nonclient.c 17 Oct 2004 18:45:39 -0000
@@ -549,6 +549,8 @@ static LONG NC_DoNCHitTest (WND *wndPtr,
rect.top += GetSystemMetrics(SM_CYCAPTION) - 1;
if (!PtInRect( &rect, pt ))
{
+ BOOL min_or_max_box = (wndPtr->dwStyle & WS_MAXIMIZEBOX) ||
+ (wndPtr->dwStyle & WS_MINIMIZEBOX);
/* Check system menu */
if ((wndPtr->dwStyle & WS_SYSMENU) && !(wndPtr->dwExStyle & WS_EX_TOOLWINDOW))
{
@@ -564,13 +566,13 @@ static LONG NC_DoNCHitTest (WND *wndPtr,
/* Check maximize box */
/* In win95 there is automatically a Maximize button when there is a minimize one*/
- if ((wndPtr->dwStyle & WS_MAXIMIZEBOX)|| (wndPtr->dwStyle & WS_MINIMIZEBOX))
+ if (min_or_max_box && !(wndPtr->dwExStyle & WS_EX_TOOLWINDOW))
rect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
if (pt.x > rect.right) return HTMAXBUTTON;
/* Check minimize box */
/* In win95 there is automatically a Maximize button when there is a Maximize one*/
- if ((wndPtr->dwStyle & WS_MINIMIZEBOX)||(wndPtr->dwStyle & WS_MAXIMIZEBOX))
+ if (min_or_max_box && !(wndPtr->dwExStyle & WS_EX_TOOLWINDOW))
rect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
if (pt.x > rect.right) return HTMINBUTTON;
@@ -711,7 +713,13 @@ static void NC_DrawCloseButton (HWND hwn
static void NC_DrawMaxButton(HWND hwnd,HDC hdc,BOOL down, BOOL bGrayed)
{
RECT rect;
- UINT flags = IsZoomed(hwnd) ? DFCS_CAPTIONRESTORE : DFCS_CAPTIONMAX;
+ UINT flags;
+
+ /* never draw maximize box when window has WS_EX_TOOLWINDOW style */
+ if (GetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_TOOLWINDOW)
+ return;
+
+ flags = IsZoomed(hwnd) ? DFCS_CAPTIONRESTORE : DFCS_CAPTIONMAX;
NC_GetInsideRect( hwnd, &rect );
if (GetWindowLongA( hwnd, GWL_STYLE) & WS_SYSMENU)
@@ -736,6 +744,10 @@ static void NC_DrawMinButton(HWND hwnd,
RECT rect;
UINT flags = DFCS_CAPTIONMIN;
DWORD style = GetWindowLongA( hwnd, GWL_STYLE );
+
+ /* never draw minimize box when window has WS_EX_TOOLWINDOW style */
+ if (GetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_TOOLWINDOW)
+ return;
NC_GetInsideRect( hwnd, &rect );
if (style & WS_SYSMENU)
More information about the wine-patches
mailing list