ReactOS 0.4.15-dev-6669-g8227c5d
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)
 
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 239 of file nonclient.c.

240{
241 MSG msg;
242 RECT sizingRect, mouseRect, origRect, unmodRect;
243 HDC hdc;
244 LONG hittest = (LONG)(wParam & 0x0f);
245 PCURICON_OBJECT DragCursor = NULL, OldCursor = NULL;
246 POINT minTrack, maxTrack;
247 POINT capturePoint, pt;
249 BOOL thickframe;
250 BOOL iconic;
251 BOOL moved = FALSE;
252 BOOL DragFullWindows = FALSE;
253 PWND pWndParent = NULL;
254 WPARAM syscommand = (wParam & 0xfff0);
256 //PMONITOR mon = 0; Don't port sync from wine!!! This breaks explorer task bar sizing!!
257 // The task bar can grow in size and can not reduce due to the change
258 // in the work area.
259
260 Style = pwnd->style;
261 ExStyle = pwnd->ExStyle;
262 iconic = (Style & WS_MINIMIZE) != 0;
263
264 if (((Style & WS_MAXIMIZE) && syscommand != SC_MOVE) || !IntIsWindowVisible(pwnd)) return;
265
266 thickframe = UserHasThickFrameStyle(Style, ExStyle) && !iconic;
267
268 //
269 // Show window contents while dragging the window, get flag from registry data.
270 //
271 UserSystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, &DragFullWindows, 0);
272
273 pt.x = pti->ptLast.x;
274 pt.y = pti->ptLast.y;
275 capturePoint = pt;
277
278 TRACE("pwnd %p command %04lx, hittest %d, pos %d,%d\n",
279 pwnd, syscommand, hittest, pt.x, pt.y);
280
281 if (syscommand == SC_MOVE)
282 {
283 if (!hittest) hittest = DefWndStartSizeMove(pwnd, wParam, &capturePoint);
284 if (!hittest) return;
285 }
286 else /* SC_SIZE */
287 {
288 if (!thickframe) return;
289 if (hittest && (syscommand != SC_MOUSEMENU))
290 {
291 hittest += (HTLEFT - WMSZ_LEFT);
292 }
293 else
294 {
296 hittest = DefWndStartSizeMove(pwnd, wParam, &capturePoint);
297 if (!hittest)
298 {
300 return;
301 }
302 }
303 }
304
305 /* Get min/max info */
306
307 co_WinPosGetMinMaxInfo(pwnd, NULL, NULL, &minTrack, &maxTrack);
308 sizingRect = pwnd->rcWindow;
309 origRect = sizingRect;
310 if (Style & WS_CHILD)
311 {
312 pWndParent = IntGetParent(pwnd);
313 IntGetClientRect( pWndParent, &mouseRect );
314 IntMapWindowPoints( pWndParent, 0, (LPPOINT)&mouseRect, 2 );
315 IntMapWindowPoints( 0, pWndParent, (LPPOINT)&sizingRect, 2 );
316 unmodRect = sizingRect;
317 }
318 else
319 {
320 if (!(ExStyle & WS_EX_TOPMOST))
321 {
322 UserSystemParametersInfo(SPI_GETWORKAREA, 0, &mouseRect, 0);
323 }
324 else
325 {
327 }
328 unmodRect = sizingRect;
329 }
330
331 if (ON_LEFT_BORDER(hittest))
332 {
333 mouseRect.left = max( mouseRect.left, sizingRect.right-maxTrack.x+capturePoint.x-sizingRect.left );
334 mouseRect.right = min( mouseRect.right, sizingRect.right-minTrack.x+capturePoint.x-sizingRect.left );
335 }
336 else if (ON_RIGHT_BORDER(hittest))
337 {
338 mouseRect.left = max( mouseRect.left, sizingRect.left+minTrack.x+capturePoint.x-sizingRect.right );
339 mouseRect.right = min( mouseRect.right, sizingRect.left+maxTrack.x+capturePoint.x-sizingRect.right );
340 }
341 if (ON_TOP_BORDER(hittest))
342 {
343 mouseRect.top = max( mouseRect.top, sizingRect.bottom-maxTrack.y+capturePoint.y-sizingRect.top );
344 mouseRect.bottom = min( mouseRect.bottom,sizingRect.bottom-minTrack.y+capturePoint.y-sizingRect.top);
345 }
346 else if (ON_BOTTOM_BORDER(hittest))
347 {
348 mouseRect.top = max( mouseRect.top, sizingRect.top+minTrack.y+capturePoint.y-sizingRect.bottom );
349 mouseRect.bottom = min( mouseRect.bottom, sizingRect.top+maxTrack.y+capturePoint.y-sizingRect.bottom );
350 }
351
352 hdc = UserGetDCEx( pWndParent, 0, DCX_CACHE );
353 if (iconic)
354 {
355 DragCursor = pwnd->pcls->spicn;
356 if (DragCursor)
357 {
358 UserReferenceObject(DragCursor);
359 }
360 else
361 {
362 HCURSOR CursorHandle = (HCURSOR)co_IntSendMessage( UserHMGetHandle(pwnd), WM_QUERYDRAGICON, 0, 0 );
363 if (CursorHandle)
364 {
365 DragCursor = UserGetCurIconObject(CursorHandle);
366 }
367 else
368 {
369 iconic = FALSE;
370 }
371 }
372 }
373
374 /* repaint the window before moving it around */
376
377 IntNotifyWinEvent( EVENT_SYSTEM_MOVESIZESTART, pwnd, OBJID_WINDOW, CHILDID_SELF, 0);
378
380
382
384
385 pwnd->head.pti->TIF_flags |= TIF_MOVESIZETRACKING;
386
387 for(;;)
388 {
389 int dx = 0, dy = 0;
390
391 if (!co_IntGetPeekMessage(&msg, 0, 0, 0, PM_REMOVE, TRUE)) break;
392 if (IntCallMsgFilter( &msg, MSGF_SIZE )) continue;
393
394 if (msg.message == WM_KEYDOWN && (msg.wParam == VK_RETURN || msg.wParam == VK_ESCAPE))
395 break; // Exit on Return or Esc
396
397 if (!g_bWindowSnapEnabled && (msg.message == WM_LBUTTONUP))
398 { // If no WindowSnapEnabled: Exit on button-up immediately
399 break;
400 }
401 else if (g_bWindowSnapEnabled && msg.message == WM_LBUTTONUP)
402 { // If WindowSnapEnabled: Decide whether to snap before exiting
403 DWORD ExStyleTB, StyleTB;
404 BOOL IsTaskBar;
405
406 // We want to forbid snapping operations on the TaskBar
407 // We use a heuristic for detecting the TaskBar Wnd by its typical Style & ExStyle Values
408 ExStyleTB = (ExStyle & WS_EX_TOOLWINDOW);
410 IsTaskBar = (StyleTB == (WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN))
411 && (ExStyleTB == WS_EX_TOOLWINDOW);
412 TRACE("ExStyle=%x Style=%x IsTaskBar=%d\n", ExStyleTB, StyleTB, IsTaskBar);
413
414 // check for snapping if was moved by caption
415 if (!IsTaskBar && hittest == HTCAPTION && thickframe && (ExStyle & WS_EX_MDICHILD) == 0)
416 {
417 RECT snapRect;
418 BOOL doSideSnap = FALSE;
419 UserSystemParametersInfo(SPI_GETWORKAREA, 0, &snapRect, 0);
420
421 // snap to left
422 if (pt.x <= snapRect.left)
423 {
424 snapRect.right = (snapRect.right - snapRect.left) / 2 + snapRect.left;
425 doSideSnap = TRUE;
426 }
427 // snap to right
428 if (pt.x >= snapRect.right-1)
429 {
430 snapRect.left = (snapRect.right - snapRect.left) / 2 + snapRect.left;
431 doSideSnap = TRUE;
432 }
433
434 if (doSideSnap)
435 {
437 NULL,
438 snapRect.left,
439 snapRect.top,
440 snapRect.right - snapRect.left,
441 snapRect.bottom - snapRect.top,
443 pwnd->InternalPos.NormalRect = origRect;
444 }
445 else
446 {
447 // maximize if on dragged to top
448 if (pt.y <= snapRect.top)
449 {
451 pwnd->InternalPos.NormalRect = origRect;
452 }
453 }
454 }
455 break;
456 }
457
458 if ((msg.message != WM_KEYDOWN) && (msg.message != WM_MOUSEMOVE))
459 {
462 continue; /* We are not interested in other messages */
463 }
464
465 pt = msg.pt;
466
467 if (msg.message == WM_KEYDOWN) switch(msg.wParam)
468 {
469 case VK_UP: pt.y -= 8; break;
470 case VK_DOWN: pt.y += 8; break;
471 case VK_LEFT: pt.x -= 8; break;
472 case VK_RIGHT: pt.x += 8; break;
473 }
474
475 pt.x = max( pt.x, mouseRect.left );
476 pt.x = min( pt.x, mouseRect.right - 1 );
477 pt.y = max( pt.y, mouseRect.top );
478 pt.y = min( pt.y, mouseRect.bottom - 1 );
479
480 dx = pt.x - capturePoint.x;
481 dy = pt.y - capturePoint.y;
482
483 if (dx || dy)
484 {
485 if ( !moved )
486 {
487 moved = TRUE;
488 if ( iconic ) /* ok, no system popup tracking */
489 {
490 OldCursor = UserSetCursor(DragCursor, FALSE);
492 }
493 else if(!DragFullWindows)
494 UserDrawMovingFrame( hdc, &sizingRect, thickframe );
495 }
496
497 if (msg.message == WM_KEYDOWN) UserSetCursorPos(pt.x, pt.y, 0, 0, FALSE);
498 else
499 {
500 RECT newRect = unmodRect;
501
502 if (!iconic && !DragFullWindows) UserDrawMovingFrame( hdc, &sizingRect, thickframe );
503 if (hittest == HTCAPTION)
504 {
505 /* Restore window size if it is snapped */
506 if (!RECTL_bIsEmptyRect(&pwnd->InternalPos.NormalRect) &&
507 !IntEqualRect(&pwnd->InternalPos.NormalRect, &pwnd->rcWindow))
508 {
509 UserSetCursorPos(max(0, pwnd->InternalPos.NormalRect.left) + pt.x, pwnd->InternalPos.NormalRect.top + pt.y, 0, 0, FALSE);
510
511 /* Save normal size - it required when window unsnapped from one side and snapped to another holding mouse down */
512 origRect = pwnd->InternalPos.NormalRect;
513
514 /* Restore from maximized state */
515 if (Style & WS_MAXIMIZE)
516 {
518 }
519 /* Restore snapped to left/right place */
520 else
521 {
523 NULL,
524 pwnd->InternalPos.NormalRect.left,
525 pwnd->InternalPos.NormalRect.top,
526 pwnd->InternalPos.NormalRect.right - pwnd->InternalPos.NormalRect.left,
527 pwnd->InternalPos.NormalRect.bottom - pwnd->InternalPos.NormalRect.top,
528 0);
529 }
530 RECTL_vSetEmptyRect(&pwnd->InternalPos.NormalRect);
531 continue;
532 }
533
534 /* regular window moving */
535 RECTL_vOffsetRect(&newRect, dx, dy);
536 }
537 if (ON_LEFT_BORDER(hittest)) newRect.left += dx;
538 else if (ON_RIGHT_BORDER(hittest)) newRect.right += dx;
539 if (ON_TOP_BORDER(hittest)) newRect.top += dy;
540 else if (ON_BOTTOM_BORDER(hittest)) newRect.bottom += dy;
541 capturePoint = pt;
542
543 //
544 // Save the new position to the unmodified rectangle. This allows explorer task bar
545 // sizing. Explorer will forces back the position unless a certain amount of sizing
546 // has occurred.
547 //
548 unmodRect = newRect;
549
550 /* determine the hit location */
551 if (syscommand == SC_SIZE)
552 {
553 WPARAM wpSizingHit = 0;
554
555 if (hittest >= HTLEFT && hittest <= HTBOTTOMRIGHT)
556 wpSizingHit = WMSZ_LEFT + (hittest - HTLEFT);
557 co_IntSendMessage( UserHMGetHandle(pwnd), WM_SIZING, wpSizingHit, (LPARAM)&newRect );
558 }
559 else
560 co_IntSendMessage( UserHMGetHandle(pwnd), WM_MOVING, 0, (LPARAM)&newRect );
561
562 if (!iconic)
563 {
564 if (!DragFullWindows)
565 UserDrawMovingFrame( hdc, &newRect, thickframe );
566 else
567 { // Moving the whole window now!
568 HRGN hrgnNew;
569 HRGN hrgnOrig = GreCreateRectRgnIndirect(&pwnd->rcWindow);
570
571 if (pwnd->hrgnClip != NULL)
572 NtGdiCombineRgn(hrgnOrig, hrgnOrig, pwnd->hrgnClip, RGN_AND);
573
575 //IntMapWindowPoints( 0, pWndParent, (POINT *)&rect, 2 );
577 NULL,
578 newRect.left,
579 newRect.top,
580 newRect.right - newRect.left,
581 newRect.bottom - newRect.top,
582 SWP_NOACTIVATE | ((hittest == HTCAPTION) ? SWP_NOSIZE : 0));
583
584 hrgnNew = GreCreateRectRgnIndirect(&pwnd->rcWindow);
585 if (pwnd->hrgnClip != NULL)
586 NtGdiCombineRgn(hrgnNew, hrgnNew, pwnd->hrgnClip, RGN_AND);
587
588 if (hrgnNew)
589 {
590 if (hrgnOrig)
591 NtGdiCombineRgn(hrgnOrig, hrgnOrig, hrgnNew, RGN_DIFF);
592 }
593 else
594 {
595 if (hrgnOrig)
596 {
597 GreDeleteObject(hrgnOrig);
598 hrgnOrig = 0;
599 }
600 }
601
602 // Update all the windows after the move or size, including this window.
603 UpdateThreadWindows(UserGetDesktopWindow()->spwndChild, pti, hrgnOrig);
604
605 if (hrgnOrig) GreDeleteObject(hrgnOrig);
606 if (hrgnNew) GreDeleteObject(hrgnNew);
607 }
608 }
609 sizingRect = newRect;
610 }
611 }
612 }
613
614 pwnd->head.pti->TIF_flags &= ~TIF_MOVESIZETRACKING;
615
617
618 if ( iconic )
619 {
620 if ( moved ) /* restore cursors, show icon title later on */
621 {
623 OldCursor = UserSetCursor(OldCursor, FALSE);
624 }
625
626 /* It could be that the cursor was already changed while we were proceeding,
627 * so we must unreference whatever cursor was current at the time we restored the old one.
628 * Maybe it is DragCursor, but maybe it is another one and DragCursor got already freed.
629 */
630 if (OldCursor) UserDereferenceObject(OldCursor);
631 }
632 else if ( moved && !DragFullWindows )
633 UserDrawMovingFrame( hdc, &sizingRect, thickframe );
634
636
638 //if (pWndParent) IntMapWindowPoints( 0, pWndParent, (POINT *)&sizingRect, 2 );
639
641 {
642 ERR("DoSizeMove : WH_CBT Call Hook return!\n");
643 moved = FALSE;
644 }
645
646 IntNotifyWinEvent( EVENT_SYSTEM_MOVESIZEEND, pwnd, OBJID_WINDOW, CHILDID_SELF, 0);
647
649
654 /* window moved or resized */
655 if (moved)
656 {
657 /* if the moving/resizing isn't canceled call SetWindowPos
658 * with the new position or the new size of the window
659 */
660 if (!((msg.message == WM_KEYDOWN) && (msg.wParam == VK_ESCAPE)) )
661 {
662 /* NOTE: SWP_NOACTIVATE prevents document window activation in Word 6 */
663 if (!DragFullWindows || iconic )
664 {
666 0,
667 sizingRect.left,
668 sizingRect.top,
669 sizingRect.right - sizingRect.left,
670 sizingRect.bottom - sizingRect.top,
671 ( hittest == HTCAPTION ) ? SWP_NOSIZE : 0 );
672 }
673 }
674 else
675 { /* restore previous size/position */
676 if ( DragFullWindows )
677 {
679 0,
680 origRect.left,
681 origRect.top,
682 origRect.right - origRect.left,
683 origRect.bottom - origRect.top,
684 ( hittest == HTCAPTION ) ? SWP_NOSIZE : 0 );
685 }
686 }
687 }
688
689 if ( IntIsWindow(UserHMGetHandle(pwnd)) )
690 {
691 if ( iconic )
692 {
693 /* Single click brings up the system menu when iconized */
694 if ( !moved )
695 {
696 if( Style & WS_SYSMENU )
698 }
699 }
700 }
701}
#define msg(x)
Definition: auth_time.c:54
#define ERR(fmt,...)
Definition: debug.h:110
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
unsigned long DWORD
Definition: ntddk_ex.h:95
HWND FASTCALL co_UserSetCapture(HWND hWnd)
Definition: focus.c:1458
HWND APIENTRY IntGetCapture(VOID)
Definition: focus.c:1440
BOOL FASTCALL IntReleaseCapture(VOID)
Definition: focus.c:1530
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
#define MSQ_STATE_MOVESIZE
Definition: ntuser.h:3708
#define TIF_MOVESIZETRACKING
Definition: ntuser.h:277
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:92
#define min(a, b)
Definition: monoChain.cc:55
HWND FASTCALL MsqSetStateWindow(PTHREADINFO pti, ULONG Type, HWND hWnd)
Definition: msgqueue.c:2553
int UserShowCursor(BOOL bShow)
Definition: msgqueue.c:168
PCURICON_OBJECT FASTCALL UserSetCursor(PCURICON_OBJECT NewCursor, BOOL ForceChange)
Definition: msgqueue.c:93
__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
BOOLEAN FASTCALL co_WinPosSetWindowPos(PWND Window, HWND WndInsertAfter, INT x, INT y, INT cx, INT cy, UINT flags)
Definition: winpos.c:1786
UINT FASTCALL co_WinPosGetMinMaxInfo(PWND Window, POINT *MaxSize, POINT *MaxPos, POINT *MinTrack, POINT *MaxTrack)
Definition: winpos.c:934
#define L(x)
Definition: ntvdm.h:50
#define WS_SYSMENU
Definition: pedump.c:629
#define WS_POPUP
Definition: pedump.c:616
#define WS_MINIMIZE
Definition: pedump.c:622
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_EX_TOPMOST
Definition: pedump.c:647
long LONG
Definition: pedump.c:60
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define GreCreateRectRgnIndirect(prc)
Definition: region.h:96
#define TRACE(s)
Definition: solgame.cpp:4
struct _CURICON_OBJECT * spicn
Definition: ntuser.h:580
POINT ptLast
Definition: win32.h:129
Definition: ntuser.h:689
DWORD ExStyle
Definition: ntuser.h:699
HRGN hrgnClip
Definition: ntuser.h:728
PCLS pcls
Definition: ntuser.h:715
THRDESKHEAD head
Definition: ntuser.h:690
DWORD style
Definition: ntuser.h:701
struct _WND::@4907 InternalPos
RECT rcWindow
Definition: ntuser.h:711
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:888
VOID FASTCALL UpdateThreadWindows(PWND pWnd, PTHREADINFO pti, HRGN hRgn)
Definition: painting.c:1093
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
FORCEINLINE VOID RECTL_vSetEmptyRect(_Out_ RECTL *prcl)
Definition: rect.h:20
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:1386
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:1152
BOOL FASTCALL IntCallMsgFilter(LPMSG lpmsg, INT code)
Definition: message.c:2133
LRESULT FASTCALL IntDispatchMessage(PMSG pMsg)
Definition: message.c:840
BOOL APIENTRY co_IntGetPeekMessage(PMSG pMsg, HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax, UINT RemoveMsg, BOOL bGMSG)
Definition: message.c:1176
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1445
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:208
#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:140
#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:2104
PWND FASTCALL IntGetParent(PWND Wnd)
Definition: window.c:204
BOOL FASTCALL IntIsWindow(HWND hWnd)
Definition: window.c:176
BOOL FASTCALL IntIsWindowVisible(PWND Wnd)
Definition: window.c:189
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 BOOL IntEqualRect(RECTL *lprc1, RECTL *lprc2)
Definition: winpos.h:48
#define SC_MOUSEMENU
Definition: winuser.h:2585
#define SWP_NOACTIVATE
Definition: winuser.h:1232
#define WM_SYSCOMMAND
Definition: winuser.h:1731
#define DCX_CACHE
Definition: winuser.h:2104
#define SM_CYSCREEN
Definition: winuser.h:954
#define HTCAPTION
Definition: winuser.h:2466
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define VK_UP
Definition: winuser.h:2215
#define SWP_NOSIZE
Definition: winuser.h:1235
#define WM_MOUSEMOVE
Definition: winuser.h:1765
#define RDW_UPDATENOW
Definition: winuser.h:1210
#define WH_CBT
Definition: winuser.h:35
#define WM_QUERYDRAGICON
Definition: winuser.h:1644
#define WMSZ_LEFT
Definition: winuser.h:2454
#define SC_SIZE
Definition: winuser.h:2574
#define VK_RETURN
Definition: winuser.h:2191
#define WS_EX_MDICHILD
Definition: winuser.h:394
#define WM_EXITSIZEMOVE
Definition: winuser.h:1814
#define RDW_ALLCHILDREN
Definition: winuser.h:1211
#define PM_REMOVE
Definition: winuser.h:1186
#define HCBT_MOVESIZE
Definition: winuser.h:55
#define HTBOTTOMRIGHT
Definition: winuser.h:2485
#define SC_MOVE
Definition: winuser.h:2575
#define WM_LBUTTONUP
Definition: winuser.h:1767
#define MSGF_SIZE
Definition: winuser.h:1167
#define VK_LEFT
Definition: winuser.h:2214
#define WM_SIZING
Definition: winuser.h:1797
#define VK_RIGHT
Definition: winuser.h:2216
#define VK_DOWN
Definition: winuser.h:2217
#define SM_CXSCREEN
Definition: winuser.h:953
#define WM_KEYDOWN
Definition: winuser.h:1705
#define WM_MOVING
Definition: winuser.h:1799
#define HTSYSMENU
Definition: winuser.h:2467
#define HTLEFT
Definition: winuser.h:2477
#define VK_ESCAPE
Definition: winuser.h:2204
#define SC_RESTORE
Definition: winuser.h:2588
#define SC_MAXIMIZE
Definition: winuser.h:2578
#define WM_ENTERSIZEMOVE
Definition: winuser.h:1813

