2 * Non-client area window functions
4 * Copyright 1994 Alexandre Julliard
10 #include "sysmetrics.h"
20 #include "nonclient.h"
23 #include "selectors.h"
29 static HBITMAP16 hbitmapClose = 0;
30 static HBITMAP16 hbitmapMinimize = 0;
31 static HBITMAP16 hbitmapMinimizeD = 0;
32 static HBITMAP16 hbitmapMaximize = 0;
33 static HBITMAP16 hbitmapMaximizeD = 0;
34 static HBITMAP16 hbitmapRestore = 0;
35 static HBITMAP16 hbitmapRestoreD = 0;
37 #define SC_ABOUTWINE (SC_SCREENSAVE+1)
39 /* Some useful macros */
40 #define HAS_DLGFRAME(style,exStyle) \
41 (((exStyle) & WS_EX_DLGMODALFRAME) || \
42 (((style) & WS_DLGFRAME) && !((style) & WS_BORDER)))
44 #define HAS_THICKFRAME(style) \
45 (((style) & WS_THICKFRAME) && \
46 !(((style) & (WS_DLGFRAME|WS_BORDER)) == WS_DLGFRAME))
48 #define HAS_MENU(w) (!((w)->dwStyle & WS_CHILD) && ((w)->wIDmenu != 0))
50 #define ON_LEFT_BORDER(hit) \
51 (((hit) == HTLEFT) || ((hit) == HTTOPLEFT) || ((hit) == HTBOTTOMLEFT))
52 #define ON_RIGHT_BORDER(hit) \
53 (((hit) == HTRIGHT) || ((hit) == HTTOPRIGHT) || ((hit) == HTBOTTOMRIGHT))
54 #define ON_TOP_BORDER(hit) \
55 (((hit) == HTTOP) || ((hit) == HTTOPLEFT) || ((hit) == HTTOPRIGHT))
56 #define ON_BOTTOM_BORDER(hit) \
57 (((hit) == HTBOTTOM) || ((hit) == HTBOTTOMLEFT) || ((hit) == HTBOTTOMRIGHT))
59 /***********************************************************************
62 * Compute the size of the window rectangle from the size of the
65 static void NC_AdjustRect(LPRECT16 rect, DWORD style, BOOL menu, DWORD exStyle)
67 if(style & WS_ICONIC) return;
68 /* Decide if the window will be managed (see CreateWindowEx) */
69 if (!(Options.managed && !(style & WS_CHILD) &&
70 ((style & (WS_DLGFRAME | WS_THICKFRAME)) ||
71 (exStyle & WS_EX_DLGMODALFRAME))))
73 if (HAS_DLGFRAME( style, exStyle ))
74 InflateRect16(rect, SYSMETRICS_CXDLGFRAME, SYSMETRICS_CYDLGFRAME );
77 if (HAS_THICKFRAME(style))
78 InflateRect16( rect, SYSMETRICS_CXFRAME, SYSMETRICS_CYFRAME );
79 if (style & WS_BORDER)
80 InflateRect16( rect, SYSMETRICS_CXBORDER, SYSMETRICS_CYBORDER);
83 if ((style & WS_CAPTION) == WS_CAPTION)
84 rect->top -= SYSMETRICS_CYCAPTION - SYSMETRICS_CYBORDER;
86 if (menu) rect->top -= SYSMETRICS_CYMENU + SYSMETRICS_CYBORDER;
88 if (style & WS_VSCROLL) rect->right += SYSMETRICS_CXVSCROLL;
89 if (style & WS_HSCROLL) rect->bottom += SYSMETRICS_CYHSCROLL;
93 /***********************************************************************
94 * AdjustWindowRect16 (USER.102)
96 BOOL16 AdjustWindowRect16( LPRECT16 rect, DWORD style, BOOL16 menu )
98 return AdjustWindowRectEx16( rect, style, menu, 0 );
102 /***********************************************************************
103 * AdjustWindowRect32 (USER32.)
105 BOOL32 AdjustWindowRect32( LPRECT32 rect, DWORD style, BOOL32 menu )
107 return AdjustWindowRectEx32( rect, style, menu, 0 );
111 /***********************************************************************
112 * AdjustWindowRectEx16 (USER.454)
114 BOOL16 AdjustWindowRectEx16( LPRECT16 rect, DWORD style,
115 BOOL16 menu, DWORD exStyle )
117 /* Correct the window style */
119 if (!(style & (WS_POPUP | WS_CHILD))) /* Overlapped window */
121 style &= (WS_DLGFRAME | WS_BORDER | WS_THICKFRAME);
122 exStyle &= WS_EX_DLGMODALFRAME;
123 if (exStyle & WS_EX_DLGMODALFRAME) style &= ~WS_THICKFRAME;
125 dprintf_nonclient(stddeb, "AdjustWindowRectEx: (%d,%d)-(%d,%d) %08lx %d %08lx\n",
126 rect->left, rect->top, rect->right, rect->bottom,
127 style, menu, exStyle );
129 NC_AdjustRect( rect, style, menu, exStyle );
134 /***********************************************************************
135 * AdjustWindowRectEx32 (USER32.)
137 BOOL32 AdjustWindowRectEx32( LPRECT32 rect, DWORD style,
138 BOOL32 menu, DWORD exStyle )
143 CONV_RECT32TO16( rect, &rect16 );
144 ret = AdjustWindowRectEx16( &rect16, style, (BOOL16)menu, exStyle );
145 CONV_RECT16TO32( &rect16, rect );
150 /*******************************************************************
153 * Get the minimized and maximized information for a window.
155 void NC_GetMinMaxInfo( HWND hwnd, POINT16 *maxSize, POINT16 *maxPos,
156 POINT16 *minTrack, POINT16 *maxTrack )
158 MINMAXINFO16 *MinMax;
160 WND *wndPtr = WIN_FindWndPtr( hwnd );
162 if (!(MinMax = SEGPTR_NEW(MINMAXINFO16))) return;
164 /* Compute default values */
166 MinMax->ptMaxSize.x = SYSMETRICS_CXSCREEN;
167 MinMax->ptMaxSize.y = SYSMETRICS_CYSCREEN;
168 MinMax->ptMinTrackSize.x = SYSMETRICS_CXMINTRACK;
169 MinMax->ptMinTrackSize.y = SYSMETRICS_CYMINTRACK;
170 MinMax->ptMaxTrackSize.x = SYSMETRICS_CXSCREEN;
171 MinMax->ptMaxTrackSize.y = SYSMETRICS_CYSCREEN;
173 if (wndPtr->flags & WIN_MANAGED) xinc = yinc = 0;
174 else if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle ))
176 xinc = SYSMETRICS_CXDLGFRAME;
177 yinc = SYSMETRICS_CYDLGFRAME;
182 if (HAS_THICKFRAME(wndPtr->dwStyle))
184 xinc += SYSMETRICS_CXFRAME;
185 yinc += SYSMETRICS_CYFRAME;
187 if (wndPtr->dwStyle & WS_BORDER)
189 xinc += SYSMETRICS_CXBORDER;
190 yinc += SYSMETRICS_CYBORDER;
193 MinMax->ptMaxSize.x += 2 * xinc;
194 MinMax->ptMaxSize.y += 2 * yinc;
196 /* Note: The '+' in the following test should really be a ||, but
197 * that would cause gcc-2.7.0 to generate incorrect code.
199 if ((wndPtr->ptMaxPos.x != -1) + (wndPtr->ptMaxPos.y != -1))
200 MinMax->ptMaxPosition = wndPtr->ptMaxPos;
203 MinMax->ptMaxPosition.x = -xinc;
204 MinMax->ptMaxPosition.y = -yinc;
207 SendMessage16( hwnd, WM_GETMINMAXINFO, 0, (LPARAM)SEGPTR_GET(MinMax) );
209 /* Some sanity checks */
211 dprintf_nonclient(stddeb,
212 "NC_GetMinMaxInfo: %d %d / %d %d / %d %d / %d %d\n",
213 MinMax->ptMaxSize.x, MinMax->ptMaxSize.y,
214 MinMax->ptMaxPosition.x, MinMax->ptMaxPosition.y,
215 MinMax->ptMaxTrackSize.x, MinMax->ptMaxTrackSize.y,
216 MinMax->ptMinTrackSize.x, MinMax->ptMinTrackSize.y);
217 MinMax->ptMaxTrackSize.x = MAX( MinMax->ptMaxTrackSize.x,
218 MinMax->ptMinTrackSize.x );
219 MinMax->ptMaxTrackSize.y = MAX( MinMax->ptMaxTrackSize.y,
220 MinMax->ptMinTrackSize.y );
222 if (maxSize) *maxSize = MinMax->ptMaxSize;
223 if (maxPos) *maxPos = MinMax->ptMaxPosition;
224 if (minTrack) *minTrack = MinMax->ptMinTrackSize;
225 if (maxTrack) *maxTrack = MinMax->ptMaxTrackSize;
230 /***********************************************************************
231 * NC_HandleNCCalcSize
233 * Handle a WM_NCCALCSIZE message. Called from DefWindowProc().
235 LONG NC_HandleNCCalcSize( WND *pWnd, RECT16 *winRect )
237 RECT16 tmpRect = { 0, 0, 0, 0 };
240 if (pWnd->class->style & CS_VREDRAW) result |= WVR_VREDRAW;
241 if (pWnd->class->style & CS_HREDRAW) result |= WVR_HREDRAW;
243 if( !( pWnd->dwStyle & WS_MINIMIZE ) )
245 NC_AdjustRect( &tmpRect, pWnd->dwStyle, FALSE, pWnd->dwExStyle );
246 winRect->left -= tmpRect.left;
247 winRect->top -= tmpRect.top;
248 winRect->right -= tmpRect.right;
249 winRect->bottom -= tmpRect.bottom;
253 winRect->top += MENU_GetMenuBarHeight( pWnd->hwndSelf,
254 winRect->right - winRect->left,
255 -tmpRect.left, -tmpRect.top ) + 1;
262 /***********************************************************************
265 * Get the 'inside' rectangle of a window, i.e. the whole window rectangle
266 * but without the borders (if any).
267 * The rectangle is in window coordinates (for drawing with GetWindowDC()).
269 static void NC_GetInsideRect( HWND hwnd, RECT16 *rect )
271 WND * wndPtr = WIN_FindWndPtr( hwnd );
273 rect->top = rect->left = 0;
274 rect->right = wndPtr->rectWindow.right - wndPtr->rectWindow.left;
275 rect->bottom = wndPtr->rectWindow.bottom - wndPtr->rectWindow.top;
277 if (wndPtr->dwStyle & WS_ICONIC) return; /* No border to remove */
278 if (wndPtr->flags & WIN_MANAGED) return;
280 /* Remove frame from rectangle */
281 if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle ))
283 InflateRect16( rect, -SYSMETRICS_CXDLGFRAME, -SYSMETRICS_CYDLGFRAME);
284 if (wndPtr->dwExStyle & WS_EX_DLGMODALFRAME)
285 InflateRect16( rect, -1, 0 );
289 if (HAS_THICKFRAME( wndPtr->dwStyle ))
290 InflateRect16( rect, -SYSMETRICS_CXFRAME, -SYSMETRICS_CYFRAME );
291 if (wndPtr->dwStyle & WS_BORDER)
292 InflateRect16( rect, -SYSMETRICS_CXBORDER, -SYSMETRICS_CYBORDER );
297 /***********************************************************************
300 * Handle a WM_NCHITTEST message. Called from DefWindowProc().
302 LONG NC_HandleNCHitTest( HWND hwnd, POINT16 pt )
305 WND *wndPtr = WIN_FindWndPtr( hwnd );
306 if (!wndPtr) return HTERROR;
308 dprintf_nonclient(stddeb, "NC_HandleNCHitTest: hwnd=%04x pt=%d,%d\n",
311 GetWindowRect16( hwnd, &rect );
312 if (!PtInRect16( &rect, pt )) return HTNOWHERE;
314 if (wndPtr->dwStyle & WS_MINIMIZE) return HTCAPTION;
316 if (!(wndPtr->flags & WIN_MANAGED))
319 if (HAS_THICKFRAME( wndPtr->dwStyle ))
321 InflateRect16( &rect, -SYSMETRICS_CXFRAME, -SYSMETRICS_CYFRAME );
322 if (wndPtr->dwStyle & WS_BORDER)
323 InflateRect16(&rect,-SYSMETRICS_CXBORDER,-SYSMETRICS_CYBORDER);
324 if (!PtInRect16( &rect, pt ))
326 /* Check top sizing border */
329 if (pt.x < rect.left+SYSMETRICS_CXSIZE) return HTTOPLEFT;
330 if (pt.x >= rect.right-SYSMETRICS_CXSIZE) return HTTOPRIGHT;
333 /* Check bottom sizing border */
334 if (pt.y >= rect.bottom)
336 if (pt.x < rect.left+SYSMETRICS_CXSIZE) return HTBOTTOMLEFT;
337 if (pt.x >= rect.right-SYSMETRICS_CXSIZE) return HTBOTTOMRIGHT;
340 /* Check left sizing border */
341 if (pt.x < rect.left)
343 if (pt.y < rect.top+SYSMETRICS_CYSIZE) return HTTOPLEFT;
344 if (pt.y >= rect.bottom-SYSMETRICS_CYSIZE) return HTBOTTOMLEFT;
347 /* Check right sizing border */
348 if (pt.x >= rect.right)
350 if (pt.y < rect.top+SYSMETRICS_CYSIZE) return HTTOPRIGHT;
351 if (pt.y >= rect.bottom-SYSMETRICS_CYSIZE) return HTBOTTOMRIGHT;
356 else /* No thick frame */
358 if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle ))
359 InflateRect16(&rect, -SYSMETRICS_CXDLGFRAME, -SYSMETRICS_CYDLGFRAME);
360 else if (wndPtr->dwStyle & WS_BORDER)
361 InflateRect16(&rect, -SYSMETRICS_CXBORDER, -SYSMETRICS_CYBORDER);
362 if (!PtInRect16( &rect, pt )) return HTBORDER;
367 if ((wndPtr->dwStyle & WS_CAPTION) == WS_CAPTION)
369 rect.top += SYSMETRICS_CYCAPTION - 1;
370 if (!PtInRect16( &rect, pt ))
372 /* Check system menu */
373 if (wndPtr->dwStyle & WS_SYSMENU)
374 rect.left += SYSMETRICS_CXSIZE;
375 if (pt.x <= rect.left) return HTSYSMENU;
376 /* Check maximize box */
377 if (wndPtr->dwStyle & WS_MAXIMIZEBOX)
378 rect.right -= SYSMETRICS_CXSIZE + 1;
379 if (pt.x >= rect.right) return HTMAXBUTTON;
380 /* Check minimize box */
381 if (wndPtr->dwStyle & WS_MINIMIZEBOX)
382 rect.right -= SYSMETRICS_CXSIZE + 1;
383 if (pt.x >= rect.right) return HTMINBUTTON;
389 /* Check client area */
391 ScreenToClient16( hwnd, &pt );
392 GetClientRect16( hwnd, &rect );
393 if (PtInRect16( &rect, pt )) return HTCLIENT;
395 /* Check vertical scroll bar */
397 if (wndPtr->dwStyle & WS_VSCROLL)
399 rect.right += SYSMETRICS_CXVSCROLL;
400 if (PtInRect16( &rect, pt )) return HTVSCROLL;
403 /* Check horizontal scroll bar */
405 if (wndPtr->dwStyle & WS_HSCROLL)
407 rect.bottom += SYSMETRICS_CYHSCROLL;
408 if (PtInRect16( &rect, pt ))
411 if ((wndPtr->dwStyle & WS_VSCROLL) &&
412 (pt.x >= rect.right - SYSMETRICS_CXVSCROLL))
420 if (HAS_MENU(wndPtr))
422 if ((pt.y < 0) && (pt.x >= 0) && (pt.x < rect.right))
426 /* Should never get here */
431 /***********************************************************************
434 void NC_DrawSysButton( HWND hwnd, HDC hdc, BOOL down )
439 WND *wndPtr = WIN_FindWndPtr( hwnd );
441 if( !(wndPtr->flags & WIN_MANAGED) )
443 NC_GetInsideRect( hwnd, &rect );
444 hdcMem = CreateCompatibleDC( hdc );
445 hbitmap = SelectObject( hdcMem, hbitmapClose );
446 BitBlt( hdc, rect.left, rect.top, SYSMETRICS_CXSIZE, SYSMETRICS_CYSIZE,
447 hdcMem, (wndPtr->dwStyle & WS_CHILD) ? SYSMETRICS_CXSIZE : 0, 0,
448 down ? NOTSRCCOPY : SRCCOPY );
449 SelectObject( hdcMem, hbitmap );
455 /***********************************************************************
458 static void NC_DrawMaxButton( HWND hwnd, HDC hdc, BOOL down )
461 WND *wndPtr = WIN_FindWndPtr( hwnd );
463 if( !(wndPtr->flags & WIN_MANAGED) )
465 NC_GetInsideRect( hwnd, &rect );
466 GRAPH_DrawBitmap( hdc, (IsZoomed(hwnd) ?
467 (down ? hbitmapRestoreD : hbitmapRestore) :
468 (down ? hbitmapMaximizeD : hbitmapMaximize)),
469 rect.right - SYSMETRICS_CXSIZE - 1, rect.top,
470 0, 0, SYSMETRICS_CXSIZE+1, SYSMETRICS_CYSIZE );
475 /***********************************************************************
478 static void NC_DrawMinButton( HWND hwnd, HDC hdc, BOOL down )
481 WND *wndPtr = WIN_FindWndPtr( hwnd );
483 if( !(wndPtr->flags & WIN_MANAGED) )
485 NC_GetInsideRect( hwnd, &rect );
486 if (wndPtr->dwStyle & WS_MAXIMIZEBOX) rect.right -= SYSMETRICS_CXSIZE + 1;
487 GRAPH_DrawBitmap( hdc, (down ? hbitmapMinimizeD : hbitmapMinimize),
488 rect.right - SYSMETRICS_CXSIZE - 1, rect.top,
489 0, 0, SYSMETRICS_CXSIZE+1, SYSMETRICS_CYSIZE );
494 /***********************************************************************
497 * Draw a window frame inside the given rectangle, and update the rectangle.
498 * The correct pen for the frame must be selected in the DC.
500 static void NC_DrawFrame( HDC hdc, RECT16 *rect, BOOL dlgFrame, BOOL active )
502 short width, height, tmp;
506 width = SYSMETRICS_CXDLGFRAME - 1;
507 height = SYSMETRICS_CYDLGFRAME - 1;
508 SelectObject( hdc, active ? sysColorObjects.hbrushActiveCaption :
509 sysColorObjects.hbrushInactiveCaption );
513 width = SYSMETRICS_CXFRAME - 1;
514 height = SYSMETRICS_CYFRAME - 1;
515 SelectObject( hdc, active ? sysColorObjects.hbrushActiveBorder :
516 sysColorObjects.hbrushInactiveBorder );
520 PatBlt( hdc, rect->left, rect->top,
521 rect->right - rect->left, height, PATCOPY );
522 PatBlt( hdc, rect->left, rect->top,
523 width, rect->bottom - rect->top, PATCOPY );
524 PatBlt( hdc, rect->left, rect->bottom,
525 rect->right - rect->left, -height, PATCOPY );
526 PatBlt( hdc, rect->right, rect->top,
527 -width, rect->bottom - rect->top, PATCOPY );
531 InflateRect16( rect, -width, -height );
535 /* Draw inner rectangle */
536 MoveTo( hdc, rect->left+width, rect->top+height );
537 LineTo( hdc, rect->right-width-1, rect->top+height );
538 LineTo( hdc, rect->right-width-1, rect->bottom-height-1 );
539 LineTo( hdc, rect->left+width, rect->bottom-height-1 );
540 LineTo( hdc, rect->left+width, rect->top+height );
542 /* Draw the decorations */
543 tmp = rect->top + SYSMETRICS_CYFRAME + SYSMETRICS_CYSIZE;
544 MoveTo( hdc, rect->left, tmp);
545 LineTo( hdc, rect->left+width, tmp );
546 MoveTo( hdc, rect->right-width-1, tmp );
547 LineTo( hdc, rect->right-1, tmp );
549 tmp = rect->bottom - 1 - SYSMETRICS_CYFRAME - SYSMETRICS_CYSIZE;
550 MoveTo( hdc, rect->left, tmp );
551 LineTo( hdc, rect->left+width, tmp );
552 MoveTo( hdc, rect->right-width-1, tmp );
553 LineTo( hdc, rect->right-1, tmp );
555 tmp = rect->left + SYSMETRICS_CXFRAME + SYSMETRICS_CXSIZE;
556 MoveTo( hdc, tmp, rect->top );
557 LineTo( hdc, tmp, rect->top+height );
558 MoveTo( hdc, tmp, rect->bottom-height-1 );
559 LineTo( hdc, tmp, rect->bottom-1 );
561 tmp = rect->right - 1 - SYSMETRICS_CXFRAME - SYSMETRICS_CYSIZE;
562 MoveTo( hdc, tmp, rect->top );
563 LineTo( hdc, tmp, rect->top+height );
564 MoveTo( hdc, tmp, rect->bottom-height-1 );
565 LineTo( hdc, tmp, rect->bottom-1 );
567 InflateRect16( rect, -width-1, -height-1 );
571 /***********************************************************************
574 * Draw the frame used when moving or resizing window.
576 static void NC_DrawMovingFrame( HDC hdc, RECT16 *rect, BOOL thickframe )
580 SelectObject( hdc, GetStockObject( GRAY_BRUSH ) );
581 PatBlt( hdc, rect->left, rect->top,
582 rect->right - rect->left - SYSMETRICS_CXFRAME,
583 SYSMETRICS_CYFRAME, PATINVERT );
584 PatBlt( hdc, rect->left, rect->top + SYSMETRICS_CYFRAME,
586 rect->bottom - rect->top - SYSMETRICS_CYFRAME, PATINVERT );
587 PatBlt( hdc, rect->left + SYSMETRICS_CXFRAME, rect->bottom,
588 rect->right - rect->left - SYSMETRICS_CXFRAME,
589 -SYSMETRICS_CYFRAME, PATINVERT );
590 PatBlt( hdc, rect->right, rect->top, -SYSMETRICS_CXFRAME,
591 rect->bottom - rect->top - SYSMETRICS_CYFRAME, PATINVERT );
593 else DrawFocusRect16( hdc, rect );
597 /***********************************************************************
600 * Draw the window caption.
601 * The correct pen for the window frame must be selected in the DC.
603 static void NC_DrawCaption( HDC hdc, RECT16 *rect, HWND hwnd,
604 DWORD style, BOOL active )
607 WND * wndPtr = WIN_FindWndPtr( hwnd );
610 if (wndPtr->flags & WIN_MANAGED) return;
614 if (!(hbitmapClose = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_CLOSE) )))
616 hbitmapMinimize = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_REDUCE) );
617 hbitmapMinimizeD = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_REDUCED) );
618 hbitmapMaximize = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_ZOOM) );
619 hbitmapMaximizeD = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_ZOOMD) );
620 hbitmapRestore = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_RESTORE) );
621 hbitmapRestoreD = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_RESTORED) );
624 if (wndPtr->dwExStyle & WS_EX_DLGMODALFRAME)
626 HBRUSH16 hbrushOld = SelectObject( hdc, sysColorObjects.hbrushWindow );
627 PatBlt( hdc, r.left, r.top, 1, r.bottom-r.top+1,PATCOPY );
628 PatBlt( hdc, r.right-1, r.top, 1, r.bottom-r.top+1, PATCOPY );
629 PatBlt( hdc, r.left, r.top-1, r.right-r.left, 1, PATCOPY );
632 SelectObject( hdc, hbrushOld );
635 MoveTo( hdc, r.left, r.bottom );
636 LineTo( hdc, r.right-1, r.bottom );
638 if (style & WS_SYSMENU)
640 NC_DrawSysButton( hwnd, hdc, FALSE );
641 r.left += SYSMETRICS_CXSIZE + 1;
642 MoveTo( hdc, r.left - 1, r.top );
643 LineTo( hdc, r.left - 1, r.bottom );
645 if (style & WS_MAXIMIZEBOX)
647 NC_DrawMaxButton( hwnd, hdc, FALSE );
648 r.right -= SYSMETRICS_CXSIZE + 1;
650 if (style & WS_MINIMIZEBOX)
652 NC_DrawMinButton( hwnd, hdc, FALSE );
653 r.right -= SYSMETRICS_CXSIZE + 1;
656 FillRect16( hdc, &r, active ? sysColorObjects.hbrushActiveCaption :
657 sysColorObjects.hbrushInactiveCaption );
659 if (GetWindowText32A( hwnd, buffer, sizeof(buffer) ))
661 if (active) SetTextColor( hdc, GetSysColor( COLOR_CAPTIONTEXT ) );
662 else SetTextColor( hdc, GetSysColor( COLOR_INACTIVECAPTIONTEXT ) );
663 SetBkMode( hdc, TRANSPARENT );
664 DrawText16( hdc, buffer, -1, &r,
665 DT_SINGLELINE | DT_CENTER | DT_VCENTER | DT_NOPREFIX );
670 /***********************************************************************
673 * Paint the non-client area. clip is currently unused.
675 void NC_DoNCPaint( HWND hwnd, HRGN32 clip, BOOL suppress_menupaint )
681 WND *wndPtr = WIN_FindWndPtr( hwnd );
683 if (!wndPtr || wndPtr->dwStyle & WS_MINIMIZE ||
684 !WIN_IsWindowDrawable( wndPtr, 0 )) return; /* Nothing to do */
686 active = wndPtr->flags & WIN_NCACTIVATED;
688 dprintf_nonclient(stddeb, "NC_DoNCPaint: %04x %d\n", hwnd, active );
690 if (!(hdc = GetDCEx32( hwnd, 0, DCX_USESTYLE | DCX_WINDOW ))) return;
692 if (ExcludeVisRect( hdc, wndPtr->rectClient.left-wndPtr->rectWindow.left,
693 wndPtr->rectClient.top-wndPtr->rectWindow.top,
694 wndPtr->rectClient.right-wndPtr->rectWindow.left,
695 wndPtr->rectClient.bottom-wndPtr->rectWindow.top )
698 ReleaseDC32( hwnd, hdc );
702 rect.top = rect.left = 0;
703 rect.right = wndPtr->rectWindow.right - wndPtr->rectWindow.left;
704 rect.bottom = wndPtr->rectWindow.bottom - wndPtr->rectWindow.top;
706 SelectObject( hdc, sysColorObjects.hpenWindowFrame );
708 if (!(wndPtr->flags & WIN_MANAGED))
710 if ((wndPtr->dwStyle & WS_BORDER) || (wndPtr->dwStyle & WS_DLGFRAME) ||
711 (wndPtr->dwExStyle & WS_EX_DLGMODALFRAME))
714 LineTo( hdc, rect.right-1, 0 );
715 LineTo( hdc, rect.right-1, rect.bottom-1 );
716 LineTo( hdc, 0, rect.bottom-1 );
718 InflateRect16( &rect, -1, -1 );
721 if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle ))
722 NC_DrawFrame( hdc, &rect, TRUE, active );
723 else if (wndPtr->dwStyle & WS_THICKFRAME)
724 NC_DrawFrame(hdc, &rect, FALSE, active );
726 if ((wndPtr->dwStyle & WS_CAPTION) == WS_CAPTION)
729 r.bottom = rect.top + SYSMETRICS_CYSIZE;
730 rect.top += SYSMETRICS_CYSIZE + SYSMETRICS_CYBORDER;
731 NC_DrawCaption( hdc, &r, hwnd, wndPtr->dwStyle, active );
735 if (HAS_MENU(wndPtr))
738 r.bottom = rect.top + SYSMETRICS_CYMENU; /* default height */
739 rect.top += MENU_DrawMenuBar( hdc, &r, hwnd, suppress_menupaint );
742 /* Draw the scroll-bars */
744 if (wndPtr->dwStyle & WS_VSCROLL)
745 SCROLL_DrawScrollBar( hwnd, hdc, SB_VERT, TRUE );
746 if (wndPtr->dwStyle & WS_HSCROLL)
747 SCROLL_DrawScrollBar( hwnd, hdc, SB_HORZ, TRUE );
749 /* Draw the "size-box" */
751 if ((wndPtr->dwStyle & WS_VSCROLL) && (wndPtr->dwStyle & WS_HSCROLL))
754 r.left = r.right - SYSMETRICS_CXVSCROLL + 1;
755 r.top = r.bottom - SYSMETRICS_CYHSCROLL + 1;
756 FillRect16( hdc, &r, sysColorObjects.hbrushScrollbar );
759 ReleaseDC32( hwnd, hdc );
764 /***********************************************************************
767 * Handle a WM_NCPAINT message. Called from DefWindowProc().
769 LONG NC_HandleNCPaint( HWND hwnd , HRGN32 clip)
771 NC_DoNCPaint( hwnd, clip, FALSE );
776 /***********************************************************************
777 * NC_HandleNCActivate
779 * Handle a WM_NCACTIVATE message. Called from DefWindowProc().
781 LONG NC_HandleNCActivate( WND *wndPtr, WPARAM wParam )
785 if( wParam ) wStateChange = !(wndPtr->flags & WIN_NCACTIVATED);
786 else wStateChange = wndPtr->flags & WIN_NCACTIVATED;
790 if (wParam) wndPtr->flags |= WIN_NCACTIVATED;
791 else wndPtr->flags &= ~WIN_NCACTIVATED;
793 if( wndPtr->dwStyle & WS_MINIMIZE )
794 PAINT_RedrawWindow( wndPtr->hwndSelf, NULL, 0, RDW_INVALIDATE | RDW_ERASE | RDW_ERASENOW, 0 );
796 NC_DoNCPaint( wndPtr->hwndSelf, (HRGN32)1, FALSE );
802 /***********************************************************************
805 * Handle a WM_SETCURSOR message. Called from DefWindowProc().
807 LONG NC_HandleSetCursor( HWND hwnd, WPARAM wParam, LPARAM lParam )
809 if (hwnd != (HWND)wParam) return 0; /* Don't set the cursor for child windows */
811 switch(LOWORD(lParam))
815 WORD msg = HIWORD( lParam );
816 if ((msg == WM_LBUTTONDOWN) || (msg == WM_MBUTTONDOWN) ||
817 (msg == WM_RBUTTONDOWN))
825 if (!(wndPtr = WIN_FindWndPtr( hwnd ))) break;
826 if (wndPtr->class->hCursor)
828 SetCursor( wndPtr->class->hCursor );
836 return (LONG)SetCursor( LoadCursor16( 0, IDC_SIZEWE ) );
840 return (LONG)SetCursor( LoadCursor16( 0, IDC_SIZENS ) );
844 return (LONG)SetCursor( LoadCursor16( 0, IDC_SIZENWSE ) );
848 return (LONG)SetCursor( LoadCursor16( 0, IDC_SIZENESW ) );
851 /* Default cursor: arrow */
852 return (LONG)SetCursor( LoadCursor16( 0, IDC_ARROW ) );
855 /***********************************************************************
858 BOOL NC_GetSysPopupPos( WND* wndPtr, RECT16* rect )
860 if( !wndPtr->hSysMenu ) return FALSE;
862 NC_GetInsideRect( wndPtr->hwndSelf, rect );
863 OffsetRect16( rect, wndPtr->rectWindow.left, wndPtr->rectWindow.top );
864 if (wndPtr->dwStyle & WS_CHILD)
865 ClientToScreen16( wndPtr->parent->hwndSelf, (POINT16 *)rect );
866 rect->right = rect->left + SYSMETRICS_CXSIZE;
867 rect->bottom = rect->top + SYSMETRICS_CYSIZE;
871 /***********************************************************************
874 * Track a mouse button press on the system menu.
876 static void NC_TrackSysMenu( HWND hwnd, HDC hdc, POINT16 pt )
879 WND *wndPtr = WIN_FindWndPtr( hwnd );
880 int iconic = wndPtr->dwStyle & WS_MINIMIZE;
883 if (!(wndPtr->dwStyle & WS_SYSMENU)) return;
885 /* If window has a menu, track the menu bar normally if it not minimized */
886 if (HAS_MENU(wndPtr) && !iconic) MENU_TrackMouseMenuBar( hwnd, pt );
889 /* Otherwise track the system menu like a normal popup menu */
891 NC_GetSysPopupPos( wndPtr, &rect );
892 if (!iconic) NC_DrawSysButton( hwnd, hdc, TRUE );
893 hmenu = GetSystemMenu(hwnd, 0);
894 MENU_InitSysMenuPopup(hmenu, wndPtr->dwStyle,
895 wndPtr->class->style);
896 TrackPopupMenu16( hmenu, TPM_LEFTALIGN | TPM_LEFTBUTTON,
897 rect.left, rect.bottom, 0, hwnd, &rect );
898 if (!iconic) NC_DrawSysButton( hwnd, hdc, FALSE );
903 /***********************************************************************
906 * Initialisation of a move or resize, when initiatied from a menu choice.
907 * Return hit test code for caption or sizing border.
909 static LONG NC_StartSizeMove( HWND hwnd, WPARAM wParam, POINT16 *capturePoint )
914 WND * wndPtr = WIN_FindWndPtr( hwnd );
916 if ((wParam & 0xfff0) == SC_MOVE)
918 /* Move pointer at the center of the caption */
920 NC_GetInsideRect( hwnd, &rect );
921 if (wndPtr->dwStyle & WS_SYSMENU)
922 rect.left += SYSMETRICS_CXSIZE + 1;
923 if (wndPtr->dwStyle & WS_MINIMIZEBOX)
924 rect.right -= SYSMETRICS_CXSIZE + 1;
925 if (wndPtr->dwStyle & WS_MAXIMIZEBOX)
926 rect.right -= SYSMETRICS_CXSIZE + 1;
927 pt.x = wndPtr->rectWindow.left + (rect.right - rect.left) / 2;
928 pt.y = wndPtr->rectWindow.top + rect.top + SYSMETRICS_CYSIZE/2;
929 if (wndPtr->dwStyle & WS_CHILD)
930 ClientToScreen16( wndPtr->parent->hwndSelf, &pt );
938 MSG_InternalGetMessage( &msg, 0, 0, MSGF_SIZE, PM_REMOVE, FALSE );
942 hittest = NC_HandleNCHitTest( hwnd, msg.pt );
944 if ((hittest < HTLEFT) || (hittest > HTBOTTOMRIGHT))
956 pt.x =(wndPtr->rectWindow.left+wndPtr->rectWindow.right)/2;
957 pt.y = wndPtr->rectWindow.top + SYSMETRICS_CYFRAME / 2;
961 pt.x =(wndPtr->rectWindow.left+wndPtr->rectWindow.right)/2;
962 pt.y = wndPtr->rectWindow.bottom - SYSMETRICS_CYFRAME / 2;
966 pt.x = wndPtr->rectWindow.left + SYSMETRICS_CXFRAME / 2;
967 pt.y =(wndPtr->rectWindow.top+wndPtr->rectWindow.bottom)/2;
971 pt.x = wndPtr->rectWindow.right - SYSMETRICS_CXFRAME / 2;
972 pt.y =(wndPtr->rectWindow.top+wndPtr->rectWindow.bottom)/2;
975 case VK_ESCAPE: return 0;
981 SetCursorPos( capturePoint->x, capturePoint->y );
982 NC_HandleSetCursor( hwnd, (WPARAM)hwnd, MAKELONG( hittest, WM_MOUSEMOVE ));
987 /***********************************************************************
990 * Perform SC_MOVE and SC_SIZE commands.
992 static void NC_DoSizeMove( HWND hwnd, WORD wParam, POINT16 pt )
996 RECT16 sizingRect, mouseRect;
999 POINT16 minTrack, maxTrack, capturePoint = pt;
1000 WND * wndPtr = WIN_FindWndPtr( hwnd );
1003 if (IsZoomed(hwnd) || !IsWindowVisible(hwnd) ||
1004 (wndPtr->flags & WIN_MANAGED)) return;
1005 hittest = wParam & 0x0f;
1006 thickframe = HAS_THICKFRAME( wndPtr->dwStyle );
1008 if ((wParam & 0xfff0) == SC_MOVE)
1010 if (!(wndPtr->dwStyle & WS_CAPTION)) return;
1011 if (!hittest) hittest = NC_StartSizeMove( hwnd, wParam, &capturePoint );
1012 if (!hittest) return;
1016 if (!thickframe) return;
1017 if (hittest) hittest += HTLEFT-1;
1021 hittest = NC_StartSizeMove( hwnd, wParam, &capturePoint );
1030 /* Get min/max info */
1032 NC_GetMinMaxInfo( hwnd, NULL, NULL, &minTrack, &maxTrack );
1033 sizingRect = wndPtr->rectWindow;
1034 if (wndPtr->dwStyle & WS_CHILD)
1035 GetClientRect16( wndPtr->parent->hwndSelf, &mouseRect );
1036 else SetRect16(&mouseRect, 0, 0, SYSMETRICS_CXSCREEN, SYSMETRICS_CYSCREEN);
1037 if (ON_LEFT_BORDER(hittest))
1039 mouseRect.left = MAX( mouseRect.left, sizingRect.right-maxTrack.x );
1040 mouseRect.right = MIN( mouseRect.right, sizingRect.right-minTrack.x );
1042 else if (ON_RIGHT_BORDER(hittest))
1044 mouseRect.left = MAX( mouseRect.left, sizingRect.left+minTrack.x );
1045 mouseRect.right = MIN( mouseRect.right, sizingRect.left+maxTrack.x );
1047 if (ON_TOP_BORDER(hittest))
1049 mouseRect.top = MAX( mouseRect.top, sizingRect.bottom-maxTrack.y );
1050 mouseRect.bottom = MIN( mouseRect.bottom,sizingRect.bottom-minTrack.y);
1052 else if (ON_BOTTOM_BORDER(hittest))
1054 mouseRect.top = MAX( mouseRect.top, sizingRect.top+minTrack.y );
1055 mouseRect.bottom = MIN( mouseRect.bottom, sizingRect.top+maxTrack.y );
1057 SendMessage16( hwnd, WM_ENTERSIZEMOVE, 0, 0 );
1059 if (GetCapture32() != hwnd) SetCapture32( hwnd );
1061 if (wndPtr->dwStyle & WS_CHILD)
1063 /* Retrieve a default cache DC (without using the window style) */
1064 hdc = GetDCEx32( wndPtr->parent->hwndSelf, 0, DCX_CACHE );
1067 { /* Grab the server only when moving top-level windows without desktop */
1069 if (rootWindow == DefaultRootWindow(display)) XGrabServer( display );
1071 NC_DrawMovingFrame( hdc, &sizingRect, thickframe );
1077 MSG_InternalGetMessage( &msg, 0, 0, MSGF_SIZE, PM_REMOVE, FALSE );
1079 /* Exit on button-up, Return, or Esc */
1080 if ((msg.message == WM_LBUTTONUP) ||
1081 ((msg.message == WM_KEYDOWN) &&
1082 ((msg.wParam == VK_RETURN) || (msg.wParam == VK_ESCAPE)))) break;
1084 if ((msg.message != WM_KEYDOWN) && (msg.message != WM_MOUSEMOVE))
1085 continue; /* We are not interested in other messages */
1088 if (wndPtr->dwStyle & WS_CHILD)
1089 ScreenToClient16( wndPtr->parent->hwndSelf, &pt );
1091 if (msg.message == WM_KEYDOWN) switch(msg.wParam)
1093 case VK_UP: pt.y -= 8; break;
1094 case VK_DOWN: pt.y += 8; break;
1095 case VK_LEFT: pt.x -= 8; break;
1096 case VK_RIGHT: pt.x += 8; break;
1099 pt.x = MAX( pt.x, mouseRect.left );
1100 pt.x = MIN( pt.x, mouseRect.right );
1101 pt.y = MAX( pt.y, mouseRect.top );
1102 pt.y = MIN( pt.y, mouseRect.bottom );
1104 dx = pt.x - capturePoint.x;
1105 dy = pt.y - capturePoint.y;
1110 if (msg.message == WM_KEYDOWN) SetCursorPos( pt.x, pt.y );
1113 RECT16 newRect = sizingRect;
1115 if (hittest == HTCAPTION) OffsetRect16( &newRect, dx, dy );
1116 if (ON_LEFT_BORDER(hittest)) newRect.left += dx;
1117 else if (ON_RIGHT_BORDER(hittest)) newRect.right += dx;
1118 if (ON_TOP_BORDER(hittest)) newRect.top += dy;
1119 else if (ON_BOTTOM_BORDER(hittest)) newRect.bottom += dy;
1120 NC_DrawMovingFrame( hdc, &sizingRect, thickframe );
1121 NC_DrawMovingFrame( hdc, &newRect, thickframe );
1123 sizingRect = newRect;
1128 NC_DrawMovingFrame( hdc, &sizingRect, thickframe );
1131 if (wndPtr->dwStyle & WS_CHILD)
1132 ReleaseDC32( wndPtr->parent->hwndSelf, hdc );
1135 ReleaseDC32( 0, hdc );
1136 if (rootWindow == DefaultRootWindow(display)) XUngrabServer( display );
1139 if (HOOK_GetHook( WH_CBT, GetTaskQueue(0) ))
1141 RECT16* pr = SEGPTR_NEW(RECT16);
1145 if( HOOK_CallHooks( WH_CBT, HCBT_MOVESIZE, hwnd,
1146 (LPARAM)SEGPTR_GET(pr)) )
1147 sizingRect = wndPtr->rectWindow;
1153 SendMessage16( hwnd, WM_EXITSIZEMOVE, 0, 0 );
1154 SendMessage16( hwnd, WM_SETVISIBLE, !IsIconic(hwnd), 0L);
1156 /* Single click brings up the system menu when iconized */
1158 if (!moved && (wndPtr->dwStyle & WS_MINIMIZE))
1160 NC_TrackSysMenu( hwnd, hdc, pt );
1164 /* If Esc key, don't move the window */
1165 if ((msg.message == WM_KEYDOWN) && (msg.wParam == VK_ESCAPE)) return;
1167 if (hittest != HTCAPTION)
1168 SetWindowPos( hwnd, 0, sizingRect.left, sizingRect.top,
1169 sizingRect.right - sizingRect.left,
1170 sizingRect.bottom - sizingRect.top,
1171 SWP_NOACTIVATE | SWP_NOZORDER );
1172 else SetWindowPos( hwnd, 0, sizingRect.left, sizingRect.top, 0, 0,
1173 SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER );
1177 /***********************************************************************
1180 * Track a mouse button press on the minimize or maximize box.
1182 static void NC_TrackMinMaxBox( HWND hwnd, WORD wParam )
1185 HDC32 hdc = GetWindowDC32( hwnd );
1186 BOOL pressed = TRUE;
1188 SetCapture32( hwnd );
1189 if (wParam == HTMINBUTTON) NC_DrawMinButton( hwnd, hdc, TRUE );
1190 else NC_DrawMaxButton( hwnd, hdc, TRUE );
1194 BOOL oldstate = pressed;
1195 MSG_InternalGetMessage( &msg, 0, 0, 0, PM_REMOVE, FALSE );
1197 pressed = (NC_HandleNCHitTest( hwnd, msg.pt ) == wParam);
1198 if (pressed != oldstate)
1200 if (wParam == HTMINBUTTON) NC_DrawMinButton( hwnd, hdc, pressed );
1201 else NC_DrawMaxButton( hwnd, hdc, pressed );
1203 } while (msg.message != WM_LBUTTONUP);
1205 if (wParam == HTMINBUTTON) NC_DrawMinButton( hwnd, hdc, FALSE );
1206 else NC_DrawMaxButton( hwnd, hdc, FALSE );
1209 ReleaseDC32( hwnd, hdc );
1210 if (!pressed) return;
1212 if (wParam == HTMINBUTTON)
1213 SendMessage16( hwnd, WM_SYSCOMMAND, SC_MINIMIZE, *(LONG*)&msg.pt );
1215 SendMessage16( hwnd, WM_SYSCOMMAND,
1216 IsZoomed(hwnd) ? SC_RESTORE : SC_MAXIMIZE, *(LONG*)&msg.pt );
1220 /***********************************************************************
1223 * Track a mouse button press on the horizontal or vertical scroll-bar.
1225 static void NC_TrackScrollBar( HWND32 hwnd, WPARAM32 wParam, POINT32 pt )
1229 WND *wndPtr = WIN_FindWndPtr( hwnd );
1231 if ((wParam & 0xfff0) == SC_HSCROLL)
1233 if ((wParam & 0x0f) != HTHSCROLL) return;
1234 scrollbar = SB_HORZ;
1236 else /* SC_VSCROLL */
1238 if ((wParam & 0x0f) != HTVSCROLL) return;
1239 scrollbar = SB_VERT;
1242 if (!(msg = SEGPTR_NEW(MSG16))) return;
1243 pt.x -= wndPtr->rectWindow.left;
1244 pt.y -= wndPtr->rectWindow.top;
1245 SetCapture32( hwnd );
1246 SCROLL_HandleScrollEvent( hwnd, scrollbar, WM_LBUTTONDOWN, pt );
1250 GetMessage( SEGPTR_GET(msg), 0, 0, 0 );
1251 switch(msg->message)
1256 pt.x = LOWORD(msg->lParam) + wndPtr->rectClient.left -
1257 wndPtr->rectWindow.left;
1258 pt.y = HIWORD(msg->lParam) + wndPtr->rectClient.top -
1259 wndPtr->rectWindow.top;
1260 SCROLL_HandleScrollEvent( hwnd, scrollbar, msg->message, pt );
1263 TranslateMessage( msg );
1264 DispatchMessage( msg );
1267 if (!IsWindow( hwnd ))
1272 } while (msg->message != WM_LBUTTONUP);
1276 /***********************************************************************
1277 * NC_HandleNCLButtonDown
1279 * Handle a WM_NCLBUTTONDOWN message. Called from DefWindowProc().
1281 LONG NC_HandleNCLButtonDown( HWND hwnd, WPARAM wParam, LPARAM lParam )
1285 switch(wParam) /* Hit test */
1288 SendMessage16( hwnd, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, lParam );
1292 hdc = GetWindowDC32( hwnd );
1293 NC_TrackSysMenu( hwnd, hdc, MAKEPOINT16(lParam) );
1294 ReleaseDC32( hwnd, hdc );
1298 SendMessage16( hwnd, WM_SYSCOMMAND, SC_MOUSEMENU, lParam );
1302 SendMessage16( hwnd, WM_SYSCOMMAND, SC_HSCROLL + HTHSCROLL, lParam );
1306 SendMessage16( hwnd, WM_SYSCOMMAND, SC_VSCROLL + HTVSCROLL, lParam );
1311 NC_TrackMinMaxBox( hwnd, wParam );
1322 SendMessage16( hwnd, WM_SYSCOMMAND, SC_SIZE + wParam - HTLEFT+1, lParam);
1332 /***********************************************************************
1333 * NC_HandleNCLButtonDblClk
1335 * Handle a WM_NCLBUTTONDBLCLK message. Called from DefWindowProc().
1337 LONG NC_HandleNCLButtonDblClk( WND *pWnd, WPARAM wParam, LPARAM lParam )
1340 * if this is an icon, send a restore since we are handling
1343 if (pWnd->dwStyle & WS_MINIMIZE)
1345 SendMessage16( pWnd->hwndSelf, WM_SYSCOMMAND, SC_RESTORE, lParam );
1349 switch(wParam) /* Hit test */
1352 /* stop processing if WS_MAXIMIZEBOX is missing */
1353 if (pWnd->dwStyle & WS_MAXIMIZEBOX)
1354 SendMessage16( pWnd->hwndSelf, WM_SYSCOMMAND,
1355 (pWnd->dwStyle & WS_MAXIMIZE) ? SC_RESTORE : SC_MAXIMIZE,
1360 if (!(pWnd->class->style & CS_NOCLOSE))
1361 SendMessage16( pWnd->hwndSelf, WM_SYSCOMMAND, SC_CLOSE, lParam );
1368 /***********************************************************************
1369 * NC_HandleSysCommand
1371 * Handle a WM_SYSCOMMAND message. Called from DefWindowProc().
1373 LONG NC_HandleSysCommand( HWND hwnd, WPARAM wParam, POINT16 pt )
1375 WND *wndPtr = WIN_FindWndPtr( hwnd );
1378 dprintf_nonclient(stddeb, "Handling WM_SYSCOMMAND %x %d,%d\n",
1379 wParam, pt.x, pt.y );
1381 if (wndPtr->dwStyle & WS_CHILD && wParam != SC_KEYMENU )
1382 ScreenToClient16( wndPtr->parent->hwndSelf, &pt );
1384 switch (wParam & 0xfff0)
1388 NC_DoSizeMove( hwnd, wParam, pt );
1392 ShowWindow( hwnd, SW_MINIMIZE );
1396 ShowWindow( hwnd, SW_MAXIMIZE );
1400 ShowWindow( hwnd, SW_RESTORE );
1408 return SendMessage16( hwnd, WM_CLOSE, 0, 0 );
1412 CONV_POINT16TO32( &pt, &pt32 );
1413 NC_TrackScrollBar( hwnd, wParam, pt32 );
1417 MENU_TrackMouseMenuBar( hwnd, pt );
1421 MENU_TrackKbdMenuBar( wndPtr , wParam , pt.x );
1428 WinExec( "taskman.exe", SW_SHOWNORMAL );
1435 if (wParam == SC_ABOUTWINE)
1437 extern const char people[];
1438 ShellAbout(hwnd,"WINE",people,0);