ReactOS 0.4.16-dev-112-g52265ae
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:71
#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:72
#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 251 of file nonclient.c.

252{
253 MSG msg;
254 RECT sizingRect, mouseRect, origRect, unmodRect, snapPreviewRect;
255 PRECT pFrameRect = &sizingRect;
256 HDC hdc;
257 LONG hittest = (LONG)(wParam & 0x0f);
258 PCURICON_OBJECT DragCursor = NULL, OldCursor = NULL;
259 POINT minTrack, maxTrack;
260 POINT capturePoint, pt;
262 UINT orgSnap = IntGetWindowSnapEdge(pwnd), snap = orgSnap;
263 BOOL thickframe;
264 BOOL iconic;
265 BOOL moved = FALSE;
266 BOOL DragFullWindows = FALSE;
267 PWND pWndParent = NULL;
268 WPARAM syscommand = (wParam & 0xfff0);
270 //PMONITOR mon = 0; Don't port sync from wine!!! This breaks explorer task bar sizing!!
271 // The task bar can grow in size and can not reduce due to the change
272 // in the work area.
273
274 Style = pwnd->style;
275 ExStyle = pwnd->ExStyle;
276 iconic = (Style & WS_MINIMIZE) != 0;
277
278 if (((Style & WS_MAXIMIZE) && syscommand != SC_MOVE) || !IntIsWindowVisible(pwnd)) return;
279 if ((Style & (WS_MAXIMIZE | WS_CHILD)) == WS_MAXIMIZE)
280 orgSnap = snap = HTTOP;
281
282 thickframe = UserHasThickFrameStyle(Style, ExStyle) && !iconic;
283
284 //
285 // Show window contents while dragging the window, get flag from registry data.
286 //
287 UserSystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, &DragFullWindows, 0);
288
289 pt.x = pti->ptLast.x;
290 pt.y = pti->ptLast.y;
291 capturePoint = pt;
293
294 TRACE("pwnd %p command %04lx, hittest %d, pos %d,%d\n",
295 pwnd, syscommand, hittest, pt.x, pt.y);
296
297 if (syscommand == SC_MOVE)
298 {
299 if (!hittest) hittest = DefWndStartSizeMove(pwnd, wParam, &capturePoint);
300 if (!hittest) return;
301 }
302 else /* SC_SIZE */
303 {
304 if (!thickframe) return;
305 if (hittest && (syscommand != SC_MOUSEMENU))
306 {
307 hittest += (HTLEFT - WMSZ_LEFT);
308 }
309 else
310 {
312 hittest = DefWndStartSizeMove(pwnd, wParam, &capturePoint);
313 if (!hittest)
314 {
316 return;
317 }
318 }
319 }
320
321 /* Get min/max info */
322
323 co_WinPosGetMinMaxInfo(pwnd, NULL, NULL, &minTrack, &maxTrack);
324 sizingRect = pwnd->rcWindow;
325 origRect = sizingRect;
326 if (Style & WS_CHILD)
327 {
328 pWndParent = IntGetParent(pwnd);
329 IntGetClientRect( pWndParent, &mouseRect );
330 IntMapWindowPoints( pWndParent, 0, (LPPOINT)&mouseRect, 2 );
331 IntMapWindowPoints( 0, pWndParent, (LPPOINT)&sizingRect, 2 );
332 unmodRect = sizingRect;
333 }
334 else
335 {
336 if (!(ExStyle & WS_EX_TOPMOST))
337 {
338 UserSystemParametersInfo(SPI_GETWORKAREA, 0, &mouseRect, 0);
339 }
340 else
341 {
343 }
344 unmodRect = sizingRect;
345 }
346
347 if (ON_LEFT_BORDER(hittest))
348 {
349 mouseRect.left = max( mouseRect.left, sizingRect.right-maxTrack.x+capturePoint.x-sizingRect.left );
350 mouseRect.right = min( mouseRect.right, sizingRect.right-minTrack.x+capturePoint.x-sizingRect.left );
351 }
352 else if (ON_RIGHT_BORDER(hittest))
353 {
354 mouseRect.left = max( mouseRect.left, sizingRect.left+minTrack.x+capturePoint.x-sizingRect.right );
355 mouseRect.right = min( mouseRect.right, sizingRect.left+maxTrack.x+capturePoint.x-sizingRect.right );
356 }
357 if (ON_TOP_BORDER(hittest))
358 {
359 mouseRect.top = max( mouseRect.top, sizingRect.bottom-maxTrack.y+capturePoint.y-sizingRect.top );
360 mouseRect.bottom = min( mouseRect.bottom,sizingRect.bottom-minTrack.y+capturePoint.y-sizingRect.top);
361 }
362 else if (ON_BOTTOM_BORDER(hittest))
363 {
364 mouseRect.top = max( mouseRect.top, sizingRect.top+minTrack.y+capturePoint.y-sizingRect.bottom );
365 mouseRect.bottom = min( mouseRect.bottom, sizingRect.top+maxTrack.y+capturePoint.y-sizingRect.bottom );
366 }
367
368 hdc = UserGetDCEx( pWndParent, 0, DCX_CACHE );
369 if (iconic)
370 {
371 DragCursor = pwnd->pcls->spicn;
372 if (DragCursor)
373 {
374 UserReferenceObject(DragCursor);
375 }
376 else
377 {
378 HCURSOR CursorHandle = (HCURSOR)co_IntSendMessage( UserHMGetHandle(pwnd), WM_QUERYDRAGICON, 0, 0 );
379 if (CursorHandle)
380 {
381 DragCursor = UserGetCurIconObject(CursorHandle);
382 }
383 else
384 {
385 iconic = FALSE;
386 }
387 }
388 }
389
390 /* repaint the window before moving it around */
392
393 IntNotifyWinEvent( EVENT_SYSTEM_MOVESIZESTART, pwnd, OBJID_WINDOW, CHILDID_SELF, 0);
394
396
398
400
401 pwnd->head.pti->TIF_flags |= TIF_MOVESIZETRACKING;
402
403 for(;;)
404 {
405 int dx = 0, dy = 0;
406
407 if (!co_IntGetPeekMessage(&msg, 0, 0, 0, PM_REMOVE, TRUE)) break;
408 if (IntCallMsgFilter( &msg, MSGF_SIZE )) continue;
409
410 if (msg.message == WM_KEYDOWN && (msg.wParam == VK_RETURN || msg.wParam == VK_ESCAPE))
411 break; // Exit on Return or Esc
412
413 if (!g_bWindowSnapEnabled && (msg.message == WM_LBUTTONUP ||
414 (msg.message == WM_MOUSEMOVE && (msg.wParam & MK_LBUTTON) == 0)))
415 { // If no WindowSnapEnabled: Exit on button-up immediately
416 break;
417 }
418 else if (g_bWindowSnapEnabled && (msg.message == WM_LBUTTONUP ||
419 (msg.message == WM_MOUSEMOVE && (msg.wParam & MK_LBUTTON) == 0)))
420 { // If WindowSnapEnabled: Decide whether to snap before exiting
421 if (hittest == HTCAPTION && thickframe && /* Check for snapping if was moved by caption */
423 {
424 BOOLEAN wasSnap = IntIsWindowSnapped(pwnd); /* Need the live snap state, not orgSnap nor maximized state */
425 UINT snapTo = iconic ? HTNOWHERE : GetSnapActivationPoint(pwnd, pt);
426 if (snapTo)
427 {
428 if (DragFullWindows)
429 {
430 co_IntSnapWindow(pwnd, snapTo);
431 if (!wasSnap)
432 pwnd->InternalPos.NormalRect = origRect;
433 }
434 snap = snapTo;
435 }
436 }
437 break;
438 }
439
440 if ((msg.message != WM_KEYDOWN) && (msg.message != WM_MOUSEMOVE))
441 {
444 continue; /* We are not interested in other messages */
445 }
446
447 pt = msg.pt;
448
449 if (msg.message == WM_KEYDOWN) switch(msg.wParam)
450 {
451 case VK_UP: pt.y -= 8; break;
452 case VK_DOWN: pt.y += 8; break;
453 case VK_LEFT: pt.x -= 8; break;
454 case VK_RIGHT: pt.x += 8; break;
455 }
456
457 pt.x = max( pt.x, mouseRect.left );
458 pt.x = min( pt.x, mouseRect.right - 1 );
459 pt.y = max( pt.y, mouseRect.top );
460 pt.y = min( pt.y, mouseRect.bottom - 1 );
461
462 dx = pt.x - capturePoint.x;
463 dy = pt.y - capturePoint.y;
464
465 if (dx || dy)
466 {
467 if (!moved)
468 {
469 moved = TRUE;
470 if (iconic) /* ok, no system popup tracking */
471 {
472 OldCursor = UserSetCursor(DragCursor, FALSE);
474 }
475 else if (!DragFullWindows)
476 UserDrawMovingFrame(hdc, &sizingRect, thickframe);
477 }
478
479 if (msg.message == WM_KEYDOWN)
480 {
481 UserSetCursorPos(pt.x, pt.y, 0, 0, FALSE);
482 }
483 else
484 {
485 RECT newRect = unmodRect;
486
487 if (!iconic && !DragFullWindows)
488 {
489 UserDrawMovingFrame(hdc, pFrameRect, thickframe);
490 pFrameRect = &sizingRect;
491 }
492 if (hittest == HTCAPTION)
493 {
494 /* Restore window size if it is snapped */
495 PRECT pr = &newRect;
496 LONG width, height, capcy, snapTo;
497 if (snap && syscommand == SC_MOVE && !iconic &&
498 !RECTL_bIsEmptyRect(&pwnd->InternalPos.NormalRect))
499 {
500 *pr = pwnd->InternalPos.NormalRect;
501 origRect = *pr; /* Save normal size - is required when window unsnapped from one side and snapped to another holding mouse down */
502
503 /* Try to position the center of the caption where the mouse is horizontally */
504 capcy = UserGetSystemMetrics((ExStyle & WS_EX_TOPMOST) ? SM_CYSMCAPTION : SM_CYCAPTION); /* No border, close enough */
505 width = pr->right - pr->left;
506 height = pr->bottom - pr->top;
507 pr->left = pt.x - width / 2;
508 pr->right = pr->left + width;
509 pr->top = mouseRect.top;
510 pr->bottom = pr->top + height;
511 if (pr->left < mouseRect.left)
512 {
513 pr->left = mouseRect.left;
514 pr->right = pr->left + width;
515 }
516 if ((pwnd->ExStyle & WS_EX_LAYOUTRTL) && pr->right > mouseRect.right)
517 {
518 pr->left = mouseRect.right - width;
519 pr->right = pr->left + width;
520 }
521 UserSetCursorPos(pt.x, pr->top + capcy / 2, 0, 0, FALSE);
522 snap = FALSE;
523 dx = dy = 0; /* Don't offset this move */
524 if (DragFullWindows)
525 {
526 IntSetStyle(pwnd, 0, WS_MAXIMIZE);
528
529 /* Have to move and size it now because we don't want SWP_NOSIZE */
531 }
532 }
533 else if (!snap && syscommand == SC_MOVE && !iconic)
534 {
535 if ((snapTo = GetSnapActivationPoint(pwnd, pt)) != 0)
536 {
537 co_IntCalculateSnapPosition(pwnd, snapTo, &snapPreviewRect);
538 if (DragFullWindows)
539 {
540 /* TODO: Show preview of snap */
541 }
542 else
543 {
544 pFrameRect = &snapPreviewRect;
545 UserDrawMovingFrame(hdc, pFrameRect, thickframe);
546 continue;
547 }
548 }
549 }
550
551 /* regular window moving */
552 RECTL_vOffsetRect(&newRect, dx, dy);
553 }
554 if (ON_LEFT_BORDER(hittest)) newRect.left += dx;
555 else if (ON_RIGHT_BORDER(hittest)) newRect.right += dx;
556 if (ON_TOP_BORDER(hittest)) newRect.top += dy;
557 else if (ON_BOTTOM_BORDER(hittest)) newRect.bottom += dy;
558
559 capturePoint = pt;
560
561 //
562 // Save the new position to the unmodified rectangle. This allows explorer task bar
563 // sizing. Explorer will forces back the position unless a certain amount of sizing
564 // has occurred.
565 //
566 unmodRect = newRect;
567
568 /* Determine the hit location */
569 if (syscommand == SC_SIZE)
570 {
571 WPARAM wpSizingHit = 0;
572
573 if (hittest >= HTLEFT && hittest <= HTBOTTOMRIGHT)
574 wpSizingHit = WMSZ_LEFT + (hittest - HTLEFT);
575 co_IntSendMessage( UserHMGetHandle(pwnd), WM_SIZING, wpSizingHit, (LPARAM)&newRect );
576 }
577 else
578 co_IntSendMessage( UserHMGetHandle(pwnd), WM_MOVING, 0, (LPARAM)&newRect );
579
580 if (!iconic)
581 {
582 if (!DragFullWindows)
583 UserDrawMovingFrame( hdc, &newRect, thickframe );
584 else
585 { // Moving the whole window now!
586 HRGN hrgnNew;
587 HRGN hrgnOrig = GreCreateRectRgnIndirect(&pwnd->rcWindow);
588
589 if (pwnd->hrgnClip != NULL)
590 NtGdiCombineRgn(hrgnOrig, hrgnOrig, pwnd->hrgnClip, RGN_AND);
591
593 //IntMapWindowPoints( 0, pWndParent, (POINT *)&rect, 2 );
595 NULL,
596 newRect.left,
597 newRect.top,
598 newRect.right - newRect.left,
599 newRect.bottom - newRect.top,
600 SWP_NOACTIVATE | ((hittest == HTCAPTION) ? SWP_NOSIZE : 0));
601
602 hrgnNew = GreCreateRectRgnIndirect(&pwnd->rcWindow);
603 if (pwnd->hrgnClip != NULL)
604 NtGdiCombineRgn(hrgnNew, hrgnNew, pwnd->hrgnClip, RGN_AND);
605
606 if (hrgnNew)
607 {
608 if (hrgnOrig)
609 NtGdiCombineRgn(hrgnOrig, hrgnOrig, hrgnNew, RGN_DIFF);
610 }
611 else
612 {
613 if (hrgnOrig)
614 {
615 GreDeleteObject(hrgnOrig);
616 hrgnOrig = 0;
617 }
618 }
619
620 // Update all the windows after the move or size, including this window.
621 UpdateThreadWindows(UserGetDesktopWindow()->spwndChild, pti, hrgnOrig);
622
623 if (hrgnOrig) GreDeleteObject(hrgnOrig);
624 if (hrgnNew) GreDeleteObject(hrgnNew);
625 }
626 }
627 sizingRect = newRect;
628 }
629 }
630 }
631
632 pwnd->head.pti->TIF_flags &= ~TIF_MOVESIZETRACKING;
633
635
636 if ( iconic )
637 {
638 if ( moved ) /* restore cursors, show icon title later on */
639 {
641 OldCursor = UserSetCursor(OldCursor, FALSE);
642 }
643
644 /* It could be that the cursor was already changed while we were proceeding,
645 * so we must unreference whatever cursor was current at the time we restored the old one.
646 * Maybe it is DragCursor, but maybe it is another one and DragCursor got already freed.
647 */
648 if (OldCursor) UserDereferenceObject(OldCursor);
649 }
650 else
651 {
652 UINT eraseFinalFrame = moved && !DragFullWindows;
653 if (eraseFinalFrame)
654 UserDrawMovingFrame(hdc, pFrameRect, thickframe); // Undo the XOR drawing
655 }
656
658
660 //if (pWndParent) IntMapWindowPoints( 0, pWndParent, (POINT *)&sizingRect, 2 );
661
663 {
664 ERR("DoSizeMove : WH_CBT Call Hook return!\n");
665 moved = FALSE;
666 }
667
668 IntNotifyWinEvent( EVENT_SYSTEM_MOVESIZEEND, pwnd, OBJID_WINDOW, CHILDID_SELF, 0);
669
671
676 /* window moved or resized */
677 if (moved)
678 {
679 BOOL forceSizing = !iconic && hittest == HTCAPTION && (!!orgSnap != !!snap);
680 UINT swp = (!forceSizing && hittest == HTCAPTION) ? SWP_NOSIZE : 0;
681
682 /* if the moving/resizing isn't canceled call SetWindowPos
683 * with the new position or the new size of the window
684 */
685 if (!((msg.message == WM_KEYDOWN) && (msg.wParam == VK_ESCAPE)) )
686 {
687 /* NOTE: SWP_NOACTIVATE prevents document window activation in Word 6 */
688 if (!DragFullWindows || iconic)
689 {
690 if (snap)
691 {
692 co_IntSnapWindow(pwnd, snap);
693 }
694 else
695 {
696 if (orgSnap && !snap)
697 {
698 IntSetStyle(pwnd, 0, WS_MAXIMIZE);
700 }
701 co_WinPosSetWindowPos(pwnd, HWND_TOP, sizingRect.left, sizingRect.top,
702 sizingRect.right - sizingRect.left,
703 sizingRect.bottom - sizingRect.top, swp);
704 }
705 }
706 }
707 else
708 {
709 /* restore previous size/position */
710 if (orgSnap)
711 {
712 co_IntSnapWindow(pwnd, orgSnap);
713 }
714 else if (DragFullWindows)
715 {
716 co_WinPosSetWindowPos(pwnd, HWND_TOP, origRect.left, origRect.top,
717 origRect.right - origRect.left,
718 origRect.bottom - origRect.top, swp);
719 }
720 }
721 }
722
723 if (IntIsWindow(UserHMGetHandle(pwnd)))
724 {
725 /* Single click brings up the system menu when iconized */
726 if (iconic && !moved && (Style & WS_SYSMENU))
727 {
729 }
730 }
731}
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:3591
#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:2501
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:4004
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:3932
VOID FASTCALL co_IntCalculateSnapPosition(PWND Wnd, UINT Edge, OUT RECT *Pos)
Definition: winpos.c:3902
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:3894
VOID FASTCALL IntSetSnapEdge(PWND Wnd, UINT Edge)
Definition: winpos.c:3979
#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::@5111 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:31
BOOL FASTCALL co_UserRedrawWindow(PWND Window, const RECTL *UpdateRect, PREGION UpdateRgn, ULONG Flags)
Definition: painting.c:894
VOID FASTCALL UpdateThreadWindows(PWND pWnd, PTHREADINFO pti, HRGN hRgn)
Definition: painting.c:1099
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:214
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:152
#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:2105
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:88
FORCEINLINE BOOLEAN IntIsSnapAllowedForWindow(PWND Wnd)
Definition: winpos.h:94
#define WS_EX_LAYOUTRTL
Definition: winuser.h:390
#define SC_MOUSEMENU
Definition: winuser.h:2598
#define SWP_NOACTIVATE
Definition: winuser.h:1245
#define WM_SYSCOMMAND
Definition: winuser.h:1744
#define DCX_CACHE
Definition: winuser.h:2117
#define SM_CYSCREEN
Definition: winuser.h:963
#define HTCAPTION
Definition: winuser.h:2479
#define VK_UP
Definition: winuser.h:2228
#define SWP_NOSIZE
Definition: winuser.h:1248
#define WM_MOUSEMOVE
Definition: winuser.h:1778
#define RDW_UPDATENOW
Definition: winuser.h:1223
#define WH_CBT
Definition: winuser.h:35
#define WM_QUERYDRAGICON
Definition: winuser.h:1657
#define WMSZ_LEFT
Definition: winuser.h:2467
#define SC_SIZE
Definition: winuser.h:2587
#define VK_RETURN
Definition: winuser.h:2204
#define HWND_TOP
Definition: winuser.h:1210
#define WS_EX_MDICHILD
Definition: winuser.h:394
#define WM_EXITSIZEMOVE
Definition: winuser.h:1827
#define RDW_ALLCHILDREN
Definition: winuser.h:1224
#define PM_REMOVE
Definition: winuser.h:1199
#define HCBT_MOVESIZE
Definition: winuser.h:55
#define HTBOTTOMRIGHT
Definition: winuser.h:2498
#define HTNOWHERE
Definition: winuser.h:2477
#define SC_MOVE
Definition: winuser.h:2588
#define WM_LBUTTONUP
Definition: winuser.h:1780
#define MSGF_SIZE
Definition: winuser.h:1180
#define VK_LEFT
Definition: winuser.h:2227
#define WM_SIZING
Definition: winuser.h:1810
#define VK_RIGHT
Definition: winuser.h:2229
#define HTTOP
Definition: winuser.h:2493
#define VK_DOWN
Definition: winuser.h:2230
#define MK_LBUTTON
Definition: winuser.h:2370
#define SM_CYSMCAPTION
Definition: winuser.h:1017
#define SM_CXSCREEN
Definition: winuser.h:962
#define WM_KEYDOWN
Definition: winuser.h:1718
#define WM_MOVING
Definition: winuser.h:1812
#define HTSYSMENU
Definition: winuser.h:2480
#define HTLEFT
Definition: winuser.h:2490
#define VK_ESCAPE
Definition: winuser.h:2217
#define SM_CYCAPTION
Definition: winuser.h:966
#define WM_ENTERSIZEMOVE
Definition: winuser.h:1826