Referenced by DefWndHandleSysCommand().

◆ DefWndStartSizeMove()

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

Definition at line 140 of file nonclient.c.

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

Referenced by DefWndDoSizeMove().

◆ GetNCHitEx()

DWORD FASTCALL GetNCHitEx ( PWND  pWnd,
POINT  pt 
)

Definition at line 1952 of file nonclient.c.

1953{
1954 RECT rcWindow, rcClient;
1956
1957 if (!pWnd) return HTNOWHERE;
1958
1959 if (UserIsDesktopWindow(pWnd))
1960 {
1961 rcClient.left = rcClient.top = rcWindow.left = rcWindow.top = 0;
1966 }
1967 else
1968 {
1969 rcClient = pWnd->rcClient;
1970 rcWindow = pWnd->rcWindow;
1971 }
1972
1973 if (!RECTL_bPointInRect(&rcWindow, pt.x, pt.y)) return HTNOWHERE;
1974
1975 Style = pWnd->style;
1976 ExStyle = pWnd->ExStyle;
1977
1978 if (Style & WS_MINIMIZE) return HTCAPTION;
1979
1980 if (RECTL_bPointInRect( &rcClient, pt.x, pt.y )) return HTCLIENT;
1981
1982 /* Check borders */
1984 {
1986 if (!RECTL_bPointInRect(&rcWindow, pt.x, pt.y ))
1987 {
1988 /* Check top sizing border */
1989 if (pt.y < rcWindow.top)
1990 {
1991 if (pt.x < rcWindow.left+UserGetSystemMetrics(SM_CXSIZE)) return HTTOPLEFT;
1992 if (pt.x >= rcWindow.right-UserGetSystemMetrics(SM_CXSIZE)) return HTTOPRIGHT;
1993 return HTTOP;
1994 }
1995 /* Check bottom sizing border */
1996 if (pt.y >= rcWindow.bottom)
1997 {
1998 if (pt.x < rcWindow.left+UserGetSystemMetrics(SM_CXSIZE)) return HTBOTTOMLEFT;
1999 if (pt.x >= rcWindow.right-UserGetSystemMetrics(SM_CXSIZE)) return HTBOTTOMRIGHT;
2000 return HTBOTTOM;
2001 }
2002 /* Check left sizing border */
2003 if (pt.x < rcWindow.left)
2004 {
2005 if (pt.y < rcWindow.top+UserGetSystemMetrics(SM_CYSIZE)) return HTTOPLEFT;
2006 if (pt.y >= rcWindow.bottom-UserGetSystemMetrics(SM_CYSIZE)) return HTBOTTOMLEFT;
2007 return HTLEFT;
2008 }
2009 /* Check right sizing border */
2010 if (pt.x >= rcWindow.right)
2011 {
2012 if (pt.y < rcWindow.top+UserGetSystemMetrics(SM_CYSIZE)) return HTTOPRIGHT;
2013 if (pt.y >= rcWindow.bottom-UserGetSystemMetrics(SM_CYSIZE)) return HTBOTTOMRIGHT;
2014 return HTRIGHT;
2015 }
2016 }
2017 }
2018 else /* No thick frame */
2019 {
2020 if (HAS_DLGFRAME( Style, ExStyle ))
2022 else if (HAS_THINFRAME( Style, ExStyle ))
2024 else if (HAS_CLIENTFRAME( Style, ExStyle ))
2026 if (!RECTL_bPointInRect( &rcWindow, pt.x, pt.y )) return HTBORDER;
2027 }
2028
2029 /* Check caption */
2030
2031 if ((Style & WS_CAPTION) == WS_CAPTION)
2032 {
2034 rcWindow.top += UserGetSystemMetrics(SM_CYSMCAPTION) - 1;
2035 else
2036 rcWindow.top += UserGetSystemMetrics(SM_CYCAPTION) - 1;
2037 if (!RECTL_bPointInRect( &rcWindow, pt.x, pt.y ))
2038 {
2039 BOOL min_or_max_box = (Style & WS_SYSMENU) && (Style & (WS_MINIMIZEBOX|WS_MAXIMIZEBOX));
2041 {
2042 /* Check system menu */
2043 if ((Style & WS_SYSMENU) && !(ExStyle & WS_EX_TOOLWINDOW) && NC_IconForWindow(pWnd))
2044 {
2045 rcWindow.right -= UserGetSystemMetrics(SM_CYCAPTION) - 1;
2046 if (pt.x > rcWindow.right) return HTSYSMENU;
2047 }
2048
2049 /* Check close button */
2050 if (Style & WS_SYSMENU)
2051 {
2053 if (pt.x < rcWindow.left) return HTCLOSE;
2054 }
2055
2056 /* Check maximize box */
2057 /* In Win95 there is automatically a Maximize button when there is a minimize one */
2058 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2059 {
2060 rcWindow.left += UserGetSystemMetrics(SM_CXSIZE);
2061 if (pt.x < rcWindow.left) return HTMAXBUTTON;
2062 }
2063
2064 /* Check minimize box */
2065 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2066 {
2067 rcWindow.left += UserGetSystemMetrics(SM_CXSIZE);
2068 if (pt.x < rcWindow.left) return HTMINBUTTON;
2069 }
2070 }
2071 else
2072 {
2073 /* Check system menu */
2074 if ((Style & WS_SYSMENU) && !(ExStyle & WS_EX_TOOLWINDOW) && NC_IconForWindow(pWnd))
2075 {
2076 rcWindow.left += UserGetSystemMetrics(SM_CYCAPTION) - 1;
2077 if (pt.x < rcWindow.left) return HTSYSMENU;
2078 }
2079
2080 /* Check close button */
2081 if (Style & WS_SYSMENU)
2082 {
2084 if (pt.x > rcWindow.right) return HTCLOSE;
2085 }
2086
2087 /* Check maximize box */
2088 /* In Win95 there is automatically a Maximize button when there is a minimize one */
2089 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2090 {
2092 if (pt.x > rcWindow.right) return HTMAXBUTTON;
2093 }
2094
2095 /* Check minimize box */
2096 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2097 {
2099 if (pt.x > rcWindow.right) return HTMINBUTTON;
2100 }
2101 }
2102 return HTCAPTION;
2103 }
2104 }
2105
2106 /* Check menu bar */
2107
2108 if (HAS_MENU( pWnd, Style ) && (pt.y < rcClient.top) &&
2109 (pt.x >= rcClient.left) && (pt.x < rcClient.right))
2110 return HTMENU;
2111
2112 /* Check vertical scroll bar */
2113
2115 if (Style & WS_VSCROLL)
2116 {
2117 if((ExStyle & WS_EX_LEFTSCROLLBAR) != 0)
2119 else
2121 if (RECTL_bPointInRect( &rcClient, pt.x, pt.y )) return HTVSCROLL;
2122 }
2123
2124 /* Check horizontal scroll bar */
2125
2126 if (Style & WS_HSCROLL)
2127 {
2129 if (RECTL_bPointInRect( &rcClient, pt.x, pt.y ))
2130 {
2131 /* Check size box */
2132 if ((Style & WS_VSCROLL) &&
2133 ((((ExStyle & WS_EX_LEFTSCROLLBAR) != 0) && (pt.x <= rcClient.left + UserGetSystemMetrics(SM_CXVSCROLL))) ||
2134 (((ExStyle & WS_EX_LEFTSCROLLBAR) == 0) && (pt.x >= rcClient.right - UserGetSystemMetrics(SM_CXVSCROLL)))))
2135 return HTSIZE;
2136 return HTHSCROLL;
2137 }
2138 }
2139
2140 /* Has to return HTNOWHERE if nothing was found
2141 Could happen when a window has a customized non client area */
2142 return HTNOWHERE;
2143}
#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:712
#define HAS_MENU(hwnd, style)
Definition: uxthemep.h:236
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:703
#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 WS_EX_LAYOUTRTL
Definition: winuser.h:390
#define HTTOPRIGHT
Definition: winuser.h:2482
#define HTCLOSE
Definition: winuser.h:2489
#define SM_CYEDGE
Definition: winuser.h:1003
#define SM_CXEDGE
Definition: winuser.h:1002
#define HTTOPLEFT
Definition: winuser.h:2481
#define SM_CXVSCROLL
Definition: winuser.h:955
#define HTBORDER
Definition: winuser.h:2487
#define HTVSCROLL
Definition: winuser.h:2472
#define HTHSCROLL
Definition: winuser.h:2471
#define HTMAXBUTTON
Definition: winuser.h:2474
#define SM_CYHSCROLL
Definition: winuser.h:956
#define HTMENU
Definition: winuser.h:2470
#define SM_CYBORDER
Definition: winuser.h:959
#define SM_CXBORDER
Definition: winuser.h:958
#define HTCLIENT
Definition: winuser.h:2465
#define HTNOWHERE
Definition: winuser.h:2464
#define SM_CXDLGFRAME
Definition: winuser.h:960
#define HTSIZE
Definition: winuser.h:2469
#define HTBOTTOMLEFT
Definition: winuser.h:2484
#define SM_CYSMCAPTION
Definition: winuser.h:1008
#define SM_CYDLGFRAME
Definition: winuser.h:962
#define WS_EX_LEFTSCROLLBAR
Definition: winuser.h:392
#define HTMINBUTTON
Definition: winuser.h:2473
#define SM_CYCAPTION
Definition: winuser.h:957

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

