2 * Non-client area window functions
4 * Copyright 1994 Alexandre Julliard
10 #include "sysmetrics.h"
18 #include "nonclient.h"
21 #include "selectors.h"
22 #include "stackframe.h"
24 /* #define DEBUG_NONCLIENT */
29 static HBITMAP hbitmapClose
= 0;
30 static HBITMAP hbitmapMinimize
= 0;
31 static HBITMAP hbitmapMinimizeD
= 0;
32 static HBITMAP hbitmapMaximize
= 0;
33 static HBITMAP hbitmapMaximizeD
= 0;
34 static HBITMAP hbitmapRestore
= 0;
35 static HBITMAP 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( LPRECT rect
, DWORD style
, BOOL menu
, DWORD exStyle
)
67 if (style
& WS_ICONIC
) return; /* Nothing to change for an icon */
69 /* Decide if the window will be managed (see CreateWindowEx) */
70 if (!(Options
.managed
&& ((style
& (WS_DLGFRAME
| WS_THICKFRAME
)) ||
71 (exStyle
& WS_EX_DLGMODALFRAME
))))
73 if (HAS_DLGFRAME( style
, exStyle
))
74 InflateRect( rect
, SYSMETRICS_CXDLGFRAME
, SYSMETRICS_CYDLGFRAME
);
77 if (HAS_THICKFRAME(style
))
78 InflateRect( rect
, SYSMETRICS_CXFRAME
, SYSMETRICS_CYFRAME
);
79 if (style
& WS_BORDER
)
80 InflateRect( 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 * AdjustWindowRect (USER.102)
96 BOOL
AdjustWindowRect( LPRECT rect
, DWORD style
, BOOL menu
)
98 return AdjustWindowRectEx( rect
, style
, menu
, 0 );
102 /***********************************************************************
103 * AdjustWindowRectEx (USER.454)
105 BOOL
AdjustWindowRectEx( LPRECT rect
, DWORD style
, BOOL menu
, DWORD exStyle
)
107 /* Correct the window style */
109 if (!(style
& (WS_POPUP
| WS_CHILD
))) /* Overlapped window */
111 if (exStyle
& WS_EX_DLGMODALFRAME
) style
&= ~WS_THICKFRAME
;
113 dprintf_nonclient(stddeb
, "AdjustWindowRectEx: (%d,%d)-(%d,%d) %08lx %d %08lx\n",
114 rect
->left
, rect
->top
, rect
->right
, rect
->bottom
,
115 style
, menu
, exStyle
);
117 NC_AdjustRect( rect
, style
, menu
, exStyle
);
122 /*******************************************************************
125 * Get the minimized and maximized information for a window.
127 void NC_GetMinMaxInfo( HWND hwnd
, POINT
*maxSize
, POINT
*maxPos
,
128 POINT
*minTrack
, POINT
*maxTrack
)
132 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
134 /* Compute default values */
136 MinMax
.ptMaxSize
.x
= SYSMETRICS_CXSCREEN
;
137 MinMax
.ptMaxSize
.y
= SYSMETRICS_CYSCREEN
;
138 MinMax
.ptMinTrackSize
.x
= SYSMETRICS_CXMINTRACK
;
139 MinMax
.ptMinTrackSize
.y
= SYSMETRICS_CYMINTRACK
;
140 MinMax
.ptMaxTrackSize
.x
= SYSMETRICS_CXSCREEN
;
141 MinMax
.ptMaxTrackSize
.y
= SYSMETRICS_CYSCREEN
;
143 if (wndPtr
->flags
& WIN_MANAGED
) xinc
= yinc
= 0;
144 else if (HAS_DLGFRAME( wndPtr
->dwStyle
, wndPtr
->dwExStyle
))
146 xinc
= SYSMETRICS_CXDLGFRAME
;
147 yinc
= SYSMETRICS_CYDLGFRAME
;
152 if (HAS_THICKFRAME(wndPtr
->dwStyle
))
154 xinc
+= SYSMETRICS_CXFRAME
;
155 yinc
+= SYSMETRICS_CYFRAME
;
157 if (wndPtr
->dwStyle
& WS_BORDER
)
159 xinc
+= SYSMETRICS_CXBORDER
;
160 yinc
+= SYSMETRICS_CYBORDER
;
163 MinMax
.ptMaxSize
.x
+= 2 * xinc
;
164 MinMax
.ptMaxSize
.y
+= 2 * yinc
;
166 /* Note: The '+' in the following test should really be a ||, but
167 * that would cause gcc-2.7.0 to generate incorrect code.
169 if ((wndPtr
->ptMaxPos
.x
!= -1) + (wndPtr
->ptMaxPos
.y
!= -1))
170 MinMax
.ptMaxPosition
= wndPtr
->ptMaxPos
;
173 MinMax
.ptMaxPosition
.x
= -xinc
;
174 MinMax
.ptMaxPosition
.y
= -yinc
;
177 SendMessage( hwnd
, WM_GETMINMAXINFO
, 0, (LPARAM
)MAKE_SEGPTR(&MinMax
) );
179 /* Some sanity checks */
181 dprintf_nonclient(stddeb
,
182 "NC_GetMinMaxInfo: %d %d / %d %d / %d %d / %d %d\n",
183 (int)MinMax
.ptMaxSize
.x
,(int)MinMax
.ptMaxSize
.y
,
184 (int)MinMax
.ptMaxPosition
.x
,(int)MinMax
.ptMaxPosition
.y
,
185 (int)MinMax
.ptMaxTrackSize
.x
,(int)MinMax
.ptMaxTrackSize
.y
,
186 (int)MinMax
.ptMinTrackSize
.x
,(int)MinMax
.ptMinTrackSize
.y
);
187 MinMax
.ptMaxTrackSize
.x
= MAX( MinMax
.ptMaxTrackSize
.x
,
188 MinMax
.ptMinTrackSize
.x
);
189 MinMax
.ptMaxTrackSize
.y
= MAX( MinMax
.ptMaxTrackSize
.y
,
190 MinMax
.ptMinTrackSize
.y
);
192 if (maxSize
) *maxSize
= MinMax
.ptMaxSize
;
193 if (maxPos
) *maxPos
= MinMax
.ptMaxPosition
;
194 if (minTrack
) *minTrack
= MinMax
.ptMinTrackSize
;
195 if (maxTrack
) *maxTrack
= MinMax
.ptMaxTrackSize
;
199 /***********************************************************************
200 * NC_HandleNCCalcSize
202 * Handle a WM_NCCALCSIZE message. Called from DefWindowProc().
204 LONG
NC_HandleNCCalcSize( HWND hwnd
, NCCALCSIZE_PARAMS
*params
)
206 RECT tmpRect
= { 0, 0, 0, 0 };
207 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
209 if (!wndPtr
) return 0;
210 NC_AdjustRect( &tmpRect
, wndPtr
->dwStyle
, FALSE
, wndPtr
->dwExStyle
);
211 params
->rgrc
[0].left
-= tmpRect
.left
;
212 params
->rgrc
[0].top
-= tmpRect
.top
;
213 params
->rgrc
[0].right
-= tmpRect
.right
;
214 params
->rgrc
[0].bottom
-= tmpRect
.bottom
;
216 if (HAS_MENU(wndPtr
))
218 params
->rgrc
[0].top
+= MENU_GetMenuBarHeight( hwnd
,
219 params
->rgrc
[0].right
- params
->rgrc
[0].left
,
220 -tmpRect
.left
, -tmpRect
.top
) + 1;
226 /***********************************************************************
229 * Get the 'inside' rectangle of a window, i.e. the whole window rectangle
230 * but without the borders (if any).
231 * The rectangle is in window coordinates (for drawing with GetWindowDC()).
233 void NC_GetInsideRect( HWND hwnd
, RECT
*rect
)
235 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
237 rect
->top
= rect
->left
= 0;
238 rect
->right
= wndPtr
->rectWindow
.right
- wndPtr
->rectWindow
.left
;
239 rect
->bottom
= wndPtr
->rectWindow
.bottom
- wndPtr
->rectWindow
.top
;
241 if (wndPtr
->dwStyle
& WS_ICONIC
) return; /* No border to remove */
242 if (wndPtr
->flags
& WIN_MANAGED
) return;
244 /* Remove frame from rectangle */
245 if (HAS_DLGFRAME( wndPtr
->dwStyle
, wndPtr
->dwExStyle
))
247 InflateRect( rect
, -SYSMETRICS_CXDLGFRAME
, -SYSMETRICS_CYDLGFRAME
);
248 if (wndPtr
->dwExStyle
& WS_EX_DLGMODALFRAME
) InflateRect( rect
, -1, 0);
252 if (HAS_THICKFRAME( wndPtr
->dwStyle
))
253 InflateRect( rect
, -SYSMETRICS_CXFRAME
, -SYSMETRICS_CYFRAME
);
254 if (wndPtr
->dwStyle
& WS_BORDER
)
255 InflateRect( rect
, -SYSMETRICS_CXBORDER
, -SYSMETRICS_CYBORDER
);
260 /***********************************************************************
263 * Handle a WM_NCHITTEST message. Called from DefWindowProc().
265 LONG
NC_HandleNCHitTest( HWND hwnd
, POINT pt
)
268 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
269 if (!wndPtr
) return HTERROR
;
271 dprintf_nonclient(stddeb
, "NC_HandleNCHitTest: hwnd=%04x pt=%d,%d\n",
274 GetWindowRect( hwnd
, &rect
);
275 if (!PtInRect( &rect
, pt
)) return HTNOWHERE
;
277 if (wndPtr
->dwStyle
& WS_MINIMIZE
) return HTCAPTION
;
279 if (!(wndPtr
->flags
& WIN_MANAGED
))
282 if (HAS_THICKFRAME( wndPtr
->dwStyle
))
284 InflateRect( &rect
, -SYSMETRICS_CXFRAME
, -SYSMETRICS_CYFRAME
);
285 if (wndPtr
->dwStyle
& WS_BORDER
)
286 InflateRect(&rect
, -SYSMETRICS_CXBORDER
, -SYSMETRICS_CYBORDER
);
287 if (!PtInRect( &rect
, pt
))
289 /* Check top sizing border */
292 if (pt
.x
< rect
.left
+SYSMETRICS_CXSIZE
) return HTTOPLEFT
;
293 if (pt
.x
>= rect
.right
-SYSMETRICS_CXSIZE
) return HTTOPRIGHT
;
296 /* Check bottom sizing border */
297 if (pt
.y
>= rect
.bottom
)
299 if (pt
.x
< rect
.left
+SYSMETRICS_CXSIZE
) return HTBOTTOMLEFT
;
300 if (pt
.x
>= rect
.right
-SYSMETRICS_CXSIZE
) return HTBOTTOMRIGHT
;
303 /* Check left sizing border */
304 if (pt
.x
< rect
.left
)
306 if (pt
.y
< rect
.top
+SYSMETRICS_CYSIZE
) return HTTOPLEFT
;
307 if (pt
.y
>= rect
.bottom
-SYSMETRICS_CYSIZE
) return HTBOTTOMLEFT
;
310 /* Check right sizing border */
311 if (pt
.x
>= rect
.right
)
313 if (pt
.y
< rect
.top
+SYSMETRICS_CYSIZE
) return HTTOPRIGHT
;
314 if (pt
.y
>= rect
.bottom
-SYSMETRICS_CYSIZE
) return HTBOTTOMRIGHT
;
319 else /* No thick frame */
321 if (HAS_DLGFRAME( wndPtr
->dwStyle
, wndPtr
->dwExStyle
))
322 InflateRect(&rect
, -SYSMETRICS_CXDLGFRAME
, -SYSMETRICS_CYDLGFRAME
);
323 else if (wndPtr
->dwStyle
& WS_BORDER
)
324 InflateRect(&rect
, -SYSMETRICS_CXBORDER
, -SYSMETRICS_CYBORDER
);
325 if (!PtInRect( &rect
, pt
)) return HTBORDER
;
330 if ((wndPtr
->dwStyle
& WS_CAPTION
) == WS_CAPTION
)
332 rect
.top
+= SYSMETRICS_CYCAPTION
- 1;
333 if (!PtInRect( &rect
, pt
))
335 /* Check system menu */
336 if (wndPtr
->dwStyle
& WS_SYSMENU
)
337 rect
.left
+= SYSMETRICS_CXSIZE
;
338 if (pt
.x
<= rect
.left
) return HTSYSMENU
;
339 /* Check maximize box */
340 if (wndPtr
->dwStyle
& WS_MAXIMIZEBOX
)
341 rect
.right
-= SYSMETRICS_CXSIZE
+ 1;
342 if (pt
.x
>= rect
.right
) return HTMAXBUTTON
;
343 /* Check minimize box */
344 if (wndPtr
->dwStyle
& WS_MINIMIZEBOX
)
345 rect
.right
-= SYSMETRICS_CXSIZE
+ 1;
346 if (pt
.x
>= rect
.right
) return HTMINBUTTON
;
352 /* Check client area */
354 ScreenToClient( hwnd
, &pt
);
355 GetClientRect( hwnd
, &rect
);
356 if (PtInRect( &rect
, pt
)) return HTCLIENT
;
358 /* Check vertical scroll bar */
360 if (wndPtr
->dwStyle
& WS_VSCROLL
)
362 rect
.right
+= SYSMETRICS_CXVSCROLL
;
363 if (PtInRect( &rect
, pt
)) return HTVSCROLL
;
366 /* Check horizontal scroll bar */
368 if (wndPtr
->dwStyle
& WS_HSCROLL
)
370 rect
.bottom
+= SYSMETRICS_CYHSCROLL
;
371 if (PtInRect( &rect
, pt
))
374 if ((wndPtr
->dwStyle
& WS_VSCROLL
) &&
375 (pt
.x
>= rect
.right
- SYSMETRICS_CXVSCROLL
))
383 if (HAS_MENU(wndPtr
))
385 if ((pt
.y
< 0) && (pt
.x
>= 0) && (pt
.x
< rect
.right
))
389 /* Should never get here */
394 /***********************************************************************
397 void NC_DrawSysButton( HWND hwnd
, HDC hdc
, BOOL down
)
402 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
404 NC_GetInsideRect( hwnd
, &rect
);
405 hdcMem
= CreateCompatibleDC( hdc
);
406 hbitmap
= SelectObject( hdcMem
, hbitmapClose
);
407 BitBlt( hdc
, rect
.left
, rect
.top
, SYSMETRICS_CXSIZE
, SYSMETRICS_CYSIZE
,
408 hdcMem
, (wndPtr
->dwStyle
& WS_CHILD
) ? SYSMETRICS_CXSIZE
: 0, 0,
409 down
? NOTSRCCOPY
: SRCCOPY
);
410 SelectObject( hdcMem
, hbitmap
);
415 /***********************************************************************
418 static void NC_DrawMaxButton( HWND hwnd
, HDC hdc
, BOOL down
)
421 NC_GetInsideRect( hwnd
, &rect
);
422 GRAPH_DrawBitmap( hdc
, (IsZoomed(hwnd
) ?
423 (down
? hbitmapRestoreD
: hbitmapRestore
) :
424 (down
? hbitmapMaximizeD
: hbitmapMaximize
)),
425 rect
.right
- SYSMETRICS_CXSIZE
- 1, rect
.top
,
426 0, 0, SYSMETRICS_CXSIZE
+1, SYSMETRICS_CYSIZE
);
430 /***********************************************************************
433 static void NC_DrawMinButton( HWND hwnd
, HDC hdc
, BOOL down
)
436 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
437 NC_GetInsideRect( hwnd
, &rect
);
438 if (wndPtr
->dwStyle
& WS_MAXIMIZEBOX
) rect
.right
-= SYSMETRICS_CXSIZE
+ 1;
439 GRAPH_DrawBitmap( hdc
, (down
? hbitmapMinimizeD
: hbitmapMinimize
),
440 rect
.right
- SYSMETRICS_CXSIZE
- 1, rect
.top
,
441 0, 0, SYSMETRICS_CXSIZE
+1, SYSMETRICS_CYSIZE
);
445 /***********************************************************************
448 * Draw a window frame inside the given rectangle, and update the rectangle.
449 * The correct pen for the frame must be selected in the DC.
451 static void NC_DrawFrame( HDC hdc
, RECT
*rect
, BOOL dlgFrame
, BOOL active
)
453 short width
, height
, tmp
;
457 width
= SYSMETRICS_CXDLGFRAME
- 1;
458 height
= SYSMETRICS_CYDLGFRAME
- 1;
459 SelectObject( hdc
, active
? sysColorObjects
.hbrushActiveCaption
:
460 sysColorObjects
.hbrushInactiveCaption
);
464 width
= SYSMETRICS_CXFRAME
- 1;
465 height
= SYSMETRICS_CYFRAME
- 1;
466 SelectObject( hdc
, active
? sysColorObjects
.hbrushActiveBorder
:
467 sysColorObjects
.hbrushInactiveBorder
);
471 PatBlt( hdc
, rect
->left
, rect
->top
,
472 rect
->right
- rect
->left
, height
, PATCOPY
);
473 PatBlt( hdc
, rect
->left
, rect
->top
,
474 width
, rect
->bottom
- rect
->top
, PATCOPY
);
475 PatBlt( hdc
, rect
->left
, rect
->bottom
,
476 rect
->right
- rect
->left
, -height
, PATCOPY
);
477 PatBlt( hdc
, rect
->right
, rect
->top
,
478 -width
, rect
->bottom
- rect
->top
, PATCOPY
);
482 InflateRect( rect
, -width
, -height
);
486 /* Draw inner rectangle */
487 MoveTo( hdc
, rect
->left
+width
, rect
->top
+height
);
488 LineTo( hdc
, rect
->right
-width
-1, rect
->top
+height
);
489 LineTo( hdc
, rect
->right
-width
-1, rect
->bottom
-height
-1 );
490 LineTo( hdc
, rect
->left
+width
, rect
->bottom
-height
-1 );
491 LineTo( hdc
, rect
->left
+width
, rect
->top
+height
);
493 /* Draw the decorations */
494 tmp
= rect
->top
+ SYSMETRICS_CYFRAME
+ SYSMETRICS_CYSIZE
;
495 MoveTo( hdc
, rect
->left
, tmp
);
496 LineTo( hdc
, rect
->left
+width
, tmp
);
497 MoveTo( hdc
, rect
->right
-width
-1, tmp
);
498 LineTo( hdc
, rect
->right
-1, tmp
);
500 tmp
= rect
->bottom
- 1 - SYSMETRICS_CYFRAME
- SYSMETRICS_CYSIZE
;
501 MoveTo( hdc
, rect
->left
, tmp
);
502 LineTo( hdc
, rect
->left
+width
, tmp
);
503 MoveTo( hdc
, rect
->right
-width
-1, tmp
);
504 LineTo( hdc
, rect
->right
-1, tmp
);
506 tmp
= rect
->left
+ SYSMETRICS_CXFRAME
+ SYSMETRICS_CXSIZE
;
507 MoveTo( hdc
, tmp
, rect
->top
);
508 LineTo( hdc
, tmp
, rect
->top
+height
);
509 MoveTo( hdc
, tmp
, rect
->bottom
-height
-1 );
510 LineTo( hdc
, tmp
, rect
->bottom
-1 );
512 tmp
= rect
->right
- 1 - SYSMETRICS_CXFRAME
- SYSMETRICS_CYSIZE
;
513 MoveTo( hdc
, tmp
, rect
->top
);
514 LineTo( hdc
, tmp
, rect
->top
+height
);
515 MoveTo( hdc
, tmp
, rect
->bottom
-height
-1 );
516 LineTo( hdc
, tmp
, rect
->bottom
-1 );
518 InflateRect( rect
, -width
-1, -height
-1 );
522 /***********************************************************************
525 * Draw the frame used when moving or resizing window.
527 static void NC_DrawMovingFrame( HDC hdc
, RECT
*rect
, BOOL thickframe
)
531 SelectObject( hdc
, GetStockObject( GRAY_BRUSH
) );
532 PatBlt( hdc
, rect
->left
, rect
->top
,
533 rect
->right
- rect
->left
- SYSMETRICS_CXFRAME
,
534 SYSMETRICS_CYFRAME
, PATINVERT
);
535 PatBlt( hdc
, rect
->left
, rect
->top
+ SYSMETRICS_CYFRAME
,
537 rect
->bottom
- rect
->top
- SYSMETRICS_CYFRAME
, PATINVERT
);
538 PatBlt( hdc
, rect
->left
+ SYSMETRICS_CXFRAME
, rect
->bottom
,
539 rect
->right
- rect
->left
- SYSMETRICS_CXFRAME
,
540 -SYSMETRICS_CYFRAME
, PATINVERT
);
541 PatBlt( hdc
, rect
->right
, rect
->top
, -SYSMETRICS_CXFRAME
,
542 rect
->bottom
- rect
->top
- SYSMETRICS_CYFRAME
, PATINVERT
);
544 else DrawFocusRect( hdc
, rect
);
548 /***********************************************************************
551 * Draw the window caption.
552 * The correct pen for the window frame must be selected in the DC.
554 static void NC_DrawCaption( HDC hdc
, RECT
*rect
, HWND hwnd
,
555 DWORD style
, BOOL active
)
558 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
563 if (!(hbitmapClose
= LoadBitmap( 0, MAKEINTRESOURCE(OBM_CLOSE
) )))
565 hbitmapMinimize
= LoadBitmap( 0, MAKEINTRESOURCE(OBM_REDUCE
) );
566 hbitmapMinimizeD
= LoadBitmap( 0, MAKEINTRESOURCE(OBM_REDUCED
) );
567 hbitmapMaximize
= LoadBitmap( 0, MAKEINTRESOURCE(OBM_ZOOM
) );
568 hbitmapMaximizeD
= LoadBitmap( 0, MAKEINTRESOURCE(OBM_ZOOMD
) );
569 hbitmapRestore
= LoadBitmap( 0, MAKEINTRESOURCE(OBM_RESTORE
) );
570 hbitmapRestoreD
= LoadBitmap( 0, MAKEINTRESOURCE(OBM_RESTORED
) );
573 if (wndPtr
->dwExStyle
& WS_EX_DLGMODALFRAME
)
575 HBRUSH hbrushOld
= SelectObject( hdc
, sysColorObjects
.hbrushWindow
);
576 PatBlt( hdc
, r
.left
, r
.top
, 1, r
.bottom
-r
.top
+1,PATCOPY
);
577 PatBlt( hdc
, r
.right
-1, r
.top
, 1, r
.bottom
-r
.top
+1, PATCOPY
);
578 PatBlt( hdc
, r
.left
, r
.top
-1, r
.right
-r
.left
, 1, PATCOPY
);
581 SelectObject( hdc
, hbrushOld
);
584 MoveTo( hdc
, r
.left
, r
.bottom
);
585 LineTo( hdc
, r
.right
-1, r
.bottom
);
587 if (style
& WS_SYSMENU
)
589 NC_DrawSysButton( hwnd
, hdc
, FALSE
);
590 r
.left
+= SYSMETRICS_CXSIZE
+ 1;
591 MoveTo( hdc
, r
.left
- 1, r
.top
);
592 LineTo( hdc
, r
.left
- 1, r
.bottom
);
594 if (style
& WS_MAXIMIZEBOX
)
596 NC_DrawMaxButton( hwnd
, hdc
, FALSE
);
597 r
.right
-= SYSMETRICS_CXSIZE
+ 1;
599 if (style
& WS_MINIMIZEBOX
)
601 NC_DrawMinButton( hwnd
, hdc
, FALSE
);
602 r
.right
-= SYSMETRICS_CXSIZE
+ 1;
605 FillRect( hdc
, &r
, active
? sysColorObjects
.hbrushActiveCaption
:
606 sysColorObjects
.hbrushInactiveCaption
);
608 if (GetWindowText( hwnd
, buffer
, 256 ))
610 if (active
) SetTextColor( hdc
, GetSysColor( COLOR_CAPTIONTEXT
) );
611 else SetTextColor( hdc
, GetSysColor( COLOR_INACTIVECAPTIONTEXT
) );
612 SetBkMode( hdc
, TRANSPARENT
);
613 DrawText( hdc
, buffer
, -1, &r
, DT_SINGLELINE
| DT_CENTER
| DT_VCENTER
);
618 /***********************************************************************
621 * Paint the non-client area. clip is currently unused.
623 void NC_DoNCPaint( HWND hwnd
, HRGN clip
, BOOL suppress_menupaint
)
629 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
631 if (!wndPtr
|| !(wndPtr
->dwStyle
& WS_VISIBLE
)) return; /* Nothing to do */
633 active
= wndPtr
->flags
& WIN_NCACTIVATED
;
635 dprintf_nonclient(stddeb
, "NC_DoNCPaint: %04x %d\n", hwnd
, active
);
637 if (!(hdc
= GetDCEx( hwnd
, 0, DCX_USESTYLE
| DCX_WINDOW
))) return;
640 * If this is an icon, we don't want to do any more nonclient painting
641 * of the window manager.
642 * If there is a class icon to draw, draw it
646 if (wndPtr
->class->hIcon
)
648 SendMessage(hwnd
, WM_ICONERASEBKGND
, (WPARAM
)hdc
, 0);
649 DrawIcon( hdc
, 0, 0, wndPtr
->class->hIcon
);
651 ReleaseDC(hwnd
, hdc
);
652 wndPtr
->flags
&= ~WIN_INTERNAL_PAINT
;
653 if( wndPtr
->hrgnUpdate
)
655 DeleteObject( wndPtr
->hrgnUpdate
);
656 QUEUE_DecPaintCount( wndPtr
->hmemTaskQ
);
657 wndPtr
->hrgnUpdate
= 0;
662 if (ExcludeVisRect( hdc
, wndPtr
->rectClient
.left
-wndPtr
->rectWindow
.left
,
663 wndPtr
->rectClient
.top
-wndPtr
->rectWindow
.top
,
664 wndPtr
->rectClient
.right
-wndPtr
->rectWindow
.left
,
665 wndPtr
->rectClient
.bottom
-wndPtr
->rectWindow
.top
)
668 ReleaseDC( hwnd
, hdc
);
672 rect
.top
= rect
.left
= 0;
673 rect
.right
= wndPtr
->rectWindow
.right
- wndPtr
->rectWindow
.left
;
674 rect
.bottom
= wndPtr
->rectWindow
.bottom
- wndPtr
->rectWindow
.top
;
676 SelectObject( hdc
, sysColorObjects
.hpenWindowFrame
);
678 if (!(wndPtr
->flags
& WIN_MANAGED
))
680 if ((wndPtr
->dwStyle
& WS_BORDER
) || (wndPtr
->dwStyle
& WS_DLGFRAME
) ||
681 (wndPtr
->dwExStyle
& WS_EX_DLGMODALFRAME
))
684 LineTo( hdc
, rect
.right
-1, 0 );
685 LineTo( hdc
, rect
.right
-1, rect
.bottom
-1 );
686 LineTo( hdc
, 0, rect
.bottom
-1 );
688 InflateRect( &rect
, -1, -1 );
691 if (HAS_DLGFRAME( wndPtr
->dwStyle
, wndPtr
->dwExStyle
))
692 NC_DrawFrame( hdc
, &rect
, TRUE
, active
);
693 else if (wndPtr
->dwStyle
& WS_THICKFRAME
)
694 NC_DrawFrame(hdc
, &rect
, FALSE
, active
);
696 if ((wndPtr
->dwStyle
& WS_CAPTION
) == WS_CAPTION
)
699 r
.bottom
= rect
.top
+ SYSMETRICS_CYSIZE
;
700 rect
.top
+= SYSMETRICS_CYSIZE
+ SYSMETRICS_CYBORDER
;
701 NC_DrawCaption( hdc
, &r
, hwnd
, wndPtr
->dwStyle
, active
);
705 if (HAS_MENU(wndPtr
))
708 r
.bottom
= rect
.top
+ SYSMETRICS_CYMENU
; /* default height */
709 rect
.top
+= MENU_DrawMenuBar( hdc
, &r
, hwnd
, suppress_menupaint
);
712 /* Draw the scroll-bars */
714 if (wndPtr
->dwStyle
& WS_VSCROLL
) SCROLL_DrawScrollBar(hwnd
, hdc
, SB_VERT
);
715 if (wndPtr
->dwStyle
& WS_HSCROLL
) SCROLL_DrawScrollBar(hwnd
, hdc
, SB_HORZ
);
717 /* Draw the "size-box" */
719 if ((wndPtr
->dwStyle
& WS_VSCROLL
) && (wndPtr
->dwStyle
& WS_HSCROLL
))
722 r
.left
= r
.right
- SYSMETRICS_CXVSCROLL
+ 1;
723 r
.top
= r
.bottom
- SYSMETRICS_CYHSCROLL
+ 1;
724 FillRect( hdc
, &r
, sysColorObjects
.hbrushScrollbar
);
727 ReleaseDC( hwnd
, hdc
);
732 /***********************************************************************
735 * Handle a WM_NCPAINT message. Called from DefWindowProc().
737 LONG
NC_HandleNCPaint( HWND hwnd
, HRGN clip
)
739 NC_DoNCPaint( hwnd
, clip
, FALSE
);
744 /***********************************************************************
745 * NC_HandleNCActivate
747 * Handle a WM_NCACTIVATE message. Called from DefWindowProc().
749 LONG
NC_HandleNCActivate( HWND hwnd
, WPARAM wParam
)
751 WND
*wndPtr
= WIN_FindWndPtr(hwnd
);
753 if (wParam
!= 0) wndPtr
->flags
|= WIN_NCACTIVATED
;
754 else wndPtr
->flags
&= ~WIN_NCACTIVATED
;
756 NC_DoNCPaint( hwnd
, (HRGN
)1, FALSE
);
761 /***********************************************************************
764 * Handle a WM_SETCURSOR message. Called from DefWindowProc().
766 LONG
NC_HandleSetCursor( HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
768 if (hwnd
!= (HWND
)wParam
) return 0; /* Don't set the cursor for child windows */
770 switch(LOWORD(lParam
))
774 WORD msg
= HIWORD( lParam
);
775 if ((msg
== WM_LBUTTONDOWN
) || (msg
== WM_MBUTTONDOWN
) ||
776 (msg
== WM_RBUTTONDOWN
))
784 if (!(wndPtr
= WIN_FindWndPtr( hwnd
))) break;
785 if (wndPtr
->class->hCursor
)
787 SetCursor( wndPtr
->class->hCursor
);
795 return (LONG
)SetCursor( LoadCursor( 0, IDC_SIZEWE
) );
799 return (LONG
)SetCursor( LoadCursor( 0, IDC_SIZENS
) );
803 return (LONG
)SetCursor( LoadCursor( 0, IDC_SIZENWSE
) );
807 return (LONG
)SetCursor( LoadCursor( 0, IDC_SIZENESW
) );
810 /* Default cursor: arrow */
811 return (LONG
)SetCursor( LoadCursor( 0, IDC_ARROW
) );
815 /***********************************************************************
818 * Track a mouse button press on the system menu.
820 static void NC_TrackSysMenu( HWND hwnd
, HDC hdc
, POINT pt
)
823 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
824 int iconic
= wndPtr
->dwStyle
& WS_MINIMIZE
;
826 if (!(wndPtr
->dwStyle
& WS_SYSMENU
)) return;
827 /* If window has a menu, track the menu bar normally if it not minimized */
828 if (HAS_MENU(wndPtr
) && !iconic
) MENU_TrackMouseMenuBar( hwnd
, pt
);
831 /* Otherwise track the system menu like a normal popup menu */
832 NC_GetInsideRect( hwnd
, &rect
);
833 OffsetRect( &rect
, wndPtr
->rectWindow
.left
, wndPtr
->rectWindow
.top
);
834 if (wndPtr
->dwStyle
& WS_CHILD
)
835 ClientToScreen( wndPtr
->parent
->hwndSelf
, (POINT
*)&rect
);
836 rect
.right
= rect
.left
+ SYSMETRICS_CXSIZE
;
837 rect
.bottom
= rect
.top
+ SYSMETRICS_CYSIZE
;
838 if (!iconic
) NC_DrawSysButton( hwnd
, hdc
, TRUE
);
839 TrackPopupMenu( wndPtr
->hSysMenu
, TPM_LEFTALIGN
| TPM_LEFTBUTTON
,
840 rect
.left
, rect
.bottom
, 0, hwnd
, &rect
);
841 if (!iconic
) NC_DrawSysButton( hwnd
, hdc
, FALSE
);
846 /***********************************************************************
849 * Initialisation of a move or resize, when initiatied from a menu choice.
850 * Return hit test code for caption or sizing border.
852 static LONG
NC_StartSizeMove( HWND hwnd
, WPARAM wParam
, POINT
*capturePoint
)
857 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
859 if ((wParam
& 0xfff0) == SC_MOVE
)
861 /* Move pointer at the center of the caption */
863 NC_GetInsideRect( hwnd
, &rect
);
864 if (wndPtr
->dwStyle
& WS_SYSMENU
)
865 rect
.left
+= SYSMETRICS_CXSIZE
+ 1;
866 if (wndPtr
->dwStyle
& WS_MINIMIZEBOX
)
867 rect
.right
-= SYSMETRICS_CXSIZE
+ 1;
868 if (wndPtr
->dwStyle
& WS_MAXIMIZEBOX
)
869 rect
.right
-= SYSMETRICS_CXSIZE
+ 1;
870 pt
.x
= wndPtr
->rectWindow
.left
+ (rect
.right
- rect
.left
) / 2;
871 pt
.y
= wndPtr
->rectWindow
.top
+ rect
.top
+ SYSMETRICS_CYSIZE
/2;
872 if (wndPtr
->dwStyle
& WS_CHILD
)
873 ClientToScreen( wndPtr
->parent
->hwndSelf
, &pt
);
881 MSG_GetHardwareMessage( &msg
);
885 hittest
= NC_HandleNCHitTest( hwnd
, msg
.pt
);
887 if ((hittest
< HTLEFT
) || (hittest
> HTBOTTOMRIGHT
))
899 pt
.x
=(wndPtr
->rectWindow
.left
+wndPtr
->rectWindow
.right
)/2;
900 pt
.y
= wndPtr
->rectWindow
.top
+ SYSMETRICS_CYFRAME
/ 2;
904 pt
.x
=(wndPtr
->rectWindow
.left
+wndPtr
->rectWindow
.right
)/2;
905 pt
.y
= wndPtr
->rectWindow
.bottom
- SYSMETRICS_CYFRAME
/ 2;
909 pt
.x
= wndPtr
->rectWindow
.left
+ SYSMETRICS_CXFRAME
/ 2;
910 pt
.y
=(wndPtr
->rectWindow
.top
+wndPtr
->rectWindow
.bottom
)/2;
914 pt
.x
= wndPtr
->rectWindow
.right
- SYSMETRICS_CXFRAME
/ 2;
915 pt
.y
=(wndPtr
->rectWindow
.top
+wndPtr
->rectWindow
.bottom
)/2;
918 case VK_ESCAPE
: return 0;
924 SetCursorPos( capturePoint
->x
, capturePoint
->y
);
925 NC_HandleSetCursor( hwnd
, (WPARAM
)hwnd
, MAKELONG( hittest
, WM_MOUSEMOVE
));
930 /***********************************************************************
933 * Perform SC_MOVE and SC_SIZE commands.
935 static void NC_DoSizeMove( HWND hwnd
, WORD wParam
, POINT pt
)
939 RECT sizingRect
, mouseRect
;
942 POINT minTrack
, maxTrack
, capturePoint
= pt
;
943 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
946 if (IsZoomed(hwnd
) || !IsWindowVisible(hwnd
) ||
947 (wndPtr
->flags
& WIN_MANAGED
)) return;
948 hittest
= wParam
& 0x0f;
949 thickframe
= HAS_THICKFRAME( wndPtr
->dwStyle
);
951 if ((wParam
& 0xfff0) == SC_MOVE
)
953 if (!(wndPtr
->dwStyle
& WS_CAPTION
)) return;
954 if (!hittest
) hittest
= NC_StartSizeMove( hwnd
, wParam
, &capturePoint
);
955 if (!hittest
) return;
959 if (!thickframe
) return;
960 if (hittest
) hittest
+= HTLEFT
-1;
964 hittest
= NC_StartSizeMove( hwnd
, wParam
, &capturePoint
);
973 /* Get min/max info */
975 NC_GetMinMaxInfo( hwnd
, NULL
, NULL
, &minTrack
, &maxTrack
);
976 sizingRect
= wndPtr
->rectWindow
;
977 if (wndPtr
->dwStyle
& WS_CHILD
)
978 GetClientRect( wndPtr
->parent
->hwndSelf
, &mouseRect
);
979 else SetRect( &mouseRect
, 0, 0, SYSMETRICS_CXSCREEN
, SYSMETRICS_CYSCREEN
);
980 if (ON_LEFT_BORDER(hittest
))
982 mouseRect
.left
= MAX( mouseRect
.left
, sizingRect
.right
-maxTrack
.x
);
983 mouseRect
.right
= MIN( mouseRect
.right
, sizingRect
.right
-minTrack
.x
);
985 else if (ON_RIGHT_BORDER(hittest
))
987 mouseRect
.left
= MAX( mouseRect
.left
, sizingRect
.left
+minTrack
.x
);
988 mouseRect
.right
= MIN( mouseRect
.right
, sizingRect
.left
+maxTrack
.x
);
990 if (ON_TOP_BORDER(hittest
))
992 mouseRect
.top
= MAX( mouseRect
.top
, sizingRect
.bottom
-maxTrack
.y
);
993 mouseRect
.bottom
= MIN( mouseRect
.bottom
,sizingRect
.bottom
-minTrack
.y
);
995 else if (ON_BOTTOM_BORDER(hittest
))
997 mouseRect
.top
= MAX( mouseRect
.top
, sizingRect
.top
+minTrack
.y
);
998 mouseRect
.bottom
= MIN( mouseRect
.bottom
, sizingRect
.top
+maxTrack
.y
);
1000 SendMessage( hwnd
, WM_ENTERSIZEMOVE
, 0, 0 );
1002 if (GetCapture() != hwnd
) SetCapture( hwnd
);
1004 if (wndPtr
->dwStyle
& WS_CHILD
)
1006 /* Retrieve a default cache DC (without using the window style) */
1007 hdc
= GetDCEx( wndPtr
->parent
->hwndSelf
, 0, DCX_CACHE
);
1010 { /* Grab the server only when moving top-level windows without desktop */
1012 if (rootWindow
== DefaultRootWindow(display
)) XGrabServer( display
);
1014 NC_DrawMovingFrame( hdc
, &sizingRect
, thickframe
);
1020 MSG_GetHardwareMessage( &msg
);
1022 /* Exit on button-up, Return, or Esc */
1023 if ((msg
.message
== WM_LBUTTONUP
) ||
1024 ((msg
.message
== WM_KEYDOWN
) &&
1025 ((msg
.wParam
== VK_RETURN
) || (msg
.wParam
== VK_ESCAPE
)))) break;
1027 if ((msg
.message
!= WM_KEYDOWN
) && (msg
.message
!= WM_MOUSEMOVE
))
1028 continue; /* We are not interested in other messages */
1031 if (wndPtr
->dwStyle
& WS_CHILD
)
1032 ScreenToClient( wndPtr
->parent
->hwndSelf
, &pt
);
1035 if (msg
.message
== WM_KEYDOWN
) switch(msg
.wParam
)
1037 case VK_UP
: pt
.y
-= 8; break;
1038 case VK_DOWN
: pt
.y
+= 8; break;
1039 case VK_LEFT
: pt
.x
-= 8; break;
1040 case VK_RIGHT
: pt
.x
+= 8; break;
1043 pt
.x
= MAX( pt
.x
, mouseRect
.left
);
1044 pt
.x
= MIN( pt
.x
, mouseRect
.right
);
1045 pt
.y
= MAX( pt
.y
, mouseRect
.top
);
1046 pt
.y
= MIN( pt
.y
, mouseRect
.bottom
);
1048 dx
= pt
.x
- capturePoint
.x
;
1049 dy
= pt
.y
- capturePoint
.y
;
1054 if (msg
.message
== WM_KEYDOWN
) SetCursorPos( pt
.x
, pt
.y
);
1057 RECT newRect
= sizingRect
;
1059 if (hittest
== HTCAPTION
) OffsetRect( &newRect
, dx
, dy
);
1060 if (ON_LEFT_BORDER(hittest
)) newRect
.left
+= dx
;
1061 else if (ON_RIGHT_BORDER(hittest
)) newRect
.right
+= dx
;
1062 if (ON_TOP_BORDER(hittest
)) newRect
.top
+= dy
;
1063 else if (ON_BOTTOM_BORDER(hittest
)) newRect
.bottom
+= dy
;
1064 NC_DrawMovingFrame( hdc
, &sizingRect
, thickframe
);
1065 NC_DrawMovingFrame( hdc
, &newRect
, thickframe
);
1067 sizingRect
= newRect
;
1072 NC_DrawMovingFrame( hdc
, &sizingRect
, thickframe
);
1075 if (wndPtr
->dwStyle
& WS_CHILD
) ReleaseDC( wndPtr
->parent
->hwndSelf
, hdc
);
1078 ReleaseDC( 0, hdc
);
1079 if (rootWindow
== DefaultRootWindow(display
)) XUngrabServer( display
);
1081 SendMessage( hwnd
, WM_EXITSIZEMOVE
, 0, 0 );
1082 SendMessage( hwnd
, WM_SETVISIBLE
, !IsIconic(hwnd
), 0L);
1084 /* Single click brings up the system menu when iconized */
1086 if (!moved
&& (wndPtr
->dwStyle
& WS_MINIMIZE
))
1088 NC_TrackSysMenu( hwnd
, hdc
, pt
);
1092 /* If Esc key, don't move the window */
1093 if ((msg
.message
== WM_KEYDOWN
) && (msg
.wParam
== VK_ESCAPE
)) return;
1095 if (hittest
!= HTCAPTION
)
1096 SetWindowPos( hwnd
, 0, sizingRect
.left
, sizingRect
.top
,
1097 sizingRect
.right
- sizingRect
.left
,
1098 sizingRect
.bottom
- sizingRect
.top
,
1099 SWP_NOACTIVATE
| SWP_NOZORDER
);
1100 else SetWindowPos( hwnd
, 0, sizingRect
.left
, sizingRect
.top
, 0, 0,
1101 SWP_NOACTIVATE
| SWP_NOSIZE
| SWP_NOZORDER
);
1105 /***********************************************************************
1108 * Track a mouse button press on the minimize or maximize box.
1110 static void NC_TrackMinMaxBox( HWND hwnd
, WORD wParam
)
1113 HDC hdc
= GetWindowDC( hwnd
);
1114 BOOL pressed
= TRUE
;
1117 if (wParam
== HTMINBUTTON
) NC_DrawMinButton( hwnd
, hdc
, TRUE
);
1118 else NC_DrawMaxButton( hwnd
, hdc
, TRUE
);
1122 BOOL oldstate
= pressed
;
1123 MSG_GetHardwareMessage( &msg
);
1125 pressed
= (NC_HandleNCHitTest( hwnd
, msg
.pt
) == wParam
);
1126 if (pressed
!= oldstate
)
1128 if (wParam
== HTMINBUTTON
) NC_DrawMinButton( hwnd
, hdc
, pressed
);
1129 else NC_DrawMaxButton( hwnd
, hdc
, pressed
);
1131 } while (msg
.message
!= WM_LBUTTONUP
);
1133 if (wParam
== HTMINBUTTON
) NC_DrawMinButton( hwnd
, hdc
, FALSE
);
1134 else NC_DrawMaxButton( hwnd
, hdc
, FALSE
);
1137 ReleaseDC( hwnd
, hdc
);
1138 if (!pressed
) return;
1140 if (wParam
== HTMINBUTTON
)
1141 SendMessage( hwnd
, WM_SYSCOMMAND
, SC_MINIMIZE
, *(LONG
*)&msg
.pt
);
1143 SendMessage( hwnd
, WM_SYSCOMMAND
,
1144 IsZoomed(hwnd
) ? SC_RESTORE
: SC_MAXIMIZE
, *(LONG
*)&msg
.pt
);
1148 /***********************************************************************
1151 * Track a mouse button press on the horizontal or vertical scroll-bar.
1153 static void NC_TrackScrollBar( HWND hwnd
, WORD wParam
, POINT pt
)
1157 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
1159 if ((wParam
& 0xfff0) == SC_HSCROLL
)
1161 if ((wParam
& 0x0f) != HTHSCROLL
) return;
1162 scrollbar
= SB_HORZ
;
1164 else /* SC_VSCROLL */
1166 if ((wParam
& 0x0f) != HTVSCROLL
) return;
1167 scrollbar
= SB_VERT
;
1170 pt
.x
-= wndPtr
->rectWindow
.left
;
1171 pt
.y
-= wndPtr
->rectWindow
.top
;
1173 SCROLL_HandleScrollEvent( hwnd
, scrollbar
, WM_LBUTTONDOWN
, pt
);
1177 GetMessage( MAKE_SEGPTR(&msg
), 0, 0, 0 );
1183 pt
.x
= LOWORD(msg
.lParam
) + wndPtr
->rectClient
.left
-
1184 wndPtr
->rectWindow
.left
;
1185 pt
.y
= HIWORD(msg
.lParam
) + wndPtr
->rectClient
.top
-
1186 wndPtr
->rectWindow
.top
;
1187 SCROLL_HandleScrollEvent( hwnd
, scrollbar
, msg
.message
, pt
);
1190 TranslateMessage( &msg
);
1191 DispatchMessage( &msg
);
1194 if (!IsWindow( hwnd
))
1199 } while (msg
.message
!= WM_LBUTTONUP
);
1202 /***********************************************************************
1203 * NC_HandleNCLButtonDown
1205 * Handle a WM_NCLBUTTONDOWN message. Called from DefWindowProc().
1207 LONG
NC_HandleNCLButtonDown( HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
1209 HDC hdc
= GetWindowDC( hwnd
);
1210 POINT pt
= { LOWORD(lParam
), HIWORD(lParam
) };
1212 switch(wParam
) /* Hit test */
1215 SendMessage( hwnd
, WM_SYSCOMMAND
, SC_MOVE
+ HTCAPTION
, lParam
);
1219 NC_TrackSysMenu( hwnd
, hdc
, pt
);
1223 SendMessage( hwnd
, WM_SYSCOMMAND
, SC_MOUSEMENU
, lParam
);
1227 SendMessage( hwnd
, WM_SYSCOMMAND
, SC_HSCROLL
+ HTHSCROLL
, lParam
);
1231 SendMessage( hwnd
, WM_SYSCOMMAND
, SC_VSCROLL
+ HTVSCROLL
, lParam
);
1236 NC_TrackMinMaxBox( hwnd
, wParam
);
1247 SendMessage( hwnd
, WM_SYSCOMMAND
, SC_SIZE
+ wParam
- HTLEFT
+1, lParam
);
1254 ReleaseDC( hwnd
, hdc
);
1259 /***********************************************************************
1260 * NC_HandleNCLButtonDblClk
1262 * Handle a WM_NCLBUTTONDBLCLK message. Called from DefWindowProc().
1264 LONG
NC_HandleNCLButtonDblClk( WND
*pWnd
, WPARAM wParam
, LPARAM lParam
)
1267 * if this is an icon, send a restore since we are handling
1270 if (pWnd
->dwStyle
& WS_MINIMIZE
)
1272 SendMessage( pWnd
->hwndSelf
, WM_SYSCOMMAND
, SC_RESTORE
, lParam
);
1276 switch(wParam
) /* Hit test */
1279 /* stop processing if WS_MAXIMIZEBOX is missing */
1280 if (pWnd
->dwStyle
& WS_MAXIMIZEBOX
)
1281 SendMessage( pWnd
->hwndSelf
, WM_SYSCOMMAND
,
1282 (pWnd
->dwStyle
& WS_MAXIMIZE
) ? SC_RESTORE
: SC_MAXIMIZE
,
1287 if (!(pWnd
->class->style
& CS_NOCLOSE
))
1288 SendMessage( pWnd
->hwndSelf
, WM_SYSCOMMAND
, SC_CLOSE
, lParam
);
1295 /***********************************************************************
1296 * NC_HandleSysCommand
1298 * Handle a WM_SYSCOMMAND message. Called from DefWindowProc().
1300 LONG
NC_HandleSysCommand( HWND hwnd
, WPARAM wParam
, POINT pt
)
1302 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
1304 dprintf_nonclient(stddeb
, "Handling WM_SYSCOMMAND %x %d,%d\n",
1305 wParam
, pt
.x
, pt
.y
);
1307 if (wndPtr
->dwStyle
& WS_CHILD
&& wParam
!= SC_KEYMENU
)
1308 ScreenToClient( wndPtr
->parent
->hwndSelf
, &pt
);
1310 switch (wParam
& 0xfff0)
1314 NC_DoSizeMove( hwnd
, wParam
, pt
);
1318 ShowWindow( hwnd
, SW_MINIMIZE
);
1322 ShowWindow( hwnd
, SW_MAXIMIZE
);
1326 ShowWindow( hwnd
, SW_RESTORE
);
1334 return SendMessage( hwnd
, WM_CLOSE
, 0, 0 );
1338 NC_TrackScrollBar( hwnd
, wParam
, pt
);
1342 MENU_TrackMouseMenuBar( hwnd
, pt
);
1346 MENU_TrackKbdMenuBar( wndPtr
, wParam
, pt
.x
);
1353 WinExec( "taskman.exe", SW_SHOWNORMAL
);
1360 if (wParam
== SC_ABOUTWINE
)
1362 extern const char people
[];
1363 ShellAbout(hwnd
,"WINE",people
,0);