ReactOS 0.4.17-dev-470-gf9e3448
nonclient.c File Reference
#include <win32k.h>
#include <windowsx.h>
Include dependency graph for nonclient.c:

Go to the source code of this file.

Macros

#define UserHasDlgFrameStyle(Style, ExStyle)
 
#define UserHasThickFrameStyle(Style, ExStyle)
 
#define UserHasThinFrameStyle(Style, ExStyle)    (((Style) & WS_BORDER) || (!((Style) & (WS_CHILD | WS_POPUP))))
 
#define ON_LEFT_BORDER(hit)    (((hit) == HTLEFT) || ((hit) == HTTOPLEFT) || ((hit) == HTBOTTOMLEFT))
 
#define ON_RIGHT_BORDER(hit)    (((hit) == HTRIGHT) || ((hit) == HTTOPRIGHT) || ((hit) == HTBOTTOMRIGHT))
 
#define ON_TOP_BORDER(hit)    (((hit) == HTTOP) || ((hit) == HTTOPLEFT) || ((hit) == HTTOPRIGHT))
 
#define ON_BOTTOM_BORDER(hit)    (((hit) == HTBOTTOM) || ((hit) == HTBOTTOMLEFT) || ((hit) == HTBOTTOMRIGHT))
 
#define HASSIZEGRIP(Style, ExStyle, ParentStyle, WindowRect, ParentClientRect)
 

Functions

 DBG_DEFAULT_CHANNEL (UserDefwnd)
 
VOID FASTCALL UserDrawWindowFrame (HDC hdc, RECTL *rect, ULONG width, ULONG height)
 
VOID FASTCALL UserDrawMovingFrame (HDC hdc, RECTL *rect, BOOL thickframe)
 
void FASTCALL NC_GetInsideRect (PWND Wnd, RECT *rect)
 
void FASTCALL NC_GetSysPopupPos (PWND Wnd, RECT *Rect)
 
static UINT GetSnapActivationPoint (PWND Wnd, POINT pt)
 
LONG FASTCALL DefWndStartSizeMove (PWND Wnd, WPARAM wParam, POINT *capturePoint)
 
VOID FASTCALL DefWndDoSizeMove (PWND pwnd, WORD wParam)
 
PCURICON_OBJECT FASTCALL NC_IconForWindow (PWND pWnd)
 
BOOL UserDrawSysMenuButton (PWND pWnd, HDC hDC, LPRECT Rect, BOOL Down)
 
BOOL IntIsScrollBarVisible (PWND pWnd, INT hBar)
 
VOID UserDrawCaptionButton (PWND pWnd, LPRECT Rect, DWORD Style, DWORD ExStyle, HDC hDC, BOOL bDown, ULONG Type)
 
VOID UserDrawCaptionButtonWnd (PWND pWnd, HDC hDC, BOOL bDown, ULONG Type)
 
VOID NC_DrawFrame (HDC hDC, RECT *CurrentRect, BOOL Active, DWORD Style, DWORD ExStyle)
 
VOID UserDrawCaptionBar (PWND pWnd, HDC hDC, INT Flags)
 
LRESULT NC_DoNCPaint (PWND pWnd, HDC hDC, INT Flags)
 
LRESULT NC_HandleNCCalcSize (PWND Wnd, WPARAM wparam, RECTL *Rect, BOOL Suspended)
 
static INT NC_DoNCActive (PWND Wnd)
 
LRESULT NC_HandleNCActivate (PWND Wnd, WPARAM wParam, LPARAM lParam)
 
VOID NC_DoButton (PWND pWnd, WPARAM wParam, LPARAM lParam)
 
LRESULT NC_HandleNCLButtonDown (PWND pWnd, WPARAM wParam, LPARAM lParam)
 
LRESULT NC_HandleNCLButtonDblClk (PWND pWnd, WPARAM wParam, LPARAM lParam)
 
LRESULT NC_HandleNCRButtonDown (PWND pwnd, WPARAM wParam, LPARAM lParam)
 
DWORD FASTCALL GetNCHitEx (PWND pWnd, POINT pt)
 

Macro Definition Documentation

◆ HASSIZEGRIP

#define HASSIZEGRIP (   Style,
  ExStyle,
  ParentStyle,
  WindowRect,
  ParentClientRect 
)
Value:
((!(Style & WS_CHILD) && (Style & WS_THICKFRAME) && !(Style & WS_MAXIMIZE)) || \
((Style & WS_CHILD) && (ParentStyle & WS_THICKFRAME) && !(ParentStyle & WS_MAXIMIZE) && \
(WindowRect.right - WindowRect.left == ParentClientRect.right) && \
(WindowRect.bottom - WindowRect.top == ParentClientRect.bottom)))
const DWORD Style
Definition: appswitch.c:72
#define WS_CHILD
Definition: pedump.c:617
#define WS_MAXIMIZE
Definition: pedump.c:623
#define WS_THICKFRAME
Definition: pedump.c:630

Definition at line 34 of file nonclient.c.

◆ ON_BOTTOM_BORDER

#define ON_BOTTOM_BORDER (   hit)     (((hit) == HTBOTTOM) || ((hit) == HTBOTTOMLEFT) || ((hit) == HTBOTTOMRIGHT))

Definition at line 31 of file nonclient.c.

◆ ON_LEFT_BORDER

#define ON_LEFT_BORDER (   hit)     (((hit) == HTLEFT) || ((hit) == HTTOPLEFT) || ((hit) == HTBOTTOMLEFT))

Definition at line 25 of file nonclient.c.

◆ ON_RIGHT_BORDER

#define ON_RIGHT_BORDER (   hit)     (((hit) == HTRIGHT) || ((hit) == HTTOPRIGHT) || ((hit) == HTBOTTOMRIGHT))

Definition at line 27 of file nonclient.c.

◆ ON_TOP_BORDER

#define ON_TOP_BORDER (   hit)     (((hit) == HTTOP) || ((hit) == HTTOPLEFT) || ((hit) == HTTOPRIGHT))

Definition at line 29 of file nonclient.c.

◆ UserHasDlgFrameStyle

#define UserHasDlgFrameStyle (   Style,
  ExStyle 
)
Value:
(((Style) & WS_DLGFRAME) && (!((Style) & WS_THICKFRAME))))
const DWORD ExStyle
Definition: appswitch.c:73
#define WS_EX_DLGMODALFRAME
Definition: pedump.c:645
#define WS_DLGFRAME
Definition: pedump.c:626

Definition at line 14 of file nonclient.c.

◆ UserHasThickFrameStyle

#define UserHasThickFrameStyle (   Style,
  ExStyle 
)
Value:
(((Style) & WS_THICKFRAME) && \
#define WS_BORDER
Definition: pedump.c:625

Definition at line 18 of file nonclient.c.

◆ UserHasThinFrameStyle

#define UserHasThinFrameStyle (   Style,
  ExStyle 
)     (((Style) & WS_BORDER) || (!((Style) & (WS_CHILD | WS_POPUP))))

Definition at line 22 of file nonclient.c.

Function Documentation

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( UserDefwnd  )

◆ DefWndDoSizeMove()

VOID FASTCALL DefWndDoSizeMove ( PWND  pwnd,
WORD  wParam 
)

Definition at line 259 of file nonclient.c.

