ReactOS 0.4.16-dev-1311-g81a4d83
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 254 of file nonclient.c.

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}
unsigned char BOOLEAN
#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
unsigned int BOOL
Definition: ntddk_ex.h:94
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
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
#define MSQ_STATE_MOVESIZE
Definition: ntuser.h:3609
#define TIF_MOVESIZETRACKING
Definition: ntuser.h:278
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
#define min(a, b)
Definition: monoChain.cc:55
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
__kernel_entry W32KAPI INT APIENTRY NtGdiCombineRgn(_In_ HRGN hrgnDst, _In_ HRGN hrgnSrc1, _In_opt_ HRGN hrgnSrc2, _In_ INT iMode)
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: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
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:3904
VOID FASTCALL IntSetSnapEdge(PWND Wnd, UINT Edge)
Definition: winpos.c:3989
#define L(x)
Definition: ntvdm.h:50
#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
#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::@5307 InternalPos
RECT rcWindow
Definition: ntuser.h:716
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
#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:895
VOID FASTCALL UpdateThreadWindows(PWND pWnd, PTHREADINFO pti, HRGN hRgn)
Definition: painting.c:1100
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:1158
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:700
PWND FASTCALL UserGetDesktopWindow(VOID)
Definition: desktop.c:1403
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
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
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:644
VOID FASTCALL UserReferenceObject(PVOID obj)
Definition: object.c:731
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 IntIsWindowVisible(PWND Wnd)
Definition: window.c:191
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 OBJID_WINDOW
Definition: winable.h:15
#define CHILDID_SELF
Definition: winable.h:14
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
HICON HCURSOR
Definition: windef.h:299
#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:2614
#define SWP_NOACTIVATE
Definition: winuser.h:1253
#define WM_SYSCOMMAND
Definition: winuser.h:1760
#define DCX_CACHE
Definition: winuser.h:2133
#define SM_CYSCREEN
Definition: winuser.h:971
#define HTCAPTION
Definition: winuser.h:2495
#define VK_UP
Definition: winuser.h:2244
#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 WM_QUERYDRAGICON
Definition: winuser.h:1673
#define WMSZ_LEFT
Definition: winuser.h:2483
#define SC_SIZE
Definition: winuser.h:2603
#define VK_RETURN
Definition: winuser.h:2220
#define HWND_TOP
Definition: winuser.h:1218
#define WS_EX_MDICHILD
Definition: winuser.h:394
#define WM_EXITSIZEMOVE
Definition: winuser.h:1843
#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:2514
#define HTNOWHERE
Definition: winuser.h:2493
#define SC_MOVE
Definition: winuser.h:2604
#define WM_LBUTTONUP
Definition: winuser.h:1796
#define MSGF_SIZE
Definition: winuser.h:1188
#define VK_LEFT
Definition: winuser.h:2243
#define WM_SIZING
Definition: winuser.h:1826
#define VK_RIGHT
Definition: winuser.h:2245
#define HTTOP
Definition: winuser.h:2509
#define VK_DOWN
Definition: winuser.h:2246
#define MK_LBUTTON
Definition: winuser.h:2386
#define SM_CYSMCAPTION
Definition: winuser.h:1025
#define SM_CXSCREEN
Definition: winuser.h:970
#define WM_KEYDOWN
Definition: winuser.h:1734
#define WM_MOVING
Definition: winuser.h:1828
#define HTSYSMENU
Definition: winuser.h:2496
#define HTLEFT
Definition: winuser.h:2506
#define VK_ESCAPE
Definition: winuser.h:2233
#define SM_CYCAPTION
Definition: winuser.h:974
#define WM_ENTERSIZEMOVE
Definition: winuser.h:1842

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)
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}
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
#define WS_MINIMIZEBOX
Definition: pedump.c:631
& rect
Definition: startmenu.cpp:1413
FLONG TIF_flags
Definition: win32.h:95
DWORD FASTCALL GetNCHitEx(PWND pWnd, POINT pt)
Definition: nonclient.c:1985
#define SM_CYSIZE
Definition: winuser.h:1003
#define HTBOTTOM
Definition: winuser.h:2512
#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:2508
#define WM_SETCURSOR
Definition: winuser.h:1655