◆ IntIsScrollBarVisible()

BOOL IntIsScrollBarVisible ( PWND  pWnd,
INT  hBar 
)

Definition at line 757 of file nonclient.c.

758{
759 SCROLLBARINFO sbi;
760 sbi.cbSize = sizeof(SCROLLBARINFO);
761
762 if(!co_IntGetScrollBarInfo(pWnd, hBar, &sbi))
763 return FALSE;
764
765 return !(sbi.rgstate[0] & STATE_SYSTEM_OFFSCREEN);
766}
BOOL FASTCALL co_IntGetScrollBarInfo(PWND, LONG, PSCROLLBARINFO)
Definition: scrollbar.c:666
DWORD rgstate[CCHILDREN_SCROLLBAR+1]
Definition: winuser.h:3744
#define STATE_SYSTEM_OFFSCREEN
Definition: winuser.h:2868
struct tagSCROLLBARINFO SCROLLBARINFO

Referenced by NC_DoNCPaint().

◆ NC_DoButton()

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

Definition at line 1462 of file nonclient.c.

1463{
1464 MSG Msg;
1465 HDC WindowDC;
1466 BOOL Pressed = TRUE, OldState;
1467 WPARAM SCMsg;
1468 PMENU SysMenu;
1469 ULONG ButtonType;
1470 DWORD Style;
1471 UINT MenuState;
1472
1473 Style = pWnd->style;
1474 switch (wParam)
1475 {
1476 case HTCLOSE:
1477 SysMenu = IntGetSystemMenu(pWnd, FALSE);
1478 MenuState = IntGetMenuState(SysMenu ? UserHMGetHandle(SysMenu) : NULL, SC_CLOSE, MF_BYCOMMAND); /* in case of error MenuState==0xFFFFFFFF */
1479 if (!(Style & WS_SYSMENU) || (MenuState & (MF_GRAYED|MF_DISABLED)) || (pWnd->style & CS_NOCLOSE))
1480 return;
1481 ButtonType = DFCS_CAPTIONCLOSE;
1482 SCMsg = SC_CLOSE;
1483 break;
1484 case HTMINBUTTON:
1485 if (!(Style & WS_MINIMIZEBOX))
1486 return;
1487 ButtonType = DFCS_CAPTIONMIN;
1488 SCMsg = ((Style & WS_MINIMIZE) ? SC_RESTORE : SC_MINIMIZE);
1489 break;
1490 case HTMAXBUTTON:
1491 if (!(Style & WS_MAXIMIZEBOX))
1492 return;
1493 ButtonType = DFCS_CAPTIONMAX;
1494 SCMsg = ((Style & WS_MAXIMIZE) ? SC_RESTORE : SC_MAXIMIZE);
1495 break;
1496
1497 default:
1498 ASSERT(FALSE);
1499 return;
1500 }
1501
1502 /*
1503 * FIXME: Not sure where to do this, but we must flush the pending
1504 * window updates when someone clicks on the close button and at
1505 * the same time the window is overlapped with another one. This
1506 * looks like a good place for now...
1507 */
1509
1510 WindowDC = UserGetWindowDC(pWnd);
1511 UserDrawCaptionButtonWnd(pWnd, WindowDC, TRUE, ButtonType);
1512
1514
1515 for (;;)
1516 {
1518 if (IntCallMsgFilter( &Msg, MSGF_MAX )) continue;
1519
1520 if (Msg.message == WM_LBUTTONUP)
1521 break;
1522
1523 if (Msg.message != WM_MOUSEMOVE)
1524 continue;
1525
1526 OldState = Pressed;
1527 Pressed = (GetNCHitEx(pWnd, Msg.pt) == wParam);
1528 if (Pressed != OldState)
1529 UserDrawCaptionButtonWnd(pWnd, WindowDC, Pressed, ButtonType);
1530 }
1531
1532 if (Pressed)
1533 UserDrawCaptionButtonWnd(pWnd, WindowDC, FALSE, ButtonType);
1535 UserReleaseDC(pWnd, WindowDC, FALSE);
1536 if (Pressed)
1537 co_IntSendMessage(UserHMGetHandle(pWnd), WM_SYSCOMMAND, SCMsg, SCMsg == SC_CLOSE ? lParam : MAKELONG(Msg.pt.x,Msg.pt.y));
1538}
struct @1611 Msg[]
LPARAM lParam
Definition: combotst.c:139
#define ASSERT(a)
Definition: mode.c:44
unsigned int UINT
Definition: ndis.h:50
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:5381
UINT FASTCALL IntGetMenuState(HMENU hMenu, UINT uId, UINT uFlags)
Definition: menu.c:4973
VOID UserDrawCaptionButtonWnd(PWND pWnd, HDC hDC, BOOL bDown, ULONG Type)
Definition: nonclient.c:857
#define MF_BYCOMMAND
Definition: winuser.h:202
#define WM_MOUSEFIRST
Definition: winuser.h:1764
#define WM_MOUSELAST
Definition: winuser.h:1791
#define DFCS_CAPTIONMIN
Definition: winuser.h:481
#define DFCS_CAPTIONCLOSE
Definition: winuser.h:480
#define SC_MINIMIZE
Definition: winuser.h:2576
#define SC_CLOSE
Definition: winuser.h:2582
#define MSGF_MAX
Definition: winuser.h:1172
#define DFCS_CAPTIONMAX
Definition: winuser.h:482
#define CS_NOCLOSE
Definition: winuser.h:649
#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 1387 of file nonclient.c.