Referenced by DefWndHandleSysCommand().

◆ DefWndStartSizeMove()

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

Definition at line 152 of file nonclient.c.

153{
154 LONG hittest = 0;
155 POINT pt;
156 MSG msg;
157 RECT rectWindow;
158 ULONG Style = Wnd->style;
160
161 rectWindow = Wnd->rcWindow;
162
163 if ((wParam & 0xfff0) == SC_MOVE)
164 {
165 /* Move pointer at the center of the caption */
166 RECT rect = rectWindow;
167 /* Note: to be exactly centered we should take the different types
168 * of border into account, but it shouldn't make more than a few pixels
169 * of difference so let's not bother with that */
170 if (Style & WS_SYSMENU)
172 if (Style & WS_MINIMIZEBOX)
173 rect.right -= UserGetSystemMetrics(SM_CXSIZE) + 1;
174 if (Style & WS_MAXIMIZEBOX)
175 rect.right -= UserGetSystemMetrics(SM_CXSIZE) + 1;
176 pt.x = (rect.right + rect.left) / 2;
178 hittest = HTCAPTION;
179 *capturePoint = pt;
180 }
181 else /* SC_SIZE */
182 {
183 pt.x = pt.y = 0;
184 while (!hittest)
185 {
186 if (!co_IntGetPeekMessage(&msg, 0, 0, 0, PM_REMOVE, TRUE)) return 0;
187 if (IntCallMsgFilter( &msg, MSGF_SIZE )) continue;
188
189 switch(msg.message)
190 {
191 case WM_MOUSEMOVE:
193 pt.x = min( max( msg.pt.x, rectWindow.left ), rectWindow.right - 1 );
194 pt.y = min( max( msg.pt.y, rectWindow.top ), rectWindow.bottom - 1 );
195 hittest = GetNCHitEx(Wnd, pt);
196 if ((hittest < HTLEFT) || (hittest > HTBOTTOMRIGHT)) hittest = 0;
197 break;
198
199 case WM_LBUTTONUP:
200 return 0;
201
202 case WM_KEYDOWN:
203 switch (msg.wParam)
204 {
205 case VK_UP:
206 hittest = HTTOP;
207 pt.x = (rectWindow.left+rectWindow.right)/2;
208 pt.y = rectWindow.top + UserGetSystemMetrics(SM_CYFRAME) / 2;
209 break;
210 case VK_DOWN:
211 hittest = HTBOTTOM;
212 pt.x = (rectWindow.left+rectWindow.right)/2;
213 pt.y = rectWindow.bottom - UserGetSystemMetrics(SM_CYFRAME) / 2;
214 break;
215 case VK_LEFT:
216 hittest = HTLEFT;
217 pt.x = rectWindow.left + UserGetSystemMetrics(SM_CXFRAME) / 2;
218 pt.y = (rectWindow.top+rectWindow.bottom)/2;
219 break;
220 case VK_RIGHT:
221 hittest = HTRIGHT;
222 pt.x = rectWindow.right - UserGetSystemMetrics(SM_CXFRAME) / 2;
223 pt.y = (rectWindow.top+rectWindow.bottom)/2;
224 break;
225 case VK_RETURN:
226 case VK_ESCAPE:
227 return 0;
228 }
229 break;
230 default:
235 break;
236 }
237 }
238 *capturePoint = pt;
239 }
240 UserSetCursorPos(pt.x, pt.y, 0, 0, FALSE);
242 return hittest;
243}
#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:1982
#define SM_CYSIZE
Definition: winuser.h:995
#define HTBOTTOM
Definition: winuser.h:2496
#define SM_CXFRAME
Definition: winuser.h:997
#define SM_CXSIZE
Definition: winuser.h:994
#define SM_CYFRAME
Definition: winuser.h:999
#define HTRIGHT
Definition: winuser.h:2492
#define WM_SETCURSOR
Definition: winuser.h:1639