Referenced by DefWndDoSizeMove().

◆ GetNCHitEx()

DWORD FASTCALL GetNCHitEx ( PWND  pWnd,
POINT  pt 
)

Definition at line 1985 of file nonclient.c.

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}
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
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:194
PCURICON_OBJECT FASTCALL NC_IconForWindow(PWND pWnd)
Definition: nonclient.c:736
#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:2511
#define HTCLOSE
Definition: winuser.h:2518
#define SM_CYEDGE
Definition: winuser.h:1020
#define SM_CXEDGE
Definition: winuser.h:1019
#define HTTOPLEFT
Definition: winuser.h:2510
#define SM_CXVSCROLL
Definition: winuser.h:972
#define HTBORDER
Definition: winuser.h:2516
#define HTVSCROLL
Definition: winuser.h:2501
#define HTHSCROLL
Definition: winuser.h:2500
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define HTMAXBUTTON
Definition: winuser.h:2503
#define SM_CYHSCROLL
Definition: winuser.h:973
#define HTMENU
Definition: winuser.h:2499
#define SM_CYBORDER
Definition: winuser.h:976
#define SM_CXBORDER
Definition: winuser.h:975
#define HTCLIENT
Definition: winuser.h:2494
#define SM_CXDLGFRAME
Definition: winuser.h:977
#define HTSIZE
Definition: winuser.h:2498
#define HTBOTTOMLEFT
Definition: winuser.h:2513
#define SM_CYDLGFRAME
Definition: winuser.h:979
#define WS_EX_LEFTSCROLLBAR
Definition: winuser.h:392
#define HTMINBUTTON
Definition: winuser.h:2502

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 790 of file nonclient.c.

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}
BOOL FASTCALL co_IntGetScrollBarInfo(PWND, LONG, PSCROLLBARINFO)
Definition: scrollbar.c:666
DWORD rgstate[CCHILDREN_SCROLLBAR+1]
Definition: winuser.h:3830
#define STATE_SYSTEM_OFFSCREEN
Definition: winuser.h:2954
struct tagSCROLLBARINFO SCROLLBARINFO

Referenced by NC_DoNCPaint().

◆ NC_DoButton()

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