1388{
1389 INT Ret = 0;
1390
1393 Ret = DC_CAPTION;
1394
1395 if (!(Wnd->style & WS_MINIMIZED) && UserHasThickFrameStyle(Wnd->style, Wnd->ExStyle))
1396 {
1397 //if (IntGetSysColor(COLOR_ACTIVEBORDER) != IntGetSysColor(COLOR_INACTIVEBORDER)) // Why are these the same?
1398 {
1399 Ret = DC_FRAME;
1400 }
1401 }
1402 return Ret;
1403}
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:928
#define COLOR_ACTIVECAPTION
Definition: winuser.h:909
#define DC_CAPTION
Definition: winuser.h:439
#define COLOR_INACTIVECAPTION
Definition: winuser.h:910
#define COLOR_CAPTIONTEXT
Definition: winuser.h:916

Referenced by NC_HandleNCActivate().

◆ NC_DoNCPaint()

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

Definition at line 1064 of file nonclient.c.

1065{
1067 PWND Parent;
1068 RECT WindowRect, CurrentRect, TempRect;
1069 BOOL Active = FALSE;
1070
1071 if (!IntIsWindowVisible(pWnd) ||
1072 (pWnd->state & WNDS_NONCPAINT && !(pWnd->state & WNDS_FORCEMENUDRAW)) ||
1073 IntEqualRect(&pWnd->rcWindow, &pWnd->rcClient) )
1074 return 0;
1075
1076 Style = pWnd->style;
1077
1078 TRACE("DefWndNCPaint: pWnd %p, hDc %p, Active %s.\n", pWnd, hDC, Flags & DC_ACTIVE ? "TRUE" : "FALSE");
1079
1080 Parent = IntGetParent(pWnd);
1081 ExStyle = pWnd->ExStyle;
1082
1083 if (Flags == -1) // NC paint mode.
1084 {
1085 if (ExStyle & WS_EX_MDICHILD)
1086 {
1088
1089 if (Active)
1091 }
1092 else
1093 {
1094 Active = (gpqForeground == pWnd->head.pti->MessageQueue);
1095 }
1096 Flags = DC_NC; // Redraw everything!
1097 }
1098 else
1099 Flags |= DC_NC;
1100
1101
1102 IntGetWindowRect(pWnd, &WindowRect);
1103
1104 CurrentRect.top = CurrentRect.left = 0;
1105 CurrentRect.right = WindowRect.right - WindowRect.left;
1106 CurrentRect.bottom = WindowRect.bottom - WindowRect.top;
1107
1108 /* Draw outer edge */
1109 if (UserHasWindowEdge(pWnd->style, pWnd->ExStyle))
1110 {
1111 DrawEdge(hDC, &CurrentRect, EDGE_RAISED, BF_RECT | BF_ADJUST);
1112 }
1113 else if (pWnd->ExStyle & WS_EX_STATICEDGE)
1114 {
1115#if 0
1116 DrawEdge(hDC, &CurrentRect, BDR_SUNKENINNER, BF_RECT | BF_ADJUST | BF_FLAT);
1117#else
1119 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.top, CurrentRect.right - CurrentRect.left, 1, PATCOPY);
1120 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY);
1121
1123 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.bottom - 1, CurrentRect.right - CurrentRect.left, 1, PATCOPY);
1124 NtGdiPatBlt(hDC, CurrentRect.right - 1, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY);
1125
1126 RECTL_vInflateRect(&CurrentRect, -1, -1);
1127#endif
1128 }
1129
1130 if (Flags & DC_FRAME) NC_DrawFrame(hDC, &CurrentRect, Active ? Active : (Flags & DC_ACTIVE), Style, ExStyle);
1131
1132 /* Draw caption */
1133 if ((Style & WS_CAPTION) == WS_CAPTION)
1134 {
1135 HPEN PreviousPen;
1136 BOOL Gradient = FALSE;
1137
1138 if (Flags & DC_REDRAWHUNGWND)
1139 {
1140 Flags &= ~DC_REDRAWHUNGWND;
1142 }
1143
1144 if (UserSystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &Gradient, 0) && Gradient)
1145 {
1146 Flags |= DC_GRADIENT;
1147 }
1148
1149 if (Active)
1150 {
1151 if (pWnd->state & WNDS_ACTIVEFRAME)
1152 Flags |= DC_ACTIVE;
1153 else
1154 {
1155 ERR("Wnd is active and not set active!\n");
1156 }
1157 }
1158
1159 TempRect = CurrentRect;
1160
1162 {
1163 Flags |= DC_SMALLCAP;
1164 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSMCAPTION) - 1;
1165 CurrentRect.top += UserGetSystemMetrics(SM_CYSMCAPTION);
1166 }
1167 else
1168 {
1169 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYCAPTION) - 1;
1170 CurrentRect.top += UserGetSystemMetrics(SM_CYCAPTION);
1171 }
1172
1173 UserDrawCaption(pWnd, hDC, &TempRect, NULL, NULL, NULL, Flags);
1174
1175 /* Draw buttons */
1176 if (Style & WS_SYSMENU)
1177 {
1180 {
1183 }
1184 }
1185 if (!(Style & WS_MINIMIZE))
1186 {
1187 /* Line under caption */
1188 PreviousPen = NtGdiSelectPen(hDC, NtGdiGetStockObject(DC_PEN));
1189
1193
1194 GreMoveTo(hDC, TempRect.left, TempRect.bottom, NULL);
1195
1196 NtGdiLineTo(hDC, TempRect.right, TempRect.bottom);
1197
1198 NtGdiSelectPen(hDC, PreviousPen);
1199 }
1200 }
1201
1202 if (!(Style & WS_MINIMIZE))
1203 {
1204 /* Draw menu bar */
1205 if (pWnd->state & WNDS_HASMENU && pWnd->IDMenu) // Should be pWnd->spmenu
1206 {
1207 if (!(Flags & DC_NOSENDMSG))
1208 {
1209 PMENU menu;
1210 // Fix crash in test_menu_locked_by_window, should use pWnd->spmenu....
1211 if ((menu = UserGetMenuObject(UlongToHandle(pWnd->IDMenu)))) // FIXME! Use pWnd->spmenu,
1212 {
1213 TempRect = CurrentRect;
1214 TempRect.bottom = TempRect.top + menu->cyMenu; // Should be pWnd->spmenu->cyMenu;
1215 CurrentRect.top += MENU_DrawMenuBar(hDC, &TempRect, pWnd, FALSE);
1216 }
1217 }
1218 }
1219
1221 {
1222 DrawEdge(hDC, &CurrentRect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
1223 }
1224
1225 /* Draw the scrollbars */
1226 if ((Style & WS_VSCROLL) && (Style & WS_HSCROLL) &&
1228 {
1229 RECT ParentClientRect;
1230
1231 TempRect = CurrentRect;
1232
1234 TempRect.right = TempRect.left + UserGetSystemMetrics(SM_CXVSCROLL);
1235 else
1236 TempRect.left = TempRect.right - UserGetSystemMetrics(SM_CXVSCROLL);
1237
1238 TempRect.top = TempRect.bottom - UserGetSystemMetrics(SM_CYHSCROLL);
1239
1241
1242 if (Parent)
1243 {
1244 IntGetClientRect(Parent, &ParentClientRect);
1245
1246 if (HASSIZEGRIP(Style, ExStyle, Parent->style, WindowRect, ParentClientRect))
1247 {
1249 }
1250 }
1251
1254 }
1255 else
1256 {
1258 {
1260 }
1262 {
1264 }
1265 }
1266 }
1267 return 0; // For WM_NCPAINT message, return 0.
1268}
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
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:41
PUSER_MESSAGE_QUEUE gpqForeground
Definition: focus.c:13
#define WNDS_ACTIVEFRAME
Definition: ntuser.h:606
#define WNDS_NONCPAINT
Definition: ntuser.h:608
#define WNDS_HASMENU
Definition: ntuser.h:600
#define WNDS_FORCEMENUDRAW
Definition: ntuser.h:615
HGDIOBJ FASTCALL IntGetSysColorBrush(INT Object)
Definition: stockobj.c:317
BOOL FASTCALL GreMoveTo(HDC hdc, INT x, INT y, LPPOINT pptOut)
Definition: line.c:108
__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:984
__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:696
UINT_PTR IDMenu
Definition: ntuser.h:726
ULONG cyMenu
Definition: ntuser.h:418
#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:2197
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:4
#define HASSIZEGRIP(Style, ExStyle, ParentStyle, WindowRect, ParentClientRect)
Definition: uxthemep.h:230
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:757
VOID UserDrawCaptionButton(PWND pWnd, LPRECT Rect, DWORD Style, DWORD ExStyle, HDC hDC, BOOL bDown, ULONG Type)
Definition: nonclient.c:775
VOID NC_DrawFrame(HDC hDC, RECT *CurrentRect, BOOL Active, DWORD Style, DWORD ExStyle)
Definition: nonclient.c:876
BOOL FASTCALL IntIsChildWindow(PWND Parent, PWND BaseWindow)
Definition: window.c:927
#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)
#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:913
BOOL WINAPI DrawFrameControl(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define SB_VERT
Definition: winuser.h:553
#define DC_ACTIVE
Definition: winuser.h:427
#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:924
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define WM_MDIGETACTIVE
Definition: winuser.h:1811
#define DC_SMALLCAP
Definition: winuser.h:428
#define COLOR_BTNHIGHLIGHT
Definition: winuser.h:929
#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:922
#define COLOR_3DFACE
Definition: winuser.h:923
_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 876 of file nonclient.c.

877{
878 /* Firstly the "thick" frame */
879 if ((Style & WS_THICKFRAME) && !(Style & WS_MINIMIZE))
880 {
881 LONG Width =
884
885 LONG Height =
888
890
891 /* Draw frame */
892 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, CurrentRect->right - CurrentRect->left, Height, PATCOPY);
893 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
894 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->bottom - 1, CurrentRect->right - CurrentRect->left, -Height, PATCOPY);
895 NtGdiPatBlt(hDC, CurrentRect->right - 1, CurrentRect->top, -Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
896
897 RECTL_vInflateRect(CurrentRect, -Width, -Height);
898 }
899
900 /* Now the other bit of the frame */
902 {
905
911
912 /* Draw frame */
913 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, CurrentRect->right - CurrentRect->left, Height, PATCOPY);
914 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
915 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->bottom - 1, CurrentRect->right - CurrentRect->left, -Height, PATCOPY);
916 NtGdiPatBlt(hDC, CurrentRect->right - 1, CurrentRect->top, -Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
917
918 RECTL_vInflateRect(CurrentRect, -Width, -Height);
919 }
920}
_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:917
#define COLOR_INACTIVEBORDER
Definition: winuser.h:918

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