Referenced by DefWndDoSizeMove().

◆ GetNCHitEx()

DWORD FASTCALL GetNCHitEx ( PWND  pWnd,
POINT  pt 
)

Definition at line 1982 of file nonclient.c.

1983{
1984 RECT rcWindow, rcClient;
1986
1987 if (!pWnd) return HTNOWHERE;
1988
1989 if (UserIsDesktopWindow(pWnd))
1990 {
1991 rcClient.left = rcClient.top = rcWindow.left = rcWindow.top = 0;
1996 }
1997 else
1998 {
1999 rcClient = pWnd->rcClient;
2000 rcWindow = pWnd->rcWindow;
2001 }
2002
2003 if (!RECTL_bPointInRect(&rcWindow, pt.x, pt.y)) return HTNOWHERE;
2004
2005 Style = pWnd->style;
2006 ExStyle = pWnd->ExStyle;
2007
2008 if (Style & WS_MINIMIZE) return HTCAPTION;
2009
2010 if (RECTL_bPointInRect( &rcClient, pt.x, pt.y )) return HTCLIENT;
2011
2012 /* Check borders */
2014 {
2016 if (!RECTL_bPointInRect(&rcWindow, pt.x, pt.y ))
2017 {
2018 /* Check top sizing border */
2019 if (pt.y < rcWindow.top)
2020 {
2021 if (pt.x < rcWindow.left+UserGetSystemMetrics(SM_CXSIZE)) return HTTOPLEFT;
2022 if (pt.x >= rcWindow.right-UserGetSystemMetrics(SM_CXSIZE)) return HTTOPRIGHT;
2023 return HTTOP;
2024 }
2025 /* Check bottom sizing border */
2026 if (pt.y >= rcWindow.bottom)
2027 {
2028 if (pt.x < rcWindow.left+UserGetSystemMetrics(SM_CXSIZE)) return HTBOTTOMLEFT;
2029 if (pt.x >= rcWindow.right-UserGetSystemMetrics(SM_CXSIZE)) return HTBOTTOMRIGHT;
2030 return HTBOTTOM;
2031 }
2032 /* Check left sizing border */
2033 if (pt.x < rcWindow.left)
2034 {
2035 if (pt.y < rcWindow.top+UserGetSystemMetrics(SM_CYSIZE)) return HTTOPLEFT;
2036 if (pt.y >= rcWindow.bottom-UserGetSystemMetrics(SM_CYSIZE)) return HTBOTTOMLEFT;
2037 return HTLEFT;
2038 }
2039 /* Check right sizing border */
2040 if (pt.x >= rcWindow.right)
2041 {
2042 if (pt.y < rcWindow.top+UserGetSystemMetrics(SM_CYSIZE)) return HTTOPRIGHT;
2043 if (pt.y >= rcWindow.bottom-UserGetSystemMetrics(SM_CYSIZE)) return HTBOTTOMRIGHT;
2044 return HTRIGHT;
2045 }
2046 }
2047 }
2048 else /* No thick frame */
2049 {
2050 if (HAS_DLGFRAME( Style, ExStyle ))
2052 else if (HAS_THINFRAME( Style, ExStyle ))
2054 else if (HAS_CLIENTFRAME( Style, ExStyle ))
2056 if (!RECTL_bPointInRect( &rcWindow, pt.x, pt.y )) return HTBORDER;
2057 }
2058
2059 /* Check caption */
2060
2061 if ((Style & WS_CAPTION) == WS_CAPTION)
2062 {
2064 rcWindow.top += UserGetSystemMetrics(SM_CYSMCAPTION) - 1;
2065 else
2066 rcWindow.top += UserGetSystemMetrics(SM_CYCAPTION) - 1;
2067 if (!RECTL_bPointInRect( &rcWindow, pt.x, pt.y ))
2068 {
2069 BOOL min_or_max_box = (Style & WS_SYSMENU) && (Style & (WS_MINIMIZEBOX|WS_MAXIMIZEBOX));
2071 {
2072 /* Check system menu */
2073 if ((Style & WS_SYSMENU) && !(ExStyle & WS_EX_TOOLWINDOW) && NC_IconForWindow(pWnd))
2074 {
2075 rcWindow.right -= UserGetSystemMetrics(SM_CYCAPTION) - 1;
2076 if (pt.x > rcWindow.right) return HTSYSMENU;
2077 }
2078
2079 /* Check close button */
2080 if (Style & WS_SYSMENU)
2081 {
2083 if (pt.x < rcWindow.left) return HTCLOSE;
2084 }
2085
2086 /* Check maximize box */
2087 /* In Win95 there is automatically a Maximize button when there is a minimize one */
2088 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2089 {
2090 rcWindow.left += UserGetSystemMetrics(SM_CXSIZE);
2091 if (pt.x < rcWindow.left) return HTMAXBUTTON;
2092 }
2093
2094 /* Check minimize box */
2095 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2096 {
2097 rcWindow.left += UserGetSystemMetrics(SM_CXSIZE);
2098 if (pt.x < rcWindow.left) return HTMINBUTTON;
2099 }
2100 }
2101 else
2102 {
2103 /* Check system menu */
2104 if ((Style & WS_SYSMENU) && !(ExStyle & WS_EX_TOOLWINDOW) && NC_IconForWindow(pWnd))
2105 {
2106 rcWindow.left += UserGetSystemMetrics(SM_CYCAPTION) - 1;
2107 if (pt.x < rcWindow.left) return HTSYSMENU;
2108 }
2109
2110 /* Check close button */
2111 if (Style & WS_SYSMENU)
2112 {
2114 if (pt.x > rcWindow.right) return HTCLOSE;
2115 }
2116
2117 /* Check maximize box */
2118 /* In Win95 there is automatically a Maximize button when there is a minimize one */
2119 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2120 {
2122 if (pt.x > rcWindow.right) return HTMAXBUTTON;
2123 }
2124
2125 /* Check minimize box */
2126 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2127 {
2129 if (pt.x > rcWindow.right) return HTMINBUTTON;
2130 }
2131 }
2132 return HTCAPTION;
2133 }
2134 }
2135
2136 /* Check menu bar */
2137
2138 if (HAS_MENU( pWnd, Style ) && (pt.y < rcClient.top) &&
2139 (pt.x >= rcClient.left) && (pt.x < rcClient.right))
2140 return HTMENU;
2141
2142 /* Check vertical scroll bar */
2143
2145 if (Style & WS_VSCROLL)
2146 {
2147 if((ExStyle & WS_EX_LEFTSCROLLBAR) != 0)
2149 else
2151 if (RECTL_bPointInRect( &rcClient, pt.x, pt.y )) return HTVSCROLL;
2152 }
2153
2154 /* Check horizontal scroll bar */
2155
2156 if (Style & WS_HSCROLL)
2157 {
2159 if (RECTL_bPointInRect( &rcClient, pt.x, pt.y ))
2160 {
2161 /* Check size box */
2162 if ((Style & WS_VSCROLL) &&
2163 ((((ExStyle & WS_EX_LEFTSCROLLBAR) != 0) && (pt.x <= rcClient.left + UserGetSystemMetrics(SM_CXVSCROLL))) ||
2164 (((ExStyle & WS_EX_LEFTSCROLLBAR) == 0) && (pt.x >= rcClient.right - UserGetSystemMetrics(SM_CXVSCROLL)))))
2165 return HTSIZE;
2166 return HTHSCROLL;
2167 }
2168 }
2169
2170 /* Has to return HTNOWHERE if nothing was found
2171 Could happen when a window has a customized non client area */
2172 return HTNOWHERE;
2173}
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:238
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:733
#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:2495
#define HTCLOSE
Definition: winuser.h:2502
#define SM_CYEDGE
Definition: winuser.h:1012
#define SM_CXEDGE
Definition: winuser.h:1011
#define HTTOPLEFT
Definition: winuser.h:2494
#define SM_CXVSCROLL
Definition: winuser.h:964
#define HTBORDER
Definition: winuser.h:2500
#define HTVSCROLL
Definition: winuser.h:2485
#define HTHSCROLL
Definition: winuser.h:2484
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define HTMAXBUTTON
Definition: winuser.h:2487
#define SM_CYHSCROLL
Definition: winuser.h:965
#define HTMENU
Definition: winuser.h:2483
#define SM_CYBORDER
Definition: winuser.h:968
#define SM_CXBORDER
Definition: winuser.h:967
#define HTCLIENT
Definition: winuser.h:2478
#define SM_CXDLGFRAME
Definition: winuser.h:969
#define HTSIZE
Definition: winuser.h:2482
#define HTBOTTOMLEFT
Definition: winuser.h:2497
#define SM_CYDLGFRAME
Definition: winuser.h:971
#define WS_EX_LEFTSCROLLBAR
Definition: winuser.h:392
#define HTMINBUTTON
Definition: winuser.h:2486

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 RECT wa;
143 UserSystemParametersInfo(SPI_GETWORKAREA, 0, &wa, 0); /* FIXME: MultiMon of PWND */
144
145 if (pt.x <= wa.left) return HTLEFT;
146 if (pt.x >= wa.right-1) return HTRIGHT;
147 if (pt.y <= wa.top) return HTTOP; /* Maximize */
148 return HTNOWHERE;
149}