Definition at line 1495 of file nonclient.c.

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}
struct @1710 Msg[]
LPARAM lParam
Definition: combotst.c:139
#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:519
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:890
#define MF_BYCOMMAND
Definition: winuser.h:202
#define WM_MOUSEFIRST
Definition: winuser.h:1793
#define WM_MOUSELAST
Definition: winuser.h:1820
#define DFCS_CAPTIONMIN
Definition: winuser.h:481
#define DFCS_CAPTIONCLOSE
Definition: winuser.h:480
#define SC_MINIMIZE
Definition: winuser.h:2605
#define SC_CLOSE
Definition: winuser.h:2611
#define MSGF_MAX
Definition: winuser.h:1193
#define DFCS_CAPTIONMAX
Definition: winuser.h:482
#define SC_RESTORE
Definition: winuser.h:2617
#define CS_NOCLOSE
Definition: winuser.h:662
#define SC_MAXIMIZE
Definition: winuser.h:2607
#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 1420 of file nonclient.c.

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}
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 1097 of file nonclient.c.

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}
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:97
#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
__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: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)
BOOL FASTCALL IntGetWindowRect(PWND Wnd, RECTL *Rect)
Definition: winpos.c:121
void IntDrawScrollBar(PWND, HDC, INT)
Definition: scrollbar.c:1072
DWORD state
Definition: ntuser.h:701
UINT_PTR IDMenu
Definition: ntuser.h:731
ULONG cyMenu
Definition: ntuser.h:423
#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:2192
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:4
#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:790
VOID UserDrawCaptionButton(PWND pWnd, LPRECT Rect, DWORD Style, DWORD ExStyle, HDC hDC, BOOL bDown, ULONG Type)
Definition: nonclient.c:808
VOID NC_DrawFrame(HDC hDC, RECT *CurrentRect, BOOL Active, DWORD Style, DWORD ExStyle)
Definition: nonclient.c:909
BOOL FASTCALL IntIsChildWindow(PWND Parent, PWND BaseWindow)
Definition: window.c:930
#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:1840
#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:561

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 909 of file nonclient.c.

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}
_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 1438 of file nonclient.c.

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}
#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:33
__kernel_entry W32KAPI HRGN APIENTRY NtGdiCreateRectRgn(_In_ INT xLeft, _In_ INT yTop, _In_ INT xRight, _In_ INT yBottom)
#define WS_VISIBLE
Definition: pedump.c:620
BOOL NTAPI GreIsHandleValid(HGDIOBJ hobj)
Definition: gdiobj.c:1146
LRESULT NC_DoNCPaint(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:1097
static INT NC_DoNCActive(PWND Wnd)
Definition: nonclient.c:1420
#define RGN_COPY
Definition: wingdi.h:357
#define DCX_WINDOW
Definition: winuser.h:2132

Referenced by IntDefWindowProc().

◆ NC_HandleNCCalcSize()

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

Definition at line 1304 of file nonclient.c.

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}
@ wparam
Definition: SystemMenu.c:30
#define WNDS_HASHORIZONTALSCROLLBAR
Definition: ntuser.h:607
#define WNDS_HASVERTICALSCROOLLBAR
Definition: ntuser.h:606
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
LONG_PTR LRESULT
Definition: windef.h:209
#define CS_VREDRAW
Definition: winuser.h:666
#define WVR_VALIDRECTS
Definition: winuser.h:2541
#define CS_HREDRAW
Definition: winuser.h:661
#define WVR_VREDRAW
Definition: winuser.h:2539
#define WVR_HREDRAW
Definition: winuser.h:2538
_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:420

Referenced by IntDefWindowProc().

◆ NC_HandleNCLButtonDblClk()

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

Definition at line 1667 of file nonclient.c.

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}
static int state
Definition: maze.c:121
LRESULT NC_HandleNCLButtonDown(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1575

Referenced by IntDefWindowProc().

◆ NC_HandleNCLButtonDown()

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

Definition at line 1575 of file nonclient.c.

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}
Arabic default style
Definition: afstyles.h:94
r parent
Definition: btrfs.c:3010
BOOL FASTCALL co_IntSetForegroundWindowMouse(PWND Window)
Definition: focus.c:1563
HWND FASTCALL UserGetActiveWindow(VOID)
Definition: focus.c:1432
#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:767
VOID NC_DoButton(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1495
#define SC_HSCROLL
Definition: winuser.h:2613
#define SC_VSCROLL
Definition: winuser.h:2612
#define WS_EX_NOACTIVATE
Definition: winuser.h:395
#define GA_PARENT
Definition: winuser.h:2864

Referenced by IntDefWindowProc(), and NC_HandleNCLButtonDblClk().

◆ NC_HandleNCRButtonDown()

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

Definition at line 1725 of file nonclient.c.

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}
#define WM_CONTEXTMENU
Definition: richedit.h:64
#define WM_RBUTTONUP
Definition: winuser.h:1799

Referenced by IntDefWindowProc().

◆ NC_IconForWindow()

PCURICON_OBJECT FASTCALL NC_IconForWindow ( PWND  pWnd)

Definition at line 736 of file nonclient.c.

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}
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 955 of file nonclient.c.

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}
#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 808 of file nonclient.c.

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}
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 890 of file nonclient.c.

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}

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 767 of file nonclient.c.

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}
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
#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.

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}
static HBRUSH hbrush
#define PATINVERT
Definition: wingdi.h:328

Referenced by UserDrawMovingFrame().