1406{
1407 INT Flags;
1408 /* Lotus Notes draws menu descriptions in the caption of its main
1409 * window. When it wants to restore original "system" view, it just
1410 * sends WM_NCACTIVATE message to itself. Any optimizations here in
1411 * attempt to minimize redrawings lead to a not restored caption.
1412 */
1413 if (wParam & DC_ACTIVE)
1414 {
1417 }
1418 else
1419 {
1420 Wnd->state &= ~WNDS_ACTIVEFRAME;
1422 }
1423
1424 if ((Wnd->state & WNDS_NONCPAINT) || !(Wnd->style & WS_VISIBLE))
1425 return TRUE;
1426
1427 /* This isn't documented but is reproducible in at least XP SP2 and
1428 * Outlook 2007 depends on it
1429 */
1430 // MSDN:
1431 // If this parameter is set to -1, DefWindowProc does not repaint the
1432 // nonclient area to reflect the state change.
1433 if ( lParam != -1 &&
1434 ( Flags = NC_DoNCActive(Wnd)) != 0 )
1435 {
1436 HDC hDC;
1437 HRGN hRgnTemp = NULL, hRgn = (HRGN)lParam;
1438
1440 {
1441 hRgnTemp = NtGdiCreateRectRgn(0, 0, 0, 0);
1442 if (NtGdiCombineRgn(hRgnTemp, hRgn, 0, RGN_COPY) == ERROR)
1443 {
1444 GreDeleteObject(hRgnTemp);
1445 hRgnTemp = NULL;
1446 }
1447 }
1448
1449 if ((hDC = UserGetDCEx(Wnd, hRgnTemp, DCX_WINDOW|DCX_USESTYLE)))
1450 {
1451 NC_DoNCPaint(Wnd, hDC, wParam | Flags); // Redraw MENUs.
1452 UserReleaseDC(Wnd, hDC, FALSE);
1453 }
1454 else
1455 GreDeleteObject(hRgnTemp);
1456 }
1457
1458 return TRUE;
1459}
#define DCX_USESTYLE
Definition: GetDCEx.c:10
#define ERROR(name)
Definition: error_private.h:53
#define WNDS_HASCAPTION
Definition: ntuser.h:603
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)
BOOL NTAPI GreIsHandleValid(HGDIOBJ hobj)
Definition: gdiobj.c:1146
LRESULT NC_DoNCPaint(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:1064
static INT NC_DoNCActive(PWND Wnd)
Definition: nonclient.c:1387
#define RGN_COPY
Definition: wingdi.h:357
#define DCX_WINDOW
Definition: winuser.h:2103

Referenced by IntDefWindowProc().

◆ NC_HandleNCCalcSize()

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

Definition at line 1271 of file nonclient.c.

1272{
1273 LRESULT Result = 0;
1274 SIZE WindowBorders;
1275 RECT OrigRect;
1276 LONG Style = Wnd->style;
1277 LONG exStyle = Wnd->ExStyle;
1278
1279 if (Rect == NULL)
1280 {
1281 return Result;
1282 }
1283 OrigRect = *Rect;
1284
1285 Wnd->state &= ~WNDS_HASCAPTION;
1286
1287 if (wparam)
1288 {
1289 if (Wnd->pcls->style & CS_VREDRAW)
1290 {
1292 }
1293 if (Wnd->pcls->style & CS_HREDRAW)
1294 {
1296 }
1298 }
1299
1300 if (!(Wnd->style & WS_MINIMIZE))
1301 {
1302 if (UserHasWindowEdge(Wnd->style, Wnd->ExStyle))
1303 {
1304 UserGetWindowBorders(Wnd->style, Wnd->ExStyle, &WindowBorders, FALSE);
1305 RECTL_vInflateRect(Rect, -WindowBorders.cx, -WindowBorders.cy);
1306 }
1307 else if ((Wnd->ExStyle & WS_EX_STATICEDGE) || (Wnd->style & WS_BORDER))
1308 {
1309 RECTL_vInflateRect(Rect, -1, -1);
1310 }
1311
1312 if ((Wnd->style & WS_CAPTION) == WS_CAPTION)
1313 {
1314 Wnd->state |= WNDS_HASCAPTION;
1315
1316 if (Wnd->ExStyle & WS_EX_TOOLWINDOW)
1318 else
1320 }
1321
1322 if (HAS_MENU(Wnd, Style))
1323 {
1325
1326 Wnd->state |= WNDS_HASMENU;
1327
1328 if (hDC)
1329 {
1330 RECT CliRect = *Rect;
1331 CliRect.bottom -= OrigRect.top;
1332 CliRect.right -= OrigRect.left;
1333 CliRect.left -= OrigRect.left;
1334 CliRect.top -= OrigRect.top;
1335 if (!Suspended) Rect->top += MENU_DrawMenuBar(hDC, &CliRect, Wnd, TRUE);
1336 UserReleaseDC(Wnd, hDC, FALSE);
1337 }
1338 }
1339
1340 if (Wnd->ExStyle & WS_EX_CLIENTEDGE)
1341 {
1343 }
1344
1345 if (Style & WS_VSCROLL)
1346 {
1347 if (Rect->right - Rect->left >= UserGetSystemMetrics(SM_CXVSCROLL))
1348 {
1350
1351 /* rectangle is in screen coords when wparam is false */
1352 if (!wparam && (exStyle & WS_EX_LAYOUTRTL)) exStyle ^= WS_EX_LEFTSCROLLBAR;
1353
1354 if((exStyle & WS_EX_LEFTSCROLLBAR) != 0)
1356 else
1358 }
1359 }
1360
1361 if (Style & WS_HSCROLL)
1362 {
1363 if( Rect->bottom - Rect->top > UserGetSystemMetrics(SM_CYHSCROLL))
1364 {
1366
1368 }
1369 }
1370
1371 if (Rect->top > Rect->bottom)
1372 Rect->bottom = Rect->top;
1373
1374 if (Rect->left > Rect->right)
1375 Rect->right = Rect->left;
1376 }
1377 else
1378 {
1379 Rect->right = Rect->left;
1380 Rect->bottom = Rect->top;
1381 }
1382
1383 return Result;
1384}
@ wparam
Definition: SystemMenu.c:30
#define WNDS_HASHORIZONTALSCROLLBAR
Definition: ntuser.h:602
#define WNDS_HASVERTICALSCROOLLBAR
Definition: ntuser.h:601
VOID UserGetWindowBorders(DWORD Style, DWORD ExStyle, SIZE *Size, BOOL WithClient)
Definition: winpos.c:888
UINT style
Definition: ntuser.h:575
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:653
#define WVR_VALIDRECTS
Definition: winuser.h:2512
#define CS_HREDRAW
Definition: winuser.h:648
#define WVR_VREDRAW
Definition: winuser.h:2510
#define WVR_HREDRAW
Definition: winuser.h:2509
_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:408

Referenced by IntDefWindowProc().

◆ NC_HandleNCLButtonDblClk()

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

Definition at line 1634 of file nonclient.c.

1635{
1636 ULONG Style;
1637
1638 Style = pWnd->style;
1639 switch(wParam)
1640 {
1641 case HTCAPTION:
1642 {
1643 /* Maximize/Restore the window */
1645 {
1647 }
1648 break;
1649 }
1650 case HTSYSMENU:
1651 {
1652 PMENU SysMenu = IntGetSystemMenu(pWnd, FALSE);
1654
1655 /* If the close item of the sysmenu is disabled or not present do nothing */
1656 if ((state & (MF_DISABLED | MF_GRAYED)) || (state == 0xFFFFFFFF))
1657 break;
1658
1660 break;
1661 }
1662 case HTTOP:
1663 case HTBOTTOM:
1664 {
1665 RECT sizingRect = pWnd->rcWindow, mouseRect;
1666
1667 if (pWnd->ExStyle & WS_EX_MDICHILD)
1668 break;
1669
1670 UserSystemParametersInfo(SPI_GETWORKAREA, 0, &mouseRect, 0);
1671
1673 NULL,
1674 sizingRect.left,
1675 mouseRect.top,
1676 sizingRect.right - sizingRect.left,
1677 mouseRect.bottom - mouseRect.top,
1678 0);
1679 break;
1680 }
1681 default:
1682 return NC_HandleNCLButtonDown(pWnd, wParam, lParam);
1683 }
1684 return(0);
1685}
static int state
Definition: maze.c:121
LRESULT NC_HandleNCLButtonDown(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1542

Referenced by IntDefWindowProc().

◆ NC_HandleNCLButtonDown()

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

Definition at line 1542 of file nonclient.c.

1543{
1544 switch (wParam)
1545 {
1546 case HTCAPTION:
1547 {
1548 PWND TopWnd = pWnd, parent;
1549 while(1)
1550 {
1551 if ((TopWnd->style & (WS_POPUP|WS_CHILD)) != WS_CHILD)
1552 break;
1553 parent = UserGetAncestor( TopWnd, GA_PARENT );
1554 if (!parent || UserIsDesktopWindow(parent)) break;
1555 TopWnd = parent;
1556 }
1557
1558 if ( (pWnd && (pWnd->ExStyle & WS_EX_NOACTIVATE)) ||
1560 //NtUserCallHwndLock(hTopWnd, HWNDLOCK_ROUTINE_SETFOREGROUNDWINDOWMOUSE) ||
1562 {
1564 }
1565 break;
1566 }
1567 case HTSYSMENU:
1568 {
1569 LONG style = pWnd->style;
1570 if (style & WS_SYSMENU)
1571 {
1572 if(!(style & WS_MINIMIZE) )
1573 {
1574 RECT rect;
1575 HDC hDC = UserGetWindowDC(pWnd);
1576 NC_GetInsideRect(pWnd, &rect);
1578 UserReleaseDC( pWnd, hDC, FALSE );
1579 }
1581 }
1582 break;
1583 }
1584 case HTMENU:
1585 {
1587 break;
1588 }
1589 case HTHSCROLL:
1590 {
1592 break;
1593 }
1594 case HTVSCROLL:
1595 {
1597 break;
1598 }
1599 case HTMINBUTTON:
1600 case HTMAXBUTTON:
1601 case HTCLOSE:
1602 {
1603 NC_DoButton(pWnd, wParam, lParam);
1604 break;
1605 }
1606 case HTLEFT:
1607 case HTRIGHT:
1608 case HTTOP:
1609 case HTBOTTOM:
1610 case HTTOPLEFT:
1611 case HTTOPRIGHT:
1612 case HTBOTTOMLEFT:
1613 case HTBOTTOMRIGHT:
1614 {
1615 /* Old comment:
1616 * "make sure hittest fits into 0xf and doesn't overlap with HTSYSMENU"
1617 * This was previously done by setting wParam=SC_SIZE + wParam - 2
1618 */
1619 /* But that is not what WinNT does. Instead it sends this. This
1620 * is easy to differentiate from HTSYSMENU, because HTSYSMENU adds
1621 * SC_MOUSEMENU into wParam.
1622 */
1624 break;
1625 }
1626 case HTBORDER:
1627 break;
1628 }
1629 return(0);
1630}
Arabic default style
Definition: afstyles.h:94
r parent
Definition: btrfs.c:3010
BOOL FASTCALL co_IntSetForegroundWindowMouse(PWND Window)
Definition: focus.c:1561
HWND FASTCALL UserGetActiveWindow(VOID)
Definition: focus.c:1429
PWND FASTCALL UserGetAncestor(PWND Wnd, UINT Type)
Definition: window.c:3349
BOOL UserDrawSysMenuButton(PWND pWnd, HDC hDC, LPRECT Rect, BOOL Down)
Definition: nonclient.c:734
VOID NC_DoButton(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1462
#define SC_HSCROLL
Definition: winuser.h:2584
#define SC_VSCROLL
Definition: winuser.h:2583
#define WS_EX_NOACTIVATE
Definition: winuser.h:395
#define GA_PARENT
Definition: winuser.h:2778

Referenced by IntDefWindowProc(), and NC_HandleNCLButtonDblClk().

◆ NC_HandleNCRButtonDown()

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

Definition at line 1692 of file nonclient.c.

1693{
1694 MSG msg;
1695 INT hittest = wParam;
1696
1697 switch (hittest)
1698 {
1699 case HTCAPTION:
1700 case HTSYSMENU:
1701 if (!IntGetSystemMenu( pwnd, FALSE )) break;
1702
1704 for (;;)
1705 {
1707 if (IntCallMsgFilter( &msg, MSGF_MAX )) continue;
1708 if (msg.message == WM_RBUTTONUP)
1709 {
1710 hittest = GetNCHitEx( pwnd, msg.pt );
1711 break;
1712 }
1713 if (UserHMGetHandle(pwnd) != IntGetCapture()) return 0;
1714 }
1716
1717 if (hittest == HTCAPTION || hittest == HTSYSMENU || hittest == HTHSCROLL || hittest == HTVSCROLL)
1718 {
1719 TRACE("Msg pt %x and Msg.lParam %x and lParam %x\n",MAKELONG(msg.pt.x,msg.pt.y),msg.lParam,lParam);
1721 }
1722 break;
1723 }
1724 return 0;
1725}
#define WM_CONTEXTMENU
Definition: richedit.h:64
#define WM_RBUTTONUP
Definition: winuser.h:1770

Referenced by IntDefWindowProc().

◆ NC_IconForWindow()

PCURICON_OBJECT FASTCALL NC_IconForWindow ( PWND  pWnd)

Definition at line 703 of file nonclient.c.

704{
705 PCURICON_OBJECT pIcon = NULL;
706 HICON hIcon;
707
709 if (!hIcon) hIcon = UserGetProp(pWnd, gpsi->atomIconProp, TRUE);
710
711 if (!hIcon && pWnd->pcls->spicnSm)
712 return pWnd->pcls->spicnSm;
713 if (!hIcon && pWnd->pcls->spicn)
714 return pWnd->pcls->spicn;
715
716 // WARNING: Wine code has this test completely wrong. The following is how
717 // Windows behaves for windows having the WS_EX_DLGMODALFRAME style set:
718 // it does not use the default icon! And it does not check for DS_MODALFRAME.
719 if (!hIcon && !(pWnd->ExStyle & WS_EX_DLGMODALFRAME))
720 {
721 hIcon = gpsi->hIconSmWindows; // Both are IDI_WINLOGO Small
722 if (!hIcon) hIcon = gpsi->hIconWindows; // Reg size.
723 }
724 if (hIcon)
725 {
727 hIcon,
729 }
730 return pIcon;
731}
struct _CURICON_OBJECT * PCURICON_OBJECT
PSERVERINFO gpsi
Definition: imm.c:18
@ TYPE_CURSOR
Definition: ntuser.h:43
static HICON
Definition: imagelist.c:84
HICON hIcon
Definition: msconfig.c:44
struct _CURICON_OBJECT * spicnSm
Definition: ntuser.h:585
ATOM atomIconProp
Definition: ntuser.h:1061
ATOM atomIconSmProp
Definition: ntuser.h:1060
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 922 of file nonclient.c.

926{
928 RECT WindowRect, CurrentRect, TempRect;
929 HPEN PreviousPen;
930 BOOL Gradient = FALSE;
931 PCURICON_OBJECT pIcon = NULL;
932
933 if (!(Flags & DC_NOVISIBLE) && !IntIsWindowVisible(pWnd)) return;
934
935 TRACE("UserDrawCaptionBar: pWnd %p, hDc %p, Flags 0x%x.\n", pWnd, hDC, Flags);
936
937 Style = pWnd->style;
938 ExStyle = pWnd->ExStyle;
939
940 IntGetWindowRect(pWnd, &WindowRect);
941
942 CurrentRect.top = CurrentRect.left = 0;
943 CurrentRect.right = WindowRect.right - WindowRect.left;
944 CurrentRect.bottom = WindowRect.bottom - WindowRect.top;
945
946 /* Draw outer edge */
948 {
949 DrawEdge(hDC, &CurrentRect, EDGE_RAISED, BF_RECT | BF_ADJUST);
950 }
951 else if (ExStyle & WS_EX_STATICEDGE)
952 {
953#if 0
955#else
957 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.top, CurrentRect.right - CurrentRect.left, 1, PATCOPY);
958 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY);
959
961 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.bottom - 1, CurrentRect.right - CurrentRect.left, 1, PATCOPY);
962 NtGdiPatBlt(hDC, CurrentRect.right - 1, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY);
963
964 RECTL_vInflateRect(&CurrentRect, -1, -1);
965#endif
966 }
967
968 if (Flags & DC_FRAME) NC_DrawFrame(hDC, &CurrentRect, (Flags & DC_ACTIVE), Style, ExStyle);
969
970 /* Draw caption */
971 if ((Style & WS_CAPTION) == WS_CAPTION)
972 {
973 TempRect = CurrentRect;
974
975 Flags |= DC_TEXT|DC_BUTTONS; // Icon will be checked if not already set.
976
977 if (UserSystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &Gradient, 0) && Gradient)
978 {
979 Flags |= DC_GRADIENT;
980 }
981
983 {
985 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSMCAPTION) - 1;
987 }
988 else
989 {
990 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYCAPTION) - 1;
991 CurrentRect.top += UserGetSystemMetrics(SM_CYCAPTION);
992 }
993
994 if (!(Flags & DC_ICON) &&
995 !(Flags & DC_SMALLCAP) &&
996 (Style & WS_SYSMENU) &&
998 {
999 pIcon = NC_IconForWindow(pWnd); // Force redraw of caption with icon if DC_ICON not flaged....
1000 }
1001 UserDrawCaption(pWnd, hDC, &TempRect, NULL, pIcon ? UserHMGetHandle(pIcon) : NULL, NULL, Flags);
1002
1003 /* Draw buttons */
1004 if (Style & WS_SYSMENU)
1005 {
1008 {
1011 }
1012 }
1013
1014 if (!(Style & WS_MINIMIZE))
1015 {
1016 /* Line under caption */
1017 PreviousPen = NtGdiSelectPen(hDC, NtGdiGetStockObject(DC_PEN));
1018
1021
1022 GreMoveTo(hDC, TempRect.left, TempRect.bottom, NULL);
1023
1024 NtGdiLineTo(hDC, TempRect.right, TempRect.bottom);
1025
1026 NtGdiSelectPen(hDC, PreviousPen);
1027 }
1028 }
1029
1030 if (!(Style & WS_MINIMIZE))
1031 {
1032 /* Draw menu bar */
1033 if (pWnd->state & WNDS_HASMENU && pWnd->IDMenu) // Should be pWnd->spmenu
1034 {
1035 PMENU menu;
1036 if ((menu = UserGetMenuObject(UlongToHandle(pWnd->IDMenu)))) // FIXME! Use pWnd->spmenu,
1037 {
1038 TempRect = CurrentRect;
1039 TempRect.bottom = TempRect.top + menu->cyMenu; // Should be pWnd->spmenu->cyMenu;
1040 CurrentRect.top += MENU_DrawMenuBar(hDC, &TempRect, pWnd, FALSE);
1041 }
1042 }
1043
1045 {
1046 DrawEdge(hDC, &CurrentRect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
1047 }
1048 }
1049}
#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 775 of file nonclient.c.