Referenced by DefWndDoSizeMove().

◆ IntIsScrollBarVisible()

BOOL IntIsScrollBarVisible ( PWND  pWnd,
INT  hBar 
)

Definition at line 787 of file nonclient.c.

788{
789 SCROLLBARINFO sbi;
790 sbi.cbSize = sizeof(SCROLLBARINFO);
791
792 if(!co_IntGetScrollBarInfo(pWnd, hBar, &sbi))
793 return FALSE;
794
795 return !(sbi.rgstate[0] & STATE_SYSTEM_OFFSCREEN);
796}
BOOL FASTCALL co_IntGetScrollBarInfo(PWND, LONG, PSCROLLBARINFO)
Definition: scrollbar.c:666
DWORD rgstate[CCHILDREN_SCROLLBAR+1]
Definition: winuser.h:3757
#define STATE_SYSTEM_OFFSCREEN
Definition: winuser.h:2881
struct tagSCROLLBARINFO SCROLLBARINFO

Referenced by NC_DoNCPaint().

◆ NC_DoButton()

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

Definition at line 1492 of file nonclient.c.

1493{
1494 MSG Msg;
1495 HDC WindowDC;
1496 BOOL Pressed = TRUE, OldState;
1497 WPARAM SCMsg;
1498 PMENU SysMenu;
1499 ULONG ButtonType;
1500 DWORD Style;
1501 UINT MenuState;
1502
1503 Style = pWnd->style;
1504 switch (wParam)
1505 {
1506 case HTCLOSE:
1507 SysMenu = IntGetSystemMenu(pWnd, FALSE);
1508 MenuState = IntGetMenuState(SysMenu ? UserHMGetHandle(SysMenu) : NULL, SC_CLOSE, MF_BYCOMMAND); /* in case of error MenuState==0xFFFFFFFF */
1509 if (!(Style & WS_SYSMENU) || (MenuState & (MF_GRAYED|MF_DISABLED)) || (pWnd->pcls->style & CS_NOCLOSE))
1510 return;
1511 ButtonType = DFCS_CAPTIONCLOSE;
1512 SCMsg = SC_CLOSE;
1513 break;
1514 case HTMINBUTTON:
1515 if (!(Style & WS_MINIMIZEBOX))
1516 return;
1517 ButtonType = DFCS_CAPTIONMIN;
1518 SCMsg = ((Style & WS_MINIMIZE) ? SC_RESTORE : SC_MINIMIZE);
1519 break;
1520 case HTMAXBUTTON:
1521 if (!(Style & WS_MAXIMIZEBOX))
1522 return;
1523 ButtonType = DFCS_CAPTIONMAX;
1524 SCMsg = ((Style & WS_MAXIMIZE) ? SC_RESTORE : SC_MAXIMIZE);
1525 break;
1526
1527 default:
1528 ASSERT(FALSE);
1529 return;
1530 }
1531
1532 /*
1533 * FIXME: Not sure where to do this, but we must flush the pending
1534 * window updates when someone clicks on the close button and at
1535 * the same time the window is overlapped with another one. This
1536 * looks like a good place for now...
1537 */
1539
1540 WindowDC = UserGetWindowDC(pWnd);
1541 UserDrawCaptionButtonWnd(pWnd, WindowDC, TRUE, ButtonType);
1542
1544
1545 for (;;)
1546 {
1548 if (IntCallMsgFilter( &Msg, MSGF_MAX )) continue;
1549
1550 if (Msg.message == WM_LBUTTONUP)
1551 break;
1552
1553 if (Msg.message != WM_MOUSEMOVE)
1554 continue;
1555
1556 OldState = Pressed;
1557 Pressed = (GetNCHitEx(pWnd, Msg.pt) == wParam);
1558 if (Pressed != OldState)
1559 UserDrawCaptionButtonWnd(pWnd, WindowDC, Pressed, ButtonType);
1560 }
1561
1562 if (Pressed)
1563 UserDrawCaptionButtonWnd(pWnd, WindowDC, FALSE, ButtonType);
1565 UserReleaseDC(pWnd, WindowDC, FALSE);
1566 if (Pressed)
1567 co_IntSendMessage(UserHMGetHandle(pWnd), WM_SYSCOMMAND, SCMsg, SCMsg == SC_CLOSE ? lParam : MAKELONG(Msg.pt.x,Msg.pt.y));
1568}
struct @1636 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:5399
UINT FASTCALL IntGetMenuState(HMENU hMenu, UINT uId, UINT uFlags)
Definition: menu.c:4991
VOID UserDrawCaptionButtonWnd(PWND pWnd, HDC hDC, BOOL bDown, ULONG Type)
Definition: nonclient.c:887
#define MF_BYCOMMAND
Definition: winuser.h:202
#define WM_MOUSEFIRST
Definition: winuser.h:1777
#define WM_MOUSELAST
Definition: winuser.h:1804
#define DFCS_CAPTIONMIN
Definition: winuser.h:481
#define DFCS_CAPTIONCLOSE
Definition: winuser.h:480
#define SC_MINIMIZE
Definition: winuser.h:2589
#define SC_CLOSE
Definition: winuser.h:2595
#define MSGF_MAX
Definition: winuser.h:1185
#define DFCS_CAPTIONMAX
Definition: winuser.h:482
#define SC_RESTORE
Definition: winuser.h:2601
#define CS_NOCLOSE
Definition: winuser.h:654
#define SC_MAXIMIZE
Definition: winuser.h:2591
#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 1417 of file nonclient.c.

