ReactOS  0.4.15-dev-5446-g3f3714b
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)))
#define WS_THICKFRAME
Definition: pedump.c:630
#define WS_CHILD
Definition: pedump.c:617
const DWORD Style
Definition: appswitch.c:71
#define WS_MAXIMIZE
Definition: pedump.c:623

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))))
#define WS_THICKFRAME
Definition: pedump.c:630
#define WS_DLGFRAME
Definition: pedump.c:626
#define WS_EX_DLGMODALFRAME
Definition: pedump.c:645
const DWORD Style
Definition: appswitch.c:71
const DWORD ExStyle
Definition: appswitch.c:72

Definition at line 14 of file nonclient.c.

◆ UserHasThickFrameStyle

#define UserHasThickFrameStyle (   Style,
  ExStyle 
)
Value:
(((Style) & WS_THICKFRAME) && \
#define WS_THICKFRAME
Definition: pedump.c:630
#define WS_DLGFRAME
Definition: pedump.c:626
const DWORD Style
Definition: appswitch.c:71
#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  DWORD ExStyleTB, StyleTB;
260  BOOL IsTaskBar;
261 
262  Style = pwnd->style;
263  ExStyle = pwnd->ExStyle;
264  iconic = (Style & WS_MINIMIZE) != 0;
265 
266  if ((Style & WS_MAXIMIZE) || !IntIsWindowVisible(pwnd)) return;
267 
268  thickframe = UserHasThickFrameStyle(Style, ExStyle) && !iconic;
269 
270  //
271  // Show window contents while dragging the window, get flag from registry data.
272  //
273  UserSystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, &DragFullWindows, 0);
274 
275  pt.x = pti->ptLast.x;
276  pt.y = pti->ptLast.y;
277  capturePoint = pt;
278  UserClipCursor( NULL );
279 
280  TRACE("pwnd %p command %04lx, hittest %d, pos %d,%d\n",
281  pwnd, syscommand, hittest, pt.x, pt.y);
282 
283  if (syscommand == SC_MOVE)
284  {
285  if (!hittest) hittest = DefWndStartSizeMove(pwnd, wParam, &capturePoint);
286  if (!hittest) return;
287  }
288  else /* SC_SIZE */
289  {
290  if (!thickframe) return;
291  if (hittest && (syscommand != SC_MOUSEMENU))
292  {
293  hittest += (HTLEFT - WMSZ_LEFT);
294  }
295  else
296  {
298  hittest = DefWndStartSizeMove(pwnd, wParam, &capturePoint);
299  if (!hittest)
300  {
302  return;
303  }
304  }
305  }
306 
307  /* Get min/max info */
308 
309  co_WinPosGetMinMaxInfo(pwnd, NULL, NULL, &minTrack, &maxTrack);
310  sizingRect = pwnd->rcWindow;
311  origRect = sizingRect;
312  if (Style & WS_CHILD)
313  {
314  pWndParent = IntGetParent(pwnd);
315  IntGetClientRect( pWndParent, &mouseRect );
316  IntMapWindowPoints( pWndParent, 0, (LPPOINT)&mouseRect, 2 );
317  IntMapWindowPoints( 0, pWndParent, (LPPOINT)&sizingRect, 2 );
318  unmodRect = sizingRect;
319  }
320  else
321  {
322  if (!(ExStyle & WS_EX_TOPMOST))
323  {
324  UserSystemParametersInfo(SPI_GETWORKAREA, 0, &mouseRect, 0);
325  }
326  else
327  {
329  }
330  unmodRect = sizingRect;
331  }
332 
333  if (ON_LEFT_BORDER(hittest))
334  {
335  mouseRect.left = max( mouseRect.left, sizingRect.right-maxTrack.x+capturePoint.x-sizingRect.left );
336  mouseRect.right = min( mouseRect.right, sizingRect.right-minTrack.x+capturePoint.x-sizingRect.left );
337  }
338  else if (ON_RIGHT_BORDER(hittest))
339  {
340  mouseRect.left = max( mouseRect.left, sizingRect.left+minTrack.x+capturePoint.x-sizingRect.right );
341  mouseRect.right = min( mouseRect.right, sizingRect.left+maxTrack.x+capturePoint.x-sizingRect.right );
342  }
343  if (ON_TOP_BORDER(hittest))
344  {
345  mouseRect.top = max( mouseRect.top, sizingRect.bottom-maxTrack.y+capturePoint.y-sizingRect.top );
346  mouseRect.bottom = min( mouseRect.bottom,sizingRect.bottom-minTrack.y+capturePoint.y-sizingRect.top);
347  }
348  else if (ON_BOTTOM_BORDER(hittest))
349  {
350  mouseRect.top = max( mouseRect.top, sizingRect.top+minTrack.y+capturePoint.y-sizingRect.bottom );
351  mouseRect.bottom = min( mouseRect.bottom, sizingRect.top+maxTrack.y+capturePoint.y-sizingRect.bottom );
352  }
353 
354  hdc = UserGetDCEx( pWndParent, 0, DCX_CACHE );
355  if (iconic)
356  {
357  DragCursor = pwnd->pcls->spicn;
358  if (DragCursor)
359  {
360  UserReferenceObject(DragCursor);
361  }
362  else
363  {
364  HCURSOR CursorHandle = (HCURSOR)co_IntSendMessage( UserHMGetHandle(pwnd), WM_QUERYDRAGICON, 0, 0 );
365  if (CursorHandle)
366  {
367  DragCursor = UserGetCurIconObject(CursorHandle);
368  }
369  else
370  {
371  iconic = FALSE;
372  }
373  }
374  }
375 
376  /* repaint the window before moving it around */
378 
379  IntNotifyWinEvent( EVENT_SYSTEM_MOVESIZESTART, pwnd, OBJID_WINDOW, CHILDID_SELF, 0);
380 
382 
384 
386 
387  pwnd->head.pti->TIF_flags |= TIF_MOVESIZETRACKING;
388 
389  for(;;)
390  {
391  int dx = 0, dy = 0;
392 
393  if (!co_IntGetPeekMessage(&msg, 0, 0, 0, PM_REMOVE, TRUE)) break;
394  if (IntCallMsgFilter( &msg, MSGF_SIZE )) continue;
395 
396  /* Exit on button-up */
397  if (msg.message == WM_LBUTTONUP)
398  {
399  /* Test for typical TaskBar ExStyle Values */
400  ExStyleTB = (ExStyle & WS_EX_TOOLWINDOW);
401  TRACE("ExStyle is '%x'.\n", ExStyleTB);
402 
403  /* Test for typical TaskBar Style Values */
404  StyleTB = (Style & (WS_POPUP | WS_VISIBLE |
406  TRACE("Style is '%x'.\n", StyleTB);
407 
408  /* Test for masked typical TaskBar Style and ExStyles to detect TaskBar */
409  IsTaskBar = (StyleTB == (WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN))
410  && (ExStyleTB == WS_EX_TOOLWINDOW);
411  TRACE("This %s the TaskBar.\n", IsTaskBar ? "is" : "is not");
412 
413  // check for snapping if was moved by caption
414  if (hittest == HTCAPTION && thickframe && (ExStyle & WS_EX_MDICHILD) == 0)
415  {
416  RECT snapRect;
417  BOOL doSideSnap = FALSE;
418  UserSystemParametersInfo(SPI_GETWORKAREA, 0, &snapRect, 0);
419 
420  /* if this is the taskbar, then we want to just exit */
421  if (IsTaskBar)
422  {
423  break;
424  }
425  // snap to left
426  if (pt.x <= snapRect.left)
427  {
428  snapRect.right = (snapRect.right - snapRect.left) / 2 + snapRect.left;
429  doSideSnap = TRUE;
430  }
431  // snap to right
432  if (pt.x >= snapRect.right-1)
433  {
434  snapRect.left = (snapRect.right - snapRect.left) / 2 + snapRect.left;
435  doSideSnap = TRUE;
436  }
437 
438  if (doSideSnap)
439  {
441  NULL,
442  snapRect.left,
443  snapRect.top,
444  snapRect.right - snapRect.left,
445  snapRect.bottom - snapRect.top,
447  pwnd->InternalPos.NormalRect = origRect;
448  }
449  else
450  {
451  // maximize if on dragged to top
452  if (pt.y <= snapRect.top)
453  {
455  pwnd->InternalPos.NormalRect = origRect;
456  }
457  }
458  }
459  break;
460  }
461 
462  /* Exit on Return or Esc */
463  if (msg.message == WM_KEYDOWN &&
464  (msg.wParam == VK_RETURN || msg.wParam == VK_ESCAPE))
465  {
466  break;
467  }
468 
469  if ((msg.message != WM_KEYDOWN) && (msg.message != WM_MOUSEMOVE))
470  {
471  IntTranslateKbdMessage( &msg , 0 );
473  continue; /* We are not interested in other messages */
474  }
475 
476  pt = msg.pt;
477 
478  if (msg.message == WM_KEYDOWN) switch(msg.wParam)
479  {
480  case VK_UP: pt.y -= 8; break;
481  case VK_DOWN: pt.y += 8; break;
482  case VK_LEFT: pt.x -= 8; break;
483  case VK_RIGHT: pt.x += 8; break;
484  }
485 
486  pt.x = max( pt.x, mouseRect.left );
487  pt.x = min( pt.x, mouseRect.right - 1 );
488  pt.y = max( pt.y, mouseRect.top );
489  pt.y = min( pt.y, mouseRect.bottom - 1 );
490 
491  dx = pt.x - capturePoint.x;
492  dy = pt.y - capturePoint.y;
493 
494  if (dx || dy)
495  {
496  if ( !moved )
497  {
498  moved = TRUE;
499  if ( iconic ) /* ok, no system popup tracking */
500  {
501  OldCursor = UserSetCursor(DragCursor, FALSE);
502  UserShowCursor( TRUE );
503  }
504  else if(!DragFullWindows)
505  UserDrawMovingFrame( hdc, &sizingRect, thickframe );
506  }
507 
508  if (msg.message == WM_KEYDOWN) UserSetCursorPos(pt.x, pt.y, 0, 0, FALSE);
509  else
510  {
511  RECT newRect = unmodRect;
512 
513  if (!iconic && !DragFullWindows) UserDrawMovingFrame( hdc, &sizingRect, thickframe );
514  if (hittest == HTCAPTION) RECTL_vOffsetRect( &newRect, dx, dy );
515  if (ON_LEFT_BORDER(hittest)) newRect.left += dx;
516  else if (ON_RIGHT_BORDER(hittest)) newRect.right += dx;
517  if (ON_TOP_BORDER(hittest)) newRect.top += dy;
518  else if (ON_BOTTOM_BORDER(hittest)) newRect.bottom += dy;
519  capturePoint = pt;
520 
521  //
522  // Save the new position to the unmodified rectangle. This allows explorer task bar
523  // sizing. Explorer will forces back the position unless a certain amount of sizing
524  // has occurred.
525  //
526  unmodRect = newRect;
527 
528  /* determine the hit location */
529  if (syscommand == SC_SIZE)
530  {
531  WPARAM wpSizingHit = 0;
532 
533  if (hittest >= HTLEFT && hittest <= HTBOTTOMRIGHT)
534  wpSizingHit = WMSZ_LEFT + (hittest - HTLEFT);
535  co_IntSendMessage( UserHMGetHandle(pwnd), WM_SIZING, wpSizingHit, (LPARAM)&newRect );
536  }
537  else
538  co_IntSendMessage( UserHMGetHandle(pwnd), WM_MOVING, 0, (LPARAM)&newRect );
539 
540  if (!iconic)
541  {
542  if (!DragFullWindows)
543  UserDrawMovingFrame( hdc, &newRect, thickframe );
544  else
545  { // Moving the whole window now!
546  HRGN hrgnNew;
547  HRGN hrgnOrig = GreCreateRectRgnIndirect(&pwnd->rcWindow);
548 
549  if (pwnd->hrgnClip != NULL)
550  NtGdiCombineRgn(hrgnOrig, hrgnOrig, pwnd->hrgnClip, RGN_AND);
551 
553  //IntMapWindowPoints( 0, pWndParent, (POINT *)&rect, 2 );
555  NULL,
556  newRect.left,
557  newRect.top,
558  newRect.right - newRect.left,
559  newRect.bottom - newRect.top,
560  SWP_NOACTIVATE | ((hittest == HTCAPTION) ? SWP_NOSIZE : 0));
561 
562  hrgnNew = GreCreateRectRgnIndirect(&pwnd->rcWindow);
563  if (pwnd->hrgnClip != NULL)
564  NtGdiCombineRgn(hrgnNew, hrgnNew, pwnd->hrgnClip, RGN_AND);
565 
566  if (hrgnNew)
567  {
568  if (hrgnOrig)
569  NtGdiCombineRgn(hrgnOrig, hrgnOrig, hrgnNew, RGN_DIFF);
570  }
571  else
572  {
573  if (hrgnOrig)
574  {
575  GreDeleteObject(hrgnOrig);
576  hrgnOrig = 0;
577  }
578  }
579 
580  // Update all the windows after the move or size, including this window.
581  UpdateThreadWindows(UserGetDesktopWindow()->spwndChild, pti, hrgnOrig);
582 
583  if (hrgnOrig) GreDeleteObject(hrgnOrig);
584  if (hrgnNew) GreDeleteObject(hrgnNew);
585  }
586  }
587  sizingRect = newRect;
588  }
589  }
590  }
591 
592  pwnd->head.pti->TIF_flags &= ~TIF_MOVESIZETRACKING;
593 
595 
596  if ( iconic )
597  {
598  if ( moved ) /* restore cursors, show icon title later on */
599  {
601  OldCursor = UserSetCursor(OldCursor, FALSE);
602  }
603 
604  /* It could be that the cursor was already changed while we were proceeding,
605  * so we must unreference whatever cursor was current at the time we restored the old one.
606  * Maybe it is DragCursor, but maybe it is another one and DragCursor got already freed.
607  */
608  if (OldCursor) UserDereferenceObject(OldCursor);
609  }
610  else if ( moved && !DragFullWindows )
611  UserDrawMovingFrame( hdc, &sizingRect, thickframe );
612 
614 
616  //if (pWndParent) IntMapWindowPoints( 0, pWndParent, (POINT *)&sizingRect, 2 );
617 
619  {
620  ERR("DoSizeMove : WH_CBT Call Hook return!\n");
621  moved = FALSE;
622  }
623 
624  IntNotifyWinEvent( EVENT_SYSTEM_MOVESIZEEND, pwnd, OBJID_WINDOW, CHILDID_SELF, 0);
625 
627 
632  /* window moved or resized */
633  if (moved)
634  {
635  /* if the moving/resizing isn't canceled call SetWindowPos
636  * with the new position or the new size of the window
637  */
638  if (!((msg.message == WM_KEYDOWN) && (msg.wParam == VK_ESCAPE)) )
639  {
640  /* NOTE: SWP_NOACTIVATE prevents document window activation in Word 6 */
641  if (!DragFullWindows || iconic )
642  {
643  co_WinPosSetWindowPos( pwnd,
644  0,
645  sizingRect.left,
646  sizingRect.top,
647  sizingRect.right - sizingRect.left,
648  sizingRect.bottom - sizingRect.top,
649  ( hittest == HTCAPTION ) ? SWP_NOSIZE : 0 );
650  }
651  }
652  else
653  { /* restore previous size/position */
654  if ( DragFullWindows )
655  {
656  co_WinPosSetWindowPos( pwnd,
657  0,
658  origRect.left,
659  origRect.top,
660  origRect.right - origRect.left,
661  origRect.bottom - origRect.top,
662  ( hittest == HTCAPTION ) ? SWP_NOSIZE : 0 );
663  }
664  }
665  }
666 
667  if ( IntIsWindow(UserHMGetHandle(pwnd)) )
668  {
669  if ( iconic )
670  {
671  /* Single click brings up the system menu when iconized */
672  if ( !moved )
673  {
674  if( Style & WS_SYSMENU )
676  }
677  }
678  }
679 }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define HTLEFT
Definition: winuser.h:2477
#define MSQ_STATE_MOVESIZE
Definition: ntuser.h:3703
#define max(a, b)
Definition: svc.c:63
DWORD ExStyle
Definition: ntuser.h:699
BOOL NTAPI GreDeleteObject(HGDIOBJ hobj)
Definition: gdiobj.c:1158
#define TIF_MOVESIZETRACKING
Definition: ntuser.h:277
long y
Definition: polytest.cpp:48
PCURICON_OBJECT FASTCALL UserGetCurIconObject(HCURSOR hCurIcon)
Definition: cursoricon.c:200
LRESULT FASTCALL IntDispatchMessage(PMSG pMsg)
Definition: message.c:841
long x
Definition: polytest.cpp:48
BOOL FASTCALL IntReleaseCapture(VOID)
Definition: focus.c:1530
#define TRUE
Definition: types.h:120
#define pt(x, y)
Definition: drawing.c:79
BOOL FASTCALL IntTranslateKbdMessage(LPMSG lpMsg, UINT flags)
Definition: keyboard.c:1152
GLint dy
Definition: linetemp.h:97
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
VOID FASTCALL IntNotifyWinEvent(DWORD Event, PWND pWnd, LONG idObject, LONG idChild, DWORD flags)
Definition: event.c:179
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
BOOLEAN FASTCALL co_WinPosSetWindowPos(PWND Window, HWND WndInsertAfter, INT x, INT y, INT cx, INT cy, UINT flags)
Definition: winpos.c:1748
static HDC
Definition: imagelist.c:92
#define OBJID_WINDOW
Definition: winable.h:15
LONG top
Definition: windef.h:307
#define VK_LEFT
Definition: winuser.h:2214
#define WM_EXITSIZEMOVE
Definition: winuser.h:1814
int UserShowCursor(BOOL bShow)
Definition: msgqueue.c:168
HDC FASTCALL UserGetDCEx(PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
#define SC_MOUSEMENU
Definition: winuser.h:2585
BOOL FASTCALL UserDereferenceObject(PVOID Object)
Definition: object.c:644
BOOL FASTCALL IntCallMsgFilter(LPMSG lpmsg, INT code)
Definition: message.c:2137
UINT_PTR WPARAM
Definition: windef.h:207
#define VK_DOWN
Definition: winuser.h:2217
#define WS_CHILD
Definition: pedump.c:617
LONG left
Definition: windef.h:306
VOID FASTCALL IntGetClientRect(PWND WindowObject, RECTL *Rect)
Definition: winpos.c:91
HICON HCURSOR
Definition: windef.h:299
#define VK_ESCAPE
Definition: winuser.h:2204
#define WS_CLIPCHILDREN
Definition: pedump.c:619
LONG right
Definition: windef.h:308
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
BOOL UserSetCursorPos(INT x, INT y, DWORD flags, ULONG_PTR dwExtraInfo, BOOL Hook)
Definition: cursoricon.c:238
#define VK_RETURN
Definition: winuser.h:2191
struct _CURICON_OBJECT * spicn
Definition: ntuser.h:580
WPARAM wParam
Definition: combotst.c:138
#define RGN_AND
Definition: wingdi.h:356
#define WM_QUERYDRAGICON
Definition: winuser.h:1644
#define SM_CXSCREEN
Definition: winuser.h:953
#define ON_RIGHT_BORDER(hit)
Definition: nonclient.c:27
#define WS_EX_MDICHILD
Definition: winuser.h:394
#define L(x)
Definition: ntvdm.h:50
#define HTSYSMENU
Definition: winuser.h:2467
#define VK_UP
Definition: winuser.h:2215
#define FALSE
Definition: types.h:117
#define WS_MINIMIZE
Definition: pedump.c:622
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define MSGF_SIZE
Definition: winuser.h:1167
#define CHILDID_SELF
Definition: winable.h:14
#define SC_MAXIMIZE
Definition: winuser.h:2578
#define GreCreateRectRgnIndirect(prc)
Definition: region.h:96
#define WM_SIZING
Definition: winuser.h:1797
THRDESKHEAD head
Definition: ntuser.h:690
#define MAKELONG(a, b)
Definition: typedefs.h:249
VOID FASTCALL UserDrawMovingFrame(HDC hdc, RECTL *rect, BOOL thickframe)
Definition: nonclient.c:56
HRGN hrgnClip
Definition: ntuser.h:728
#define WM_KEYDOWN
Definition: winuser.h:1705
LONG_PTR LPARAM
Definition: windef.h:208
#define WH_CBT
Definition: winuser.h:35
BOOL APIENTRY UserClipCursor(RECTL *prcl)
Definition: cursoricon.c:700
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:208
UINT FASTCALL co_WinPosGetMinMaxInfo(PWND Window, POINT *MaxSize, POINT *MaxPos, POINT *MinTrack, POINT *MaxTrack)
Definition: winpos.c:933
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
#define SM_CYSCREEN
Definition: winuser.h:954
HWND FASTCALL MsqSetStateWindow(PTHREADINFO pti, ULONG Type, HWND hWnd)
Definition: msgqueue.c:2551
#define TRACE(s)
Definition: solgame.cpp:4
HWND FASTCALL co_UserSetCapture(HWND hWnd)
Definition: focus.c:1458
#define ON_BOTTOM_BORDER(hit)
Definition: nonclient.c:31
LONG FASTCALL DefWndStartSizeMove(PWND Wnd, WPARAM wParam, POINT *capturePoint)
Definition: nonclient.c:140
const DWORD Style
Definition: appswitch.c:71
#define SWP_NOACTIVATE
Definition: winuser.h:1232
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL FASTCALL IntIsWindow(HWND hWnd)
Definition: window.c:180
LRESULT APIENTRY co_HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam, LPARAM lParam)
Definition: hook.c:1103
PWND FASTCALL UserGetDesktopWindow(VOID)
Definition: desktop.c:1386
BOOL FASTCALL IntIsWindowVisible(PWND Wnd)
Definition: window.c:193
#define WM_MOVING
Definition: winuser.h:1799
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1446
HDC hdc
Definition: main.c:9
#define WS_EX_TOPMOST
Definition: pedump.c:647
#define WM_SETVISIBLE
Definition: undocuser.h:31
RECT rcWindow
Definition: ntuser.h:711
#define HTBOTTOMRIGHT
Definition: winuser.h:2485
HWND APIENTRY IntGetCapture(VOID)
Definition: focus.c:1440
__kernel_entry W32KAPI INT APIENTRY NtGdiCombineRgn(_In_ HRGN hrgnDst, _In_ HRGN hrgnSrc1, _In_opt_ HRGN hrgnSrc2, _In_ INT iMode)
POINT ptLast
Definition: win32.h:129
#define VK_RIGHT
Definition: winuser.h:2216
#define SWP_NOSIZE
Definition: winuser.h:1235
#define ERR(fmt,...)
Definition: debug.h:110
#define HTCAPTION
Definition: winuser.h:2466
Definition: ntuser.h:688
VOID FASTCALL UpdateThreadWindows(PWND pWnd, PTHREADINFO pti, HRGN hRgn)
Definition: painting.c:1093
FORCEINLINE VOID RECTL_vOffsetRect(_Inout_ RECTL *prcl, _In_ INT cx, _In_ INT cy)
Definition: rect.h:31
FORCEINLINE VOID RECTL_vSetRect(_Out_ RECTL *prcl, _In_ LONG left, _In_ LONG top, _In_ LONG right, _In_ LONG bottom)
Definition: rect.h:5
#define DCX_CACHE
Definition: winuser.h:2104
BOOL APIENTRY co_IntGetPeekMessage(PMSG pMsg, HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax, UINT RemoveMsg, BOOL bGMSG)
Definition: message.c:1177
#define RGN_DIFF
Definition: wingdi.h:358
BOOL FASTCALL co_UserRedrawWindow(PWND Window, const RECTL *UpdateRect, PREGION UpdateRgn, ULONG Flags)
Definition: painting.c:888
#define RDW_ALLCHILDREN
Definition: winuser.h:1211
#define SC_SIZE
Definition: winuser.h:2574
#define WM_LBUTTONUP
Definition: winuser.h:1767
PWND FASTCALL IntGetParent(PWND Wnd)
Definition: window.c:208
INT FASTCALL IntMapWindowPoints(PWND FromWnd, PWND ToWnd, LPPOINT lpPoints, UINT cPoints)
Definition: winpos.c:143
#define ON_TOP_BORDER(hit)
Definition: nonclient.c:29
#define min(a, b)
Definition: monoChain.cc:55
#define WS_POPUP
Definition: pedump.c:616
#define WM_MOUSEMOVE
Definition: winuser.h:1765
#define NULL
Definition: types.h:112
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:918
GLint dx
Definition: linetemp.h:97
#define msg(x)
Definition: auth_time.c:54
#define RDW_UPDATENOW
Definition: winuser.h:1210
#define SC_MOVE
Definition: winuser.h:2575
#define HCBT_MOVESIZE
Definition: winuser.h:55
struct _WND::@4894 InternalPos
unsigned int ULONG
Definition: retypes.h:1
#define UserHasThickFrameStyle(Style, ExStyle)
Definition: nonclient.c:18
LONG bottom
Definition: windef.h:309
BOOL FASTCALL UserSystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
Definition: sysparams.c:2090
#define PM_REMOVE
Definition: winuser.h:1186
PCURICON_OBJECT FASTCALL UserSetCursor(PCURICON_OBJECT NewCursor, BOOL ForceChange)
Definition: msgqueue.c:93
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_SYSMENU
Definition: pedump.c:629
#define WM_SYSCOMMAND
Definition: winuser.h:1731
#define WM_ENTERSIZEMOVE
Definition: winuser.h:1813
#define WMSZ_LEFT
Definition: winuser.h:2454
#define ON_LEFT_BORDER(hit)
Definition: nonclient.c:25
const DWORD ExStyle
Definition: appswitch.c:72
VOID FASTCALL UserReferenceObject(PVOID obj)
Definition: object.c:731
PCLS pcls
Definition: ntuser.h:715
#define WS_MAXIMIZE
Definition: pedump.c:623
DWORD style
Definition: ntuser.h:701

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)
159  rect.left += UserGetSystemMetrics(SM_CXSIZE) + 1;
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;
165  pt.y = rect.top + UserGetSystemMetrics(SM_CYSIZE)/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 HTTOP
Definition: winuser.h:2480
#define HTLEFT
Definition: winuser.h:2477
#define max(a, b)
Definition: svc.c:63
#define TIF_MOVESIZETRACKING
Definition: ntuser.h:277
#define SM_CYSIZE
Definition: winuser.h:986
LRESULT FASTCALL IntDispatchMessage(PMSG pMsg)
Definition: message.c:841
#define TRUE
Definition: types.h:120
#define pt(x, y)
Definition: drawing.c:79
BOOL FASTCALL IntTranslateKbdMessage(LPMSG lpMsg, UINT flags)
Definition: keyboard.c:1152
FLONG TIF_flags
Definition: win32.h:95
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
LONG top
Definition: windef.h:307
#define VK_LEFT
Definition: winuser.h:2214
BOOL FASTCALL IntCallMsgFilter(LPMSG lpmsg, INT code)
Definition: message.c:2137
UINT_PTR WPARAM
Definition: windef.h:207
#define VK_DOWN
Definition: winuser.h:2217
#define HTRIGHT
Definition: winuser.h:2479
LONG left
Definition: windef.h:306
#define SM_CYFRAME
Definition: winuser.h:990
#define SM_CXFRAME
Definition: winuser.h:988
#define VK_ESCAPE
Definition: winuser.h:2204
LONG right
Definition: windef.h:308
BOOL UserSetCursorPos(INT x, INT y, DWORD flags, ULONG_PTR dwExtraInfo, BOOL Hook)
Definition: cursoricon.c:238
#define VK_RETURN
Definition: winuser.h:2191
& rect
Definition: startmenu.cpp:1413
WPARAM wParam
Definition: combotst.c:138
#define VK_UP
Definition: winuser.h:2215
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
#define WM_SETCURSOR
Definition: winuser.h:1626
#define MSGF_SIZE
Definition: winuser.h:1167
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define WM_KEYDOWN
Definition: winuser.h:1705
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:208
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
const DWORD Style
Definition: appswitch.c:71
#define HTBOTTOM
Definition: winuser.h:2483
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1446
RECT rcWindow
Definition: ntuser.h:711
#define HTBOTTOMRIGHT
Definition: winuser.h:2485
#define VK_RIGHT
Definition: winuser.h:2216
#define HTCAPTION
Definition: winuser.h:2466
BOOL APIENTRY co_IntGetPeekMessage(PMSG pMsg, HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax, UINT RemoveMsg, BOOL bGMSG)
Definition: message.c:1177
#define WS_MINIMIZEBOX
Definition: pedump.c:631
#define WM_LBUTTONUP
Definition: winuser.h:1767
#define min(a, b)
Definition: monoChain.cc:55
#define WM_MOUSEMOVE
Definition: winuser.h:1765
#define msg(x)
Definition: auth_time.c:54
#define SC_MOVE
Definition: winuser.h:2575
#define SM_CXSIZE
Definition: winuser.h:985
unsigned int ULONG
Definition: retypes.h:1
LONG bottom
Definition: windef.h:309
#define PM_REMOVE
Definition: winuser.h:1186
DWORD FASTCALL GetNCHitEx(PWND pWnd, POINT pt)
Definition: nonclient.c:1930
#define WS_SYSMENU
Definition: pedump.c:629
DWORD style
Definition: ntuser.h:701

