ReactOS 0.4.16-dev-1338-g8aab5a9
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 );
48 NtGdiPatBlt( hdc, rect->left, rect->top, rect->right - rect->left - width, height, PATINVERT );
49 NtGdiPatBlt( hdc, rect->left, rect->top + height, width, rect->bottom - rect->top - height, PATINVERT );
50 NtGdiPatBlt( hdc, rect->left + width, rect->bottom, rect->right - rect->left - width, -(LONG)height, PATINVERT );
51 NtGdiPatBlt( hdc, rect->right, rect->top, -(LONG)width, rect->bottom - rect->top - height, PATINVERT );
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)
176 rect.right -= UserGetSystemMetrics(SM_CXSIZE) + 1;
177 if (Style & WS_MAXIMIZEBOX)
178 rect.right -= UserGetSystemMetrics(SM_CXSIZE) + 1;
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{
792 SCROLLBARINFO sbi;
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
1303/* Win: xxxCalcClientRect */
1305{
1306 LRESULT Result = 0;
1307 SIZE WindowBorders;
1308 RECT OrigRect;
1309 LONG Style = Wnd->style;
1310 LONG exStyle = Wnd->ExStyle;
1311
1312 if (Rect == NULL)
1313 {
1314 return Result;
1315 }
1316 OrigRect = *Rect;
1317
1318 Wnd->state &= ~WNDS_HASCAPTION;
1319
1320 if (wparam)
1321 {
1322 if (Wnd->pcls->style & CS_VREDRAW)
1323 {
1325 }
1326 if (Wnd->pcls->style & CS_HREDRAW)
1327 {
1329 }
1331 }
1332
1333 if (!(Wnd->style & WS_MINIMIZE))
1334 {
1335 if (UserHasWindowEdge(Wnd->style, Wnd->ExStyle))
1336 {
1337 UserGetWindowBorders(Wnd->style, Wnd->ExStyle, &WindowBorders, FALSE);
1338 RECTL_vInflateRect(Rect, -WindowBorders.cx, -WindowBorders.cy);
1339 }
1340 else if ((Wnd->ExStyle & WS_EX_STATICEDGE) || (Wnd->style & WS_BORDER))
1341 {
1342 RECTL_vInflateRect(Rect, -1, -1);
1343 }
1344
1345 if ((Wnd->style & WS_CAPTION) == WS_CAPTION)
1346 {
1347 Wnd->state |= WNDS_HASCAPTION;
1348
1349 if (Wnd->ExStyle & WS_EX_TOOLWINDOW)
1351 else
1353 }
1354
1355 if (HAS_MENU(Wnd, Style))
1356 {
1358
1359 Wnd->state |= WNDS_HASMENU;
1360
1361 if (hDC)
1362 {
1363 RECT CliRect = *Rect;
1364 CliRect.bottom -= OrigRect.top;
1365 CliRect.right -= OrigRect.left;
1366 CliRect.left -= OrigRect.left;
1367 CliRect.top -= OrigRect.top;
1368 if (!Suspended) Rect->top += MENU_DrawMenuBar(hDC, &CliRect, Wnd, TRUE);
1369 UserReleaseDC(Wnd, hDC, FALSE);
1370 }
1371 }
1372
1373 if (Wnd->ExStyle & WS_EX_CLIENTEDGE)
1374 {
1376 }
1377
1378 if (Style & WS_VSCROLL)
1379 {
1380 if (Rect->right - Rect->left >= UserGetSystemMetrics(SM_CXVSCROLL))
1381 {
1383
1384 /* rectangle is in screen coords when wparam is false */
1385 if (!wparam && (exStyle & WS_EX_LAYOUTRTL)) exStyle ^= WS_EX_LEFTSCROLLBAR;
1386
1387 if((exStyle & WS_EX_LEFTSCROLLBAR) != 0)
1389 else
1391 }
1392 }
1393
1394 if (Style & WS_HSCROLL)
1395 {
1396 if( Rect->bottom - Rect->top > UserGetSystemMetrics(SM_CYHSCROLL))
1397 {
1399
1401 }
1402 }
1403
1404 if (Rect->top > Rect->bottom)
1405 Rect->bottom = Rect->top;
1406
1407 if (Rect->left > Rect->right)
1408 Rect->right = Rect->left;
1409 }
1410 else
1411 {
1412 Rect->right = Rect->left;
1413 Rect->bottom = Rect->top;
1414 }
1415
1416 return Result;
1417}
1418
1419static
1421{
1422 INT Ret = 0;
1423
1426 Ret = DC_CAPTION;
1427
1428 if (!(Wnd->style & WS_MINIMIZED) && UserHasThickFrameStyle(Wnd->style, Wnd->ExStyle))
1429 {
1430 //if (IntGetSysColor(COLOR_ACTIVEBORDER) != IntGetSysColor(COLOR_INACTIVEBORDER)) // Why are these the same?
1431 {
1432 Ret = DC_FRAME;
1433 }
1434 }
1435 return Ret;
1436}
1437
1439{
1440 INT Flags;
1441 /* Lotus Notes draws menu descriptions in the caption of its main
1442 * window. When it wants to restore original "system" view, it just
1443 * sends WM_NCACTIVATE message to itself. Any optimizations here in
1444 * attempt to minimize redrawings lead to a not restored caption.
1445 */
1446 if (wParam & DC_ACTIVE)
1447 {
1450 }
1451 else
1452 {
1453 Wnd->state &= ~WNDS_ACTIVEFRAME;
1455 }
1456
1457 if ((Wnd->state & WNDS_NONCPAINT) || !(Wnd->style & WS_VISIBLE))
1458 return TRUE;
1459
1460 /* This isn't documented but is reproducible in at least XP SP2 and
1461 * Outlook 2007 depends on it
1462 */
1463 // MSDN:
1464 // If this parameter is set to -1, DefWindowProc does not repaint the
1465 // nonclient area to reflect the state change.
1466 if ( lParam != -1 &&
1467 ( Flags = NC_DoNCActive(Wnd)) != 0 )
1468 {
1469 HDC hDC;
1470 HRGN hRgnTemp = NULL, hRgn = (HRGN)lParam;
1471
1473 {
1474 hRgnTemp = NtGdiCreateRectRgn(0, 0, 0, 0);
1475 if (NtGdiCombineRgn(hRgnTemp, hRgn, 0, RGN_COPY) == ERROR)
1476 {
1477 GreDeleteObject(hRgnTemp);
1478 hRgnTemp = NULL;
1479 }
1480 }
1481
1482 if ((hDC = UserGetDCEx(Wnd, hRgnTemp, DCX_WINDOW|DCX_USESTYLE)))
1483 {
1484 NC_DoNCPaint(Wnd, hDC, wParam | Flags); // Redraw MENUs.
1485 UserReleaseDC(Wnd, hDC, FALSE);
1486 }
1487 else
1488 GreDeleteObject(hRgnTemp);
1489 }
1490
1491 return TRUE;
1492}
1493
1494VOID
1496{
1497 MSG Msg;
1498 HDC WindowDC;
1499 BOOL Pressed = TRUE, OldState;
1500 WPARAM SCMsg;
1501 PMENU SysMenu;
1502 ULONG ButtonType;
1503 DWORD Style;
1504 UINT MenuState;
1505
1506 Style = pWnd->style;
1507 switch (wParam)
1508 {
1509 case HTCLOSE:
1510 SysMenu = IntGetSystemMenu(pWnd, FALSE);
1511 MenuState = IntGetMenuState(SysMenu ? UserHMGetHandle(SysMenu) : NULL, SC_CLOSE, MF_BYCOMMAND); /* in case of error MenuState==0xFFFFFFFF */
1512 if (!(Style & WS_SYSMENU) || (MenuState & (MF_GRAYED|MF_DISABLED)) || (pWnd->pcls->style & CS_NOCLOSE))
1513 return;
1514 ButtonType = DFCS_CAPTIONCLOSE;
1515 SCMsg = SC_CLOSE;
1516 break;
1517 case HTMINBUTTON:
1518 if (!(Style & WS_MINIMIZEBOX))
1519 return;
1520 ButtonType = DFCS_CAPTIONMIN;
1521 SCMsg = ((Style & WS_MINIMIZE) ? SC_RESTORE : SC_MINIMIZE);
1522 break;
1523 case HTMAXBUTTON:
1524 if (!(Style & WS_MAXIMIZEBOX))
1525 return;
1526 ButtonType = DFCS_CAPTIONMAX;
1527 SCMsg = ((Style & WS_MAXIMIZE) ? SC_RESTORE : SC_MAXIMIZE);
1528 break;
1529
1530 default:
1531 ASSERT(FALSE);
1532 return;
1533 }
1534
1535 /*
1536 * FIXME: Not sure where to do this, but we must flush the pending
1537 * window updates when someone clicks on the close button and at
1538 * the same time the window is overlapped with another one. This
1539 * looks like a good place for now...
1540 */
1542
1543 WindowDC = UserGetWindowDC(pWnd);
1544 UserDrawCaptionButtonWnd(pWnd, WindowDC, TRUE, ButtonType);
1545
1547
1548 for (;;)
1549 {
1551 if (IntCallMsgFilter( &Msg, MSGF_MAX )) continue;
1552
1553 if (Msg.message == WM_LBUTTONUP)
1554 break;
1555
1556 if (Msg.message != WM_MOUSEMOVE)
1557 continue;
1558
1559 OldState = Pressed;
1560 Pressed = (GetNCHitEx(pWnd, Msg.pt) == wParam);
1561 if (Pressed != OldState)
1562 UserDrawCaptionButtonWnd(pWnd, WindowDC, Pressed, ButtonType);
1563 }
1564
1565 if (Pressed)
1566 UserDrawCaptionButtonWnd(pWnd, WindowDC, FALSE, ButtonType);
1568 UserReleaseDC(pWnd, WindowDC, FALSE);
1569 if (Pressed)
1570 co_IntSendMessage(UserHMGetHandle(pWnd), WM_SYSCOMMAND, SCMsg, SCMsg == SC_CLOSE ? lParam : MAKELONG(Msg.pt.x,Msg.pt.y));
1571}
1572
1573
1574LRESULT
1576{
1577 switch (wParam)
1578 {
1579 case HTCAPTION:
1580 {
1581 PWND TopWnd = pWnd, parent;
1582 while(1)
1583 {
1584 if ((TopWnd->style & (WS_POPUP|WS_CHILD)) != WS_CHILD)
1585 break;
1586 parent = UserGetAncestor( TopWnd, GA_PARENT );
1587 if (!parent || UserIsDesktopWindow(parent)) break;
1588 TopWnd = parent;
1589 }
1590
1591 if ( (pWnd && (pWnd->ExStyle & WS_EX_NOACTIVATE)) ||
1593 //NtUserCallHwndLock(hTopWnd, HWNDLOCK_ROUTINE_SETFOREGROUNDWINDOWMOUSE) ||
1595 {
1597 }
1598 break;
1599 }
1600 case HTSYSMENU:
1601 {
1602 LONG style = pWnd->style;
1603 if (style & WS_SYSMENU)
1604 {
1605 if(!(style & WS_MINIMIZE) )
1606 {
1607 RECT rect;
1608 HDC hDC = UserGetWindowDC(pWnd);
1609 NC_GetInsideRect(pWnd, &rect);
1611 UserReleaseDC( pWnd, hDC, FALSE );
1612 }
1614 }
1615 break;
1616 }
1617 case HTMENU:
1618 {
1620 break;
1621 }
1622 case HTHSCROLL:
1623 {
1625 break;
1626 }
1627 case HTVSCROLL:
1628 {
1630 break;
1631 }
1632 case HTMINBUTTON:
1633 case HTMAXBUTTON:
1634 case HTCLOSE:
1635 {
1636 NC_DoButton(pWnd, wParam, lParam);
1637 break;
1638 }
1639 case HTLEFT:
1640 case HTRIGHT:
1641 case HTTOP:
1642 case HTBOTTOM:
1643 case HTTOPLEFT:
1644 case HTTOPRIGHT:
1645 case HTBOTTOMLEFT:
1646 case HTBOTTOMRIGHT:
1647 {
1648 /* Old comment:
1649 * "make sure hittest fits into 0xf and doesn't overlap with HTSYSMENU"
1650 * This was previously done by setting wParam=SC_SIZE + wParam - 2
1651 */
1652 /* But that is not what WinNT does. Instead it sends this. This
1653 * is easy to differentiate from HTSYSMENU, because HTSYSMENU adds
1654 * SC_MOUSEMENU into wParam.
1655 */
1657 break;
1658 }
1659 case HTBORDER:
1660 break;
1661 }
1662 return(0);
1663}
1664
1665
1666LRESULT
1668{
1669 ULONG Style;
1670
1671 Style = pWnd->style;
1672 switch(wParam)
1673 {
1674 case HTCAPTION:
1675 {
1676 /* Maximize/Restore the window */
1678 {
1680 }
1681 break;
1682 }
1683 case HTSYSMENU:
1684 {
1685 PMENU SysMenu = IntGetSystemMenu(pWnd, FALSE);
1687
1688 /* If the close item of the sysmenu is disabled or not present do nothing */
1689 if ((state & (MF_DISABLED | MF_GRAYED)) || (state == 0xFFFFFFFF))
1690 break;
1691
1693 break;
1694 }
1695 case HTTOP:
1696 case HTBOTTOM:
1697 {
1698 RECT sizingRect = pWnd->rcWindow, mouseRect;
1699
1700 if (pWnd->ExStyle & WS_EX_MDICHILD)
1701 break;
1702
1703 UserSystemParametersInfo(SPI_GETWORKAREA, 0, &mouseRect, 0);
1704
1706 NULL,
1707 sizingRect.left,
1708 mouseRect.top,
1709 sizingRect.right - sizingRect.left,
1710 mouseRect.bottom - mouseRect.top,
1711 0);
1712 break;
1713 }
1714 default:
1715 return NC_HandleNCLButtonDown(pWnd, wParam, lParam);
1716 }
1717 return(0);
1718}
1719
1720/***********************************************************************
1721 * NC_HandleNCRButtonDown
1722 *
1723 * Handle a WM_NCRBUTTONDOWN message. Called from DefWindowProc().
1724 */
1726{
1727 MSG msg;
1728 INT hittest = wParam;
1729
1730 switch (hittest)
1731 {
1732 case HTCAPTION:
1733 case HTSYSMENU:
1734 if (!IntGetSystemMenu( pwnd, FALSE )) break;
1735
1737 for (;;)
1738 {
1740 if (IntCallMsgFilter( &msg, MSGF_MAX )) continue;
1741 if (msg.message == WM_RBUTTONUP)
1742 {
1743 hittest = GetNCHitEx( pwnd, msg.pt );
1744 break;
1745 }
1746 if (UserHMGetHandle(pwnd) != IntGetCapture()) return 0;
1747 }
1749
1750 if (hittest == HTCAPTION || hittest == HTSYSMENU || hittest == HTHSCROLL || hittest == HTVSCROLL)
1751 {
1752 TRACE("Msg pt %x and Msg.lParam %x and lParam %x\n",MAKELONG(msg.pt.x,msg.pt.y),msg.lParam,lParam);
1754 }
1755 break;
1756 }
1757 return 0;
1758}
1759
1760
1761#if 0 // Old version, kept there for reference, which is also used
1762 // almost unmodified in uxtheme.dll (in nonclient.c)
1763/*
1764 * FIXME:
1765 * - Check the scrollbar handling
1766 */
1767LRESULT
1769{
1770 RECT WindowRect, ClientRect, OrigWndRect;
1771 POINT ClientPoint;
1772 SIZE WindowBorders;
1775
1776 GetWindowRect(hWnd, &WindowRect);
1777 if (!PtInRect(&WindowRect, Point))
1778 {
1779 return HTNOWHERE;
1780 }
1781 OrigWndRect = WindowRect;
1782
1784 {
1785 LONG XSize, YSize;
1786
1787 UserGetWindowBorders(Style, ExStyle, &WindowBorders, FALSE);
1788 InflateRect(&WindowRect, -WindowBorders.cx, -WindowBorders.cy);
1791 if (!PtInRect(&WindowRect, Point))
1792 {
1793 BOOL ThickFrame;
1794
1795 ThickFrame = (Style & WS_THICKFRAME);
1796 if (Point.y < WindowRect.top)
1797 {
1798 if(Style & WS_MINIMIZE)
1799 return HTCAPTION;
1800 if(!ThickFrame)
1801 return HTBORDER;
1802 if (Point.x < (WindowRect.left + XSize))
1803 return HTTOPLEFT;
1804 if (Point.x >= (WindowRect.right - XSize))
1805 return HTTOPRIGHT;
1806 return HTTOP;
1807 }
1808 if (Point.y >= WindowRect.bottom)
1809 {
1810 if(Style & WS_MINIMIZE)
1811 return HTCAPTION;
1812 if(!ThickFrame)
1813 return HTBORDER;
1814 if (Point.x < (WindowRect.left + XSize))
1815 return HTBOTTOMLEFT;
1816 if (Point.x >= (WindowRect.right - XSize))
1817 return HTBOTTOMRIGHT;
1818 return HTBOTTOM;
1819 }
1820 if (Point.x < WindowRect.left)
1821 {
1822 if(Style & WS_MINIMIZE)
1823 return HTCAPTION;
1824 if(!ThickFrame)
1825 return HTBORDER;
1826 if (Point.y < (WindowRect.top + YSize))
1827 return HTTOPLEFT;
1828 if (Point.y >= (WindowRect.bottom - YSize))
1829 return HTBOTTOMLEFT;
1830 return HTLEFT;
1831 }
1832 if (Point.x >= WindowRect.right)
1833 {
1834 if(Style & WS_MINIMIZE)
1835 return HTCAPTION;
1836 if(!ThickFrame)
1837 return HTBORDER;
1838 if (Point.y < (WindowRect.top + YSize))
1839 return HTTOPRIGHT;
1840 if (Point.y >= (WindowRect.bottom - YSize))
1841 return HTBOTTOMRIGHT;
1842 return HTRIGHT;
1843 }
1844 }
1845 }
1846 else
1847 {
1849 InflateRect(&WindowRect,
1852 if (!PtInRect(&WindowRect, Point))
1853 return HTBORDER;
1854 }
1855
1856 if ((Style & WS_CAPTION) == WS_CAPTION)
1857 {
1859 WindowRect.top += GetSystemMetrics(SM_CYSMCAPTION);
1860 else
1861 WindowRect.top += GetSystemMetrics(SM_CYCAPTION);
1862 if (!PtInRect(&WindowRect, Point))
1863 {
1864 if (Style & WS_SYSMENU)
1865 {
1867 {
1868 WindowRect.right -= GetSystemMetrics(SM_CXSMSIZE);
1869 }
1870 else
1871 {
1872 // if(!(ExStyle & WS_EX_DLGMODALFRAME))
1873 // FIXME: The real test should check whether there is
1874 // an icon for the system window, and if so, do the
1875 // rect.left increase.
1876 // See dll/win32/uxtheme/nonclient.c!DefWndNCHitTest
1877 // and win32ss/user/ntuser/nonclient.c!GetNCHitEx which does
1878 // the test better.
1879 WindowRect.left += GetSystemMetrics(SM_CXSIZE);
1880 WindowRect.right -= GetSystemMetrics(SM_CXSIZE);
1881 }
1882 }
1883 if (Point.x < WindowRect.left)
1884 return HTSYSMENU;
1885 if (WindowRect.right <= Point.x)
1886 return HTCLOSE;
1888 WindowRect.right -= GetSystemMetrics(SM_CXSIZE);
1889 if (Point.x >= WindowRect.right)
1890 return HTMAXBUTTON;
1891 if (Style & WS_MINIMIZEBOX)
1892 WindowRect.right -= GetSystemMetrics(SM_CXSIZE);
1893 if (Point.x >= WindowRect.right)
1894 return HTMINBUTTON;
1895 return HTCAPTION;
1896 }
1897 }
1898
1899 if(!(Style & WS_MINIMIZE))
1900 {
1901 ClientPoint = Point;
1902 ScreenToClient(hWnd, &ClientPoint);
1903 GetClientRect(hWnd, &ClientRect);
1904
1905 if (PtInRect(&ClientRect, ClientPoint))
1906 {
1907 return HTCLIENT;
1908 }
1909
1910 if (GetMenu(hWnd) && !(Style & WS_CHILD))
1911 {
1912 if (Point.x > 0 && Point.x < WindowRect.right && ClientPoint.y < 0)
1913 return HTMENU;
1914 }
1915
1917 {
1918 InflateRect(&WindowRect, -2 * GetSystemMetrics(SM_CXBORDER),
1920 }
1921
1922 if ((Style & WS_VSCROLL) && (Style & WS_HSCROLL) &&
1923 (WindowRect.bottom - WindowRect.top) > GetSystemMetrics(SM_CYHSCROLL))
1924 {
1925 RECT ParentRect, TempRect = WindowRect, TempRect2 = WindowRect;
1927
1929 if ((ExStyle & WS_EX_LEFTSCROLLBAR) != 0)
1930 TempRect.right = TempRect.left + GetSystemMetrics(SM_CXVSCROLL);
1931 else
1932 TempRect.left = TempRect.right - GetSystemMetrics(SM_CXVSCROLL);
1933 if (PtInRect(&TempRect, Point))
1934 return HTVSCROLL;
1935
1936 TempRect2.top = TempRect2.bottom - GetSystemMetrics(SM_CYHSCROLL);
1937 if ((ExStyle & WS_EX_LEFTSCROLLBAR) != 0)
1938 TempRect2.left += GetSystemMetrics(SM_CXVSCROLL);
1939 else
1940 TempRect2.right -= GetSystemMetrics(SM_CXVSCROLL);
1941 if (PtInRect(&TempRect2, Point))
1942 return HTHSCROLL;
1943
1944 TempRect.top = TempRect2.top;
1945 TempRect.bottom = TempRect2.bottom;
1946 if(Parent)
1947 GetClientRect(Parent, &ParentRect);
1948 if (PtInRect(&TempRect, Point) && HASSIZEGRIP(Style, ExStyle,
1949 GetWindowLongPtrW(Parent, GWL_STYLE), OrigWndRect, ParentRect))
1950 {
1951 if ((ExStyle & WS_EX_LEFTSCROLLBAR) != 0)
1952 return HTBOTTOMLEFT;
1953 else
1954 return HTBOTTOMRIGHT;
1955 }
1956 }
1957 else
1958 {
1959 if (Style & WS_VSCROLL)
1960 {
1961 RECT TempRect = WindowRect;
1962
1963 if ((ExStyle & WS_EX_LEFTSCROLLBAR) != 0)
1964 TempRect.right = TempRect.left + GetSystemMetrics(SM_CXVSCROLL);
1965 else
1966 TempRect.left = TempRect.right - GetSystemMetrics(SM_CXVSCROLL);
1967 if (PtInRect(&TempRect, Point))
1968 return HTVSCROLL;
1969 } else
1970 if (Style & WS_HSCROLL)
1971 {
1972 RECT TempRect = WindowRect;
1973 TempRect.top = TempRect.bottom - GetSystemMetrics(SM_CYHSCROLL);
1974 if (PtInRect(&TempRect, Point))
1975 return HTHSCROLL;
1976 }
1977 }
1978 }
1979
1980 return HTNOWHERE;
1981}
1982#endif
1983
1986{
1987 RECT rcWindow, rcClient;
1989
1990 if (!pWnd) return HTNOWHERE;
1991
1992 if (UserIsDesktopWindow(pWnd))
1993 {
1994 rcClient.left = rcClient.top = rcWindow.left = rcWindow.top = 0;
1999 }
2000 else
2001 {
2002 rcClient = pWnd->rcClient;
2003 rcWindow = pWnd->rcWindow;
2004 }
2005
2006 if (!RECTL_bPointInRect(&rcWindow, pt.x, pt.y)) return HTNOWHERE;
2007
2008 Style = pWnd->style;
2009 ExStyle = pWnd->ExStyle;
2010
2011 if (Style & WS_MINIMIZE) return HTCAPTION;
2012
2013 if (RECTL_bPointInRect( &rcClient, pt.x, pt.y )) return HTCLIENT;
2014
2015 /* Check borders */
2017 {
2019 if (!RECTL_bPointInRect(&rcWindow, pt.x, pt.y ))
2020 {
2021 /* Check top sizing border */
2022 if (pt.y < rcWindow.top)
2023 {
2024 if (pt.x < rcWindow.left+UserGetSystemMetrics(SM_CXSIZE)) return HTTOPLEFT;
2025 if (pt.x >= rcWindow.right-UserGetSystemMetrics(SM_CXSIZE)) return HTTOPRIGHT;
2026 return HTTOP;
2027 }
2028 /* Check bottom sizing border */
2029 if (pt.y >= rcWindow.bottom)
2030 {
2031 if (pt.x < rcWindow.left+UserGetSystemMetrics(SM_CXSIZE)) return HTBOTTOMLEFT;
2032 if (pt.x >= rcWindow.right-UserGetSystemMetrics(SM_CXSIZE)) return HTBOTTOMRIGHT;
2033 return HTBOTTOM;
2034 }
2035 /* Check left sizing border */
2036 if (pt.x < rcWindow.left)
2037 {
2038 if (pt.y < rcWindow.top+UserGetSystemMetrics(SM_CYSIZE)) return HTTOPLEFT;
2039 if (pt.y >= rcWindow.bottom-UserGetSystemMetrics(SM_CYSIZE)) return HTBOTTOMLEFT;
2040 return HTLEFT;
2041 }
2042 /* Check right sizing border */
2043 if (pt.x >= rcWindow.right)
2044 {
2045 if (pt.y < rcWindow.top+UserGetSystemMetrics(SM_CYSIZE)) return HTTOPRIGHT;
2046 if (pt.y >= rcWindow.bottom-UserGetSystemMetrics(SM_CYSIZE)) return HTBOTTOMRIGHT;
2047 return HTRIGHT;
2048 }
2049 }
2050 }
2051 else /* No thick frame */
2052 {
2053 if (HAS_DLGFRAME( Style, ExStyle ))
2055 else if (HAS_THINFRAME( Style, ExStyle ))
2057 else if (HAS_CLIENTFRAME( Style, ExStyle ))
2059 if (!RECTL_bPointInRect( &rcWindow, pt.x, pt.y )) return HTBORDER;
2060 }
2061
2062 /* Check caption */
2063
2064 if ((Style & WS_CAPTION) == WS_CAPTION)
2065 {
2067 rcWindow.top += UserGetSystemMetrics(SM_CYSMCAPTION) - 1;
2068 else
2069 rcWindow.top += UserGetSystemMetrics(SM_CYCAPTION) - 1;
2070 if (!RECTL_bPointInRect( &rcWindow, pt.x, pt.y ))
2071 {
2072 BOOL min_or_max_box = (Style & WS_SYSMENU) && (Style & (WS_MINIMIZEBOX|WS_MAXIMIZEBOX));
2074 {
2075 /* Check system menu */
2076 if ((Style & WS_SYSMENU) && !(ExStyle & WS_EX_TOOLWINDOW) && NC_IconForWindow(pWnd))
2077 {
2078 rcWindow.right -= UserGetSystemMetrics(SM_CYCAPTION) - 1;
2079 if (pt.x > rcWindow.right) return HTSYSMENU;
2080 }
2081
2082 /* Check close button */
2083 if (Style & WS_SYSMENU)
2084 {
2086 if (pt.x < rcWindow.left) return HTCLOSE;
2087 }
2088
2089 /* Check maximize box */
2090 /* In Win95 there is automatically a Maximize button when there is a minimize one */
2091 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2092 {
2093 rcWindow.left += UserGetSystemMetrics(SM_CXSIZE);
2094 if (pt.x < rcWindow.left) return HTMAXBUTTON;
2095 }
2096
2097 /* Check minimize box */
2098 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2099 {
2100 rcWindow.left += UserGetSystemMetrics(SM_CXSIZE);
2101 if (pt.x < rcWindow.left) return HTMINBUTTON;
2102 }
2103 }
2104 else
2105 {
2106 /* Check system menu */
2107 if ((Style & WS_SYSMENU) && !(ExStyle & WS_EX_TOOLWINDOW) && NC_IconForWindow(pWnd))
2108 {
2109 rcWindow.left += UserGetSystemMetrics(SM_CYCAPTION) - 1;
2110 if (pt.x < rcWindow.left) return HTSYSMENU;
2111 }
2112
2113 /* Check close button */
2114 if (Style & WS_SYSMENU)
2115 {
2117 if (pt.x > rcWindow.right) return HTCLOSE;
2118 }
2119
2120 /* Check maximize box */
2121 /* In Win95 there is automatically a Maximize button when there is a minimize one */
2122 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2123 {
2125 if (pt.x > rcWindow.right) return HTMAXBUTTON;
2126 }
2127
2128 /* Check minimize box */
2129 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2130 {
2132 if (pt.x > rcWindow.right) return HTMINBUTTON;
2133 }
2134 }
2135 return HTCAPTION;
2136 }
2137 }
2138
2139 /* Check menu bar */
2140
2141 if (HAS_MENU( pWnd, Style ) && (pt.y < rcClient.top) &&
2142 (pt.x >= rcClient.left) && (pt.x < rcClient.right))
2143 return HTMENU;
2144
2145 /* Check vertical scroll bar */
2146
2148 if (Style & WS_VSCROLL)
2149 {
2150 if((ExStyle & WS_EX_LEFTSCROLLBAR) != 0)
2152 else
2154 if (RECTL_bPointInRect( &rcClient, pt.x, pt.y )) return HTVSCROLL;
2155 }
2156
2157 /* Check horizontal scroll bar */
2158
2159 if (Style & WS_HSCROLL)
2160 {
2162 if (RECTL_bPointInRect( &rcClient, pt.x, pt.y ))
2163 {
2164 /* Check size box */
2165 if ((Style & WS_VSCROLL) &&
2166 ((((ExStyle & WS_EX_LEFTSCROLLBAR) != 0) && (pt.x <= rcClient.left + UserGetSystemMetrics(SM_CXVSCROLL))) ||
2167 (((ExStyle & WS_EX_LEFTSCROLLBAR) == 0) && (pt.x >= rcClient.right - UserGetSystemMetrics(SM_CXVSCROLL)))))
2168 return HTSIZE;
2169 return HTHSCROLL;
2170 }
2171 }
2172
2173 /* Has to return HTNOWHERE if nothing was found
2174 Could happen when a window has a customized non client area */
2175 return HTNOWHERE;
2176}
2177
2178/* EOF */
static HDC hDC
Definition: 3dtext.c:33
#define DCX_USESTYLE
Definition: GetDCEx.c:10
static HBRUSH hbrush
unsigned char BOOLEAN
@ 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
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:97
#define DBG_DEFAULT_CHANNEL(ch)
Definition: debug.h:106
struct @1762 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 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 int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
PUSER_MESSAGE_QUEUE gpqForeground
Definition: focus.c:13
HWND FASTCALL co_UserSetCapture(HWND hWnd)
Definition: focus.c:1460
HWND APIENTRY IntGetCapture(VOID)
Definition: focus.c:1443
BOOL FASTCALL IntReleaseCapture(VOID)
Definition: focus.c:1532
BOOL FASTCALL co_IntSetForegroundWindowMouse(PWND Window)
Definition: focus.c:1563
HWND FASTCALL UserGetActiveWindow(VOID)
Definition: focus.c:1432
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:3609
#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
#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:33
#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
__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:990
__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)
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:4014
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:3942
VOID FASTCALL co_IntCalculateSnapPosition(PWND Wnd, UINT Edge, OUT RECT *Pos)
Definition: winpos.c:3912
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:3904
VOID FASTCALL IntSetSnapEdge(PWND Wnd, UINT Edge)
Definition: winpos.c:3989
#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
#define GreCreateRectRgnIndirect(prc)
Definition: region.h:96
#define WM_CONTEXTMENU
Definition: richedit.h:64
BOOL FASTCALL co_IntGetScrollBarInfo(PWND, LONG, PSCROLLBARINFO)
Definition: scrollbar.c:666
void IntDrawScrollBar(PWND, HDC, INT)
Definition: scrollbar.c:1072
#define TRACE(s)
Definition: solgame.cpp:4
& rect
Definition: startmenu.cpp:1413
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
struct _WND::@5359 InternalPos
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
RECT rcWindow
Definition: ntuser.h:716
ULONG cyMenu
Definition: ntuser.h:423
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
DWORD rgstate[CCHILDREN_SCROLLBAR+1]
Definition: winuser.h:3830
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:2192
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:4
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:1158
BOOL NTAPI GreIsHandleValid(HGDIOBJ hobj)
Definition: gdiobj.c:1146
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:700
BOOL UserDrawIconEx(HDC hDc, INT xLeft, INT yTop, PCURICON_OBJECT pIcon, INT cxWidth, INT cyHeight, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags)
Definition: cursoricon.c:1689
PWND FASTCALL UserGetDesktopWindow(VOID)
Definition: desktop.c:1403
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:194
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:1276
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:210
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:1575
VOID UserDrawCaptionBar(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:955
DWORD FASTCALL GetNCHitEx(PWND pWnd, POINT pt)
Definition: nonclient.c:1985
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:1438
VOID NC_DoButton(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1495
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:1304
LRESULT NC_HandleNCRButtonDown(PWND pwnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1725
static INT NC_DoNCActive(PWND Wnd)
Definition: nonclient.c:1420
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:1667
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:644
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:731
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:2116
ULONG FASTCALL IntSetStyle(PWND pwnd, ULONG set_bits, ULONG clear_bits)
Definition: window.c:145
PWND FASTCALL IntGetParent(PWND Wnd)
Definition: window.c:206
BOOL FASTCALL IntIsWindow(HWND hWnd)
Definition: window.c:178
BOOL FASTCALL IntIsChildWindow(PWND Parent, PWND BaseWindow)
Definition: window.c:930
BOOL FASTCALL IntIsWindowVisible(PWND Wnd)
Definition: window.c:191
#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 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
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
HICON HCURSOR
Definition: windef.h:299
#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:2613
#define HTTOPRIGHT
Definition: winuser.h:2511
#define HTCLOSE
Definition: winuser.h:2518
#define CS_VREDRAW
Definition: winuser.h:666
#define SC_MOUSEMENU
Definition: winuser.h:2614
#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:1760
#define COLOR_INACTIVECAPTIONTEXT
Definition: winuser.h:945
#define GetWindowLongPtrW
Definition: winuser.h:4905
#define SM_CYEDGE
Definition: winuser.h:1020
#define WM_MOUSEFIRST
Definition: winuser.h:1793
#define EDGE_SUNKEN
Definition: winuser.h:451
#define WM_MOUSELAST
Definition: winuser.h:1820
#define DCX_CACHE
Definition: winuser.h:2133
#define COLOR_WINDOWFRAME
Definition: winuser.h:930
#define SM_CYSCREEN
Definition: winuser.h:971
#define HTCAPTION
Definition: winuser.h:2495
#define DCX_WINDOW
Definition: winuser.h:2132
#define SM_CXEDGE
Definition: winuser.h:1019
#define HTTOPLEFT
Definition: winuser.h:2510
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:2512
#define WVR_VALIDRECTS
Definition: winuser.h:2541
#define HTBORDER
Definition: winuser.h:2516
#define SB_VERT
Definition: winuser.h:553
#define SC_VSCROLL
Definition: winuser.h:2612
#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:2501
#define COLOR_ACTIVECAPTION
Definition: winuser.h:926
#define HTHSCROLL
Definition: winuser.h:2500
#define DC_CAPTION
Definition: winuser.h:439
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define WM_RBUTTONUP
Definition: winuser.h:1799
#define DFCS_SCROLLSIZEGRIP
Definition: winuser.h:494
#define SM_CYSMICON
Definition: winuser.h:1024
#define VK_UP
Definition: winuser.h:2244
#define COLOR_INACTIVECAPTION
Definition: winuser.h:927
#define BF_ADJUST
Definition: winuser.h:470
#define GA_PARENT
Definition: winuser.h:2864
#define SWP_NOSIZE
Definition: winuser.h:1256
#define WM_MOUSEMOVE
Definition: winuser.h:1794
#define RDW_UPDATENOW
Definition: winuser.h:1231
#define WH_CBT
Definition: winuser.h:35
#define HTMAXBUTTON
Definition: winuser.h:2503
#define BF_FLAT
Definition: winuser.h:471
#define SM_CXSIZE
Definition: winuser.h:1002
#define WM_QUERYDRAGICON
Definition: winuser.h:1673
#define SM_CYFRAME
Definition: winuser.h:1007
#define WMSZ_LEFT
Definition: winuser.h:2483
#define SM_CYHSCROLL
Definition: winuser.h:973
#define DFC_CAPTION
Definition: winuser.h:473
#define HTMENU
Definition: winuser.h:2499
#define SC_SIZE
Definition: winuser.h:2603
#define SC_MINIMIZE
Definition: winuser.h:2605
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:2220
#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:1843
#define WVR_VREDRAW
Definition: winuser.h:2539
#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:2508
#define HTCLIENT
Definition: winuser.h:2494
#define COLOR_ACTIVEBORDER
Definition: winuser.h:934
#define HCBT_MOVESIZE
Definition: winuser.h:55
#define HTBOTTOMRIGHT
Definition: winuser.h:2514
#define HTNOWHERE
Definition: winuser.h:2493
#define SC_CLOSE
Definition: winuser.h:2611
#define DC_TEXT
Definition: winuser.h:430
#define SC_MOVE
Definition: winuser.h:2604
#define STATE_SYSTEM_OFFSCREEN
Definition: winuser.h:2954
#define COLOR_BTNSHADOW
Definition: winuser.h:941
#define SM_CXDLGFRAME
Definition: winuser.h:977
#define WVR_HREDRAW
Definition: winuser.h:2538
#define WM_LBUTTONUP
Definition: winuser.h:1796
#define HTSIZE
Definition: winuser.h:2498
#define MSGF_SIZE
Definition: winuser.h:1188
HWND WINAPI GetParent(_In_ HWND)
#define VK_LEFT
Definition: winuser.h:2243
#define WM_SIZING
Definition: winuser.h:1826
#define VK_RIGHT
Definition: winuser.h:2245
struct tagSCROLLBARINFO SCROLLBARINFO
#define HTBOTTOMLEFT
Definition: winuser.h:2513
#define HTTOP
Definition: winuser.h:2509
#define VK_DOWN
Definition: winuser.h:2246
#define WM_SETCURSOR
Definition: winuser.h:1655
#define MSGF_MAX
Definition: winuser.h:1193
#define MK_LBUTTON
Definition: winuser.h:2386
#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:1734
#define WM_MOVING
Definition: winuser.h:1828
#define WM_MDIGETACTIVE
Definition: winuser.h:1840
#define DC_SMALLCAP
Definition: winuser.h:428
#define HTMINBUTTON
Definition: winuser.h:2502
#define DFCS_CAPTIONMAX
Definition: winuser.h:482
#define HTSYSMENU
Definition: winuser.h:2496
#define HTLEFT
Definition: winuser.h:2506
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:2233
#define SC_RESTORE
Definition: winuser.h:2617
#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:2607
#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:1842
_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:420
_In_ ULONG _In_ BOOLEAN Active
Definition: potypes.h:561