776{
777 RECT TempRect;
778
779 if (!(Style & WS_SYSMENU))
780 {
781 return;
782 }
783
784 TempRect = *Rect;
785
786 switch (Type)
787 {
788 case DFCS_CAPTIONMIN:
789 {
791 return; /* ToolWindows don't have min/max buttons */
792
793 if (Style & WS_SYSMENU)
794 TempRect.right -= UserGetSystemMetrics(SM_CXSIZE) + 1;
795
797 TempRect.right -= UserGetSystemMetrics(SM_CXSIZE) - 2;
798
799 TempRect.left = TempRect.right - UserGetSystemMetrics(SM_CXSIZE) + 1;
800 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSIZE) - 2;
801 TempRect.top += 2;
802 TempRect.right -= 1;
803
804 DrawFrameControl(hDC, &TempRect, DFC_CAPTION,
806 (bDown ? DFCS_PUSHED : 0) |
808 break;
809 }
810 case DFCS_CAPTIONMAX:
811 {
813 return; /* ToolWindows don't have min/max buttons */
814
815 if (Style & WS_SYSMENU)
816 TempRect.right -= UserGetSystemMetrics(SM_CXSIZE) + 1;
817
818 TempRect.left = TempRect.right - UserGetSystemMetrics(SM_CXSIZE) + 1;
819 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSIZE) - 2;
820 TempRect.top += 2;
821 TempRect.right -= 1;
822
823 DrawFrameControl(hDC, &TempRect, DFC_CAPTION,
825 (bDown ? DFCS_PUSHED : 0) |
827 break;
828 }
830 {
831 PMENU pSysMenu = IntGetSystemMenu(pWnd, FALSE);
832 UINT MenuState = IntGetMenuState(pSysMenu ? UserHMGetHandle(pSysMenu) : NULL, SC_CLOSE, MF_BYCOMMAND); /* in case of error MenuState==0xFFFFFFFF */
833
834 /* A tool window has a smaller Close button */
836 {
837 TempRect.left = TempRect.right - UserGetSystemMetrics(SM_CXSMSIZE);
838 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSMSIZE) - 2;
839 }
840 else
841 {
842 TempRect.left = TempRect.right - UserGetSystemMetrics(SM_CXSIZE);
843 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSIZE) - 2;
844 }
845 TempRect.top += 2;
846 TempRect.right -= 2;
847
848 DrawFrameControl(hDC, &TempRect, DFC_CAPTION,
849 (DFCS_CAPTIONCLOSE | (bDown ? DFCS_PUSHED : 0) |
850 ((!(MenuState & (MF_GRAYED|MF_DISABLED)) && !(pWnd->pcls->style & CS_NOCLOSE)) ? 0 : DFCS_INACTIVE)));
851 break;
852 }
853 }
854}
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:1009
#define DFCS_CAPTIONRESTORE
Definition: winuser.h:483
#define SM_CYSMSIZE
Definition: winuser.h:1010
#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 857 of file nonclient.c.