Referenced by DefWndDoSizeMove().

◆ GetNCHitEx()

DWORD FASTCALL GetNCHitEx ( PWND  pWnd,
POINT  pt 
)

Definition at line 1930 of file nonclient.c.

1931 {
1932  RECT rcWindow, rcClient;
1933  DWORD Style, ExStyle;
1934 
1935  if (!pWnd) return HTNOWHERE;
1936 
1937  if (UserIsDesktopWindow(pWnd))
1938  {
1939  rcClient.left = rcClient.top = rcWindow.left = rcWindow.top = 0;
1944  }
1945  else
1946  {
1947  rcClient = pWnd->rcClient;
1948  rcWindow = pWnd->rcWindow;
1949  }
1950 
1951  if (!RECTL_bPointInRect(&rcWindow, pt.x, pt.y)) return HTNOWHERE;
1952 
1953  Style = pWnd->style;
1954  ExStyle = pWnd->ExStyle;
1955 
1956  if (Style & WS_MINIMIZE) return HTCAPTION;
1957 
1958  if (RECTL_bPointInRect( &rcClient, pt.x, pt.y )) return HTCLIENT;
1959 
1960  /* Check borders */
1961  if (HAS_THICKFRAME( Style, ExStyle ))
1962  {
1964  if (!RECTL_bPointInRect(&rcWindow, pt.x, pt.y ))
1965  {
1966  /* Check top sizing border */
1967  if (pt.y < rcWindow.top)
1968  {
1969  if (pt.x < rcWindow.left+UserGetSystemMetrics(SM_CXSIZE)) return HTTOPLEFT;
1970  if (pt.x >= rcWindow.right-UserGetSystemMetrics(SM_CXSIZE)) return HTTOPRIGHT;
1971  return HTTOP;
1972  }
1973  /* Check bottom sizing border */
1974  if (pt.y >= rcWindow.bottom)
1975  {
1976  if (pt.x < rcWindow.left+UserGetSystemMetrics(SM_CXSIZE)) return HTBOTTOMLEFT;
1977  if (pt.x >= rcWindow.right-UserGetSystemMetrics(SM_CXSIZE)) return HTBOTTOMRIGHT;
1978  return HTBOTTOM;
1979  }
1980  /* Check left sizing border */
1981  if (pt.x < rcWindow.left)
1982  {
1983  if (pt.y < rcWindow.top+UserGetSystemMetrics(SM_CYSIZE)) return HTTOPLEFT;
1984  if (pt.y >= rcWindow.bottom-UserGetSystemMetrics(SM_CYSIZE)) return HTBOTTOMLEFT;
1985  return HTLEFT;
1986  }
1987  /* Check right sizing border */
1988  if (pt.x >= rcWindow.right)
1989  {
1990  if (pt.y < rcWindow.top+UserGetSystemMetrics(SM_CYSIZE)) return HTTOPRIGHT;
1991  if (pt.y >= rcWindow.bottom-UserGetSystemMetrics(SM_CYSIZE)) return HTBOTTOMRIGHT;
1992  return HTRIGHT;
1993  }
1994  }
1995  }
1996  else /* No thick frame */
1997  {
1998  if (HAS_DLGFRAME( Style, ExStyle ))
2000  else if (HAS_THINFRAME( Style, ExStyle ))
2002  else if (HAS_CLIENTFRAME( Style, ExStyle ))
2004  if (!RECTL_bPointInRect( &rcWindow, pt.x, pt.y )) return HTBORDER;
2005  }
2006 
2007  /* Check caption */
2008 
2009  if ((Style & WS_CAPTION) == WS_CAPTION)
2010  {
2011  if (ExStyle & WS_EX_TOOLWINDOW)
2012  rcWindow.top += UserGetSystemMetrics(SM_CYSMCAPTION) - 1;
2013  else
2014  rcWindow.top += UserGetSystemMetrics(SM_CYCAPTION) - 1;
2015  if (!RECTL_bPointInRect( &rcWindow, pt.x, pt.y ))
2016  {
2017  BOOL min_or_max_box = (Style & WS_SYSMENU) && (Style & (WS_MINIMIZEBOX|WS_MAXIMIZEBOX));
2018  if (ExStyle & WS_EX_LAYOUTRTL)
2019  {
2020  /* Check system menu */
2021  if ((Style & WS_SYSMENU) && !(ExStyle & WS_EX_TOOLWINDOW) && NC_IconForWindow(pWnd))
2022  {
2023  rcWindow.right -= UserGetSystemMetrics(SM_CYCAPTION) - 1;
2024  if (pt.x > rcWindow.right) return HTSYSMENU;
2025  }
2026 
2027  /* Check close button */
2028  if (Style & WS_SYSMENU)
2029  {
2030  rcWindow.left += UserGetSystemMetrics(SM_CYCAPTION);
2031  if (pt.x < rcWindow.left) return HTCLOSE;
2032  }
2033 
2034  /* Check maximize box */
2035  /* In Win95 there is automatically a Maximize button when there is a minimize one */
2036  if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2037  {
2038  rcWindow.left += UserGetSystemMetrics(SM_CXSIZE);
2039  if (pt.x < rcWindow.left) return HTMAXBUTTON;
2040  }
2041 
2042  /* Check minimize box */
2043  if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2044  {
2045  rcWindow.left += UserGetSystemMetrics(SM_CXSIZE);
2046  if (pt.x < rcWindow.left) return HTMINBUTTON;
2047  }
2048  }
2049  else
2050  {
2051  /* Check system menu */
2052  if ((Style & WS_SYSMENU) && !(ExStyle & WS_EX_TOOLWINDOW) && NC_IconForWindow(pWnd))
2053  {
2054  rcWindow.left += UserGetSystemMetrics(SM_CYCAPTION) - 1;
2055  if (pt.x < rcWindow.left) return HTSYSMENU;
2056  }
2057 
2058  /* Check close button */
2059  if (Style & WS_SYSMENU)
2060  {
2062  if (pt.x > rcWindow.right) return HTCLOSE;
2063  }
2064 
2065  /* Check maximize box */
2066  /* In Win95 there is automatically a Maximize button when there is a minimize one */
2067  if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2068  {
2069  rcWindow.right -= UserGetSystemMetrics(SM_CXSIZE);
2070  if (pt.x > rcWindow.right) return HTMAXBUTTON;
2071  }
2072 
2073  /* Check minimize box */
2074  if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2075  {
2076  rcWindow.right -= UserGetSystemMetrics(SM_CXSIZE);
2077  if (pt.x > rcWindow.right) return HTMINBUTTON;
2078  }
2079  }
2080  return HTCAPTION;
2081  }
2082  }
2083 
2084  /* Check menu bar */
2085 
2086  if (HAS_MENU( pWnd, Style ) && (pt.y < rcClient.top) &&
2087  (pt.x >= rcClient.left) && (pt.x < rcClient.right))
2088  return HTMENU;
2089 
2090  /* Check vertical scroll bar */
2091 
2093  if (Style & WS_VSCROLL)
2094  {
2095  if((ExStyle & WS_EX_LEFTSCROLLBAR) != 0)
2096  rcClient.left -= UserGetSystemMetrics(SM_CXVSCROLL);
2097  else
2099  if (RECTL_bPointInRect( &rcClient, pt.x, pt.y )) return HTVSCROLL;
2100  }
2101 
2102  /* Check horizontal scroll bar */
2103 
2104  if (Style & WS_HSCROLL)
2105  {
2107  if (RECTL_bPointInRect( &rcClient, pt.x, pt.y ))
2108  {
2109  /* Check size box */
2110  if ((Style & WS_VSCROLL) &&
2111  ((((ExStyle & WS_EX_LEFTSCROLLBAR) != 0) && (pt.x <= rcClient.left + UserGetSystemMetrics(SM_CXVSCROLL))) ||
2112  (((ExStyle & WS_EX_LEFTSCROLLBAR) == 0) && (pt.x >= rcClient.right - UserGetSystemMetrics(SM_CXVSCROLL)))))
2113  return HTSIZE;
2114  return HTHSCROLL;
2115  }
2116  }
2117 
2118  /* Has to return HTNOWHERE if nothing was found
2119  Could happen when a window has a customized non client area */
2120  return HTNOWHERE;
2121 }
#define HTMAXBUTTON
Definition: winuser.h:2474
#define HTTOP
Definition: winuser.h:2480
#define HTLEFT
Definition: winuser.h:2477
DWORD ExStyle
Definition: ntuser.h:699
#define HTHSCROLL
Definition: winuser.h:2471
#define SM_CYHSCROLL
Definition: winuser.h:956
#define SM_CYSIZE
Definition: winuser.h:986
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:194
VOID FASTCALL RECTL_vInflateRect(_Inout_ RECTL *rect, _In_ INT dx, _In_ INT dy)
Definition: rect.c:101
#define pt(x, y)
Definition: drawing.c:79
LONG top
Definition: windef.h:307
#define WS_EX_LAYOUTRTL
Definition: winuser.h:390
#define SM_CXEDGE
Definition: winuser.h:1002
#define HTBOTTOMLEFT
Definition: winuser.h:2484
#define HTRIGHT
Definition: winuser.h:2479
RECT rcClient
Definition: ntuser.h:712
LONG left
Definition: windef.h:306
#define SM_CYFRAME
Definition: winuser.h:990
#define SM_CXFRAME
Definition: winuser.h:988
LONG right
Definition: windef.h:308
#define WS_EX_LEFTSCROLLBAR
Definition: winuser.h:392
#define HTNOWHERE
Definition: winuser.h:2464
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define HTMINBUTTON
Definition: winuser.h:2473
#define HTTOPLEFT
Definition: winuser.h:2481
#define HAS_CLIENTFRAME(Style, ExStyle)
Definition: window.h:19
#define SM_CXSCREEN
Definition: winuser.h:953
#define HTSYSMENU
Definition: winuser.h:2467
#define WS_MINIMIZE
Definition: pedump.c:622
unsigned int BOOL
Definition: ntddk_ex.h:94
#define SM_CYDLGFRAME
Definition: winuser.h:962
#define HAS_THINFRAME(Style, ExStyle)
Definition: window.h:16
#define HAS_THICKFRAME(Style, ExStyle)
Definition: window.h:12
#define SM_CYEDGE
Definition: winuser.h:1003
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
PCURICON_OBJECT FASTCALL NC_IconForWindow(PWND pWnd)
Definition: nonclient.c:681
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:208
#define WS_CAPTION
Definition: pedump.c:624
#define HTSIZE
Definition: winuser.h:2469
#define SM_CYSCREEN
Definition: winuser.h:954
#define HTTOPRIGHT
Definition: winuser.h:2482
#define SM_CYCAPTION
Definition: winuser.h:957
const DWORD Style
Definition: appswitch.c:71
#define SM_CXDLGFRAME
Definition: winuser.h:960
#define HTBOTTOM
Definition: winuser.h:2483
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WS_HSCROLL
Definition: pedump.c:628
#define HTCLOSE
Definition: winuser.h:2489
FORCEINLINE BOOL RECTL_bPointInRect(_In_ const RECTL *prcl, _In_ INT x, _In_ INT y)
Definition: rect.h:52
#define SM_CYBORDER
Definition: winuser.h:959
#define SM_CXBORDER
Definition: winuser.h:958
RECT rcWindow
Definition: ntuser.h:711
#define HTBOTTOMRIGHT
Definition: winuser.h:2485
#define HTCAPTION
Definition: winuser.h:2466
#define HAS_MENU(hwnd, style)
Definition: uxthemep.h:222
#define WS_MINIMIZEBOX
Definition: pedump.c:631
#define HTMENU
Definition: winuser.h:2470
#define HTBORDER
Definition: winuser.h:2487
#define WS_VSCROLL
Definition: pedump.c:627
#define SM_CXVSCROLL
Definition: winuser.h:955
#define HTVSCROLL
Definition: winuser.h:2472
#define SM_CXSIZE
Definition: winuser.h:985
#define HAS_DLGFRAME(Style, ExStyle)
Definition: window.h:8
LONG bottom
Definition: windef.h:309
#define HTCLIENT
Definition: winuser.h:2465
#define WS_SYSMENU
Definition: pedump.c:629
#define SM_CYSMCAPTION
Definition: winuser.h:1008
const DWORD ExStyle
Definition: appswitch.c:72
DWORD style
Definition: ntuser.h:701

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