260{
261 MSG msg;
262 RECT sizingRect, mouseRect, origRect, unmodRect, snapPreviewRect;
263 PRECT pFrameRect = &sizingRect;
264 HDC hdc;
265 LONG hittest = (LONG)(wParam & 0x0f);
266 PCURICON_OBJECT DragCursor = NULL, OldCursor = NULL;
267 POINT minTrack, maxTrack;
268 POINT capturePoint, pt;
270 UINT orgSnap = IntGetWindowSnapEdge(pwnd), snap = orgSnap;
271 BOOL thickframe;
272 BOOL iconic;
273 BOOL moved = FALSE;
274 BOOL DragFullWindows = FALSE;
275 PWND pWndParent = NULL;
276 WPARAM syscommand = (wParam & 0xfff0);
278 //PMONITOR mon = 0; Don't port sync from wine!!! This breaks explorer task bar sizing!!
279 // The task bar can grow in size and can not reduce due to the change
280 // in the work area.
281
282 Style = pwnd->style;
283 ExStyle = pwnd->ExStyle;
284 iconic = (Style & WS_MINIMIZE) != 0;
285
286 if (((Style & WS_MAXIMIZE) && syscommand != SC_MOVE) || !IntIsWindowVisible(pwnd)) return;
287 if ((Style & (WS_MAXIMIZE | WS_CHILD)) == WS_MAXIMIZE)
288 orgSnap = snap = HTTOP;
289
290 thickframe = UserHasThickFrameStyle(Style, ExStyle) && !iconic;
291
292 //
293 // Show window contents while dragging the window, get flag from registry data.
294 //
295 UserSystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, &DragFullWindows, 0);
296
297 pt.x = pti->ptLast.x;
298 pt.y = pti->ptLast.y;
299 capturePoint = pt;
301
302 TRACE("pwnd %p command %04lx, hittest %d, pos %d,%d\n",
303 pwnd, syscommand, hittest, pt.x, pt.y);
304
305 if (syscommand == SC_MOVE)
306 {
307 if (!hittest) hittest = DefWndStartSizeMove(pwnd, wParam, &capturePoint);
308 if (!hittest) return;
309 }
310 else /* SC_SIZE */
311 {
312 if (!thickframe) return;
313 if (hittest && (syscommand != SC_MOUSEMENU))
314 {
315 hittest += (HTLEFT - WMSZ_LEFT);
316 }
317 else
318 {
320 hittest = DefWndStartSizeMove(pwnd, wParam, &capturePoint);
321 if (!hittest)
322 {
324 return;
325 }
326 }
327 }
328
329 /* Get min/max info */
330
331 co_WinPosGetMinMaxInfo(pwnd, NULL, NULL, &minTrack, &maxTrack);
332 sizingRect = pwnd->rcWindow;
333 origRect = sizingRect;
334 if (Style & WS_CHILD)
335 {
336 pWndParent = IntGetParent(pwnd);
337 IntGetClientRect( pWndParent, &mouseRect );
338 IntMapWindowPoints( pWndParent, 0, (LPPOINT)&mouseRect, 2 );
339 IntMapWindowPoints( 0, pWndParent, (LPPOINT)&sizingRect, 2 );
340 unmodRect = sizingRect;
341 }
342 else
343 {
344 if (!(ExStyle & WS_EX_TOPMOST))
345 {
346 UserSystemParametersInfo(SPI_GETWORKAREA, 0, &mouseRect, 0);
347 }
348 else
349 {
351 }
352 unmodRect = sizingRect;
353 }
354
355 if (ON_LEFT_BORDER(hittest))
356 {
357 mouseRect.left = max( mouseRect.left, sizingRect.right-maxTrack.x+capturePoint.x-sizingRect.left );
358 mouseRect.right = min( mouseRect.right, sizingRect.right-minTrack.x+capturePoint.x-sizingRect.left );
359 }
360 else if (ON_RIGHT_BORDER(hittest))
361 {
362 mouseRect.left = max( mouseRect.left, sizingRect.left+minTrack.x+capturePoint.x-sizingRect.right );
363 mouseRect.right = min( mouseRect.right, sizingRect.left+maxTrack.x+capturePoint.x-sizingRect.right );
364 }
365 if (ON_TOP_BORDER(hittest))
366 {
367 mouseRect.top = max( mouseRect.top, sizingRect.bottom-maxTrack.y+capturePoint.y-sizingRect.top );
368 mouseRect.bottom = min( mouseRect.bottom,sizingRect.bottom-minTrack.y+capturePoint.y-sizingRect.top);
369 }
370 else if (ON_BOTTOM_BORDER(hittest))
371 {
372 mouseRect.top = max( mouseRect.top, sizingRect.top+minTrack.y+capturePoint.y-sizingRect.bottom );
373 mouseRect.bottom = min( mouseRect.bottom, sizingRect.top+maxTrack.y+capturePoint.y-sizingRect.bottom );
374 }
375
376 hdc = UserGetDCEx( pWndParent, 0, DCX_CACHE );
377 if (iconic)
378 {
379 DragCursor = pwnd->pcls->spicn;
380 if (DragCursor)
381 {
382 UserReferenceObject(DragCursor);
383 }
384 else
385 {
386 HCURSOR CursorHandle = (HCURSOR)co_IntSendMessage( UserHMGetHandle(pwnd), WM_QUERYDRAGICON, 0, 0 );
387 if (CursorHandle)
388 {
389 DragCursor = UserGetCurIconObject(CursorHandle);
390 }
391 else
392 {
393 iconic = FALSE;
394 }
395 }
396 }
397
398 /* repaint the window before moving it around */
400
401 IntNotifyWinEvent( EVENT_SYSTEM_MOVESIZESTART, pwnd, OBJID_WINDOW, CHILDID_SELF, 0);
402
404
406
408
409 pwnd->head.pti->TIF_flags |= TIF_MOVESIZETRACKING;
410
411 for(;;)
412 {
413 int dx = 0, dy = 0;
414
415 if (!co_IntGetPeekMessage(&msg, 0, 0, 0, PM_REMOVE, TRUE)) break;
416 if (msg.message == WM_QUIT)
417 {
418 MsqPostQuitMessage(pti, (ULONG)msg.wParam);
419 break;
420 }
421 if (IntCallMsgFilter( &msg, MSGF_SIZE )) continue;
422
423 if (msg.message == WM_KEYDOWN && (msg.wParam == VK_RETURN || msg.wParam == VK_ESCAPE))
424 break; // Exit on Return or Esc
425
426 if (!g_bWindowSnapEnabled && (msg.message == WM_LBUTTONUP ||
427 (msg.message == WM_MOUSEMOVE && (msg.wParam & MK_LBUTTON) == 0)))
428 { // If no WindowSnapEnabled: Exit on button-up immediately
429 break;
430 }
431 else if (g_bWindowSnapEnabled && (msg.message == WM_LBUTTONUP ||
432 (msg.message == WM_MOUSEMOVE && (msg.wParam & MK_LBUTTON) == 0)))
433 { // If WindowSnapEnabled: Decide whether to snap before exiting
434 if (hittest == HTCAPTION && thickframe && /* Check for snapping if was moved by caption */
436 {
437 BOOLEAN wasSnap = IntIsWindowSnapped(pwnd); /* Need the live snap state, not orgSnap nor maximized state */
438 UINT snapTo = iconic ? HTNOWHERE : GetSnapActivationPoint(pwnd, pt);
439 if (snapTo)
440 {
441 if (DragFullWindows)
442 {
443 co_IntSnapWindow(pwnd, snapTo);
444 if (!wasSnap)
445 pwnd->InternalPos.NormalRect = origRect;
446 }
447 snap = snapTo;
448 }
449 }
450 break;
451 }
452
453 if ((msg.message != WM_KEYDOWN) && (msg.message != WM_MOUSEMOVE))
454 {
457 continue; /* We are not interested in other messages */
458 }
459
460 pt = msg.pt;
461
462 if (msg.message == WM_KEYDOWN) switch(msg.wParam)
463 {
464 case VK_UP: pt.y -= 8; break;
465 case VK_DOWN: pt.y += 8; break;
466 case VK_LEFT: pt.x -= 8; break;
467 case VK_RIGHT: pt.x += 8; break;
468 }
469
470 pt.x = max( pt.x, mouseRect.left );
471 pt.x = min( pt.x, mouseRect.right - 1 );
472 pt.y = max( pt.y, mouseRect.top );
473 pt.y = min( pt.y, mouseRect.bottom - 1 );
474
475 dx = pt.x - capturePoint.x;
476 dy = pt.y - capturePoint.y;
477
478 if (dx || dy)
479 {
480 if (!moved)
481 {
482 moved = TRUE;
483 if (iconic) /* ok, no system popup tracking */
484 {
485 OldCursor = UserSetCursor(DragCursor, FALSE);
487 }
488 else if (!DragFullWindows)
489 UserDrawMovingFrame(hdc, &sizingRect, thickframe);
490 }
491
492 if (msg.message == WM_KEYDOWN)
493 {
494 UserSetCursorPos(pt.x, pt.y, 0, 0, FALSE);
495 }
496 else
497 {
498 RECT newRect = unmodRect;
499
500 if (!iconic && !DragFullWindows)
501 {
502 UserDrawMovingFrame(hdc, pFrameRect, thickframe);
503 pFrameRect = &sizingRect;
504 }
505 if (hittest == HTCAPTION)
506 {
507 /* Restore window size if it is snapped */
508 PRECT pr = &newRect;
509 LONG width, height, capcy, snapTo;
510 if (snap && syscommand == SC_MOVE && !iconic &&
511 !RECTL_bIsEmptyRect(&pwnd->InternalPos.NormalRect))
512 {
513 *pr = pwnd->InternalPos.NormalRect;
514 origRect = *pr; /* Save normal size - is required when window unsnapped from one side and snapped to another holding mouse down */
515
516 /* Try to position the center of the caption where the mouse is horizontally */
517 capcy = UserGetSystemMetrics((ExStyle & WS_EX_TOPMOST) ? SM_CYSMCAPTION : SM_CYCAPTION); /* No border, close enough */
518 width = pr->right - pr->left;
519 height = pr->bottom - pr->top;
520 pr->left = pt.x - width / 2;
521 pr->right = pr->left + width;
522 pr->top = mouseRect.top;
523 pr->bottom = pr->top + height;
524 if (pr->left < mouseRect.left)
525 {
526 pr->left = mouseRect.left;
527 pr->right = pr->left + width;
528 }
529 if ((pwnd->ExStyle & WS_EX_LAYOUTRTL) && pr->right > mouseRect.right)
530 {
531 pr->left = mouseRect.right - width;
532 pr->right = pr->left + width;
533 }
534 UserSetCursorPos(pt.x, pr->top + capcy / 2, 0, 0, FALSE);
535 snap = FALSE;
536 dx = dy = 0; /* Don't offset this move */
537 if (DragFullWindows)
538 {
539 IntSetStyle(pwnd, 0, WS_MAXIMIZE);
541
542 /* Have to move and size it now because we don't want SWP_NOSIZE */
544 }
545 }
546 else if (!snap && syscommand == SC_MOVE && !iconic)
547 {
548 if ((snapTo = GetSnapActivationPoint(pwnd, pt)) != 0)
549 {
550 co_IntCalculateSnapPosition(pwnd, snapTo, &snapPreviewRect);
551 if (DragFullWindows)
552 {
553 /* TODO: Show preview of snap */
554 }
555 else
556 {
557 pFrameRect = &snapPreviewRect;
558 UserDrawMovingFrame(hdc, pFrameRect, thickframe);
559 continue;
560 }
561 }
562 }
563
564 /* regular window moving */
565 RECTL_vOffsetRect(&newRect, dx, dy);
566 }
567 if (ON_LEFT_BORDER(hittest)) newRect.left += dx;
568 else if (ON_RIGHT_BORDER(hittest)) newRect.right += dx;
569 if (ON_TOP_BORDER(hittest)) newRect.top += dy;
570 else if (ON_BOTTOM_BORDER(hittest)) newRect.bottom += dy;
571
572 capturePoint = pt;
573
574 //
575 // Save the new position to the unmodified rectangle. This allows explorer task bar
576 // sizing. Explorer will forces back the position unless a certain amount of sizing
577 // has occurred.
578 //
579 unmodRect = newRect;
580
581 /* Determine the hit location */
582 if (syscommand == SC_SIZE)
583 {
584 WPARAM wpSizingHit = 0;
585
586 if (hittest >= HTLEFT && hittest <= HTBOTTOMRIGHT)
587 wpSizingHit = WMSZ_LEFT + (hittest - HTLEFT);
588 co_IntSendMessage( UserHMGetHandle(pwnd), WM_SIZING, wpSizingHit, (LPARAM)&newRect );
589 }
590 else
591 co_IntSendMessage( UserHMGetHandle(pwnd), WM_MOVING, 0, (LPARAM)&newRect );
592
593 if (!iconic)
594 {
595 if (!DragFullWindows)
596 UserDrawMovingFrame( hdc, &newRect, thickframe );
597 else
598 { // Moving the whole window now!
599 HRGN hrgnNew;
600 HRGN hrgnOrig = GreCreateRectRgnIndirect(&pwnd->rcWindow);
601
602 if (pwnd->hrgnClip != NULL)
603 NtGdiCombineRgn(hrgnOrig, hrgnOrig, pwnd->hrgnClip, RGN_AND);
604
606 //IntMapWindowPoints( 0, pWndParent, (POINT *)&rect, 2 );
608 NULL,
609 newRect.left,
610 newRect.top,
611 newRect.right - newRect.left,
612 newRect.bottom - newRect.top,
613 SWP_NOACTIVATE | ((hittest == HTCAPTION) ? SWP_NOSIZE : 0));
614
615 hrgnNew = GreCreateRectRgnIndirect(&pwnd->rcWindow);
616 if (pwnd->hrgnClip != NULL)
617 NtGdiCombineRgn(hrgnNew, hrgnNew, pwnd->hrgnClip, RGN_AND);
618
619 if (hrgnNew)
620 {
621 if (hrgnOrig)
622 NtGdiCombineRgn(hrgnOrig, hrgnOrig, hrgnNew, RGN_DIFF);
623 }
624 else
625 {
626 if (hrgnOrig)
627 {
628 GreDeleteObject(hrgnOrig);
629 hrgnOrig = 0;
630 }
631 }
632
633 // Update all the windows after the move or size, including this window.
634 UpdateThreadWindows(UserGetDesktopWindow()->spwndChild, pti, hrgnOrig);
635
636 if (hrgnOrig) GreDeleteObject(hrgnOrig);
637 if (hrgnNew) GreDeleteObject(hrgnNew);
638 }
639 }
640 sizingRect = newRect;
641 }
642 }
643 }
644
645 pwnd->head.pti->TIF_flags &= ~TIF_MOVESIZETRACKING;
646
648
649 if ( iconic )
650 {
651 if ( moved ) /* restore cursors, show icon title later on */
652 {
654 OldCursor = UserSetCursor(OldCursor, FALSE);
655 }
656
657 /* It could be that the cursor was already changed while we were proceeding,
658 * so we must unreference whatever cursor was current at the time we restored the old one.
659 * Maybe it is DragCursor, but maybe it is another one and DragCursor got already freed.
660 */
661 if (OldCursor) UserDereferenceObject(OldCursor);
662 }
663 else
664 {
665 UINT eraseFinalFrame = moved && !DragFullWindows;
666 if (eraseFinalFrame)
667 UserDrawMovingFrame(hdc, pFrameRect, thickframe); // Undo the XOR drawing
668 }
669
671
673 //if (pWndParent) IntMapWindowPoints( 0, pWndParent, (POINT *)&sizingRect, 2 );
674
676 {
677 ERR("DoSizeMove : WH_CBT Call Hook return!\n");
678 moved = FALSE;
679 }
680
681 IntNotifyWinEvent( EVENT_SYSTEM_MOVESIZEEND, pwnd, OBJID_WINDOW, CHILDID_SELF, 0);
682
684
689 /* window moved or resized */
690 if (moved)
691 {
692 BOOL forceSizing = !iconic && hittest == HTCAPTION && (!!orgSnap != !!snap);
693 UINT swp = (!forceSizing && hittest == HTCAPTION) ? SWP_NOSIZE : 0;
694
695 /* if the moving/resizing isn't canceled call SetWindowPos
696 * with the new position or the new size of the window
697 */
698 if (!((msg.message == WM_KEYDOWN) && (msg.wParam == VK_ESCAPE)) )
699 {
700 /* NOTE: SWP_NOACTIVATE prevents document window activation in Word 6 */
701 if (!DragFullWindows || iconic)
702 {
703 if (snap)
704 {
705 co_IntSnapWindow(pwnd, snap);
706 }
707 else
708 {
709 if (orgSnap && !snap)
710 {
711 IntSetStyle(pwnd, 0, WS_MAXIMIZE);
713 }
714 co_WinPosSetWindowPos(pwnd, HWND_TOP, sizingRect.left, sizingRect.top,
715 sizingRect.right - sizingRect.left,
716 sizingRect.bottom - sizingRect.top, swp);
717 }
718 }
719 }
720 else
721 {
722 /* restore previous size/position */
723 if (orgSnap)
724 {
725 co_IntSnapWindow(pwnd, orgSnap);
726 }
727 else if (DragFullWindows)
728 {
729 co_WinPosSetWindowPos(pwnd, HWND_TOP, origRect.left, origRect.top,
730 origRect.right - origRect.left,
731 origRect.bottom - origRect.top, swp);
732 }
733 }
734 }
735
736 if (IntIsWindow(UserHMGetHandle(pwnd)))
737 {
738 /* Single click brings up the system menu when iconized */
739 if (iconic && !moved && (Style & WS_SYSMENU))
740 {
742 }
743 }
744}
unsigned char BOOLEAN
Definition: actypes.h:127
#define msg(x)
Definition: auth_time.c:54
#define ERR(fmt,...)
Definition: precomp.h:57
WPARAM wParam
Definition: combotst.c:138
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define pt(x, y)
Definition: drawing.c:79
#define L(x)
Definition: resources.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
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
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
unsigned int UINT
Definition: sysinfo.c:13
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
#define MSQ_STATE_MOVESIZE
Definition: ntuser.h:3613
#define TIF_MOVESIZETRACKING
Definition: ntuser.h:278
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97
LONG_PTR LPARAM
Definition: minwindef.h:175
UINT_PTR WPARAM
Definition: minwindef.h:174
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
#define min(a, b)
Definition: monoChain.cc:55
VOID FASTCALL MsqPostQuitMessage(PTHREADINFO pti, ULONG ExitCode)
Definition: msgqueue.c:1381
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
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
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
UINT FASTCALL co_WinPosGetMinMaxInfo(PWND Window, POINT *MaxSize, POINT *MaxPos, POINT *MinTrack, POINT *MaxTrack)
Definition: winpos.c:940
UINT FASTCALL IntGetWindowSnapEdge(PWND Wnd)
Definition: winpos.c:3931
VOID FASTCALL IntSetSnapEdge(PWND Wnd, UINT Edge)
Definition: winpos.c:4016
#define WS_SYSMENU
Definition: pedump.c:629
#define WS_MINIMIZE
Definition: pedump.c:622
#define WS_EX_TOPMOST
Definition: pedump.c:647
long LONG
Definition: pedump.c:60
__kernel_entry W32KAPI INT APIENTRY NtGdiCombineRgn(_In_ HRGN hrgnDst, _In_ HRGN hrgnSrc1, _In_opt_ HRGN hrgnSrc2, _In_ INT iMode)
#define GreCreateRectRgnIndirect(prc)
Definition: region.h:96
#define TRACE(s)
Definition: solgame.cpp:4
struct _CURICON_OBJECT * spicn
Definition: ntuser.h:585
POINT ptLast
Definition: win32.h:129
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
struct _WND::@5624 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
#define max(a, b)
Definition: svc.c:63
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
#define MAKELONG(a, b)
Definition: typedefs.h:249
uint32_t ULONG
Definition: typedefs.h:59
#define WM_SETVISIBLE
Definition: undocuser.h:33
BOOL FASTCALL co_UserRedrawWindow(PWND Window, const RECTL *UpdateRect, PREGION UpdateRgn, ULONG Flags)
Definition: painting.c:897
VOID FASTCALL UpdateThreadWindows(PWND pWnd, PTHREADINFO pti, HRGN hRgn)
Definition: painting.c:1102
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:918
HDC FASTCALL UserGetDCEx(PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
BOOL NTAPI GreDeleteObject(HGDIOBJ hobj)
Definition: gdiobj.c:1165
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_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
PWND FASTCALL UserGetDesktopWindow(VOID)
Definition: desktop.c:1408
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
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
static UINT GetSnapActivationPoint(PWND Wnd, POINT pt)
Definition: nonclient.c:140
#define ON_BOTTOM_BORDER(hit)
Definition: nonclient.c:31
#define UserHasThickFrameStyle(Style, ExStyle)
Definition: nonclient.c:18
#define ON_TOP_BORDER(hit)
Definition: nonclient.c:29
LONG FASTCALL DefWndStartSizeMove(PWND Wnd, WPARAM wParam, POINT *capturePoint)
Definition: nonclient.c:155
#define ON_RIGHT_BORDER(hit)
Definition: nonclient.c:27
#define ON_LEFT_BORDER(hit)
Definition: nonclient.c:25
VOID FASTCALL UserDrawMovingFrame(HDC hdc, RECTL *rect, BOOL thickframe)
Definition: nonclient.c:56
BOOL FASTCALL UserDereferenceObject(PVOID Object)
Definition: object.c:643
VOID FASTCALL UserReferenceObject(PVOID obj)
Definition: object.c:730
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 IntIsWindowVisible(PWND Wnd)
Definition: window.c:190
#define OBJID_WINDOW
Definition: winable.h:15
#define CHILDID_SELF
Definition: winable.h:14
HICON HCURSOR
Definition: windef.h:99
INT FASTCALL IntMapWindowPoints(PWND FromWnd, PWND ToWnd, LPPOINT lpPoints, UINT cPoints)
Definition: winpos.c:144
VOID FASTCALL IntGetClientRect(PWND WindowObject, RECTL *Rect)
Definition: winpos.c:92
#define RGN_DIFF
Definition: wingdi.h:358
#define RGN_AND
Definition: wingdi.h:356
FORCEINLINE BOOLEAN IntIsWindowSnapped(PWND Wnd)
Definition: winpos.h:95
FORCEINLINE BOOLEAN IntIsSnapAllowedForWindow(PWND Wnd)
Definition: winpos.h:101
#define WS_EX_LAYOUTRTL
Definition: winuser.h:390
#define SC_MOUSEMENU
Definition: winuser.h:2631
#define SWP_NOACTIVATE
Definition: winuser.h:1253
#define WM_SYSCOMMAND
Definition: winuser.h:1769
#define WM_QUIT
Definition: winuser.h:1651
#define DCX_CACHE
Definition: winuser.h:2150
#define SM_CYSCREEN
Definition: winuser.h:971
#define HTCAPTION
Definition: winuser.h:2512
#define VK_UP
Definition: winuser.h:2261
#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 WM_QUERYDRAGICON
Definition: winuser.h:1682
#define WMSZ_LEFT
Definition: winuser.h:2500
#define SC_SIZE
Definition: winuser.h:2620
#define VK_RETURN
Definition: winuser.h:2237
#define HWND_TOP
Definition: winuser.h:1218
#define WS_EX_MDICHILD
Definition: winuser.h:394
#define WM_EXITSIZEMOVE
Definition: winuser.h:1852
#define RDW_ALLCHILDREN
Definition: winuser.h:1232
#define PM_REMOVE
Definition: winuser.h:1207
#define HCBT_MOVESIZE
Definition: winuser.h:55
#define HTBOTTOMRIGHT
Definition: winuser.h:2531
#define HTNOWHERE
Definition: winuser.h:2510
#define SC_MOVE
Definition: winuser.h:2621
#define WM_LBUTTONUP
Definition: winuser.h:1805
#define MSGF_SIZE
Definition: winuser.h:1188
#define VK_LEFT
Definition: winuser.h:2260
#define WM_SIZING
Definition: winuser.h:1835
#define VK_RIGHT
Definition: winuser.h:2262
#define HTTOP
Definition: winuser.h:2526
#define VK_DOWN
Definition: winuser.h:2263
#define MK_LBUTTON
Definition: winuser.h:2403
#define SM_CYSMCAPTION
Definition: winuser.h:1025
#define SM_CXSCREEN
Definition: winuser.h:970
#define WM_KEYDOWN
Definition: winuser.h:1743
#define WM_MOVING
Definition: winuser.h:1837
#define HTSYSMENU
Definition: winuser.h:2513
#define HTLEFT
Definition: winuser.h:2523
#define VK_ESCAPE
Definition: winuser.h:2250
#define SM_CYCAPTION
Definition: winuser.h:974
#define WM_ENTERSIZEMOVE
Definition: winuser.h:1851

Referenced by DefWndHandleSysCommand().

◆ DefWndStartSizeMove()

LONG FASTCALL DefWndStartSizeMove ( PWND  Wnd,
WPARAM  wParam,
POINT capturePoint 
)

Definition at line 155 of file nonclient.c.

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 (msg.message == WM_QUIT)
191 {
192 MsqPostQuitMessage(pti, (ULONG)msg.wParam);
193 return 0;
194 }
195 if (IntCallMsgFilter( &msg, MSGF_SIZE )) continue;
196
197 switch(msg.message)
198 {
199 case WM_MOUSEMOVE:
201 pt.x = min( max( msg.pt.x, rectWindow.left ), rectWindow.right - 1 );
202 pt.y = min( max( msg.pt.y, rectWindow.top ), rectWindow.bottom - 1 );
203 hittest = GetNCHitEx(Wnd, pt);
204 if ((hittest < HTLEFT) || (hittest > HTBOTTOMRIGHT)) hittest = 0;
205 break;
206
207 case WM_LBUTTONUP:
208 return 0;
209
210 case WM_KEYDOWN:
211 switch (msg.wParam)
212 {
213 case VK_UP:
214 hittest = HTTOP;
215 pt.x = (rectWindow.left+rectWindow.right)/2;
216 pt.y = rectWindow.top + UserGetSystemMetrics(SM_CYFRAME) / 2;
217 break;
218 case VK_DOWN:
219 hittest = HTBOTTOM;
220 pt.x = (rectWindow.left+rectWindow.right)/2;
221 pt.y = rectWindow.bottom - UserGetSystemMetrics(SM_CYFRAME) / 2;
222 break;
223 case VK_LEFT:
224 hittest = HTLEFT;
225 pt.x = rectWindow.left + UserGetSystemMetrics(SM_CXFRAME) / 2;
226 pt.y = (rectWindow.top+rectWindow.bottom)/2;
227 break;
228 case VK_RIGHT:
229 hittest = HTRIGHT;
230 pt.x = rectWindow.right - UserGetSystemMetrics(SM_CXFRAME) / 2;
231 pt.y = (rectWindow.top+rectWindow.bottom)/2;
232 break;
233 case VK_RETURN:
234 case VK_ESCAPE:
235 return 0;
236 }
237 break;
238 default:
243 break;
244 }
245 }
246 *capturePoint = pt;
247 }
248 UserSetCursorPos(pt.x, pt.y, 0, 0, FALSE);
250 return hittest;
251}
RECT rect
Definition: combotst.c:67
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
#define WS_MINIMIZEBOX
Definition: pedump.c:631
FLONG TIF_flags
Definition: win32.h:95
DWORD FASTCALL GetNCHitEx(PWND pWnd, POINT pt)
Definition: nonclient.c:1994
#define SM_CYSIZE
Definition: winuser.h:1003
#define HTBOTTOM
Definition: winuser.h:2529
#define SM_CXFRAME
Definition: winuser.h:1005
#define SM_CXSIZE
Definition: winuser.h:1002
#define SM_CYFRAME
Definition: winuser.h:1007
#define HTRIGHT
Definition: winuser.h:2525
#define WM_SETCURSOR
Definition: winuser.h:1664