1418{
1419 INT Ret = 0;
1420
1423 Ret = DC_CAPTION;
1424
1425 if (!(Wnd->style & WS_MINIMIZED) && UserHasThickFrameStyle(Wnd->style, Wnd->ExStyle))
1426 {
1427 //if (IntGetSysColor(COLOR_ACTIVEBORDER) != IntGetSysColor(COLOR_INACTIVEBORDER)) // Why are these the same?
1428 {
1429 Ret = DC_FRAME;
1430 }
1431 }
1432 return Ret;
1433}
DWORD FASTCALL IntGetSysColor(INT nIndex)
Definition: stockobj.c:323
int32_t INT
Definition: typedefs.h:58
#define DC_FRAME
Definition: undocuser.h:149
#define WS_MINIMIZED
Definition: undocuser.h:18
#define COLOR_INACTIVECAPTIONTEXT
Definition: winuser.h:937
#define COLOR_ACTIVECAPTION
Definition: winuser.h:918
#define DC_CAPTION
Definition: winuser.h:439
#define COLOR_INACTIVECAPTION
Definition: winuser.h:919
#define COLOR_CAPTIONTEXT
Definition: winuser.h:925

Referenced by NC_HandleNCActivate().

◆ NC_DoNCPaint()

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

Definition at line 1094 of file nonclient.c.

