Windows with WS_EX_TOOLWINDOW Should Not Have Min/Max Buttons
Robert Shearman
rob at codeweavers.com
Fri Sep 24 10:27:39 CDT 2004
Changelog:
Windows with WS_EX_TOOLWINDOW 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.124
diff -u -p -r1.124 nonclient.c
--- wine/windows/nonclient.c 13 Sep 2004 19:32:59 -0000 1.124
+++ wine/windows/nonclient.c 24 Sep 2004 14:03:16 -0000
@@ -542,6 +542,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))
{
@@ -557,13 +559,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;
@@ -710,7 +712,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 minimize 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)
@@ -735,6 +743,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