Referenced by DefWndDoSizeMove().

◆ GetNCHitEx()

DWORD FASTCALL GetNCHitEx ( PWND  pWnd,
POINT  pt 
)

Definition at line 1994 of file nonclient.c.

1995{
1996 RECT rcWindow, rcClient;
1998
1999 if (!pWnd) return HTNOWHERE;
2000
2001 if (UserIsDesktopWindow(pWnd))
2002 {
2003 rcClient.left = rcClient.top = rcWindow.left = rcWindow.top = 0;
2008 }
2009 else
2010 {
2011 rcClient = pWnd->rcClient;
2012 rcWindow = pWnd->rcWindow;
2013 }
2014
2015 if (!RECTL_bPointInRect(&rcWindow, pt.x, pt.y)) return HTNOWHERE;
2016
2017 Style = pWnd->style;
2018 ExStyle = pWnd->ExStyle;
2019
2020 if (Style & WS_MINIMIZE) return HTCAPTION;
2021
2022 if (RECTL_bPointInRect( &rcClient, pt.x, pt.y )) return HTCLIENT;
2023
2024 /* Check borders */
2026 {
2028 if (!RECTL_bPointInRect(&rcWindow, pt.x, pt.y ))
2029 {
2030 /* Check top sizing border */
2031 if (pt.y < rcWindow.top)
2032 {
2033 if (pt.x < rcWindow.left+UserGetSystemMetrics(SM_CXSIZE)) return HTTOPLEFT;
2034 if (pt.x >= rcWindow.right-UserGetSystemMetrics(SM_CXSIZE)) return HTTOPRIGHT;
2035 return HTTOP;
2036 }
2037 /* Check bottom sizing border */
2038 if (pt.y >= rcWindow.bottom)
2039 {
2040 if (pt.x < rcWindow.left+UserGetSystemMetrics(SM_CXSIZE)) return HTBOTTOMLEFT;
2041 if (pt.x >= rcWindow.right-UserGetSystemMetrics(SM_CXSIZE)) return HTBOTTOMRIGHT;
2042 return HTBOTTOM;
2043 }
2044 /* Check left sizing border */
2045 if (pt.x < rcWindow.left)
2046 {
2047 if (pt.y < rcWindow.top+UserGetSystemMetrics(SM_CYSIZE)) return HTTOPLEFT;
2048 if (pt.y >= rcWindow.bottom-UserGetSystemMetrics(SM_CYSIZE)) return HTBOTTOMLEFT;
2049 return HTLEFT;
2050 }
2051 /* Check right sizing border */
2052 if (pt.x >= rcWindow.right)
2053 {
2054 if (pt.y < rcWindow.top+UserGetSystemMetrics(SM_CYSIZE)) return HTTOPRIGHT;
2055 if (pt.y >= rcWindow.bottom-UserGetSystemMetrics(SM_CYSIZE)) return HTBOTTOMRIGHT;
2056 return HTRIGHT;
2057 }
2058 }
2059 }
2060 else /* No thick frame */
2061 {
2062 if (HAS_DLGFRAME( Style, ExStyle ))
2064 else if (HAS_THINFRAME( Style, ExStyle ))
2066 else if (HAS_CLIENTFRAME( Style, ExStyle ))
2068 if (!RECTL_bPointInRect( &rcWindow, pt.x, pt.y )) return HTBORDER;
2069 }
2070
2071 /* Check caption */
2072
2073 if ((Style & WS_CAPTION) == WS_CAPTION)
2074 {
2076 rcWindow.top += UserGetSystemMetrics(SM_CYSMCAPTION) - 1;
2077 else
2078 rcWindow.top += UserGetSystemMetrics(SM_CYCAPTION) - 1;
2079 if (!RECTL_bPointInRect( &rcWindow, pt.x, pt.y ))
2080 {
2081 BOOL min_or_max_box = (Style & WS_SYSMENU) && (Style & (WS_MINIMIZEBOX|WS_MAXIMIZEBOX));
2083 {
2084 /* Check system menu */
2085 if ((Style & WS_SYSMENU) && !(ExStyle & WS_EX_TOOLWINDOW) && NC_IconForWindow(pWnd))
2086 {
2087 rcWindow.right -= UserGetSystemMetrics(SM_CYCAPTION) - 1;
2088 if (pt.x > rcWindow.right) return HTSYSMENU;
2089 }
2090
2091 /* Check close button */
2092 if (Style & WS_SYSMENU)
2093 {
2095 if (pt.x < rcWindow.left) return HTCLOSE;
2096 }
2097
2098 /* Check maximize box */
2099 /* In Win95 there is automatically a Maximize button when there is a minimize one */
2100 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2101 {
2102 rcWindow.left += UserGetSystemMetrics(SM_CXSIZE);
2103 if (pt.x < rcWindow.left) return HTMAXBUTTON;
2104 }
2105
2106 /* Check minimize box */
2107 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2108 {
2109 rcWindow.left += UserGetSystemMetrics(SM_CXSIZE);
2110 if (pt.x < rcWindow.left) return HTMINBUTTON;
2111 }
2112 }
2113 else
2114 {
2115 /* Check system menu */
2116 if ((Style & WS_SYSMENU) && !(ExStyle & WS_EX_TOOLWINDOW) && NC_IconForWindow(pWnd))
2117 {
2118 rcWindow.left += UserGetSystemMetrics(SM_CYCAPTION) - 1;
2119 if (pt.x < rcWindow.left) return HTSYSMENU;
2120 }
2121
2122 /* Check close button */
2123 if (Style & WS_SYSMENU)
2124 {
2126 if (pt.x > rcWindow.right) return HTCLOSE;
2127 }
2128
2129 /* Check maximize box */
2130 /* In Win95 there is automatically a Maximize button when there is a minimize one */
2131 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2132 {
2134 if (pt.x > rcWindow.right) return HTMAXBUTTON;
2135 }
2136
2137 /* Check minimize box */
2138 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2139 {
2141 if (pt.x > rcWindow.right) return HTMINBUTTON;
2142 }
2143 }
2144 return HTCAPTION;
2145 }
2146 }
2147
2148 /* Check menu bar */
2149
2150 if (HAS_MENU( pWnd, Style ) && (pt.y < rcClient.top) &&
2151 (pt.x >= rcClient.left) && (pt.x < rcClient.right))
2152 return HTMENU;
2153
2154 /* Check vertical scroll bar */
2155
2157 if (Style & WS_VSCROLL)
2158 {
2159 if((ExStyle & WS_EX_LEFTSCROLLBAR) != 0)
2161 else
2163 if (RECTL_bPointInRect( &rcClient, pt.x, pt.y )) return HTVSCROLL;
2164 }
2165
2166 /* Check horizontal scroll bar */
2167
2168 if (Style & WS_HSCROLL)
2169 {
2171 if (RECTL_bPointInRect( &rcClient, pt.x, pt.y ))
2172 {
2173 /* Check size box */
2174 if ((Style & WS_VSCROLL) &&
2175 ((((ExStyle & WS_EX_LEFTSCROLLBAR) != 0) && (pt.x <= rcClient.left + UserGetSystemMetrics(SM_CXVSCROLL))) ||
2176 (((ExStyle & WS_EX_LEFTSCROLLBAR) == 0) && (pt.x >= rcClient.right - UserGetSystemMetrics(SM_CXVSCROLL)))))
2177 return HTSIZE;
2178 return HTHSCROLL;
2179 }
2180 }
2181
2182 /* Has to return HTNOWHERE if nothing was found
2183 Could happen when a window has a customized non client area */
2184 return HTNOWHERE;
2185}
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:194
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WS_CAPTION
Definition: pedump.c:624
#define WS_VSCROLL
Definition: pedump.c:627
#define WS_HSCROLL
Definition: pedump.c:628
RECT rcClient
Definition: ntuser.h:717
#define HAS_MENU(hwnd, style)
Definition: uxthemep.h:248
VOID FASTCALL RECTL_vInflateRect(_Inout_ RECTL *rect, _In_ INT dx, _In_ INT dy)
Definition: rect.c:101
FORCEINLINE BOOL RECTL_bPointInRect(_In_ const RECTL *prcl, _In_ INT x, _In_ INT y)
Definition: rect.h:52
PCURICON_OBJECT FASTCALL NC_IconForWindow(PWND pWnd)
Definition: nonclient.c:746
#define HAS_DLGFRAME(Style, ExStyle)
Definition: window.h:9
#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
#define HTTOPRIGHT
Definition: winuser.h:2528
#define HTCLOSE
Definition: winuser.h:2535
#define SM_CYEDGE
Definition: winuser.h:1020
#define SM_CXEDGE
Definition: winuser.h:1019
#define HTTOPLEFT
Definition: winuser.h:2527
#define SM_CXVSCROLL
Definition: winuser.h:972
#define HTBORDER
Definition: winuser.h:2533
#define HTVSCROLL
Definition: winuser.h:2518
#define HTHSCROLL
Definition: winuser.h:2517
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define HTMAXBUTTON
Definition: winuser.h:2520
#define SM_CYHSCROLL
Definition: winuser.h:973
#define HTMENU
Definition: winuser.h:2516
#define SM_CYBORDER
Definition: winuser.h:976
#define SM_CXBORDER
Definition: winuser.h:975
#define HTCLIENT
Definition: winuser.h:2511
#define SM_CXDLGFRAME
Definition: winuser.h:977
#define HTSIZE
Definition: winuser.h:2515
#define HTBOTTOMLEFT
Definition: winuser.h:2530
#define SM_CYDLGFRAME
Definition: winuser.h:979
#define WS_EX_LEFTSCROLLBAR
Definition: winuser.h:392
#define HTMINBUTTON
Definition: winuser.h:2519