1095{
1097 PWND Parent;
1098 RECT WindowRect, CurrentRect, TempRect;
1099 BOOL Active = FALSE;
1100
1101 if (!IntIsWindowVisible(pWnd) ||
1102 (pWnd->state & WNDS_NONCPAINT && !(pWnd->state & WNDS_FORCEMENUDRAW)) ||
1103 IntEqualRect(&pWnd->rcWindow, &pWnd->rcClient) )
1104 return 0;
1105
1106 Style = pWnd->style;
1107
1108 TRACE("DefWndNCPaint: pWnd %p, hDc %p, Active %s.\n", pWnd, hDC, Flags & DC_ACTIVE ? "TRUE" : "FALSE");
1109
1110 Parent = IntGetParent(pWnd);
1111 ExStyle = pWnd->ExStyle;
1112
1113 if (Flags == -1) // NC paint mode.
1114 {
1115 if (ExStyle & WS_EX_MDICHILD)
1116 {
1118
1119 if (Active)
1121 }
1122 else
1123 {
1124 Active = (gpqForeground == pWnd->head.pti->MessageQueue);
1125 }
1126 Flags = DC_NC; // Redraw everything!
1127 }
1128 else
1129 Flags |= DC_NC;
1130
1131
1132 IntGetWindowRect(pWnd, &WindowRect);
1133
1134 CurrentRect.top = CurrentRect.left = 0;
1135 CurrentRect.right = WindowRect.right - WindowRect.left;
1136 CurrentRect.bottom = WindowRect.bottom - WindowRect.top;
1137
1138 /* Draw outer edge */
1139 if (UserHasWindowEdge(pWnd->style, pWnd->ExStyle))
1140 {
1141 DrawEdge(hDC, &CurrentRect, EDGE_RAISED, BF_RECT | BF_ADJUST);
1142 }
1143 else if (pWnd->ExStyle & WS_EX_STATICEDGE)
1144 {
1145#if 0
1146 DrawEdge(hDC, &CurrentRect, BDR_SUNKENINNER, BF_RECT | BF_ADJUST | BF_FLAT);
1147#else
1149 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.top, CurrentRect.right - CurrentRect.left, 1, PATCOPY);
1150 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY);
1151
1153 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.bottom - 1, CurrentRect.right - CurrentRect.left, 1, PATCOPY);
1154 NtGdiPatBlt(hDC, CurrentRect.right - 1, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY);
1155
1156 RECTL_vInflateRect(&CurrentRect, -1, -1);
1157#endif
1158 }
1159
1160 if (Flags & DC_FRAME) NC_DrawFrame(hDC, &CurrentRect, Active ? Active : (Flags & DC_ACTIVE), Style, ExStyle);
1161
1162 /* Draw caption */
1163 if ((Style & WS_CAPTION) == WS_CAPTION)
1164 {
1165 HPEN PreviousPen;
1166 BOOL Gradient = FALSE;
1167
1168 if (Flags & DC_REDRAWHUNGWND)
1169 {
1170 Flags &= ~DC_REDRAWHUNGWND;
1172 }
1173
1174 if (UserSystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &Gradient, 0) && Gradient)
1175 {
1176 Flags |= DC_GRADIENT;
1177 }
1178
1179 if (Active)
1180 {
1181 if (pWnd->state & WNDS_ACTIVEFRAME)
1182 Flags |= DC_ACTIVE;
1183 else
1184 {
1185 ERR("Wnd is active and not set active!\n");
1186 }
1187 }
1188
1189 TempRect = CurrentRect;
1190
1192 {
1193 Flags |= DC_SMALLCAP;
1194 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSMCAPTION) - 1;
1195 CurrentRect.top += UserGetSystemMetrics(SM_CYSMCAPTION);
1196 }
1197 else
1198 {
1199 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYCAPTION) - 1;
1200 CurrentRect.top += UserGetSystemMetrics(SM_CYCAPTION);
1201 }
1202
1203 UserDrawCaption(pWnd, hDC, &TempRect, NULL, NULL, NULL, Flags);
1204
1205 /* Draw buttons */
1206 if (Style & WS_SYSMENU)
1207 {
1210 {
1213 }
1214 }
1215 if (!(Style & WS_MINIMIZE))
1216 {
1217 /* Line under caption */
1218 PreviousPen = NtGdiSelectPen(hDC, NtGdiGetStockObject(DC_PEN));
1219
1223
1224 GreMoveTo(hDC, TempRect.left, TempRect.bottom, NULL);
1225
1226 NtGdiLineTo(hDC, TempRect.right, TempRect.bottom);
1227
1228 NtGdiSelectPen(hDC, PreviousPen);
1229 }
1230 }
1231
1232 if (!(Style & WS_MINIMIZE))
1233 {
1234 /* Draw menu bar */
1235 if (pWnd->state & WNDS_HASMENU && pWnd->IDMenu) // Should be pWnd->spmenu
1236 {
1237 if (!(Flags & DC_NOSENDMSG))
1238 {
1239 PMENU menu;
1240 // Fix crash in test_menu_locked_by_window, should use pWnd->spmenu....
1241 if ((menu = UserGetMenuObject(UlongToHandle(pWnd->IDMenu)))) // FIXME! Use pWnd->spmenu,
1242 {
1243 TempRect = CurrentRect;
1244 TempRect.bottom = TempRect.top + menu->cyMenu; // Should be pWnd->spmenu->cyMenu;
1245 CurrentRect.top += MENU_DrawMenuBar(hDC, &TempRect, pWnd, FALSE);
1246 }
1247 }
1248 }
1249
1251 {
1252 DrawEdge(hDC, &CurrentRect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
1253 }
1254
1255 /* Draw the scrollbars */
1256 if ((Style & WS_VSCROLL) && (Style & WS_HSCROLL) &&
1258 {
1259 RECT ParentClientRect;
1260
1261 TempRect = CurrentRect;
1262
1264 TempRect.right = TempRect.left + UserGetSystemMetrics(SM_CXVSCROLL);
1265 else
1266 TempRect.left = TempRect.right - UserGetSystemMetrics(SM_CXVSCROLL);
1267
1268 TempRect.top = TempRect.bottom - UserGetSystemMetrics(SM_CYHSCROLL);
1269
1271
1272 if (Parent)
1273 {
1274 IntGetClientRect(Parent, &ParentClientRect);
1275
1276 if (HASSIZEGRIP(Style, ExStyle, Parent->style, WindowRect, ParentClientRect))
1277 {
1279 }
1280 }
1281
1284 }
1285 else
1286 {
1288 {
1290 }
1292 {
1294 }
1295 }
1296 }
1297 return 0; // For WM_NCPAINT message, return 0.
1298}
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:992
__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:148
#define DC_REDRAWHUNGWND
Definition: undocuser.h:152
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:4
#define HASSIZEGRIP(Style, ExStyle, ParentStyle, WindowRect, ParentClientRect)
Definition: uxthemep.h:232
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:787
VOID UserDrawCaptionButton(PWND pWnd, LPRECT Rect, DWORD Style, DWORD ExStyle, HDC hDC, BOOL bDown, ULONG Type)
Definition: nonclient.c:805
VOID NC_DrawFrame(HDC hDC, RECT *CurrentRect, BOOL Active, DWORD Style, DWORD ExStyle)
Definition: nonclient.c:906
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:922
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:933
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define WM_MDIGETACTIVE
Definition: winuser.h:1824
#define DC_SMALLCAP
Definition: winuser.h:428
#define COLOR_BTNHIGHLIGHT
Definition: winuser.h:938
#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:931
#define COLOR_3DFACE
Definition: winuser.h:932
_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 906 of file nonclient.c.

907{
908 /* Firstly the "thick" frame */
909 if ((Style & WS_THICKFRAME) && !(Style & WS_MINIMIZE))
910 {
911 LONG Width =
914
915 LONG Height =
918
920
921 /* Draw frame */
922 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, CurrentRect->right - CurrentRect->left, Height, PATCOPY);
923 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
924 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->bottom, CurrentRect->right - CurrentRect->left, -Height, PATCOPY);
925 NtGdiPatBlt(hDC, CurrentRect->right, CurrentRect->top, -Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
926
927 RECTL_vInflateRect(CurrentRect, -Width, -Height);
928 }
929
930 /* Now the other bit of the frame */
932 {
935
941
942 /* Draw frame */
943 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, CurrentRect->right - CurrentRect->left, Height, PATCOPY);
944 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
945 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->bottom, CurrentRect->right - CurrentRect->left, -Height, PATCOPY);
946 NtGdiPatBlt(hDC, CurrentRect->right, CurrentRect->top, -Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
947
948 RECTL_vInflateRect(CurrentRect, -Width, -Height);
949 }
950}
_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:926
#define COLOR_INACTIVEBORDER
Definition: winuser.h:927

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

1436{
1437 INT Flags;
1438 /* Lotus Notes draws menu descriptions in the caption of its main
1439 * window. When it wants to restore original "system" view, it just
1440 * sends WM_NCACTIVATE message to itself. Any optimizations here in
1441 * attempt to minimize redrawings lead to a not restored caption.
1442 */
1443 if (wParam & DC_ACTIVE)
1444 {
1447 }
1448 else
1449 {
1450 Wnd->state &= ~WNDS_ACTIVEFRAME;
1452 }
1453
1454 if ((Wnd->state & WNDS_NONCPAINT) || !(Wnd->style & WS_VISIBLE))
1455 return TRUE;
1456
1457 /* This isn't documented but is reproducible in at least XP SP2 and
1458 * Outlook 2007 depends on it
1459 */
1460 // MSDN:
1461 // If this parameter is set to -1, DefWindowProc does not repaint the
1462 // nonclient area to reflect the state change.
1463 if ( lParam != -1 &&
1464 ( Flags = NC_DoNCActive(Wnd)) != 0 )
1465 {
1466 HDC hDC;
1467 HRGN hRgnTemp = NULL, hRgn = (HRGN)lParam;
1468
1470 {
1471 hRgnTemp = NtGdiCreateRectRgn(0, 0, 0, 0);
1472 if (NtGdiCombineRgn(hRgnTemp, hRgn, 0, RGN_COPY) == ERROR)
1473 {
1474 GreDeleteObject(hRgnTemp);
1475 hRgnTemp = NULL;
1476 }
1477 }
1478
1479 if ((hDC = UserGetDCEx(Wnd, hRgnTemp, DCX_WINDOW|DCX_USESTYLE)))
1480 {
1481 NC_DoNCPaint(Wnd, hDC, wParam | Flags); // Redraw MENUs.
1482 UserReleaseDC(Wnd, hDC, FALSE);
1483 }
1484 else
1485 GreDeleteObject(hRgnTemp);
1486 }
1487
1488 return TRUE;
1489}
#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:1094
static INT NC_DoNCActive(PWND Wnd)
Definition: nonclient.c:1417
#define RGN_COPY
Definition: wingdi.h:357
#define DCX_WINDOW
Definition: winuser.h:2116

Referenced by IntDefWindowProc().

◆ NC_HandleNCCalcSize()

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

Definition at line 1301 of file nonclient.c.

