ReactOS 0.4.15-dev-7788-g1ad9096
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 (msg.message == WM_MOUSEMOVE && (msg.wParam & MK_LBUTTON) == 0)))
399 { // If no WindowSnapEnabled: Exit on button-up immediately
400 break;
401 }
402 else if (g_bWindowSnapEnabled && (msg.message == WM_LBUTTONUP ||
403 (msg.message == WM_MOUSEMOVE && (msg.wParam & MK_LBUTTON) == 0)))
404 { // If WindowSnapEnabled: Decide whether to snap before exiting
405 DWORD ExStyleTB, StyleTB;
406 BOOL IsTaskBar;
407
408 // We want to forbid snapping operations on the TaskBar
409 // We use a heuristic for detecting the TaskBar Wnd by its typical Style & ExStyle Values
410 ExStyleTB = (ExStyle & WS_EX_TOOLWINDOW);
412 IsTaskBar = (StyleTB == (WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN))
413 && (ExStyleTB == WS_EX_TOOLWINDOW);
414 TRACE("ExStyle=%x Style=%x IsTaskBar=%d\n", ExStyleTB, StyleTB, IsTaskBar);
415
416 // check for snapping if was moved by caption
417 if (!IsTaskBar && hittest == HTCAPTION && thickframe && (ExStyle & WS_EX_MDICHILD) == 0)
418 {
419 RECT snapRect;
420 BOOL doSideSnap = FALSE;
421 UserSystemParametersInfo(SPI_GETWORKAREA, 0, &snapRect, 0);
422
423 // snap to left
424 if (pt.x <= snapRect.left)
425 {
426 snapRect.right = (snapRect.right - snapRect.left) / 2 + snapRect.left;
427 doSideSnap = TRUE;
428 }
429 // snap to right
430 if (pt.x >= snapRect.right-1)
431 {
432 snapRect.left = (snapRect.right - snapRect.left) / 2 + snapRect.left;
433 doSideSnap = TRUE;
434 }
435
436 if (doSideSnap)
437 {
439 NULL,
440 snapRect.left,
441 snapRect.top,
442 snapRect.right - snapRect.left,
443 snapRect.bottom - snapRect.top,
445 pwnd->InternalPos.NormalRect = origRect;
446 }
447 else
448 {
449 // maximize if on dragged to top
450 if (pt.y <= snapRect.top)
451 {
453 pwnd->InternalPos.NormalRect = origRect;
454 }
455 }
456 }
457 break;
458 }
459
460 if ((msg.message != WM_KEYDOWN) && (msg.message != WM_MOUSEMOVE))
461 {
464 continue; /* We are not interested in other messages */
465 }
466
467 pt = msg.pt;
468
469 if (msg.message == WM_KEYDOWN) switch(msg.wParam)
470 {
471 case VK_UP: pt.y -= 8; break;
472 case VK_DOWN: pt.y += 8; break;
473 case VK_LEFT: pt.x -= 8; break;
474 case VK_RIGHT: pt.x += 8; break;
475 }
476
477 pt.x = max( pt.x, mouseRect.left );
478 pt.x = min( pt.x, mouseRect.right - 1 );
479 pt.y = max( pt.y, mouseRect.top );
480 pt.y = min( pt.y, mouseRect.bottom - 1 );
481
482 dx = pt.x - capturePoint.x;
483 dy = pt.y - capturePoint.y;
484
485 if (dx || dy)
486 {
487 if ( !moved )
488 {
489 moved = TRUE;
490 if ( iconic ) /* ok, no system popup tracking */
491 {
492 OldCursor = UserSetCursor(DragCursor, FALSE);
494 }
495 else if(!DragFullWindows)
496 UserDrawMovingFrame( hdc, &sizingRect, thickframe );
497 }
498
499 if (msg.message == WM_KEYDOWN) UserSetCursorPos(pt.x, pt.y, 0, 0, FALSE);
500 else
501 {
502 RECT newRect = unmodRect;
503
504 if (!iconic && !DragFullWindows) UserDrawMovingFrame( hdc, &sizingRect, thickframe );
505 if (hittest == HTCAPTION)
506 {
507 /* Restore window size if it is snapped */
508 if (!RECTL_bIsEmptyRect(&pwnd->InternalPos.NormalRect) &&
509 !IntEqualRect(&pwnd->InternalPos.NormalRect, &pwnd->rcWindow))
510 {
511 UserSetCursorPos(max(0, pwnd->InternalPos.NormalRect.left) + pt.x, pwnd->InternalPos.NormalRect.top + pt.y, 0, 0, FALSE);
512
513 /* Save normal size - it required when window unsnapped from one side and snapped to another holding mouse down */
514 origRect = pwnd->InternalPos.NormalRect;
515
516 /* Restore from maximized state */
517 if (Style & WS_MAXIMIZE)
518 {
520 }
521 /* Restore snapped to left/right place */
522 else
523 {
525 NULL,
526 pwnd->InternalPos.NormalRect.left,
527 pwnd->InternalPos.NormalRect.top,
528 pwnd->InternalPos.NormalRect.right - pwnd->InternalPos.NormalRect.left,
529 pwnd->InternalPos.NormalRect.bottom - pwnd->InternalPos.NormalRect.top,
530 0);
531 }
532 RECTL_vSetEmptyRect(&pwnd->InternalPos.NormalRect);
533 continue;
534 }
535
536 /* regular window moving */
537 RECTL_vOffsetRect(&newRect, dx, dy);
538 }
539 if (ON_LEFT_BORDER(hittest)) newRect.left += dx;
540 else if (ON_RIGHT_BORDER(hittest)) newRect.right += dx;
541 if (ON_TOP_BORDER(hittest)) newRect.top += dy;
542 else if (ON_BOTTOM_BORDER(hittest)) newRect.bottom += dy;
543 capturePoint = pt;
544
545 //
546 // Save the new position to the unmodified rectangle. This allows explorer task bar
547 // sizing. Explorer will forces back the position unless a certain amount of sizing
548 // has occurred.
549 //
550 unmodRect = newRect;
551
552 /* determine the hit location */
553 if (syscommand == SC_SIZE)
554 {
555 WPARAM wpSizingHit = 0;
556
557 if (hittest >= HTLEFT && hittest <= HTBOTTOMRIGHT)
558 wpSizingHit = WMSZ_LEFT + (hittest - HTLEFT);
559 co_IntSendMessage( UserHMGetHandle(pwnd), WM_SIZING, wpSizingHit, (LPARAM)&newRect );
560 }
561 else
562 co_IntSendMessage( UserHMGetHandle(pwnd), WM_MOVING, 0, (LPARAM)&newRect );
563
564 if (!iconic)
565 {
566 if (!DragFullWindows)
567 UserDrawMovingFrame( hdc, &newRect, thickframe );
568 else
569 { // Moving the whole window now!
570 HRGN hrgnNew;
571 HRGN hrgnOrig = GreCreateRectRgnIndirect(&pwnd->rcWindow);
572
573 if (pwnd->hrgnClip != NULL)
574 NtGdiCombineRgn(hrgnOrig, hrgnOrig, pwnd->hrgnClip, RGN_AND);
575
577 //IntMapWindowPoints( 0, pWndParent, (POINT *)&rect, 2 );
579 NULL,
580 newRect.left,
581 newRect.top,
582 newRect.right - newRect.left,
583 newRect.bottom - newRect.top,
584 SWP_NOACTIVATE | ((hittest == HTCAPTION) ? SWP_NOSIZE : 0));
585
586 hrgnNew = GreCreateRectRgnIndirect(&pwnd->rcWindow);
587 if (pwnd->hrgnClip != NULL)
588 NtGdiCombineRgn(hrgnNew, hrgnNew, pwnd->hrgnClip, RGN_AND);
589
590 if (hrgnNew)
591 {
592 if (hrgnOrig)
593 NtGdiCombineRgn(hrgnOrig, hrgnOrig, hrgnNew, RGN_DIFF);
594 }
595 else
596 {
597 if (hrgnOrig)
598 {
599 GreDeleteObject(hrgnOrig);
600 hrgnOrig = 0;
601 }
602 }
603
604 // Update all the windows after the move or size, including this window.
605 UpdateThreadWindows(UserGetDesktopWindow()->spwndChild, pti, hrgnOrig);
606
607 if (hrgnOrig) GreDeleteObject(hrgnOrig);
608 if (hrgnNew) GreDeleteObject(hrgnNew);
609 }
610 }
611 sizingRect = newRect;
612 }
613 }
614 }
615
616 pwnd->head.pti->TIF_flags &= ~TIF_MOVESIZETRACKING;
617
619
620 if ( iconic )
621 {
622 if ( moved ) /* restore cursors, show icon title later on */
623 {
625 OldCursor = UserSetCursor(OldCursor, FALSE);
626 }
627
628 /* It could be that the cursor was already changed while we were proceeding,
629 * so we must unreference whatever cursor was current at the time we restored the old one.
630 * Maybe it is DragCursor, but maybe it is another one and DragCursor got already freed.
631 */
632 if (OldCursor) UserDereferenceObject(OldCursor);
633 }
634 else if ( moved && !DragFullWindows )
635 UserDrawMovingFrame( hdc, &sizingRect, thickframe );
636
638
640 //if (pWndParent) IntMapWindowPoints( 0, pWndParent, (POINT *)&sizingRect, 2 );
641
643 {
644 ERR("DoSizeMove : WH_CBT Call Hook return!\n");
645 moved = FALSE;
646 }
647
648 IntNotifyWinEvent( EVENT_SYSTEM_MOVESIZEEND, pwnd, OBJID_WINDOW, CHILDID_SELF, 0);
649
651
656 /* window moved or resized */
657 if (moved)
658 {
659 /* if the moving/resizing isn't canceled call SetWindowPos
660 * with the new position or the new size of the window
661 */
662 if (!((msg.message == WM_KEYDOWN) && (msg.wParam == VK_ESCAPE)) )
663 {
664 /* NOTE: SWP_NOACTIVATE prevents document window activation in Word 6 */
665 if (!DragFullWindows || iconic )
666 {
668 0,
669 sizingRect.left,
670 sizingRect.top,
671 sizingRect.right - sizingRect.left,
672 sizingRect.bottom - sizingRect.top,
673 ( hittest == HTCAPTION ) ? SWP_NOSIZE : 0 );
674 }
675 }
676 else
677 { /* restore previous size/position */
678 if ( DragFullWindows )
679 {
681 0,
682 origRect.left,
683 origRect.top,
684 origRect.right - origRect.left,
685 origRect.bottom - origRect.top,
686 ( hittest == HTCAPTION ) ? SWP_NOSIZE : 0 );
687 }
688 }
689 }
690
691 if ( IntIsWindow(UserHMGetHandle(pwnd)) )
692 {
693 if ( iconic )
694 {
695 /* Single click brings up the system menu when iconized */
696 if ( !moved )
697 {
698 if( Style & WS_SYSMENU )
700 }
701 }
702 }
703}
#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:1457
HWND APIENTRY IntGetCapture(VOID)
Definition: focus.c:1440
BOOL FASTCALL IntReleaseCapture(VOID)
Definition: focus.c:1529
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
#define MSQ_STATE_MOVESIZE
Definition: ntuser.h:3585
#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:92
#define min(a, b)
Definition: monoChain.cc:55
HWND FASTCALL MsqSetStateWindow(PTHREADINFO pti, ULONG Type, HWND hWnd)
Definition: msgqueue.c:2495
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: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::@5110 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: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:696
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:1276
BOOL FASTCALL IntCallMsgFilter(LPMSG lpmsg, INT code)
Definition: message.c:2140
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:213
#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:2105
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:2595
#define SWP_NOACTIVATE
Definition: winuser.h:1242
#define WM_SYSCOMMAND
Definition: winuser.h:1741
#define DCX_CACHE
Definition: winuser.h:2114
#define SM_CYSCREEN
Definition: winuser.h:960
#define HTCAPTION
Definition: winuser.h:2476
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define VK_UP
Definition: winuser.h:2225
#define SWP_NOSIZE
Definition: winuser.h:1245
#define WM_MOUSEMOVE
Definition: winuser.h:1775
#define RDW_UPDATENOW
Definition: winuser.h:1220
#define WH_CBT
Definition: winuser.h:35
#define WM_QUERYDRAGICON
Definition: winuser.h:1654
#define WMSZ_LEFT
Definition: winuser.h:2464
#define SC_SIZE
Definition: winuser.h:2584
#define VK_RETURN
Definition: winuser.h:2201
#define WS_EX_MDICHILD
Definition: winuser.h:394
#define WM_EXITSIZEMOVE
Definition: winuser.h:1824
#define RDW_ALLCHILDREN
Definition: winuser.h:1221
#define PM_REMOVE
Definition: winuser.h:1196
#define HCBT_MOVESIZE
Definition: winuser.h:55
#define HTBOTTOMRIGHT
Definition: winuser.h:2495
#define SC_MOVE
Definition: winuser.h:2585
#define WM_LBUTTONUP
Definition: winuser.h:1777
#define MSGF_SIZE
Definition: winuser.h:1177
#define VK_LEFT
Definition: winuser.h:2224
#define WM_SIZING
Definition: winuser.h:1807
#define VK_RIGHT
Definition: winuser.h:2226
#define VK_DOWN
Definition: winuser.h:2227
#define MK_LBUTTON
Definition: winuser.h:2367
#define SM_CXSCREEN
Definition: winuser.h:959
#define WM_KEYDOWN
Definition: winuser.h:1715
#define WM_MOVING
Definition: winuser.h:1809
#define HTSYSMENU
Definition: winuser.h:2477
#define HTLEFT
Definition: winuser.h:2487
#define VK_ESCAPE
Definition: winuser.h:2214
#define SC_RESTORE
Definition: winuser.h:2598
#define SC_MAXIMIZE
Definition: winuser.h:2588
#define WM_ENTERSIZEMOVE
Definition: winuser.h:1823

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:1954
#define SM_CYSIZE
Definition: winuser.h:992
#define HTBOTTOM
Definition: winuser.h:2493
#define SM_CXFRAME
Definition: winuser.h:994
#define SM_CXSIZE
Definition: winuser.h:991
#define SM_CYFRAME
Definition: winuser.h:996
#define HTRIGHT
Definition: winuser.h:2489
#define HTTOP
Definition: winuser.h:2490
#define WM_SETCURSOR
Definition: winuser.h:1636