Referenced by DefWndStartSizeMove(), IntDefWindowProc(), MENU_PtMenu(), MENU_TrackMenu(), NC_DoButton(), and NC_HandleNCRButtonDown().

◆ GetSnapActivationPoint()

static UINT GetSnapActivationPoint ( PWND  Wnd,
POINT  pt 
)
static

Definition at line 140 of file nonclient.c.

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}
#define GetSnapSetting(gspvmember)
Definition: winpos.h:80

Referenced by DefWndDoSizeMove().

◆ IntIsScrollBarVisible()

BOOL IntIsScrollBarVisible ( PWND  pWnd,
INT  hBar 
)

Definition at line 800 of file nonclient.c.

801{
803 sbi.cbSize = sizeof(SCROLLBARINFO);
804
805 if(!co_IntGetScrollBarInfo(pWnd, hBar, &sbi))
806 return FALSE;
807
808 return !(sbi.rgstate[0] & STATE_SYSTEM_OFFSCREEN);
809}
static SYSTEM_BASIC_INFORMATION sbi
Definition: virtual.c:53
BOOL FASTCALL co_IntGetScrollBarInfo(PWND, LONG, PSCROLLBARINFO)
Definition: scrollbar.c:671
#define STATE_SYSTEM_OFFSCREEN
Definition: winuser.h:2985
struct tagSCROLLBARINFO SCROLLBARINFO

Referenced by NC_DoNCPaint().

◆ NC_DoButton()