◆ IntIsScrollBarVisible()

BOOL IntIsScrollBarVisible ( PWND  pWnd,
INT  hBar 
)

Definition at line 735 of file nonclient.c.

736 {
737  SCROLLBARINFO sbi;
738  sbi.cbSize = sizeof(SCROLLBARINFO);
739 
740  if(!co_IntGetScrollBarInfo(pWnd, hBar, &sbi))
741  return FALSE;
742 
743  return !(sbi.rgstate[0] & STATE_SYSTEM_OFFSCREEN);
744 }
#define STATE_SYSTEM_OFFSCREEN
Definition: winuser.h:2868
#define FALSE
Definition: types.h:117
DWORD rgstate[CCHILDREN_SCROLLBAR+1]
Definition: winuser.h:3744
BOOL FASTCALL co_IntGetScrollBarInfo(PWND, LONG, PSCROLLBARINFO)
Definition: scrollbar.c:760
struct tagSCROLLBARINFO SCROLLBARINFO

Referenced by NC_DoNCPaint().

◆ NC_DoButton()

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

Definition at line 1440 of file nonclient.c.

1441 {
1442  MSG Msg;
1443  HDC WindowDC;
1444  BOOL Pressed = TRUE, OldState;
1445  WPARAM SCMsg;
1446  PMENU SysMenu;
1447  ULONG ButtonType;
1448  DWORD Style;
1449  UINT MenuState;
1450 
1451  Style = pWnd->style;
1452  switch (wParam)
1453  {
1454  case HTCLOSE:
1455  SysMenu = IntGetSystemMenu(pWnd, FALSE);
1456  MenuState = IntGetMenuState(SysMenu ? UserHMGetHandle(SysMenu) : NULL, SC_CLOSE, MF_BYCOMMAND); /* in case of error MenuState==0xFFFFFFFF */
1457  if (!(Style & WS_SYSMENU) || (MenuState & (MF_GRAYED|MF_DISABLED)) || (pWnd->style & CS_NOCLOSE))
1458  return;
1459  ButtonType = DFCS_CAPTIONCLOSE;
1460  SCMsg = SC_CLOSE;
1461  break;
1462  case HTMINBUTTON:
1463  if (!(Style & WS_MINIMIZEBOX))
1464  return;
1465  ButtonType = DFCS_CAPTIONMIN;
1466  SCMsg = ((Style & WS_MINIMIZE) ? SC_RESTORE : SC_MINIMIZE);
1467  break;
1468  case HTMAXBUTTON:
1469  if (!(Style & WS_MAXIMIZEBOX))
1470  return;
1471  ButtonType = DFCS_CAPTIONMAX;
1472  SCMsg = ((Style & WS_MAXIMIZE) ? SC_RESTORE : SC_MAXIMIZE);
1473  break;
1474 
1475  default:
1476  ASSERT(FALSE);
1477  return;
1478  }
1479 
1480  /*
1481  * FIXME: Not sure where to do this, but we must flush the pending
1482  * window updates when someone clicks on the close button and at
1483  * the same time the window is overlapped with another one. This
1484  * looks like a good place for now...
1485  */
1487 
1488  WindowDC = UserGetWindowDC(pWnd);
1489  UserDrawCaptionButtonWnd(pWnd, WindowDC, TRUE, ButtonType);
1490 
1492 
1493  for (;;)
1494  {
1496  if (IntCallMsgFilter( &Msg, MSGF_MAX )) continue;
1497 
1498  if (Msg.message == WM_LBUTTONUP)
1499  break;
1500 
1501  if (Msg.message != WM_MOUSEMOVE)
1502  continue;
1503 
1504  OldState = Pressed;
1505  Pressed = (GetNCHitEx(pWnd, Msg.pt) == wParam);
1506  if (Pressed != OldState)
1507  UserDrawCaptionButtonWnd(pWnd, WindowDC, Pressed, ButtonType);
1508  }
1509 
1510  if (Pressed)
1511  UserDrawCaptionButtonWnd(pWnd, WindowDC, FALSE, ButtonType);
1513  UserReleaseDC(pWnd, WindowDC, FALSE);
1514  if (Pressed)
1515  co_IntSendMessage(UserHMGetHandle(pWnd), WM_SYSCOMMAND, SCMsg, SCMsg == SC_CLOSE ? lParam : MAKELONG(Msg.pt.x,Msg.pt.y));
1516 }
#define HTMAXBUTTON
Definition: winuser.h:2474
#define MSGF_MAX
Definition: winuser.h:1172
#define MF_DISABLED
Definition: winuser.h:130
#define WM_MOUSEFIRST
Definition: winuser.h:1764
#define MF_BYCOMMAND
Definition: winuser.h:202
#define SC_RESTORE
Definition: winuser.h:2588
BOOL FASTCALL IntReleaseCapture(VOID)
Definition: focus.c:1530
#define TRUE
Definition: types.h:120
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
static HDC
Definition: imagelist.c:92
#define CS_NOCLOSE
Definition: winuser.h:649
HDC FASTCALL UserGetWindowDC(PWND Wnd)
Definition: windc.c:947
BOOL FASTCALL IntCallMsgFilter(LPMSG lpmsg, INT code)
Definition: message.c:2137
UINT_PTR WPARAM
Definition: windef.h:207
VOID UserDrawCaptionButtonWnd(PWND pWnd, HDC hDC, BOOL bDown, ULONG Type)
Definition: nonclient.c:835
#define HTMINBUTTON
Definition: winuser.h:2473
WPARAM wParam
Definition: combotst.c:138
#define FALSE
Definition: types.h:117
#define WS_MINIMIZE
Definition: pedump.c:622
unsigned int BOOL
Definition: ntddk_ex.h:94
#define SC_MAXIMIZE
Definition: winuser.h:2578
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
HWND FASTCALL co_UserSetCapture(HWND hWnd)
Definition: focus.c:1458
const DWORD Style
Definition: appswitch.c:71
#define ASSERT(a)
Definition: mode.c:44
PMENU FASTCALL IntGetSystemMenu(PWND Window, BOOL bRevert)
Definition: menu.c:5383
#define WM_MOUSELAST
Definition: winuser.h:1791
#define DFCS_CAPTIONCLOSE
Definition: winuser.h:480
unsigned long DWORD
Definition: ntddk_ex.h:95
VOID FASTCALL co_IntUpdateWindows(PWND Wnd, ULONG Flags, BOOL Recurse)
Definition: painting.c:519
#define HTCLOSE
Definition: winuser.h:2489
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1446
#define SC_MINIMIZE
Definition: winuser.h:2576
BOOL APIENTRY co_IntGetPeekMessage(PMSG pMsg, HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax, UINT RemoveMsg, BOOL bGMSG)
Definition: message.c:1177
#define WS_MINIMIZEBOX
Definition: pedump.c:631
#define RDW_ALLCHILDREN
Definition: winuser.h:1211
#define WM_LBUTTONUP
Definition: winuser.h:1767
unsigned int UINT
Definition: ndis.h:50
#define WM_MOUSEMOVE
Definition: winuser.h:1765
#define NULL
Definition: types.h:112
#define DFCS_CAPTIONMAX
Definition: winuser.h:482
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:918
#define SC_CLOSE
Definition: winuser.h:2582
unsigned int ULONG
Definition: retypes.h:1
#define PM_REMOVE
Definition: winuser.h:1186
#define MF_GRAYED
Definition: winuser.h:129
DWORD FASTCALL GetNCHitEx(PWND pWnd, POINT pt)
Definition: nonclient.c:1930
#define WS_SYSMENU
Definition: pedump.c:629
#define WM_SYSCOMMAND
Definition: winuser.h:1731
struct @1595 Msg[]
LPARAM lParam
Definition: combotst.c:139
#define DFCS_CAPTIONMIN
Definition: winuser.h:481
UINT FASTCALL IntGetMenuState(HMENU hMenu, UINT uId, UINT uFlags)
Definition: menu.c:4975
#define WS_MAXIMIZE
Definition: pedump.c:623
DWORD style
Definition: ntuser.h:701