Referenced by DefWndDoSizeMove().

◆ GetNCHitEx()

DWORD FASTCALL GetNCHitEx ( PWND  pWnd,
POINT  pt 
)

Definition at line 1954 of file nonclient.c.

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

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

◆ IntIsScrollBarVisible()

BOOL IntIsScrollBarVisible ( PWND  pWnd,
INT  hBar 
)

Definition at line 759 of file nonclient.c.

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

Referenced by NC_DoNCPaint().

◆ NC_DoButton()

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

Definition at line 1464 of file nonclient.c.

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

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

Referenced by NC_HandleNCActivate().

◆ NC_DoNCPaint()

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

Definition at line 1066 of file nonclient.c.

1067{
1069 PWND Parent;
1070 RECT WindowRect, CurrentRect, TempRect;
1071 BOOL Active = FALSE;
1072
1073 if (!IntIsWindowVisible(pWnd) ||
1074 (pWnd->state & WNDS_NONCPAINT && !(pWnd->state & WNDS_FORCEMENUDRAW)) ||
1075 IntEqualRect(&pWnd->rcWindow, &pWnd->rcClient) )
1076 return 0;
1077
1078 Style = pWnd->style;
1079
1080 TRACE("DefWndNCPaint: pWnd %p, hDc %p, Active %s.\n", pWnd, hDC, Flags & DC_ACTIVE ? "TRUE" : "FALSE");
1081
1082 Parent = IntGetParent(pWnd);
1083 ExStyle = pWnd->ExStyle;
1084
1085 if (Flags == -1) // NC paint mode.
1086 {
1087 if (ExStyle & WS_EX_MDICHILD)
1088 {
1090
1091 if (Active)
1093 }
1094 else
1095 {
1096 Active = (gpqForeground == pWnd->head.pti->MessageQueue);
1097 }
1098 Flags = DC_NC; // Redraw everything!
1099 }
1100 else
1101 Flags |= DC_NC;
1102
1103
1104 IntGetWindowRect(pWnd, &WindowRect);
1105
1106 CurrentRect.top = CurrentRect.left = 0;
1107 CurrentRect.right = WindowRect.right - WindowRect.left;
1108 CurrentRect.bottom = WindowRect.bottom - WindowRect.top;
1109
1110 /* Draw outer edge */
1111 if (UserHasWindowEdge(pWnd->style, pWnd->ExStyle))
1112 {
1113 DrawEdge(hDC, &CurrentRect, EDGE_RAISED, BF_RECT | BF_ADJUST);
1114 }
1115 else if (pWnd->ExStyle & WS_EX_STATICEDGE)
1116 {
1117#if 0
1118 DrawEdge(hDC, &CurrentRect, BDR_SUNKENINNER, BF_RECT | BF_ADJUST | BF_FLAT);
1119#else
1121 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.top, CurrentRect.right - CurrentRect.left, 1, PATCOPY);
1122 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY);
1123
1125 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.bottom - 1, CurrentRect.right - CurrentRect.left, 1, PATCOPY);
1126 NtGdiPatBlt(hDC, CurrentRect.right - 1, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY);
1127
1128 RECTL_vInflateRect(&CurrentRect, -1, -1);
1129#endif
1130 }
1131
1132 if (Flags & DC_FRAME) NC_DrawFrame(hDC, &CurrentRect, Active ? Active : (Flags & DC_ACTIVE), Style, ExStyle);
1133
1134 /* Draw caption */
1135 if ((Style & WS_CAPTION) == WS_CAPTION)
1136 {
1137 HPEN PreviousPen;
1138 BOOL Gradient = FALSE;
1139
1140 if (Flags & DC_REDRAWHUNGWND)
1141 {
1142 Flags &= ~DC_REDRAWHUNGWND;
1144 }
1145
1146 if (UserSystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &Gradient, 0) && Gradient)
1147 {
1148 Flags |= DC_GRADIENT;
1149 }
1150
1151 if (Active)
1152 {
1153 if (pWnd->state & WNDS_ACTIVEFRAME)
1154 Flags |= DC_ACTIVE;
1155 else
1156 {
1157 ERR("Wnd is active and not set active!\n");
1158 }
1159 }
1160
1161 TempRect = CurrentRect;
1162
1164 {
1165 Flags |= DC_SMALLCAP;
1166 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSMCAPTION) - 1;
1167 CurrentRect.top += UserGetSystemMetrics(SM_CYSMCAPTION);
1168 }
1169 else
1170 {
1171 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYCAPTION) - 1;
1172 CurrentRect.top += UserGetSystemMetrics(SM_CYCAPTION);
1173 }
1174
1175 UserDrawCaption(pWnd, hDC, &TempRect, NULL, NULL, NULL, Flags);
1176
1177 /* Draw buttons */
1178 if (Style & WS_SYSMENU)
1179 {
1182 {
1185 }
1186 }
1187 if (!(Style & WS_MINIMIZE))
1188 {
1189 /* Line under caption */
1190 PreviousPen = NtGdiSelectPen(hDC, NtGdiGetStockObject(DC_PEN));
1191
1195
1196 GreMoveTo(hDC, TempRect.left, TempRect.bottom, NULL);
1197
1198 NtGdiLineTo(hDC, TempRect.right, TempRect.bottom);
1199
1200 NtGdiSelectPen(hDC, PreviousPen);
1201 }
1202 }
1203
1204 if (!(Style & WS_MINIMIZE))
1205 {
1206 /* Draw menu bar */
1207 if (pWnd->state & WNDS_HASMENU && pWnd->IDMenu) // Should be pWnd->spmenu
1208 {
1209 if (!(Flags & DC_NOSENDMSG))
1210 {
1211 PMENU menu;
1212 // Fix crash in test_menu_locked_by_window, should use pWnd->spmenu....
1213 if ((menu = UserGetMenuObject(UlongToHandle(pWnd->IDMenu)))) // FIXME! Use pWnd->spmenu,
1214 {
1215 TempRect = CurrentRect;
1216 TempRect.bottom = TempRect.top + menu->cyMenu; // Should be pWnd->spmenu->cyMenu;
1217 CurrentRect.top += MENU_DrawMenuBar(hDC, &TempRect, pWnd, FALSE);
1218 }
1219 }
1220 }
1221
1223 {
1224 DrawEdge(hDC, &CurrentRect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
1225 }
1226
1227 /* Draw the scrollbars */
1228 if ((Style & WS_VSCROLL) && (Style & WS_HSCROLL) &&
1230 {
1231 RECT ParentClientRect;
1232
1233 TempRect = CurrentRect;
1234
1236 TempRect.right = TempRect.left + UserGetSystemMetrics(SM_CXVSCROLL);
1237 else
1238 TempRect.left = TempRect.right - UserGetSystemMetrics(SM_CXVSCROLL);
1239
1240 TempRect.top = TempRect.bottom - UserGetSystemMetrics(SM_CYHSCROLL);
1241
1243
1244 if (Parent)
1245 {
1246 IntGetClientRect(Parent, &ParentClientRect);
1247
1248 if (HASSIZEGRIP(Style, ExStyle, Parent->style, WindowRect, ParentClientRect))
1249 {
1251 }
1252 }
1253
1256 }
1257 else
1258 {
1260 {
1262 }
1264 {
1266 }
1267 }
1268 }
1269 return 0; // For WM_NCPAINT message, return 0.
1270}
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: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: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:2185
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:759
VOID UserDrawCaptionButton(PWND pWnd, LPRECT Rect, DWORD Style, DWORD ExStyle, HDC hDC, BOOL bDown, ULONG Type)
Definition: nonclient.c:777
VOID NC_DrawFrame(HDC hDC, RECT *CurrentRect, BOOL Active, DWORD Style, DWORD ExStyle)
Definition: nonclient.c:878
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:919
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:930
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define WM_MDIGETACTIVE
Definition: winuser.h:1821
#define DC_SMALLCAP
Definition: winuser.h:428
#define COLOR_BTNHIGHLIGHT
Definition: winuser.h:935
#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:928
#define COLOR_3DFACE
Definition: winuser.h:929
_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 878 of file nonclient.c.

879{
880 /* Firstly the "thick" frame */
881 if ((Style & WS_THICKFRAME) && !(Style & WS_MINIMIZE))
882 {
883 LONG Width =
886
887 LONG Height =
890
892
893 /* Draw frame */
894 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, CurrentRect->right - CurrentRect->left, Height, PATCOPY);
895 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
896 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->bottom, CurrentRect->right - CurrentRect->left, -Height, PATCOPY);
897 NtGdiPatBlt(hDC, CurrentRect->right, CurrentRect->top, -Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
898
899 RECTL_vInflateRect(CurrentRect, -Width, -Height);
900 }
901
902 /* Now the other bit of the frame */
904 {
907
913
914 /* Draw frame */
915 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, CurrentRect->right - CurrentRect->left, Height, PATCOPY);
916 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
917 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->bottom, CurrentRect->right - CurrentRect->left, -Height, PATCOPY);
918 NtGdiPatBlt(hDC, CurrentRect->right, CurrentRect->top, -Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
919
920 RECTL_vInflateRect(CurrentRect, -Width, -Height);
921 }
922}
_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:923
#define COLOR_INACTIVEBORDER
Definition: winuser.h:924

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

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

