ReactOS 0.4.17-dev-116-ga4b6fe9
nonclient.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Win32k subsystem
4 * PURPOSE: Miscellaneous User functions
5 * FILE: win32ss/user/ntuser/nonclient.c
6 * PROGRAMER:
7 */
8
9#include <win32k.h>
10#include <windowsx.h>
11
13
14#define UserHasDlgFrameStyle(Style, ExStyle) \
15 (((ExStyle) & WS_EX_DLGMODALFRAME) || \
16 (((Style) & WS_DLGFRAME) && (!((Style) & WS_THICKFRAME))))
17
18#define UserHasThickFrameStyle(Style, ExStyle) \
19 (((Style) & WS_THICKFRAME) && \
20 (!(((Style) & (WS_DLGFRAME | WS_BORDER)) == WS_DLGFRAME)))
21
22#define UserHasThinFrameStyle(Style, ExStyle) \
23 (((Style) & WS_BORDER) || (!((Style) & (WS_CHILD | WS_POPUP))))
24
25#define ON_LEFT_BORDER(hit) \
26 (((hit) == HTLEFT) || ((hit) == HTTOPLEFT) || ((hit) == HTBOTTOMLEFT))
27#define ON_RIGHT_BORDER(hit) \
28 (((hit) == HTRIGHT) || ((hit) == HTTOPRIGHT) || ((hit) == HTBOTTOMRIGHT))
29#define ON_TOP_BORDER(hit) \
30 (((hit) == HTTOP) || ((hit) == HTTOPLEFT) || ((hit) == HTTOPRIGHT))
31#define ON_BOTTOM_BORDER(hit) \
32 (((hit) == HTBOTTOM) || ((hit) == HTBOTTOMLEFT) || ((hit) == HTBOTTOMRIGHT))
33
34#define HASSIZEGRIP(Style, ExStyle, ParentStyle, WindowRect, ParentClientRect) \
35 ((!(Style & WS_CHILD) && (Style & WS_THICKFRAME) && !(Style & WS_MAXIMIZE)) || \
36 ((Style & WS_CHILD) && (ParentStyle & WS_THICKFRAME) && !(ParentStyle & WS_MAXIMIZE) && \
37 (WindowRect.right - WindowRect.left == ParentClientRect.right) && \
38 (WindowRect.bottom - WindowRect.top == ParentClientRect.bottom)))
39
40
43 RECTL *rect,
46{
47 HBRUSH hbrush = NtGdiSelectBrush( hdc, gpsi->hbrGray );
53}
54
57 RECTL *rect,
58 BOOL thickframe)
59{
61 else UserDrawWindowFrame(hdc, rect, 1, 1);
62}
63
64/***********************************************************************
65 * NC_GetInsideRect
66 *
67 * Get the 'inside' rectangle of a window, i.e. the whole window rectangle
68 * but without the borders (if any).
69 */
70void FASTCALL // Previously known as "UserGetInsideRectNC"
72{
75
76 Style = Wnd->style;
77 ExStyle = Wnd->ExStyle;
78
79 rect->top = rect->left = 0;
80 rect->right = Wnd->rcWindow.right - Wnd->rcWindow.left;
81 rect->bottom = Wnd->rcWindow.bottom - Wnd->rcWindow.top;
82
83 if (Style & WS_ICONIC) return;
84
85 /* Remove frame from rectangle */
87 {
89 }
91 {
93 /* FIXME: this isn't in NC_AdjustRect? why not? */
95 RECTL_vInflateRect( rect, -1, 0 );
96 }
98 {
100 }
101
102 /* We have additional border information if the window
103 * is a child (but not an MDI child) */
104 if ((Style & WS_CHILD) && !(ExStyle & WS_EX_MDICHILD))
105 {
110 }
111}
112
113/***********************************************************************
114 * NC_GetSysPopupPos
115 */
116void FASTCALL
118{
119 RECT WindowRect;
120
121 if ((Wnd->style & WS_MINIMIZE) != 0)
122 {
124 }
125 else
126 {
128 IntGetWindowRect(Wnd, &WindowRect);
129 RECTL_vOffsetRect(Rect, WindowRect.left, WindowRect.top);
130 if (Wnd->style & WS_CHILD)
131 {
133 }
134 Rect->right = Rect->left + UserGetSystemMetrics(SM_CYCAPTION) - 1;
135 Rect->bottom = Rect->top + UserGetSystemMetrics(SM_CYCAPTION) - 1;
136 }
137}
138
139static UINT
141{
142 // TODO: SPI_GETMOUSEDOCKTHRESHOLD
143 RECT wa;
144 if (!GetSnapSetting(bDockMoving))
145 return HTNOWHERE;
146 UserSystemParametersInfo(SPI_GETWORKAREA, 0, &wa, 0); /* FIXME: MultiMon of PWND */
147
148 if (pt.x <= wa.left) return HTLEFT;
149 if (pt.x >= wa.right-1) return HTRIGHT;
150 if (pt.y <= wa.top) return HTTOP; /* Maximize */
151 return HTNOWHERE;
152}
153
156{
157 LONG hittest = 0;
158 POINT pt;
159 MSG msg;
160 RECT rectWindow;
161 ULONG Style = Wnd->style;
163
164 rectWindow = Wnd->rcWindow;
165
166 if ((wParam & 0xfff0) == SC_MOVE)
167 {
168 /* Move pointer at the center of the caption */
169 RECT rect = rectWindow;
170 /* Note: to be exactly centered we should take the different types
171 * of border into account, but it shouldn't make more than a few pixels
172 * of difference so let's not bother with that */
173 if (Style & WS_SYSMENU)
175 if (Style & WS_MINIMIZEBOX)
177 if (Style & WS_MAXIMIZEBOX)
179 pt.x = (rect.right + rect.left) / 2;
181 hittest = HTCAPTION;
182 *capturePoint = pt;
183 }
184 else /* SC_SIZE */
185 {
186 pt.x = pt.y = 0;
187 while (!hittest)
188 {
189 if (!co_IntGetPeekMessage(&msg, 0, 0, 0, PM_REMOVE, TRUE)) return 0;
190 if (IntCallMsgFilter( &msg, MSGF_SIZE )) continue;
191
192 switch(msg.message)
193 {
194 case WM_MOUSEMOVE:
196 pt.x = min( max( msg.pt.x, rectWindow.left ), rectWindow.right - 1 );
197 pt.y = min( max( msg.pt.y, rectWindow.top ), rectWindow.bottom - 1 );
198 hittest = GetNCHitEx(Wnd, pt);
199 if ((hittest < HTLEFT) || (hittest > HTBOTTOMRIGHT)) hittest = 0;
200 break;
201
202 case WM_LBUTTONUP:
203 return 0;
204
205 case WM_KEYDOWN:
206 switch (msg.wParam)
207 {
208 case VK_UP:
209 hittest = HTTOP;
210 pt.x = (rectWindow.left+rectWindow.right)/2;
211 pt.y = rectWindow.top + UserGetSystemMetrics(SM_CYFRAME) / 2;
212 break;
213 case VK_DOWN:
214 hittest = HTBOTTOM;
215 pt.x = (rectWindow.left+rectWindow.right)/2;
216 pt.y = rectWindow.bottom - UserGetSystemMetrics(SM_CYFRAME) / 2;
217 break;
218 case VK_LEFT:
219 hittest = HTLEFT;
220 pt.x = rectWindow.left + UserGetSystemMetrics(SM_CXFRAME) / 2;
221 pt.y = (rectWindow.top+rectWindow.bottom)/2;
222 break;
223 case VK_RIGHT:
224 hittest = HTRIGHT;
225 pt.x = rectWindow.right - UserGetSystemMetrics(SM_CXFRAME) / 2;
226 pt.y = (rectWindow.top+rectWindow.bottom)/2;
227 break;
228 case VK_RETURN:
229 case VK_ESCAPE:
230 return 0;
231 }
232 break;
233 default:
238 break;
239 }
240 }
241 *capturePoint = pt;
242 }
243 UserSetCursorPos(pt.x, pt.y, 0, 0, FALSE);
245 return hittest;
246}
247
248//
249// System Command Size and Move
250//
251// Perform SC_MOVE and SC_SIZE commands.
252//
255{
256 MSG msg;
257 RECT sizingRect, mouseRect, origRect, unmodRect, snapPreviewRect;
258 PRECT pFrameRect = &sizingRect;
259 HDC hdc;
260 LONG hittest = (LONG)(wParam & 0x0f);
261 PCURICON_OBJECT DragCursor = NULL, OldCursor = NULL;
262 POINT minTrack, maxTrack;
263 POINT capturePoint, pt;
265 UINT orgSnap = IntGetWindowSnapEdge(pwnd), snap = orgSnap;
266 BOOL thickframe;
267 BOOL iconic;
268 BOOL moved = FALSE;
269 BOOL DragFullWindows = FALSE;
270 PWND pWndParent = NULL;
271 WPARAM syscommand = (wParam & 0xfff0);
273 //PMONITOR mon = 0; Don't port sync from wine!!! This breaks explorer task bar sizing!!
274 // The task bar can grow in size and can not reduce due to the change
275 // in the work area.
276
277 Style = pwnd->style;
278 ExStyle = pwnd->ExStyle;
279 iconic = (Style & WS_MINIMIZE) != 0;
280
281 if (((Style & WS_MAXIMIZE) && syscommand != SC_MOVE) || !IntIsWindowVisible(pwnd)) return;
282 if ((Style & (WS_MAXIMIZE | WS_CHILD)) == WS_MAXIMIZE)
283 orgSnap = snap = HTTOP;
284
285 thickframe = UserHasThickFrameStyle(Style, ExStyle) && !iconic;
286
287 //
288 // Show window contents while dragging the window, get flag from registry data.
289 //
290 UserSystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, &DragFullWindows, 0);
291
292 pt.x = pti->ptLast.x;
293 pt.y = pti->ptLast.y;
294 capturePoint = pt;
296
297 TRACE("pwnd %p command %04lx, hittest %d, pos %d,%d\n",
298 pwnd, syscommand, hittest, pt.x, pt.y);
299
300 if (syscommand == SC_MOVE)
301 {
302 if (!hittest) hittest = DefWndStartSizeMove(pwnd, wParam, &capturePoint);
303 if (!hittest) return;
304 }
305 else /* SC_SIZE */
306 {
307 if (!thickframe) return;
308 if (hittest && (syscommand != SC_MOUSEMENU))
309 {
310 hittest += (HTLEFT - WMSZ_LEFT);
311 }
312 else
313 {
315 hittest = DefWndStartSizeMove(pwnd, wParam, &capturePoint);
316 if (!hittest)
317 {
319 return;
320 }
321 }
322 }
323
324 /* Get min/max info */
325
326 co_WinPosGetMinMaxInfo(pwnd, NULL, NULL, &minTrack, &maxTrack);
327 sizingRect = pwnd->rcWindow;
328 origRect = sizingRect;
329 if (Style & WS_CHILD)
330 {
331 pWndParent = IntGetParent(pwnd);
332 IntGetClientRect( pWndParent, &mouseRect );
333 IntMapWindowPoints( pWndParent, 0, (LPPOINT)&mouseRect, 2 );
334 IntMapWindowPoints( 0, pWndParent, (LPPOINT)&sizingRect, 2 );
335 unmodRect = sizingRect;
336 }
337 else
338 {
339 if (!(ExStyle & WS_EX_TOPMOST))
340 {
341 UserSystemParametersInfo(SPI_GETWORKAREA, 0, &mouseRect, 0);
342 }
343 else
344 {
346 }
347 unmodRect = sizingRect;
348 }
349
350 if (ON_LEFT_BORDER(hittest))
351 {
352 mouseRect.left = max( mouseRect.left, sizingRect.right-maxTrack.x+capturePoint.x-sizingRect.left );
353 mouseRect.right = min( mouseRect.right, sizingRect.right-minTrack.x+capturePoint.x-sizingRect.left );
354 }
355 else if (ON_RIGHT_BORDER(hittest))
356 {
357 mouseRect.left = max( mouseRect.left, sizingRect.left+minTrack.x+capturePoint.x-sizingRect.right );
358 mouseRect.right = min( mouseRect.right, sizingRect.left+maxTrack.x+capturePoint.x-sizingRect.right );
359 }
360 if (ON_TOP_BORDER(hittest))
361 {
362 mouseRect.top = max( mouseRect.top, sizingRect.bottom-maxTrack.y+capturePoint.y-sizingRect.top );
363 mouseRect.bottom = min( mouseRect.bottom,sizingRect.bottom-minTrack.y+capturePoint.y-sizingRect.top);
364 }
365 else if (ON_BOTTOM_BORDER(hittest))
366 {
367 mouseRect.top = max( mouseRect.top, sizingRect.top+minTrack.y+capturePoint.y-sizingRect.bottom );
368 mouseRect.bottom = min( mouseRect.bottom, sizingRect.top+maxTrack.y+capturePoint.y-sizingRect.bottom );
369 }
370
371 hdc = UserGetDCEx( pWndParent, 0, DCX_CACHE );
372 if (iconic)
373 {
374 DragCursor = pwnd->pcls->spicn;
375 if (DragCursor)
376 {
377 UserReferenceObject(DragCursor);
378 }
379 else
380 {
381 HCURSOR CursorHandle = (HCURSOR)co_IntSendMessage( UserHMGetHandle(pwnd), WM_QUERYDRAGICON, 0, 0 );
382 if (CursorHandle)
383 {
384 DragCursor = UserGetCurIconObject(CursorHandle);
385 }
386 else
387 {
388 iconic = FALSE;
389 }
390 }
391 }
392
393 /* repaint the window before moving it around */
395
396 IntNotifyWinEvent( EVENT_SYSTEM_MOVESIZESTART, pwnd, OBJID_WINDOW, CHILDID_SELF, 0);
397
399
401
403
404 pwnd->head.pti->TIF_flags |= TIF_MOVESIZETRACKING;
405
406 for(;;)
407 {
408 int dx = 0, dy = 0;
409
410 if (!co_IntGetPeekMessage(&msg, 0, 0, 0, PM_REMOVE, TRUE)) break;
411 if (IntCallMsgFilter( &msg, MSGF_SIZE )) continue;
412
413 if (msg.message == WM_KEYDOWN && (msg.wParam == VK_RETURN || msg.wParam == VK_ESCAPE))
414 break; // Exit on Return or Esc
415
416 if (!g_bWindowSnapEnabled && (msg.message == WM_LBUTTONUP ||
417 (msg.message == WM_MOUSEMOVE && (msg.wParam & MK_LBUTTON) == 0)))
418 { // If no WindowSnapEnabled: Exit on button-up immediately
419 break;
420 }
421 else if (g_bWindowSnapEnabled && (msg.message == WM_LBUTTONUP ||
422 (msg.message == WM_MOUSEMOVE && (msg.wParam & MK_LBUTTON) == 0)))
423 { // If WindowSnapEnabled: Decide whether to snap before exiting
424 if (hittest == HTCAPTION && thickframe && /* Check for snapping if was moved by caption */
426 {
427 BOOLEAN wasSnap = IntIsWindowSnapped(pwnd); /* Need the live snap state, not orgSnap nor maximized state */
428 UINT snapTo = iconic ? HTNOWHERE : GetSnapActivationPoint(pwnd, pt);
429 if (snapTo)
430 {
431 if (DragFullWindows)
432 {
433 co_IntSnapWindow(pwnd, snapTo);
434 if (!wasSnap)
435 pwnd->InternalPos.NormalRect = origRect;
436 }
437 snap = snapTo;
438 }
439 }
440 break;
441 }
442
443 if ((msg.message != WM_KEYDOWN) && (msg.message != WM_MOUSEMOVE))
444 {
447 continue; /* We are not interested in other messages */
448 }
449
450 pt = msg.pt;
451
452 if (msg.message == WM_KEYDOWN) switch(msg.wParam)
453 {
454 case VK_UP: pt.y -= 8; break;
455 case VK_DOWN: pt.y += 8; break;
456 case VK_LEFT: pt.x -= 8; break;
457 case VK_RIGHT: pt.x += 8; break;
458 }
459
460 pt.x = max( pt.x, mouseRect.left );
461 pt.x = min( pt.x, mouseRect.right - 1 );
462 pt.y = max( pt.y, mouseRect.top );
463 pt.y = min( pt.y, mouseRect.bottom - 1 );
464
465 dx = pt.x - capturePoint.x;
466 dy = pt.y - capturePoint.y;
467
468 if (dx || dy)
469 {
470 if (!moved)
471 {
472 moved = TRUE;
473 if (iconic) /* ok, no system popup tracking */
474 {
475 OldCursor = UserSetCursor(DragCursor, FALSE);
477 }
478 else if (!DragFullWindows)
479 UserDrawMovingFrame(hdc, &sizingRect, thickframe);
480 }
481
482 if (msg.message == WM_KEYDOWN)
483 {
484 UserSetCursorPos(pt.x, pt.y, 0, 0, FALSE);
485 }
486 else
487 {
488 RECT newRect = unmodRect;
489
490 if (!iconic && !DragFullWindows)
491 {
492 UserDrawMovingFrame(hdc, pFrameRect, thickframe);
493 pFrameRect = &sizingRect;
494 }
495 if (hittest == HTCAPTION)
496 {
497 /* Restore window size if it is snapped */
498 PRECT pr = &newRect;
499 LONG width, height, capcy, snapTo;
500 if (snap && syscommand == SC_MOVE && !iconic &&
501 !RECTL_bIsEmptyRect(&pwnd->InternalPos.NormalRect))
502 {
503 *pr = pwnd->InternalPos.NormalRect;
504 origRect = *pr; /* Save normal size - is required when window unsnapped from one side and snapped to another holding mouse down */
505
506 /* Try to position the center of the caption where the mouse is horizontally */
507 capcy = UserGetSystemMetrics((ExStyle & WS_EX_TOPMOST) ? SM_CYSMCAPTION : SM_CYCAPTION); /* No border, close enough */
508 width = pr->right - pr->left;
509 height = pr->bottom - pr->top;
510 pr->left = pt.x - width / 2;
511 pr->right = pr->left + width;
512 pr->top = mouseRect.top;
513 pr->bottom = pr->top + height;
514 if (pr->left < mouseRect.left)
515 {
516 pr->left = mouseRect.left;
517 pr->right = pr->left + width;
518 }
519 if ((pwnd->ExStyle & WS_EX_LAYOUTRTL) && pr->right > mouseRect.right)
520 {
521 pr->left = mouseRect.right - width;
522 pr->right = pr->left + width;
523 }
524 UserSetCursorPos(pt.x, pr->top + capcy / 2, 0, 0, FALSE);
525 snap = FALSE;
526 dx = dy = 0; /* Don't offset this move */
527 if (DragFullWindows)
528 {
529 IntSetStyle(pwnd, 0, WS_MAXIMIZE);
531
532 /* Have to move and size it now because we don't want SWP_NOSIZE */
534 }
535 }
536 else if (!snap && syscommand == SC_MOVE && !iconic)
537 {
538 if ((snapTo = GetSnapActivationPoint(pwnd, pt)) != 0)
539 {
540 co_IntCalculateSnapPosition(pwnd, snapTo, &snapPreviewRect);
541 if (DragFullWindows)
542 {
543 /* TODO: Show preview of snap */
544 }
545 else
546 {
547 pFrameRect = &snapPreviewRect;
548 UserDrawMovingFrame(hdc, pFrameRect, thickframe);
549 continue;
550 }
551 }
552 }
553
554 /* regular window moving */
555 RECTL_vOffsetRect(&newRect, dx, dy);
556 }
557 if (ON_LEFT_BORDER(hittest)) newRect.left += dx;
558 else if (ON_RIGHT_BORDER(hittest)) newRect.right += dx;
559 if (ON_TOP_BORDER(hittest)) newRect.top += dy;
560 else if (ON_BOTTOM_BORDER(hittest)) newRect.bottom += dy;
561
562 capturePoint = pt;
563
564 //
565 // Save the new position to the unmodified rectangle. This allows explorer task bar
566 // sizing. Explorer will forces back the position unless a certain amount of sizing
567 // has occurred.
568 //
569 unmodRect = newRect;
570
571 /* Determine the hit location */
572 if (syscommand == SC_SIZE)
573 {
574 WPARAM wpSizingHit = 0;
575
576 if (hittest >= HTLEFT && hittest <= HTBOTTOMRIGHT)
577 wpSizingHit = WMSZ_LEFT + (hittest - HTLEFT);
578 co_IntSendMessage( UserHMGetHandle(pwnd), WM_SIZING, wpSizingHit, (LPARAM)&newRect );
579 }
580 else
581 co_IntSendMessage( UserHMGetHandle(pwnd), WM_MOVING, 0, (LPARAM)&newRect );
582
583 if (!iconic)
584 {
585 if (!DragFullWindows)
586 UserDrawMovingFrame( hdc, &newRect, thickframe );
587 else
588 { // Moving the whole window now!
589 HRGN hrgnNew;
590 HRGN hrgnOrig = GreCreateRectRgnIndirect(&pwnd->rcWindow);
591
592 if (pwnd->hrgnClip != NULL)
593 NtGdiCombineRgn(hrgnOrig, hrgnOrig, pwnd->hrgnClip, RGN_AND);
594
596 //IntMapWindowPoints( 0, pWndParent, (POINT *)&rect, 2 );
598 NULL,
599 newRect.left,
600 newRect.top,
601 newRect.right - newRect.left,
602 newRect.bottom - newRect.top,
603 SWP_NOACTIVATE | ((hittest == HTCAPTION) ? SWP_NOSIZE : 0));
604
605 hrgnNew = GreCreateRectRgnIndirect(&pwnd->rcWindow);
606 if (pwnd->hrgnClip != NULL)
607 NtGdiCombineRgn(hrgnNew, hrgnNew, pwnd->hrgnClip, RGN_AND);
608
609 if (hrgnNew)
610 {
611 if (hrgnOrig)
612 NtGdiCombineRgn(hrgnOrig, hrgnOrig, hrgnNew, RGN_DIFF);
613 }
614 else
615 {
616 if (hrgnOrig)
617 {
618 GreDeleteObject(hrgnOrig);
619 hrgnOrig = 0;
620 }
621 }
622
623 // Update all the windows after the move or size, including this window.
624 UpdateThreadWindows(UserGetDesktopWindow()->spwndChild, pti, hrgnOrig);
625
626 if (hrgnOrig) GreDeleteObject(hrgnOrig);
627 if (hrgnNew) GreDeleteObject(hrgnNew);
628 }
629 }
630 sizingRect = newRect;
631 }
632 }
633 }
634
635 pwnd->head.pti->TIF_flags &= ~TIF_MOVESIZETRACKING;
636
638
639 if ( iconic )
640 {
641 if ( moved ) /* restore cursors, show icon title later on */
642 {
644 OldCursor = UserSetCursor(OldCursor, FALSE);
645 }
646
647 /* It could be that the cursor was already changed while we were proceeding,
648 * so we must unreference whatever cursor was current at the time we restored the old one.
649 * Maybe it is DragCursor, but maybe it is another one and DragCursor got already freed.
650 */
651 if (OldCursor) UserDereferenceObject(OldCursor);
652 }
653 else
654 {
655 UINT eraseFinalFrame = moved && !DragFullWindows;
656 if (eraseFinalFrame)
657 UserDrawMovingFrame(hdc, pFrameRect, thickframe); // Undo the XOR drawing
658 }
659
661
663 //if (pWndParent) IntMapWindowPoints( 0, pWndParent, (POINT *)&sizingRect, 2 );
664
666 {
667 ERR("DoSizeMove : WH_CBT Call Hook return!\n");
668 moved = FALSE;
669 }
670
671 IntNotifyWinEvent( EVENT_SYSTEM_MOVESIZEEND, pwnd, OBJID_WINDOW, CHILDID_SELF, 0);
672
674
679 /* window moved or resized */
680 if (moved)
681 {
682 BOOL forceSizing = !iconic && hittest == HTCAPTION && (!!orgSnap != !!snap);
683 UINT swp = (!forceSizing && hittest == HTCAPTION) ? SWP_NOSIZE : 0;
684
685 /* if the moving/resizing isn't canceled call SetWindowPos
686 * with the new position or the new size of the window
687 */
688 if (!((msg.message == WM_KEYDOWN) && (msg.wParam == VK_ESCAPE)) )
689 {
690 /* NOTE: SWP_NOACTIVATE prevents document window activation in Word 6 */
691 if (!DragFullWindows || iconic)
692 {
693 if (snap)
694 {
695 co_IntSnapWindow(pwnd, snap);
696 }
697 else
698 {
699 if (orgSnap && !snap)
700 {
701 IntSetStyle(pwnd, 0, WS_MAXIMIZE);
703 }
704 co_WinPosSetWindowPos(pwnd, HWND_TOP, sizingRect.left, sizingRect.top,
705 sizingRect.right - sizingRect.left,
706 sizingRect.bottom - sizingRect.top, swp);
707 }
708 }
709 }
710 else
711 {
712 /* restore previous size/position */
713 if (orgSnap)
714 {
715 co_IntSnapWindow(pwnd, orgSnap);
716 }
717 else if (DragFullWindows)
718 {
719 co_WinPosSetWindowPos(pwnd, HWND_TOP, origRect.left, origRect.top,
720 origRect.right - origRect.left,
721 origRect.bottom - origRect.top, swp);
722 }
723 }
724 }
725
726 if (IntIsWindow(UserHMGetHandle(pwnd)))
727 {
728 /* Single click brings up the system menu when iconized */
729 if (iconic && !moved && (Style & WS_SYSMENU))
730 {
732 }
733 }
734}
735
737{
738 PCURICON_OBJECT pIcon = NULL;
739 HICON hIcon;
740
742 if (!hIcon) hIcon = UserGetProp(pWnd, gpsi->atomIconProp, TRUE);
743
744 if (!hIcon && pWnd->pcls->spicnSm)
745 return pWnd->pcls->spicnSm;
746 if (!hIcon && pWnd->pcls->spicn)
747 return pWnd->pcls->spicn;
748
749 // WARNING: Wine code has this test completely wrong. The following is how
750 // Windows behaves for windows having the WS_EX_DLGMODALFRAME style set:
751 // it does not use the default icon! And it does not check for DS_MODALFRAME.
752 if (!hIcon && !(pWnd->ExStyle & WS_EX_DLGMODALFRAME))
753 {
754 hIcon = gpsi->hIconSmWindows; // Both are IDI_WINLOGO Small
755 if (!hIcon) hIcon = gpsi->hIconWindows; // Reg size.
756 }
757 if (hIcon)
758 {
760 hIcon,
762 }
763 return pIcon;
764}
765
766BOOL
768{
769 PCURICON_OBJECT WindowIcon;
770 BOOL Ret = FALSE;
771
772 if ((WindowIcon = NC_IconForWindow(pWnd)))
773 {
774 UserReferenceObject(WindowIcon);
775
776 Ret = UserDrawIconEx(hDC,
777 Rect->left + 2,
778 Rect->top + 2,
779 WindowIcon,
782 0, NULL, DI_NORMAL);
783
784 UserDereferenceObject(WindowIcon);
785 }
786 return Ret;
787}
788
789BOOL
791{
793 sbi.cbSize = sizeof(SCROLLBARINFO);
794
795 if(!co_IntGetScrollBarInfo(pWnd, hBar, &sbi))
796 return FALSE;
797
798 return !(sbi.rgstate[0] & STATE_SYSTEM_OFFSCREEN);
799}
800
801/*
802 * FIXME:
803 * - Cache bitmaps, then just bitblt instead of calling DFC() (and
804 * wasting precious CPU cycles) every time
805 * - Center the buttons vertically in the rect
806 */
807VOID
809{
810 RECT TempRect;
811
812 if (!(Style & WS_SYSMENU))
813 {
814 return;
815 }
816
817 TempRect = *Rect;
818
819 switch (Type)
820 {
821 case DFCS_CAPTIONMIN:
822 {
824 return; /* ToolWindows don't have min/max buttons */
825
826 if (Style & WS_SYSMENU)
827 TempRect.right -= UserGetSystemMetrics(SM_CXSIZE) + 1;
828
830 TempRect.right -= UserGetSystemMetrics(SM_CXSIZE) - 2;
831
832 TempRect.left = TempRect.right - UserGetSystemMetrics(SM_CXSIZE) + 1;
833 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSIZE) - 2;
834 TempRect.top += 2;
835 TempRect.right -= 1;
836
837 DrawFrameControl(hDC, &TempRect, DFC_CAPTION,
839 (bDown ? DFCS_PUSHED : 0) |
841 break;
842 }
843 case DFCS_CAPTIONMAX:
844 {
846 return; /* ToolWindows don't have min/max buttons */
847
848 if (Style & WS_SYSMENU)
849 TempRect.right -= UserGetSystemMetrics(SM_CXSIZE) + 1;
850
851 TempRect.left = TempRect.right - UserGetSystemMetrics(SM_CXSIZE) + 1;
852 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSIZE) - 2;
853 TempRect.top += 2;
854 TempRect.right -= 1;
855
856 DrawFrameControl(hDC, &TempRect, DFC_CAPTION,
858 (bDown ? DFCS_PUSHED : 0) |
860 break;
861 }
863 {
864 PMENU pSysMenu = IntGetSystemMenu(pWnd, FALSE);
865 UINT MenuState = IntGetMenuState(pSysMenu ? UserHMGetHandle(pSysMenu) : NULL, SC_CLOSE, MF_BYCOMMAND); /* in case of error MenuState==0xFFFFFFFF */
866
867 /* A tool window has a smaller Close button */
869 {
870 TempRect.left = TempRect.right - UserGetSystemMetrics(SM_CXSMSIZE);
871 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSMSIZE) - 2;
872 }
873 else
874 {
875 TempRect.left = TempRect.right - UserGetSystemMetrics(SM_CXSIZE);
876 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSIZE) - 2;
877 }
878 TempRect.top += 2;
879 TempRect.right -= 2;
880
881 DrawFrameControl(hDC, &TempRect, DFC_CAPTION,
882 (DFCS_CAPTIONCLOSE | (bDown ? DFCS_PUSHED : 0) |
883 ((!(MenuState & (MF_GRAYED|MF_DISABLED)) && !(pWnd->pcls->style & CS_NOCLOSE)) ? 0 : DFCS_INACTIVE)));
884 break;
885 }
886 }
887}
888
889VOID
891{
892 RECT WindowRect;
893 SIZE WindowBorder;
894
895 IntGetWindowRect(pWnd, &WindowRect);
896
897 WindowRect.right -= WindowRect.left;
898 WindowRect.bottom -= WindowRect.top;
899 WindowRect.left = WindowRect.top = 0;
900
901 UserGetWindowBorders(pWnd->style, pWnd->ExStyle, &WindowBorder, FALSE);
902
903 RECTL_vInflateRect(&WindowRect, -WindowBorder.cx, -WindowBorder.cy);
904
905 UserDrawCaptionButton(pWnd, &WindowRect, pWnd->style, pWnd->ExStyle, hDC, bDown, Type);
906}
907
908VOID
910{
911 /* Firstly the "thick" frame */
912 if ((Style & WS_THICKFRAME) && !(Style & WS_MINIMIZE))
913 {
914 LONG Width =
917
918 LONG Height =
921
923
924 /* Draw frame */
925 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, CurrentRect->right - CurrentRect->left, Height, PATCOPY);
926 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
927 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->bottom, CurrentRect->right - CurrentRect->left, -Height, PATCOPY);
928 NtGdiPatBlt(hDC, CurrentRect->right, CurrentRect->top, -Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
929
930 RECTL_vInflateRect(CurrentRect, -Width, -Height);
931 }
932
933 /* Now the other bit of the frame */
935 {
938
944
945 /* Draw frame */
946 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, CurrentRect->right - CurrentRect->left, Height, PATCOPY);
947 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
948 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->bottom, CurrentRect->right - CurrentRect->left, -Height, PATCOPY);
949 NtGdiPatBlt(hDC, CurrentRect->right, CurrentRect->top, -Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
950
951 RECTL_vInflateRect(CurrentRect, -Width, -Height);
952 }
953}
954
956 PWND pWnd,
957 HDC hDC,
958 INT Flags)
959{
961 RECT WindowRect, CurrentRect, TempRect;
962 HPEN PreviousPen;
963 BOOL Gradient = FALSE;
964 PCURICON_OBJECT pIcon = NULL;
965
966 if (!(Flags & DC_NOVISIBLE) && !IntIsWindowVisible(pWnd)) return;
967
968 TRACE("UserDrawCaptionBar: pWnd %p, hDc %p, Flags 0x%x.\n", pWnd, hDC, Flags);
969
970 Style = pWnd->style;
971 ExStyle = pWnd->ExStyle;
972
973 IntGetWindowRect(pWnd, &WindowRect);
974
975 CurrentRect.top = CurrentRect.left = 0;
976 CurrentRect.right = WindowRect.right - WindowRect.left;
977 CurrentRect.bottom = WindowRect.bottom - WindowRect.top;
978
979 /* Draw outer edge */
981 {
982 DrawEdge(hDC, &CurrentRect, EDGE_RAISED, BF_RECT | BF_ADJUST);
983 }
984 else if (ExStyle & WS_EX_STATICEDGE)
985 {
986#if 0
988#else
990 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.top, CurrentRect.right - CurrentRect.left, 1, PATCOPY);
991 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY);
992
994 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.bottom - 1, CurrentRect.right - CurrentRect.left, 1, PATCOPY);
995 NtGdiPatBlt(hDC, CurrentRect.right - 1, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY);
996
997 RECTL_vInflateRect(&CurrentRect, -1, -1);
998#endif
999 }
1000
1001 if (Flags & DC_FRAME) NC_DrawFrame(hDC, &CurrentRect, (Flags & DC_ACTIVE), Style, ExStyle);
1002
1003 /* Draw caption */
1004 if ((Style & WS_CAPTION) == WS_CAPTION)
1005 {
1006 TempRect = CurrentRect;
1007
1008 Flags |= DC_TEXT|DC_BUTTONS; // Icon will be checked if not already set.
1009
1010 if (UserSystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &Gradient, 0) && Gradient)
1011 {
1012 Flags |= DC_GRADIENT;
1013 }
1014
1016 {
1017 Flags |= DC_SMALLCAP;
1018 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSMCAPTION) - 1;
1019 CurrentRect.top += UserGetSystemMetrics(SM_CYSMCAPTION);
1020 }
1021 else
1022 {
1023 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYCAPTION) - 1;
1024 CurrentRect.top += UserGetSystemMetrics(SM_CYCAPTION);
1025 }
1026
1027 if (!(Flags & DC_ICON) &&
1028 !(Flags & DC_SMALLCAP) &&
1029 (Style & WS_SYSMENU) &&
1031 {
1032 pIcon = NC_IconForWindow(pWnd); // Force redraw of caption with icon if DC_ICON not flaged....
1033 }
1034 UserDrawCaption(pWnd, hDC, &TempRect, NULL, pIcon ? UserHMGetHandle(pIcon) : NULL, NULL, Flags);
1035
1036 /* Draw buttons */
1037 if (Style & WS_SYSMENU)
1038 {
1041 {
1044 }
1045 }
1046
1047 if (!(Style & WS_MINIMIZE))
1048 {
1049 /* Line under caption */
1050 PreviousPen = NtGdiSelectPen(hDC, NtGdiGetStockObject(DC_PEN));
1051
1054
1055 GreMoveTo(hDC, TempRect.left, TempRect.bottom, NULL);
1056
1057 NtGdiLineTo(hDC, TempRect.right, TempRect.bottom);
1058
1059 NtGdiSelectPen(hDC, PreviousPen);
1060 }
1061 }
1062
1063 if (!(Style & WS_MINIMIZE))
1064 {
1065 /* Draw menu bar */
1066 if (pWnd->state & WNDS_HASMENU && pWnd->IDMenu) // Should be pWnd->spmenu
1067 {
1068 PMENU menu;
1069 if ((menu = UserGetMenuObject(UlongToHandle(pWnd->IDMenu)))) // FIXME! Use pWnd->spmenu,
1070 {
1071 TempRect = CurrentRect;
1072 TempRect.bottom = TempRect.top + menu->cyMenu; // Should be pWnd->spmenu->cyMenu;
1073 CurrentRect.top += MENU_DrawMenuBar(hDC, &TempRect, pWnd, FALSE);
1074 }
1075 }
1076
1078 {
1079 DrawEdge(hDC, &CurrentRect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
1080 }
1081 }
1082}
1083
1084// Note from Wine:
1085/* MSDN docs are pretty idiotic here, they say app CAN use clipRgn in
1086 the call to GetDCEx implying that it is allowed not to use it either.
1087 However, the suggested GetDCEx( , DCX_WINDOW | DCX_INTERSECTRGN)
1088 will cause clipRgn to be deleted after ReleaseDC().
1089 Now, how is the "system" supposed to tell what happened?
1090 */
1091/*
1092 * FIXME:
1093 * - Drawing of WS_BORDER after scrollbars
1094 * - Correct drawing of size-box
1095 */
1096LRESULT
1098{
1100 PWND Parent;
1101 RECT WindowRect, CurrentRect, TempRect;
1102 BOOL Active = FALSE;
1103
1104 if (!IntIsWindowVisible(pWnd) ||
1105 (pWnd->state & WNDS_NONCPAINT && !(pWnd->state & WNDS_FORCEMENUDRAW)) ||
1106 IntEqualRect(&pWnd->rcWindow, &pWnd->rcClient) )
1107 return 0;
1108
1109 Style = pWnd->style;
1110
1111 TRACE("DefWndNCPaint: pWnd %p, hDc %p, Active %s.\n", pWnd, hDC, Flags & DC_ACTIVE ? "TRUE" : "FALSE");
1112
1113 Parent = IntGetParent(pWnd);
1114 ExStyle = pWnd->ExStyle;
1115
1116 if (Flags == -1) // NC paint mode.
1117 {
1118 if (ExStyle & WS_EX_MDICHILD)
1119 {
1121
1122 if (Active)
1124 }
1125 else
1126 {
1127 Active = (gpqForeground == pWnd->head.pti->MessageQueue);
1128 }
1129 Flags = DC_NC; // Redraw everything!
1130 }
1131 else
1132 Flags |= DC_NC;
1133
1134
1135 IntGetWindowRect(pWnd, &WindowRect);
1136
1137 CurrentRect.top = CurrentRect.left = 0;
1138 CurrentRect.right = WindowRect.right - WindowRect.left;
1139 CurrentRect.bottom = WindowRect.bottom - WindowRect.top;
1140
1141 /* Draw outer edge */
1142 if (UserHasWindowEdge(pWnd->style, pWnd->ExStyle))
1143 {
1144 DrawEdge(hDC, &CurrentRect, EDGE_RAISED, BF_RECT | BF_ADJUST);
1145 }
1146 else if (pWnd->ExStyle & WS_EX_STATICEDGE)
1147 {
1148#if 0
1149 DrawEdge(hDC, &CurrentRect, BDR_SUNKENINNER, BF_RECT | BF_ADJUST | BF_FLAT);
1150#else
1152 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.top, CurrentRect.right - CurrentRect.left, 1, PATCOPY);
1153 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY);
1154
1156 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.bottom - 1, CurrentRect.right - CurrentRect.left, 1, PATCOPY);
1157 NtGdiPatBlt(hDC, CurrentRect.right - 1, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY);
1158
1159 RECTL_vInflateRect(&CurrentRect, -1, -1);
1160#endif
1161 }
1162
1163 if (Flags & DC_FRAME) NC_DrawFrame(hDC, &CurrentRect, Active ? Active : (Flags & DC_ACTIVE), Style, ExStyle);
1164
1165 /* Draw caption */
1166 if ((Style & WS_CAPTION) == WS_CAPTION)
1167 {
1168 HPEN PreviousPen;
1169 BOOL Gradient = FALSE;
1170
1171 if (Flags & DC_REDRAWHUNGWND)
1172 {
1173 Flags &= ~DC_REDRAWHUNGWND;
1175 }
1176
1177 if (UserSystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &Gradient, 0) && Gradient)
1178 {
1179 Flags |= DC_GRADIENT;
1180 }
1181
1182 if (Active)
1183 {
1184 if (pWnd->state & WNDS_ACTIVEFRAME)
1185 Flags |= DC_ACTIVE;
1186 else
1187 {
1188 ERR("Wnd is active and not set active!\n");
1189 }
1190 }
1191
1192 TempRect = CurrentRect;
1193
1195 {
1196 Flags |= DC_SMALLCAP;
1197 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSMCAPTION) - 1;
1198 CurrentRect.top += UserGetSystemMetrics(SM_CYSMCAPTION);
1199 }
1200 else
1201 {
1202 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYCAPTION) - 1;
1203 CurrentRect.top += UserGetSystemMetrics(SM_CYCAPTION);
1204 }
1205
1206 UserDrawCaption(pWnd, hDC, &TempRect, NULL, NULL, NULL, Flags);
1207
1208 /* Draw buttons */
1209 if (Style & WS_SYSMENU)
1210 {
1213 {
1216 }
1217 }
1218 if (!(Style & WS_MINIMIZE))
1219 {
1220 /* Line under caption */
1221 PreviousPen = NtGdiSelectPen(hDC, NtGdiGetStockObject(DC_PEN));
1222
1226
1227 GreMoveTo(hDC, TempRect.left, TempRect.bottom, NULL);
1228
1229 NtGdiLineTo(hDC, TempRect.right, TempRect.bottom);
1230
1231 NtGdiSelectPen(hDC, PreviousPen);
1232 }
1233 }
1234
1235 if (!(Style & WS_MINIMIZE))
1236 {
1237 /* Draw menu bar */
1238 if (pWnd->state & WNDS_HASMENU && pWnd->IDMenu) // Should be pWnd->spmenu
1239 {
1240 if (!(Flags & DC_NOSENDMSG))
1241 {
1242 PMENU menu;
1243 // Fix crash in test_menu_locked_by_window, should use pWnd->spmenu....
1244 if ((menu = UserGetMenuObject(UlongToHandle(pWnd->IDMenu)))) // FIXME! Use pWnd->spmenu,
1245 {
1246 TempRect = CurrentRect;
1247 TempRect.bottom = TempRect.top + menu->cyMenu; // Should be pWnd->spmenu->cyMenu;
1248 CurrentRect.top += MENU_DrawMenuBar(hDC, &TempRect, pWnd, FALSE);
1249 }
1250 }
1251 }
1252
1254 {
1255 DrawEdge(hDC, &CurrentRect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
1256 }
1257
1258 /* Draw the scrollbars */
1259 if ((Style & WS_VSCROLL) && (Style & WS_HSCROLL) &&
1261 {
1262 RECT ParentClientRect;
1263
1264 TempRect = CurrentRect;
1265
1267 TempRect.right = TempRect.left + UserGetSystemMetrics(SM_CXVSCROLL);
1268 else
1269 TempRect.left = TempRect.right - UserGetSystemMetrics(SM_CXVSCROLL);
1270
1271 TempRect.top = TempRect.bottom - UserGetSystemMetrics(SM_CYHSCROLL);
1272
1274
1275 if (Parent)
1276 {
1277 IntGetClientRect(Parent, &ParentClientRect);
1278
1279 if (HASSIZEGRIP(Style, ExStyle, Parent->style, WindowRect, ParentClientRect))
1280 {
1282 }
1283 }
1284
1287 }
1288 else
1289 {
1291 {
1293 }
1295 {
1297 }
1298 }
1299 }
1300 return 0; // For WM_NCPAINT message, return 0.
1301}
1302
1304{
1305 LRESULT Result = 0;
1306 SIZE WindowBorders;
1307 RECT OrigRect;
1308 LONG Style = Wnd->style;
1309 LONG exStyle = Wnd->ExStyle;
1310
1311 if (Rect == NULL)
1312 {
1313 return Result;
1314 }
1315 OrigRect = *Rect;
1316
1317 Wnd->state &= ~WNDS_HASCAPTION;
1318
1319 if (wparam)
1320 {
1321 if (Wnd->pcls->style & CS_VREDRAW)
1322 {
1324 }
1325 if (Wnd->pcls->style & CS_HREDRAW)
1326 {
1328 }
1330 }
1331
1332 if (!(Wnd->style & WS_MINIMIZE))
1333 {
1334 if (UserHasWindowEdge(Wnd->style, Wnd->ExStyle))
1335 {
1336 UserGetWindowBorders(Wnd->style, Wnd->ExStyle, &WindowBorders, FALSE);
1337 RECTL_vInflateRect(Rect, -WindowBorders.cx, -WindowBorders.cy);
1338 }
1339 else if ((Wnd->ExStyle & WS_EX_STATICEDGE) || (Wnd->style & WS_BORDER))
1340 {
1341 RECTL_vInflateRect(Rect, -1, -1);
1342 }
1343
1344 if ((Wnd->style & WS_CAPTION) == WS_CAPTION)
1345 {
1346 Wnd->state |= WNDS_HASCAPTION;
1347
1348 if (Wnd->ExStyle & WS_EX_TOOLWINDOW)
1350 else
1352 }
1353
1354 if (HAS_MENU(Wnd, Style))
1355 {
1357
1358 Wnd->state |= WNDS_HASMENU;
1359
1360 if (hDC)
1361 {
1362 RECT CliRect = *Rect;
1363 CliRect.bottom -= OrigRect.top;
1364 CliRect.right -= OrigRect.left;
1365 CliRect.left -= OrigRect.left;
1366 CliRect.top -= OrigRect.top;
1367 if (!Suspended) Rect->top += MENU_DrawMenuBar(hDC, &CliRect, Wnd, TRUE);
1368 UserReleaseDC(Wnd, hDC, FALSE);
1369 }
1370 }
1371
1372 if (Wnd->ExStyle & WS_EX_CLIENTEDGE)
1373 {
1375 }
1376
1377 if (Style & WS_VSCROLL)
1378 {
1379 if (Rect->right - Rect->left >= UserGetSystemMetrics(SM_CXVSCROLL))
1380 {
1382
1383 /* rectangle is in screen coords when wparam is false */
1384 if (!wparam && (exStyle & WS_EX_LAYOUTRTL)) exStyle ^= WS_EX_LEFTSCROLLBAR;
1385
1386 if((exStyle & WS_EX_LEFTSCROLLBAR) != 0)
1388 else
1390 }
1391 }
1392
1393 if (Style & WS_HSCROLL)
1394 {
1395 if( Rect->bottom - Rect->top > UserGetSystemMetrics(SM_CYHSCROLL))
1396 {
1398
1400 }
1401 }
1402
1403 if (Rect->top > Rect->bottom)
1404 Rect->bottom = Rect->top;
1405
1406 if (Rect->left > Rect->right)
1407 Rect->right = Rect->left;
1408 }
1409 else
1410 {
1411 Rect->right = Rect->left;
1412 Rect->bottom = Rect->top;
1413 }
1414
1415 return Result;
1416}
1417
1418static
1420{
1421 INT Ret = 0;
1422
1425 Ret = DC_CAPTION;
1426
1427 if (!(Wnd->style & WS_MINIMIZED) && UserHasThickFrameStyle(Wnd->style, Wnd->ExStyle))
1428 {
1429 //if (IntGetSysColor(COLOR_ACTIVEBORDER) != IntGetSysColor(COLOR_INACTIVEBORDER)) // Why are these the same?
1430 {
1431 Ret = DC_FRAME;
1432 }
1433 }
1434 return Ret;
1435}
1436
1438{
1439 INT Flags;
1440 /* Lotus Notes draws menu descriptions in the caption of its main
1441 * window. When it wants to restore original "system" view, it just
1442 * sends WM_NCACTIVATE message to itself. Any optimizations here in
1443 * attempt to minimize redrawings lead to a not restored caption.
1444 */
1445 if (wParam & DC_ACTIVE)
1446 {
1449 }
1450 else
1451 {
1452 Wnd->state &= ~WNDS_ACTIVEFRAME;
1454 }
1455
1456 if ((Wnd->state & WNDS_NONCPAINT) || !(Wnd->style & WS_VISIBLE))
1457 return TRUE;
1458
1459 /* This isn't documented but is reproducible in at least XP SP2 and
1460 * Outlook 2007 depends on it
1461 */
1462 // MSDN:
1463 // If this parameter is set to -1, DefWindowProc does not repaint the
1464 // nonclient area to reflect the state change.
1465 if ( lParam != -1 &&
1466 ( Flags = NC_DoNCActive(Wnd)) != 0 )
1467 {
1468 HDC hDC;
1469 HRGN hRgnTemp = NULL, hRgn = (HRGN)lParam;
1470
1472 {
1473 hRgnTemp = NtGdiCreateRectRgn(0, 0, 0, 0);
1474 if (NtGdiCombineRgn(hRgnTemp, hRgn, 0, RGN_COPY) == ERROR)
1475 {
1476 GreDeleteObject(hRgnTemp);
1477 hRgnTemp = NULL;
1478 }
1479 }
1480
1481 if ((hDC = UserGetDCEx(Wnd, hRgnTemp, DCX_WINDOW|DCX_USESTYLE)))
1482 {
1483 NC_DoNCPaint(Wnd, hDC, wParam | Flags); // Redraw MENUs.
1484 UserReleaseDC(Wnd, hDC, FALSE);
1485 }
1486 else
1487 GreDeleteObject(hRgnTemp);
1488 }
1489
1490 return TRUE;
1491}
1492
1493VOID
1495{
1496 MSG Msg;
1497 HDC WindowDC;
1498 BOOL Pressed = TRUE, OldState;
1499 WPARAM SCMsg;
1500 PMENU SysMenu;
1501 ULONG ButtonType;
1502 DWORD Style;
1503 UINT MenuState;
1504
1505 Style = pWnd->style;
1506 switch (wParam)
1507 {
1508 case HTCLOSE:
1509 SysMenu = IntGetSystemMenu(pWnd, FALSE);
1510 MenuState = IntGetMenuState(SysMenu ? UserHMGetHandle(SysMenu) : NULL, SC_CLOSE, MF_BYCOMMAND); /* in case of error MenuState==0xFFFFFFFF */
1511 if (!(Style & WS_SYSMENU) || (MenuState & (MF_GRAYED|MF_DISABLED)) || (pWnd->pcls->style & CS_NOCLOSE))
1512 return;
1513 ButtonType = DFCS_CAPTIONCLOSE;
1514 SCMsg = SC_CLOSE;
1515 break;
1516 case HTMINBUTTON:
1517 if (!(Style & WS_MINIMIZEBOX))
1518 return;
1519 ButtonType = DFCS_CAPTIONMIN;
1520 SCMsg = ((Style & WS_MINIMIZE) ? SC_RESTORE : SC_MINIMIZE);
1521 break;
1522 case HTMAXBUTTON:
1523 if (!(Style & WS_MAXIMIZEBOX))
1524 return;
1525 ButtonType = DFCS_CAPTIONMAX;
1526 SCMsg = ((Style & WS_MAXIMIZE) ? SC_RESTORE : SC_MAXIMIZE);
1527 break;
1528
1529 default:
1530 ASSERT(FALSE);
1531 return;
1532 }
1533
1534 /*
1535 * FIXME: Not sure where to do this, but we must flush the pending
1536 * window updates when someone clicks on the close button and at
1537 * the same time the window is overlapped with another one. This
1538 * looks like a good place for now...
1539 */
1541
1542 WindowDC = UserGetWindowDC(pWnd);
1543 UserDrawCaptionButtonWnd(pWnd, WindowDC, TRUE, ButtonType);
1544
1546
1547 for (;;)
1548 {
1550 if (IntCallMsgFilter( &Msg, MSGF_MAX )) continue;
1551
1552 if (Msg.message == WM_LBUTTONUP)
1553 break;
1554
1555 if (Msg.message != WM_MOUSEMOVE)
1556 continue;
1557
1558 OldState = Pressed;
1559 Pressed = (GetNCHitEx(pWnd, Msg.pt) == wParam);
1560 if (Pressed != OldState)
1561 UserDrawCaptionButtonWnd(pWnd, WindowDC, Pressed, ButtonType);
1562 }
1563
1564 if (Pressed)
1565 UserDrawCaptionButtonWnd(pWnd, WindowDC, FALSE, ButtonType);
1567 UserReleaseDC(pWnd, WindowDC, FALSE);
1568 if (Pressed)
1569 co_IntSendMessage(UserHMGetHandle(pWnd), WM_SYSCOMMAND, SCMsg, SCMsg == SC_CLOSE ? lParam : MAKELONG(Msg.pt.x,Msg.pt.y));
1570}
1571
1572
1573LRESULT
1575{
1576 switch (wParam)
1577 {
1578 case HTCAPTION:
1579 {
1580 PWND TopWnd = pWnd, parent;
1581 while(1)
1582 {
1583 if ((TopWnd->style & (WS_POPUP|WS_CHILD)) != WS_CHILD)
1584 break;
1585 parent = UserGetAncestor( TopWnd, GA_PARENT );
1586 if (!parent || UserIsDesktopWindow(parent)) break;
1587 TopWnd = parent;
1588 }
1589
1590 if ( (pWnd && (pWnd->ExStyle & WS_EX_NOACTIVATE)) ||
1592 //NtUserCallHwndLock(hTopWnd, HWNDLOCK_ROUTINE_SETFOREGROUNDWINDOWMOUSE) ||
1594 {
1596 }
1597 break;
1598 }
1599 case HTSYSMENU:
1600 {
1601 LONG style = pWnd->style;
1602 if (style & WS_SYSMENU)
1603 {
1604 if(!(style & WS_MINIMIZE) )
1605 {
1606 RECT rect;
1607 HDC hDC = UserGetWindowDC(pWnd);
1608 NC_GetInsideRect(pWnd, &rect);
1610 UserReleaseDC( pWnd, hDC, FALSE );
1611 }
1613 }
1614 break;
1615 }
1616 case HTMENU:
1617 {
1619 break;
1620 }
1621 case HTHSCROLL:
1622 {
1624 break;
1625 }
1626 case HTVSCROLL:
1627 {
1629 break;
1630 }
1631 case HTMINBUTTON:
1632 case HTMAXBUTTON:
1633 case HTCLOSE:
1634 {
1635 NC_DoButton(pWnd, wParam, lParam);
1636 break;
1637 }
1638 case HTLEFT:
1639 case HTRIGHT:
1640 case HTTOP:
1641 case HTBOTTOM:
1642 case HTTOPLEFT:
1643 case HTTOPRIGHT:
1644 case HTBOTTOMLEFT:
1645 case HTBOTTOMRIGHT:
1646 {
1647 /* Old comment:
1648 * "make sure hittest fits into 0xf and doesn't overlap with HTSYSMENU"
1649 * This was previously done by setting wParam=SC_SIZE + wParam - 2
1650 */
1651 /* But that is not what WinNT does. Instead it sends this. This
1652 * is easy to differentiate from HTSYSMENU, because HTSYSMENU adds
1653 * SC_MOUSEMENU into wParam.
1654 */
1656 break;
1657 }
1658 case HTBORDER:
1659 break;
1660 }
1661 return(0);
1662}
1663
1664
1665LRESULT
1667{
1668 ULONG Style;
1669
1670 Style = pWnd->style;
1671 switch(wParam)
1672 {
1673 case HTCAPTION:
1674 {
1675 /* Maximize/Restore the window */
1677 {
1679 }
1680 break;
1681 }
1682 case HTSYSMENU:
1683 {
1684 PMENU SysMenu = IntGetSystemMenu(pWnd, FALSE);
1686
1687 /* If the close item of the sysmenu is disabled or not present do nothing */
1688 if ((state & (MF_DISABLED | MF_GRAYED)) || (state == 0xFFFFFFFF))
1689 break;
1690
1692 break;
1693 }
1694 case HTTOP:
1695 case HTBOTTOM:
1696 {
1697 RECT sizingRect = pWnd->rcWindow, mouseRect;
1698
1699 if (pWnd->ExStyle & WS_EX_MDICHILD)
1700 break;
1701
1702 UserSystemParametersInfo(SPI_GETWORKAREA, 0, &mouseRect, 0);
1703
1705 NULL,
1706 sizingRect.left,
1707 mouseRect.top,
1708 sizingRect.right - sizingRect.left,
1709 mouseRect.bottom - mouseRect.top,
1710 0);
1711 break;
1712 }
1713 default:
1714 return NC_HandleNCLButtonDown(pWnd, wParam, lParam);
1715 }
1716 return(0);
1717}
1718
1719/***********************************************************************
1720 * NC_HandleNCRButtonDown
1721 *
1722 * Handle a WM_NCRBUTTONDOWN message. Called from DefWindowProc().
1723 */
1725{
1726 MSG msg;
1727 INT hittest = wParam;
1728
1729 switch (hittest)
1730 {
1731 case HTCAPTION:
1732 case HTSYSMENU:
1733 if (!IntGetSystemMenu( pwnd, FALSE )) break;
1734
1736 for (;;)
1737 {
1739 if (IntCallMsgFilter( &msg, MSGF_MAX )) continue;
1740 if (msg.message == WM_RBUTTONUP)
1741 {
1742 hittest = GetNCHitEx( pwnd, msg.pt );
1743 break;
1744 }
1745 if (UserHMGetHandle(pwnd) != IntGetCapture()) return 0;
1746 }
1748
1749 if (hittest == HTCAPTION || hittest == HTSYSMENU || hittest == HTHSCROLL || hittest == HTVSCROLL)
1750 {
1751 TRACE("Msg pt %x and Msg.lParam %x and lParam %x\n",MAKELONG(msg.pt.x,msg.pt.y),msg.lParam,lParam);
1753 }
1754 break;
1755 }
1756 return 0;
1757}
1758
1759
1760#if 0 // Old version, kept there for reference, which is also used
1761 // almost unmodified in uxtheme.dll (in nonclient.c)
1762/*
1763 * FIXME:
1764 * - Check the scrollbar handling
1765 */
1766LRESULT
1768{
1769 RECT WindowRect, ClientRect, OrigWndRect;
1770 POINT ClientPoint;
1771 SIZE WindowBorders;
1774
1775 GetWindowRect(hWnd, &WindowRect);
1776 if (!PtInRect(&WindowRect, Point))
1777 {
1778 return HTNOWHERE;
1779 }
1780 OrigWndRect = WindowRect;
1781
1783 {
1784 LONG XSize, YSize;
1785
1786 UserGetWindowBorders(Style, ExStyle, &WindowBorders, FALSE);
1787 InflateRect(&WindowRect, -WindowBorders.cx, -WindowBorders.cy);
1790 if (!PtInRect(&WindowRect, Point))
1791 {
1792 BOOL ThickFrame;
1793
1794 ThickFrame = (Style & WS_THICKFRAME);
1795 if (Point.y < WindowRect.top)
1796 {
1797 if(Style & WS_MINIMIZE)
1798 return HTCAPTION;
1799 if(!ThickFrame)
1800 return HTBORDER;
1801 if (Point.x < (WindowRect.left + XSize))
1802 return HTTOPLEFT;
1803 if (Point.x >= (WindowRect.right - XSize))
1804 return HTTOPRIGHT;
1805 return HTTOP;
1806 }
1807 if (Point.y >= WindowRect.bottom)
1808 {
1809 if(Style & WS_MINIMIZE)
1810 return HTCAPTION;
1811 if(!ThickFrame)
1812 return HTBORDER;
1813 if (Point.x < (WindowRect.left + XSize))
1814 return HTBOTTOMLEFT;
1815 if (Point.x >= (WindowRect.right - XSize))
1816 return HTBOTTOMRIGHT;
1817 return HTBOTTOM;
1818 }
1819 if (Point.x < WindowRect.left)
1820 {
1821 if(Style & WS_MINIMIZE)
1822 return HTCAPTION;
1823 if(!ThickFrame)
1824 return HTBORDER;
1825 if (Point.y < (WindowRect.top + YSize))
1826 return HTTOPLEFT;
1827 if (Point.y >= (WindowRect.bottom - YSize))
1828 return HTBOTTOMLEFT;
1829 return HTLEFT;
1830 }
1831 if (Point.x >= WindowRect.right)
1832 {
1833 if(Style & WS_MINIMIZE)
1834 return HTCAPTION;
1835 if(!ThickFrame)
1836 return HTBORDER;
1837 if (Point.y < (WindowRect.top + YSize))
1838 return HTTOPRIGHT;
1839 if (Point.y >= (WindowRect.bottom - YSize))
1840 return HTBOTTOMRIGHT;
1841 return HTRIGHT;
1842 }
1843 }
1844 }
1845 else
1846 {
1848 InflateRect(&WindowRect,
1851 if (!PtInRect(&WindowRect, Point))
1852 return HTBORDER;
1853 }
1854
1855 if ((Style & WS_CAPTION) == WS_CAPTION)
1856 {
1858 WindowRect.top += GetSystemMetrics(SM_CYSMCAPTION);
1859 else
1860 WindowRect.top += GetSystemMetrics(SM_CYCAPTION);
1861 if (!PtInRect(&WindowRect, Point))
1862 {
1863 if (Style & WS_SYSMENU)
1864 {
1866 {
1867 WindowRect.right -= GetSystemMetrics(SM_CXSMSIZE);
1868 }
1869 else
1870 {
1871 // if(!(ExStyle & WS_EX_DLGMODALFRAME))
1872 // FIXME: The real test should check whether there is
1873 // an icon for the system window, and if so, do the
1874 // rect.left increase.
1875 // See dll/win32/uxtheme/nonclient.c!DefWndNCHitTest
1876 // and win32ss/user/ntuser/nonclient.c!GetNCHitEx which does
1877 // the test better.
1878 WindowRect.left += GetSystemMetrics(SM_CXSIZE);
1879 WindowRect.right -= GetSystemMetrics(SM_CXSIZE);
1880 }
1881 }
1882 if (Point.x < WindowRect.left)
1883 return HTSYSMENU;
1884 if (WindowRect.right <= Point.x)
1885 return HTCLOSE;
1887 WindowRect.right -= GetSystemMetrics(SM_CXSIZE);
1888 if (Point.x >= WindowRect.right)
1889 return HTMAXBUTTON;
1890 if (Style & WS_MINIMIZEBOX)
1891 WindowRect.right -= GetSystemMetrics(SM_CXSIZE);
1892 if (Point.x >= WindowRect.right)
1893 return HTMINBUTTON;
1894 return HTCAPTION;
1895 }
1896 }
1897
1898 if(!(Style & WS_MINIMIZE))
1899 {
1900 ClientPoint = Point;
1901 ScreenToClient(hWnd, &ClientPoint);
1902 GetClientRect(hWnd, &ClientRect);
1903
1904 if (PtInRect(&ClientRect, ClientPoint))
1905 {
1906 return HTCLIENT;
1907 }
1908
1909 if (GetMenu(hWnd) && !(Style & WS_CHILD))
1910 {
1911 if (Point.x > 0 && Point.x < WindowRect.right && ClientPoint.y < 0)
1912 return HTMENU;
1913 }
1914
1916 {
1917 InflateRect(&WindowRect, -2 * GetSystemMetrics(SM_CXBORDER),
1919 }
1920
1921 if ((Style & WS_VSCROLL) && (Style & WS_HSCROLL) &&
1922 (WindowRect.bottom - WindowRect.top) > GetSystemMetrics(SM_CYHSCROLL))
1923 {
1924 RECT ParentRect, TempRect = WindowRect, TempRect2 = WindowRect;
1926
1928 if ((ExStyle & WS_EX_LEFTSCROLLBAR) != 0)
1929 TempRect.right = TempRect.left + GetSystemMetrics(SM_CXVSCROLL);
1930 else
1931 TempRect.left = TempRect.right - GetSystemMetrics(SM_CXVSCROLL);
1932 if (PtInRect(&TempRect, Point))
1933 return HTVSCROLL;
1934
1935 TempRect2.top = TempRect2.bottom - GetSystemMetrics(SM_CYHSCROLL);
1936 if ((ExStyle & WS_EX_LEFTSCROLLBAR) != 0)
1937 TempRect2.left += GetSystemMetrics(SM_CXVSCROLL);
1938 else
1939 TempRect2.right -= GetSystemMetrics(SM_CXVSCROLL);
1940 if (PtInRect(&TempRect2, Point))
1941 return HTHSCROLL;
1942
1943 TempRect.top = TempRect2.top;
1944 TempRect.bottom = TempRect2.bottom;
1945 if(Parent)
1946 GetClientRect(Parent, &ParentRect);
1947 if (PtInRect(&TempRect, Point) && HASSIZEGRIP(Style, ExStyle,
1948 GetWindowLongPtrW(Parent, GWL_STYLE), OrigWndRect, ParentRect))
1949 {
1950 if ((ExStyle & WS_EX_LEFTSCROLLBAR) != 0)
1951 return HTBOTTOMLEFT;
1952 else
1953 return HTBOTTOMRIGHT;
1954 }
1955 }
1956 else
1957 {
1958 if (Style & WS_VSCROLL)
1959 {
1960 RECT TempRect = WindowRect;
1961
1962 if ((ExStyle & WS_EX_LEFTSCROLLBAR) != 0)
1963 TempRect.right = TempRect.left + GetSystemMetrics(SM_CXVSCROLL);
1964 else
1965 TempRect.left = TempRect.right - GetSystemMetrics(SM_CXVSCROLL);
1966 if (PtInRect(&TempRect, Point))
1967 return HTVSCROLL;
1968 } else
1969 if (Style & WS_HSCROLL)
1970 {
1971 RECT TempRect = WindowRect;
1972 TempRect.top = TempRect.bottom - GetSystemMetrics(SM_CYHSCROLL);
1973 if (PtInRect(&TempRect, Point))
1974 return HTHSCROLL;
1975 }
1976 }
1977 }
1978
1979 return HTNOWHERE;
1980}
1981#endif
1982
1985{
1986 RECT rcWindow, rcClient;
1988
1989 if (!pWnd) return HTNOWHERE;
1990
1991 if (UserIsDesktopWindow(pWnd))
1992 {
1993 rcClient.left = rcClient.top = rcWindow.left = rcWindow.top = 0;
1998 }
1999 else
2000 {
2001 rcClient = pWnd->rcClient;
2002 rcWindow = pWnd->rcWindow;
2003 }
2004
2005 if (!RECTL_bPointInRect(&rcWindow, pt.x, pt.y)) return HTNOWHERE;
2006
2007 Style = pWnd->style;
2008 ExStyle = pWnd->ExStyle;
2009
2010 if (Style & WS_MINIMIZE) return HTCAPTION;
2011
2012 if (RECTL_bPointInRect( &rcClient, pt.x, pt.y )) return HTCLIENT;
2013
2014 /* Check borders */
2016 {
2018 if (!RECTL_bPointInRect(&rcWindow, pt.x, pt.y ))
2019 {
2020 /* Check top sizing border */
2021 if (pt.y < rcWindow.top)
2022 {
2023 if (pt.x < rcWindow.left+UserGetSystemMetrics(SM_CXSIZE)) return HTTOPLEFT;
2024 if (pt.x >= rcWindow.right-UserGetSystemMetrics(SM_CXSIZE)) return HTTOPRIGHT;
2025 return HTTOP;
2026 }
2027 /* Check bottom sizing border */
2028 if (pt.y >= rcWindow.bottom)
2029 {
2030 if (pt.x < rcWindow.left+UserGetSystemMetrics(SM_CXSIZE)) return HTBOTTOMLEFT;
2031 if (pt.x >= rcWindow.right-UserGetSystemMetrics(SM_CXSIZE)) return HTBOTTOMRIGHT;
2032 return HTBOTTOM;
2033 }
2034 /* Check left sizing border */
2035 if (pt.x < rcWindow.left)
2036 {
2037 if (pt.y < rcWindow.top+UserGetSystemMetrics(SM_CYSIZE)) return HTTOPLEFT;
2038 if (pt.y >= rcWindow.bottom-UserGetSystemMetrics(SM_CYSIZE)) return HTBOTTOMLEFT;
2039 return HTLEFT;
2040 }
2041 /* Check right sizing border */
2042 if (pt.x >= rcWindow.right)
2043 {
2044 if (pt.y < rcWindow.top+UserGetSystemMetrics(SM_CYSIZE)) return HTTOPRIGHT;
2045 if (pt.y >= rcWindow.bottom-UserGetSystemMetrics(SM_CYSIZE)) return HTBOTTOMRIGHT;
2046 return HTRIGHT;
2047 }
2048 }
2049 }
2050 else /* No thick frame */
2051 {
2052 if (HAS_DLGFRAME( Style, ExStyle ))
2054 else if (HAS_THINFRAME( Style, ExStyle ))
2056 else if (HAS_CLIENTFRAME( Style, ExStyle ))
2058 if (!RECTL_bPointInRect( &rcWindow, pt.x, pt.y )) return HTBORDER;
2059 }
2060
2061 /* Check caption */
2062
2063 if ((Style & WS_CAPTION) == WS_CAPTION)
2064 {
2066 rcWindow.top += UserGetSystemMetrics(SM_CYSMCAPTION) - 1;
2067 else
2068 rcWindow.top += UserGetSystemMetrics(SM_CYCAPTION) - 1;
2069 if (!RECTL_bPointInRect( &rcWindow, pt.x, pt.y ))
2070 {
2071 BOOL min_or_max_box = (Style & WS_SYSMENU) && (Style & (WS_MINIMIZEBOX|WS_MAXIMIZEBOX));
2073 {
2074 /* Check system menu */
2075 if ((Style & WS_SYSMENU) && !(ExStyle & WS_EX_TOOLWINDOW) && NC_IconForWindow(pWnd))
2076 {
2077 rcWindow.right -= UserGetSystemMetrics(SM_CYCAPTION) - 1;
2078 if (pt.x > rcWindow.right) return HTSYSMENU;
2079 }
2080
2081 /* Check close button */
2082 if (Style & WS_SYSMENU)
2083 {
2085 if (pt.x < rcWindow.left) return HTCLOSE;
2086 }
2087
2088 /* Check maximize box */
2089 /* In Win95 there is automatically a Maximize button when there is a minimize one */
2090 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2091 {
2092 rcWindow.left += UserGetSystemMetrics(SM_CXSIZE);
2093 if (pt.x < rcWindow.left) return HTMAXBUTTON;
2094 }
2095
2096 /* Check minimize box */
2097 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2098 {
2099 rcWindow.left += UserGetSystemMetrics(SM_CXSIZE);
2100 if (pt.x < rcWindow.left) return HTMINBUTTON;
2101 }
2102 }
2103 else
2104 {
2105 /* Check system menu */
2106 if ((Style & WS_SYSMENU) && !(ExStyle & WS_EX_TOOLWINDOW) && NC_IconForWindow(pWnd))
2107 {
2108 rcWindow.left += UserGetSystemMetrics(SM_CYCAPTION) - 1;
2109 if (pt.x < rcWindow.left) return HTSYSMENU;
2110 }
2111
2112 /* Check close button */
2113 if (Style & WS_SYSMENU)
2114 {
2116 if (pt.x > rcWindow.right) return HTCLOSE;
2117 }
2118
2119 /* Check maximize box */
2120 /* In Win95 there is automatically a Maximize button when there is a minimize one */
2121 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2122 {
2124 if (pt.x > rcWindow.right) return HTMAXBUTTON;
2125 }
2126
2127 /* Check minimize box */
2128 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2129 {
2131 if (pt.x > rcWindow.right) return HTMINBUTTON;
2132 }
2133 }
2134 return HTCAPTION;
2135 }
2136 }
2137
2138 /* Check menu bar */
2139
2140 if (HAS_MENU( pWnd, Style ) && (pt.y < rcClient.top) &&
2141 (pt.x >= rcClient.left) && (pt.x < rcClient.right))
2142 return HTMENU;
2143
2144 /* Check vertical scroll bar */
2145
2147 if (Style & WS_VSCROLL)
2148 {
2149 if((ExStyle & WS_EX_LEFTSCROLLBAR) != 0)
2151 else
2153 if (RECTL_bPointInRect( &rcClient, pt.x, pt.y )) return HTVSCROLL;
2154 }
2155
2156 /* Check horizontal scroll bar */
2157
2158 if (Style & WS_HSCROLL)
2159 {
2161 if (RECTL_bPointInRect( &rcClient, pt.x, pt.y ))
2162 {
2163 /* Check size box */
2164 if ((Style & WS_VSCROLL) &&
2165 ((((ExStyle & WS_EX_LEFTSCROLLBAR) != 0) && (pt.x <= rcClient.left + UserGetSystemMetrics(SM_CXVSCROLL))) ||
2166 (((ExStyle & WS_EX_LEFTSCROLLBAR) == 0) && (pt.x >= rcClient.right - UserGetSystemMetrics(SM_CXVSCROLL)))))
2167 return HTSIZE;
2168 return HTHSCROLL;
2169 }
2170 }
2171
2172 /* Has to return HTNOWHERE if nothing was found
2173 Could happen when a window has a customized non client area */
2174 return HTNOWHERE;
2175}
2176
2177/* EOF */
static HDC hDC
Definition: 3dtext.c:33
#define DCX_USESTYLE
Definition: GetDCEx.c:10
static HBRUSH hbrush
@ wparam
Definition: SystemMenu.c:30
Type
Definition: Type.h:7
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE Parent
Definition: acpixf.h:732
unsigned char BOOLEAN
Definition: actypes.h:127
Arabic default style
Definition: afstyles.h:94
static int state
Definition: maze.c:121
const DWORD Style
Definition: appswitch.c:72
const DWORD ExStyle
Definition: appswitch.c:73
#define msg(x)
Definition: auth_time.c:54
HWND hWnd
Definition: settings.c:17
#define ERR(fmt,...)
Definition: precomp.h:57
#define UlongToHandle(ul)
Definition: basetsd.h:91
#define DBG_DEFAULT_CHANNEL(ch)
Definition: debug.h:106
RECT rect
Definition: combotst.c:67
struct @1767 Msg[]
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
struct _CURICON_OBJECT * PCURICON_OBJECT
#define DC_ACTIVE
Definition: dc21x4.h:120
COLORREF FASTCALL IntSetDCPenColor(HDC, COLORREF)
Definition: dcutil.c:259
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:194
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HANDLE HWND
Definition: compat.h:19
static BOOL UserHasWindowEdge(DWORD Style, DWORD ExStyle)
Definition: nonclient.c:46
static LRESULT DefWndNCHitTest(HWND hWnd, POINT Point)
Definition: nonclient.c:800
#define pt(x, y)
Definition: drawing.c:79
#define L(x)
Definition: resources.c:13
r parent
Definition: btrfs.c:3010
#define ERROR(name)
Definition: error_private.h:53
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
PUSER_MESSAGE_QUEUE gpqForeground
Definition: focus.c:13
HWND FASTCALL co_UserSetCapture(HWND hWnd)
Definition: focus.c:1453
HWND APIENTRY IntGetCapture(VOID)
Definition: focus.c:1436
BOOL FASTCALL IntReleaseCapture(VOID)
Definition: focus.c:1525
BOOL FASTCALL co_IntSetForegroundWindowMouse(PWND Window)
Definition: focus.c:1556
HWND FASTCALL UserGetActiveWindow(VOID)
Definition: focus.c:1426
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
PSERVERINFO gpsi
Definition: imm.c:18
#define WNDS_HASHORIZONTALSCROLLBAR
Definition: ntuser.h:607
#define WNDS_ACTIVEFRAME
Definition: ntuser.h:611
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
#define MSQ_STATE_MOVESIZE
Definition: ntuser.h:3613
#define WNDS_NONCPAINT
Definition: ntuser.h:613
#define WNDS_HASMENU
Definition: ntuser.h:605
#define WNDS_FORCEMENUDRAW
Definition: ntuser.h:620
#define WNDS_HASVERTICALSCROOLLBAR
Definition: ntuser.h:606
#define TIF_MOVESIZETRACKING
Definition: ntuser.h:278
@ TYPE_CURSOR
Definition: ntuser.h:43
#define WNDS_HASCAPTION
Definition: ntuser.h:608
HGDIOBJ FASTCALL IntGetSysColorBrush(INT Object)
Definition: stockobj.c:317
BOOL FASTCALL GreMoveTo(HDC hdc, INT x, INT y, LPPOINT pptOut)
Definition: line.c:110
DWORD FASTCALL IntGetSysColor(INT nIndex)
Definition: stockobj.c:323
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97
LONG_PTR LPARAM
Definition: minwindef.h:175
LONG_PTR LRESULT
Definition: minwindef.h:176
UINT_PTR WPARAM
Definition: minwindef.h:174
#define ASSERT(a)
Definition: mode.c:44
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
static HICON
Definition: imagelist.c:80
static HRGN hRgn
Definition: mapping.c:32
static SYSTEM_BASIC_INFORMATION sbi
Definition: virtual.c:53
#define menu
Definition: input.c:3282
#define min(a, b)
Definition: monoChain.cc:55
HICON hIcon
Definition: msconfig.c:44
HWND FASTCALL MsqSetStateWindow(PTHREADINFO pti, ULONG Type, HWND hWnd)
Definition: msgqueue.c:2507
int UserShowCursor(BOOL bShow)
Definition: msgqueue.c:168
PCURICON_OBJECT FASTCALL UserSetCursor(PCURICON_OBJECT NewCursor, BOOL ForceChange)
Definition: msgqueue.c:93
unsigned int UINT
Definition: ndis.h:50
#define FASTCALL
Definition: nt_native.h:50
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
LRESULT APIENTRY co_HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam, LPARAM lParam)
Definition: hook.c:1102
BOOL FASTCALL IntClientToScreen(PWND Wnd, LPPOINT lpPoint)
Definition: winpos.c:199
VOID FASTCALL IntSetSnapInfo(PWND Wnd, UINT Edge, IN const RECT *Pos OPTIONAL)
Definition: winpos.c:4041
BOOLEAN FASTCALL co_WinPosSetWindowPos(PWND Window, HWND WndInsertAfter, INT x, INT y, INT cx, INT cy, UINT flags)
Definition: winpos.c:1792
VOID FASTCALL co_IntSnapWindow(PWND Wnd, UINT Edge)
Definition: winpos.c:3969
VOID FASTCALL co_IntCalculateSnapPosition(PWND Wnd, UINT Edge, OUT RECT *Pos)
Definition: winpos.c:3939
BOOL FASTCALL IntGetWindowRect(PWND Wnd, RECTL *Rect)
Definition: winpos.c:121
UINT FASTCALL co_WinPosGetMinMaxInfo(PWND Window, POINT *MaxSize, POINT *MaxPos, POINT *MinTrack, POINT *MaxTrack)
Definition: winpos.c:940
VOID UserGetWindowBorders(DWORD Style, DWORD ExStyle, SIZE *Size, BOOL WithClient)
Definition: winpos.c:894
UINT FASTCALL IntGetWindowSnapEdge(PWND Wnd)
Definition: winpos.c:3931
VOID FASTCALL IntSetSnapEdge(PWND Wnd, UINT Edge)
Definition: winpos.c:4016
#define WS_CHILD
Definition: pedump.c:617
#define WS_CAPTION
Definition: pedump.c:624
#define WS_ICONIC
Definition: pedump.c:641
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
#define WS_EX_DLGMODALFRAME
Definition: pedump.c:645
#define WS_MAXIMIZE
Definition: pedump.c:623
#define WS_SYSMENU
Definition: pedump.c:629
#define WS_BORDER
Definition: pedump.c:625
#define WS_POPUP
Definition: pedump.c:616
#define WS_VSCROLL
Definition: pedump.c:627
#define WS_MINIMIZE
Definition: pedump.c:622
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_EX_TOPMOST
Definition: pedump.c:647
long LONG
Definition: pedump.c:60
#define WS_DLGFRAME
Definition: pedump.c:626
#define WS_HSCROLL
Definition: pedump.c:628
#define WS_MINIMIZEBOX
Definition: pedump.c:631
#define WS_THICKFRAME
Definition: pedump.c:630
__kernel_entry W32KAPI INT APIENTRY NtGdiCombineRgn(_In_ HRGN hrgnDst, _In_ HRGN hrgnSrc1, _In_opt_ HRGN hrgnSrc2, _In_ INT iMode)
__kernel_entry W32KAPI HBRUSH APIENTRY NtGdiSelectBrush(_In_ HDC hdc, _In_ HBRUSH hbrush)
__kernel_entry W32KAPI HRGN APIENTRY NtGdiCreateRectRgn(_In_ INT xLeft, _In_ INT yTop, _In_ INT xRight, _In_ INT yBottom)
__kernel_entry W32KAPI HANDLE APIENTRY NtGdiGetStockObject(_In_ INT iObject)
__kernel_entry W32KAPI BOOL APIENTRY NtGdiPatBlt(_In_ HDC hdcDest, _In_ INT x, _In_ INT y, _In_ INT cx, _In_ INT cy, _In_ DWORD dwRop)
Definition: bitblt.c:988
__kernel_entry W32KAPI HPEN APIENTRY NtGdiSelectPen(_In_ HDC hdc, _In_ HPEN hpen)
__kernel_entry W32KAPI BOOL APIENTRY NtGdiLineTo(_In_ HDC hdc, _In_ INT x, _In_ INT y)
#define GreCreateRectRgnIndirect(prc)
Definition: region.h:96
#define WM_CONTEXTMENU
Definition: richedit.h:64
BOOL FASTCALL co_IntGetScrollBarInfo(PWND, LONG, PSCROLLBARINFO)
Definition: scrollbar.c:671
void IntDrawScrollBar(PWND, HDC, INT)
Definition: scrollbar.c:1083
#define TRACE(s)
Definition: solgame.cpp:4
struct _CURICON_OBJECT * spicn
Definition: ntuser.h:585
struct _CURICON_OBJECT * spicnSm
Definition: ntuser.h:590
UINT style
Definition: ntuser.h:580
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
POINT ptLast
Definition: win32.h:129
FLONG TIF_flags
Definition: win32.h:95
Definition: ntuser.h:694
DWORD ExStyle
Definition: ntuser.h:704
HRGN hrgnClip
Definition: ntuser.h:733
PCLS pcls
Definition: ntuser.h:720
THRDESKHEAD head
Definition: ntuser.h:695
DWORD style
Definition: ntuser.h:706
RECT rcClient
Definition: ntuser.h:717
DWORD state
Definition: ntuser.h:701
UINT_PTR IDMenu
Definition: ntuser.h:731
struct _WND::@5611 InternalPos
RECT rcWindow
Definition: ntuser.h:716
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
LONG right
Definition: windef.h:108
LONG bottom
Definition: windef.h:109
LONG top
Definition: windef.h:107
LONG left
Definition: windef.h:106
ATOM atomIconProp
Definition: ntuser.h:1066
ATOM atomIconSmProp
Definition: ntuser.h:1065
#define max(a, b)
Definition: svc.c:63
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
int32_t INT
Definition: typedefs.h:58
#define MAKELONG(a, b)
Definition: typedefs.h:249
uint32_t ULONG
Definition: typedefs.h:59
#define DC_NOSENDMSG
Definition: undocuser.h:149
#define WM_SETVISIBLE
Definition: undocuser.h:33
#define DC_REDRAWHUNGWND
Definition: undocuser.h:153
#define DC_NOVISIBLE
Definition: undocuser.h:148
#define DC_FRAME
Definition: undocuser.h:150
#define WS_MINIMIZED
Definition: undocuser.h:20
BOOL UserDrawCaption(PWND pWnd, HDC hDc, RECTL *lpRc, HFONT hFont, HICON hIcon, const PUNICODE_STRING Str, UINT uFlags)
Definition: painting.c:2189
BOOL FASTCALL co_UserRedrawWindow(PWND Window, const RECTL *UpdateRect, PREGION UpdateRgn, ULONG Flags)
Definition: painting.c:895
VOID FASTCALL UpdateThreadWindows(PWND pWnd, PTHREADINFO pti, HRGN hRgn)
Definition: painting.c:1100
VOID FASTCALL co_IntUpdateWindows(PWND Wnd, ULONG Flags, BOOL Recurse)
Definition: painting.c:519
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:89
_In_ HFONT _Out_ PUINT Height
Definition: font.h:88
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:3
HDC FASTCALL UserGetWindowDC(PWND Wnd)
Definition: windc.c:947
PWND FASTCALL UserGetAncestor(PWND Wnd, UINT Type)
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:918
HDC FASTCALL UserGetDCEx(PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
#define HAS_MENU(hwnd, style)
Definition: uxthemep.h:248
#define HASSIZEGRIP(Style, ExStyle, ParentStyle, WindowRect, ParentClientRect)
Definition: uxthemep.h:242
BOOL NTAPI GreDeleteObject(HGDIOBJ hobj)
Definition: gdiobj.c:1165
BOOL NTAPI GreIsHandleValid(HGDIOBJ hobj)
Definition: gdiobj.c:1153
VOID FASTCALL RECTL_vInflateRect(_Inout_ RECTL *rect, _In_ INT dx, _In_ INT dy)
Definition: rect.c:101
FORCEINLINE VOID RECTL_vSetRect(_Out_ RECTL *prcl, _In_ LONG left, _In_ LONG top, _In_ LONG right, _In_ LONG bottom)
Definition: rect.h:5
FORCEINLINE BOOL RECTL_bPointInRect(_In_ const RECTL *prcl, _In_ INT x, _In_ INT y)
Definition: rect.h:52
FORCEINLINE BOOL RECTL_bIsEmptyRect(_In_ const RECTL *prcl)
Definition: rect.h:44
FORCEINLINE VOID RECTL_vOffsetRect(_Inout_ RECTL *prcl, _In_ INT cx, _In_ INT cy)
Definition: rect.h:31
BOOL UserSetCursorPos(INT x, INT y, DWORD flags, ULONG_PTR dwExtraInfo, BOOL Hook)
Definition: cursoricon.c:238
PCURICON_OBJECT FASTCALL UserGetCurIconObject(HCURSOR hCurIcon)
Definition: cursoricon.c:200
BOOL APIENTRY UserClipCursor(RECTL *prcl)
Definition: cursoricon.c:702
BOOL UserDrawIconEx(HDC hDc, INT xLeft, INT yTop, PCURICON_OBJECT pIcon, INT cxWidth, INT cyHeight, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags)
Definition: cursoricon.c:1691
PWND FASTCALL UserGetDesktopWindow(VOID)
Definition: desktop.c:1402
VOID FASTCALL IntNotifyWinEvent(DWORD Event, PWND pWnd, LONG idObject, LONG idChild, DWORD flags)
Definition: event.c:178
BOOL FASTCALL IntTranslateKbdMessage(LPMSG lpMsg, UINT flags)
Definition: keyboard.c:1499
PMENU FASTCALL IntGetSystemMenu(PWND Window, BOOL bRevert)
Definition: menu.c:5409
UINT MENU_DrawMenuBar(HDC hDC, LPRECT lprect, PWND pWnd, BOOL suppress_draw)
Definition: menu.c:2742
UINT FASTCALL IntGetMenuState(HMENU hMenu, UINT uId, UINT uFlags)
Definition: menu.c:5001
BOOL FASTCALL IntCallMsgFilter(LPMSG lpmsg, INT code)
Definition: message.c:2190
LRESULT FASTCALL IntDispatchMessage(PMSG pMsg)
Definition: message.c:890
BOOL APIENTRY co_IntGetPeekMessage(PMSG pMsg, HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax, UINT RemoveMsg, BOOL bGMSG)
Definition: message.c:1226
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1495
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:209
BOOL IntIsScrollBarVisible(PWND pWnd, INT hBar)
Definition: nonclient.c:790
PCURICON_OBJECT FASTCALL NC_IconForWindow(PWND pWnd)
Definition: nonclient.c:736
LRESULT NC_HandleNCLButtonDown(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1574
VOID UserDrawCaptionBar(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:955
DWORD FASTCALL GetNCHitEx(PWND pWnd, POINT pt)
Definition: nonclient.c:1984
VOID FASTCALL UserDrawWindowFrame(HDC hdc, RECTL *rect, ULONG width, ULONG height)
Definition: nonclient.c:42
static UINT GetSnapActivationPoint(PWND Wnd, POINT pt)
Definition: nonclient.c:140
#define ON_BOTTOM_BORDER(hit)
Definition: nonclient.c:31
#define UserHasDlgFrameStyle(Style, ExStyle)
Definition: nonclient.c:14
BOOL UserDrawSysMenuButton(PWND pWnd, HDC hDC, LPRECT Rect, BOOL Down)
Definition: nonclient.c:767
VOID FASTCALL DefWndDoSizeMove(PWND pwnd, WORD wParam)
Definition: nonclient.c:254
void FASTCALL NC_GetSysPopupPos(PWND Wnd, RECT *Rect)
Definition: nonclient.c:117
#define UserHasThickFrameStyle(Style, ExStyle)
Definition: nonclient.c:18
LRESULT NC_HandleNCActivate(PWND Wnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1437
VOID NC_DoButton(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1494
VOID UserDrawCaptionButton(PWND pWnd, LPRECT Rect, DWORD Style, DWORD ExStyle, HDC hDC, BOOL bDown, ULONG Type)
Definition: nonclient.c:808
LRESULT NC_DoNCPaint(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:1097
#define UserHasThinFrameStyle(Style, ExStyle)
Definition: nonclient.c:22
#define ON_TOP_BORDER(hit)
Definition: nonclient.c:29
LONG FASTCALL DefWndStartSizeMove(PWND Wnd, WPARAM wParam, POINT *capturePoint)
Definition: nonclient.c:155
LRESULT NC_HandleNCCalcSize(PWND Wnd, WPARAM wparam, RECTL *Rect, BOOL Suspended)
Definition: nonclient.c:1303
LRESULT NC_HandleNCRButtonDown(PWND pwnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1724
static INT NC_DoNCActive(PWND Wnd)
Definition: nonclient.c:1419
void FASTCALL NC_GetInsideRect(PWND Wnd, RECT *rect)
Definition: nonclient.c:71
#define ON_RIGHT_BORDER(hit)
Definition: nonclient.c:27
#define ON_LEFT_BORDER(hit)
Definition: nonclient.c:25
LRESULT NC_HandleNCLButtonDblClk(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1666
VOID UserDrawCaptionButtonWnd(PWND pWnd, HDC hDC, BOOL bDown, ULONG Type)
Definition: nonclient.c:890
VOID NC_DrawFrame(HDC hDC, RECT *CurrentRect, BOOL Active, DWORD Style, DWORD ExStyle)
Definition: nonclient.c:909
VOID FASTCALL UserDrawMovingFrame(HDC hdc, RECTL *rect, BOOL thickframe)
Definition: nonclient.c:56
BOOL FASTCALL UserDereferenceObject(PVOID Object)
Definition: object.c:643
PUSER_HANDLE_TABLE gHandleTable
Definition: object.c:13
PVOID UserGetObjectNoErr(PUSER_HANDLE_TABLE ht, HANDLE handle, HANDLE_TYPE type)
Definition: object.c:481
VOID FASTCALL UserReferenceObject(PVOID obj)
Definition: object.c:730
HANDLE FASTCALL UserGetProp(_In_ PWND Window, _In_ ATOM Atom, _In_ BOOLEAN SystemProp)
Definition: prop.c:46
BOOL g_bWindowSnapEnabled
Definition: sysparams.c:20
BOOL FASTCALL UserSystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
Definition: sysparams.c:2123
ULONG FASTCALL IntSetStyle(PWND pwnd, ULONG set_bits, ULONG clear_bits)
Definition: window.c:144
PWND FASTCALL IntGetParent(PWND Wnd)
Definition: window.c:205
BOOL FASTCALL IntIsWindow(HWND hWnd)
Definition: window.c:177
BOOL FASTCALL IntIsChildWindow(PWND Parent, PWND BaseWindow)
Definition: window.c:929
BOOL FASTCALL IntIsWindowVisible(PWND Wnd)
Definition: window.c:190
#define OBJID_VSCROLL
Definition: winable.h:20
#define OBJID_HSCROLL
Definition: winable.h:21
#define OBJID_WINDOW
Definition: winable.h:15
#define CHILDID_SELF
Definition: winable.h:14
HICON HCURSOR
Definition: windef.h:99
#define HAS_DLGFRAME(Style, ExStyle)
Definition: window.h:9
INT FASTCALL IntMapWindowPoints(PWND FromWnd, PWND ToWnd, LPPOINT lpPoints, UINT cPoints)
Definition: winpos.c:144
#define HAS_CLIENTFRAME(Style, ExStyle)
Definition: window.h:20
#define HAS_THINFRAME(Style, ExStyle)
Definition: window.h:17
#define HAS_THICKFRAME(Style, ExStyle)
Definition: window.h:13
VOID FASTCALL IntGetClientRect(PWND WindowObject, RECTL *Rect)
Definition: winpos.c:92
#define PATINVERT
Definition: wingdi.h:328
#define RGN_DIFF
Definition: wingdi.h:358
#define DI_NORMAL
Definition: wingdi.h:72
#define RGN_COPY
Definition: wingdi.h:357
#define RGN_AND
Definition: wingdi.h:356
#define PATCOPY
Definition: wingdi.h:335
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
FORCEINLINE BOOLEAN IntIsWindowSnapped(PWND Wnd)
Definition: winpos.h:95
#define GetSnapSetting(gspvmember)
Definition: winpos.h:80
FORCEINLINE BOOL IntEqualRect(RECTL *lprc1, RECTL *lprc2)
Definition: winpos.h:48
FORCEINLINE BOOLEAN IntIsSnapAllowedForWindow(PWND Wnd)
Definition: winpos.h:101
#define WS_EX_LAYOUTRTL
Definition: winuser.h:390
#define BDR_SUNKENINNER
Definition: winuser.h:445
#define SC_HSCROLL
Definition: winuser.h:2630
#define HTTOPRIGHT
Definition: winuser.h:2528
#define HTCLOSE
Definition: winuser.h:2535
#define CS_VREDRAW
Definition: winuser.h:666
#define SC_MOUSEMENU
Definition: winuser.h:2631
#define WS_EX_STATICEDGE
Definition: winuser.h:403
#define SWP_NOACTIVATE
Definition: winuser.h:1253
#define DFC_SCROLL
Definition: winuser.h:475
#define MF_BYCOMMAND
Definition: winuser.h:202
#define WM_SYSCOMMAND
Definition: winuser.h:1769
#define COLOR_INACTIVECAPTIONTEXT
Definition: winuser.h:945
#define GetWindowLongPtrW
Definition: winuser.h:4983
#define SM_CYEDGE
Definition: winuser.h:1020
#define WM_MOUSEFIRST
Definition: winuser.h:1802
#define EDGE_SUNKEN
Definition: winuser.h:451
#define WM_MOUSELAST
Definition: winuser.h:1829
#define DCX_CACHE
Definition: winuser.h:2150
#define COLOR_WINDOWFRAME
Definition: winuser.h:930
#define SM_CYSCREEN
Definition: winuser.h:971
#define HTCAPTION
Definition: winuser.h:2512
#define DCX_WINDOW
Definition: winuser.h:2149
#define SM_CXEDGE
Definition: winuser.h:1019
#define HTTOPLEFT
Definition: winuser.h:2527
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define SM_CYSIZE
Definition: winuser.h:1003
BOOL WINAPI DrawFrameControl(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define DFCS_CAPTIONMIN
Definition: winuser.h:481
#define DFCS_CAPTIONCLOSE
Definition: winuser.h:480
#define SM_CXVSCROLL
Definition: winuser.h:972
#define HTBOTTOM
Definition: winuser.h:2529
#define WVR_VALIDRECTS
Definition: winuser.h:2558
#define HTBORDER
Definition: winuser.h:2533
#define SB_VERT
Definition: winuser.h:553
#define SC_VSCROLL
Definition: winuser.h:2629
#define SM_CXFRAME
Definition: winuser.h:1005
#define CS_HREDRAW
Definition: winuser.h:661
#define DFCS_INACTIVE
Definition: winuser.h:502
#define WS_EX_NOACTIVATE
Definition: winuser.h:395
#define HTVSCROLL
Definition: winuser.h:2518
#define COLOR_ACTIVECAPTION
Definition: winuser.h:926
#define HTHSCROLL
Definition: winuser.h:2517
#define DC_CAPTION
Definition: winuser.h:439
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define WM_RBUTTONUP
Definition: winuser.h:1808
#define DFCS_SCROLLSIZEGRIP
Definition: winuser.h:494
#define SM_CYSMICON
Definition: winuser.h:1024
#define VK_UP
Definition: winuser.h:2261
#define COLOR_INACTIVECAPTION
Definition: winuser.h:927
#define BF_ADJUST
Definition: winuser.h:470
#define GA_PARENT
Definition: winuser.h:2892
#define SWP_NOSIZE
Definition: winuser.h:1256
#define WM_MOUSEMOVE
Definition: winuser.h:1803
#define RDW_UPDATENOW
Definition: winuser.h:1231
#define WH_CBT
Definition: winuser.h:35
#define HTMAXBUTTON
Definition: winuser.h:2520
#define BF_FLAT
Definition: winuser.h:471
#define SM_CXSIZE
Definition: winuser.h:1002
#define WM_QUERYDRAGICON
Definition: winuser.h:1682
#define SM_CYFRAME
Definition: winuser.h:1007
#define WMSZ_LEFT
Definition: winuser.h:2500
#define SM_CYHSCROLL
Definition: winuser.h:973
#define DFC_CAPTION
Definition: winuser.h:473
#define HTMENU
Definition: winuser.h:2516
#define SC_SIZE
Definition: winuser.h:2620
#define SC_MINIMIZE
Definition: winuser.h:2622
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)
#define SM_CYBORDER
Definition: winuser.h:976
#define DC_NC
Definition: winuser.h:440
#define SM_CXSMICON
Definition: winuser.h:1023
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define VK_RETURN
Definition: winuser.h:2237
#define HWND_TOP
Definition: winuser.h:1218
#define WS_EX_MDICHILD
Definition: winuser.h:394
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define WM_EXITSIZEMOVE
Definition: winuser.h:1852
#define WVR_VREDRAW
Definition: winuser.h:2556
#define SM_CXSMSIZE
Definition: winuser.h:1026
#define RDW_ALLCHILDREN
Definition: winuser.h:1232
#define SM_CXBORDER
Definition: winuser.h:975
#define DFCS_CAPTIONRESTORE
Definition: winuser.h:483
#define PM_REMOVE
Definition: winuser.h:1207
#define HTRIGHT
Definition: winuser.h:2525
#define HTCLIENT
Definition: winuser.h:2511
#define COLOR_ACTIVEBORDER
Definition: winuser.h:934
#define HCBT_MOVESIZE
Definition: winuser.h:55
#define HTBOTTOMRIGHT
Definition: winuser.h:2531
#define HTNOWHERE
Definition: winuser.h:2510
#define SC_CLOSE
Definition: winuser.h:2628
#define DC_TEXT
Definition: winuser.h:430
#define SC_MOVE
Definition: winuser.h:2621
#define STATE_SYSTEM_OFFSCREEN
Definition: winuser.h:2985
#define COLOR_BTNSHADOW
Definition: winuser.h:941
#define SM_CXDLGFRAME
Definition: winuser.h:977
#define WVR_HREDRAW
Definition: winuser.h:2555
#define WM_LBUTTONUP
Definition: winuser.h:1805
#define HTSIZE
Definition: winuser.h:2515
#define MSGF_SIZE
Definition: winuser.h:1188
HWND WINAPI GetParent(_In_ HWND)
#define VK_LEFT
Definition: winuser.h:2260
#define WM_SIZING
Definition: winuser.h:1835
#define VK_RIGHT
Definition: winuser.h:2262
struct tagSCROLLBARINFO SCROLLBARINFO
#define HTBOTTOMLEFT
Definition: winuser.h:2530
#define HTTOP
Definition: winuser.h:2526
#define VK_DOWN
Definition: winuser.h:2263
#define WM_SETCURSOR
Definition: winuser.h:1664
#define MSGF_MAX
Definition: winuser.h:1193
#define MK_LBUTTON
Definition: winuser.h:2403
#define SM_CYSMCAPTION
Definition: winuser.h:1025
#define SM_CYSMSIZE
Definition: winuser.h:1027
#define SM_CYDLGFRAME
Definition: winuser.h:979
#define DC_ICON
Definition: winuser.h:429
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define WS_EX_LEFTSCROLLBAR
Definition: winuser.h:392
#define SM_CXSCREEN
Definition: winuser.h:970
#define WM_KEYDOWN
Definition: winuser.h:1743
#define WM_MOVING
Definition: winuser.h:1837
#define WM_MDIGETACTIVE
Definition: winuser.h:1849
#define DC_SMALLCAP
Definition: winuser.h:428
#define HTMINBUTTON
Definition: winuser.h:2519
#define DFCS_CAPTIONMAX
Definition: winuser.h:482
#define HTSYSMENU
Definition: winuser.h:2513
#define HTLEFT
Definition: winuser.h:2523
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define COLOR_BTNHIGHLIGHT
Definition: winuser.h:946
#define COLOR_INACTIVEBORDER
Definition: winuser.h:935
#define BF_RECT
Definition: winuser.h:462
#define GWL_STYLE
Definition: winuser.h:863
#define COLOR_CAPTIONTEXT
Definition: winuser.h:933
#define VK_ESCAPE
Definition: winuser.h:2250
#define SC_RESTORE
Definition: winuser.h:2634
#define EDGE_RAISED
Definition: winuser.h:450
#define DFCS_PUSHED
Definition: winuser.h:503
#define SM_CYCAPTION
Definition: winuser.h:974
int WINAPI GetSystemMetrics(_In_ int)
#define CS_NOCLOSE
Definition: winuser.h:662
HMENU WINAPI GetMenu(_In_ HWND)
#define SC_MAXIMIZE
Definition: winuser.h:2624
#define SB_HORZ
Definition: winuser.h:552
#define COLOR_BTNFACE
Definition: winuser.h:939
#define GWL_EXSTYLE
Definition: winuser.h:862
#define MF_GRAYED
Definition: winuser.h:129
#define COLOR_3DFACE
Definition: winuser.h:940
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
#define MF_DISABLED
Definition: winuser.h:130
#define WM_ENTERSIZEMOVE
Definition: winuser.h:1851
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
@ Suspended
Definition: ketypes.h:472
_In_ ULONG _In_ BOOLEAN Active
Definition: potypes.h:564