Referenced by NC_HandleNCLButtonDown().

◆ NC_DoNCActive()

static INT NC_DoNCActive ( PWND  Wnd)
static

Definition at line 1365 of file nonclient.c.

1366 {
1367  INT Ret = 0;
1368 
1371  Ret = DC_CAPTION;
1372 
1373  if (!(Wnd->style & WS_MINIMIZED) && UserHasThickFrameStyle(Wnd->style, Wnd->ExStyle))
1374  {
1375  //if (IntGetSysColor(COLOR_ACTIVEBORDER) != IntGetSysColor(COLOR_INACTIVEBORDER)) // Why are these the same?
1376  {
1377  Ret = DC_FRAME;
1378  }
1379  }
1380  return Ret;
1381 }
DWORD ExStyle
Definition: ntuser.h:699
#define COLOR_INACTIVECAPTION
Definition: winuser.h:910
#define COLOR_CAPTIONTEXT
Definition: winuser.h:916
int32_t INT
Definition: typedefs.h:58
#define COLOR_ACTIVECAPTION
Definition: winuser.h:909
#define WS_MINIMIZED
Definition: undocuser.h:18
#define DC_FRAME
Definition: undocuser.h:149
DWORD FASTCALL IntGetSysColor(INT nIndex)
Definition: stockobj.c:323
#define COLOR_INACTIVECAPTIONTEXT
Definition: winuser.h:928
#define UserHasThickFrameStyle(Style, ExStyle)
Definition: nonclient.c:18
#define DC_CAPTION
Definition: winuser.h:439
DWORD style
Definition: ntuser.h:701

Referenced by NC_HandleNCActivate().

◆ NC_DoNCPaint()

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

Definition at line 1042 of file nonclient.c.

