2 * Non-client area window functions
4 * Copyright 1994 Alexandre Julliard
11 #include "sysmetrics.h"
19 #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: (%ld,%ld)-(%ld,%ld) %08lx %d %08lx\n",
114 (LONG
)rect
->left
, (LONG
)rect
->top
, (LONG
)rect
->right
, (LONG
)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="NPFMT
" pt=%ld,%ld\n",
272 hwnd
, (LONG
)pt
.x
, (LONG
)pt
.y
);
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.
623 void NC_DoNCPaint( HWND hwnd
, BOOL active
, BOOL suppress_menupaint
)
628 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
630 dprintf_nonclient(stddeb
, "NC_DoNCPaint: "NPFMT
" %d\n", hwnd
, active
);
631 if (!wndPtr
|| !(wndPtr
->dwStyle
& WS_VISIBLE
)) return; /* Nothing to do */
633 if (!(hdc
= GetDCEx( hwnd
, 0, DCX_USESTYLE
| DCX_WINDOW
))) return;
636 * If this is an icon, we don't want to do any more nonclient painting
637 * of the window manager.
638 * If there is a class icon to draw, draw it
642 HICON hIcon
= WIN_CLASS_INFO(wndPtr
).hIcon
;
645 SendMessage(hwnd
, WM_ICONERASEBKGND
, (WPARAM
)hdc
, 0);
646 DrawIcon(hdc
, 0, 0, hIcon
);
648 ReleaseDC(hwnd
, hdc
);
652 if (ExcludeVisRect( hdc
, wndPtr
->rectClient
.left
-wndPtr
->rectWindow
.left
,
653 wndPtr
->rectClient
.top
-wndPtr
->rectWindow
.top
,
654 wndPtr
->rectClient
.right
-wndPtr
->rectWindow
.left
,
655 wndPtr
->rectClient
.bottom
-wndPtr
->rectWindow
.top
)
658 ReleaseDC( hwnd
, hdc
);
662 rect
.top
= rect
.left
= 0;
663 rect
.right
= wndPtr
->rectWindow
.right
- wndPtr
->rectWindow
.left
;
664 rect
.bottom
= wndPtr
->rectWindow
.bottom
- wndPtr
->rectWindow
.top
;
666 SelectObject( hdc
, sysColorObjects
.hpenWindowFrame
);
668 if (!(wndPtr
->flags
& WIN_MANAGED
))
670 if ((wndPtr
->dwStyle
& WS_BORDER
) || (wndPtr
->dwStyle
& WS_DLGFRAME
) ||
671 (wndPtr
->dwExStyle
& WS_EX_DLGMODALFRAME
))
674 LineTo( hdc
, rect
.right
-1, 0 );
675 LineTo( hdc
, rect
.right
-1, rect
.bottom
-1 );
676 LineTo( hdc
, 0, rect
.bottom
-1 );
678 InflateRect( &rect
, -1, -1 );
681 if (HAS_DLGFRAME( wndPtr
->dwStyle
, wndPtr
->dwExStyle
))
682 NC_DrawFrame( hdc
, &rect
, TRUE
, active
);
683 else if (wndPtr
->dwStyle
& WS_THICKFRAME
)
684 NC_DrawFrame(hdc
, &rect
, FALSE
, active
);
686 if ((wndPtr
->dwStyle
& WS_CAPTION
) == WS_CAPTION
)
689 r
.bottom
= rect
.top
+ SYSMETRICS_CYSIZE
;
690 rect
.top
+= SYSMETRICS_CYSIZE
+ SYSMETRICS_CYBORDER
;
691 NC_DrawCaption( hdc
, &r
, hwnd
, wndPtr
->dwStyle
, active
);
695 if (HAS_MENU(wndPtr
))
698 r
.bottom
= rect
.top
+ SYSMETRICS_CYMENU
; /* default height */
699 rect
.top
+= MENU_DrawMenuBar( hdc
, &r
, hwnd
, suppress_menupaint
);
702 /* Draw the scroll-bars */
704 if (wndPtr
->dwStyle
& WS_VSCROLL
) SCROLL_DrawScrollBar(hwnd
, hdc
, SB_VERT
);
705 if (wndPtr
->dwStyle
& WS_HSCROLL
) SCROLL_DrawScrollBar(hwnd
, hdc
, SB_HORZ
);
707 /* Draw the "size-box" */
709 if ((wndPtr
->dwStyle
& WS_VSCROLL
) && (wndPtr
->dwStyle
& WS_HSCROLL
))
712 r
.left
= r
.right
- SYSMETRICS_CXVSCROLL
+ 1;
713 r
.top
= r
.bottom
- SYSMETRICS_CYHSCROLL
+ 1;
714 FillRect( hdc
, &r
, sysColorObjects
.hbrushScrollbar
);
717 ReleaseDC( hwnd
, hdc
);
722 /***********************************************************************
725 * Handle a WM_NCPAINT message. Called from DefWindowProc().
727 LONG
NC_HandleNCPaint( HWND hwnd
)
729 WND
*wndPtr
= WIN_FindWndPtr(hwnd
);
731 NC_DoNCPaint( hwnd
, wndPtr
->flags
& WIN_NCACTIVATED
, FALSE
);
736 /***********************************************************************
737 * NC_HandleNCActivate
739 * Handle a WM_NCACTIVATE message. Called from DefWindowProc().
741 LONG
NC_HandleNCActivate( HWND hwnd
, WPARAM wParam
)
743 WND
*wndPtr
= WIN_FindWndPtr(hwnd
);
745 if (wParam
!= 0) wndPtr
->flags
|= WIN_NCACTIVATED
;
746 else wndPtr
->flags
&= ~WIN_NCACTIVATED
;
748 NC_DoNCPaint( hwnd
, (wParam
!= 0), FALSE
);
753 /***********************************************************************
756 * Handle a WM_SETCURSOR message. Called from DefWindowProc().
758 LONG
NC_HandleSetCursor( HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
760 if (hwnd
!= (HWND
)wParam
) return 0; /* Don't set the cursor for child windows */
762 switch(LOWORD(lParam
))
766 WORD msg
= HIWORD( lParam
);
767 if ((msg
== WM_LBUTTONDOWN
) || (msg
== WM_MBUTTONDOWN
) ||
768 (msg
== WM_RBUTTONDOWN
))
777 if (!(wndPtr
= WIN_FindWndPtr( hwnd
))) break;
778 if (!(classPtr
= CLASS_FindClassPtr( wndPtr
->hClass
))) break;
779 if (classPtr
->wc
.hCursor
)
781 SetCursor( classPtr
->wc
.hCursor
);
789 return (LONG
)SetCursor( LoadCursor( 0, IDC_SIZEWE
) );
793 return (LONG
)SetCursor( LoadCursor( 0, IDC_SIZENS
) );
797 return (LONG
)SetCursor( LoadCursor( 0, IDC_SIZENWSE
) );
801 return (LONG
)SetCursor( LoadCursor( 0, IDC_SIZENESW
) );
804 /* Default cursor: arrow */
805 return (LONG
)SetCursor( LoadCursor( 0, IDC_ARROW
) );
809 /***********************************************************************
812 * Track a mouse button press on the system menu.
814 static void NC_TrackSysMenu( HWND hwnd
, HDC hdc
, POINT pt
)
817 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
818 int iconic
= wndPtr
->dwStyle
& WS_MINIMIZE
;
820 if (!(wndPtr
->dwStyle
& WS_SYSMENU
)) return;
821 /* If window has a menu, track the menu bar normally if it not minimized */
822 if (HAS_MENU(wndPtr
) && !iconic
) MENU_TrackMouseMenuBar( hwnd
, pt
);
825 /* Otherwise track the system menu like a normal popup menu */
826 NC_GetInsideRect( hwnd
, &rect
);
827 OffsetRect( &rect
, wndPtr
->rectWindow
.left
, wndPtr
->rectWindow
.top
);
828 if (wndPtr
->dwStyle
& WS_CHILD
)
829 ClientToScreen( wndPtr
->hwndParent
, (POINT
*)&rect
);
830 rect
.right
= rect
.left
+ SYSMETRICS_CXSIZE
;
831 rect
.bottom
= rect
.top
+ SYSMETRICS_CYSIZE
;
832 if (!iconic
) NC_DrawSysButton( hwnd
, hdc
, TRUE
);
833 TrackPopupMenu( wndPtr
->hSysMenu
, TPM_LEFTALIGN
| TPM_LEFTBUTTON
,
834 rect
.left
, rect
.bottom
, 0, hwnd
, &rect
);
835 if (!iconic
) NC_DrawSysButton( hwnd
, hdc
, FALSE
);
840 /***********************************************************************
843 * Initialisation of a move or resize, when initiatied from a menu choice.
844 * Return hit test code for caption or sizing border.
846 static LONG
NC_StartSizeMove( HWND hwnd
, WPARAM wParam
, POINT
*capturePoint
)
851 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
853 if ((wParam
& 0xfff0) == SC_MOVE
)
855 /* Move pointer at the center of the caption */
857 NC_GetInsideRect( hwnd
, &rect
);
858 if (wndPtr
->dwStyle
& WS_SYSMENU
)
859 rect
.left
+= SYSMETRICS_CXSIZE
+ 1;
860 if (wndPtr
->dwStyle
& WS_MINIMIZEBOX
)
861 rect
.right
-= SYSMETRICS_CXSIZE
+ 1;
862 if (wndPtr
->dwStyle
& WS_MAXIMIZEBOX
)
863 rect
.right
-= SYSMETRICS_CXSIZE
+ 1;
864 pt
.x
= wndPtr
->rectWindow
.left
+ (rect
.right
- rect
.left
) / 2;
865 pt
.y
= wndPtr
->rectWindow
.top
+ rect
.top
+ SYSMETRICS_CYSIZE
/2;
866 if (wndPtr
->dwStyle
& WS_CHILD
)
867 ClientToScreen( wndPtr
->hwndParent
, &pt
);
875 MSG_GetHardwareMessage( &msg
);
879 hittest
= NC_HandleNCHitTest( hwnd
, msg
.pt
);
881 if ((hittest
< HTLEFT
) || (hittest
> HTBOTTOMRIGHT
))
893 pt
.x
=(wndPtr
->rectWindow
.left
+wndPtr
->rectWindow
.right
)/2;
894 pt
.y
= wndPtr
->rectWindow
.top
+ SYSMETRICS_CYFRAME
/ 2;
898 pt
.x
=(wndPtr
->rectWindow
.left
+wndPtr
->rectWindow
.right
)/2;
899 pt
.y
= wndPtr
->rectWindow
.bottom
- SYSMETRICS_CYFRAME
/ 2;
903 pt
.x
= wndPtr
->rectWindow
.left
+ SYSMETRICS_CXFRAME
/ 2;
904 pt
.y
=(wndPtr
->rectWindow
.top
+wndPtr
->rectWindow
.bottom
)/2;
908 pt
.x
= wndPtr
->rectWindow
.right
- SYSMETRICS_CXFRAME
/ 2;
909 pt
.y
=(wndPtr
->rectWindow
.top
+wndPtr
->rectWindow
.bottom
)/2;
912 case VK_ESCAPE
: return 0;
918 SetCursorPos( capturePoint
->x
, capturePoint
->y
);
919 NC_HandleSetCursor( hwnd
, (WPARAM
)hwnd
, MAKELONG( hittest
, WM_MOUSEMOVE
));
924 /***********************************************************************
927 * Perform SC_MOVE and SC_SIZE commands.
929 static void NC_DoSizeMove( HWND hwnd
, WORD wParam
, POINT pt
)
933 RECT sizingRect
, mouseRect
;
936 POINT minTrack
, maxTrack
, capturePoint
= pt
;
937 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
940 if (IsZoomed(hwnd
) || !IsWindowVisible(hwnd
) ||
941 (wndPtr
->flags
& WIN_MANAGED
)) return;
942 hittest
= wParam
& 0x0f;
943 thickframe
= HAS_THICKFRAME( wndPtr
->dwStyle
);
945 if ((wParam
& 0xfff0) == SC_MOVE
)
947 if (!(wndPtr
->dwStyle
& WS_CAPTION
)) return;
948 if (!hittest
) hittest
= NC_StartSizeMove( hwnd
, wParam
, &capturePoint
);
949 if (!hittest
) return;
953 if (!thickframe
) return;
954 if (hittest
) hittest
+= HTLEFT
-1;
958 hittest
= NC_StartSizeMove( hwnd
, wParam
, &capturePoint
);
967 /* Get min/max info */
969 NC_GetMinMaxInfo( hwnd
, NULL
, NULL
, &minTrack
, &maxTrack
);
970 sizingRect
= wndPtr
->rectWindow
;
971 if (wndPtr
->dwStyle
& WS_CHILD
)
972 GetClientRect( wndPtr
->hwndParent
, &mouseRect
);
973 else SetRect( &mouseRect
, 0, 0, SYSMETRICS_CXSCREEN
, SYSMETRICS_CYSCREEN
);
974 if (ON_LEFT_BORDER(hittest
))
976 mouseRect
.left
= MAX( mouseRect
.left
, sizingRect
.right
-maxTrack
.x
);
977 mouseRect
.right
= MIN( mouseRect
.right
, sizingRect
.right
-minTrack
.x
);
979 else if (ON_RIGHT_BORDER(hittest
))
981 mouseRect
.left
= MAX( mouseRect
.left
, sizingRect
.left
+minTrack
.x
);
982 mouseRect
.right
= MIN( mouseRect
.right
, sizingRect
.left
+maxTrack
.x
);
984 if (ON_TOP_BORDER(hittest
))
986 mouseRect
.top
= MAX( mouseRect
.top
, sizingRect
.bottom
-maxTrack
.y
);
987 mouseRect
.bottom
= MIN( mouseRect
.bottom
,sizingRect
.bottom
-minTrack
.y
);
989 else if (ON_BOTTOM_BORDER(hittest
))
991 mouseRect
.top
= MAX( mouseRect
.top
, sizingRect
.top
+minTrack
.y
);
992 mouseRect
.bottom
= MIN( mouseRect
.bottom
, sizingRect
.top
+maxTrack
.y
);
994 SendMessage( hwnd
, WM_ENTERSIZEMOVE
, 0, 0 );
996 if (GetCapture() != hwnd
) SetCapture( hwnd
);
998 if (wndPtr
->dwStyle
& WS_CHILD
)
1000 /* Retrieve a default cache DC (without using the window style) */
1001 hdc
= GetDCEx( wndPtr
->hwndParent
, 0, DCX_CACHE
);
1004 { /* Grab the server only when moving top-level windows without desktop */
1006 if (rootWindow
== DefaultRootWindow(display
)) XGrabServer( display
);
1008 NC_DrawMovingFrame( hdc
, &sizingRect
, thickframe
);
1014 MSG_GetHardwareMessage( &msg
);
1016 /* Exit on button-up, Return, or Esc */
1017 if ((msg
.message
== WM_LBUTTONUP
) ||
1018 ((msg
.message
== WM_KEYDOWN
) &&
1019 ((msg
.wParam
== VK_RETURN
) || (msg
.wParam
== VK_ESCAPE
)))) break;
1021 if ((msg
.message
!= WM_KEYDOWN
) && (msg
.message
!= WM_MOUSEMOVE
))
1022 continue; /* We are not interested in other messages */
1025 if (wndPtr
->dwStyle
& WS_CHILD
)
1026 ScreenToClient( wndPtr
->hwndParent
, &pt
);
1029 if (msg
.message
== WM_KEYDOWN
) switch(msg
.wParam
)
1031 case VK_UP
: pt
.y
-= 8; break;
1032 case VK_DOWN
: pt
.y
+= 8; break;
1033 case VK_LEFT
: pt
.x
-= 8; break;
1034 case VK_RIGHT
: pt
.x
+= 8; break;
1037 pt
.x
= MAX( pt
.x
, mouseRect
.left
);
1038 pt
.x
= MIN( pt
.x
, mouseRect
.right
);
1039 pt
.y
= MAX( pt
.y
, mouseRect
.top
);
1040 pt
.y
= MIN( pt
.y
, mouseRect
.bottom
);
1042 dx
= pt
.x
- capturePoint
.x
;
1043 dy
= pt
.y
- capturePoint
.y
;
1048 if (msg
.message
== WM_KEYDOWN
) SetCursorPos( pt
.x
, pt
.y
);
1051 RECT newRect
= sizingRect
;
1053 if (hittest
== HTCAPTION
) OffsetRect( &newRect
, dx
, dy
);
1054 if (ON_LEFT_BORDER(hittest
)) newRect
.left
+= dx
;
1055 else if (ON_RIGHT_BORDER(hittest
)) newRect
.right
+= dx
;
1056 if (ON_TOP_BORDER(hittest
)) newRect
.top
+= dy
;
1057 else if (ON_BOTTOM_BORDER(hittest
)) newRect
.bottom
+= dy
;
1058 NC_DrawMovingFrame( hdc
, &sizingRect
, thickframe
);
1059 NC_DrawMovingFrame( hdc
, &newRect
, thickframe
);
1061 sizingRect
= newRect
;
1066 NC_DrawMovingFrame( hdc
, &sizingRect
, thickframe
);
1069 if (wndPtr
->dwStyle
& WS_CHILD
) ReleaseDC( wndPtr
->hwndParent
, hdc
);
1072 ReleaseDC( 0, hdc
);
1073 if (rootWindow
== DefaultRootWindow(display
)) XUngrabServer( display
);
1075 SendMessage( hwnd
, WM_EXITSIZEMOVE
, 0, 0 );
1076 SendMessage( hwnd
, WM_SETVISIBLE
, !IsIconic(hwnd
), 0L);
1078 /* Single click brings up the system menu */
1082 NC_TrackSysMenu( hwnd
, hdc
, pt
);
1086 /* If Esc key, don't move the window */
1087 if ((msg
.message
== WM_KEYDOWN
) && (msg
.wParam
== VK_ESCAPE
)) return;
1089 if (hittest
!= HTCAPTION
)
1090 SetWindowPos( hwnd
, 0, sizingRect
.left
, sizingRect
.top
,
1091 sizingRect
.right
- sizingRect
.left
,
1092 sizingRect
.bottom
- sizingRect
.top
,
1093 SWP_NOACTIVATE
| SWP_NOZORDER
);
1094 else SetWindowPos( hwnd
, 0, sizingRect
.left
, sizingRect
.top
, 0, 0,
1095 SWP_NOACTIVATE
| SWP_NOSIZE
| SWP_NOZORDER
);
1099 /***********************************************************************
1102 * Track a mouse button press on the minimize or maximize box.
1104 static void NC_TrackMinMaxBox( HWND hwnd
, WORD wParam
)
1107 HDC hdc
= GetWindowDC( hwnd
);
1108 BOOL pressed
= TRUE
;
1111 if (wParam
== HTMINBUTTON
) NC_DrawMinButton( hwnd
, hdc
, TRUE
);
1112 else NC_DrawMaxButton( hwnd
, hdc
, TRUE
);
1116 BOOL oldstate
= pressed
;
1117 MSG_GetHardwareMessage( &msg
);
1119 pressed
= (NC_HandleNCHitTest( hwnd
, msg
.pt
) == wParam
);
1120 if (pressed
!= oldstate
)
1122 if (wParam
== HTMINBUTTON
) NC_DrawMinButton( hwnd
, hdc
, pressed
);
1123 else NC_DrawMaxButton( hwnd
, hdc
, pressed
);
1125 } while (msg
.message
!= WM_LBUTTONUP
);
1127 if (wParam
== HTMINBUTTON
) NC_DrawMinButton( hwnd
, hdc
, FALSE
);
1128 else NC_DrawMaxButton( hwnd
, hdc
, FALSE
);
1131 ReleaseDC( hwnd
, hdc
);
1132 if (!pressed
) return;
1134 if (wParam
== HTMINBUTTON
)
1135 SendMessage( hwnd
, WM_SYSCOMMAND
, SC_MINIMIZE
, *(LONG
*)&msg
.pt
);
1137 SendMessage( hwnd
, WM_SYSCOMMAND
,
1138 IsZoomed(hwnd
) ? SC_RESTORE
: SC_MAXIMIZE
, *(LONG
*)&msg
.pt
);
1142 /***********************************************************************
1145 * Track a mouse button press on the horizontal or vertical scroll-bar.
1147 static void NC_TrackScrollBar( HWND hwnd
, WORD wParam
, POINT pt
)
1151 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
1153 if ((wParam
& 0xfff0) == SC_HSCROLL
)
1155 if ((wParam
& 0x0f) != HTHSCROLL
) return;
1156 scrollbar
= SB_HORZ
;
1158 else /* SC_VSCROLL */
1160 if ((wParam
& 0x0f) != HTVSCROLL
) return;
1161 scrollbar
= SB_VERT
;
1164 pt
.x
-= wndPtr
->rectWindow
.left
;
1165 pt
.y
-= wndPtr
->rectWindow
.top
;
1167 SCROLL_HandleScrollEvent( hwnd
, scrollbar
, WM_LBUTTONDOWN
, pt
);
1171 GetMessage( MAKE_SEGPTR(&msg
), 0, 0, 0 );
1177 pt
.x
= LOWORD(msg
.lParam
) + wndPtr
->rectClient
.left
-
1178 wndPtr
->rectWindow
.left
;
1179 pt
.y
= HIWORD(msg
.lParam
) + wndPtr
->rectClient
.top
-
1180 wndPtr
->rectWindow
.top
;
1181 SCROLL_HandleScrollEvent( hwnd
, scrollbar
, msg
.message
, pt
);
1184 TranslateMessage( &msg
);
1185 DispatchMessage( &msg
);
1188 if (!IsWindow( hwnd
))
1193 } while (msg
.message
!= WM_LBUTTONUP
);
1196 /***********************************************************************
1197 * NC_HandleNCLButtonDown
1199 * Handle a WM_NCLBUTTONDOWN message. Called from DefWindowProc().
1201 LONG
NC_HandleNCLButtonDown( HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
1203 HDC hdc
= GetWindowDC( hwnd
);
1204 POINT pt
= { LOWORD(lParam
), HIWORD(lParam
) };
1206 switch(wParam
) /* Hit test */
1209 SendMessage( hwnd
, WM_SYSCOMMAND
, SC_MOVE
+ HTCAPTION
, lParam
);
1213 NC_TrackSysMenu( hwnd
, hdc
, pt
);
1217 SendMessage( hwnd
, WM_SYSCOMMAND
, SC_MOUSEMENU
, lParam
);
1221 SendMessage( hwnd
, WM_SYSCOMMAND
, SC_HSCROLL
+ HTHSCROLL
, lParam
);
1225 SendMessage( hwnd
, WM_SYSCOMMAND
, SC_VSCROLL
+ HTVSCROLL
, lParam
);
1230 NC_TrackMinMaxBox( hwnd
, wParam
);
1241 SendMessage( hwnd
, WM_SYSCOMMAND
, SC_SIZE
+ wParam
- HTLEFT
+1, lParam
);
1248 ReleaseDC( hwnd
, hdc
);
1253 /***********************************************************************
1254 * NC_HandleNCLButtonDblClk
1256 * Handle a WM_NCLBUTTONDBLCLK message. Called from DefWindowProc().
1258 LONG
NC_HandleNCLButtonDblClk( HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
1261 * if this is an icon, send a restore since we are handling
1266 SendMessage(hwnd
, WM_SYSCOMMAND
, SC_RESTORE
, lParam
);
1270 switch(wParam
) /* Hit test */
1273 /* stop processing if WS_MAXIMIZEBOX is missing */
1275 if( GetWindowLong( hwnd
, GWL_STYLE
) & WS_MAXIMIZEBOX
)
1276 SendMessage( hwnd
, WM_SYSCOMMAND
,
1277 IsZoomed(hwnd
) ? SC_RESTORE
: SC_MAXIMIZE
, lParam
);
1281 SendMessage( hwnd
, WM_SYSCOMMAND
, SC_CLOSE
, lParam
);
1288 /***********************************************************************
1289 * NC_HandleSysCommand
1291 * Handle a WM_SYSCOMMAND message. Called from DefWindowProc().
1293 LONG
NC_HandleSysCommand( HWND hwnd
, WPARAM wParam
, POINT pt
)
1295 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
1297 dprintf_nonclient(stddeb
, "Handling WM_SYSCOMMAND %lx %ld,%ld\n",
1298 (DWORD
)wParam
, (LONG
)pt
.x
, (LONG
)pt
.y
);
1300 if (wndPtr
->dwStyle
& WS_CHILD
) ScreenToClient( wndPtr
->hwndParent
, &pt
);
1302 switch (wParam
& 0xfff0)
1306 NC_DoSizeMove( hwnd
, wParam
, pt
);
1310 ShowWindow( hwnd
, SW_MINIMIZE
);
1314 ShowWindow( hwnd
, SW_MAXIMIZE
);
1318 ShowWindow( hwnd
, SW_RESTORE
);
1326 return SendMessage( hwnd
, WM_CLOSE
, 0, 0 );
1330 NC_TrackScrollBar( hwnd
, wParam
, pt
);
1334 MENU_TrackMouseMenuBar( hwnd
, pt
);
1338 MENU_TrackKbdMenuBar( hwnd
, wParam
);
1345 WinExec( "taskman.exe", SW_SHOWNORMAL
);
1352 if (wParam
== SC_ABOUTWINE
)
1354 extern const char people
[];
1355 ShellAbout(hwnd
,"WINE",people
,0);