1302{
1303 LRESULT Result = 0;
1304 SIZE WindowBorders;
1305 RECT OrigRect;
1306 LONG Style = Wnd->style;
1307 LONG exStyle = Wnd->ExStyle;
1308
1309 if (Rect == NULL)
1310 {
1311 return Result;
1312 }
1313 OrigRect = *Rect;
1314
1315 Wnd->state &= ~WNDS_HASCAPTION;
1316
1317 if (wparam)
1318 {
1319 if (Wnd->pcls->style & CS_VREDRAW)
1320 {
1322 }
1323 if (Wnd->pcls->style & CS_HREDRAW)
1324 {
1326 }
1328 }
1329
1330 if (!(Wnd->style & WS_MINIMIZE))
1331 {
1332 if (UserHasWindowEdge(Wnd->style, Wnd->ExStyle))
1333 {
1334 UserGetWindowBorders(Wnd->style, Wnd->ExStyle, &WindowBorders, FALSE);
1335 RECTL_vInflateRect(Rect, -WindowBorders.cx, -WindowBorders.cy);
1336 }
1337 else if ((Wnd->ExStyle & WS_EX_STATICEDGE) || (Wnd->style & WS_BORDER))
1338 {
1339 RECTL_vInflateRect(Rect, -1, -1);
1340 }
1341
1342 if ((Wnd->style & WS_CAPTION) == WS_CAPTION)
1343 {
1344 Wnd->state |= WNDS_HASCAPTION;
1345
1346 if (Wnd->ExStyle & WS_EX_TOOLWINDOW)
1348 else
1350 }
1351
1352 if (HAS_MENU(Wnd, Style))
1353 {
1355
1356 Wnd->state |= WNDS_HASMENU;
1357
1358 if (hDC)
1359 {
1360 RECT CliRect = *Rect;
1361 CliRect.bottom -= OrigRect.top;
1362 CliRect.right -= OrigRect.left;
1363 CliRect.left -= OrigRect.left;
1364 CliRect.top -= OrigRect.top;
1365 if (!Suspended) Rect->top += MENU_DrawMenuBar(hDC, &CliRect, Wnd, TRUE);
1366 UserReleaseDC(Wnd, hDC, FALSE);
1367 }
1368 }
1369
1370 if (Wnd->ExStyle & WS_EX_CLIENTEDGE)
1371 {
1373 }
1374
1375 if (Style & WS_VSCROLL)
1376 {
1377 if (Rect->right - Rect->left >= UserGetSystemMetrics(SM_CXVSCROLL))
1378 {
1380
1381 /* rectangle is in screen coords when wparam is false */
1382 if (!wparam && (exStyle & WS_EX_LAYOUTRTL)) exStyle ^= WS_EX_LEFTSCROLLBAR;
1383
1384 if((exStyle & WS_EX_LEFTSCROLLBAR) != 0)
1386 else
1388 }
1389 }
1390
1391 if (Style & WS_HSCROLL)
1392 {
1393 if( Rect->bottom - Rect->top > UserGetSystemMetrics(SM_CYHSCROLL))
1394 {
1396
1398 }
1399 }
1400
1401 if (Rect->top > Rect->bottom)
1402 Rect->bottom = Rect->top;
1403
1404 if (Rect->left > Rect->right)
1405 Rect->right = Rect->left;
1406 }
1407 else
1408 {
1409 Rect->right = Rect->left;
1410 Rect->bottom = Rect->top;
1411 }
1412
1413 return Result;
1414}
@ 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:658
#define WVR_VALIDRECTS
Definition: winuser.h:2525
#define CS_HREDRAW
Definition: winuser.h:653
#define WVR_VREDRAW
Definition: winuser.h:2523
#define WVR_HREDRAW
Definition: winuser.h:2522
_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 1664 of file nonclient.c.

1665{
1666 ULONG Style;
1667
1668 Style = pWnd->style;
1669 switch(wParam)
1670 {
1671 case HTCAPTION:
1672 {
1673 /* Maximize/Restore the window */
1675 {
1677 }
1678 break;
1679 }
1680 case HTSYSMENU:
1681 {
1682 PMENU SysMenu = IntGetSystemMenu(pWnd, FALSE);
1684
1685 /* If the close item of the sysmenu is disabled or not present do nothing */
1686 if ((state & (MF_DISABLED | MF_GRAYED)) || (state == 0xFFFFFFFF))
1687 break;
1688
1690 break;
1691 }
1692 case HTTOP:
1693 case HTBOTTOM:
1694 {
1695 RECT sizingRect = pWnd->rcWindow, mouseRect;
1696
1697 if (pWnd->ExStyle & WS_EX_MDICHILD)
1698 break;
1699
1700 UserSystemParametersInfo(SPI_GETWORKAREA, 0, &mouseRect, 0);
1701
1703 NULL,
1704 sizingRect.left,
1705 mouseRect.top,
1706 sizingRect.right - sizingRect.left,
1707 mouseRect.bottom - mouseRect.top,
1708 0);
1709 break;
1710 }
1711 default:
1712 return NC_HandleNCLButtonDown(pWnd, wParam, lParam);
1713 }
1714 return(0);
1715}
static int state
Definition: maze.c:121
LRESULT NC_HandleNCLButtonDown(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1572

Referenced by IntDefWindowProc().

◆ NC_HandleNCLButtonDown()

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

Definition at line 1572 of file nonclient.c.

1573{
1574 switch (wParam)
1575 {
1576 case HTCAPTION:
1577 {
1578 PWND TopWnd = pWnd, parent;
1579 while(1)
1580 {
1581 if ((TopWnd->style & (WS_POPUP|WS_CHILD)) != WS_CHILD)
1582 break;
1583 parent = UserGetAncestor( TopWnd, GA_PARENT );
1584 if (!parent || UserIsDesktopWindow(parent)) break;
1585 TopWnd = parent;
1586 }
1587
1588 if ( (pWnd && (pWnd->ExStyle & WS_EX_NOACTIVATE)) ||
1590 //NtUserCallHwndLock(hTopWnd, HWNDLOCK_ROUTINE_SETFOREGROUNDWINDOWMOUSE) ||
1592 {
1594 }
1595 break;
1596 }
1597 case HTSYSMENU:
1598 {
1599 LONG style = pWnd->style;
1600 if (style & WS_SYSMENU)
1601 {
1602 if(!(style & WS_MINIMIZE) )
1603 {
1604 RECT rect;
1605 HDC hDC = UserGetWindowDC(pWnd);
1606 NC_GetInsideRect(pWnd, &rect);
1608 UserReleaseDC( pWnd, hDC, FALSE );
1609 }
1611 }
1612 break;
1613 }
1614 case HTMENU:
1615 {
1617 break;
1618 }
1619 case HTHSCROLL:
1620 {
1622 break;
1623 }
1624 case HTVSCROLL:
1625 {
1627 break;
1628 }
1629 case HTMINBUTTON:
1630 case HTMAXBUTTON:
1631 case HTCLOSE:
1632 {
1633 NC_DoButton(pWnd, wParam, lParam);
1634 break;
1635 }
1636 case HTLEFT:
1637 case HTRIGHT:
1638 case HTTOP:
1639 case HTBOTTOM:
1640 case HTTOPLEFT:
1641 case HTTOPRIGHT:
1642 case HTBOTTOMLEFT:
1643 case HTBOTTOMRIGHT:
1644 {
1645 /* Old comment:
1646 * "make sure hittest fits into 0xf and doesn't overlap with HTSYSMENU"
1647 * This was previously done by setting wParam=SC_SIZE + wParam - 2
1648 */
1649 /* But that is not what WinNT does. Instead it sends this. This
1650 * is easy to differentiate from HTSYSMENU, because HTSYSMENU adds
1651 * SC_MOUSEMENU into wParam.
1652 */
1654 break;
1655 }
1656 case HTBORDER:
1657 break;
1658 }
1659 return(0);
1660}
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)
Definition: window.c:3343
BOOL UserDrawSysMenuButton(PWND pWnd, HDC hDC, LPRECT Rect, BOOL Down)
Definition: nonclient.c:764
VOID NC_DoButton(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1492
#define SC_HSCROLL
Definition: winuser.h:2597
#define SC_VSCROLL
Definition: winuser.h:2596
#define WS_EX_NOACTIVATE
Definition: winuser.h:395
#define GA_PARENT
Definition: winuser.h:2791

Referenced by IntDefWindowProc(), and NC_HandleNCLButtonDblClk().

◆ NC_HandleNCRButtonDown()

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

Definition at line 1722 of file nonclient.c.

1723{
1724 MSG msg;
1725 INT hittest = wParam;
1726
1727 switch (hittest)
1728 {
1729 case HTCAPTION:
1730 case HTSYSMENU:
1731 if (!IntGetSystemMenu( pwnd, FALSE )) break;
1732
1734 for (;;)
1735 {
1737 if (IntCallMsgFilter( &msg, MSGF_MAX )) continue;
1738 if (msg.message == WM_RBUTTONUP)
1739 {
1740 hittest = GetNCHitEx( pwnd, msg.pt );
1741 break;
1742 }
1743 if (UserHMGetHandle(pwnd) != IntGetCapture()) return 0;
1744 }
1746
1747 if (hittest == HTCAPTION || hittest == HTSYSMENU || hittest == HTHSCROLL || hittest == HTVSCROLL)
1748 {
1749 TRACE("Msg pt %x and Msg.lParam %x and lParam %x\n",MAKELONG(msg.pt.x,msg.pt.y),msg.lParam,lParam);
1751 }
1752 break;
1753 }
1754 return 0;
1755}
#define WM_CONTEXTMENU
Definition: richedit.h:64
#define WM_RBUTTONUP
Definition: winuser.h:1783

Referenced by IntDefWindowProc().

◆ NC_IconForWindow()

PCURICON_OBJECT FASTCALL NC_IconForWindow ( PWND  pWnd)

Definition at line 733 of file nonclient.c.

734{
735 PCURICON_OBJECT pIcon = NULL;
736 HICON hIcon;
737
739 if (!hIcon) hIcon = UserGetProp(pWnd, gpsi->atomIconProp, TRUE);
740
741 if (!hIcon && pWnd->pcls->spicnSm)
742 return pWnd->pcls->spicnSm;
743 if (!hIcon && pWnd->pcls->spicn)
744 return pWnd->pcls->spicn;
745
746 // WARNING: Wine code has this test completely wrong. The following is how
747 // Windows behaves for windows having the WS_EX_DLGMODALFRAME style set:
748 // it does not use the default icon! And it does not check for DS_MODALFRAME.
749 if (!hIcon && !(pWnd->ExStyle & WS_EX_DLGMODALFRAME))
750 {
751 hIcon = gpsi->hIconSmWindows; // Both are IDI_WINLOGO Small
752 if (!hIcon) hIcon = gpsi->hIconWindows; // Reg size.
753 }
754 if (hIcon)
755 {
757 hIcon,
759 }
760 return pIcon;
761}
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 952 of file nonclient.c.

956{
958 RECT WindowRect, CurrentRect, TempRect;
959 HPEN PreviousPen;
960 BOOL Gradient = FALSE;
961 PCURICON_OBJECT pIcon = NULL;
962
963 if (!(Flags & DC_NOVISIBLE) && !IntIsWindowVisible(pWnd)) return;
964
965 TRACE("UserDrawCaptionBar: pWnd %p, hDc %p, Flags 0x%x.\n", pWnd, hDC, Flags);
966
967 Style = pWnd->style;
968 ExStyle = pWnd->ExStyle;
969
970 IntGetWindowRect(pWnd, &WindowRect);
971
972 CurrentRect.top = CurrentRect.left = 0;
973 CurrentRect.right = WindowRect.right - WindowRect.left;
974 CurrentRect.bottom = WindowRect.bottom - WindowRect.top;
975
976 /* Draw outer edge */
978 {
979 DrawEdge(hDC, &CurrentRect, EDGE_RAISED, BF_RECT | BF_ADJUST);
980 }
981 else if (ExStyle & WS_EX_STATICEDGE)
982 {
983#if 0
985#else
987 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.top, CurrentRect.right - CurrentRect.left, 1, PATCOPY);
988 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY);
989
991 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.bottom - 1, CurrentRect.right - CurrentRect.left, 1, PATCOPY);
992 NtGdiPatBlt(hDC, CurrentRect.right - 1, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY);
993
994 RECTL_vInflateRect(&CurrentRect, -1, -1);
995#endif
996 }
997
998 if (Flags & DC_FRAME) NC_DrawFrame(hDC, &CurrentRect, (Flags & DC_ACTIVE), Style, ExStyle);
999
1000 /* Draw caption */
1001 if ((Style & WS_CAPTION) == WS_CAPTION)
1002 {
1003 TempRect = CurrentRect;
1004
1005 Flags |= DC_TEXT|DC_BUTTONS; // Icon will be checked if not already set.
1006
1007 if (UserSystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &Gradient, 0) && Gradient)
1008 {
1009 Flags |= DC_GRADIENT;
1010 }
1011
1013 {
1014 Flags |= DC_SMALLCAP;
1015 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSMCAPTION) - 1;
1016 CurrentRect.top += UserGetSystemMetrics(SM_CYSMCAPTION);
1017 }
1018 else
1019 {
1020 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYCAPTION) - 1;
1021 CurrentRect.top += UserGetSystemMetrics(SM_CYCAPTION);
1022 }
1023
1024 if (!(Flags & DC_ICON) &&
1025 !(Flags & DC_SMALLCAP) &&
1026 (Style & WS_SYSMENU) &&
1028 {
1029 pIcon = NC_IconForWindow(pWnd); // Force redraw of caption with icon if DC_ICON not flaged....
1030 }
1031 UserDrawCaption(pWnd, hDC, &TempRect, NULL, pIcon ? UserHMGetHandle(pIcon) : NULL, NULL, Flags);
1032
1033 /* Draw buttons */
1034 if (Style & WS_SYSMENU)
1035 {
1038 {
1041 }
1042 }
1043
1044 if (!(Style & WS_MINIMIZE))
1045 {
1046 /* Line under caption */
1047 PreviousPen = NtGdiSelectPen(hDC, NtGdiGetStockObject(DC_PEN));
1048
1051
1052 GreMoveTo(hDC, TempRect.left, TempRect.bottom, NULL);
1053
1054 NtGdiLineTo(hDC, TempRect.right, TempRect.bottom);
1055
1056 NtGdiSelectPen(hDC, PreviousPen);
1057 }
1058 }
1059
1060 if (!(Style & WS_MINIMIZE))
1061 {
1062 /* Draw menu bar */
1063 if (pWnd->state & WNDS_HASMENU && pWnd->IDMenu) // Should be pWnd->spmenu
1064 {
1065 PMENU menu;
1066 if ((menu = UserGetMenuObject(UlongToHandle(pWnd->IDMenu)))) // FIXME! Use pWnd->spmenu,
1067 {
1068 TempRect = CurrentRect;
1069 TempRect.bottom = TempRect.top + menu->cyMenu; // Should be pWnd->spmenu->cyMenu;
1070 CurrentRect.top += MENU_DrawMenuBar(hDC, &TempRect, pWnd, FALSE);
1071 }
1072 }
1073
1075 {
1076 DrawEdge(hDC, &CurrentRect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
1077 }
1078 }
1079}
#define DC_NOVISIBLE
Definition: undocuser.h:147
#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 805 of file nonclient.c.