1043 {
1044  DWORD Style, ExStyle;
1045  PWND Parent;
1046  RECT WindowRect, CurrentRect, TempRect;
1047  BOOL Active = FALSE;
1048 
1049  if (!IntIsWindowVisible(pWnd) ||
1050  (pWnd->state & WNDS_NONCPAINT && !(pWnd->state & WNDS_FORCEMENUDRAW)) ||
1051  IntEqualRect(&pWnd->rcWindow, &pWnd->rcClient) )
1052  return 0;
1053 
1054  Style = pWnd->style;
1055 
1056  TRACE("DefWndNCPaint: pWnd %p, hDc %p, Active %s.\n", pWnd, hDC, Flags & DC_ACTIVE ? "TRUE" : "FALSE");
1057 
1058  Parent = IntGetParent(pWnd);
1059  ExStyle = pWnd->ExStyle;
1060 
1061  if (Flags == -1) // NC paint mode.
1062  {
1063  if (ExStyle & WS_EX_MDICHILD)
1064  {
1066 
1067  if (Active)
1069  }
1070  else
1071  {
1072  Active = (gpqForeground == pWnd->head.pti->MessageQueue);
1073  }
1074  Flags = DC_NC; // Redraw everything!
1075  }
1076  else
1077  Flags |= DC_NC;
1078 
1079 
1080  IntGetWindowRect(pWnd, &WindowRect);
1081 
1082  CurrentRect.top = CurrentRect.left = 0;
1083  CurrentRect.right = WindowRect.right - WindowRect.left;
1084  CurrentRect.bottom = WindowRect.bottom - WindowRect.top;
1085 
1086  /* Draw outer edge */
1087  if (UserHasWindowEdge(pWnd->style, pWnd->ExStyle))
1088  {
1089  DrawEdge(hDC, &CurrentRect, EDGE_RAISED, BF_RECT | BF_ADJUST);
1090  }
1091  else if (pWnd->ExStyle & WS_EX_STATICEDGE)
1092  {
1093 #if 0
1094  DrawEdge(hDC, &CurrentRect, BDR_SUNKENINNER, BF_RECT | BF_ADJUST | BF_FLAT);
1095 #else
1097  NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.top, CurrentRect.right - CurrentRect.left, 1, PATCOPY);
1098  NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY);
1099 
1101  NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.bottom - 1, CurrentRect.right - CurrentRect.left, 1, PATCOPY);
1102  NtGdiPatBlt(hDC, CurrentRect.right - 1, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY);
1103 
1104  RECTL_vInflateRect(&CurrentRect, -1, -1);
1105 #endif
1106  }
1107 
1108  if (Flags & DC_FRAME) NC_DrawFrame(hDC, &CurrentRect, Active ? Active : (Flags & DC_ACTIVE), Style, ExStyle);
1109 
1110  /* Draw caption */
1111  if ((Style & WS_CAPTION) == WS_CAPTION)
1112  {
1113  HPEN PreviousPen;
1114  BOOL Gradient = FALSE;
1115 
1116  if (Flags & DC_REDRAWHUNGWND)
1117  {
1118  Flags &= ~DC_REDRAWHUNGWND;
1119  Flags |= DC_NOSENDMSG;
1120  }
1121 
1122  if (UserSystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &Gradient, 0) && Gradient)
1123  {
1124  Flags |= DC_GRADIENT;
1125  }
1126 
1127  if (Active)
1128  {
1129  if (pWnd->state & WNDS_ACTIVEFRAME)
1130  Flags |= DC_ACTIVE;
1131  else
1132  {
1133  ERR("Wnd is active and not set active!\n");
1134  }
1135  }
1136 
1137  TempRect = CurrentRect;
1138 
1139  if (ExStyle & WS_EX_TOOLWINDOW)
1140  {
1141  Flags |= DC_SMALLCAP;
1142  TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSMCAPTION) - 1;
1143  CurrentRect.top += UserGetSystemMetrics(SM_CYSMCAPTION);
1144  }
1145  else
1146  {
1147  TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYCAPTION) - 1;
1148  CurrentRect.top += UserGetSystemMetrics(SM_CYCAPTION);
1149  }
1150 
1151  UserDrawCaption(pWnd, hDC, &TempRect, NULL, NULL, NULL, Flags);
1152 
1153  /* Draw buttons */
1154  if (Style & WS_SYSMENU)
1155  {
1158  {
1161  }
1162  }
1163  if (!(Style & WS_MINIMIZE))
1164  {
1165  /* Line under caption */
1166  PreviousPen = NtGdiSelectPen(hDC, NtGdiGetStockObject(DC_PEN));
1167 
1171 
1172  GreMoveTo(hDC, TempRect.left, TempRect.bottom, NULL);
1173 
1174  NtGdiLineTo(hDC, TempRect.right, TempRect.bottom);
1175 
1176  NtGdiSelectPen(hDC, PreviousPen);
1177  }
1178  }
1179 
1180  if (!(Style & WS_MINIMIZE))
1181  {
1182  /* Draw menu bar */
1183  if (pWnd->state & WNDS_HASMENU && pWnd->IDMenu) // Should be pWnd->spmenu
1184  {
1185  if (!(Flags & DC_NOSENDMSG))
1186  {
1187  PMENU menu;
1188  // Fix crash in test_menu_locked_by_window, should use pWnd->spmenu....
1189  if ((menu = UserGetMenuObject(UlongToHandle(pWnd->IDMenu)))) // FIXME! Use pWnd->spmenu,
1190  {
1191  TempRect = CurrentRect;
1192  TempRect.bottom = TempRect.top + menu->cyMenu; // Should be pWnd->spmenu->cyMenu;
1193  CurrentRect.top += MENU_DrawMenuBar(hDC, &TempRect, pWnd, FALSE);
1194  }
1195  }
1196  }
1197 
1198  if (ExStyle & WS_EX_CLIENTEDGE)
1199  {
1200  DrawEdge(hDC, &CurrentRect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
1201  }
1202 
1203  /* Draw the scrollbars */
1204  if ((Style & WS_VSCROLL) && (Style & WS_HSCROLL) &&
1206  {
1207  RECT ParentClientRect;
1208 
1209  TempRect = CurrentRect;
1210 
1212  TempRect.right = TempRect.left + UserGetSystemMetrics(SM_CXVSCROLL);
1213  else
1214  TempRect.left = TempRect.right - UserGetSystemMetrics(SM_CXVSCROLL);
1215 
1216  TempRect.top = TempRect.bottom - UserGetSystemMetrics(SM_CYHSCROLL);
1217 
1219 
1220  if (Parent)
1221  {
1222  IntGetClientRect(Parent, &ParentClientRect);
1223 
1224  if (HASSIZEGRIP(Style, ExStyle, Parent->style, WindowRect, ParentClientRect))
1225  {
1227  }
1228  }
1229 
1230  IntDrawScrollBar(pWnd, hDC, SB_VERT);
1231  IntDrawScrollBar(pWnd, hDC, SB_HORZ);
1232  }
1233  else
1234  {
1236  {
1237  IntDrawScrollBar(pWnd, hDC, SB_VERT);
1238  }
1239  else if (Style & WS_HSCROLL && IntIsScrollBarVisible(pWnd, OBJID_HSCROLL))
1240  {
1241  IntDrawScrollBar(pWnd, hDC, SB_HORZ);
1242  }
1243  }
1244  }
1245  return 0; // For WM_NCPAINT message, return 0.
1246 }
#define BF_FLAT
Definition: winuser.h:471
PUSER_MESSAGE_QUEUE gpqForeground
Definition: focus.c:13
DWORD ExStyle
Definition: ntuser.h:699
#define SM_CYHSCROLL
Definition: winuser.h:956
void IntDrawScrollBar(PWND, HDC, INT)
Definition: scrollbar.c:1180
#define COLOR_WINDOWFRAME
Definition: winuser.h:913
__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
HGDIOBJ FASTCALL IntGetSysColorBrush(INT Object)
Definition: stockobj.c:317
#define SB_VERT
Definition: winuser.h:553
VOID FASTCALL RECTL_vInflateRect(_Inout_ RECTL *rect, _In_ INT dx, _In_ INT dy)
Definition: rect.c:101
BOOL IntIsScrollBarVisible(PWND pWnd, INT hBar)
Definition: nonclient.c:735
#define SB_HORZ
Definition: winuser.h:552
__kernel_entry W32KAPI HANDLE APIENTRY NtGdiGetStockObject(_In_ INT iObject)
LONG top
Definition: windef.h:307
HANDLE HWND
Definition: compat.h:19
#define COLOR_BTNHIGHLIGHT
Definition: winuser.h:929
BOOL UserHasWindowEdge(DWORD Style, DWORD ExStyle)
Definition: nonclient.c:36
BOOL WINAPI DrawFrameControl(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
RECT rcClient
Definition: ntuser.h:712
LONG left
Definition: windef.h:306
VOID FASTCALL IntGetClientRect(PWND WindowObject, RECTL *Rect)
Definition: winpos.c:91
UINT MENU_DrawMenuBar(HDC hDC, LPRECT lprect, PWND pWnd, BOOL suppress_draw)
Definition: menu.c:2744
LONG right
Definition: windef.h:308
VOID UserDrawCaptionButton(PWND pWnd, LPRECT Rect, DWORD Style, DWORD ExStyle, HDC hDC, BOOL bDown, ULONG Type)
Definition: nonclient.c:753
#define WS_EX_LEFTSCROLLBAR
Definition: winuser.h:392
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define BF_ADJUST
Definition: winuser.h:470
__kernel_entry W32KAPI HBRUSH APIENTRY NtGdiSelectBrush(_In_ HDC hdc, _In_ HBRUSH hbrush)
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:4
#define BF_RECT
Definition: winuser.h:462
__kernel_entry W32KAPI BOOL APIENTRY NtGdiLineTo(_In_ HDC hdc, _In_ INT x, _In_ INT y)
__kernel_entry W32KAPI HPEN APIENTRY NtGdiSelectPen(_In_ HDC hdc, _In_ HPEN hpen)
#define WS_EX_MDICHILD
Definition: winuser.h:394
#define COLOR_3DFACE
Definition: winuser.h:923
#define BDR_SUNKENINNER
Definition: winuser.h:445
#define DC_NC
Definition: winuser.h:440
#define FALSE
Definition: types.h:117
#define WS_MINIMIZE
Definition: pedump.c:622
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define DC_REDRAWHUNGWND
Definition: undocuser.h:152
ULONG cyMenu
Definition: ntuser.h:418
THRDESKHEAD head
Definition: ntuser.h:690
#define WS_EX_DLGMODALFRAME
Definition: pedump.c:645
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
#define DC_ACTIVE
Definition: winuser.h:427
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:208
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
#define WS_CAPTION
Definition: pedump.c:624
UINT_PTR IDMenu
Definition: ntuser.h:726
#define TRACE(s)
Definition: solgame.cpp:4
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define SM_CYCAPTION
Definition: winuser.h:957
const DWORD Style
Definition: appswitch.c:71
#define OBJID_HSCROLL
Definition: winable.h:21
#define UlongToHandle(ul)
Definition: basetsd.h:97
#define DFCS_SCROLLSIZEGRIP
Definition: winuser.h:494
#define DC_FRAME
Definition: undocuser.h:149
#define DFCS_CAPTIONCLOSE
Definition: winuser.h:480
VOID NC_DrawFrame(HDC hDC, RECT *CurrentRect, BOOL Active, DWORD Style, DWORD ExStyle)
Definition: nonclient.c:854
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD FASTCALL IntGetSysColor(INT nIndex)
Definition: stockobj.c:323
#define OBJID_VSCROLL
Definition: winable.h:20
#define WS_HSCROLL
Definition: pedump.c:628
#define WM_MDIGETACTIVE
Definition: winuser.h:1811
BOOL FASTCALL IntIsWindowVisible(PWND Wnd)
Definition: window.c:193
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1446
#define COLOR_BTNFACE
Definition: winuser.h:922
COLORREF FASTCALL IntSetDCPenColor(HDC, COLORREF)
Definition: dcutil.c:259
#define WNDS_ACTIVEFRAME
Definition: ntuser.h:606
RECT rcWindow
Definition: ntuser.h:711
BOOL FASTCALL GreMoveTo(HDC hdc, INT x, INT y, LPPOINT pptOut)
Definition: line.c:108
#define PATCOPY
Definition: wingdi.h:335
#define EDGE_RAISED
Definition: winuser.h:450
#define ERR(fmt,...)
Definition: debug.h:110
Definition: ntuser.h:688
static HDC hDC
Definition: 3dtext.c:33
#define DC_NOSENDMSG
Definition: undocuser.h:148
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define DC_SMALLCAP
Definition: winuser.h:428
#define WS_MINIMIZEBOX
Definition: pedump.c:631
FORCEINLINE BOOL IntEqualRect(RECTL *lprc1, RECTL *lprc2)
Definition: winpos.h:48
#define COLOR_BTNSHADOW
Definition: winuser.h:924
PWND FASTCALL IntGetParent(PWND Wnd)
Definition: window.c:208
DWORD state
Definition: ntuser.h:696
#define NULL
Definition: types.h:112
#define WS_VSCROLL
Definition: pedump.c:627
#define DFCS_CAPTIONMAX
Definition: winuser.h:482
#define WNDS_NONCPAINT
Definition: ntuser.h:608
#define SM_CXVSCROLL
Definition: winuser.h:955
#define DFC_SCROLL
Definition: winuser.h:475
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 HASSIZEGRIP(Style, ExStyle, ParentStyle, WindowRect, ParentClientRect)
Definition: nonclient.c:34
LONG bottom
Definition: windef.h:309
#define WNDS_FORCEMENUDRAW
Definition: ntuser.h:615
_In_ ULONG _In_ BOOLEAN Active
Definition: potypes.h:560
#define EDGE_SUNKEN
Definition: winuser.h:451
BOOL FASTCALL IntIsChildWindow(PWND Parent, PWND BaseWindow)
Definition: window.c:916
BOOL FASTCALL UserSystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
Definition: sysparams.c:2090
#define WNDS_HASMENU
Definition: ntuser.h:600
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
#define WS_SYSMENU
Definition: pedump.c:629
#define SM_CYSMCAPTION
Definition: winuser.h:1008
#define WS_EX_STATICEDGE
Definition: winuser.h:403
#define DFCS_CAPTIONMIN
Definition: winuser.h:481
const DWORD ExStyle
Definition: appswitch.c:72
BOOL UserDrawCaption(PWND pWnd, HDC hDc, RECTL *lpRc, HFONT hFont, HICON hIcon, const PUNICODE_STRING Str, UINT uFlags)
Definition: painting.c:2197
DWORD style
Definition: ntuser.h:701
BOOL FASTCALL IntGetWindowRect(PWND Wnd, RECTL *Rect)
Definition: winpos.c:120

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

855 {
856  /* Firstly the "thick" frame */
857  if ((Style & WS_THICKFRAME) && !(Style & WS_MINIMIZE))
858  {
859  LONG Width =
862 
863  LONG Height =
866 
868 
869  /* Draw frame */
870  NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, CurrentRect->right - CurrentRect->left, Height, PATCOPY);
871  NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
872  NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->bottom - 1, CurrentRect->right - CurrentRect->left, -Height, PATCOPY);
873  NtGdiPatBlt(hDC, CurrentRect->right - 1, CurrentRect->top, -Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
874 
875  RECTL_vInflateRect(CurrentRect, -Width, -Height);
876  }
877 
878  /* Now the other bit of the frame */
880  {
883 
889 
890  /* Draw frame */
891  NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, CurrentRect->right - CurrentRect->left, Height, PATCOPY);
892  NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
893  NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->bottom - 1, CurrentRect->right - CurrentRect->left, -Height, PATCOPY);
894  NtGdiPatBlt(hDC, CurrentRect->right - 1, CurrentRect->top, -Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
895 
896  RECTL_vInflateRect(CurrentRect, -Width, -Height);
897  }
898 }
#define WS_THICKFRAME
Definition: pedump.c:630
#define COLOR_WINDOWFRAME
Definition: winuser.h:913
__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
HGDIOBJ FASTCALL IntGetSysColorBrush(INT Object)
Definition: stockobj.c:317
VOID FASTCALL RECTL_vInflateRect(_Inout_ RECTL *rect, _In_ INT dx, _In_ INT dy)
Definition: rect.c:101
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:124
LONG top
Definition: windef.h:307
#define COLOR_INACTIVEBORDER
Definition: winuser.h:918
#define WS_DLGFRAME
Definition: pedump.c:626
_In_ HFONT _Out_ PUINT Height
Definition: font.h:124
LONG left
Definition: windef.h:306
#define SM_CYFRAME
Definition: winuser.h:990
#define SM_CXFRAME
Definition: winuser.h:988
LONG right
Definition: windef.h:308
__kernel_entry W32KAPI HBRUSH APIENTRY NtGdiSelectBrush(_In_ HDC hdc, _In_ HBRUSH hbrush)
#define COLOR_3DFACE
Definition: winuser.h:923
#define WS_MINIMIZE
Definition: pedump.c:622
long LONG
Definition: pedump.c:60
#define SM_CYDLGFRAME
Definition: winuser.h:962
#define WS_EX_DLGMODALFRAME
Definition: pedump.c:645
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:208
const DWORD Style
Definition: appswitch.c:71
#define SM_CXDLGFRAME
Definition: winuser.h:960
#define COLOR_ACTIVEBORDER
Definition: winuser.h:917
#define SM_CYBORDER
Definition: winuser.h:959
#define SM_CXBORDER
Definition: winuser.h:958
#define PATCOPY
Definition: wingdi.h:335
static HDC hDC
Definition: 3dtext.c:33
#define WS_BORDER
Definition: pedump.c:625
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
LONG bottom
Definition: windef.h:309
_In_ ULONG _In_ BOOLEAN Active
Definition: potypes.h:560
#define WS_EX_STATICEDGE
Definition: winuser.h:403
const DWORD ExStyle
Definition: appswitch.c:72

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 {
73  ULONG Style;
74  ULONG ExStyle;
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 }
DWORD ExStyle
Definition: ntuser.h:699
VOID FASTCALL RECTL_vInflateRect(_Inout_ RECTL *rect, _In_ INT dx, _In_ INT dy)
Definition: rect.c:101
LONG top
Definition: windef.h:307
#define SM_CXEDGE
Definition: winuser.h:1002
#define WS_CHILD
Definition: pedump.c:617
LONG left
Definition: windef.h:306
#define SM_CYFRAME
Definition: winuser.h:990
#define SM_CXFRAME
Definition: winuser.h:988
LONG right
Definition: windef.h:308
& rect
Definition: startmenu.cpp:1413
#define WS_EX_MDICHILD
Definition: winuser.h:394
#define SM_CYDLGFRAME
Definition: winuser.h:962
#define WS_EX_DLGMODALFRAME
Definition: pedump.c:645
#define SM_CYEDGE
Definition: winuser.h:1003
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:208
const DWORD Style
Definition: appswitch.c:71
#define WS_ICONIC
Definition: pedump.c:641
#define UserHasDlgFrameStyle(Style, ExStyle)
Definition: nonclient.c:14
#define SM_CXDLGFRAME
Definition: winuser.h:960
#define SM_CYBORDER
Definition: winuser.h:959
#define UserHasThinFrameStyle(Style, ExStyle)
Definition: nonclient.c:22
#define SM_CXBORDER
Definition: winuser.h:958
RECT rcWindow
Definition: ntuser.h:711
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
unsigned int ULONG
Definition: retypes.h:1
#define UserHasThickFrameStyle(Style, ExStyle)
Definition: nonclient.c:18
LONG bottom
Definition: windef.h:309
#define WS_EX_STATICEDGE
Definition: winuser.h:403
const DWORD ExStyle
Definition: appswitch.c:72
DWORD style
Definition: ntuser.h:701

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  {
123  IntGetWindowRect(Wnd, Rect);
124  }
125  else
126  {
127  NC_GetInsideRect(Wnd, Rect);
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:198
LONG top
Definition: windef.h:307
#define WS_CHILD
Definition: pedump.c:617
LONG left
Definition: windef.h:306
#define WS_MINIMIZE
Definition: pedump.c:622
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:208
#define SM_CYCAPTION
Definition: winuser.h:957
void FASTCALL NC_GetInsideRect(PWND Wnd, RECT *rect)
Definition: nonclient.c:71
FORCEINLINE VOID RECTL_vOffsetRect(_Inout_ RECTL *prcl, _In_ INT cx, _In_ INT cy)
Definition: rect.h:31
PWND FASTCALL IntGetParent(PWND Wnd)
Definition: window.c:208
DWORD style
Definition: ntuser.h:701
BOOL FASTCALL IntGetWindowRect(PWND Wnd, RECTL *Rect)
Definition: winpos.c:120

Referenced by MENU_ShowSubPopup().

◆ NC_HandleNCActivate()

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

Definition at line 1383 of file nonclient.c.

1384 {
1385  INT Flags;
1386  /* Lotus Notes draws menu descriptions in the caption of its main
1387  * window. When it wants to restore original "system" view, it just
1388  * sends WM_NCACTIVATE message to itself. Any optimizations here in
1389  * attempt to minimize redrawings lead to a not restored caption.
1390  */
1391  if (wParam & DC_ACTIVE)
1392  {
1395  }
1396  else
1397  {
1398  Wnd->state &= ~WNDS_ACTIVEFRAME;
1399  wParam = DC_CAPTION;
1400  }
1401 
1402  if ((Wnd->state & WNDS_NONCPAINT) || !(Wnd->style & WS_VISIBLE))
1403  return TRUE;
1404 
1405  /* This isn't documented but is reproducible in at least XP SP2 and
1406  * Outlook 2007 depends on it
1407  */
1408  // MSDN:
1409  // If this parameter is set to -1, DefWindowProc does not repaint the
1410  // nonclient area to reflect the state change.
1411  if ( lParam != -1 &&
1412  ( Flags = NC_DoNCActive(Wnd)) != 0 )
1413  {
1414  HDC hDC;
1415  HRGN hRgnTemp = NULL, hRgn = (HRGN)lParam;
1416 
1417  if (GreIsHandleValid(hRgn))
1418  {
1419  hRgnTemp = NtGdiCreateRectRgn(0, 0, 0, 0);
1420  if (NtGdiCombineRgn(hRgnTemp, hRgn, 0, RGN_COPY) == ERROR)
1421  {
1422  GreDeleteObject(hRgnTemp);
1423  hRgnTemp = NULL;
1424  }
1425  }
1426 
1427  if ((hDC = UserGetDCEx(Wnd, hRgnTemp, DCX_WINDOW|DCX_USESTYLE)))
1428  {
1429  NC_DoNCPaint(Wnd, hDC, wParam | Flags); // Redraw MENUs.
1430  UserReleaseDC(Wnd, hDC, FALSE);
1431  }
1432  else
1433  GreDeleteObject(hRgnTemp);
1434  }
1435 
1436  return TRUE;
1437 }
__kernel_entry W32KAPI HRGN APIENTRY NtGdiCreateRectRgn(_In_ INT xLeft, _In_ INT yTop, _In_ INT xRight, _In_ INT yBottom)
BOOL NTAPI GreDeleteObject(HGDIOBJ hobj)
Definition: gdiobj.c:1158
BOOL NTAPI GreIsHandleValid(HGDIOBJ hobj)
Definition: gdiobj.c:1146
#define TRUE
Definition: types.h:120
#define ERROR(name)
Definition: error_private.h:53
static HDC
Definition: imagelist.c:92
static HRGN hRgn
Definition: mapping.c:33
#define DCX_USESTYLE
Definition: GetDCEx.c:10
HDC FASTCALL UserGetDCEx(PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
int32_t INT
Definition: typedefs.h:58
WPARAM wParam
Definition: combotst.c:138
#define DCX_WINDOW
Definition: winuser.h:2103
#define FALSE
Definition: types.h:117
LRESULT NC_DoNCPaint(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:1042
#define DC_ACTIVE
Definition: winuser.h:427
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define WNDS_ACTIVEFRAME
Definition: ntuser.h:606
__kernel_entry W32KAPI INT APIENTRY NtGdiCombineRgn(_In_ HRGN hrgnDst, _In_ HRGN hrgnSrc1, _In_opt_ HRGN hrgnSrc2, _In_ INT iMode)
#define RGN_COPY
Definition: wingdi.h:357
static HDC hDC
Definition: 3dtext.c:33
DWORD state
Definition: ntuser.h:696
#define NULL
Definition: types.h:112
static INT NC_DoNCActive(PWND Wnd)
Definition: nonclient.c:1365
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:918
#define WNDS_NONCPAINT
Definition: ntuser.h:608
#define WS_VISIBLE
Definition: pedump.c:620
#define DC_CAPTION
Definition: winuser.h:439
LPARAM lParam
Definition: combotst.c:139
#define WNDS_HASCAPTION
Definition: ntuser.h:603
DWORD style
Definition: ntuser.h:701

Referenced by IntDefWindowProc().

◆ NC_HandleNCCalcSize()

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

Definition at line 1249 of file nonclient.c.

1250 {
1251  LRESULT Result = 0;
1252  SIZE WindowBorders;
1253  RECT OrigRect;
1254  LONG Style = Wnd->style;
1255  LONG exStyle = Wnd->ExStyle;
1256 
1257  if (Rect == NULL)
1258  {
1259  return Result;
1260  }
1261  OrigRect = *Rect;
1262 
1263  Wnd->state &= ~WNDS_HASCAPTION;
1264 
1265  if (wparam)
1266  {
1267  if (Wnd->pcls->style & CS_VREDRAW)
1268  {
1269  Result |= WVR_VREDRAW;
1270  }
1271  if (Wnd->pcls->style & CS_HREDRAW)
1272  {
1273  Result |= WVR_HREDRAW;
1274  }
1276  }
1277 
1278  if (!(Wnd->style & WS_MINIMIZE))
1279  {
1280  if (UserHasWindowEdge(Wnd->style, Wnd->ExStyle))
1281  {
1282  UserGetWindowBorders(Wnd->style, Wnd->ExStyle, &WindowBorders, FALSE);
1283  RECTL_vInflateRect(Rect, -WindowBorders.cx, -WindowBorders.cy);
1284  }
1285  else if ((Wnd->ExStyle & WS_EX_STATICEDGE) || (Wnd->style & WS_BORDER))
1286  {
1287  RECTL_vInflateRect(Rect, -1, -1);
1288  }
1289 
1290  if ((Wnd->style & WS_CAPTION) == WS_CAPTION)
1291  {
1292  Wnd->state |= WNDS_HASCAPTION;
1293 
1294  if (Wnd->ExStyle & WS_EX_TOOLWINDOW)
1296  else
1298  }
1299 
1300  if (HAS_MENU(Wnd, Style))
1301  {
1302  HDC hDC = UserGetDCEx(Wnd, 0, DCX_USESTYLE | DCX_WINDOW);
1303 
1304  Wnd->state |= WNDS_HASMENU;
1305 
1306  if (hDC)
1307  {
1308  RECT CliRect = *Rect;
1309  CliRect.bottom -= OrigRect.top;
1310  CliRect.right -= OrigRect.left;
1311  CliRect.left -= OrigRect.left;
1312  CliRect.top -= OrigRect.top;
1313  if (!Suspended) Rect->top += MENU_DrawMenuBar(hDC, &CliRect, Wnd, TRUE);
1314  UserReleaseDC(Wnd, hDC, FALSE);
1315  }
1316  }
1317 
1318  if (Wnd->ExStyle & WS_EX_CLIENTEDGE)
1319  {
1321  }
1322 
1323  if (Style & WS_VSCROLL)
1324  {
1325  if (Rect->right - Rect->left >= UserGetSystemMetrics(SM_CXVSCROLL))
1326  {
1328 
1329  /* rectangle is in screen coords when wparam is false */
1330  if (!wparam && (exStyle & WS_EX_LAYOUTRTL)) exStyle ^= WS_EX_LEFTSCROLLBAR;
1331 
1332  if((exStyle & WS_EX_LEFTSCROLLBAR) != 0)
1334  else
1336  }
1337  }
1338 
1339  if (Style & WS_HSCROLL)
1340  {
1341  if( Rect->bottom - Rect->top > UserGetSystemMetrics(SM_CYHSCROLL))
1342  {
1344 
1346  }
1347  }
1348 
1349  if (Rect->top > Rect->bottom)
1350  Rect->bottom = Rect->top;
1351 
1352  if (Rect->left > Rect->right)
1353  Rect->right = Rect->left;
1354  }
1355  else
1356  {
1357  Rect->right = Rect->left;
1358  Rect->bottom = Rect->top;
1359  }
1360 
1361  return Result;
1362 }
DWORD ExStyle
Definition: ntuser.h:699
#define SM_CYHSCROLL
Definition: winuser.h:956
VOID FASTCALL RECTL_vInflateRect(_Inout_ RECTL *rect, _In_ INT dx, _In_ INT dy)
Definition: rect.c:101
#define TRUE
Definition: types.h:120
#define WNDS_HASHORIZONTALSCROLLBAR
Definition: ntuser.h:602
static HDC
Definition: imagelist.c:92
LONG top
Definition: windef.h:307
#define WS_EX_LAYOUTRTL
Definition: winuser.h:390
#define DCX_USESTYLE
Definition: GetDCEx.c:10
#define CS_HREDRAW
Definition: winuser.h:648
BOOL UserHasWindowEdge(DWORD Style, DWORD ExStyle)
Definition: nonclient.c:36
HDC FASTCALL UserGetDCEx(PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
LONG left
Definition: windef.h:306
UINT MENU_DrawMenuBar(HDC hDC, LPRECT lprect, PWND pWnd, BOOL suppress_draw)
Definition: menu.c:2744
LONG right
Definition: windef.h:308
#define WS_EX_LEFTSCROLLBAR
Definition: winuser.h:392
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define DCX_WINDOW
Definition: winuser.h:2103
#define WNDS_HASVERTICALSCROOLLBAR
Definition: ntuser.h:601
UINT style
Definition: ntuser.h:575
#define FALSE
Definition: types.h:117
#define WS_MINIMIZE
Definition: pedump.c:622
long LONG
Definition: pedump.c:60
_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:426
LONG cx
Definition: windef.h:334
VOID UserGetWindowBorders(DWORD Style, DWORD ExStyle, SIZE *Size, BOOL WithClient)
Definition: nonclient.c:53
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:208
#define WS_CAPTION
Definition: pedump.c:624
#define CS_VREDRAW
Definition: winuser.h:653
#define SM_CYCAPTION
Definition: winuser.h:957
const DWORD Style
Definition: appswitch.c:71
#define WVR_VALIDRECTS
Definition: winuser.h:2512
#define WS_HSCROLL
Definition: pedump.c:628
#define SM_CYBORDER
Definition: winuser.h:959
#define SM_CXBORDER
Definition: winuser.h:958
static HDC hDC
Definition: 3dtext.c:33
#define WS_BORDER
Definition: pedump.c:625
#define HAS_MENU(hwnd, style)
Definition: uxthemep.h:222
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define WVR_HREDRAW
Definition: winuser.h:2509
DWORD state
Definition: ntuser.h:696
#define NULL
Definition: types.h:112
#define WS_VSCROLL
Definition: pedump.c:627
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:918
#define WVR_VREDRAW
Definition: winuser.h:2510
#define SM_CXVSCROLL
Definition: winuser.h:955
LONG bottom
Definition: windef.h:309
#define WNDS_HASMENU
Definition: ntuser.h:600
LONG_PTR LRESULT
Definition: windef.h:209
#define SM_CYSMCAPTION
Definition: winuser.h:1008
LONG cy
Definition: windef.h:335
#define WS_EX_STATICEDGE
Definition: winuser.h:403
#define WNDS_HASCAPTION
Definition: ntuser.h:603
struct Rect Rect
static UINT WPARAM wparam
Definition: combo.c:716
PCLS pcls
Definition: ntuser.h:715
DWORD style
Definition: ntuser.h:701

Referenced by IntDefWindowProc().

◆ NC_HandleNCLButtonDblClk()

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

Definition at line 1612 of file nonclient.c.

1613 {
1614  ULONG Style;
1615 
1616  Style = pWnd->style;
1617  switch(wParam)
1618  {
1619  case HTCAPTION:
1620  {
1621  /* Maximize/Restore the window */
1622  if((Style & WS_CAPTION) == WS_CAPTION && (Style & WS_MAXIMIZEBOX))
1623  {
1625  }
1626  break;
1627  }
1628  case HTSYSMENU:
1629  {
1630  PMENU SysMenu = IntGetSystemMenu(pWnd, FALSE);
1632 
1633  /* If the close item of the sysmenu is disabled or not present do nothing */
1634  if ((state & (MF_DISABLED | MF_GRAYED)) || (state == 0xFFFFFFFF))
1635  break;
1636 
1638  break;
1639  }
1640  case HTTOP:
1641  case HTBOTTOM:
1642  {
1643  RECT sizingRect = pWnd->rcWindow, mouseRect;
1644 
1645  if (pWnd->ExStyle & WS_EX_MDICHILD)
1646  break;
1647 
1648  UserSystemParametersInfo(SPI_GETWORKAREA, 0, &mouseRect, 0);
1649 
1650  co_WinPosSetWindowPos(pWnd,
1651  0,
1652  sizingRect.left,
1653  mouseRect.top,
1654  sizingRect.right - sizingRect.left,
1655  mouseRect.bottom - mouseRect.top,
1656  0);
1657  break;
1658  }
1659  default:
1660  return NC_HandleNCLButtonDown(pWnd, wParam, lParam);
1661  }
1662  return(0);
1663 }
#define HTTOP
Definition: winuser.h:2480
DWORD ExStyle
Definition: ntuser.h:699
#define MF_DISABLED
Definition: winuser.h:130
#define MF_BYCOMMAND
Definition: winuser.h:202
#define SC_RESTORE
Definition: winuser.h:2588
BOOLEAN FASTCALL co_WinPosSetWindowPos(PWND Window, HWND WndInsertAfter, INT x, INT y, INT cx, INT cy, UINT flags)
Definition: winpos.c:1748
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
WPARAM wParam
Definition: combotst.c:138
#define WS_EX_MDICHILD
Definition: winuser.h:394
#define HTSYSMENU
Definition: winuser.h:2467
#define FALSE
Definition: types.h:117
#define WS_MINIMIZE
Definition: pedump.c:622
#define SC_MAXIMIZE
Definition: winuser.h:2578
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
#define WS_CAPTION
Definition: pedump.c:624
const DWORD Style
Definition: appswitch.c:71
PMENU FASTCALL IntGetSystemMenu(PWND Window, BOOL bRevert)
Definition: menu.c:5383
#define HTBOTTOM
Definition: winuser.h:2483
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1446
static int state
Definition: maze.c:121
RECT rcWindow
Definition: ntuser.h:711
#define HTCAPTION
Definition: winuser.h:2466
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define SC_CLOSE
Definition: winuser.h:2582
unsigned int ULONG
Definition: retypes.h:1
BOOL FASTCALL UserSystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
Definition: sysparams.c:2090
#define MF_GRAYED
Definition: winuser.h:129
LRESULT NC_HandleNCLButtonDown(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1520
#define WM_SYSCOMMAND
Definition: winuser.h:1731
LPARAM lParam
Definition: combotst.c:139
UINT FASTCALL IntGetMenuState(HMENU hMenu, UINT uId, UINT uFlags)
Definition: menu.c:4975
#define WS_MAXIMIZE
Definition: pedump.c:623
DWORD style
Definition: ntuser.h:701

Referenced by IntDefWindowProc().

◆ NC_HandleNCLButtonDown()

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

Definition at line 1520 of file nonclient.c.

1521 {
1522  switch (wParam)
1523  {
1524  case HTCAPTION:
1525  {
1526  PWND TopWnd = pWnd, parent;
1527  while(1)
1528  {
1529  if ((TopWnd->style & (WS_POPUP|WS_CHILD)) != WS_CHILD)
1530  break;
1531  parent = UserGetAncestor( TopWnd, GA_PARENT );
1532  if (!parent || UserIsDesktopWindow(parent)) break;
1533  TopWnd = parent;
1534  }
1535 
1536  if ( (pWnd && (pWnd->ExStyle & WS_EX_NOACTIVATE)) ||
1538  //NtUserCallHwndLock(hTopWnd, HWNDLOCK_ROUTINE_SETFOREGROUNDWINDOWMOUSE) ||
1539  UserGetActiveWindow() == UserHMGetHandle(TopWnd))
1540  {
1542  }
1543  break;
1544  }
1545  case HTSYSMENU:
1546  {
1547  LONG style = pWnd->style;
1548  if (style & WS_SYSMENU)
1549  {
1550  if(!(style & WS_MINIMIZE) )
1551  {
1552  RECT rect;
1553  HDC hDC = UserGetWindowDC(pWnd);
1554  NC_GetInsideRect(pWnd, &rect);
1555  UserDrawSysMenuButton(pWnd, hDC, &rect, TRUE);
1556  UserReleaseDC( pWnd, hDC, FALSE );
1557  }
1559  }
1560  break;
1561  }
1562  case HTMENU:
1563  {
1565  break;
1566  }
1567  case HTHSCROLL:
1568  {
1570  break;
1571  }
1572  case HTVSCROLL:
1573  {
1575  break;
1576  }
1577  case HTMINBUTTON:
1578  case HTMAXBUTTON:
1579  case HTCLOSE:
1580  {
1581  NC_DoButton(pWnd, wParam, lParam);
1582  break;
1583  }
1584  case HTLEFT:
1585  case HTRIGHT:
1586  case HTTOP:
1587  case HTBOTTOM:
1588  case HTTOPLEFT:
1589  case HTTOPRIGHT:
1590  case HTBOTTOMLEFT:
1591  case HTBOTTOMRIGHT:
1592  {
1593  /* Old comment:
1594  * "make sure hittest fits into 0xf and doesn't overlap with HTSYSMENU"
1595  * This was previously done by setting wParam=SC_SIZE + wParam - 2
1596  */
1597  /* But that is not what WinNT does. Instead it sends this. This
1598  * is easy to differentiate from HTSYSMENU, because HTSYSMENU adds
1599  * SC_MOUSEMENU into wParam.
1600  */
1602  break;
1603  }
1604  case HTBORDER:
1605  break;
1606  }
1607  return(0);
1608 }
#define HTMAXBUTTON
Definition: winuser.h:2474
#define HTTOP
Definition: winuser.h:2480
#define HTLEFT
Definition: winuser.h:2477
DWORD ExStyle
Definition: ntuser.h:699
#define HTHSCROLL
Definition: winuser.h:2471
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:194
#define TRUE
Definition: types.h:120
HWND FASTCALL UserGetActiveWindow(VOID)
Definition: focus.c:1429
static HDC
Definition: imagelist.c:92
HDC FASTCALL UserGetWindowDC(PWND Wnd)
Definition: windc.c:947
#define HTBOTTOMLEFT
Definition: winuser.h:2484
#define SC_MOUSEMENU
Definition: winuser.h:2585
#define HTRIGHT
Definition: winuser.h:2479
#define WS_CHILD
Definition: pedump.c:617
#define HTMINBUTTON
Definition: winuser.h:2473
& rect
Definition: startmenu.cpp:1413
WPARAM wParam
Definition: combotst.c:138
#define HTTOPLEFT
Definition: winuser.h:2481
#define HTSYSMENU
Definition: winuser.h:2467
#define FALSE
Definition: types.h:117
#define WS_MINIMIZE
Definition: pedump.c:622
long LONG
Definition: pedump.c:60
#define GA_PARENT
Definition: winuser.h:2778
BOOL UserDrawSysMenuButton(PWND pWnd, HDC hDC, LPRECT Rect, BOOL Down)
Definition: nonclient.c:712
#define WS_EX_NOACTIVATE
Definition: winuser.h:395
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
#define HTTOPRIGHT
Definition: winuser.h:2482
r parent
Definition: btrfs.c:3010
#define HTBOTTOM
Definition: winuser.h:2483
#define HTCLOSE
Definition: winuser.h:2489
void FASTCALL NC_GetInsideRect(PWND Wnd, RECT *rect)
Definition: nonclient.c:71
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1446
#define HTBOTTOMRIGHT
Definition: winuser.h:2485
PWND FASTCALL UserGetAncestor(PWND Wnd, UINT Type)
Definition: window.c:3331
#define HTCAPTION
Definition: winuser.h:2466
Definition: ntuser.h:688
static HDC hDC
Definition: 3dtext.c:33
#define HTMENU
Definition: winuser.h:2470
#define SC_SIZE
Definition: winuser.h:2574
#define HTBORDER
Definition: winuser.h:2487
#define WS_POPUP
Definition: pedump.c:616
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:918
#define HTVSCROLL
Definition: winuser.h:2472
#define SC_MOVE
Definition: winuser.h:2575
BOOL FASTCALL co_IntSetForegroundWindowMouse(PWND Window)
Definition: focus.c:1561
Arabic default style
Definition: afstyles.h:93
#define WS_SYSMENU
Definition: pedump.c:629
VOID NC_DoButton(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1440
#define WM_SYSCOMMAND
Definition: winuser.h:1731
#define SC_VSCROLL
Definition: winuser.h:2583
LPARAM lParam
Definition: combotst.c:139
#define WMSZ_LEFT
Definition: winuser.h:2454
DWORD style
Definition: ntuser.h:701
#define SC_HSCROLL
Definition: winuser.h:2584

Referenced by IntDefWindowProc(), and NC_HandleNCLButtonDblClk().

◆ NC_HandleNCRButtonDown()

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

Definition at line 1670 of file nonclient.c.

1671 {
1672  MSG msg;
1673  INT hittest = wParam;
1674 
1675  switch (hittest)
1676  {
1677  case HTCAPTION:
1678  case HTSYSMENU:
1679  if (!IntGetSystemMenu( pwnd, FALSE )) break;
1680 
1682  for (;;)
1683  {
1685  if (IntCallMsgFilter( &msg, MSGF_MAX )) continue;
1686  if (msg.message == WM_RBUTTONUP)
1687  {
1688  hittest = GetNCHitEx( pwnd, msg.pt );
1689  break;
1690  }
1691  if (UserHMGetHandle(pwnd) != IntGetCapture()) return 0;
1692  }
1694 
1695  if (hittest == HTCAPTION || hittest == HTSYSMENU || hittest == HTHSCROLL || hittest == HTVSCROLL)
1696  {
1697  TRACE("Msg pt %x and Msg.lParam %x and lParam %x\n",MAKELONG(msg.pt.x,msg.pt.y),msg.lParam,lParam);
1699  }
1700  break;
1701  }
1702  return 0;
1703 }
#define MSGF_MAX
Definition: winuser.h:1172
#define HTHSCROLL
Definition: winuser.h:2471
#define WM_MOUSEFIRST
Definition: winuser.h:1764
#define WM_CONTEXTMENU
Definition: richedit.h:64
BOOL FASTCALL IntReleaseCapture(VOID)
Definition: focus.c:1530
#define TRUE
Definition: types.h:120
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
BOOL FASTCALL IntCallMsgFilter(LPMSG lpmsg, INT code)
Definition: message.c:2137
UINT_PTR WPARAM
Definition: windef.h:207
int32_t INT
Definition: typedefs.h:58
WPARAM wParam
Definition: combotst.c:138
#define HTSYSMENU
Definition: winuser.h:2467
#define FALSE
Definition: types.h:117
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
#define TRACE(s)
Definition: solgame.cpp:4
HWND FASTCALL co_UserSetCapture(HWND hWnd)
Definition: focus.c:1458
PMENU FASTCALL IntGetSystemMenu(PWND Window, BOOL bRevert)
Definition: menu.c:5383
#define WM_MOUSELAST
Definition: winuser.h:1791
#define WM_RBUTTONUP
Definition: winuser.h:1770
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1446
HWND APIENTRY IntGetCapture(VOID)
Definition: focus.c:1440
#define HTCAPTION
Definition: winuser.h:2466
BOOL APIENTRY co_IntGetPeekMessage(PMSG pMsg, HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax, UINT RemoveMsg, BOOL bGMSG)
Definition: message.c:1177
#define HTVSCROLL
Definition: winuser.h:2472
#define msg(x)
Definition: auth_time.c:54
#define PM_REMOVE
Definition: winuser.h:1186
DWORD FASTCALL GetNCHitEx(PWND pWnd, POINT pt)
Definition: nonclient.c:1930
LPARAM lParam
Definition: combotst.c:139

Referenced by IntDefWindowProc().

◆ NC_IconForWindow()

PCURICON_OBJECT FASTCALL NC_IconForWindow ( PWND  pWnd)

Definition at line 681 of file nonclient.c.

682 {
683  PCURICON_OBJECT pIcon = NULL;
684  HICON hIcon;
685 
687  if (!hIcon) hIcon = UserGetProp(pWnd, gpsi->atomIconProp, TRUE);
688 
689  if (!hIcon && pWnd->pcls->spicnSm)
690  return pWnd->pcls->spicnSm;
691  if (!hIcon && pWnd->pcls->spicn)
692  return pWnd->pcls->spicn;
693 
694  // WARNING: Wine code has this test completely wrong. The following is how
695  // Windows behaves for windows having the WS_EX_DLGMODALFRAME style set:
696  // it does not use the default icon! And it does not check for DS_MODALFRAME.
697  if (!hIcon && !(pWnd->ExStyle & WS_EX_DLGMODALFRAME))
698  {
699  hIcon = gpsi->hIconSmWindows; // Both are IDI_WINLOGO Small
700  if (!hIcon) hIcon = gpsi->hIconWindows; // Reg size.
701  }
702  if (hIcon)
703  {
705  hIcon,
706  TYPE_CURSOR);
707  }
708  return pIcon;
709 }
DWORD ExStyle
Definition: ntuser.h:699
static HICON
Definition: imagelist.c:84
PVOID UserGetObjectNoErr(PUSER_HANDLE_TABLE ht, HANDLE handle, HANDLE_TYPE type)
Definition: object.c:481
#define TRUE
Definition: types.h:120
PSERVERINFO gpsi
Definition: imm.c:18
struct _CURICON_OBJECT * spicn
Definition: ntuser.h:580
struct _CURICON_OBJECT * spicnSm
Definition: ntuser.h:585
#define WS_EX_DLGMODALFRAME
Definition: pedump.c:645
HANDLE FASTCALL UserGetProp(_In_ PWND Window, _In_ ATOM Atom, _In_ BOOLEAN SystemProp)
Definition: prop.c:46
ATOM atomIconProp
Definition: ntuser.h:1061
HICON hIcon
Definition: msconfig.c:44
#define NULL
Definition: types.h:112
ATOM atomIconSmProp
Definition: ntuser.h:1060
struct _CURICON_OBJECT * PCURICON_OBJECT
PUSER_HANDLE_TABLE gHandleTable
Definition: object.c:13
PCLS pcls
Definition: ntuser.h:715

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

◆ UserDrawCaptionBar()

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

Definition at line 900 of file nonclient.c.

904 {
906  RECT WindowRect, CurrentRect, TempRect;
907  HPEN PreviousPen;
908  BOOL Gradient = FALSE;
909  PCURICON_OBJECT pIcon = NULL;
910 
911  if (!(Flags & DC_NOVISIBLE) && !IntIsWindowVisible(pWnd)) return;
912 
913  TRACE("UserDrawCaptionBar: pWnd %p, hDc %p, Flags 0x%x.\n", pWnd, hDC, Flags);
914 
915  Style = pWnd->style;
916  ExStyle = pWnd->ExStyle;
917 
918  IntGetWindowRect(pWnd, &WindowRect);
919 
920  CurrentRect.top = CurrentRect.left = 0;
921  CurrentRect.right = WindowRect.right - WindowRect.left;
922  CurrentRect.bottom = WindowRect.bottom - WindowRect.top;
923 
924  /* Draw outer edge */
926  {
927  DrawEdge(hDC, &CurrentRect, EDGE_RAISED, BF_RECT | BF_ADJUST);
928  }
929  else if (ExStyle & WS_EX_STATICEDGE)
930  {
931 #if 0
932  DrawEdge(hDC, &CurrentRect, BDR_SUNKENINNER, BF_RECT | BF_ADJUST | BF_FLAT);
933 #else
935  NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.top, CurrentRect.right - CurrentRect.left, 1, PATCOPY);
936  NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY);
937 
939  NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.bottom - 1, CurrentRect.right - CurrentRect.left, 1, PATCOPY);
940  NtGdiPatBlt(hDC, CurrentRect.right - 1, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY);
941 
942  RECTL_vInflateRect(&CurrentRect, -1, -1);
943 #endif
944  }
945 
946  if (Flags & DC_FRAME) NC_DrawFrame(hDC, &CurrentRect, (Flags & DC_ACTIVE), Style, ExStyle);
947 
948  /* Draw caption */
949  if ((Style & WS_CAPTION) == WS_CAPTION)
950  {
951  TempRect = CurrentRect;
952 
953  Flags |= DC_TEXT|DC_BUTTONS; // Icon will be checked if not already set.
954 
955  if (UserSystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &Gradient, 0) && Gradient)
956  {
957  Flags |= DC_GRADIENT;
958  }
959 
961  {
962  Flags |= DC_SMALLCAP;
963  TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSMCAPTION) - 1;
964  CurrentRect.top += UserGetSystemMetrics(SM_CYSMCAPTION);
965  }
966  else
967  {
968  TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYCAPTION) - 1;
969  CurrentRect.top += UserGetSystemMetrics(SM_CYCAPTION);
970  }
971 
972  if (!(Flags & DC_ICON) &&
973  !(Flags & DC_SMALLCAP) &&
974  (Style & WS_SYSMENU) &&
976  {
977  pIcon = NC_IconForWindow(pWnd); // Force redraw of caption with icon if DC_ICON not flaged....
978  }
979  UserDrawCaption(pWnd, hDC, &TempRect, NULL, pIcon ? UserHMGetHandle(pIcon) : NULL, NULL, Flags);
980 
981  /* Draw buttons */
982  if (Style & WS_SYSMENU)
983  {
986  {
989  }
990  }
991 
992  if (!(Style & WS_MINIMIZE))
993  {
994  /* Line under caption */
995  PreviousPen = NtGdiSelectPen(hDC, NtGdiGetStockObject(DC_PEN));
996 
999 
1000  GreMoveTo(hDC, TempRect.left, TempRect.bottom, NULL);
1001 
1002  NtGdiLineTo(hDC, TempRect.right, TempRect.bottom);
1003 
1004  NtGdiSelectPen(hDC, PreviousPen);
1005  }
1006  }
1007 
1008  if (!(Style & WS_MINIMIZE))
1009  {
1010  /* Draw menu bar */
1011  if (pWnd->state & WNDS_HASMENU && pWnd->IDMenu) // Should be pWnd->spmenu
1012  {
1013  PMENU menu;
1014  if ((menu = UserGetMenuObject(UlongToHandle(pWnd->IDMenu)))) // FIXME! Use pWnd->spmenu,
1015  {
1016  TempRect = CurrentRect;
1017  TempRect.bottom = TempRect.top + menu->cyMenu; // Should be pWnd->spmenu->cyMenu;
1018  CurrentRect.top += MENU_DrawMenuBar(hDC, &TempRect, pWnd, FALSE);
1019  }
1020  }
1021 
1022  if (ExStyle & WS_EX_CLIENTEDGE)
1023  {
1024  DrawEdge(hDC, &CurrentRect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
1025  }
1026  }
1027 }
#define BF_FLAT
Definition: winuser.h:471
DWORD ExStyle
Definition: ntuser.h:699
#define COLOR_WINDOWFRAME
Definition: winuser.h:913
#define DC_NOVISIBLE
Definition: undocuser.h:147
__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
HGDIOBJ FASTCALL IntGetSysColorBrush(INT Object)
Definition: stockobj.c:317
VOID FASTCALL RECTL_vInflateRect(_Inout_ RECTL *rect, _In_ INT dx, _In_ INT dy)
Definition: rect.c:101
__kernel_entry W32KAPI HANDLE APIENTRY NtGdiGetStockObject(_In_ INT iObject)
LONG top
Definition: windef.h:307
#define COLOR_BTNHIGHLIGHT
Definition: winuser.h:929
BOOL UserHasWindowEdge(DWORD Style, DWORD ExStyle)
Definition: nonclient.c:36
LONG left
Definition: windef.h:306
UINT MENU_DrawMenuBar(HDC hDC, LPRECT lprect, PWND pWnd, BOOL suppress_draw)
Definition: menu.c:2744
LONG right
Definition: windef.h:308
VOID UserDrawCaptionButton(PWND pWnd, LPRECT Rect, DWORD Style, DWORD ExStyle, HDC hDC, BOOL bDown, ULONG Type)
Definition: nonclient.c:753
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define BF_ADJUST
Definition: winuser.h:470
__kernel_entry W32KAPI HBRUSH APIENTRY NtGdiSelectBrush(_In_ HDC hdc, _In_ HBRUSH hbrush)
#define DC_ICON
Definition: winuser.h:429
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:4
#define BF_RECT
Definition: winuser.h:462
__kernel_entry W32KAPI BOOL APIENTRY NtGdiLineTo(_In_ HDC hdc, _In_ INT x, _In_ INT y)
__kernel_entry W32KAPI HPEN APIENTRY NtGdiSelectPen(_In_ HDC hdc, _In_ HPEN hpen)
#define COLOR_3DFACE
Definition: winuser.h:923
#define BDR_SUNKENINNER
Definition: winuser.h:445
#define FALSE
Definition: types.h:117
#define WS_MINIMIZE
Definition: pedump.c:622
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
ULONG cyMenu
Definition: ntuser.h:418
#define WS_EX_DLGMODALFRAME
Definition: pedump.c:645
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
PCURICON_OBJECT FASTCALL NC_IconForWindow(PWND pWnd)
Definition: nonclient.c:681
#define DC_ACTIVE
Definition: winuser.h:427
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:208
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
#define WS_CAPTION
Definition: pedump.c:624
UINT_PTR IDMenu
Definition: ntuser.h:726
#define TRACE(s)
Definition: solgame.cpp:4
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define SM_CYCAPTION
Definition: winuser.h:957
const DWORD Style
Definition: appswitch.c:71
#define UlongToHandle(ul)
Definition: basetsd.h:97
#define DC_FRAME
Definition: undocuser.h:149
#define DFCS_CAPTIONCLOSE
Definition: winuser.h:480
VOID NC_DrawFrame(HDC hDC, RECT *CurrentRect, BOOL Active, DWORD Style, DWORD ExStyle)
Definition: nonclient.c:854
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD FASTCALL IntGetSysColor(INT nIndex)
Definition: stockobj.c:323
BOOL FASTCALL IntIsWindowVisible(PWND Wnd)
Definition: window.c:193
COLORREF FASTCALL IntSetDCPenColor(HDC, COLORREF)
Definition: dcutil.c:259
BOOL FASTCALL GreMoveTo(HDC hdc, INT x, INT y, LPPOINT pptOut)
Definition: line.c:108
#define PATCOPY
Definition: wingdi.h:335
#define EDGE_RAISED
Definition: winuser.h:450
static HDC hDC
Definition: 3dtext.c:33
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define DC_SMALLCAP
Definition: winuser.h:428
#define WS_MINIMIZEBOX
Definition: pedump.c:631
#define COLOR_BTNSHADOW
Definition: winuser.h:924
DWORD state
Definition: ntuser.h:696
#define NULL
Definition: types.h:112
#define DFCS_CAPTIONMAX
Definition: winuser.h:482
LONG bottom
Definition: windef.h:309
#define EDGE_SUNKEN
Definition: winuser.h:451
BOOL FASTCALL UserSystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
Definition: sysparams.c:2090
#define WNDS_HASMENU
Definition: ntuser.h:600
#define WS_SYSMENU
Definition: pedump.c:629
#define SM_CYSMCAPTION
Definition: winuser.h:1008
#define WS_EX_STATICEDGE
Definition: winuser.h:403
#define DC_TEXT
Definition: winuser.h:430
#define DFCS_CAPTIONMIN
Definition: winuser.h:481
const DWORD ExStyle
Definition: appswitch.c:72
BOOL UserDrawCaption(PWND pWnd, HDC hDc, RECTL *lpRc, HFONT hFont, HICON hIcon, const PUNICODE_STRING Str, UINT uFlags)
Definition: painting.c:2197
DWORD style
Definition: ntuser.h:701
BOOL FASTCALL IntGetWindowRect(PWND Wnd, RECTL *Rect)
Definition: winpos.c:120

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

754 {
755  RECT TempRect;
756 
757  if (!(Style & WS_SYSMENU))
758  {
759  return;
760  }
761 
762  TempRect = *Rect;
763 
764  switch (Type)
765  {
766  case DFCS_CAPTIONMIN:
767  {
769  return; /* ToolWindows don't have min/max buttons */
770 
771  if (Style & WS_SYSMENU)
772  TempRect.right -= UserGetSystemMetrics(SM_CXSIZE) + 1;
773 
775  TempRect.right -= UserGetSystemMetrics(SM_CXSIZE) - 2;
776 
777  TempRect.left = TempRect.right - UserGetSystemMetrics(SM_CXSIZE) + 1;
778  TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSIZE) - 2;
779  TempRect.top += 2;
780  TempRect.right -= 1;
781 
782  DrawFrameControl(hDC, &TempRect, DFC_CAPTION,
784  (bDown ? DFCS_PUSHED : 0) |
785  ((Style & WS_MINIMIZEBOX) ? 0 : DFCS_INACTIVE));
786  break;
787  }
788  case DFCS_CAPTIONMAX:
789  {
791  return; /* ToolWindows don't have min/max buttons */
792 
793  if (Style & WS_SYSMENU)
794  TempRect.right -= UserGetSystemMetrics(SM_CXSIZE) + 1;
795 
796  TempRect.left = TempRect.right - UserGetSystemMetrics(SM_CXSIZE) + 1;
797  TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSIZE) - 2;
798  TempRect.top += 2;
799  TempRect.right -= 1;
800 
801  DrawFrameControl(hDC, &TempRect, DFC_CAPTION,
803  (bDown ? DFCS_PUSHED : 0) |
804  ((Style & WS_MAXIMIZEBOX) ? 0 : DFCS_INACTIVE));
805  break;
806  }
807  case DFCS_CAPTIONCLOSE:
808  {
809  PMENU pSysMenu = IntGetSystemMenu(pWnd, FALSE);
810  UINT MenuState = IntGetMenuState(pSysMenu ? UserHMGetHandle(pSysMenu) : NULL, SC_CLOSE, MF_BYCOMMAND); /* in case of error MenuState==0xFFFFFFFF */
811 
812  /* A tool window has a smaller Close button */
814  {
815  TempRect.left = TempRect.right - UserGetSystemMetrics(SM_CXSMSIZE);
816  TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSMSIZE) - 2;
817  }
818  else
819  {
820  TempRect.left = TempRect.right - UserGetSystemMetrics(SM_CXSIZE);
821  TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSIZE) - 2;
822  }
823  TempRect.top += 2;
824  TempRect.right -= 2;
825 
826  DrawFrameControl(hDC, &TempRect, DFC_CAPTION,
827  (DFCS_CAPTIONCLOSE | (bDown ? DFCS_PUSHED : 0) |
828  ((!(MenuState & (MF_GRAYED|MF_DISABLED)) && !(pWnd->pcls->style & CS_NOCLOSE)) ? 0 : DFCS_INACTIVE)));
829  break;
830  }
831  }
832 }
#define MF_DISABLED
Definition: winuser.h:130
#define SM_CYSIZE
Definition: winuser.h:986
#define MF_BYCOMMAND
Definition: winuser.h:202
#define DFCS_INACTIVE
Definition: winuser.h:502
LONG top
Definition: windef.h:307
#define CS_NOCLOSE
Definition: winuser.h:649
BOOL WINAPI DrawFrameControl(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define DFCS_PUSHED
Definition: winuser.h:503
UINT style
Definition: ntuser.h:575
#define FALSE
Definition: types.h:117
#define WS_MINIMIZE
Definition: pedump.c:622
#define DFCS_CAPTIONRESTORE
Definition: winuser.h:483
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:208
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
#define SM_CYSMSIZE
Definition: winuser.h:1010
const DWORD Style
Definition: appswitch.c:71
PMENU FASTCALL IntGetSystemMenu(PWND Window, BOOL bRevert)
Definition: menu.c:5383
#define DFCS_CAPTIONCLOSE
Definition: winuser.h:480
#define SM_CXSMSIZE
Definition: winuser.h:1009
Type
Definition: Type.h:6
#define DFC_CAPTION
Definition: winuser.h:473
static HDC hDC
Definition: 3dtext.c:33
#define WS_MINIMIZEBOX
Definition: pedump.c:631
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define DFCS_CAPTIONMAX
Definition: winuser.h:482
#define SC_CLOSE
Definition: winuser.h:2582
#define SM_CXSIZE
Definition: winuser.h:985
LONG bottom
Definition: windef.h:309
#define MF_GRAYED
Definition: winuser.h:129
#define WS_SYSMENU
Definition: pedump.c:629
#define DFCS_CAPTIONMIN
Definition: winuser.h:481
struct Rect Rect
const DWORD ExStyle
Definition: appswitch.c:72
UINT FASTCALL IntGetMenuState(HMENU hMenu, UINT uId, UINT uFlags)
Definition: menu.c:4975
PCLS pcls
Definition: ntuser.h:715
#define WS_MAXIMIZE
Definition: pedump.c:623

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

◆ UserDrawCaptionButtonWnd()

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

Definition at line 835 of file nonclient.c.

836 {
837  RECT WindowRect;
838  SIZE WindowBorder;
839 
840  IntGetWindowRect(pWnd, &WindowRect);
841 
842  WindowRect.right -= WindowRect.left;
843  WindowRect.bottom -= WindowRect.top;
844  WindowRect.left = WindowRect.top = 0;
845 
846  UserGetWindowBorders(pWnd->style, pWnd->ExStyle, &WindowBorder, FALSE);
847 
848  RECTL_vInflateRect(&WindowRect, -WindowBorder.cx, -WindowBorder.cy);
849 
850  UserDrawCaptionButton(pWnd, &WindowRect, pWnd->style, pWnd->ExStyle, hDC, bDown, Type);
851 }
DWORD ExStyle
Definition: ntuser.h:699
VOID FASTCALL RECTL_vInflateRect(_Inout_ RECTL *rect, _In_ INT dx, _In_ INT dy)
Definition: rect.c:101
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
VOID UserDrawCaptionButton(PWND pWnd, LPRECT Rect, DWORD Style, DWORD ExStyle, HDC hDC, BOOL bDown, ULONG Type)
Definition: nonclient.c:753
#define FALSE
Definition: types.h:117
LONG cx
Definition: windef.h:334
VOID UserGetWindowBorders(DWORD Style, DWORD ExStyle, SIZE *Size, BOOL WithClient)
Definition: nonclient.c:53
Type
Definition: Type.h:6
static HDC hDC
Definition: 3dtext.c:33
LONG bottom
Definition: windef.h:309
LONG cy
Definition: windef.h:335
DWORD style
Definition: ntuser.h:701
BOOL FASTCALL IntGetWindowRect(PWND Wnd, RECTL *Rect)
Definition: winpos.c:120

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 }
#define SM_CYFRAME
Definition: winuser.h:990
#define SM_CXFRAME
Definition: winuser.h:988
& rect
Definition: startmenu.cpp:1413
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:208
HDC hdc
Definition: main.c:9
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 712 of file nonclient.c.