Referenced by IntDefWindowProc().

◆ NC_HandleNCCalcSize()

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

Definition at line 1273 of file nonclient.c.

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

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

Referenced by IntDefWindowProc().

◆ NC_HandleNCLButtonDown()

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

Definition at line 1544 of file nonclient.c.

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

Referenced by IntDefWindowProc(), and NC_HandleNCLButtonDblClk().

◆ NC_HandleNCRButtonDown()

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

Definition at line 1694 of file nonclient.c.

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

Referenced by IntDefWindowProc().

◆ NC_IconForWindow()

PCURICON_OBJECT FASTCALL NC_IconForWindow ( PWND  pWnd)

Definition at line 705 of file nonclient.c.

706{
707 PCURICON_OBJECT pIcon = NULL;
708 HICON hIcon;
709
711 if (!hIcon) hIcon = UserGetProp(pWnd, gpsi->atomIconProp, TRUE);
712
713 if (!hIcon && pWnd->pcls->spicnSm)
714 return pWnd->pcls->spicnSm;
715 if (!hIcon && pWnd->pcls->spicn)
716 return pWnd->pcls->spicn;
717
718 // WARNING: Wine code has this test completely wrong. The following is how
719 // Windows behaves for windows having the WS_EX_DLGMODALFRAME style set:
720 // it does not use the default icon! And it does not check for DS_MODALFRAME.
721 if (!hIcon && !(pWnd->ExStyle & WS_EX_DLGMODALFRAME))
722 {
723 hIcon = gpsi->hIconSmWindows; // Both are IDI_WINLOGO Small
724 if (!hIcon) hIcon = gpsi->hIconWindows; // Reg size.
725 }
726 if (hIcon)
727 {
729 hIcon,
731 }
732 return pIcon;
733}
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: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 924 of file nonclient.c.

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

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

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

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

737{
738 PCURICON_OBJECT WindowIcon;
739 BOOL Ret = FALSE;
740
741 if ((WindowIcon = NC_IconForWindow(pWnd)))
742 {
743 UserReferenceObject(WindowIcon);
744
745 Ret = UserDrawIconEx(hDC,
746 Rect->left + 2,
747 Rect->top + 2,
748 WindowIcon,
751 0, NULL, DI_NORMAL);
752
753 UserDereferenceObject(WindowIcon);
754 }
755 return Ret;
756}
BOOL UserDrawIconEx(HDC hDc, INT xLeft, INT yTop, PCURICON_OBJECT pIcon, INT cxWidth, INT cyHeight, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags)
Definition: cursoricon.c:1685
#define DI_NORMAL
Definition: wingdi.h:72
#define SM_CYSMICON
Definition: winuser.h:1013
#define SM_CXSMICON
Definition: winuser.h:1012

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