806{
807 RECT TempRect;
808
809 if (!(Style & WS_SYSMENU))
810 {
811 return;
812 }
813
814 TempRect = *Rect;
815
816 switch (Type)
817 {
818 case DFCS_CAPTIONMIN:
819 {
821 return; /* ToolWindows don't have min/max buttons */
822
823 if (Style & WS_SYSMENU)
824 TempRect.right -= UserGetSystemMetrics(SM_CXSIZE) + 1;
825
827 TempRect.right -= UserGetSystemMetrics(SM_CXSIZE) - 2;
828
829 TempRect.left = TempRect.right - UserGetSystemMetrics(SM_CXSIZE) + 1;
830 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSIZE) - 2;
831 TempRect.top += 2;
832 TempRect.right -= 1;
833
834 DrawFrameControl(hDC, &TempRect, DFC_CAPTION,
836 (bDown ? DFCS_PUSHED : 0) |
838 break;
839 }
840 case DFCS_CAPTIONMAX:
841 {
843 return; /* ToolWindows don't have min/max buttons */
844
845 if (Style & WS_SYSMENU)
846 TempRect.right -= UserGetSystemMetrics(SM_CXSIZE) + 1;
847
848 TempRect.left = TempRect.right - UserGetSystemMetrics(SM_CXSIZE) + 1;
849 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSIZE) - 2;
850 TempRect.top += 2;
851 TempRect.right -= 1;
852
853 DrawFrameControl(hDC, &TempRect, DFC_CAPTION,
855 (bDown ? DFCS_PUSHED : 0) |
857 break;
858 }
860 {
861 PMENU pSysMenu = IntGetSystemMenu(pWnd, FALSE);
862 UINT MenuState = IntGetMenuState(pSysMenu ? UserHMGetHandle(pSysMenu) : NULL, SC_CLOSE, MF_BYCOMMAND); /* in case of error MenuState==0xFFFFFFFF */
863
864 /* A tool window has a smaller Close button */
866 {
867 TempRect.left = TempRect.right - UserGetSystemMetrics(SM_CXSMSIZE);
868 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSMSIZE) - 2;
869 }
870 else
871 {
872 TempRect.left = TempRect.right - UserGetSystemMetrics(SM_CXSIZE);
873 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSIZE) - 2;
874 }
875 TempRect.top += 2;
876 TempRect.right -= 2;
877
878 DrawFrameControl(hDC, &TempRect, DFC_CAPTION,
879 (DFCS_CAPTIONCLOSE | (bDown ? DFCS_PUSHED : 0) |
880 ((!(MenuState & (MF_GRAYED|MF_DISABLED)) && !(pWnd->pcls->style & CS_NOCLOSE)) ? 0 : DFCS_INACTIVE)));
881 break;
882 }
883 }
884}
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:1018
#define DFCS_CAPTIONRESTORE
Definition: winuser.h:483
#define SM_CYSMSIZE
Definition: winuser.h:1019
#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 887 of file nonclient.c.

888{
889 RECT WindowRect;
890 SIZE WindowBorder;
891
892 IntGetWindowRect(pWnd, &WindowRect);
893
894 WindowRect.right -= WindowRect.left;
895 WindowRect.bottom -= WindowRect.top;
896 WindowRect.left = WindowRect.top = 0;
897
898 UserGetWindowBorders(pWnd->style, pWnd->ExStyle, &WindowBorder, FALSE);
899
900 RECTL_vInflateRect(&WindowRect, -WindowBorder.cx, -WindowBorder.cy);
901
902 UserDrawCaptionButton(pWnd, &WindowRect, pWnd->style, pWnd->ExStyle, hDC, bDown, Type);
903}

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

765{
766 PCURICON_OBJECT WindowIcon;
767 BOOL Ret = FALSE;
768
769 if ((WindowIcon = NC_IconForWindow(pWnd)))
770 {
771 UserReferenceObject(WindowIcon);
772
773 Ret = UserDrawIconEx(hDC,
774 Rect->left + 2,
775 Rect->top + 2,
776 WindowIcon,
779 0, NULL, DI_NORMAL);
780
781 UserDereferenceObject(WindowIcon);
782 }
783 return Ret;
784}
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:1016
#define SM_CXSMICON
Definition: winuser.h:1015

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().