713 {
714  PCURICON_OBJECT WindowIcon;
715  BOOL Ret = FALSE;
716 
717  if ((WindowIcon = NC_IconForWindow(pWnd)))
718  {
719  UserReferenceObject(WindowIcon);
720 
721  Ret = UserDrawIconEx(hDC,
722  Rect->left + 2,
723  Rect->top + 2,
724  WindowIcon,
727  0, NULL, DI_NORMAL);
728 
729  UserDereferenceObject(WindowIcon);
730  }
731  return Ret;
732 }
BOOL UserDrawIconEx(HDC hDc, INT xLeft, INT yTop, PCURICON_OBJECT pIcon, INT cxWidth, INT cyHeight, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags)
Definition: cursoricon.c:1688
#define SM_CYSMICON
Definition: winuser.h:1007
BOOL FASTCALL UserDereferenceObject(PVOID Object)
Definition: object.c:644
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
PCURICON_OBJECT FASTCALL NC_IconForWindow(PWND pWnd)
Definition: nonclient.c:681
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:208
#define SM_CXSMICON
Definition: winuser.h:1006
#define DI_NORMAL
Definition: wingdi.h:72
static HDC hDC
Definition: 3dtext.c:33
#define NULL
Definition: types.h:112
VOID FASTCALL UserReferenceObject(PVOID obj)
Definition: object.c:731

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 }
GLint GLint GLsizei width
Definition: gl.h:1546
#define PATINVERT
Definition: wingdi.h:328
static HBRUSH hbrush
__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
PSERVERINFO gpsi
Definition: imm.c:18
& rect
Definition: startmenu.cpp:1413
__kernel_entry W32KAPI HBRUSH APIENTRY NtGdiSelectBrush(_In_ HDC hdc, _In_ HBRUSH hbrush)
long LONG
Definition: pedump.c:60
HDC hdc
Definition: main.c:9
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546

Referenced by UserDrawMovingFrame().