2 * Non-client area window functions
4 * Copyright 1994 Alexandre Julliard
11 #include "sysmetrics.h"
19 #include "nonclient.h"
22 #include "selectors.h"
23 #include "stackframe.h"
25 /* #define DEBUG_NONCLIENT */
30 static HBITMAP hbitmapClose
= 0;
31 static HBITMAP hbitmapMinimize
= 0;
32 static HBITMAP hbitmapMinimizeD
= 0;
33 static HBITMAP hbitmapMaximize
= 0;
34 static HBITMAP hbitmapMaximizeD
= 0;
35 static HBITMAP hbitmapRestore
= 0;
36 static HBITMAP hbitmapRestoreD
= 0;
38 #define SC_ABOUTWINE (SC_SCREENSAVE+1)
40 /* Some useful macros */
41 #define HAS_DLGFRAME(style,exStyle) \
42 (((exStyle) & WS_EX_DLGMODALFRAME) || \
43 (((style) & WS_DLGFRAME) && !((style) & WS_BORDER)))
45 #define HAS_THICKFRAME(style) \
46 (((style) & WS_THICKFRAME) && \
47 !(((style) & (WS_DLGFRAME|WS_BORDER)) == WS_DLGFRAME))
49 #define HAS_MENU(w) (!((w)->dwStyle & WS_CHILD) && ((w)->wIDmenu != 0))
51 #define ON_LEFT_BORDER(hit) \
52 (((hit) == HTLEFT) || ((hit) == HTTOPLEFT) || ((hit) == HTBOTTOMLEFT))
53 #define ON_RIGHT_BORDER(hit) \
54 (((hit) == HTRIGHT) || ((hit) == HTTOPRIGHT) || ((hit) == HTBOTTOMRIGHT))
55 #define ON_TOP_BORDER(hit) \
56 (((hit) == HTTOP) || ((hit) == HTTOPLEFT) || ((hit) == HTTOPRIGHT))
57 #define ON_BOTTOM_BORDER(hit) \
58 (((hit) == HTBOTTOM) || ((hit) == HTBOTTOMLEFT) || ((hit) == HTBOTTOMRIGHT))
60 /***********************************************************************
63 * Compute the size of the window rectangle from the size of the
66 static void NC_AdjustRect( LPRECT rect
, DWORD style
, BOOL menu
, DWORD exStyle
)
68 if (style
& WS_ICONIC
) return; /* Nothing to change for an icon */
70 /* Decide if the window will be managed (see CreateWindowEx) */
71 if (!(Options
.managed
&& ((style
& (WS_DLGFRAME
| WS_THICKFRAME
)) ||
72 (exStyle
& WS_EX_DLGMODALFRAME
))))
74 if (HAS_DLGFRAME( style
, exStyle
))
75 InflateRect( rect
, SYSMETRICS_CXDLGFRAME
, SYSMETRICS_CYDLGFRAME
);
78 if (HAS_THICKFRAME(style
))
79 InflateRect( rect
, SYSMETRICS_CXFRAME
, SYSMETRICS_CYFRAME
);
80 if (style
& WS_BORDER
)
81 InflateRect( rect
, SYSMETRICS_CXBORDER
, SYSMETRICS_CYBORDER
);
84 if ((style
& WS_CAPTION
) == WS_CAPTION
)
85 rect
->top
-= SYSMETRICS_CYCAPTION
- SYSMETRICS_CYBORDER
;
87 if (menu
) rect
->top
-= SYSMETRICS_CYMENU
+ SYSMETRICS_CYBORDER
;
89 if (style
& WS_VSCROLL
) rect
->right
+= SYSMETRICS_CXVSCROLL
;
90 if (style
& WS_HSCROLL
) rect
->bottom
+= SYSMETRICS_CYHSCROLL
;
94 /***********************************************************************
95 * AdjustWindowRect (USER.102)
97 BOOL
AdjustWindowRect( LPRECT rect
, DWORD style
, BOOL menu
)
99 return AdjustWindowRectEx( rect
, style
, menu
, 0 );
103 /***********************************************************************
104 * AdjustWindowRectEx (USER.454)
106 BOOL
AdjustWindowRectEx( LPRECT rect
, DWORD style
, BOOL menu
, DWORD exStyle
)
108 /* Correct the window style */
110 if (!(style
& (WS_POPUP
| WS_CHILD
))) /* Overlapped window */
112 if (exStyle
& WS_EX_DLGMODALFRAME
) style
&= ~WS_THICKFRAME
;
114 dprintf_nonclient(stddeb
, "AdjustWindowRectEx: (%d,%d)-(%d,%d) %08lx %d %08lx\n",
115 rect
->left
, rect
->top
, rect
->right
, rect
->bottom
,
116 style
, menu
, exStyle
);
118 NC_AdjustRect( rect
, style
, menu
, exStyle
);
123 /*******************************************************************
126 * Get the minimized and maximized information for a window.
128 void NC_GetMinMaxInfo( HWND hwnd
, POINT
*maxSize
, POINT
*maxPos
,
129 POINT
*minTrack
, POINT
*maxTrack
)
133 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
135 /* Compute default values */
137 MinMax
.ptMaxSize
.x
= SYSMETRICS_CXSCREEN
;
138 MinMax
.ptMaxSize
.y
= SYSMETRICS_CYSCREEN
;
139 MinMax
.ptMinTrackSize
.x
= SYSMETRICS_CXMINTRACK
;
140 MinMax
.ptMinTrackSize
.y
= SYSMETRICS_CYMINTRACK
;
141 MinMax
.ptMaxTrackSize
.x
= SYSMETRICS_CXSCREEN
;
142 MinMax
.ptMaxTrackSize
.y
= SYSMETRICS_CYSCREEN
;
144 if (wndPtr
->flags
& WIN_MANAGED
) xinc
= yinc
= 0;
145 else if (HAS_DLGFRAME( wndPtr
->dwStyle
, wndPtr
->dwExStyle
))
147 xinc
= SYSMETRICS_CXDLGFRAME
;
148 yinc
= SYSMETRICS_CYDLGFRAME
;
153 if (HAS_THICKFRAME(wndPtr
->dwStyle
))
155 xinc
+= SYSMETRICS_CXFRAME
;
156 yinc
+= SYSMETRICS_CYFRAME
;
158 if (wndPtr
->dwStyle
& WS_BORDER
)
160 xinc
+= SYSMETRICS_CXBORDER
;
161 yinc
+= SYSMETRICS_CYBORDER
;
164 MinMax
.ptMaxSize
.x
+= 2 * xinc
;
165 MinMax
.ptMaxSize
.y
+= 2 * yinc
;
167 /* Note: The '+' in the following test should really be a ||, but
168 * that would cause gcc-2.7.0 to generate incorrect code.
170 if ((wndPtr
->ptMaxPos
.x
!= -1) + (wndPtr
->ptMaxPos
.y
!= -1))
171 MinMax
.ptMaxPosition
= wndPtr
->ptMaxPos
;
174 MinMax
.ptMaxPosition
.x
= -xinc
;
175 MinMax
.ptMaxPosition
.y
= -yinc
;
178 SendMessage( hwnd
, WM_GETMINMAXINFO
, 0, (LPARAM
)MAKE_SEGPTR(&MinMax
) );
180 /* Some sanity checks */
182 dprintf_nonclient(stddeb
,
183 "NC_GetMinMaxInfo: %d %d / %d %d / %d %d / %d %d\n",
184 (int)MinMax
.ptMaxSize
.x
,(int)MinMax
.ptMaxSize
.y
,
185 (int)MinMax
.ptMaxPosition
.x
,(int)MinMax
.ptMaxPosition
.y
,
186 (int)MinMax
.ptMaxTrackSize
.x
,(int)MinMax
.ptMaxTrackSize
.y
,
187 (int)MinMax
.ptMinTrackSize
.x
,(int)MinMax
.ptMinTrackSize
.y
);
188 MinMax
.ptMaxTrackSize
.x
= MAX( MinMax
.ptMaxTrackSize
.x
,
189 MinMax
.ptMinTrackSize
.x
);
190 MinMax
.ptMaxTrackSize
.y
= MAX( MinMax
.ptMaxTrackSize
.y
,
191 MinMax
.ptMinTrackSize
.y
);
193 if (maxSize
) *maxSize
= MinMax
.ptMaxSize
;
194 if (maxPos
) *maxPos
= MinMax
.ptMaxPosition
;
195 if (minTrack
) *minTrack
= MinMax
.ptMinTrackSize
;
196 if (maxTrack
) *maxTrack
= MinMax
.ptMaxTrackSize
;
200 /***********************************************************************
201 * NC_HandleNCCalcSize
203 * Handle a WM_NCCALCSIZE message. Called from DefWindowProc().
205 LONG
NC_HandleNCCalcSize( HWND hwnd
, NCCALCSIZE_PARAMS
*params
)
207 RECT tmpRect
= { 0, 0, 0, 0 };
208 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
210 if (!wndPtr
) return 0;
211 NC_AdjustRect( &tmpRect
, wndPtr
->dwStyle
, FALSE
, wndPtr
->dwExStyle
);
212 params
->rgrc
[0].left
-= tmpRect
.left
;
213 params
->rgrc
[0].top
-= tmpRect
.top
;
214 params
->rgrc
[0].right
-= tmpRect
.right
;
215 params
->rgrc
[0].bottom
-= tmpRect
.bottom
;
217 if (HAS_MENU(wndPtr
))
219 params
->rgrc
[0].top
+= MENU_GetMenuBarHeight( hwnd
,
220 params
->rgrc
[0].right
- params
->rgrc
[0].left
,
221 -tmpRect
.left
, -tmpRect
.top
) + 1;
227 /***********************************************************************
230 * Get the 'inside' rectangle of a window, i.e. the whole window rectangle
231 * but without the borders (if any).
232 * The rectangle is in window coordinates (for drawing with GetWindowDC()).
234 void NC_GetInsideRect( HWND hwnd
, RECT
*rect
)
236 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
238 rect
->top
= rect
->left
= 0;
239 rect
->right
= wndPtr
->rectWindow
.right
- wndPtr
->rectWindow
.left
;
240 rect
->bottom
= wndPtr
->rectWindow
.bottom
- wndPtr
->rectWindow
.top
;
242 if (wndPtr
->dwStyle
& WS_ICONIC
) return; /* No border to remove */
243 if (wndPtr
->flags
& WIN_MANAGED
) return;
245 /* Remove frame from rectangle */
246 if (HAS_DLGFRAME( wndPtr
->dwStyle
, wndPtr
->dwExStyle
))
248 InflateRect( rect
, -SYSMETRICS_CXDLGFRAME
, -SYSMETRICS_CYDLGFRAME
);
249 if (wndPtr
->dwExStyle
& WS_EX_DLGMODALFRAME
) InflateRect( rect
, -1, 0);
253 if (HAS_THICKFRAME( wndPtr
->dwStyle
))
254 InflateRect( rect
, -SYSMETRICS_CXFRAME
, -SYSMETRICS_CYFRAME
);
255 if (wndPtr
->dwStyle
& WS_BORDER
)
256 InflateRect( rect
, -SYSMETRICS_CXBORDER
, -SYSMETRICS_CYBORDER
);
261 /***********************************************************************
264 * Handle a WM_NCHITTEST message. Called from DefWindowProc().
266 LONG
NC_HandleNCHitTest( HWND hwnd
, POINT pt
)
269 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
270 if (!wndPtr
) return HTERROR
;
272 dprintf_nonclient(stddeb
, "NC_HandleNCHitTest: hwnd=%04x pt=%d,%d\n",
275 GetWindowRect( hwnd
, &rect
);
276 if (!PtInRect( &rect
, pt
)) return HTNOWHERE
;
278 if (wndPtr
->dwStyle
& WS_MINIMIZE
) return HTCAPTION
;
280 if (!(wndPtr
->flags
& WIN_MANAGED
))
283 if (HAS_THICKFRAME( wndPtr
->dwStyle
))
285 InflateRect( &rect
, -SYSMETRICS_CXFRAME
, -SYSMETRICS_CYFRAME
);
286 if (wndPtr
->dwStyle
& WS_BORDER
)
287 InflateRect(&rect
, -SYSMETRICS_CXBORDER
, -SYSMETRICS_CYBORDER
);
288 if (!PtInRect( &rect
, pt
))
290 /* Check top sizing border */
293 if (pt
.x
< rect
.left
+SYSMETRICS_CXSIZE
) return HTTOPLEFT
;
294 if (pt
.x
>= rect
.right
-SYSMETRICS_CXSIZE
) return HTTOPRIGHT
;
297 /* Check bottom sizing border */
298 if (pt
.y
>= rect
.bottom
)
300 if (pt
.x
< rect
.left
+SYSMETRICS_CXSIZE
) return HTBOTTOMLEFT
;
301 if (pt
.x
>= rect
.right
-SYSMETRICS_CXSIZE
) return HTBOTTOMRIGHT
;
304 /* Check left sizing border */
305 if (pt
.x
< rect
.left
)
307 if (pt
.y
< rect
.top
+SYSMETRICS_CYSIZE
) return HTTOPLEFT
;
308 if (pt
.y
>= rect
.bottom
-SYSMETRICS_CYSIZE
) return HTBOTTOMLEFT
;
311 /* Check right sizing border */
312 if (pt
.x
>= rect
.right
)
314 if (pt
.y
< rect
.top
+SYSMETRICS_CYSIZE
) return HTTOPRIGHT
;
315 if (pt
.y
>= rect
.bottom
-SYSMETRICS_CYSIZE
) return HTBOTTOMRIGHT
;
320 else /* No thick frame */
322 if (HAS_DLGFRAME( wndPtr
->dwStyle
, wndPtr
->dwExStyle
))
323 InflateRect(&rect
, -SYSMETRICS_CXDLGFRAME
, -SYSMETRICS_CYDLGFRAME
);
324 else if (wndPtr
->dwStyle
& WS_BORDER
)
325 InflateRect(&rect
, -SYSMETRICS_CXBORDER
, -SYSMETRICS_CYBORDER
);
326 if (!PtInRect( &rect
, pt
)) return HTBORDER
;
331 if ((wndPtr
->dwStyle
& WS_CAPTION
) == WS_CAPTION
)
333 rect
.top
+= SYSMETRICS_CYCAPTION
- 1;
334 if (!PtInRect( &rect
, pt
))
336 /* Check system menu */
337 if (wndPtr
->dwStyle
& WS_SYSMENU
)
338 rect
.left
+= SYSMETRICS_CXSIZE
;
339 if (pt
.x
<= rect
.left
) return HTSYSMENU
;
340 /* Check maximize box */
341 if (wndPtr
->dwStyle
& WS_MAXIMIZEBOX
)
342 rect
.right
-= SYSMETRICS_CXSIZE
+ 1;
343 if (pt
.x
>= rect
.right
) return HTMAXBUTTON
;
344 /* Check minimize box */
345 if (wndPtr
->dwStyle
& WS_MINIMIZEBOX
)
346 rect
.right
-= SYSMETRICS_CXSIZE
+ 1;
347 if (pt
.x
>= rect
.right
) return HTMINBUTTON
;
353 /* Check client area */
355 ScreenToClient( hwnd
, &pt
);
356 GetClientRect( hwnd
, &rect
);
357 if (PtInRect( &rect
, pt
)) return HTCLIENT
;
359 /* Check vertical scroll bar */
361 if (wndPtr
->dwStyle
& WS_VSCROLL
)
363 rect
.right
+= SYSMETRICS_CXVSCROLL
;
364 if (PtInRect( &rect
, pt
)) return HTVSCROLL
;
367 /* Check horizontal scroll bar */
369 if (wndPtr
->dwStyle
& WS_HSCROLL
)
371 rect
.bottom
+= SYSMETRICS_CYHSCROLL
;
372 if (PtInRect( &rect
, pt
))
375 if ((wndPtr
->dwStyle
& WS_VSCROLL
) &&
376 (pt
.x
>= rect
.right
- SYSMETRICS_CXVSCROLL
))
384 if (HAS_MENU(wndPtr
))
386 if ((pt
.y
< 0) && (pt
.x
>= 0) && (pt
.x
< rect
.right
))
390 /* Should never get here */
395 /***********************************************************************
398 void NC_DrawSysButton( HWND hwnd
, HDC hdc
, BOOL down
)
403 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
405 NC_GetInsideRect( hwnd
, &rect
);
406 hdcMem
= CreateCompatibleDC( hdc
);
407 hbitmap
= SelectObject( hdcMem
, hbitmapClose
);
408 BitBlt( hdc
, rect
.left
, rect
.top
, SYSMETRICS_CXSIZE
, SYSMETRICS_CYSIZE
,
409 hdcMem
, (wndPtr
->dwStyle
& WS_CHILD
) ? SYSMETRICS_CXSIZE
: 0, 0,
410 down
? NOTSRCCOPY
: SRCCOPY
);
411 SelectObject( hdcMem
, hbitmap
);
416 /***********************************************************************
419 static void NC_DrawMaxButton( HWND hwnd
, HDC hdc
, BOOL down
)
422 NC_GetInsideRect( hwnd
, &rect
);
423 GRAPH_DrawBitmap( hdc
, (IsZoomed(hwnd
) ?
424 (down
? hbitmapRestoreD
: hbitmapRestore
) :
425 (down
? hbitmapMaximizeD
: hbitmapMaximize
)),
426 rect
.right
- SYSMETRICS_CXSIZE
- 1, rect
.top
,
427 0, 0, SYSMETRICS_CXSIZE
+1, SYSMETRICS_CYSIZE
);
431 /***********************************************************************
434 static void NC_DrawMinButton( HWND hwnd
, HDC hdc
, BOOL down
)
437 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
438 NC_GetInsideRect( hwnd
, &rect
);
439 if (wndPtr
->dwStyle
& WS_MAXIMIZEBOX
) rect
.right
-= SYSMETRICS_CXSIZE
+ 1;
440 GRAPH_DrawBitmap( hdc
, (down
? hbitmapMinimizeD
: hbitmapMinimize
),
441 rect
.right
- SYSMETRICS_CXSIZE
- 1, rect
.top
,
442 0, 0, SYSMETRICS_CXSIZE
+1, SYSMETRICS_CYSIZE
);
446 /***********************************************************************
449 * Draw a window frame inside the given rectangle, and update the rectangle.
450 * The correct pen for the frame must be selected in the DC.
452 static void NC_DrawFrame( HDC hdc
, RECT
*rect
, BOOL dlgFrame
, BOOL active
)
454 short width
, height
, tmp
;
458 width
= SYSMETRICS_CXDLGFRAME
- 1;
459 height
= SYSMETRICS_CYDLGFRAME
- 1;
460 SelectObject( hdc
, active
? sysColorObjects
.hbrushActiveCaption
:
461 sysColorObjects
.hbrushInactiveCaption
);
465 width
= SYSMETRICS_CXFRAME
- 1;
466 height
= SYSMETRICS_CYFRAME
- 1;
467 SelectObject( hdc
, active
? sysColorObjects
.hbrushActiveBorder
:
468 sysColorObjects
.hbrushInactiveBorder
);
472 PatBlt( hdc
, rect
->left
, rect
->top
,
473 rect
->right
- rect
->left
, height
, PATCOPY
);
474 PatBlt( hdc
, rect
->left
, rect
->top
,
475 width
, rect
->bottom
- rect
->top
, PATCOPY
);
476 PatBlt( hdc
, rect
->left
, rect
->bottom
,
477 rect
->right
- rect
->left
, -height
, PATCOPY
);
478 PatBlt( hdc
, rect
->right
, rect
->top
,
479 -width
, rect
->bottom
- rect
->top
, PATCOPY
);
483 InflateRect( rect
, -width
, -height
);
487 /* Draw inner rectangle */
488 MoveTo( hdc
, rect
->left
+width
, rect
->top
+height
);
489 LineTo( hdc
, rect
->right
-width
-1, rect
->top
+height
);
490 LineTo( hdc
, rect
->right
-width
-1, rect
->bottom
-height
-1 );
491 LineTo( hdc
, rect
->left
+width
, rect
->bottom
-height
-1 );
492 LineTo( hdc
, rect
->left
+width
, rect
->top
+height
);
494 /* Draw the decorations */
495 tmp
= rect
->top
+ SYSMETRICS_CYFRAME
+ SYSMETRICS_CYSIZE
;
496 MoveTo( hdc
, rect
->left
, tmp
);
497 LineTo( hdc
, rect
->left
+width
, tmp
);
498 MoveTo( hdc
, rect
->right
-width
-1, tmp
);
499 LineTo( hdc
, rect
->right
-1, tmp
);
501 tmp
= rect
->bottom
- 1 - SYSMETRICS_CYFRAME
- SYSMETRICS_CYSIZE
;
502 MoveTo( hdc
, rect
->left
, tmp
);
503 LineTo( hdc
, rect
->left
+width
, tmp
);
504 MoveTo( hdc
, rect
->right
-width
-1, tmp
);
505 LineTo( hdc
, rect
->right
-1, tmp
);
507 tmp
= rect
->left
+ SYSMETRICS_CXFRAME
+ SYSMETRICS_CXSIZE
;
508 MoveTo( hdc
, tmp
, rect
->top
);
509 LineTo( hdc
, tmp
, rect
->top
+height
);
510 MoveTo( hdc
, tmp
, rect
->bottom
-height
-1 );
511 LineTo( hdc
, tmp
, rect
->bottom
-1 );
513 tmp
= rect
->right
- 1 - SYSMETRICS_CXFRAME
- SYSMETRICS_CYSIZE
;
514 MoveTo( hdc
, tmp
, rect
->top
);
515 LineTo( hdc
, tmp
, rect
->top
+height
);
516 MoveTo( hdc
, tmp
, rect
->bottom
-height
-1 );
517 LineTo( hdc
, tmp
, rect
->bottom
-1 );
519 InflateRect( rect
, -width
-1, -height
-1 );
523 /***********************************************************************
526 * Draw the frame used when moving or resizing window.
528 static void NC_DrawMovingFrame( HDC hdc
, RECT
*rect
, BOOL thickframe
)
532 SelectObject( hdc
, GetStockObject( GRAY_BRUSH
) );
533 PatBlt( hdc
, rect
->left
, rect
->top
,
534 rect
->right
- rect
->left
- SYSMETRICS_CXFRAME
,
535 SYSMETRICS_CYFRAME
, PATINVERT
);
536 PatBlt( hdc
, rect
->left
, rect
->top
+ SYSMETRICS_CYFRAME
,
538 rect
->bottom
- rect
->top
- SYSMETRICS_CYFRAME
, PATINVERT
);
539 PatBlt( hdc
, rect
->left
+ SYSMETRICS_CXFRAME
, rect
->bottom
,
540 rect
->right
- rect
->left
- SYSMETRICS_CXFRAME
,
541 -SYSMETRICS_CYFRAME
, PATINVERT
);
542 PatBlt( hdc
, rect
->right
, rect
->top
, -SYSMETRICS_CXFRAME
,
543 rect
->bottom
- rect
->top
- SYSMETRICS_CYFRAME
, PATINVERT
);
545 else DrawFocusRect( hdc
, rect
);
549 /***********************************************************************
552 * Draw the window caption.
553 * The correct pen for the window frame must be selected in the DC.
555 static void NC_DrawCaption( HDC hdc
, RECT
*rect
, HWND hwnd
,
556 DWORD style
, BOOL active
)
559 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
564 if (!(hbitmapClose
= LoadBitmap( 0, MAKEINTRESOURCE(OBM_CLOSE
) )))
566 hbitmapMinimize
= LoadBitmap( 0, MAKEINTRESOURCE(OBM_REDUCE
) );
567 hbitmapMinimizeD
= LoadBitmap( 0, MAKEINTRESOURCE(OBM_REDUCED
) );
568 hbitmapMaximize
= LoadBitmap( 0, MAKEINTRESOURCE(OBM_ZOOM
) );
569 hbitmapMaximizeD
= LoadBitmap( 0, MAKEINTRESOURCE(OBM_ZOOMD
) );
570 hbitmapRestore
= LoadBitmap( 0, MAKEINTRESOURCE(OBM_RESTORE
) );
571 hbitmapRestoreD
= LoadBitmap( 0, MAKEINTRESOURCE(OBM_RESTORED
) );
574 if (wndPtr
->dwExStyle
& WS_EX_DLGMODALFRAME
)
576 HBRUSH hbrushOld
= SelectObject( hdc
, sysColorObjects
.hbrushWindow
);
577 PatBlt( hdc
, r
.left
, r
.top
, 1, r
.bottom
-r
.top
+1,PATCOPY
);
578 PatBlt( hdc
, r
.right
-1, r
.top
, 1, r
.bottom
-r
.top
+1, PATCOPY
);
579 PatBlt( hdc
, r
.left
, r
.top
-1, r
.right
-r
.left
, 1, PATCOPY
);
582 SelectObject( hdc
, hbrushOld
);
585 MoveTo( hdc
, r
.left
, r
.bottom
);
586 LineTo( hdc
, r
.right
-1, r
.bottom
);
588 if (style
& WS_SYSMENU
)
590 NC_DrawSysButton( hwnd
, hdc
, FALSE
);
591 r
.left
+= SYSMETRICS_CXSIZE
+ 1;
592 MoveTo( hdc
, r
.left
- 1, r
.top
);
593 LineTo( hdc
, r
.left
- 1, r
.bottom
);
595 if (style
& WS_MAXIMIZEBOX
)
597 NC_DrawMaxButton( hwnd
, hdc
, FALSE
);
598 r
.right
-= SYSMETRICS_CXSIZE
+ 1;
600 if (style
& WS_MINIMIZEBOX
)
602 NC_DrawMinButton( hwnd
, hdc
, FALSE
);
603 r
.right
-= SYSMETRICS_CXSIZE
+ 1;
606 FillRect( hdc
, &r
, active
? sysColorObjects
.hbrushActiveCaption
:
607 sysColorObjects
.hbrushInactiveCaption
);
609 if (GetWindowText( hwnd
, buffer
, 256 ))
611 if (active
) SetTextColor( hdc
, GetSysColor( COLOR_CAPTIONTEXT
) );
612 else SetTextColor( hdc
, GetSysColor( COLOR_INACTIVECAPTIONTEXT
) );
613 SetBkMode( hdc
, TRANSPARENT
);
614 DrawText( hdc
, buffer
, -1, &r
, DT_SINGLELINE
| DT_CENTER
| DT_VCENTER
);
619 /***********************************************************************
622 * Paint the non-client area. clip is currently unused.
624 void NC_DoNCPaint( HWND hwnd
, HRGN clip
, BOOL suppress_menupaint
)
630 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
632 if (!wndPtr
|| !(wndPtr
->dwStyle
& WS_VISIBLE
)) return; /* Nothing to do */
634 active
= wndPtr
->flags
& WIN_NCACTIVATED
;
636 dprintf_nonclient(stddeb
, "NC_DoNCPaint: %04x %d\n", hwnd
, active
);
638 if (!(hdc
= GetDCEx( hwnd
, 0, DCX_USESTYLE
| DCX_WINDOW
))) return;
641 * If this is an icon, we don't want to do any more nonclient painting
642 * of the window manager.
643 * If there is a class icon to draw, draw it
647 HICON hIcon
= WIN_CLASS_INFO(wndPtr
).hIcon
;
650 SendMessage(hwnd
, WM_ICONERASEBKGND
, (WPARAM
)hdc
, 0);
651 DrawIcon(hdc
, 0, 0, hIcon
);
653 ReleaseDC(hwnd
, hdc
);
654 wndPtr
->flags
&= ~WIN_INTERNAL_PAINT
;
655 if( wndPtr
->hrgnUpdate
)
657 DeleteObject( wndPtr
->hrgnUpdate
);
658 QUEUE_DecPaintCount( wndPtr
->hmemTaskQ
);
659 wndPtr
->hrgnUpdate
= 0;
664 if (ExcludeVisRect( hdc
, wndPtr
->rectClient
.left
-wndPtr
->rectWindow
.left
,
665 wndPtr
->rectClient
.top
-wndPtr
->rectWindow
.top
,
666 wndPtr
->rectClient
.right
-wndPtr
->rectWindow
.left
,
667 wndPtr
->rectClient
.bottom
-wndPtr
->rectWindow
.top
)
670 ReleaseDC( hwnd
, hdc
);
674 rect
.top
= rect
.left
= 0;
675 rect
.right
= wndPtr
->rectWindow
.right
- wndPtr
->rectWindow
.left
;
676 rect
.bottom
= wndPtr
->rectWindow
.bottom
- wndPtr
->rectWindow
.top
;
678 SelectObject( hdc
, sysColorObjects
.hpenWindowFrame
);
680 if (!(wndPtr
->flags
& WIN_MANAGED
))
682 if ((wndPtr
->dwStyle
& WS_BORDER
) || (wndPtr
->dwStyle
& WS_DLGFRAME
) ||
683 (wndPtr
->dwExStyle
& WS_EX_DLGMODALFRAME
))
686 LineTo( hdc
, rect
.right
-1, 0 );
687 LineTo( hdc
, rect
.right
-1, rect
.bottom
-1 );
688 LineTo( hdc
, 0, rect
.bottom
-1 );
690 InflateRect( &rect
, -1, -1 );
693 if (HAS_DLGFRAME( wndPtr
->dwStyle
, wndPtr
->dwExStyle
))
694 NC_DrawFrame( hdc
, &rect
, TRUE
, active
);
695 else if (wndPtr
->dwStyle
& WS_THICKFRAME
)
696 NC_DrawFrame(hdc
, &rect
, FALSE
, active
);
698 if ((wndPtr
->dwStyle
& WS_CAPTION
) == WS_CAPTION
)
701 r
.bottom
= rect
.top
+ SYSMETRICS_CYSIZE
;
702 rect
.top
+= SYSMETRICS_CYSIZE
+ SYSMETRICS_CYBORDER
;
703 NC_DrawCaption( hdc
, &r
, hwnd
, wndPtr
->dwStyle
, active
);
707 if (HAS_MENU(wndPtr
))
710 r
.bottom
= rect
.top
+ SYSMETRICS_CYMENU
; /* default height */
711 rect
.top
+= MENU_DrawMenuBar( hdc
, &r
, hwnd
, suppress_menupaint
);
714 /* Draw the scroll-bars */
716 if (wndPtr
->dwStyle
& WS_VSCROLL
) SCROLL_DrawScrollBar(hwnd
, hdc
, SB_VERT
);
717 if (wndPtr
->dwStyle
& WS_HSCROLL
) SCROLL_DrawScrollBar(hwnd
, hdc
, SB_HORZ
);
719 /* Draw the "size-box" */
721 if ((wndPtr
->dwStyle
& WS_VSCROLL
) && (wndPtr
->dwStyle
& WS_HSCROLL
))
724 r
.left
= r
.right
- SYSMETRICS_CXVSCROLL
+ 1;
725 r
.top
= r
.bottom
- SYSMETRICS_CYHSCROLL
+ 1;
726 FillRect( hdc
, &r
, sysColorObjects
.hbrushScrollbar
);
729 ReleaseDC( hwnd
, hdc
);
734 /***********************************************************************
737 * Handle a WM_NCPAINT message. Called from DefWindowProc().
739 LONG
NC_HandleNCPaint( HWND hwnd
, HRGN clip
)
741 NC_DoNCPaint( hwnd
, clip
, FALSE
);
746 /***********************************************************************
747 * NC_HandleNCActivate
749 * Handle a WM_NCACTIVATE message. Called from DefWindowProc().
751 LONG
NC_HandleNCActivate( HWND hwnd
, WPARAM wParam
)
753 WND
*wndPtr
= WIN_FindWndPtr(hwnd
);
755 if (wParam
!= 0) wndPtr
->flags
|= WIN_NCACTIVATED
;
756 else wndPtr
->flags
&= ~WIN_NCACTIVATED
;
758 NC_DoNCPaint( hwnd
, (HRGN
)1, FALSE
);
763 /***********************************************************************
766 * Handle a WM_SETCURSOR message. Called from DefWindowProc().
768 LONG
NC_HandleSetCursor( HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
770 if (hwnd
!= (HWND
)wParam
) return 0; /* Don't set the cursor for child windows */
772 switch(LOWORD(lParam
))
776 WORD msg
= HIWORD( lParam
);
777 if ((msg
== WM_LBUTTONDOWN
) || (msg
== WM_MBUTTONDOWN
) ||
778 (msg
== WM_RBUTTONDOWN
))
787 if (!(wndPtr
= WIN_FindWndPtr( hwnd
))) break;
788 if (!(classPtr
= CLASS_FindClassPtr( wndPtr
->hClass
))) break;
789 if (classPtr
->wc
.hCursor
)
791 SetCursor( classPtr
->wc
.hCursor
);
799 return (LONG
)SetCursor( LoadCursor( 0, IDC_SIZEWE
) );
803 return (LONG
)SetCursor( LoadCursor( 0, IDC_SIZENS
) );
807 return (LONG
)SetCursor( LoadCursor( 0, IDC_SIZENWSE
) );
811 return (LONG
)SetCursor( LoadCursor( 0, IDC_SIZENESW
) );
814 /* Default cursor: arrow */
815 return (LONG
)SetCursor( LoadCursor( 0, IDC_ARROW
) );
819 /***********************************************************************
822 * Track a mouse button press on the system menu.
824 static void NC_TrackSysMenu( HWND hwnd
, HDC hdc
, POINT pt
)
827 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
828 int iconic
= wndPtr
->dwStyle
& WS_MINIMIZE
;
830 if (!(wndPtr
->dwStyle
& WS_SYSMENU
)) return;
831 /* If window has a menu, track the menu bar normally if it not minimized */
832 if (HAS_MENU(wndPtr
) && !iconic
) MENU_TrackMouseMenuBar( hwnd
, pt
);
835 /* Otherwise track the system menu like a normal popup menu */
836 NC_GetInsideRect( hwnd
, &rect
);
837 OffsetRect( &rect
, wndPtr
->rectWindow
.left
, wndPtr
->rectWindow
.top
);
838 if (wndPtr
->dwStyle
& WS_CHILD
)
839 ClientToScreen( wndPtr
->parent
->hwndSelf
, (POINT
*)&rect
);
840 rect
.right
= rect
.left
+ SYSMETRICS_CXSIZE
;
841 rect
.bottom
= rect
.top
+ SYSMETRICS_CYSIZE
;
842 if (!iconic
) NC_DrawSysButton( hwnd
, hdc
, TRUE
);
843 TrackPopupMenu( wndPtr
->hSysMenu
, TPM_LEFTALIGN
| TPM_LEFTBUTTON
,
844 rect
.left
, rect
.bottom
, 0, hwnd
, &rect
);
845 if (!iconic
) NC_DrawSysButton( hwnd
, hdc
, FALSE
);
850 /***********************************************************************
853 * Initialisation of a move or resize, when initiatied from a menu choice.
854 * Return hit test code for caption or sizing border.
856 static LONG
NC_StartSizeMove( HWND hwnd
, WPARAM wParam
, POINT
*capturePoint
)
861 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
863 if ((wParam
& 0xfff0) == SC_MOVE
)
865 /* Move pointer at the center of the caption */
867 NC_GetInsideRect( hwnd
, &rect
);
868 if (wndPtr
->dwStyle
& WS_SYSMENU
)
869 rect
.left
+= SYSMETRICS_CXSIZE
+ 1;
870 if (wndPtr
->dwStyle
& WS_MINIMIZEBOX
)
871 rect
.right
-= SYSMETRICS_CXSIZE
+ 1;
872 if (wndPtr
->dwStyle
& WS_MAXIMIZEBOX
)
873 rect
.right
-= SYSMETRICS_CXSIZE
+ 1;
874 pt
.x
= wndPtr
->rectWindow
.left
+ (rect
.right
- rect
.left
) / 2;
875 pt
.y
= wndPtr
->rectWindow
.top
+ rect
.top
+ SYSMETRICS_CYSIZE
/2;
876 if (wndPtr
->dwStyle
& WS_CHILD
)
877 ClientToScreen( wndPtr
->parent
->hwndSelf
, &pt
);
885 MSG_GetHardwareMessage( &msg
);
889 hittest
= NC_HandleNCHitTest( hwnd
, msg
.pt
);
891 if ((hittest
< HTLEFT
) || (hittest
> HTBOTTOMRIGHT
))
903 pt
.x
=(wndPtr
->rectWindow
.left
+wndPtr
->rectWindow
.right
)/2;
904 pt
.y
= wndPtr
->rectWindow
.top
+ SYSMETRICS_CYFRAME
/ 2;
908 pt
.x
=(wndPtr
->rectWindow
.left
+wndPtr
->rectWindow
.right
)/2;
909 pt
.y
= wndPtr
->rectWindow
.bottom
- SYSMETRICS_CYFRAME
/ 2;
913 pt
.x
= wndPtr
->rectWindow
.left
+ SYSMETRICS_CXFRAME
/ 2;
914 pt
.y
=(wndPtr
->rectWindow
.top
+wndPtr
->rectWindow
.bottom
)/2;
918 pt
.x
= wndPtr
->rectWindow
.right
- SYSMETRICS_CXFRAME
/ 2;
919 pt
.y
=(wndPtr
->rectWindow
.top
+wndPtr
->rectWindow
.bottom
)/2;
922 case VK_ESCAPE
: return 0;
928 SetCursorPos( capturePoint
->x
, capturePoint
->y
);
929 NC_HandleSetCursor( hwnd
, (WPARAM
)hwnd
, MAKELONG( hittest
, WM_MOUSEMOVE
));
934 /***********************************************************************
937 * Perform SC_MOVE and SC_SIZE commands.
939 static void NC_DoSizeMove( HWND hwnd
, WORD wParam
, POINT pt
)
943 RECT sizingRect
, mouseRect
;
946 POINT minTrack
, maxTrack
, capturePoint
= pt
;
947 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
950 if (IsZoomed(hwnd
) || !IsWindowVisible(hwnd
) ||
951 (wndPtr
->flags
& WIN_MANAGED
)) return;
952 hittest
= wParam
& 0x0f;
953 thickframe
= HAS_THICKFRAME( wndPtr
->dwStyle
);
955 if ((wParam
& 0xfff0) == SC_MOVE
)
957 if (!(wndPtr
->dwStyle
& WS_CAPTION
)) return;
958 if (!hittest
) hittest
= NC_StartSizeMove( hwnd
, wParam
, &capturePoint
);
959 if (!hittest
) return;
963 if (!thickframe
) return;
964 if (hittest
) hittest
+= HTLEFT
-1;
968 hittest
= NC_StartSizeMove( hwnd
, wParam
, &capturePoint
);
977 /* Get min/max info */
979 NC_GetMinMaxInfo( hwnd
, NULL
, NULL
, &minTrack
, &maxTrack
);
980 sizingRect
= wndPtr
->rectWindow
;
981 if (wndPtr
->dwStyle
& WS_CHILD
)
982 GetClientRect( wndPtr
->parent
->hwndSelf
, &mouseRect
);
983 else SetRect( &mouseRect
, 0, 0, SYSMETRICS_CXSCREEN
, SYSMETRICS_CYSCREEN
);
984 if (ON_LEFT_BORDER(hittest
))
986 mouseRect
.left
= MAX( mouseRect
.left
, sizingRect
.right
-maxTrack
.x
);
987 mouseRect
.right
= MIN( mouseRect
.right
, sizingRect
.right
-minTrack
.x
);
989 else if (ON_RIGHT_BORDER(hittest
))
991 mouseRect
.left
= MAX( mouseRect
.left
, sizingRect
.left
+minTrack
.x
);
992 mouseRect
.right
= MIN( mouseRect
.right
, sizingRect
.left
+maxTrack
.x
);
994 if (ON_TOP_BORDER(hittest
))
996 mouseRect
.top
= MAX( mouseRect
.top
, sizingRect
.bottom
-maxTrack
.y
);
997 mouseRect
.bottom
= MIN( mouseRect
.bottom
,sizingRect
.bottom
-minTrack
.y
);
999 else if (ON_BOTTOM_BORDER(hittest
))
1001 mouseRect
.top
= MAX( mouseRect
.top
, sizingRect
.top
+minTrack
.y
);
1002 mouseRect
.bottom
= MIN( mouseRect
.bottom
, sizingRect
.top
+maxTrack
.y
);
1004 SendMessage( hwnd
, WM_ENTERSIZEMOVE
, 0, 0 );
1006 if (GetCapture() != hwnd
) SetCapture( hwnd
);
1008 if (wndPtr
->dwStyle
& WS_CHILD
)
1010 /* Retrieve a default cache DC (without using the window style) */
1011 hdc
= GetDCEx( wndPtr
->parent
->hwndSelf
, 0, DCX_CACHE
);
1014 { /* Grab the server only when moving top-level windows without desktop */
1016 if (rootWindow
== DefaultRootWindow(display
)) XGrabServer( display
);
1018 NC_DrawMovingFrame( hdc
, &sizingRect
, thickframe
);
1024 MSG_GetHardwareMessage( &msg
);
1026 /* Exit on button-up, Return, or Esc */
1027 if ((msg
.message
== WM_LBUTTONUP
) ||
1028 ((msg
.message
== WM_KEYDOWN
) &&
1029 ((msg
.wParam
== VK_RETURN
) || (msg
.wParam
== VK_ESCAPE
)))) break;
1031 if ((msg
.message
!= WM_KEYDOWN
) && (msg
.message
!= WM_MOUSEMOVE
))
1032 continue; /* We are not interested in other messages */
1035 if (wndPtr
->dwStyle
& WS_CHILD
)
1036 ScreenToClient( wndPtr
->parent
->hwndSelf
, &pt
);
1039 if (msg
.message
== WM_KEYDOWN
) switch(msg
.wParam
)
1041 case VK_UP
: pt
.y
-= 8; break;
1042 case VK_DOWN
: pt
.y
+= 8; break;
1043 case VK_LEFT
: pt
.x
-= 8; break;
1044 case VK_RIGHT
: pt
.x
+= 8; break;
1047 pt
.x
= MAX( pt
.x
, mouseRect
.left
);
1048 pt
.x
= MIN( pt
.x
, mouseRect
.right
);
1049 pt
.y
= MAX( pt
.y
, mouseRect
.top
);
1050 pt
.y
= MIN( pt
.y
, mouseRect
.bottom
);
1052 dx
= pt
.x
- capturePoint
.x
;
1053 dy
= pt
.y
- capturePoint
.y
;
1058 if (msg
.message
== WM_KEYDOWN
) SetCursorPos( pt
.x
, pt
.y
);
1061 RECT newRect
= sizingRect
;
1063 if (hittest
== HTCAPTION
) OffsetRect( &newRect
, dx
, dy
);
1064 if (ON_LEFT_BORDER(hittest
)) newRect
.left
+= dx
;
1065 else if (ON_RIGHT_BORDER(hittest
)) newRect
.right
+= dx
;
1066 if (ON_TOP_BORDER(hittest
)) newRect
.top
+= dy
;
1067 else if (ON_BOTTOM_BORDER(hittest
)) newRect
.bottom
+= dy
;
1068 NC_DrawMovingFrame( hdc
, &sizingRect
, thickframe
);
1069 NC_DrawMovingFrame( hdc
, &newRect
, thickframe
);
1071 sizingRect
= newRect
;
1076 NC_DrawMovingFrame( hdc
, &sizingRect
, thickframe
);
1079 if (wndPtr
->dwStyle
& WS_CHILD
) ReleaseDC( wndPtr
->parent
->hwndSelf
, hdc
);
1082 ReleaseDC( 0, hdc
);
1083 if (rootWindow
== DefaultRootWindow(display
)) XUngrabServer( display
);
1085 SendMessage( hwnd
, WM_EXITSIZEMOVE
, 0, 0 );
1086 SendMessage( hwnd
, WM_SETVISIBLE
, !IsIconic(hwnd
), 0L);
1088 /* Single click brings up the system menu when iconized */
1090 if (!moved
&& (wndPtr
->dwStyle
& WS_MINIMIZE
))
1092 NC_TrackSysMenu( hwnd
, hdc
, pt
);
1096 /* If Esc key, don't move the window */
1097 if ((msg
.message
== WM_KEYDOWN
) && (msg
.wParam
== VK_ESCAPE
)) return;
1099 if (hittest
!= HTCAPTION
)
1100 SetWindowPos( hwnd
, 0, sizingRect
.left
, sizingRect
.top
,
1101 sizingRect
.right
- sizingRect
.left
,
1102 sizingRect
.bottom
- sizingRect
.top
,
1103 SWP_NOACTIVATE
| SWP_NOZORDER
);
1104 else SetWindowPos( hwnd
, 0, sizingRect
.left
, sizingRect
.top
, 0, 0,
1105 SWP_NOACTIVATE
| SWP_NOSIZE
| SWP_NOZORDER
);
1109 /***********************************************************************
1112 * Track a mouse button press on the minimize or maximize box.
1114 static void NC_TrackMinMaxBox( HWND hwnd
, WORD wParam
)
1117 HDC hdc
= GetWindowDC( hwnd
);
1118 BOOL pressed
= TRUE
;
1121 if (wParam
== HTMINBUTTON
) NC_DrawMinButton( hwnd
, hdc
, TRUE
);
1122 else NC_DrawMaxButton( hwnd
, hdc
, TRUE
);
1126 BOOL oldstate
= pressed
;
1127 MSG_GetHardwareMessage( &msg
);
1129 pressed
= (NC_HandleNCHitTest( hwnd
, msg
.pt
) == wParam
);
1130 if (pressed
!= oldstate
)
1132 if (wParam
== HTMINBUTTON
) NC_DrawMinButton( hwnd
, hdc
, pressed
);
1133 else NC_DrawMaxButton( hwnd
, hdc
, pressed
);
1135 } while (msg
.message
!= WM_LBUTTONUP
);
1137 if (wParam
== HTMINBUTTON
) NC_DrawMinButton( hwnd
, hdc
, FALSE
);
1138 else NC_DrawMaxButton( hwnd
, hdc
, FALSE
);
1141 ReleaseDC( hwnd
, hdc
);
1142 if (!pressed
) return;
1144 if (wParam
== HTMINBUTTON
)
1145 SendMessage( hwnd
, WM_SYSCOMMAND
, SC_MINIMIZE
, *(LONG
*)&msg
.pt
);
1147 SendMessage( hwnd
, WM_SYSCOMMAND
,
1148 IsZoomed(hwnd
) ? SC_RESTORE
: SC_MAXIMIZE
, *(LONG
*)&msg
.pt
);
1152 /***********************************************************************
1155 * Track a mouse button press on the horizontal or vertical scroll-bar.
1157 static void NC_TrackScrollBar( HWND hwnd
, WORD wParam
, POINT pt
)
1161 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
1163 if ((wParam
& 0xfff0) == SC_HSCROLL
)
1165 if ((wParam
& 0x0f) != HTHSCROLL
) return;
1166 scrollbar
= SB_HORZ
;
1168 else /* SC_VSCROLL */
1170 if ((wParam
& 0x0f) != HTVSCROLL
) return;
1171 scrollbar
= SB_VERT
;
1174 pt
.x
-= wndPtr
->rectWindow
.left
;
1175 pt
.y
-= wndPtr
->rectWindow
.top
;
1177 SCROLL_HandleScrollEvent( hwnd
, scrollbar
, WM_LBUTTONDOWN
, pt
);
1181 GetMessage( MAKE_SEGPTR(&msg
), 0, 0, 0 );
1187 pt
.x
= LOWORD(msg
.lParam
) + wndPtr
->rectClient
.left
-
1188 wndPtr
->rectWindow
.left
;
1189 pt
.y
= HIWORD(msg
.lParam
) + wndPtr
->rectClient
.top
-
1190 wndPtr
->rectWindow
.top
;
1191 SCROLL_HandleScrollEvent( hwnd
, scrollbar
, msg
.message
, pt
);
1194 TranslateMessage( &msg
);
1195 DispatchMessage( &msg
);
1198 if (!IsWindow( hwnd
))
1203 } while (msg
.message
!= WM_LBUTTONUP
);
1206 /***********************************************************************
1207 * NC_HandleNCLButtonDown
1209 * Handle a WM_NCLBUTTONDOWN message. Called from DefWindowProc().
1211 LONG
NC_HandleNCLButtonDown( HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
1213 HDC hdc
= GetWindowDC( hwnd
);
1214 POINT pt
= { LOWORD(lParam
), HIWORD(lParam
) };
1216 switch(wParam
) /* Hit test */
1219 SendMessage( hwnd
, WM_SYSCOMMAND
, SC_MOVE
+ HTCAPTION
, lParam
);
1223 NC_TrackSysMenu( hwnd
, hdc
, pt
);
1227 SendMessage( hwnd
, WM_SYSCOMMAND
, SC_MOUSEMENU
, lParam
);
1231 SendMessage( hwnd
, WM_SYSCOMMAND
, SC_HSCROLL
+ HTHSCROLL
, lParam
);
1235 SendMessage( hwnd
, WM_SYSCOMMAND
, SC_VSCROLL
+ HTVSCROLL
, lParam
);
1240 NC_TrackMinMaxBox( hwnd
, wParam
);
1251 SendMessage( hwnd
, WM_SYSCOMMAND
, SC_SIZE
+ wParam
- HTLEFT
+1, lParam
);
1258 ReleaseDC( hwnd
, hdc
);
1263 /***********************************************************************
1264 * NC_HandleNCLButtonDblClk
1266 * Handle a WM_NCLBUTTONDBLCLK message. Called from DefWindowProc().
1268 LONG
NC_HandleNCLButtonDblClk( HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
1271 * if this is an icon, send a restore since we are handling
1276 SendMessage(hwnd
, WM_SYSCOMMAND
, SC_RESTORE
, lParam
);
1280 switch(wParam
) /* Hit test */
1283 /* stop processing if WS_MAXIMIZEBOX is missing */
1285 if( GetWindowLong( hwnd
, GWL_STYLE
) & WS_MAXIMIZEBOX
)
1286 SendMessage( hwnd
, WM_SYSCOMMAND
,
1287 IsZoomed(hwnd
) ? SC_RESTORE
: SC_MAXIMIZE
, lParam
);
1291 SendMessage( hwnd
, WM_SYSCOMMAND
, SC_CLOSE
, lParam
);
1298 /***********************************************************************
1299 * NC_HandleSysCommand
1301 * Handle a WM_SYSCOMMAND message. Called from DefWindowProc().
1303 LONG
NC_HandleSysCommand( HWND hwnd
, WPARAM wParam
, POINT pt
)
1305 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
1307 dprintf_nonclient(stddeb
, "Handling WM_SYSCOMMAND %x %d,%d\n",
1308 wParam
, pt
.x
, pt
.y
);
1310 if (wndPtr
->dwStyle
& WS_CHILD
&& wParam
!= SC_KEYMENU
)
1311 ScreenToClient( wndPtr
->parent
->hwndSelf
, &pt
);
1313 switch (wParam
& 0xfff0)
1317 NC_DoSizeMove( hwnd
, wParam
, pt
);
1321 ShowWindow( hwnd
, SW_MINIMIZE
);
1325 ShowWindow( hwnd
, SW_MAXIMIZE
);
1329 ShowWindow( hwnd
, SW_RESTORE
);
1337 return SendMessage( hwnd
, WM_CLOSE
, 0, 0 );
1341 NC_TrackScrollBar( hwnd
, wParam
, pt
);
1345 MENU_TrackMouseMenuBar( hwnd
, pt
);
1349 MENU_TrackKbdMenuBar( wndPtr
, wParam
, pt
.x
);
1356 WinExec( "taskman.exe", SW_SHOWNORMAL
);
1363 if (wParam
== SC_ABOUTWINE
)
1365 extern const char people
[];
1366 ShellAbout(hwnd
,"WINE",people
,0);