VOID NC_DoButton ( PWND  pWnd,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1504 of file nonclient.c.

1505{
1506 MSG Msg;
1507 HDC WindowDC;
1508 BOOL Pressed = TRUE, OldState;
1509 WPARAM SCMsg;
1510 PMENU SysMenu;
1511 ULONG ButtonType;
1512 DWORD Style;
1513 UINT MenuState;
1514
1515 Style = pWnd->style;
1516 switch (wParam)
1517 {
1518 case HTCLOSE:
1519 SysMenu = IntGetSystemMenu(pWnd, FALSE);
1520 MenuState = IntGetMenuState(SysMenu ? UserHMGetHandle(SysMenu) : NULL, SC_CLOSE, MF_BYCOMMAND); /* in case of error MenuState==0xFFFFFFFF */
1521 if (!(Style & WS_SYSMENU) || (MenuState & (MF_GRAYED|MF_DISABLED)) || (pWnd->pcls->style & CS_NOCLOSE))
1522 return;
1523 ButtonType = DFCS_CAPTIONCLOSE;
1524 SCMsg = SC_CLOSE;
1525 break;
1526 case HTMINBUTTON:
1527 if (!(Style & WS_MINIMIZEBOX))
1528 return;
1529 ButtonType = DFCS_CAPTIONMIN;
1530 SCMsg = ((Style & WS_MINIMIZE) ? SC_RESTORE : SC_MINIMIZE);
1531 break;
1532 case HTMAXBUTTON:
1533 if (!(Style & WS_MAXIMIZEBOX))
1534 return;
1535 ButtonType = DFCS_CAPTIONMAX;
1536 SCMsg = ((Style & WS_MAXIMIZE) ? SC_RESTORE : SC_MAXIMIZE);
1537 break;
1538
1539 default:
1540 ASSERT(FALSE);
1541 return;
1542 }
1543
1544 /*
1545 * FIXME: Not sure where to do this, but we must flush the pending
1546 * window updates when someone clicks on the close button and at
1547 * the same time the window is overlapped with another one. This
1548 * looks like a good place for now...
1549 */
1551
1552 WindowDC = UserGetWindowDC(pWnd);
1553 UserDrawCaptionButtonWnd(pWnd, WindowDC, TRUE, ButtonType);
1554
1556
1557 for (;;)
1558 {
1560 if (IntCallMsgFilter( &Msg, MSGF_MAX )) continue;
1561
1562 if (Msg.message == WM_LBUTTONUP)
1563 break;
1564
1565 if (Msg.message != WM_MOUSEMOVE)
1566 continue;
1567
1568 OldState = Pressed;
1569 Pressed = (GetNCHitEx(pWnd, Msg.pt) == wParam);
1570 if (Pressed != OldState)
1571 UserDrawCaptionButtonWnd(pWnd, WindowDC, Pressed, ButtonType);
1572 }
1573
1574 if (Pressed)
1575 UserDrawCaptionButtonWnd(pWnd, WindowDC, FALSE, ButtonType);
1577 UserReleaseDC(pWnd, WindowDC, FALSE);
1578 if (Pressed)
1579 co_IntSendMessage(UserHMGetHandle(pWnd), WM_SYSCOMMAND, SCMsg, SCMsg == SC_CLOSE ? lParam : MAKELONG(Msg.pt.x,Msg.pt.y));
1580}
LPARAM lParam
Definition: combotst.c:139
struct @1777 Msg[]
#define ASSERT(a)
Definition: mode.c:44
UINT style
Definition: ntuser.h:580
VOID FASTCALL co_IntUpdateWindows(PWND Wnd, ULONG Flags, BOOL Recurse)
Definition: painting.c:521
HDC FASTCALL UserGetWindowDC(PWND Wnd)
Definition: windc.c:947
PMENU FASTCALL IntGetSystemMenu(PWND Window, BOOL bRevert)
Definition: menu.c:5409
UINT FASTCALL IntGetMenuState(HMENU hMenu, UINT uId, UINT uFlags)
Definition: menu.c:5001
VOID UserDrawCaptionButtonWnd(PWND pWnd, HDC hDC, BOOL bDown, ULONG Type)
Definition: nonclient.c:900
#define MF_BYCOMMAND
Definition: winuser.h:202
#define WM_MOUSEFIRST
Definition: winuser.h:1802
#define WM_MOUSELAST
Definition: winuser.h:1829
#define DFCS_CAPTIONMIN
Definition: winuser.h:481
#define DFCS_CAPTIONCLOSE
Definition: winuser.h:480
#define SC_MINIMIZE
Definition: winuser.h:2622
#define SC_CLOSE
Definition: winuser.h:2628
#define MSGF_MAX
Definition: winuser.h:1193
#define DFCS_CAPTIONMAX
Definition: winuser.h:482
#define SC_RESTORE
Definition: winuser.h:2634
#define CS_NOCLOSE
Definition: winuser.h:662
#define SC_MAXIMIZE
Definition: winuser.h:2624
#define MF_GRAYED
Definition: winuser.h:129
#define MF_DISABLED
Definition: winuser.h:130

Referenced by NC_HandleNCLButtonDown().

◆ NC_DoNCActive()

static INT NC_DoNCActive ( PWND  Wnd)
static

Definition at line 1429 of file nonclient.c.

1430{
1431 INT Ret = 0;
1432
1435 Ret = DC_CAPTION;
1436
1437 if (!(Wnd->style & WS_MINIMIZED) && UserHasThickFrameStyle(Wnd->style, Wnd->ExStyle))
1438 {
1439 //if (IntGetSysColor(COLOR_ACTIVEBORDER) != IntGetSysColor(COLOR_INACTIVEBORDER)) // Why are these the same?
1440 {
1441 Ret = DC_FRAME;
1442 }
1443 }
1444 return Ret;
1445}
DWORD FASTCALL IntGetSysColor(INT nIndex)
Definition: stockobj.c:323
int32_t INT
Definition: typedefs.h:58
#define DC_FRAME
Definition: undocuser.h:150
#define WS_MINIMIZED
Definition: undocuser.h:20
#define COLOR_INACTIVECAPTIONTEXT
Definition: winuser.h:945
#define COLOR_ACTIVECAPTION
Definition: winuser.h:926
#define DC_CAPTION
Definition: winuser.h:439
#define COLOR_INACTIVECAPTION
Definition: winuser.h:927
#define COLOR_CAPTIONTEXT
Definition: winuser.h:933

Referenced by NC_HandleNCActivate().

◆ NC_DoNCPaint()

LRESULT NC_DoNCPaint ( PWND  pWnd,
HDC  hDC,
INT  Flags 
)

Definition at line 1107 of file nonclient.c.

1108{
1110 PWND Parent;
1111 RECT WindowRect, CurrentRect, TempRect;
1112 BOOL Active = FALSE;
1113
1114 if (!IntIsWindowVisible(pWnd) ||
1115 (pWnd->state & WNDS_NONCPAINT && !(pWnd->state & WNDS_FORCEMENUDRAW)) ||
1116 IntEqualRect(&pWnd->rcWindow, &pWnd->rcClient) )
1117 return 0;
1118
1119 Style = pWnd->style;
1120
1121 TRACE("DefWndNCPaint: pWnd %p, hDc %p, Active %s.\n", pWnd, hDC, Flags & DC_ACTIVE ? "TRUE" : "FALSE");
1122
1123 Parent = IntGetParent(pWnd);
1124 ExStyle = pWnd->ExStyle;
1125
1126 if (Flags == -1) // NC paint mode.
1127 {
1128 if (ExStyle & WS_EX_MDICHILD)
1129 {
1131
1132 if (Active)
1134 }
1135 else
1136 {
1137 Active = (gpqForeground == pWnd->head.pti->MessageQueue);
1138 }
1139 Flags = DC_NC; // Redraw everything!
1140 }
1141 else
1142 Flags |= DC_NC;
1143
1144
1145 IntGetWindowRect(pWnd, &WindowRect);
1146
1147 CurrentRect.top = CurrentRect.left = 0;
1148 CurrentRect.right = WindowRect.right - WindowRect.left;
1149 CurrentRect.bottom = WindowRect.bottom - WindowRect.top;
1150
1151 /* Draw outer edge */
1152 if (UserHasWindowEdge(pWnd->style, pWnd->ExStyle))
1153 {
1154 DrawEdge(hDC, &CurrentRect, EDGE_RAISED, BF_RECT | BF_ADJUST);
1155 }
1156 else if (pWnd->ExStyle & WS_EX_STATICEDGE)
1157 {
1158#if 0
1159 DrawEdge(hDC, &CurrentRect, BDR_SUNKENINNER, BF_RECT | BF_ADJUST | BF_FLAT);
1160#else
1162 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.top, CurrentRect.right - CurrentRect.left, 1, PATCOPY);
1163 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY);
1164
1166 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.bottom - 1, CurrentRect.right - CurrentRect.left, 1, PATCOPY);
1167 NtGdiPatBlt(hDC, CurrentRect.right - 1, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY);
1168
1169 RECTL_vInflateRect(&CurrentRect, -1, -1);
1170#endif
1171 }
1172
1173 if (Flags & DC_FRAME) NC_DrawFrame(hDC, &CurrentRect, Active ? Active : (Flags & DC_ACTIVE), Style, ExStyle);
1174
1175 /* Draw caption */
1176 if ((Style & WS_CAPTION) == WS_CAPTION)
1177 {
1178 HPEN PreviousPen;
1179 BOOL Gradient = FALSE;
1180
1181 if (Flags & DC_REDRAWHUNGWND)
1182 {
1183 Flags &= ~DC_REDRAWHUNGWND;
1185 }
1186
1187 if (UserSystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &Gradient, 0) && Gradient)
1188 {
1189 Flags |= DC_GRADIENT;
1190 }
1191
1192 if (Active)
1193 {
1194 if (pWnd->state & WNDS_ACTIVEFRAME)
1195 Flags |= DC_ACTIVE;
1196 else
1197 {
1198 ERR("Wnd is active and not set active!\n");
1199 }
1200 }
1201
1202 TempRect = CurrentRect;
1203
1205 {
1206 Flags |= DC_SMALLCAP;
1207 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSMCAPTION) - 1;
1208 CurrentRect.top += UserGetSystemMetrics(SM_CYSMCAPTION);
1209 }
1210 else
1211 {
1212 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYCAPTION) - 1;
1213 CurrentRect.top += UserGetSystemMetrics(SM_CYCAPTION);
1214 }
1215
1216 UserDrawCaption(pWnd, hDC, &TempRect, NULL, NULL, NULL, Flags);
1217
1218 /* Draw buttons */
1219 if (Style & WS_SYSMENU)
1220 {
1223 {
1226 }
1227 }
1228 if (!(Style & WS_MINIMIZE))
1229 {
1230 /* Line under caption */
1231 PreviousPen = NtGdiSelectPen(hDC, NtGdiGetStockObject(DC_PEN));
1232
1236
1237 GreMoveTo(hDC, TempRect.left, TempRect.bottom, NULL);
1238
1239 NtGdiLineTo(hDC, TempRect.right, TempRect.bottom);
1240
1241 NtGdiSelectPen(hDC, PreviousPen);
1242 }
1243 }
1244
1245 if (!(Style & WS_MINIMIZE))
1246 {
1247 /* Draw menu bar */
1248 if (pWnd->state & WNDS_HASMENU && pWnd->IDMenu) // Should be pWnd->spmenu
1249 {
1250 if (!(Flags & DC_NOSENDMSG))
1251 {
1252 PMENU menu;
1253 // Fix crash in test_menu_locked_by_window, should use pWnd->spmenu....
1254 if ((menu = UserGetMenuObject(UlongToHandle(pWnd->IDMenu)))) // FIXME! Use pWnd->spmenu,
1255 {
1256 TempRect = CurrentRect;
1257 TempRect.bottom = TempRect.top + menu->cyMenu; // Should be pWnd->spmenu->cyMenu;
1258 CurrentRect.top += MENU_DrawMenuBar(hDC, &TempRect, pWnd, FALSE);
1259 }
1260 }
1261 }
1262
1264 {
1265 DrawEdge(hDC, &CurrentRect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
1266 }
1267
1268 /* Draw the scrollbars */
1269 if ((Style & WS_VSCROLL) && (Style & WS_HSCROLL) &&
1271 {
1272 RECT ParentClientRect;
1273
1274 TempRect = CurrentRect;
1275
1277 TempRect.right = TempRect.left + UserGetSystemMetrics(SM_CXVSCROLL);
1278 else
1279 TempRect.left = TempRect.right - UserGetSystemMetrics(SM_CXVSCROLL);
1280
1281 TempRect.top = TempRect.bottom - UserGetSystemMetrics(SM_CYHSCROLL);
1282
1284
1285 if (Parent)
1286 {
1287 IntGetClientRect(Parent, &ParentClientRect);
1288
1289 if (HASSIZEGRIP(Style, ExStyle, Parent->style, WindowRect, ParentClientRect))
1290 {
1292 }
1293 }
1294
1297 }
1298 else
1299 {
1301 {
1303 }
1305 {
1307 }
1308 }
1309 }
1310 return 0; // For WM_NCPAINT message, return 0.
1311}
static HDC hDC
Definition: 3dtext.c:33
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
#define UlongToHandle(ul)
Definition: basetsd.h:91
#define DC_ACTIVE
Definition: dc21x4.h:120
COLORREF FASTCALL IntSetDCPenColor(HDC, COLORREF)
Definition: dcutil.c:259
HANDLE HWND
Definition: compat.h:19
static BOOL UserHasWindowEdge(DWORD Style, DWORD ExStyle)
Definition: nonclient.c:46
PUSER_MESSAGE_QUEUE gpqForeground
Definition: focus.c:13
#define WNDS_ACTIVEFRAME
Definition: ntuser.h:611
#define WNDS_NONCPAINT
Definition: ntuser.h:613
#define WNDS_HASMENU
Definition: ntuser.h:605
#define WNDS_FORCEMENUDRAW
Definition: ntuser.h:620
HGDIOBJ FASTCALL IntGetSysColorBrush(INT Object)
Definition: stockobj.c:317
BOOL FASTCALL GreMoveTo(HDC hdc, INT x, INT y, LPPOINT pptOut)
Definition: line.c:110
#define menu
Definition: input.c:3282
BOOL FASTCALL IntGetWindowRect(PWND Wnd, RECTL *Rect)
Definition: winpos.c:121
__kernel_entry W32KAPI HBRUSH APIENTRY NtGdiSelectBrush(_In_ HDC hdc, _In_ HBRUSH hbrush)
__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)
void IntDrawScrollBar(PWND, HDC, INT)
Definition: scrollbar.c:1083
DWORD state
Definition: ntuser.h:701
UINT_PTR IDMenu
Definition: ntuser.h:731
#define DC_NOSENDMSG
Definition: undocuser.h:149
#define DC_REDRAWHUNGWND
Definition: undocuser.h:153
BOOL UserDrawCaption(PWND pWnd, HDC hDc, RECTL *lpRc, HFONT hFont, HICON hIcon, const PUNICODE_STRING Str, UINT uFlags)
Definition: painting.c:2191
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:3
#define HASSIZEGRIP(Style, ExStyle, ParentStyle, WindowRect, ParentClientRect)
Definition: uxthemep.h:242
UINT MENU_DrawMenuBar(HDC hDC, LPRECT lprect, PWND pWnd, BOOL suppress_draw)
Definition: menu.c:2742
BOOL IntIsScrollBarVisible(PWND pWnd, INT hBar)
Definition: nonclient.c:800
VOID UserDrawCaptionButton(PWND pWnd, LPRECT Rect, DWORD Style, DWORD ExStyle, HDC hDC, BOOL bDown, ULONG Type)
Definition: nonclient.c:818
VOID NC_DrawFrame(HDC hDC, RECT *CurrentRect, BOOL Active, DWORD Style, DWORD ExStyle)
Definition: nonclient.c:919
BOOL FASTCALL IntIsChildWindow(PWND Parent, PWND BaseWindow)
Definition: window.c:929
#define OBJID_VSCROLL
Definition: winable.h:20
#define OBJID_HSCROLL
Definition: winable.h:21
#define PATCOPY
Definition: wingdi.h:335
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
FORCEINLINE BOOL IntEqualRect(RECTL *lprc1, RECTL *lprc2)
Definition: winpos.h:48
#define BDR_SUNKENINNER
Definition: winuser.h:445
#define WS_EX_STATICEDGE
Definition: winuser.h:403
#define DFC_SCROLL
Definition: winuser.h:475
#define EDGE_SUNKEN
Definition: winuser.h:451
#define COLOR_WINDOWFRAME
Definition: winuser.h:930
BOOL WINAPI DrawFrameControl(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define SB_VERT
Definition: winuser.h:553
#define DFCS_SCROLLSIZEGRIP
Definition: winuser.h:494
#define BF_ADJUST
Definition: winuser.h:470
#define BF_FLAT
Definition: winuser.h:471
#define DC_NC
Definition: winuser.h:440
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define COLOR_BTNSHADOW
Definition: winuser.h:941
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define WM_MDIGETACTIVE
Definition: winuser.h:1849
#define DC_SMALLCAP
Definition: winuser.h:428
#define COLOR_BTNHIGHLIGHT
Definition: winuser.h:946
#define BF_RECT
Definition: winuser.h:462
#define EDGE_RAISED
Definition: winuser.h:450
#define SB_HORZ
Definition: winuser.h:552
#define COLOR_BTNFACE
Definition: winuser.h:939
#define COLOR_3DFACE
Definition: winuser.h:940
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
_In_ ULONG _In_ BOOLEAN Active
Definition: potypes.h:564

Referenced by IntDefWindowProc(), NC_HandleNCActivate(), NtUserDrawCaptionTemp(), and PaintSuspendedWindow().

◆ NC_DrawFrame()

VOID NC_DrawFrame ( HDC  hDC,
RECT CurrentRect,
BOOL  Active,
DWORD  Style,
DWORD  ExStyle 
)

Definition at line 919 of file nonclient.c.

920{
921 /* Firstly the "thick" frame */
922 if ((Style & WS_THICKFRAME) && !(Style & WS_MINIMIZE))
923 {
924 LONG Width =
927
928 LONG Height =
931
933
934 /* Draw frame */
935 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, CurrentRect->right - CurrentRect->left, Height, PATCOPY);
936 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
937 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->bottom, CurrentRect->right - CurrentRect->left, -Height, PATCOPY);
938 NtGdiPatBlt(hDC, CurrentRect->right, CurrentRect->top, -Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
939
940 RECTL_vInflateRect(CurrentRect, -Width, -Height);
941 }
942
943 /* Now the other bit of the frame */
945 {
948
954
955 /* Draw frame */
956 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, CurrentRect->right - CurrentRect->left, Height, PATCOPY);
957 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
958 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->bottom, CurrentRect->right - CurrentRect->left, -Height, PATCOPY);
959 NtGdiPatBlt(hDC, CurrentRect->right, CurrentRect->top, -Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
960
961 RECTL_vInflateRect(CurrentRect, -Width, -Height);
962 }
963}
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:89
_In_ HFONT _Out_ PUINT Height
Definition: font.h:88
#define COLOR_ACTIVEBORDER
Definition: winuser.h:934
#define COLOR_INACTIVEBORDER
Definition: winuser.h:935

