2 * Non-client area window functions
4 * Copyright 1994 Alexandre Julliard
11 #include "sysmetrics.h"
19 #include "nonclient.h"
21 #include "selectors.h"
23 /* #define DEBUG_NONCLIENT */
27 static HBITMAP hbitmapClose
= 0;
28 static HBITMAP hbitmapMinimize
= 0;
29 static HBITMAP hbitmapMinimizeD
= 0;
30 static HBITMAP hbitmapMaximize
= 0;
31 static HBITMAP hbitmapMaximizeD
= 0;
32 static HBITMAP hbitmapRestore
= 0;
33 static HBITMAP hbitmapRestoreD
= 0;
35 #define SC_ABOUTWINE (SC_SCREENSAVE+1)
37 /* Some useful macros */
38 #define HAS_DLGFRAME(style,exStyle) \
39 (((exStyle) & WS_EX_DLGMODALFRAME) || \
40 (((style) & WS_DLGFRAME) && !((style) & WS_BORDER)))
42 #define HAS_THICKFRAME(style) \
43 (((style) & WS_THICKFRAME) && \
44 !(((style) & (WS_DLGFRAME|WS_BORDER)) == WS_DLGFRAME))
46 #define HAS_MENU(w) (!((w)->dwStyle & WS_CHILD) && ((w)->wIDmenu != 0))
48 #define ON_LEFT_BORDER(hit) \
49 (((hit) == HTLEFT) || ((hit) == HTTOPLEFT) || ((hit) == HTBOTTOMLEFT))
50 #define ON_RIGHT_BORDER(hit) \
51 (((hit) == HTRIGHT) || ((hit) == HTTOPRIGHT) || ((hit) == HTBOTTOMRIGHT))
52 #define ON_TOP_BORDER(hit) \
53 (((hit) == HTTOP) || ((hit) == HTTOPLEFT) || ((hit) == HTTOPRIGHT))
54 #define ON_BOTTOM_BORDER(hit) \
55 (((hit) == HTBOTTOM) || ((hit) == HTBOTTOMLEFT) || ((hit) == HTBOTTOMRIGHT))
57 /***********************************************************************
60 * Compute the size of the window rectangle from the size of the
63 static void NC_AdjustRect( LPRECT rect
, DWORD style
, BOOL menu
, DWORD exStyle
)
65 if (style
& WS_ICONIC
) return; /* Nothing to change for an icon */
66 if (HAS_DLGFRAME( style
, exStyle
))
67 InflateRect( rect
, SYSMETRICS_CXDLGFRAME
, SYSMETRICS_CYDLGFRAME
);
70 if (HAS_THICKFRAME(style
))
71 InflateRect( rect
, SYSMETRICS_CXFRAME
, SYSMETRICS_CYFRAME
);
72 if (style
& WS_BORDER
)
73 InflateRect( rect
, SYSMETRICS_CXBORDER
, SYSMETRICS_CYBORDER
);
76 if ((style
& WS_CAPTION
) == WS_CAPTION
)
77 rect
->top
-= SYSMETRICS_CYCAPTION
- SYSMETRICS_CYBORDER
;
78 if (menu
) rect
->top
-= SYSMETRICS_CYMENU
+ SYSMETRICS_CYBORDER
;
80 if (style
& WS_VSCROLL
) rect
->right
+= SYSMETRICS_CXVSCROLL
;
81 if (style
& WS_HSCROLL
) rect
->bottom
+= SYSMETRICS_CYHSCROLL
;
85 /***********************************************************************
86 * AdjustWindowRect (USER.102)
88 void AdjustWindowRect( LPRECT rect
, DWORD style
, BOOL menu
)
90 AdjustWindowRectEx( rect
, style
, menu
, 0 );
94 /***********************************************************************
95 * AdjustWindowRectEx (USER.454)
97 void AdjustWindowRectEx( LPRECT rect
, DWORD style
, BOOL menu
, DWORD exStyle
)
99 /* Correct the window style */
101 if (!(style
& (WS_POPUP
| WS_CHILD
))) /* Overlapped window */
103 if (exStyle
& WS_EX_DLGMODALFRAME
) style
&= ~WS_THICKFRAME
;
105 dprintf_nonclient(stddeb
, "AdjustWindowRectEx: (%d,%d)-(%d,%d) %08lx %d %08lx\n",
106 rect
->left
, rect
->top
, rect
->right
, rect
->bottom
, style
, menu
, exStyle
);
108 NC_AdjustRect( rect
, style
, menu
, exStyle
);
112 /*******************************************************************
115 * Get the minimized and maximized information for a window.
117 void NC_GetMinMaxInfo( HWND hwnd
, POINT
*maxSize
, POINT
*maxPos
,
118 POINT
*minTrack
, POINT
*maxTrack
)
121 MINMAXINFO MinMax
, *pMinMax
;
123 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
125 /* Compute default values */
127 MinMax
.ptMaxSize
.x
= SYSMETRICS_CXSCREEN
;
128 MinMax
.ptMaxSize
.y
= SYSMETRICS_CYSCREEN
;
129 MinMax
.ptMinTrackSize
.x
= SYSMETRICS_CXMINTRACK
;
130 MinMax
.ptMinTrackSize
.y
= SYSMETRICS_CYMINTRACK
;
131 MinMax
.ptMaxTrackSize
.x
= SYSMETRICS_CXSCREEN
;
132 MinMax
.ptMaxTrackSize
.y
= SYSMETRICS_CYSCREEN
;
134 if (HAS_DLGFRAME( wndPtr
->dwStyle
, wndPtr
->dwExStyle
))
136 xinc
= SYSMETRICS_CXDLGFRAME
;
137 yinc
= SYSMETRICS_CYDLGFRAME
;
142 if (HAS_THICKFRAME(wndPtr
->dwStyle
))
144 xinc
+= SYSMETRICS_CXFRAME
;
145 yinc
+= SYSMETRICS_CYFRAME
;
147 if (wndPtr
->dwStyle
& WS_BORDER
)
149 xinc
+= SYSMETRICS_CXBORDER
;
150 yinc
+= SYSMETRICS_CYBORDER
;
153 MinMax
.ptMaxSize
.x
+= 2 * xinc
;
154 MinMax
.ptMaxSize
.y
+= 2 * yinc
;
156 /* Note: The '+' in the following test should really be a ||, but
157 * that would cause gcc-2.7.0 to generate incorrect code.
159 if ((wndPtr
->ptMaxPos
.x
!= -1) + (wndPtr
->ptMaxPos
.y
!= -1))
160 MinMax
.ptMaxPosition
= wndPtr
->ptMaxPos
;
163 MinMax
.ptMaxPosition
.x
= -xinc
;
164 MinMax
.ptMaxPosition
.y
= -yinc
;
167 minmaxHandle
= USER_HEAP_ALLOC( sizeof(MINMAXINFO
) );
170 pMinMax
= (MINMAXINFO
*) USER_HEAP_LIN_ADDR( minmaxHandle
);
171 memcpy( pMinMax
, &MinMax
, sizeof(MinMax
) );
172 SendMessage( hwnd
, WM_GETMINMAXINFO
, 0,
173 USER_HEAP_SEG_ADDR(minmaxHandle
) );
175 else pMinMax
= &MinMax
;
177 /* Some sanity checks */
179 pMinMax
->ptMaxTrackSize
.x
= max( pMinMax
->ptMaxTrackSize
.x
,
180 pMinMax
->ptMinTrackSize
.x
);
181 pMinMax
->ptMaxTrackSize
.y
= max( pMinMax
->ptMaxTrackSize
.y
,
182 pMinMax
->ptMinTrackSize
.y
);
184 if (maxSize
) *maxSize
= pMinMax
->ptMaxSize
;
185 if (maxPos
) *maxPos
= pMinMax
->ptMaxPosition
;
186 if (minTrack
) *minTrack
= pMinMax
->ptMinTrackSize
;
187 if (maxTrack
) *maxTrack
= pMinMax
->ptMaxTrackSize
;
188 if (minmaxHandle
) USER_HEAP_FREE( minmaxHandle
);
192 /***********************************************************************
193 * NC_HandleNCCalcSize
195 * Handle a WM_NCCALCSIZE message. Called from DefWindowProc().
197 LONG
NC_HandleNCCalcSize( HWND hwnd
, NCCALCSIZE_PARAMS
*params
)
199 RECT tmpRect
= { 0, 0, 0, 0 };
200 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
202 if (!wndPtr
) return 0;
203 NC_AdjustRect( &tmpRect
, wndPtr
->dwStyle
, FALSE
, wndPtr
->dwExStyle
);
204 params
->rgrc
[0].left
-= tmpRect
.left
;
205 params
->rgrc
[0].top
-= tmpRect
.top
;
206 params
->rgrc
[0].right
-= tmpRect
.right
;
207 params
->rgrc
[0].bottom
-= tmpRect
.bottom
;
209 if (HAS_MENU(wndPtr
))
211 params
->rgrc
[0].top
+= MENU_GetMenuBarHeight( hwnd
,
212 params
->rgrc
[0].right
- params
->rgrc
[0].left
,
213 -tmpRect
.left
, -tmpRect
.top
) + 1;
219 /***********************************************************************
222 * Get the 'inside' rectangle of a window, i.e. the whole window rectangle
223 * but without the borders (if any).
224 * The rectangle is in window coordinates (for drawing with GetWindowDC()).
226 void NC_GetInsideRect( HWND hwnd
, RECT
*rect
)
228 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
230 rect
->top
= rect
->left
= 0;
231 rect
->right
= wndPtr
->rectWindow
.right
- wndPtr
->rectWindow
.left
;
232 rect
->bottom
= wndPtr
->rectWindow
.bottom
- wndPtr
->rectWindow
.top
;
234 if (wndPtr
->dwStyle
& WS_ICONIC
) return; /* No border to remove */
236 /* Remove frame from rectangle */
237 if (HAS_DLGFRAME( wndPtr
->dwStyle
, wndPtr
->dwExStyle
))
239 InflateRect( rect
, -SYSMETRICS_CXDLGFRAME
, -SYSMETRICS_CYDLGFRAME
);
240 if (wndPtr
->dwExStyle
& WS_EX_DLGMODALFRAME
) InflateRect( rect
, -1, 0);
244 if (HAS_THICKFRAME( wndPtr
->dwStyle
))
245 InflateRect( rect
, -SYSMETRICS_CXFRAME
, -SYSMETRICS_CYFRAME
);
246 if (wndPtr
->dwStyle
& WS_BORDER
)
247 InflateRect( rect
, -SYSMETRICS_CXBORDER
, -SYSMETRICS_CYBORDER
);
252 /***********************************************************************
255 * Handle a WM_NCHITTEST message. Called from DefWindowProc().
257 LONG
NC_HandleNCHitTest( HWND hwnd
, POINT pt
)
260 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
261 if (!wndPtr
) return HTERROR
;
263 dprintf_nonclient(stddeb
, "NC_HandleNCHitTest: hwnd=%x pt=%d,%d\n",
266 GetWindowRect( hwnd
, &rect
);
267 if (!PtInRect( &rect
, pt
)) return HTNOWHERE
;
270 * if this is a iconic window, we don't care were the hit
271 * occured, only that it did occur, just return HTCAPTION
272 * so the caller knows the icon did get hit
276 return HTCAPTION
; /* change this to something meaningful? */
280 if (HAS_THICKFRAME( wndPtr
->dwStyle
))
282 InflateRect( &rect
, -SYSMETRICS_CXFRAME
, -SYSMETRICS_CYFRAME
);
283 if (wndPtr
->dwStyle
& WS_BORDER
)
284 InflateRect( &rect
, -SYSMETRICS_CXBORDER
, -SYSMETRICS_CYBORDER
);
285 if (!PtInRect( &rect
, pt
))
287 /* Check top sizing border */
290 if (pt
.x
< rect
.left
+SYSMETRICS_CXSIZE
) return HTTOPLEFT
;
291 if (pt
.x
>= rect
.right
-SYSMETRICS_CXSIZE
) return HTTOPRIGHT
;
294 /* Check bottom sizing border */
295 if (pt
.y
>= rect
.bottom
)
297 if (pt
.x
< rect
.left
+SYSMETRICS_CXSIZE
) return HTBOTTOMLEFT
;
298 if (pt
.x
>= rect
.right
-SYSMETRICS_CXSIZE
) return HTBOTTOMRIGHT
;
301 /* Check left sizing border */
302 if (pt
.x
< rect
.left
)
304 if (pt
.y
< rect
.top
+SYSMETRICS_CYSIZE
) return HTTOPLEFT
;
305 if (pt
.y
>= rect
.bottom
-SYSMETRICS_CYSIZE
) return HTBOTTOMLEFT
;
308 /* Check right sizing border */
309 if (pt
.x
>= rect
.right
)
311 if (pt
.y
< rect
.top
+SYSMETRICS_CYSIZE
) return HTTOPRIGHT
;
312 if (pt
.y
>= rect
.bottom
-SYSMETRICS_CYSIZE
) return HTBOTTOMRIGHT
;
317 else /* No thick frame */
319 if (HAS_DLGFRAME( wndPtr
->dwStyle
, wndPtr
->dwExStyle
))
320 InflateRect(&rect
, -SYSMETRICS_CXDLGFRAME
, -SYSMETRICS_CYDLGFRAME
);
321 else if (wndPtr
->dwStyle
& WS_BORDER
)
322 InflateRect(&rect
, -SYSMETRICS_CXBORDER
, -SYSMETRICS_CYBORDER
);
323 if (!PtInRect( &rect
, pt
)) return HTBORDER
;
328 if ((wndPtr
->dwStyle
& WS_CAPTION
) == WS_CAPTION
)
330 rect
.top
+= SYSMETRICS_CYCAPTION
- 1;
331 if (!PtInRect( &rect
, pt
))
333 /* Check system menu */
334 if (wndPtr
->dwStyle
& WS_SYSMENU
)
335 rect
.left
+= SYSMETRICS_CXSIZE
;
336 if (pt
.x
<= rect
.left
) return HTSYSMENU
;
337 /* Check maximize box */
338 if (wndPtr
->dwStyle
& WS_MAXIMIZEBOX
)
339 rect
.right
-= SYSMETRICS_CXSIZE
+ 1;
340 if (pt
.x
>= rect
.right
) return HTMAXBUTTON
;
341 /* Check minimize box */
342 if (wndPtr
->dwStyle
& WS_MINIMIZEBOX
)
343 rect
.right
-= SYSMETRICS_CXSIZE
+ 1;
344 if (pt
.x
>= rect
.right
) return HTMINBUTTON
;
349 /* Check client area */
351 ScreenToClient( hwnd
, &pt
);
352 GetClientRect( hwnd
, &rect
);
353 if (PtInRect( &rect
, pt
)) return HTCLIENT
;
355 /* Check vertical scroll bar */
357 if (wndPtr
->dwStyle
& WS_VSCROLL
)
359 rect
.right
+= SYSMETRICS_CXVSCROLL
;
360 if (PtInRect( &rect
, pt
)) return HTVSCROLL
;
363 /* Check horizontal scroll bar */
365 if (wndPtr
->dwStyle
& WS_HSCROLL
)
367 rect
.bottom
+= SYSMETRICS_CYHSCROLL
;
368 if (PtInRect( &rect
, pt
))
371 if ((wndPtr
->dwStyle
& WS_VSCROLL
) &&
372 (pt
.x
>= rect
.right
- SYSMETRICS_CXVSCROLL
))
380 if (HAS_MENU(wndPtr
))
382 if ((pt
.y
< 0) && (pt
.x
>= 0) && (pt
.x
< rect
.right
))
386 /* Should never get here */
391 /***********************************************************************
394 void NC_DrawSysButton( HWND hwnd
, HDC hdc
, BOOL down
)
399 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
401 NC_GetInsideRect( hwnd
, &rect
);
402 hdcMem
= CreateCompatibleDC( hdc
);
403 hbitmap
= SelectObject( hdcMem
, hbitmapClose
);
404 BitBlt( hdc
, rect
.left
, rect
.top
, SYSMETRICS_CXSIZE
, SYSMETRICS_CYSIZE
,
405 hdcMem
, (wndPtr
->dwStyle
& WS_CHILD
) ? SYSMETRICS_CXSIZE
: 0, 0,
406 down
? NOTSRCCOPY
: SRCCOPY
);
407 SelectObject( hdcMem
, hbitmap
);
412 /***********************************************************************
415 static void NC_DrawMaxButton( HWND hwnd
, HDC hdc
, BOOL down
)
418 NC_GetInsideRect( hwnd
, &rect
);
419 GRAPH_DrawBitmap( hdc
, (IsZoomed(hwnd
) ?
420 (down
? hbitmapRestoreD
: hbitmapRestore
) :
421 (down
? hbitmapMaximizeD
: hbitmapMaximize
)),
422 rect
.right
- SYSMETRICS_CXSIZE
- 1, rect
.top
,
423 0, 0, SYSMETRICS_CXSIZE
+1, SYSMETRICS_CYSIZE
);
427 /***********************************************************************
430 static void NC_DrawMinButton( HWND hwnd
, HDC hdc
, BOOL down
)
433 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
434 NC_GetInsideRect( hwnd
, &rect
);
435 if (wndPtr
->dwStyle
& WS_MAXIMIZEBOX
) rect
.right
-= SYSMETRICS_CXSIZE
+ 1;
436 GRAPH_DrawBitmap( hdc
, (down
? hbitmapMinimizeD
: hbitmapMinimize
),
437 rect
.right
- SYSMETRICS_CXSIZE
- 1, rect
.top
,
438 0, 0, SYSMETRICS_CXSIZE
+1, SYSMETRICS_CYSIZE
);
442 /***********************************************************************
445 * Draw a window frame inside the given rectangle, and update the rectangle.
446 * The correct pen for the frame must be selected in the DC.
448 static void NC_DrawFrame( HDC hdc
, RECT
*rect
, BOOL dlgFrame
, BOOL active
)
450 short width
, height
, tmp
;
454 width
= SYSMETRICS_CXDLGFRAME
- 1;
455 height
= SYSMETRICS_CYDLGFRAME
- 1;
456 SelectObject( hdc
, active
? sysColorObjects
.hbrushActiveCaption
:
457 sysColorObjects
.hbrushInactiveCaption
);
461 width
= SYSMETRICS_CXFRAME
- 1;
462 height
= SYSMETRICS_CYFRAME
- 1;
463 SelectObject( hdc
, active
? sysColorObjects
.hbrushActiveBorder
:
464 sysColorObjects
.hbrushInactiveBorder
);
468 PatBlt( hdc
, rect
->left
, rect
->top
,
469 rect
->right
- rect
->left
, height
, PATCOPY
);
470 PatBlt( hdc
, rect
->left
, rect
->top
,
471 width
, rect
->bottom
- rect
->top
, PATCOPY
);
472 PatBlt( hdc
, rect
->left
, rect
->bottom
,
473 rect
->right
- rect
->left
, -height
, PATCOPY
);
474 PatBlt( hdc
, rect
->right
, rect
->top
,
475 -width
, rect
->bottom
- rect
->top
, PATCOPY
);
479 InflateRect( rect
, -width
, -height
);
483 /* Draw inner rectangle */
484 MoveTo( hdc
, rect
->left
+width
, rect
->top
+height
);
485 LineTo( hdc
, rect
->right
-width
-1, rect
->top
+height
);
486 LineTo( hdc
, rect
->right
-width
-1, rect
->bottom
-height
-1 );
487 LineTo( hdc
, rect
->left
+width
, rect
->bottom
-height
-1 );
488 LineTo( hdc
, rect
->left
+width
, rect
->top
+height
);
490 /* Draw the decorations */
491 tmp
= rect
->top
+ SYSMETRICS_CYFRAME
+ SYSMETRICS_CYSIZE
;
492 MoveTo( hdc
, rect
->left
, tmp
);
493 LineTo( hdc
, rect
->left
+width
, tmp
);
494 MoveTo( hdc
, rect
->right
-width
-1, tmp
);
495 LineTo( hdc
, rect
->right
-1, tmp
);
497 tmp
= rect
->bottom
- 1 - SYSMETRICS_CYFRAME
- SYSMETRICS_CYSIZE
;
498 MoveTo( hdc
, rect
->left
, tmp
);
499 LineTo( hdc
, rect
->left
+width
, tmp
);
500 MoveTo( hdc
, rect
->right
-width
-1, tmp
);
501 LineTo( hdc
, rect
->right
-1, tmp
);
503 tmp
= rect
->left
+ SYSMETRICS_CXFRAME
+ SYSMETRICS_CXSIZE
;
504 MoveTo( hdc
, tmp
, rect
->top
);
505 LineTo( hdc
, tmp
, rect
->top
+height
);
506 MoveTo( hdc
, tmp
, rect
->bottom
-height
-1 );
507 LineTo( hdc
, tmp
, rect
->bottom
-1 );
509 tmp
= rect
->right
- 1 - SYSMETRICS_CXFRAME
- SYSMETRICS_CYSIZE
;
510 MoveTo( hdc
, tmp
, rect
->top
);
511 LineTo( hdc
, tmp
, rect
->top
+height
);
512 MoveTo( hdc
, tmp
, rect
->bottom
-height
-1 );
513 LineTo( hdc
, tmp
, rect
->bottom
-1 );
515 InflateRect( rect
, -width
-1, -height
-1 );
519 /***********************************************************************
522 * Draw the frame used when moving or resizing window.
524 static void NC_DrawMovingFrame( HDC hdc
, RECT
*rect
, BOOL thickframe
)
528 SelectObject( hdc
, GetStockObject( GRAY_BRUSH
) );
529 PatBlt( hdc
, rect
->left
, rect
->top
,
530 rect
->right
- rect
->left
- SYSMETRICS_CXFRAME
,
531 SYSMETRICS_CYFRAME
, PATINVERT
);
532 PatBlt( hdc
, rect
->left
, rect
->top
+ SYSMETRICS_CYFRAME
,
534 rect
->bottom
- rect
->top
- SYSMETRICS_CYFRAME
, PATINVERT
);
535 PatBlt( hdc
, rect
->left
+ SYSMETRICS_CXFRAME
, rect
->bottom
,
536 rect
->right
- rect
->left
- SYSMETRICS_CXFRAME
,
537 -SYSMETRICS_CYFRAME
, PATINVERT
);
538 PatBlt( hdc
, rect
->right
, rect
->top
, -SYSMETRICS_CXFRAME
,
539 rect
->bottom
- rect
->top
- SYSMETRICS_CYFRAME
, PATINVERT
);
541 else DrawFocusRect( hdc
, rect
);
545 /***********************************************************************
548 * Draw the window caption.
549 * The correct pen for the window frame must be selected in the DC.
551 static void NC_DrawCaption( HDC hdc
, RECT
*rect
, HWND hwnd
,
552 DWORD style
, BOOL active
)
555 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
560 if (!(hbitmapClose
= LoadBitmap( 0, MAKEINTRESOURCE(OBM_CLOSE
) )))
562 hbitmapMinimize
= LoadBitmap( 0, MAKEINTRESOURCE(OBM_REDUCE
) );
563 hbitmapMinimizeD
= LoadBitmap( 0, MAKEINTRESOURCE(OBM_REDUCED
) );
564 hbitmapMaximize
= LoadBitmap( 0, MAKEINTRESOURCE(OBM_ZOOM
) );
565 hbitmapMaximizeD
= LoadBitmap( 0, MAKEINTRESOURCE(OBM_ZOOMD
) );
566 hbitmapRestore
= LoadBitmap( 0, MAKEINTRESOURCE(OBM_RESTORE
) );
567 hbitmapRestoreD
= LoadBitmap( 0, MAKEINTRESOURCE(OBM_RESTORED
) );
570 if (wndPtr
->dwExStyle
& WS_EX_DLGMODALFRAME
)
572 HBRUSH hbrushOld
= SelectObject( hdc
, sysColorObjects
.hbrushWindow
);
573 PatBlt( hdc
, r
.left
, r
.top
, 1, r
.bottom
-r
.top
+1,PATCOPY
);
574 PatBlt( hdc
, r
.right
-1, r
.top
, 1, r
.bottom
-r
.top
+1, PATCOPY
);
575 PatBlt( hdc
, r
.left
, r
.top
-1, r
.right
-r
.left
, 1, PATCOPY
);
578 SelectObject( hdc
, hbrushOld
);
581 MoveTo( hdc
, r
.left
, r
.bottom
);
582 LineTo( hdc
, r
.right
-1, r
.bottom
);
584 if (style
& WS_SYSMENU
)
586 NC_DrawSysButton( hwnd
, hdc
, FALSE
);
587 r
.left
+= SYSMETRICS_CXSIZE
+ 1;
588 MoveTo( hdc
, r
.left
- 1, r
.top
);
589 LineTo( hdc
, r
.left
- 1, r
.bottom
);
591 if (style
& WS_MAXIMIZEBOX
)
593 NC_DrawMaxButton( hwnd
, hdc
, FALSE
);
594 r
.right
-= SYSMETRICS_CXSIZE
+ 1;
596 if (style
& WS_MINIMIZEBOX
)
598 NC_DrawMinButton( hwnd
, hdc
, FALSE
);
599 r
.right
-= SYSMETRICS_CXSIZE
+ 1;
602 FillRect( hdc
, &r
, active
? sysColorObjects
.hbrushActiveCaption
:
603 sysColorObjects
.hbrushInactiveCaption
);
605 if (GetWindowText( hwnd
, buffer
, 256 ))
607 if (active
) SetTextColor( hdc
, GetSysColor( COLOR_CAPTIONTEXT
) );
608 else SetTextColor( hdc
, GetSysColor( COLOR_INACTIVECAPTIONTEXT
) );
609 SetBkMode( hdc
, TRANSPARENT
);
610 DrawText( hdc
, buffer
, -1, &r
, DT_SINGLELINE
| DT_CENTER
| DT_VCENTER
);
615 /***********************************************************************
618 * Paint the non-client area.
620 void NC_DoNCPaint( HWND hwnd
, BOOL active
, BOOL suppress_menupaint
)
625 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
627 dprintf_nonclient(stddeb
, "NC_DoNCPaint: %x %d\n", hwnd
, active
);
628 if (!wndPtr
|| !(wndPtr
->dwStyle
& WS_VISIBLE
)) return; /* Nothing to do */
630 if (!(hdc
= GetDCEx( hwnd
, 0, DCX_USESTYLE
| DCX_WINDOW
))) return;
633 * If this is an icon, we don't want to do any more nonclient painting
634 * of the window manager.
635 * If there is a class icon to draw, draw it
639 HICON hIcon
= WIN_CLASS_INFO(wndPtr
).hIcon
;
642 SendMessage(hwnd
, WM_ICONERASEBKGND
, hdc
, 0);
643 DrawIcon(hdc
, 0, 0, hIcon
);
645 ReleaseDC(hwnd
, hdc
);
649 if (ExcludeVisRect( hdc
, wndPtr
->rectClient
.left
-wndPtr
->rectWindow
.left
,
650 wndPtr
->rectClient
.top
-wndPtr
->rectWindow
.top
,
651 wndPtr
->rectClient
.right
-wndPtr
->rectWindow
.left
,
652 wndPtr
->rectClient
.bottom
-wndPtr
->rectWindow
.top
)
655 ReleaseDC( hwnd
, hdc
);
659 rect
.top
= rect
.left
= 0;
660 rect
.right
= wndPtr
->rectWindow
.right
- wndPtr
->rectWindow
.left
;
661 rect
.bottom
= wndPtr
->rectWindow
.bottom
- wndPtr
->rectWindow
.top
;
663 SelectObject( hdc
, sysColorObjects
.hpenWindowFrame
);
665 if ((wndPtr
->dwStyle
& WS_BORDER
) || (wndPtr
->dwStyle
& WS_DLGFRAME
) ||
666 (wndPtr
->dwExStyle
& WS_EX_DLGMODALFRAME
))
669 LineTo( hdc
, rect
.right
-1, 0 );
670 LineTo( hdc
, rect
.right
-1, rect
.bottom
-1 );
671 LineTo( hdc
, 0, rect
.bottom
-1 );
673 InflateRect( &rect
, -1, -1 );
676 if (HAS_DLGFRAME( wndPtr
->dwStyle
, wndPtr
->dwExStyle
))
677 NC_DrawFrame( hdc
, &rect
, TRUE
, active
);
678 else if (wndPtr
->dwStyle
& WS_THICKFRAME
)
679 NC_DrawFrame(hdc
, &rect
, FALSE
, active
);
681 if ((wndPtr
->dwStyle
& WS_CAPTION
) == WS_CAPTION
)
684 r
.bottom
= rect
.top
+ SYSMETRICS_CYSIZE
;
685 rect
.top
+= SYSMETRICS_CYSIZE
+ SYSMETRICS_CYBORDER
;
686 NC_DrawCaption( hdc
, &r
, hwnd
, wndPtr
->dwStyle
, active
);
689 if (HAS_MENU(wndPtr
))
692 r
.bottom
= rect
.top
+ SYSMETRICS_CYMENU
; /* default height */
693 rect
.top
+= MENU_DrawMenuBar( hdc
, &r
, hwnd
, suppress_menupaint
);
696 /* Draw the scroll-bars */
698 if (wndPtr
->dwStyle
& WS_VSCROLL
) SCROLL_DrawScrollBar(hwnd
, hdc
, SB_VERT
);
699 if (wndPtr
->dwStyle
& WS_HSCROLL
) SCROLL_DrawScrollBar(hwnd
, hdc
, SB_HORZ
);
701 /* Draw the "size-box" */
703 if ((wndPtr
->dwStyle
& WS_VSCROLL
) && (wndPtr
->dwStyle
& WS_HSCROLL
))
706 r
.left
= r
.right
- SYSMETRICS_CXVSCROLL
+ 1;
707 r
.top
= r
.bottom
- SYSMETRICS_CYHSCROLL
+ 1;
708 FillRect( hdc
, &r
, sysColorObjects
.hbrushScrollbar
);
711 ReleaseDC( hwnd
, hdc
);
716 /***********************************************************************
719 * Handle a WM_NCPAINT message. Called from DefWindowProc().
721 LONG
NC_HandleNCPaint( HWND hwnd
)
723 NC_DoNCPaint( hwnd
, hwnd
== GetActiveWindow(), FALSE
);
728 /***********************************************************************
729 * NC_HandleNCActivate
731 * Handle a WM_NCACTIVATE message. Called from DefWindowProc().
733 LONG
NC_HandleNCActivate( HWND hwnd
, WORD wParam
)
735 NC_DoNCPaint( hwnd
, wParam
, FALSE
);
740 /***********************************************************************
743 * Handle a WM_SETCURSOR message. Called from DefWindowProc().
745 LONG
NC_HandleSetCursor( HWND hwnd
, WORD wParam
, LONG lParam
)
747 if (hwnd
!= wParam
) return 0; /* Don't set the cursor for child windows */
749 switch(LOWORD(lParam
))
753 WORD msg
= HIWORD( lParam
);
754 if ((msg
== WM_LBUTTONDOWN
) || (msg
== WM_MBUTTONDOWN
) ||
755 (msg
== WM_RBUTTONDOWN
))
764 if (!(wndPtr
= WIN_FindWndPtr( hwnd
))) break;
765 if (!(classPtr
= CLASS_FindClassPtr( wndPtr
->hClass
))) break;
766 if (classPtr
->wc
.hCursor
)
768 SetCursor( classPtr
->wc
.hCursor
);
776 return SetCursor( LoadCursor( 0, IDC_SIZEWE
) );
780 return SetCursor( LoadCursor( 0, IDC_SIZENS
) );
784 return SetCursor( LoadCursor( 0, IDC_SIZENWSE
) );
788 return SetCursor( LoadCursor( 0, IDC_SIZENESW
) );
791 /* Default cursor: arrow */
792 return SetCursor( LoadCursor( 0, IDC_ARROW
) );
796 /***********************************************************************
799 * Initialisation of a move or resize, when initiatied from a menu choice.
800 * Return hit test code for caption or sizing border.
802 static LONG
NC_StartSizeMove( HWND hwnd
, WORD wParam
, POINT
*capturePoint
)
807 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
809 if ((wParam
& 0xfff0) == SC_MOVE
)
811 /* Move pointer at the center of the caption */
813 NC_GetInsideRect( hwnd
, &rect
);
814 if (wndPtr
->dwStyle
& WS_SYSMENU
)
815 rect
.left
+= SYSMETRICS_CXSIZE
+ 1;
816 if (wndPtr
->dwStyle
& WS_MINIMIZEBOX
)
817 rect
.right
-= SYSMETRICS_CXSIZE
+ 1;
818 if (wndPtr
->dwStyle
& WS_MAXIMIZEBOX
)
819 rect
.right
-= SYSMETRICS_CXSIZE
+ 1;
820 pt
.x
= wndPtr
->rectWindow
.left
+ (rect
.right
- rect
.left
) / 2;
821 pt
.y
= wndPtr
->rectWindow
.top
+ rect
.top
+ SYSMETRICS_CYSIZE
/2;
822 if (wndPtr
->dwStyle
& WS_CHILD
)
823 ClientToScreen( wndPtr
->hwndParent
, &pt
);
831 MSG_GetHardwareMessage( &msg
);
835 hittest
= NC_HandleNCHitTest( hwnd
, msg
.pt
);
837 if ((hittest
< HTLEFT
) || (hittest
> HTBOTTOMRIGHT
))
849 pt
.x
=(wndPtr
->rectWindow
.left
+wndPtr
->rectWindow
.right
)/2;
850 pt
.y
= wndPtr
->rectWindow
.top
+ SYSMETRICS_CYFRAME
/ 2;
854 pt
.x
=(wndPtr
->rectWindow
.left
+wndPtr
->rectWindow
.right
)/2;
855 pt
.y
= wndPtr
->rectWindow
.bottom
- SYSMETRICS_CYFRAME
/ 2;
859 pt
.x
= wndPtr
->rectWindow
.left
+ SYSMETRICS_CXFRAME
/ 2;
860 pt
.y
=(wndPtr
->rectWindow
.top
+wndPtr
->rectWindow
.bottom
)/2;
864 pt
.x
= wndPtr
->rectWindow
.right
- SYSMETRICS_CXFRAME
/ 2;
865 pt
.y
=(wndPtr
->rectWindow
.top
+wndPtr
->rectWindow
.bottom
)/2;
868 case VK_ESCAPE
: return 0;
874 SetCursorPos( capturePoint
->x
, capturePoint
->y
);
875 NC_HandleSetCursor( hwnd
, hwnd
, MAKELONG( hittest
, WM_MOUSEMOVE
));
880 /***********************************************************************
883 * Perform SC_MOVE and SC_SIZE commands.
885 static void NC_DoSizeMove( HWND hwnd
, WORD wParam
, POINT pt
)
889 RECT sizingRect
, mouseRect
;
892 POINT minTrack
, maxTrack
, capturePoint
= pt
;
893 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
895 if (IsZoomed(hwnd
) || !IsWindowVisible(hwnd
)) return;
896 hittest
= wParam
& 0x0f;
897 thickframe
= HAS_THICKFRAME( wndPtr
->dwStyle
);
899 if ((wParam
& 0xfff0) == SC_MOVE
)
901 if (!(wndPtr
->dwStyle
& WS_CAPTION
)) return;
902 if (!hittest
) hittest
= NC_StartSizeMove( hwnd
, wParam
, &capturePoint
);
903 if (!hittest
) return;
907 if (!thickframe
) return;
908 if (hittest
) hittest
+= HTLEFT
-1;
912 hittest
= NC_StartSizeMove( hwnd
, wParam
, &capturePoint
);
921 /* Get min/max info */
923 NC_GetMinMaxInfo( hwnd
, NULL
, NULL
, &minTrack
, &maxTrack
);
924 sizingRect
= wndPtr
->rectWindow
;
925 if (wndPtr
->dwStyle
& WS_CHILD
)
926 GetClientRect( wndPtr
->hwndParent
, &mouseRect
);
927 else SetRect( &mouseRect
, 0, 0, SYSMETRICS_CXSCREEN
, SYSMETRICS_CYSCREEN
);
928 if (ON_LEFT_BORDER(hittest
))
930 mouseRect
.left
= max( mouseRect
.left
, sizingRect
.right
-maxTrack
.x
);
931 mouseRect
.right
= min( mouseRect
.right
, sizingRect
.right
-minTrack
.x
);
933 else if (ON_RIGHT_BORDER(hittest
))
935 mouseRect
.left
= max( mouseRect
.left
, sizingRect
.left
+minTrack
.x
);
936 mouseRect
.right
= min( mouseRect
.right
, sizingRect
.left
+maxTrack
.x
);
938 if (ON_TOP_BORDER(hittest
))
940 mouseRect
.top
= max( mouseRect
.top
, sizingRect
.bottom
-maxTrack
.y
);
941 mouseRect
.bottom
= min( mouseRect
.bottom
,sizingRect
.bottom
-minTrack
.y
);
943 else if (ON_BOTTOM_BORDER(hittest
))
945 mouseRect
.top
= max( mouseRect
.top
, sizingRect
.top
+minTrack
.y
);
946 mouseRect
.bottom
= min( mouseRect
.bottom
, sizingRect
.top
+maxTrack
.y
);
948 SendMessage( hwnd
, WM_ENTERSIZEMOVE
, 0, 0 );
950 if (GetCapture() != hwnd
) SetCapture( hwnd
);
952 if (wndPtr
->dwStyle
& WS_CHILD
)
954 /* Retrieve a default cache DC (without using the window style) */
955 hdc
= GetDCEx( wndPtr
->hwndParent
, 0, DCX_CACHE
);
958 { /* Grab the server only when moving top-level windows without desktop */
960 if (rootWindow
== DefaultRootWindow(display
)) XGrabServer( display
);
962 NC_DrawMovingFrame( hdc
, &sizingRect
, thickframe
);
968 MSG_GetHardwareMessage( &msg
);
970 /* Exit on button-up, Return, or Esc */
971 if ((msg
.message
== WM_LBUTTONUP
) ||
972 ((msg
.message
== WM_KEYDOWN
) &&
973 ((msg
.wParam
== VK_RETURN
) || (msg
.wParam
== VK_ESCAPE
)))) break;
975 if ((msg
.message
!= WM_KEYDOWN
) && (msg
.message
!= WM_MOUSEMOVE
))
976 continue; /* We are not interested in other messages */
979 if (wndPtr
->dwStyle
& WS_CHILD
)
980 ScreenToClient( wndPtr
->hwndParent
, &pt
);
983 if (msg
.message
== WM_KEYDOWN
) switch(msg
.wParam
)
985 case VK_UP
: pt
.y
-= 8; break;
986 case VK_DOWN
: pt
.y
+= 8; break;
987 case VK_LEFT
: pt
.x
-= 8; break;
988 case VK_RIGHT
: pt
.x
+= 8; break;
991 pt
.x
= max( pt
.x
, mouseRect
.left
);
992 pt
.x
= min( pt
.x
, mouseRect
.right
);
993 pt
.y
= max( pt
.y
, mouseRect
.top
);
994 pt
.y
= min( pt
.y
, mouseRect
.bottom
);
996 dx
= pt
.x
- capturePoint
.x
;
997 dy
= pt
.y
- capturePoint
.y
;
1001 if (msg
.message
== WM_KEYDOWN
) SetCursorPos( pt
.x
, pt
.y
);
1004 RECT newRect
= sizingRect
;
1006 if (hittest
== HTCAPTION
) OffsetRect( &newRect
, dx
, dy
);
1007 if (ON_LEFT_BORDER(hittest
)) newRect
.left
+= dx
;
1008 else if (ON_RIGHT_BORDER(hittest
)) newRect
.right
+= dx
;
1009 if (ON_TOP_BORDER(hittest
)) newRect
.top
+= dy
;
1010 else if (ON_BOTTOM_BORDER(hittest
)) newRect
.bottom
+= dy
;
1011 NC_DrawMovingFrame( hdc
, &sizingRect
, thickframe
);
1012 NC_DrawMovingFrame( hdc
, &newRect
, thickframe
);
1014 sizingRect
= newRect
;
1019 NC_DrawMovingFrame( hdc
, &sizingRect
, thickframe
);
1021 if (wndPtr
->dwStyle
& WS_CHILD
) ReleaseDC( wndPtr
->hwndParent
, hdc
);
1024 ReleaseDC( 0, hdc
);
1025 if (rootWindow
== DefaultRootWindow(display
)) XUngrabServer( display
);
1027 SendMessage( hwnd
, WM_EXITSIZEMOVE
, 0, 0 );
1029 /* If Esc key, don't move the window */
1030 if ((msg
.message
== WM_KEYDOWN
) && (msg
.wParam
== VK_ESCAPE
)) return;
1032 if (hittest
!= HTCAPTION
)
1033 SetWindowPos( hwnd
, 0, sizingRect
.left
, sizingRect
.top
,
1034 sizingRect
.right
- sizingRect
.left
,
1035 sizingRect
.bottom
- sizingRect
.top
,
1036 SWP_NOACTIVATE
| SWP_NOZORDER
);
1037 else SetWindowPos( hwnd
, 0, sizingRect
.left
, sizingRect
.top
, 0, 0,
1038 SWP_NOACTIVATE
| SWP_NOSIZE
| SWP_NOZORDER
);
1042 /***********************************************************************
1045 * Track a mouse button press on the minimize or maximize box.
1047 static void NC_TrackMinMaxBox( HWND hwnd
, WORD wParam
)
1050 HDC hdc
= GetWindowDC( hwnd
);
1051 BOOL pressed
= TRUE
;
1054 if (wParam
== HTMINBUTTON
) NC_DrawMinButton( hwnd
, hdc
, TRUE
);
1055 else NC_DrawMaxButton( hwnd
, hdc
, TRUE
);
1059 BOOL oldstate
= pressed
;
1060 MSG_GetHardwareMessage( &msg
);
1062 pressed
= (NC_HandleNCHitTest( hwnd
, msg
.pt
) == wParam
);
1063 if (pressed
!= oldstate
)
1065 if (wParam
== HTMINBUTTON
) NC_DrawMinButton( hwnd
, hdc
, pressed
);
1066 else NC_DrawMaxButton( hwnd
, hdc
, pressed
);
1068 } while (msg
.message
!= WM_LBUTTONUP
);
1070 if (wParam
== HTMINBUTTON
) NC_DrawMinButton( hwnd
, hdc
, FALSE
);
1071 else NC_DrawMaxButton( hwnd
, hdc
, FALSE
);
1074 ReleaseDC( hwnd
, hdc
);
1075 if (!pressed
) return;
1077 if (wParam
== HTMINBUTTON
)
1078 SendMessage( hwnd
, WM_SYSCOMMAND
, SC_MINIMIZE
, *(LONG
*)&msg
.pt
);
1080 SendMessage( hwnd
, WM_SYSCOMMAND
,
1081 IsZoomed(hwnd
) ? SC_RESTORE
: SC_MAXIMIZE
, *(LONG
*)&msg
.pt
);
1085 /***********************************************************************
1088 * Track a mouse button press on the horizontal or vertical scroll-bar.
1090 static void NC_TrackScrollBar( HWND hwnd
, WORD wParam
, POINT pt
)
1095 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
1097 if ((wParam
& 0xfff0) == SC_HSCROLL
)
1099 if ((wParam
& 0x0f) != HTHSCROLL
) return;
1100 scrollbar
= SB_HORZ
;
1102 else /* SC_VSCROLL */
1104 if ((wParam
& 0x0f) != HTVSCROLL
) return;
1105 scrollbar
= SB_VERT
;
1108 hMsg
= USER_HEAP_ALLOC( sizeof(MSG
) );
1109 msg
= (MSG
*) USER_HEAP_LIN_ADDR( hMsg
);
1110 pt
.x
-= wndPtr
->rectWindow
.left
;
1111 pt
.y
-= wndPtr
->rectWindow
.top
;
1113 SCROLL_HandleScrollEvent( hwnd
, scrollbar
, WM_LBUTTONDOWN
, pt
);
1117 GetMessage( USER_HEAP_SEG_ADDR(hMsg
), 0, 0, 0 );
1118 switch(msg
->message
)
1123 pt
= MAKEPOINT(msg
->lParam
);
1124 pt
.x
+= wndPtr
->rectClient
.left
- wndPtr
->rectWindow
.left
;
1125 pt
.y
+= wndPtr
->rectClient
.top
- wndPtr
->rectWindow
.top
;
1126 SCROLL_HandleScrollEvent( hwnd
, scrollbar
, msg
->message
, pt
);
1129 TranslateMessage( msg
);
1130 DispatchMessage( msg
);
1133 if (!IsWindow( hwnd
))
1138 } while (msg
->message
!= WM_LBUTTONUP
);
1139 USER_HEAP_FREE( hMsg
);
1142 /***********************************************************************
1145 * Track a mouse button press on the system menu.
1147 static void NC_TrackSysMenu( HWND hwnd
, HDC hdc
, POINT pt
)
1150 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
1152 if (!(wndPtr
->dwStyle
& WS_SYSMENU
)) return;
1153 /* If window has a menu, track the menu bar normally */
1154 if (HAS_MENU(wndPtr
)) MENU_TrackMouseMenuBar( hwnd
, pt
);
1157 /* Otherwise track the system menu like a normal popup menu */
1158 NC_GetInsideRect( hwnd
, &rect
);
1159 OffsetRect( &rect
, wndPtr
->rectWindow
.left
, wndPtr
->rectWindow
.top
);
1160 if (wndPtr
->dwStyle
& WS_CHILD
)
1161 ClientToScreen( wndPtr
->hwndParent
, (POINT
*)&rect
);
1162 rect
.right
= rect
.left
+ SYSMETRICS_CXSIZE
;
1163 rect
.bottom
= rect
.top
+ SYSMETRICS_CYSIZE
;
1164 NC_DrawSysButton( hwnd
, hdc
, TRUE
);
1165 TrackPopupMenu( wndPtr
->hSysMenu
, TPM_LEFTALIGN
| TPM_LEFTBUTTON
,
1166 rect
.left
, rect
.bottom
, 0, hwnd
, &rect
);
1167 NC_DrawSysButton( hwnd
, hdc
, FALSE
);
1172 /***********************************************************************
1173 * NC_HandleNCLButtonDown
1175 * Handle a WM_NCLBUTTONDOWN message. Called from DefWindowProc().
1177 LONG
NC_HandleNCLButtonDown( HWND hwnd
, WORD wParam
, LONG lParam
)
1179 HDC hdc
= GetWindowDC( hwnd
);
1181 switch(wParam
) /* Hit test */
1184 SendMessage( hwnd
, WM_SYSCOMMAND
, SC_MOVE
+ HTCAPTION
, lParam
);
1188 NC_TrackSysMenu( hwnd
, hdc
, MAKEPOINT(lParam
) );
1192 SendMessage( hwnd
, WM_SYSCOMMAND
, SC_MOUSEMENU
, lParam
);
1196 SendMessage( hwnd
, WM_SYSCOMMAND
, SC_HSCROLL
+ HTHSCROLL
, lParam
);
1200 SendMessage( hwnd
, WM_SYSCOMMAND
, SC_VSCROLL
+ HTVSCROLL
, lParam
);
1205 NC_TrackMinMaxBox( hwnd
, wParam
);
1216 SendMessage( hwnd
, WM_SYSCOMMAND
, SC_SIZE
+ wParam
- HTLEFT
+1, lParam
);
1223 ReleaseDC( hwnd
, hdc
);
1228 /***********************************************************************
1229 * NC_HandleNCLButtonDblClk
1231 * Handle a WM_NCLBUTTONDBLCLK message. Called from DefWindowProc().
1233 LONG
NC_HandleNCLButtonDblClk( HWND hwnd
, WORD wParam
, LONG lParam
)
1236 * if this is an icon, send a restore since we are handling
1241 SendMessage(hwnd
, WM_SYSCOMMAND
, SC_RESTORE
, lParam
);
1245 switch(wParam
) /* Hit test */
1248 SendMessage( hwnd
, WM_SYSCOMMAND
,
1249 IsZoomed(hwnd
) ? SC_RESTORE
: SC_MAXIMIZE
, lParam
);
1253 SendMessage( hwnd
, WM_SYSCOMMAND
, SC_CLOSE
, lParam
);
1260 /***********************************************************************
1261 * NC_HandleSysCommand
1263 * Handle a WM_SYSCOMMAND message. Called from DefWindowProc().
1265 LONG
NC_HandleSysCommand( HWND hwnd
, WORD wParam
, POINT pt
)
1267 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
1269 dprintf_nonclient(stddeb
, "Handling WM_SYSCOMMAND %x %d,%d\n",
1270 wParam
, pt
.x
, pt
.y
);
1272 if (wndPtr
->dwStyle
& WS_CHILD
) ScreenToClient( wndPtr
->hwndParent
, &pt
);
1274 switch (wParam
& 0xfff0)
1278 NC_DoSizeMove( hwnd
, wParam
, pt
);
1282 ShowWindow( hwnd
, SW_MINIMIZE
);
1286 ShowWindow( hwnd
, SW_MAXIMIZE
);
1290 ShowWindow( hwnd
, SW_RESTORE
);
1298 return SendMessage( hwnd
, WM_CLOSE
, 0, 0 );
1302 NC_TrackScrollBar( hwnd
, wParam
, pt
);
1306 MENU_TrackMouseMenuBar( hwnd
, pt
);
1310 MENU_TrackKbdMenuBar( hwnd
, wParam
);
1317 WinExec( "taskman.exe", SW_SHOWNORMAL
);
1324 if (wParam
== SC_ABOUTWINE
)
1326 extern const char people
[];
1327 ShellAbout(hwnd
,"WINE",people
,0);