858{
859 RECT WindowRect;
860 SIZE WindowBorder;
861
862 IntGetWindowRect(pWnd, &WindowRect);
863
864 WindowRect.right -= WindowRect.left;
865 WindowRect.bottom -= WindowRect.top;
866 WindowRect.left = WindowRect.top = 0;
867
868 UserGetWindowBorders(pWnd->style, pWnd->ExStyle, &WindowBorder, FALSE);
869
870 RECTL_vInflateRect(&WindowRect, -WindowBorder.cx, -WindowBorder.cy);
871
872 UserDrawCaptionButton(pWnd, &WindowRect, pWnd->style, pWnd->ExStyle, hDC, bDown, Type);
873}

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

735{
736 PCURICON_OBJECT WindowIcon;
737 BOOL Ret = FALSE;
738
739 if ((WindowIcon = NC_IconForWindow(pWnd)))
740 {
741 UserReferenceObject(WindowIcon);
742
743 Ret = UserDrawIconEx(hDC,
744 Rect->left + 2,
745 Rect->top + 2,
746 WindowIcon,
749 0, NULL, DI_NORMAL);
750
751 UserDereferenceObject(WindowIcon);
752 }
753 return Ret;
754}
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:1007
#define SM_CXSMICON
Definition: winuser.h:1006

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 - 1, rect->right - rect->left - width, -(LONG)height, PATINVERT );
51 NtGdiPatBlt( hdc, rect->right - 1, rect->top, -(LONG)width, rect->bottom - rect->top - height, PATINVERT );
53}
static HBRUSH hbrush
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
#define PATINVERT
Definition: wingdi.h:328

Referenced by UserDrawMovingFrame().