Referenced by NC_DoNCPaint(), and UserDrawCaptionBar().

◆ NC_GetInsideRect()

void FASTCALL NC_GetInsideRect ( PWND  Wnd,
RECT rect 
)

Definition at line 71 of file nonclient.c.

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}
#define WS_ICONIC
Definition: pedump.c:641
#define UserHasDlgFrameStyle(Style, ExStyle)
Definition: nonclient.c:14
#define UserHasThinFrameStyle(Style, ExStyle)
Definition: nonclient.c:22

Referenced by MENU_DrawMenuItem(), NC_GetSysPopupPos(), and NC_HandleNCLButtonDown().

◆ NC_GetSysPopupPos()

void FASTCALL NC_GetSysPopupPos ( PWND  Wnd,
RECT Rect 
)

Definition at line 117 of file nonclient.c.

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}
BOOL FASTCALL IntClientToScreen(PWND Wnd, LPPOINT lpPoint)
Definition: winpos.c:199
void FASTCALL NC_GetInsideRect(PWND Wnd, RECT *rect)
Definition: nonclient.c:71

Referenced by MENU_ShowSubPopup().

◆ NC_HandleNCActivate()

LRESULT NC_HandleNCActivate ( PWND  Wnd,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1447 of file nonclient.c.

1448{
1449 INT Flags;
1450 /* Lotus Notes draws menu descriptions in the caption of its main
1451 * window. When it wants to restore original "system" view, it just
1452 * sends WM_NCACTIVATE message to itself. Any optimizations here in
1453 * attempt to minimize redrawings lead to a not restored caption.
1454 */
1455 if (wParam & DC_ACTIVE)
1456 {
1459 }
1460 else
1461 {
1462 Wnd->state &= ~WNDS_ACTIVEFRAME;
1464 }
1465
1466 if ((Wnd->state & WNDS_NONCPAINT) || !(Wnd->style & WS_VISIBLE))
1467 return TRUE;
1468
1469 /* This isn't documented but is reproducible in at least XP SP2 and
1470 * Outlook 2007 depends on it
1471 */
1472 // MSDN:
1473 // If this parameter is set to -1, DefWindowProc does not repaint the
1474 // nonclient area to reflect the state change.
1475 if ( lParam != -1 &&
1476 ( Flags = NC_DoNCActive(Wnd)) != 0 )
1477 {
1478 HDC hDC;
1479 HRGN hRgnTemp = NULL, hRgn = (HRGN)lParam;
1480
1482 {
1483 hRgnTemp = NtGdiCreateRectRgn(0, 0, 0, 0);
1484 if (NtGdiCombineRgn(hRgnTemp, hRgn, 0, RGN_COPY) == ERROR)
1485 {
1486 GreDeleteObject(hRgnTemp);
1487 hRgnTemp = NULL;
1488 }
1489 }
1490
1491 if ((hDC = UserGetDCEx(Wnd, hRgnTemp, DCX_WINDOW|DCX_USESTYLE)))
1492 {
1493 NC_DoNCPaint(Wnd, hDC, wParam | Flags); // Redraw MENUs.
1494 UserReleaseDC(Wnd, hDC, FALSE);
1495 }
1496 else
1497 GreDeleteObject(hRgnTemp);
1498 }
1499
1500 return TRUE;
1501}
#define DCX_USESTYLE
Definition: GetDCEx.c:10
#define ERROR(name)
Definition: error_private.h:53
#define WNDS_HASCAPTION
Definition: ntuser.h:608
static HRGN hRgn
Definition: mapping.c:32
#define WS_VISIBLE
Definition: pedump.c:620
__kernel_entry W32KAPI HRGN APIENTRY NtGdiCreateRectRgn(_In_ INT xLeft, _In_ INT yTop, _In_ INT xRight, _In_ INT yBottom)
BOOL NTAPI GreIsHandleValid(HGDIOBJ hobj)
Definition: gdiobj.c:1153
LRESULT NC_DoNCPaint(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:1107
static INT NC_DoNCActive(PWND Wnd)
Definition: nonclient.c:1429
#define RGN_COPY
Definition: wingdi.h:357
#define DCX_WINDOW
Definition: winuser.h:2149

Referenced by IntDefWindowProc().

◆ NC_HandleNCCalcSize()

LRESULT NC_HandleNCCalcSize ( PWND  Wnd,
WPARAM  wparam,
RECTL Rect,
BOOL  Suspended 
)

Definition at line 1313 of file nonclient.c.

1314{
1315 LRESULT Result = 0;
1316 SIZE WindowBorders;
1317 RECT OrigRect;
1318 LONG Style = Wnd->style;
1319 LONG exStyle = Wnd->ExStyle;
1320
1321 if (Rect == NULL)
1322 {
1323 return Result;
1324 }
1325 OrigRect = *Rect;
1326
1327 Wnd->state &= ~WNDS_HASCAPTION;
1328
1329 if (wparam)
1330 {
1331 if (Wnd->pcls->style & CS_VREDRAW)
1332 {
1334 }
1335 if (Wnd->pcls->style & CS_HREDRAW)
1336 {
1338 }
1340 }
1341
1342 if (!(Wnd->style & WS_MINIMIZE))
1343 {
1344 if (UserHasWindowEdge(Wnd->style, Wnd->ExStyle))
1345 {
1346 UserGetWindowBorders(Wnd->style, Wnd->ExStyle, &WindowBorders, FALSE);
1347 RECTL_vInflateRect(Rect, -WindowBorders.cx, -WindowBorders.cy);
1348 }
1349 else if ((Wnd->ExStyle & WS_EX_STATICEDGE) || (Wnd->style & WS_BORDER))
1350 {
1351 RECTL_vInflateRect(Rect, -1, -1);
1352 }
1353
1354 if ((Wnd->style & WS_CAPTION) == WS_CAPTION)
1355 {
1356 Wnd->state |= WNDS_HASCAPTION;
1357
1358 if (Wnd->ExStyle & WS_EX_TOOLWINDOW)
1360 else
1362 }
1363
1364 if (HAS_MENU(Wnd, Style))
1365 {
1367
1368 Wnd->state |= WNDS_HASMENU;
1369
1370 if (hDC)
1371 {
1372 RECT CliRect = *Rect;
1373 CliRect.bottom -= OrigRect.top;
1374 CliRect.right -= OrigRect.left;
1375 CliRect.left -= OrigRect.left;
1376 CliRect.top -= OrigRect.top;
1377 if (!Suspended) Rect->top += MENU_DrawMenuBar(hDC, &CliRect, Wnd, TRUE);
1378 UserReleaseDC(Wnd, hDC, FALSE);
1379 }
1380 }
1381
1382 if (Wnd->ExStyle & WS_EX_CLIENTEDGE)
1383 {
1385 }
1386
1387 if (Style & WS_VSCROLL)
1388 {
1389 if (Rect->right - Rect->left >= UserGetSystemMetrics(SM_CXVSCROLL))
1390 {
1392
1393 /* rectangle is in screen coords when wparam is false */
1394 if (!wparam && (exStyle & WS_EX_LAYOUTRTL)) exStyle ^= WS_EX_LEFTSCROLLBAR;
1395
1396 if((exStyle & WS_EX_LEFTSCROLLBAR) != 0)
1398 else
1400 }
1401 }
1402
1403 if (Style & WS_HSCROLL)
1404 {
1405 if( Rect->bottom - Rect->top > UserGetSystemMetrics(SM_CYHSCROLL))
1406 {
1408
1410 }
1411 }
1412
1413 if (Rect->top > Rect->bottom)
1414 Rect->bottom = Rect->top;
1415
1416 if (Rect->left > Rect->right)
1417 Rect->right = Rect->left;
1418 }
1419 else
1420 {
1421 Rect->right = Rect->left;
1422 Rect->bottom = Rect->top;
1423 }
1424
1425 return Result;
1426}
@ wparam
Definition: SystemMenu.c:30
#define WNDS_HASHORIZONTALSCROLLBAR
Definition: ntuser.h:607
#define WNDS_HASVERTICALSCROOLLBAR
Definition: ntuser.h:606
LONG_PTR LRESULT
Definition: minwindef.h:176
VOID UserGetWindowBorders(DWORD Style, DWORD ExStyle, SIZE *Size, BOOL WithClient)
Definition: winpos.c:894
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
#define CS_VREDRAW
Definition: winuser.h:666
#define WVR_VALIDRECTS
Definition: winuser.h:2558
#define CS_HREDRAW
Definition: winuser.h:661
#define WVR_VREDRAW
Definition: winuser.h:2556
#define WVR_HREDRAW
Definition: winuser.h:2555
_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
@ Suspended
Definition: ketypes.h:472

Referenced by IntDefWindowProc().

◆ NC_HandleNCLButtonDblClk()

LRESULT NC_HandleNCLButtonDblClk ( PWND  pWnd,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1676 of file nonclient.c.

1677{
1678 ULONG Style;
1679
1680 Style = pWnd->style;
1681 switch(wParam)
1682 {
1683 case HTCAPTION:
1684 {
1685 /* Maximize/Restore the window */
1687 {
1689 }
1690 break;
1691 }
1692 case HTSYSMENU:
1693 {
1694 PMENU SysMenu = IntGetSystemMenu(pWnd, FALSE);
1696
1697 /* If the close item of the sysmenu is disabled or not present do nothing */
1698 if ((state & (MF_DISABLED | MF_GRAYED)) || (state == 0xFFFFFFFF))
1699 break;
1700
1702 break;
1703 }
1704 case HTTOP:
1705 case HTBOTTOM:
1706 {
1707 RECT sizingRect = pWnd->rcWindow, mouseRect;
1708
1709 if (pWnd->ExStyle & WS_EX_MDICHILD)
1710 break;
1711
1712 UserSystemParametersInfo(SPI_GETWORKAREA, 0, &mouseRect, 0);
1713
1715 NULL,
1716 sizingRect.left,
1717 mouseRect.top,
1718 sizingRect.right - sizingRect.left,
1719 mouseRect.bottom - mouseRect.top,
1720 0);
1721 break;
1722 }
1723 default:
1724 return NC_HandleNCLButtonDown(pWnd, wParam, lParam);
1725 }
1726 return(0);
1727}
static int state
Definition: maze.c:121
LRESULT NC_HandleNCLButtonDown(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1584

Referenced by IntDefWindowProc().

◆ NC_HandleNCLButtonDown()

LRESULT NC_HandleNCLButtonDown ( PWND  pWnd,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1584 of file nonclient.c.

1585{
1586 switch (wParam)
1587 {
1588 case HTCAPTION:
1589 {
1590 PWND TopWnd = pWnd, parent;
1591 while(1)
1592 {
1593 if ((TopWnd->style & (WS_POPUP|WS_CHILD)) != WS_CHILD)
1594 break;
1595 parent = UserGetAncestor( TopWnd, GA_PARENT );
1596 if (!parent || UserIsDesktopWindow(parent)) break;
1597 TopWnd = parent;
1598 }
1599
1600 if ( (pWnd && (pWnd->ExStyle & WS_EX_NOACTIVATE)) ||
1602 //NtUserCallHwndLock(hTopWnd, HWNDLOCK_ROUTINE_SETFOREGROUNDWINDOWMOUSE) ||
1604 {
1606 }
1607 break;
1608 }
1609 case HTSYSMENU:
1610 {
1611 LONG style = pWnd->style;
1612 if (style & WS_SYSMENU)
1613 {
1614 if(!(style & WS_MINIMIZE) )
1615 {
1616 RECT rect;
1617 HDC hDC = UserGetWindowDC(pWnd);
1618 NC_GetInsideRect(pWnd, &rect);
1620 UserReleaseDC( pWnd, hDC, FALSE );
1621 }
1623 }
1624 break;
1625 }
1626 case HTMENU:
1627 {
1629 break;
1630 }
1631 case HTHSCROLL:
1632 {
1634 break;
1635 }
1636 case HTVSCROLL:
1637 {
1639 break;
1640 }
1641 case HTMINBUTTON:
1642 case HTMAXBUTTON:
1643 case HTCLOSE:
1644 {
1645 NC_DoButton(pWnd, wParam, lParam);
1646 break;
1647 }
1648 case HTLEFT:
1649 case HTRIGHT:
1650 case HTTOP:
1651 case HTBOTTOM:
1652 case HTTOPLEFT:
1653 case HTTOPRIGHT:
1654 case HTBOTTOMLEFT:
1655 case HTBOTTOMRIGHT:
1656 {
1657 /* Old comment:
1658 * "make sure hittest fits into 0xf and doesn't overlap with HTSYSMENU"
1659 * This was previously done by setting wParam=SC_SIZE + wParam - 2
1660 */
1661 /* But that is not what WinNT does. Instead it sends this. This
1662 * is easy to differentiate from HTSYSMENU, because HTSYSMENU adds
1663 * SC_MOUSEMENU into wParam.
1664 */
1666 break;
1667 }
1668 case HTBORDER:
1669 break;
1670 }
1671 return(0);
1672}
Arabic default style
Definition: afstyles.h:94
r parent
Definition: btrfs.c:3010
BOOL FASTCALL co_IntSetForegroundWindowMouse(PWND Window)
Definition: focus.c:1556
HWND FASTCALL UserGetActiveWindow(VOID)
Definition: focus.c:1426
#define WS_POPUP
Definition: pedump.c:616
PWND FASTCALL UserGetAncestor(PWND Wnd, UINT Type)
BOOL UserDrawSysMenuButton(PWND pWnd, HDC hDC, LPRECT Rect, BOOL Down)
Definition: nonclient.c:777
VOID NC_DoButton(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1504
#define SC_HSCROLL
Definition: winuser.h:2630
#define SC_VSCROLL
Definition: winuser.h:2629
#define WS_EX_NOACTIVATE
Definition: winuser.h:395
#define GA_PARENT
Definition: winuser.h:2892

Referenced by IntDefWindowProc(), and NC_HandleNCLButtonDblClk().

◆ NC_HandleNCRButtonDown()

LRESULT NC_HandleNCRButtonDown ( PWND  pwnd,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1734 of file nonclient.c.

1735{
1736 MSG msg;
1737 INT hittest = wParam;
1738
1739 switch (hittest)
1740 {
1741 case HTCAPTION:
1742 case HTSYSMENU:
1743 if (!IntGetSystemMenu( pwnd, FALSE )) break;
1744
1746 for (;;)
1747 {
1749 if (IntCallMsgFilter( &msg, MSGF_MAX )) continue;
1750 if (msg.message == WM_RBUTTONUP)
1751 {
1752 hittest = GetNCHitEx( pwnd, msg.pt );
1753 break;
1754 }
1755 if (UserHMGetHandle(pwnd) != IntGetCapture()) return 0;
1756 }
1758
1759 if (hittest == HTCAPTION || hittest == HTSYSMENU || hittest == HTHSCROLL || hittest == HTVSCROLL)
1760 {
1761 TRACE("Msg pt %x and Msg.lParam %x and lParam %x\n",MAKELONG(msg.pt.x,msg.pt.y),msg.lParam,lParam);
1763 }
1764 break;
1765 }
1766 return 0;
1767}
#define WM_CONTEXTMENU
Definition: richedit.h:64
#define WM_RBUTTONUP
Definition: winuser.h:1808

Referenced by IntDefWindowProc().

◆ NC_IconForWindow()

PCURICON_OBJECT FASTCALL NC_IconForWindow ( PWND  pWnd)

Definition at line 746 of file nonclient.c.

747{
748 PCURICON_OBJECT pIcon = NULL;
749 HICON hIcon;
750
752 if (!hIcon) hIcon = UserGetProp(pWnd, gpsi->atomIconProp, TRUE);
753
754 if (!hIcon && pWnd->pcls->spicnSm)
755 return pWnd->pcls->spicnSm;
756 if (!hIcon && pWnd->pcls->spicn)
757 return pWnd->pcls->spicn;
758
759 // WARNING: Wine code has this test completely wrong. The following is how
760 // Windows behaves for windows having the WS_EX_DLGMODALFRAME style set:
761 // it does not use the default icon! And it does not check for DS_MODALFRAME.
762 if (!hIcon && !(pWnd->ExStyle & WS_EX_DLGMODALFRAME))
763 {
764 hIcon = gpsi->hIconSmWindows; // Both are IDI_WINLOGO Small
765 if (!hIcon) hIcon = gpsi->hIconWindows; // Reg size.
766 }
767 if (hIcon)
768 {
770 hIcon,
772 }
773 return pIcon;
774}
struct _CURICON_OBJECT * PCURICON_OBJECT
PSERVERINFO gpsi
Definition: imm.c:18
@ TYPE_CURSOR
Definition: ntuser.h:43
static HICON
Definition: imagelist.c:80
HICON hIcon
Definition: msconfig.c:44
struct _CURICON_OBJECT * spicnSm
Definition: ntuser.h:590
ATOM atomIconProp
Definition: ntuser.h:1066
ATOM atomIconSmProp
Definition: ntuser.h:1065
PUSER_HANDLE_TABLE gHandleTable
Definition: object.c:13
PVOID UserGetObjectNoErr(PUSER_HANDLE_TABLE ht, HANDLE handle, HANDLE_TYPE type)
Definition: object.c:481
HANDLE FASTCALL UserGetProp(_In_ PWND Window, _In_ ATOM Atom, _In_ BOOLEAN SystemProp)
Definition: prop.c:46

Referenced by GetNCHitEx(), MENU_DrawBitmapItem(), UserDrawCaption(), UserDrawCaptionBar(), and UserDrawSysMenuButton().

◆ UserDrawCaptionBar()

VOID UserDrawCaptionBar ( PWND  pWnd,
HDC  hDC,
INT  Flags 
)

Definition at line 965 of file nonclient.c.

969{
971 RECT WindowRect, CurrentRect, TempRect;
972 HPEN PreviousPen;
973 BOOL Gradient = FALSE;
974 PCURICON_OBJECT pIcon = NULL;
975
976 if (!(Flags & DC_NOVISIBLE) && !IntIsWindowVisible(pWnd)) return;
977
978 TRACE("UserDrawCaptionBar: pWnd %p, hDc %p, Flags 0x%x.\n", pWnd, hDC, Flags);
979
980 Style = pWnd->style;
981 ExStyle = pWnd->ExStyle;
982
983 IntGetWindowRect(pWnd, &WindowRect);
984
985 CurrentRect.top = CurrentRect.left = 0;
986 CurrentRect.right = WindowRect.right - WindowRect.left;
987 CurrentRect.bottom = WindowRect.bottom - WindowRect.top;
988
989 /* Draw outer edge */
991 {
992 DrawEdge(hDC, &CurrentRect, EDGE_RAISED, BF_RECT | BF_ADJUST);
993 }
994 else if (ExStyle & WS_EX_STATICEDGE)
995 {
996#if 0
998#else
1000 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.top, CurrentRect.right - CurrentRect.left, 1, PATCOPY);
1001 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY);
1002
1004 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.bottom - 1, CurrentRect.right - CurrentRect.left, 1, PATCOPY);
1005 NtGdiPatBlt(hDC, CurrentRect.right - 1, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY);
1006
1007 RECTL_vInflateRect(&CurrentRect, -1, -1);
1008#endif
1009 }
1010
1011 if (Flags & DC_FRAME) NC_DrawFrame(hDC, &CurrentRect, (Flags & DC_ACTIVE), Style, ExStyle);
1012
1013 /* Draw caption */
1014 if ((Style & WS_CAPTION) == WS_CAPTION)
1015 {
1016 TempRect = CurrentRect;
1017
1018 Flags |= DC_TEXT|DC_BUTTONS; // Icon will be checked if not already set.
1019
1020 if (UserSystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &Gradient, 0) && Gradient)
1021 {
1022 Flags |= DC_GRADIENT;
1023 }
1024
1026 {
1027 Flags |= DC_SMALLCAP;
1028 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSMCAPTION) - 1;
1029 CurrentRect.top += UserGetSystemMetrics(SM_CYSMCAPTION);
1030 }
1031 else
1032 {
1033 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYCAPTION) - 1;
1034 CurrentRect.top += UserGetSystemMetrics(SM_CYCAPTION);
1035 }
1036
1037 if (!(Flags & DC_ICON) &&
1038 !(Flags & DC_SMALLCAP) &&
1039 (Style & WS_SYSMENU) &&
1041 {
1042 pIcon = NC_IconForWindow(pWnd); // Force redraw of caption with icon if DC_ICON not flaged....
1043 }
1044 UserDrawCaption(pWnd, hDC, &TempRect, NULL, pIcon ? UserHMGetHandle(pIcon) : NULL, NULL, Flags);
1045
1046 /* Draw buttons */
1047 if (Style & WS_SYSMENU)
1048 {
1051 {
1054 }
1055 }
1056
1057 if (!(Style & WS_MINIMIZE))
1058 {
1059 /* Line under caption */
1060 PreviousPen = NtGdiSelectPen(hDC, NtGdiGetStockObject(DC_PEN));
1061
1064
1065 GreMoveTo(hDC, TempRect.left, TempRect.bottom, NULL);
1066
1067 NtGdiLineTo(hDC, TempRect.right, TempRect.bottom);
1068
1069 NtGdiSelectPen(hDC, PreviousPen);
1070 }
1071 }
1072
1073 if (!(Style & WS_MINIMIZE))
1074 {
1075 /* Draw menu bar */
1076 if (pWnd->state & WNDS_HASMENU && pWnd->IDMenu) // Should be pWnd->spmenu
1077 {
1078 PMENU menu;
1079 if ((menu = UserGetMenuObject(UlongToHandle(pWnd->IDMenu)))) // FIXME! Use pWnd->spmenu,
1080 {
1081 TempRect = CurrentRect;
1082 TempRect.bottom = TempRect.top + menu->cyMenu; // Should be pWnd->spmenu->cyMenu;
1083 CurrentRect.top += MENU_DrawMenuBar(hDC, &TempRect, pWnd, FALSE);
1084 }
1085 }
1086
1088 {
1089 DrawEdge(hDC, &CurrentRect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
1090 }
1091 }
1092}
#define DC_NOVISIBLE
Definition: undocuser.h:148
#define DC_TEXT
Definition: winuser.h:430
#define DC_ICON
Definition: winuser.h:429

Referenced by IntDefWindowProc(), NtUserDrawCaptionTemp(), and UserPaintCaption().

◆ UserDrawCaptionButton()

VOID UserDrawCaptionButton ( PWND  pWnd,
LPRECT  Rect,
DWORD  Style,
DWORD  ExStyle,
HDC  hDC,
BOOL  bDown,
ULONG  Type 
)

Definition at line 818 of file nonclient.c.

819{
820 RECT TempRect;
821
822 if (!(Style & WS_SYSMENU))
823 {
824 return;
825 }
826
827 TempRect = *Rect;
828
829 switch (Type)
830 {
831 case DFCS_CAPTIONMIN:
832 {
834 return; /* ToolWindows don't have min/max buttons */
835
836 if (Style & WS_SYSMENU)
837 TempRect.right -= UserGetSystemMetrics(SM_CXSIZE) + 1;
838
840 TempRect.right -= UserGetSystemMetrics(SM_CXSIZE) - 2;
841
842 TempRect.left = TempRect.right - UserGetSystemMetrics(SM_CXSIZE) + 1;
843 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSIZE) - 2;
844 TempRect.top += 2;
845 TempRect.right -= 1;
846
847 DrawFrameControl(hDC, &TempRect, DFC_CAPTION,
849 (bDown ? DFCS_PUSHED : 0) |
851 break;
852 }
853 case DFCS_CAPTIONMAX:
854 {
856 return; /* ToolWindows don't have min/max buttons */
857
858 if (Style & WS_SYSMENU)
859 TempRect.right -= UserGetSystemMetrics(SM_CXSIZE) + 1;
860
861 TempRect.left = TempRect.right - UserGetSystemMetrics(SM_CXSIZE) + 1;
862 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSIZE) - 2;
863 TempRect.top += 2;
864 TempRect.right -= 1;
865
866 DrawFrameControl(hDC, &TempRect, DFC_CAPTION,
868 (bDown ? DFCS_PUSHED : 0) |
870 break;
871 }
873 {
874 PMENU pSysMenu = IntGetSystemMenu(pWnd, FALSE);
875 UINT MenuState = IntGetMenuState(pSysMenu ? UserHMGetHandle(pSysMenu) : NULL, SC_CLOSE, MF_BYCOMMAND); /* in case of error MenuState==0xFFFFFFFF */
876
877 /* A tool window has a smaller Close button */
879 {
880 TempRect.left = TempRect.right - UserGetSystemMetrics(SM_CXSMSIZE);
881 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSMSIZE) - 2;
882 }
883 else
884 {
885 TempRect.left = TempRect.right - UserGetSystemMetrics(SM_CXSIZE);
886 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSIZE) - 2;
887 }
888 TempRect.top += 2;
889 TempRect.right -= 2;
890
891 DrawFrameControl(hDC, &TempRect, DFC_CAPTION,
892 (DFCS_CAPTIONCLOSE | (bDown ? DFCS_PUSHED : 0) |
893 ((!(MenuState & (MF_GRAYED|MF_DISABLED)) && !(pWnd->pcls->style & CS_NOCLOSE)) ? 0 : DFCS_INACTIVE)));
894 break;
895 }
896 }
897}
Type
Definition: Type.h:7
#define DFCS_INACTIVE
Definition: winuser.h:502
#define DFC_CAPTION
Definition: winuser.h:473
#define SM_CXSMSIZE
Definition: winuser.h:1026
#define DFCS_CAPTIONRESTORE
Definition: winuser.h:483
#define SM_CYSMSIZE
Definition: winuser.h:1027
#define DFCS_PUSHED
Definition: winuser.h:503

Referenced by NC_DoNCPaint(), UserDrawCaptionBar(), and UserDrawCaptionButtonWnd().

◆ UserDrawCaptionButtonWnd()

VOID UserDrawCaptionButtonWnd ( PWND  pWnd,
HDC  hDC,
BOOL  bDown,
ULONG  Type 
)

Definition at line 900 of file nonclient.c.

901{
902 RECT WindowRect;
903 SIZE WindowBorder;
904
905 IntGetWindowRect(pWnd, &WindowRect);
906
907 WindowRect.right -= WindowRect.left;
908 WindowRect.bottom -= WindowRect.top;
909 WindowRect.left = WindowRect.top = 0;
910
911 UserGetWindowBorders(pWnd->style, pWnd->ExStyle, &WindowBorder, FALSE);
912
913 RECTL_vInflateRect(&WindowRect, -WindowBorder.cx, -WindowBorder.cy);
914
915 UserDrawCaptionButton(pWnd, &WindowRect, pWnd->style, pWnd->ExStyle, hDC, bDown, Type);
916}

Referenced by NC_DoButton().

◆ UserDrawMovingFrame()

VOID FASTCALL UserDrawMovingFrame ( HDC  hdc,
RECTL rect,
BOOL  thickframe 
)

Definition at line 56 of file nonclient.c.

59{
61 else UserDrawWindowFrame(hdc, rect, 1, 1);
62}
VOID FASTCALL UserDrawWindowFrame(HDC hdc, RECTL *rect, ULONG width, ULONG height)
Definition: nonclient.c:42

Referenced by DefWndDoSizeMove().

◆ UserDrawSysMenuButton()

BOOL UserDrawSysMenuButton ( PWND  pWnd,
HDC  hDC,
LPRECT  Rect,
BOOL  Down 
)

Definition at line 777 of file nonclient.c.

778{
779 PCURICON_OBJECT WindowIcon;
780 BOOL Ret = FALSE;
781
782 if ((WindowIcon = NC_IconForWindow(pWnd)))
783 {
784 UserReferenceObject(WindowIcon);
785
786 Ret = UserDrawIconEx(hDC,
787 Rect->left + 2,
788 Rect->top + 2,
789 WindowIcon,
792 0, NULL, DI_NORMAL);
793
794 UserDereferenceObject(WindowIcon);
795 }
796 return Ret;
797}
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
#define DI_NORMAL
Definition: wingdi.h:72
#define SM_CYSMICON
Definition: winuser.h:1024
#define SM_CXSMICON
Definition: winuser.h:1023

Referenced by MENU_DrawMenuItem(), and NC_HandleNCLButtonDown().

◆ UserDrawWindowFrame()

VOID FASTCALL UserDrawWindowFrame ( HDC  hdc,
RECTL rect,
ULONG  width,
ULONG  height 
)

Definition at line 42 of file nonclient.c.

Referenced by UserDrawMovingFrame().