Release 941122
[wine/multimedia.git] / windows / nonclient.c
blob929c1f1e08e50c9bd3e44ec3e9b239d5fcfb2e11
1 /*
2 * Non-client area window functions
4 * Copyright 1994 Alexandre Julliard
5 */
7 static char Copyright[] = "Copyright Alexandre Julliard, 1994";
9 #include "win.h"
10 #include "class.h"
11 #include "message.h"
12 #include "scroll.h"
13 #include "sysmetrics.h"
14 #include "user.h"
15 #include "syscolor.h"
16 #include "stddebug.h"
17 /* #define DEBUG_NONCLIENT */
18 /* #undef DEBUG_NONCLIENT */
19 #include "debug.h"
22 static HBITMAP hbitmapClose = 0;
23 static HBITMAP hbitmapMinimize = 0;
24 static HBITMAP hbitmapMinimizeD = 0;
25 static HBITMAP hbitmapMaximize = 0;
26 static HBITMAP hbitmapMaximizeD = 0;
27 static HBITMAP hbitmapRestore = 0;
28 static HBITMAP hbitmapRestoreD = 0;
30 #define SC_ABOUTWINE (SC_SCREENSAVE+1)
31 extern HINSTANCE hSysRes;
32 extern BOOL AboutWine_Proc( HWND hDlg, WORD msg, WORD wParam, LONG lParam );
34 extern void WINPOS_GetMinMaxInfo( HWND hwnd, POINT *maxSize, POINT *maxPos,
35 POINT *minTrack, POINT *maxTrack ); /* winpos.c */
36 extern BOOL GRAPH_DrawBitmap( HDC hdc, HBITMAP hbitmap, int xdest, int ydest,
37 int xsrc, int ysrc, int width, int height,
38 int rop ); /* graphics.c */
39 extern WORD MENU_GetMenuBarHeight( HWND hwnd, WORD menubarWidth,
40 int orgX, int orgY ); /* menu.c */
41 extern void MENU_TrackMouseMenuBar( HWND hwnd, POINT pt ); /* menu.c */
42 extern void MENU_TrackKbdMenuBar( HWND hwnd, WORD wParam ); /* menu.c */
43 extern WORD MENU_DrawMenuBar( HDC hDC, LPRECT lprect,
44 HWND hwnd, BOOL suppress_draw ); /* menu.c */
45 extern void SCROLL_HandleScrollEvent( HWND hwnd, int nBar,
46 WORD msg, POINT pt); /* scroll.c */
49 /* Some useful macros */
50 #define HAS_DLGFRAME(style,exStyle) \
51 (((style) & WS_DLGFRAME) && \
52 (((exStyle) & WS_EX_DLGMODALFRAME) || !((style) & WS_BORDER)))
54 #define HAS_THICKFRAME(style) \
55 (((style) & WS_THICKFRAME) && \
56 !(((style) & (WS_DLGFRAME|WS_BORDER)) == WS_DLGFRAME))
58 #define HAS_MENU(w) (!((w)->dwStyle & WS_CHILD) && ((w)->wIDmenu != 0))
60 #define ON_LEFT_BORDER(hit) \
61 (((hit) == HTLEFT) || ((hit) == HTTOPLEFT) || ((hit) == HTBOTTOMLEFT))
62 #define ON_RIGHT_BORDER(hit) \
63 (((hit) == HTRIGHT) || ((hit) == HTTOPRIGHT) || ((hit) == HTBOTTOMRIGHT))
64 #define ON_TOP_BORDER(hit) \
65 (((hit) == HTTOP) || ((hit) == HTTOPLEFT) || ((hit) == HTTOPRIGHT))
66 #define ON_BOTTOM_BORDER(hit) \
67 (((hit) == HTBOTTOM) || ((hit) == HTBOTTOMLEFT) || ((hit) == HTBOTTOMRIGHT))
69 /***********************************************************************
70 * NC_AdjustRect
72 * Compute the size of the window rectangle from the size of the
73 * client rectangle.
75 static void NC_AdjustRect( LPRECT rect, DWORD style, BOOL menu, DWORD exStyle )
77 if (style & WS_ICONIC) return; /* Nothing to change for an icon */
78 if (HAS_DLGFRAME( style, exStyle ))
79 InflateRect( rect, SYSMETRICS_CXDLGFRAME, SYSMETRICS_CYDLGFRAME );
80 else
82 if (HAS_THICKFRAME(style))
83 InflateRect( rect, SYSMETRICS_CXFRAME, SYSMETRICS_CYFRAME );
84 if (style & WS_BORDER)
85 InflateRect( rect, SYSMETRICS_CXBORDER, SYSMETRICS_CYBORDER );
88 if ((style & WS_CAPTION) == WS_CAPTION)
89 rect->top -= SYSMETRICS_CYCAPTION - SYSMETRICS_CYBORDER;
90 if (menu) rect->top -= SYSMETRICS_CYMENU + SYSMETRICS_CYBORDER;
92 if (style & WS_VSCROLL) rect->right += SYSMETRICS_CXVSCROLL;
93 if (style & WS_HSCROLL) rect->bottom += SYSMETRICS_CYHSCROLL;
97 /***********************************************************************
98 * AdjustWindowRect (USER.102)
100 void AdjustWindowRect( LPRECT rect, DWORD style, BOOL menu )
102 AdjustWindowRectEx( rect, style, menu, 0 );
106 /***********************************************************************
107 * AdjustWindowRectEx (USER.454)
109 void AdjustWindowRectEx( LPRECT rect, DWORD style, BOOL menu, DWORD exStyle )
111 /* Correct the window style */
113 if (!(style & (WS_POPUP | WS_CHILD))) /* Overlapped window */
114 style |= WS_CAPTION;
115 if (exStyle & WS_EX_DLGMODALFRAME) style &= ~WS_THICKFRAME;
117 dprintf_nonclient(stddeb, "AdjustWindowRectEx: (%d,%d)-(%d,%d) %08lx %d %08lx\n",
118 rect->left, rect->top, rect->right, rect->bottom, style, menu, exStyle );
120 NC_AdjustRect( rect, style, menu, exStyle );
124 /***********************************************************************
125 * NC_HandleNCCalcSize
127 * Handle a WM_NCCALCSIZE message. Called from DefWindowProc().
129 LONG NC_HandleNCCalcSize( HWND hwnd, NCCALCSIZE_PARAMS *params )
131 RECT tmpRect = { 0, 0, 0, 0 };
132 WND *wndPtr = WIN_FindWndPtr( hwnd );
134 if (!wndPtr) return 0;
135 NC_AdjustRect( &tmpRect, wndPtr->dwStyle, FALSE, wndPtr->dwExStyle );
136 params->rgrc[0].left -= tmpRect.left;
137 params->rgrc[0].top -= tmpRect.top;
138 params->rgrc[0].right -= tmpRect.right;
139 params->rgrc[0].bottom -= tmpRect.bottom;
141 if (HAS_MENU(wndPtr))
143 params->rgrc[0].top += MENU_GetMenuBarHeight( hwnd,
144 params->rgrc[0].right - params->rgrc[0].left,
145 -tmpRect.left, -tmpRect.top ) + 1;
147 return 0;
151 /***********************************************************************
152 * NC_GetInsideRect
154 * Get the 'inside' rectangle of a window, i.e. the whole window rectangle
155 * but without the borders (if any).
156 * The rectangle is in window coordinates (for drawing with GetWindowDC()).
158 void NC_GetInsideRect( HWND hwnd, RECT *rect )
160 WND * wndPtr = WIN_FindWndPtr( hwnd );
162 rect->top = rect->left = 0;
163 rect->right = wndPtr->rectWindow.right - wndPtr->rectWindow.left;
164 rect->bottom = wndPtr->rectWindow.bottom - wndPtr->rectWindow.top;
166 if (wndPtr->dwStyle & WS_ICONIC) return; /* No border to remove */
168 /* Remove frame from rectangle */
169 if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle ))
171 InflateRect( rect, -SYSMETRICS_CXDLGFRAME, -SYSMETRICS_CYDLGFRAME);
172 if (wndPtr->dwExStyle & WS_EX_DLGMODALFRAME) InflateRect( rect, -1, 0);
174 else
176 if (HAS_THICKFRAME( wndPtr->dwStyle ))
177 InflateRect( rect, -SYSMETRICS_CXFRAME, -SYSMETRICS_CYFRAME );
178 if (wndPtr->dwStyle & WS_BORDER)
179 InflateRect( rect, -SYSMETRICS_CXBORDER, -SYSMETRICS_CYBORDER );
184 /***********************************************************************
185 * NC_HandleNCHitTest
187 * Handle a WM_NCHITTEST message. Called from DefWindowProc().
189 LONG NC_HandleNCHitTest( HWND hwnd, POINT pt )
191 RECT rect;
192 WND *wndPtr = WIN_FindWndPtr( hwnd );
193 if (!wndPtr) return HTERROR;
195 dprintf_nonclient(stddeb, "NC_HandleNCHitTest: hwnd=%x pt=%d,%d\n",
196 hwnd, pt.x, pt.y );
198 GetWindowRect( hwnd, &rect );
199 if (!PtInRect( &rect, pt )) return HTNOWHERE;
202 * if this is a iconic window, we don't care were the hit
203 * occured, only that it did occur, just return HTCAPTION
204 * so the caller knows the icon did get hit
206 if (IsIconic(hwnd))
208 return HTCAPTION; /* change this to something meaningful? */
211 /* Check borders */
212 if (HAS_THICKFRAME( wndPtr->dwStyle ))
214 InflateRect( &rect, -SYSMETRICS_CXFRAME, -SYSMETRICS_CYFRAME );
215 if (wndPtr->dwStyle & WS_BORDER)
216 InflateRect( &rect, -SYSMETRICS_CXBORDER, -SYSMETRICS_CYBORDER );
217 if (!PtInRect( &rect, pt ))
219 /* Check top sizing border */
220 if (pt.y < rect.top)
222 if (pt.x < rect.left+SYSMETRICS_CXSIZE) return HTTOPLEFT;
223 if (pt.x >= rect.right-SYSMETRICS_CXSIZE) return HTTOPRIGHT;
224 return HTTOP;
226 /* Check bottom sizing border */
227 if (pt.y >= rect.bottom)
229 if (pt.x < rect.left+SYSMETRICS_CXSIZE) return HTBOTTOMLEFT;
230 if (pt.x >= rect.right-SYSMETRICS_CXSIZE) return HTBOTTOMRIGHT;
231 return HTBOTTOM;
233 /* Check left sizing border */
234 if (pt.x < rect.left)
236 if (pt.y < rect.top+SYSMETRICS_CYSIZE) return HTTOPLEFT;
237 if (pt.y >= rect.bottom-SYSMETRICS_CYSIZE) return HTBOTTOMLEFT;
238 return HTLEFT;
240 /* Check right sizing border */
241 if (pt.x >= rect.right)
243 if (pt.y < rect.top+SYSMETRICS_CYSIZE) return HTTOPRIGHT;
244 if (pt.y >= rect.bottom-SYSMETRICS_CYSIZE) return HTBOTTOMRIGHT;
245 return HTRIGHT;
249 else /* No thick frame */
251 if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle ))
252 InflateRect(&rect, -SYSMETRICS_CXDLGFRAME, -SYSMETRICS_CYDLGFRAME);
253 else if (wndPtr->dwStyle & WS_BORDER)
254 InflateRect(&rect, -SYSMETRICS_CXBORDER, -SYSMETRICS_CYBORDER);
255 if (!PtInRect( &rect, pt )) return HTBORDER;
258 /* Check caption */
260 if ((wndPtr->dwStyle & WS_CAPTION) == WS_CAPTION)
262 rect.top += SYSMETRICS_CYCAPTION - 1;
263 if (!PtInRect( &rect, pt ))
265 /* Check system menu */
266 if (wndPtr->dwStyle & WS_SYSMENU)
267 rect.left += SYSMETRICS_CXSIZE;
268 if (pt.x <= rect.left) return HTSYSMENU;
269 /* Check maximize box */
270 if (wndPtr->dwStyle & WS_MAXIMIZEBOX)
271 rect.right -= SYSMETRICS_CXSIZE + 1;
272 if (pt.x >= rect.right) return HTMAXBUTTON;
273 /* Check minimize box */
274 if (wndPtr->dwStyle & WS_MINIMIZEBOX)
275 rect.right -= SYSMETRICS_CXSIZE + 1;
276 if (pt.x >= rect.right) return HTMINBUTTON;
277 return HTCAPTION;
281 /* Check client area */
283 ScreenToClient( hwnd, &pt );
284 GetClientRect( hwnd, &rect );
285 if (PtInRect( &rect, pt )) return HTCLIENT;
287 /* Check vertical scroll bar */
289 if (wndPtr->dwStyle & WS_VSCROLL)
291 rect.right += SYSMETRICS_CXVSCROLL;
292 if (PtInRect( &rect, pt )) return HTVSCROLL;
295 /* Check horizontal scroll bar */
297 if (wndPtr->dwStyle & WS_HSCROLL)
299 rect.bottom += SYSMETRICS_CYHSCROLL;
300 if (PtInRect( &rect, pt ))
302 /* Check size box */
303 if ((wndPtr->dwStyle & WS_VSCROLL) &&
304 (pt.x >= rect.right - SYSMETRICS_CXVSCROLL))
305 return HTSIZE;
306 return HTHSCROLL;
310 /* Check menu bar */
312 if (HAS_MENU(wndPtr))
314 if ((pt.y < 0) && (pt.x >= 0) && (pt.x < rect.right))
315 return HTMENU;
318 /* Should never get here */
319 return HTERROR;
323 /***********************************************************************
324 * NC_DrawSysButton
326 void NC_DrawSysButton( HWND hwnd, HDC hdc, BOOL down )
328 RECT rect;
329 WND *wndPtr = WIN_FindWndPtr( hwnd );
330 NC_GetInsideRect( hwnd, &rect );
331 GRAPH_DrawBitmap( hdc, hbitmapClose,
332 rect.left, rect.top,
333 (wndPtr->dwStyle & WS_CHILD) ? SYSMETRICS_CXSIZE : 0, 0,
334 SYSMETRICS_CXSIZE, SYSMETRICS_CYSIZE,
335 down ? NOTSRCCOPY : SRCCOPY );
339 /***********************************************************************
340 * NC_DrawMaxButton
342 static void NC_DrawMaxButton( HWND hwnd, HDC hdc, BOOL down )
344 RECT rect;
345 NC_GetInsideRect( hwnd, &rect );
346 GRAPH_DrawBitmap( hdc, (IsZoomed(hwnd) ?
347 (down ? hbitmapRestoreD : hbitmapRestore) :
348 (down ? hbitmapMaximizeD : hbitmapMaximize)),
349 rect.right - SYSMETRICS_CXSIZE - 1, rect.top,
350 0, 0, SYSMETRICS_CXSIZE+1, SYSMETRICS_CYSIZE, SRCCOPY );
354 /***********************************************************************
355 * NC_DrawMinButton
357 static void NC_DrawMinButton( HWND hwnd, HDC hdc, BOOL down )
359 RECT rect;
360 WND *wndPtr = WIN_FindWndPtr( hwnd );
361 NC_GetInsideRect( hwnd, &rect );
362 if (wndPtr->dwStyle & WS_MAXIMIZEBOX) rect.right -= SYSMETRICS_CXSIZE + 1;
363 GRAPH_DrawBitmap( hdc, (down ? hbitmapMinimizeD : hbitmapMinimize),
364 rect.right - SYSMETRICS_CXSIZE - 1, rect.top,
365 0, 0, SYSMETRICS_CXSIZE+1, SYSMETRICS_CYSIZE, SRCCOPY );
369 /***********************************************************************
370 * NC_DrawFrame
372 * Draw a window frame inside the given rectangle, and update the rectangle.
373 * The correct pen for the frame must be selected in the DC.
375 static void NC_DrawFrame( HDC hdc, RECT *rect, BOOL dlgFrame, BOOL active )
377 short width, height, tmp;
379 if (dlgFrame)
381 width = SYSMETRICS_CXDLGFRAME - 1;
382 height = SYSMETRICS_CYDLGFRAME - 1;
383 SelectObject( hdc, active ? sysColorObjects.hbrushActiveCaption :
384 sysColorObjects.hbrushInactiveCaption );
386 else
388 width = SYSMETRICS_CXFRAME - 1;
389 height = SYSMETRICS_CYFRAME - 1;
390 SelectObject( hdc, active ? sysColorObjects.hbrushActiveBorder :
391 sysColorObjects.hbrushInactiveBorder );
394 /* Draw frame */
395 PatBlt( hdc, rect->left, rect->top,
396 rect->right - rect->left, height, PATCOPY );
397 PatBlt( hdc, rect->left, rect->top,
398 width, rect->bottom - rect->top, PATCOPY );
399 PatBlt( hdc, rect->left, rect->bottom,
400 rect->right - rect->left, -height, PATCOPY );
401 PatBlt( hdc, rect->right, rect->top,
402 -width, rect->bottom - rect->top, PATCOPY );
404 if (dlgFrame)
406 InflateRect( rect, -width, -height );
407 return;
410 /* Draw inner rectangle */
411 MoveTo( hdc, rect->left+width, rect->top+height );
412 LineTo( hdc, rect->right-width-1, rect->top+height );
413 LineTo( hdc, rect->right-width-1, rect->bottom-height-1 );
414 LineTo( hdc, rect->left+width, rect->bottom-height-1 );
415 LineTo( hdc, rect->left+width, rect->top+height );
417 /* Draw the decorations */
418 tmp = rect->top + SYSMETRICS_CYFRAME + SYSMETRICS_CYSIZE;
419 MoveTo( hdc, rect->left, tmp);
420 LineTo( hdc, rect->left+width, tmp );
421 MoveTo( hdc, rect->right-width-1, tmp );
422 LineTo( hdc, rect->right-1, tmp );
424 tmp = rect->bottom - 1 - SYSMETRICS_CYFRAME - SYSMETRICS_CYSIZE;
425 MoveTo( hdc, rect->left, tmp );
426 LineTo( hdc, rect->left+width, tmp );
427 MoveTo( hdc, rect->right-width-1, tmp );
428 LineTo( hdc, rect->right-1, tmp );
430 tmp = rect->left + SYSMETRICS_CXFRAME + SYSMETRICS_CXSIZE;
431 MoveTo( hdc, tmp, rect->top );
432 LineTo( hdc, tmp, rect->top+height );
433 MoveTo( hdc, tmp, rect->bottom-height-1 );
434 LineTo( hdc, tmp, rect->bottom-1 );
436 tmp = rect->right - 1 - SYSMETRICS_CXFRAME - SYSMETRICS_CYSIZE;
437 MoveTo( hdc, tmp, rect->top );
438 LineTo( hdc, tmp, rect->top+height );
439 MoveTo( hdc, tmp, rect->bottom-height-1 );
440 LineTo( hdc, tmp, rect->bottom-1 );
442 InflateRect( rect, -width-1, -height-1 );
446 /***********************************************************************
447 * NC_DrawMovingFrame
449 * Draw the frame used when moving or resizing window.
451 static void NC_DrawMovingFrame( HDC hdc, RECT *rect, BOOL thickframe )
453 if (thickframe)
455 SelectObject( hdc, GetStockObject( GRAY_BRUSH ) );
456 PatBlt( hdc, rect->left, rect->top,
457 rect->right - rect->left - SYSMETRICS_CXFRAME,
458 SYSMETRICS_CYFRAME, PATINVERT );
459 PatBlt( hdc, rect->left, rect->top + SYSMETRICS_CYFRAME,
460 SYSMETRICS_CXFRAME,
461 rect->bottom - rect->top - SYSMETRICS_CYFRAME, PATINVERT );
462 PatBlt( hdc, rect->left + SYSMETRICS_CXFRAME, rect->bottom,
463 rect->right - rect->left - SYSMETRICS_CXFRAME,
464 -SYSMETRICS_CYFRAME, PATINVERT );
465 PatBlt( hdc, rect->right, rect->top, -SYSMETRICS_CXFRAME,
466 rect->bottom - rect->top - SYSMETRICS_CYFRAME, PATINVERT );
468 else DrawFocusRect( hdc, rect );
472 /***********************************************************************
473 * NC_DrawCaption
475 * Draw the window caption.
476 * The correct pen for the window frame must be selected in the DC.
478 static void NC_DrawCaption( HDC hdc, RECT *rect, HWND hwnd,
479 DWORD style, BOOL active )
481 RECT r = *rect;
482 WND * wndPtr = WIN_FindWndPtr( hwnd );
483 char buffer[256];
485 if (!hbitmapClose)
487 if (!(hbitmapClose = LoadBitmap( 0, MAKEINTRESOURCE(OBM_CLOSE) )))
488 return;
489 hbitmapMinimize = LoadBitmap( 0, MAKEINTRESOURCE(OBM_REDUCE) );
490 hbitmapMinimizeD = LoadBitmap( 0, MAKEINTRESOURCE(OBM_REDUCED) );
491 hbitmapMaximize = LoadBitmap( 0, MAKEINTRESOURCE(OBM_ZOOM) );
492 hbitmapMaximizeD = LoadBitmap( 0, MAKEINTRESOURCE(OBM_ZOOMD) );
493 hbitmapRestore = LoadBitmap( 0, MAKEINTRESOURCE(OBM_RESTORE) );
494 hbitmapRestoreD = LoadBitmap( 0, MAKEINTRESOURCE(OBM_RESTORED) );
497 if (wndPtr->dwExStyle & WS_EX_DLGMODALFRAME)
499 HBRUSH hbrushOld = SelectObject( hdc, sysColorObjects.hbrushWindow );
500 PatBlt( hdc, r.left, r.top, 1, r.bottom-r.top+1,PATCOPY );
501 PatBlt( hdc, r.right-1, r.top, 1, r.bottom-r.top+1, PATCOPY );
502 PatBlt( hdc, r.left, r.top-1, r.right-r.left, 1, PATCOPY );
503 r.left++;
504 r.right--;
505 SelectObject( hdc, hbrushOld );
508 MoveTo( hdc, r.left, r.bottom );
509 LineTo( hdc, r.right-1, r.bottom );
511 if (style & WS_SYSMENU)
513 NC_DrawSysButton( hwnd, hdc, FALSE );
514 r.left += SYSMETRICS_CXSIZE + 1;
515 MoveTo( hdc, r.left - 1, r.top );
516 LineTo( hdc, r.left - 1, r.bottom );
518 if (style & WS_MAXIMIZEBOX)
520 NC_DrawMaxButton( hwnd, hdc, FALSE );
521 r.right -= SYSMETRICS_CXSIZE + 1;
523 if (style & WS_MINIMIZEBOX)
525 NC_DrawMinButton( hwnd, hdc, FALSE );
526 r.right -= SYSMETRICS_CXSIZE + 1;
529 FillRect( hdc, &r, active ? sysColorObjects.hbrushActiveCaption :
530 sysColorObjects.hbrushInactiveCaption );
532 if (GetWindowText( hwnd, buffer, 256 ))
534 if (active) SetTextColor( hdc, GetSysColor( COLOR_CAPTIONTEXT ) );
535 else SetTextColor( hdc, GetSysColor( COLOR_INACTIVECAPTIONTEXT ) );
536 SetBkMode( hdc, TRANSPARENT );
537 DrawText( hdc, buffer, -1, &r, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
542 /***********************************************************************
543 * NC_DoNCPaint
545 * Paint the non-client area.
546 * 'hrgn' is the update rgn to use (in client coords) or 1 if no update rgn.
548 void NC_DoNCPaint( HWND hwnd, HRGN hrgn, BOOL active, BOOL suppress_menupaint )
550 HDC hdc;
551 RECT rect;
553 WND *wndPtr = WIN_FindWndPtr( hwnd );
555 dprintf_nonclient(stddeb, "NC_DoNCPaint: %d %d\n", hwnd, hrgn );
556 if (!wndPtr || !hrgn) return;
557 if ((!(wndPtr->dwStyle & (WS_BORDER | WS_DLGFRAME | WS_THICKFRAME))) ||
558 (!(wndPtr->dwStyle & WS_VISIBLE)))
559 return; /* Nothing to do! */
561 if (hrgn == 1) hdc = GetDCEx( hwnd, 0, DCX_USESTYLE | DCX_WINDOW );
562 else
564 /* Make region relative to window area */
565 int xoffset = wndPtr->rectWindow.left - wndPtr->rectClient.left;
566 int yoffset = wndPtr->rectWindow.top - wndPtr->rectClient.top;
567 OffsetRgn( hrgn, -xoffset, -yoffset );
568 hdc = GetDCEx( hwnd, hrgn, DCX_USESTYLE|DCX_WINDOW|DCX_INTERSECTRGN );
569 OffsetRgn( hrgn, xoffset, yoffset ); /* Restore region */
571 if (!hdc) return;
575 * If this is an icon, we don't want to do any more nonclient painting
576 * of the window manager.
577 * If there is a class icon to draw, draw it
579 if (IsIconic(hwnd))
581 HICON hIcon = WIN_CLASS_INFO(wndPtr).hIcon;
582 if (hIcon)
584 SendMessage(hwnd, WM_ICONERASEBKGND, hdc, 0);
585 DrawIcon(hdc, 0, 0, hIcon);
587 ReleaseDC(hwnd, hdc);
588 return;
591 if (ExcludeVisRect( hdc, wndPtr->rectClient.left-wndPtr->rectWindow.left,
592 wndPtr->rectClient.top-wndPtr->rectWindow.top,
593 wndPtr->rectClient.right-wndPtr->rectWindow.left,
594 wndPtr->rectClient.bottom-wndPtr->rectWindow.top )
595 == NULLREGION)
597 ReleaseDC( hwnd, hdc );
598 return;
601 rect.top = rect.left = 0;
602 rect.right = wndPtr->rectWindow.right - wndPtr->rectWindow.left;
603 rect.bottom = wndPtr->rectWindow.bottom - wndPtr->rectWindow.top;
605 SelectObject( hdc, sysColorObjects.hpenWindowFrame );
607 if ((wndPtr->dwStyle & WS_BORDER) || (wndPtr->dwStyle & WS_DLGFRAME))
609 MoveTo( hdc, 0, 0 );
610 LineTo( hdc, rect.right-1, 0 );
611 LineTo( hdc, rect.right-1, rect.bottom-1 );
612 LineTo( hdc, 0, rect.bottom-1 );
613 LineTo( hdc, 0, 0 );
614 InflateRect( &rect, -1, -1 );
617 if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle ))
618 NC_DrawFrame( hdc, &rect, TRUE, active );
619 else if (wndPtr->dwStyle & WS_THICKFRAME)
620 NC_DrawFrame(hdc, &rect, FALSE, active );
622 if ((wndPtr->dwStyle & WS_CAPTION) == WS_CAPTION)
624 RECT r = rect;
625 r.bottom = rect.top + SYSMETRICS_CYSIZE;
626 rect.top += SYSMETRICS_CYSIZE + SYSMETRICS_CYBORDER;
627 NC_DrawCaption( hdc, &r, hwnd, wndPtr->dwStyle, active );
630 if (HAS_MENU(wndPtr))
632 RECT r = rect;
633 r.bottom = rect.top + SYSMETRICS_CYMENU; /* default height */
634 rect.top += MENU_DrawMenuBar( hdc, &r, hwnd, suppress_menupaint );
637 /* Draw the scroll-bars */
639 if (wndPtr->dwStyle & WS_VSCROLL) SCROLL_DrawScrollBar(hwnd, hdc, SB_VERT);
640 if (wndPtr->dwStyle & WS_HSCROLL) SCROLL_DrawScrollBar(hwnd, hdc, SB_HORZ);
642 /* Draw the "size-box" */
644 if ((wndPtr->dwStyle & WS_VSCROLL) && (wndPtr->dwStyle & WS_HSCROLL))
646 RECT r = rect;
647 r.left = r.right - SYSMETRICS_CXVSCROLL + 1;
648 r.top = r.bottom - SYSMETRICS_CYHSCROLL + 1;
649 FillRect( hdc, &r, sysColorObjects.hbrushScrollbar );
652 ReleaseDC( hwnd, hdc );
657 /***********************************************************************
658 * NC_HandleNCPaint
660 * Handle a WM_NCPAINT message. Called from DefWindowProc().
662 LONG NC_HandleNCPaint( HWND hwnd, HRGN hrgn )
664 NC_DoNCPaint( hwnd, hrgn, hwnd == GetActiveWindow(), FALSE );
665 return 0;
669 /***********************************************************************
670 * NC_HandleNCActivate
672 * Handle a WM_NCACTIVATE message. Called from DefWindowProc().
674 LONG NC_HandleNCActivate( HWND hwnd, WORD wParam )
676 NC_DoNCPaint( hwnd, (HRGN)1, wParam, FALSE );
677 return TRUE;
681 /***********************************************************************
682 * NC_HandleSetCursor
684 * Handle a WM_SETCURSOR message. Called from DefWindowProc().
686 LONG NC_HandleSetCursor( HWND hwnd, WORD wParam, LONG lParam )
688 if (hwnd != wParam) return 0; /* Don't set the cursor for child windows */
690 switch(LOWORD(lParam))
692 case HTERROR:
694 WORD msg = HIWORD( lParam );
695 if ((msg == WM_LBUTTONDOWN) || (msg == WM_MBUTTONDOWN) ||
696 (msg == WM_RBUTTONDOWN))
697 MessageBeep(0);
699 break;
701 case HTCLIENT:
703 WND *wndPtr;
704 CLASS *classPtr;
705 if (!(wndPtr = WIN_FindWndPtr( hwnd ))) break;
706 if (!(classPtr = CLASS_FindClassPtr( wndPtr->hClass ))) break;
707 if (classPtr->wc.hCursor)
709 SetCursor( classPtr->wc.hCursor );
710 return TRUE;
712 else return FALSE;
715 case HTLEFT:
716 case HTRIGHT:
717 return SetCursor( LoadCursor( 0, IDC_SIZEWE ) );
719 case HTTOP:
720 case HTBOTTOM:
721 return SetCursor( LoadCursor( 0, IDC_SIZENS ) );
723 case HTTOPLEFT:
724 case HTBOTTOMRIGHT:
725 return SetCursor( LoadCursor( 0, IDC_SIZENWSE ) );
727 case HTTOPRIGHT:
728 case HTBOTTOMLEFT:
729 return SetCursor( LoadCursor( 0, IDC_SIZENESW ) );
732 /* Default cursor: arrow */
733 return SetCursor( LoadCursor( 0, IDC_ARROW ) );
737 /***********************************************************************
738 * NC_StartSizeMove
740 * Initialisation of a move or resize, when initiatied from a menu choice.
741 * Return hit test code for caption or sizing border.
743 static LONG NC_StartSizeMove( HWND hwnd, WORD wParam, POINT *capturePoint )
745 LONG hittest = 0;
746 POINT pt;
747 MSG msg;
748 WND * wndPtr = WIN_FindWndPtr( hwnd );
750 if ((wParam & 0xfff0) == SC_MOVE)
752 /* Move pointer at the center of the caption */
753 RECT rect;
754 NC_GetInsideRect( hwnd, &rect );
755 if (wndPtr->dwStyle & WS_SYSMENU)
756 rect.left += SYSMETRICS_CXSIZE + 1;
757 if (wndPtr->dwStyle & WS_MINIMIZEBOX)
758 rect.right -= SYSMETRICS_CXSIZE + 1;
759 if (wndPtr->dwStyle & WS_MAXIMIZEBOX)
760 rect.right -= SYSMETRICS_CXSIZE + 1;
761 pt.x = wndPtr->rectWindow.left + (rect.right - rect.left) / 2;
762 pt.y = wndPtr->rectWindow.top + rect.top + SYSMETRICS_CYSIZE/2;
763 if (wndPtr->dwStyle & WS_CHILD)
764 ClientToScreen( wndPtr->hwndParent, &pt );
765 hittest = HTCAPTION;
767 else /* SC_SIZE */
769 SetCapture(hwnd);
770 while(!hittest)
772 MSG_GetHardwareMessage( &msg );
773 switch(msg.message)
775 case WM_MOUSEMOVE:
776 hittest = NC_HandleNCHitTest( hwnd, msg.pt );
777 pt = msg.pt;
778 if ((hittest < HTLEFT) || (hittest > HTBOTTOMRIGHT))
779 hittest = 0;
780 break;
782 case WM_LBUTTONUP:
783 return 0;
785 case WM_KEYDOWN:
786 switch(msg.wParam)
788 case VK_UP:
789 hittest = HTTOP;
790 pt.x =(wndPtr->rectWindow.left+wndPtr->rectWindow.right)/2;
791 pt.y = wndPtr->rectWindow.top + SYSMETRICS_CYFRAME / 2;
792 break;
793 case VK_DOWN:
794 hittest = HTBOTTOM;
795 pt.x =(wndPtr->rectWindow.left+wndPtr->rectWindow.right)/2;
796 pt.y = wndPtr->rectWindow.bottom - SYSMETRICS_CYFRAME / 2;
797 break;
798 case VK_LEFT:
799 hittest = HTLEFT;
800 pt.x = wndPtr->rectWindow.left + SYSMETRICS_CXFRAME / 2;
801 pt.y =(wndPtr->rectWindow.top+wndPtr->rectWindow.bottom)/2;
802 break;
803 case VK_RIGHT:
804 hittest = HTRIGHT;
805 pt.x = wndPtr->rectWindow.right - SYSMETRICS_CXFRAME / 2;
806 pt.y =(wndPtr->rectWindow.top+wndPtr->rectWindow.bottom)/2;
807 break;
808 case VK_RETURN:
809 case VK_ESCAPE: return 0;
814 *capturePoint = pt;
815 SetCursorPos( capturePoint->x, capturePoint->y );
816 NC_HandleSetCursor( hwnd, hwnd, MAKELONG( hittest, WM_MOUSEMOVE ));
817 return hittest;
821 /***********************************************************************
822 * NC_DoSizeMove
824 * Perform SC_MOVE and SC_SIZE commands.
826 static void NC_DoSizeMove( HWND hwnd, WORD wParam, POINT pt )
828 MSG msg;
829 LONG hittest;
830 RECT sizingRect, mouseRect;
831 HDC hdc;
832 BOOL thickframe;
833 POINT minTrack, maxTrack, capturePoint = pt;
834 WND * wndPtr = WIN_FindWndPtr( hwnd );
836 if (IsZoomed(hwnd) || !IsWindowVisible(hwnd)) return;
837 hittest = wParam & 0x0f;
838 thickframe = HAS_THICKFRAME( wndPtr->dwStyle );
840 if ((wParam & 0xfff0) == SC_MOVE)
842 if (!(wndPtr->dwStyle & WS_CAPTION)) return;
843 if (!hittest) hittest = NC_StartSizeMove( hwnd, wParam, &capturePoint );
844 if (!hittest) return;
846 else /* SC_SIZE */
848 if (!thickframe) return;
849 if (hittest) hittest += HTLEFT-1;
850 else
852 SetCapture(hwnd);
853 hittest = NC_StartSizeMove( hwnd, wParam, &capturePoint );
854 if (!hittest)
856 ReleaseCapture();
857 return;
862 /* Get min/max info */
864 WINPOS_GetMinMaxInfo( hwnd, NULL, NULL, &minTrack, &maxTrack );
865 sizingRect = wndPtr->rectWindow;
866 if (wndPtr->dwStyle & WS_CHILD)
867 GetClientRect( wndPtr->hwndParent, &mouseRect );
868 else SetRect( &mouseRect, 0, 0, SYSMETRICS_CXSCREEN, SYSMETRICS_CYSCREEN );
869 if (ON_LEFT_BORDER(hittest))
871 mouseRect.left = max( mouseRect.left, sizingRect.right-maxTrack.x );
872 mouseRect.right = min( mouseRect.right, sizingRect.right-minTrack.x );
874 else if (ON_RIGHT_BORDER(hittest))
876 mouseRect.left = max( mouseRect.left, sizingRect.left+minTrack.x );
877 mouseRect.right = min( mouseRect.right, sizingRect.left+maxTrack.x );
879 if (ON_TOP_BORDER(hittest))
881 mouseRect.top = max( mouseRect.top, sizingRect.bottom-maxTrack.y );
882 mouseRect.bottom = min( mouseRect.bottom,sizingRect.bottom-minTrack.y);
884 else if (ON_BOTTOM_BORDER(hittest))
886 mouseRect.top = max( mouseRect.top, sizingRect.top+minTrack.y );
887 mouseRect.bottom = min( mouseRect.bottom, sizingRect.top+maxTrack.y );
889 SendMessage( hwnd, WM_ENTERSIZEMOVE, 0, 0 );
891 if (GetCapture() != hwnd) SetCapture( hwnd );
893 if (wndPtr->dwStyle & WS_CHILD)
895 /* Retrieve a default cache DC (without using the window style) */
896 hdc = GetDCEx( wndPtr->hwndParent, 0, DCX_CACHE );
898 else
899 { /* Grab the server only when moving top-level windows without desktop */
900 hdc = GetDC( 0 );
901 if (rootWindow == DefaultRootWindow(display)) XGrabServer( display );
903 NC_DrawMovingFrame( hdc, &sizingRect, thickframe );
905 while(1)
907 int dx = 0, dy = 0;
909 MSG_GetHardwareMessage( &msg );
911 /* Exit on button-up, Return, or Esc */
912 if ((msg.message == WM_LBUTTONUP) ||
913 ((msg.message == WM_KEYDOWN) &&
914 ((msg.wParam == VK_RETURN) || (msg.wParam == VK_ESCAPE)))) break;
916 if ((msg.message != WM_KEYDOWN) && (msg.message != WM_MOUSEMOVE))
917 continue; /* We are not interested in other messages */
919 pt = msg.pt;
920 if (wndPtr->dwStyle & WS_CHILD)
921 ScreenToClient( wndPtr->hwndParent, &pt );
924 if (msg.message == WM_KEYDOWN) switch(msg.wParam)
926 case VK_UP: pt.y -= 8; break;
927 case VK_DOWN: pt.y += 8; break;
928 case VK_LEFT: pt.x -= 8; break;
929 case VK_RIGHT: pt.x += 8; break;
932 pt.x = max( pt.x, mouseRect.left );
933 pt.x = min( pt.x, mouseRect.right );
934 pt.y = max( pt.y, mouseRect.top );
935 pt.y = min( pt.y, mouseRect.bottom );
937 dx = pt.x - capturePoint.x;
938 dy = pt.y - capturePoint.y;
940 if (dx || dy)
942 if (msg.message == WM_KEYDOWN) SetCursorPos( pt.x, pt.y );
943 else
945 RECT newRect = sizingRect;
947 if (hittest == HTCAPTION) OffsetRect( &newRect, dx, dy );
948 if (ON_LEFT_BORDER(hittest)) newRect.left += dx;
949 else if (ON_RIGHT_BORDER(hittest)) newRect.right += dx;
950 if (ON_TOP_BORDER(hittest)) newRect.top += dy;
951 else if (ON_BOTTOM_BORDER(hittest)) newRect.bottom += dy;
952 NC_DrawMovingFrame( hdc, &sizingRect, thickframe );
953 NC_DrawMovingFrame( hdc, &newRect, thickframe );
954 capturePoint = pt;
955 sizingRect = newRect;
960 NC_DrawMovingFrame( hdc, &sizingRect, thickframe );
961 ReleaseCapture();
962 if (wndPtr->dwStyle & WS_CHILD) ReleaseDC( wndPtr->hwndParent, hdc );
963 else
965 ReleaseDC( 0, hdc );
966 if (rootWindow == DefaultRootWindow(display)) XUngrabServer( display );
968 SendMessage( hwnd, WM_EXITSIZEMOVE, 0, 0 );
970 /* If Esc key, don't move the window */
971 if ((msg.message == WM_KEYDOWN) && (msg.wParam == VK_ESCAPE)) return;
973 if (hittest != HTCAPTION)
974 SetWindowPos( hwnd, 0, sizingRect.left, sizingRect.top,
975 sizingRect.right - sizingRect.left,
976 sizingRect.bottom - sizingRect.top,
977 SWP_NOACTIVATE | SWP_NOZORDER );
978 else SetWindowPos( hwnd, 0, sizingRect.left, sizingRect.top, 0, 0,
979 SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER );
983 /***********************************************************************
984 * NC_TrackMinMaxBox
986 * Track a mouse button press on the minimize or maximize box.
988 static void NC_TrackMinMaxBox( HWND hwnd, WORD wParam )
990 MSG msg;
991 HDC hdc = GetWindowDC( hwnd );
992 BOOL pressed = TRUE;
994 SetCapture( hwnd );
995 if (wParam == HTMINBUTTON) NC_DrawMinButton( hwnd, hdc, TRUE );
996 else NC_DrawMaxButton( hwnd, hdc, TRUE );
1000 BOOL oldstate = pressed;
1001 MSG_GetHardwareMessage( &msg );
1003 pressed = (NC_HandleNCHitTest( hwnd, msg.pt ) == wParam);
1004 if (pressed != oldstate)
1006 if (wParam == HTMINBUTTON) NC_DrawMinButton( hwnd, hdc, pressed );
1007 else NC_DrawMaxButton( hwnd, hdc, pressed );
1009 } while (msg.message != WM_LBUTTONUP);
1011 if (wParam == HTMINBUTTON) NC_DrawMinButton( hwnd, hdc, FALSE );
1012 else NC_DrawMaxButton( hwnd, hdc, FALSE );
1014 ReleaseCapture();
1015 ReleaseDC( hwnd, hdc );
1016 if (!pressed) return;
1018 if (wParam == HTMINBUTTON)
1019 SendMessage( hwnd, WM_SYSCOMMAND, SC_MINIMIZE, *(LONG*)&msg.pt );
1020 else
1021 SendMessage( hwnd, WM_SYSCOMMAND,
1022 IsZoomed(hwnd) ? SC_RESTORE : SC_MAXIMIZE, *(LONG*)&msg.pt );
1026 /***********************************************************************
1027 * NC_TrackScrollBar
1029 * Track a mouse button press on the horizontal or vertical scroll-bar.
1031 static void NC_TrackScrollBar( HWND hwnd, WORD wParam, POINT pt )
1033 MSG msg;
1034 WORD scrollbar;
1035 WND *wndPtr = WIN_FindWndPtr( hwnd );
1037 if ((wParam & 0xfff0) == SC_HSCROLL)
1039 if ((wParam & 0x0f) != HTHSCROLL) return;
1040 scrollbar = SB_HORZ;
1042 else /* SC_VSCROLL */
1044 if ((wParam & 0x0f) != HTVSCROLL) return;
1045 scrollbar = SB_VERT;
1048 pt.x -= wndPtr->rectWindow.left;
1049 pt.y -= wndPtr->rectWindow.top;
1050 SetCapture( hwnd );
1051 SCROLL_HandleScrollEvent( hwnd, scrollbar, WM_LBUTTONDOWN, pt );
1055 GetMessage( &msg, 0, 0, 0 );
1056 switch(msg.message)
1058 case WM_LBUTTONUP:
1059 case WM_MOUSEMOVE:
1060 case WM_SYSTIMER:
1061 pt = MAKEPOINT(msg.lParam);
1062 pt.x += wndPtr->rectClient.left - wndPtr->rectWindow.left;
1063 pt.y += wndPtr->rectClient.top - wndPtr->rectWindow.top;
1064 SCROLL_HandleScrollEvent( hwnd, scrollbar, msg.message, pt );
1065 break;
1066 default:
1067 TranslateMessage( &msg );
1068 DispatchMessage( &msg );
1069 break;
1071 if (!IsWindow( hwnd ))
1073 ReleaseCapture();
1074 break;
1076 } while (msg.message != WM_LBUTTONUP);
1079 /***********************************************************************
1080 * NC_TrackSysMenu
1082 * Track a mouse button press on the system menu.
1084 static void NC_TrackSysMenu( HWND hwnd, HDC hdc, POINT pt )
1086 RECT rect;
1087 WND *wndPtr = WIN_FindWndPtr( hwnd );
1089 if (!(wndPtr->dwStyle & WS_SYSMENU)) return;
1090 /* If window has a menu, track the menu bar normally */
1091 if (HAS_MENU(wndPtr)) MENU_TrackMouseMenuBar( hwnd, pt );
1092 else
1094 /* Otherwise track the system menu like a normal popup menu */
1095 NC_GetInsideRect( hwnd, &rect );
1096 OffsetRect( &rect, wndPtr->rectWindow.left, wndPtr->rectWindow.top );
1097 if (wndPtr->dwStyle & WS_CHILD)
1098 ClientToScreen( wndPtr->hwndParent, (POINT *)&rect );
1099 rect.right = rect.left + SYSMETRICS_CXSIZE;
1100 rect.bottom = rect.top + SYSMETRICS_CYSIZE;
1101 NC_DrawSysButton( hwnd, hdc, TRUE );
1102 TrackPopupMenu( wndPtr->hSysMenu, TPM_LEFTALIGN | TPM_LEFTBUTTON,
1103 rect.left, rect.bottom, 0, hwnd, &rect );
1104 NC_DrawSysButton( hwnd, hdc, FALSE );
1109 /***********************************************************************
1110 * NC_HandleNCLButtonDown
1112 * Handle a WM_NCLBUTTONDOWN message. Called from DefWindowProc().
1114 LONG NC_HandleNCLButtonDown( HWND hwnd, WORD wParam, LONG lParam )
1116 HDC hdc = GetWindowDC( hwnd );
1118 switch(wParam) /* Hit test */
1120 case HTCAPTION:
1121 SendMessage( hwnd, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, lParam );
1122 break;
1124 case HTSYSMENU:
1125 NC_TrackSysMenu( hwnd, hdc, MAKEPOINT(lParam) );
1126 break;
1128 case HTMENU:
1129 SendMessage( hwnd, WM_SYSCOMMAND, SC_MOUSEMENU, lParam );
1130 break;
1132 case HTHSCROLL:
1133 SendMessage( hwnd, WM_SYSCOMMAND, SC_HSCROLL + HTHSCROLL, lParam );
1134 break;
1136 case HTVSCROLL:
1137 SendMessage( hwnd, WM_SYSCOMMAND, SC_VSCROLL + HTVSCROLL, lParam );
1138 break;
1140 case HTMINBUTTON:
1141 case HTMAXBUTTON:
1142 NC_TrackMinMaxBox( hwnd, wParam );
1143 break;
1145 case HTLEFT:
1146 case HTRIGHT:
1147 case HTTOP:
1148 case HTTOPLEFT:
1149 case HTTOPRIGHT:
1150 case HTBOTTOM:
1151 case HTBOTTOMLEFT:
1152 case HTBOTTOMRIGHT:
1153 SendMessage( hwnd, WM_SYSCOMMAND, SC_SIZE + wParam - HTLEFT+1, lParam);
1154 break;
1156 case HTBORDER:
1157 break;
1160 ReleaseDC( hwnd, hdc );
1161 return 0;
1165 /***********************************************************************
1166 * NC_HandleNCLButtonDblClk
1168 * Handle a WM_NCLBUTTONDBLCLK message. Called from DefWindowProc().
1170 LONG NC_HandleNCLButtonDblClk( HWND hwnd, WORD wParam, LONG lParam )
1173 * if this is an icon, send a restore since we are handling
1174 * a double click
1176 if (IsIconic(hwnd))
1178 SendMessage(hwnd, WM_SYSCOMMAND, SC_RESTORE, lParam);
1179 return 0;
1182 switch(wParam) /* Hit test */
1184 case HTCAPTION:
1185 SendMessage( hwnd, WM_SYSCOMMAND, SC_MAXIMIZE, lParam );
1186 break;
1188 case HTSYSMENU:
1189 SendMessage( hwnd, WM_SYSCOMMAND, SC_CLOSE, lParam );
1190 break;
1192 return 0;
1196 /***********************************************************************
1197 * NC_HandleSysCommand
1199 * Handle a WM_SYSCOMMAND message. Called from DefWindowProc().
1201 LONG NC_HandleSysCommand( HWND hwnd, WORD wParam, POINT pt )
1203 WND *wndPtr = WIN_FindWndPtr( hwnd );
1205 dprintf_nonclient(stddeb, "Handling WM_SYSCOMMAND %x %d,%d\n",
1206 wParam, pt.x, pt.y );
1208 if (wndPtr->dwStyle & WS_CHILD) ScreenToClient( wndPtr->hwndParent, &pt );
1210 switch (wParam & 0xfff0)
1212 case SC_SIZE:
1213 case SC_MOVE:
1214 NC_DoSizeMove( hwnd, wParam, pt );
1215 break;
1217 case SC_MINIMIZE:
1218 ShowWindow( hwnd, SW_MINIMIZE );
1219 break;
1221 case SC_MAXIMIZE:
1222 ShowWindow( hwnd, SW_MAXIMIZE );
1223 break;
1225 case SC_RESTORE:
1226 ShowWindow( hwnd, SW_RESTORE );
1227 break;
1229 case SC_NEXTWINDOW:
1230 case SC_PREVWINDOW:
1231 break;
1233 case SC_CLOSE:
1234 return SendMessage( hwnd, WM_CLOSE, 0, 0 );
1236 case SC_VSCROLL:
1237 case SC_HSCROLL:
1238 NC_TrackScrollBar( hwnd, wParam, pt );
1239 break;
1241 case SC_MOUSEMENU:
1242 MENU_TrackMouseMenuBar( hwnd, pt );
1243 break;
1245 case SC_KEYMENU:
1246 MENU_TrackKbdMenuBar( hwnd, wParam );
1247 break;
1249 case SC_ARRANGE:
1250 break;
1252 case SC_TASKLIST:
1253 /* WinExec( "taskman.exe", SW_SHOWNORMAL ); */
1254 break;
1256 case SC_HOTKEY:
1257 break;
1259 case SC_SCREENSAVE:
1260 if (wParam == SC_ABOUTWINE)
1261 { extern char sysres_DIALOG_2[];
1262 DialogBoxIndirectPtr( hSysRes, sysres_DIALOG_2,
1263 hwnd, (WNDPROC)AboutWine_Proc );
1265 break;
1267 return 0;