ReactOS  0.4.15-dev-5122-g72bdbdd
painting.c File Reference
#include <win32k.h>
Include dependency graph for painting.c:

Go to the source code of this file.

Functions

 DBG_DEFAULT_CHANNEL (UserPainting)
 
BOOL UserExtTextOutW (HDC hdc, INT x, INT y, UINT flags, PRECTL lprc, LPCWSTR lpString, UINT count)
 
IntIntersectWithParents

Intersect window rectangle with all parent client rectangles.

Parameters
ChildPointer to child window to start intersecting from.
WindowRectPointer to rectangle that we want to intersect in screen coordinates on input and intersected rectangle on output (if TRUE is returned).
Returns
If any parent is minimized or invisible or the resulting rectangle is empty then FALSE is returned. Otherwise TRUE is returned.
BOOL FASTCALL IntIntersectWithParents (PWND Child, RECTL *WindowRect)
 
BOOL FASTCALL IntValidateParents (PWND Child, BOOL Recurse)
 
VOID FASTCALL IntSendSyncPaint (PWND Wnd, ULONG Flags)
 
HRGN FASTCALL IntCalcWindowRgn (PWND Wnd, BOOL Client)
 
HRGN FASTCALL IntGetNCUpdateRgn (PWND Window, BOOL Validate)
 
VOID FASTCALL IntSendNCPaint (PWND pWnd, HRGN hRgn)
 
VOID FASTCALL IntSendChildNCPaint (PWND pWnd)
 
VOID FASTCALL co_IntPaintWindows (PWND Wnd, ULONG Flags, BOOL Recurse)
 
VOID FASTCALL co_IntUpdateWindows (PWND Wnd, ULONG Flags, BOOL Recurse)
 
VOID FASTCALL UserUpdateWindows (PWND pWnd, ULONG Flags)
 
VOID FASTCALL UserSyncAndPaintWindows (PWND pWnd, ULONG Flags)
 
VOID FASTCALL IntInvalidateWindows (PWND Wnd, PREGION Rgn, ULONG Flags)
 
BOOL FASTCALL IntIsWindowDrawable (PWND Wnd)
 
BOOL FASTCALL co_UserRedrawWindow (PWND Window, const RECTL *UpdateRect, PREGION UpdateRgn, ULONG Flags)
 
VOID FASTCALL PaintSuspendedWindow (PWND pwnd, HRGN hrgnOrig)
 
VOID FASTCALL UpdateTheadChildren (PWND pWnd, HRGN hRgn)
 
VOID FASTCALL UpdateThreadWindows (PWND pWnd, PTHREADINFO pti, HRGN hRgn)
 
BOOL FASTCALL IntIsWindowDirty (PWND Wnd)
 
PWND FASTCALL IntFindWindowToRepaint (PWND Window, PTHREADINFO Thread)
 
VOID FASTCALL IntPaintWindow (PWND Window)
 
BOOL FASTCALL IntGetPaintMessage (PWND Window, UINT MsgFilterMin, UINT MsgFilterMax, PTHREADINFO Thread, MSG *Message, BOOL Remove)
 
BOOL FASTCALL IntPrintWindow (PWND pwnd, HDC hdcBlt, UINT nFlags)
 
BOOL FASTCALL IntFlashWindowEx (PWND pWnd, PFLASHWINFO pfwi)
 
HDC FASTCALL IntBeginPaint (PWND Window, PPAINTSTRUCT Ps)
 
BOOL FASTCALL IntEndPaint (PWND Wnd, PPAINTSTRUCT Ps)
 
BOOL FASTCALL IntFillWindow (PWND pWndParent, PWND pWnd, HDC hDC, HBRUSH hBrush)
 
HDC APIENTRY NtUserBeginPaint (HWND hWnd, PAINTSTRUCT *UnsafePs)
 
BOOL APIENTRY NtUserEndPaint (HWND hWnd, CONST PAINTSTRUCT *pUnsafePs)
 
BOOL APIENTRY NtUserFillWindow (HWND hWndParent, HWND hWnd, HDC hDC, HBRUSH hBrush)
 
BOOL APIENTRY NtUserFlashWindowEx (IN PFLASHWINFO pfwi)
 
INT FASTCALL co_UserGetUpdateRgn (PWND Window, HRGN hRgn, BOOL bErase)
 
BOOL FASTCALL co_UserGetUpdateRect (PWND Window, PRECT pRect, BOOL bErase)
 
INT APIENTRY NtUserGetUpdateRgn (HWND hWnd, HRGN hRgn, BOOL bErase)
 
BOOL APIENTRY NtUserGetUpdateRect (HWND hWnd, LPRECT UnsafeRect, BOOL bErase)
 
BOOL APIENTRY NtUserRedrawWindow (HWND hWnd, CONST RECT *lprcUpdate, HRGN hrgnUpdate, UINT flags)
 
BOOL UserDrawCaptionText (PWND pWnd, HDC hDc, const PUNICODE_STRING Text, const RECTL *lpRc, UINT uFlags, HFONT hFont)
 
BOOL UserDrawCaption (PWND pWnd, HDC hDc, RECTL *lpRc, HFONT hFont, HICON hIcon, const PUNICODE_STRING Str, UINT uFlags)
 
INT FASTCALL UserRealizePalette (HDC hdc)
 
BOOL APIENTRY NtUserDrawCaptionTemp (HWND hWnd, HDC hDC, LPCRECT lpRc, HFONT hFont, HICON hIcon, const PUNICODE_STRING str, UINT uFlags)
 
BOOL APIENTRY NtUserDrawCaption (HWND hWnd, HDC hDC, LPCRECT lpRc, UINT uFlags)
 
INT FASTCALL co_UserExcludeUpdateRgn (HDC hDC, PWND Window)
 
INT APIENTRY NtUserExcludeUpdateRgn (HDC hDC, HWND hWnd)
 
BOOL APIENTRY NtUserInvalidateRect (HWND hWnd, CONST RECT *lpUnsafeRect, BOOL bErase)
 
BOOL APIENTRY NtUserInvalidateRgn (HWND hWnd, HRGN hRgn, BOOL bErase)
 
BOOL APIENTRY NtUserPrintWindow (HWND hwnd, HDC hdcBlt, UINT nFlags)
 
BOOL APIENTRY NtUserValidateRect (HWND hWnd, const RECT *lpRect)
 

Function Documentation

◆ co_IntPaintWindows()

VOID FASTCALL co_IntPaintWindows ( PWND  Wnd,
ULONG  Flags,
BOOL  Recurse 
)

Definition at line 403 of file painting.c.

404 {
405  HDC hDC;
406  HWND hWnd = Wnd->head.h;
407  HRGN TempRegion = NULL;
408 
409  Wnd->state &= ~WNDS_PAINTNOTPROCESSED;
410 
411  if (Wnd->state & WNDS_SENDNCPAINT ||
413  {
414  if (!(Wnd->style & WS_VISIBLE))
415  {
417  return;
418  }
419  else
420  {
421  if (Wnd->hrgnUpdate == NULL)
422  {
424  }
425 
426  if (Wnd->head.pti == PsGetCurrentThreadWin32Thread())
427  {
428  if (Wnd->state & WNDS_SENDNCPAINT)
429  {
430  TempRegion = IntGetNCUpdateRgn(Wnd, TRUE);
431 
432  IntSendNCPaint(Wnd, TempRegion);
433 
434  if (TempRegion > HRGN_WINDOW && GreIsHandleValid(TempRegion))
435  {
436  /* NOTE: The region can already be deleted! */
437  GreDeleteObject(TempRegion);
438  }
439  }
440 
441  if (Wnd->state & WNDS_SENDERASEBACKGROUND)
442  {
444  if (Wnd->hrgnUpdate)
445  {
446  hDC = UserGetDCEx( Wnd,
447  Wnd->hrgnUpdate,
449 
450  if (Wnd->head.pti->ppi != pti->ppi)
451  {
452  ERR("Sending DC to another Process!!!\n");
453  }
454 
456  // Kill the loop, so Clear before we send.
458  {
460  }
461  UserReleaseDC(Wnd, hDC, FALSE);
462  }
463  }
464  }
465 
466  }
467  }
468 
469  /*
470  * Check that the window is still valid at this point
471  */
472  if (!IntIsWindow(hWnd))
473  {
474  return;
475  }
476 
477  /*
478  * Paint child windows.
479  */
480 
481  if (!(Flags & RDW_NOCHILDREN) &&
482  !(Wnd->style & WS_MINIMIZE) &&
483  ( Flags & RDW_ALLCHILDREN ||
484  (Flags & RDW_CLIPCHILDREN && Wnd->style & WS_CLIPCHILDREN) ) )
485  {
486  HWND *List, *phWnd;
488 
489  if ((List = IntWinListChildren(Wnd)))
490  {
491  for (phWnd = List; *phWnd; ++phWnd)
492  {
493  if ((Wnd = UserGetWindowObject(*phWnd)) == NULL)
494  continue;
495 
496  if (Wnd->head.pti != pti && Wnd->style & WS_CHILD)
497  continue;
498 
499  if (Wnd->style & WS_VISIBLE)
500  {
502  UserRefObjectCo(Wnd, &Ref);
504  UserDerefObjectCo(Wnd);
505  }
506  }
508  }
509  }
510 }
#define RDW_NOCHILDREN
Definition: winuser.h:1212
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 WNDS_SENDNCPAINT
Definition: ntuser.h:599
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
VOID FASTCALL IntSendNCPaint(PWND pWnd, HRGN hRgn)
Definition: painting.c:348
static HDC
Definition: imagelist.c:92
HWND hWnd
Definition: settings.c:17
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:27
#define DCX_USESTYLE
Definition: GetDCEx.c:10
HDC FASTCALL UserGetDCEx(PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
UINT_PTR WPARAM
Definition: windef.h:207
#define WS_CHILD
Definition: pedump.c:617
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define DCX_INTERSECTRGN
Definition: winuser.h:2112
PPROCESSINFO ppi
Definition: win32.h:84
#define WNDS_PAINTNOTPROCESSED
Definition: ntuser.h:610
#define FALSE
Definition: types.h:117
#define WS_MINIMIZE
Definition: pedump.c:622
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:40
HRGN FASTCALL IntGetNCUpdateRgn(PWND Window, BOOL Validate)
Definition: painting.c:260
THRDESKHEAD head
Definition: ntuser.h:674
Definition: object.h:3
#define DCX_KEEPCLIPRGN
Definition: undocuser.h:67
#define HRGN_WINDOW
Definition: ntuser.h:344
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:126
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
VOID FASTCALL co_IntPaintWindows(PWND Wnd, ULONG Flags, BOOL Recurse)
Definition: painting.c:403
HRGN hrgnUpdate
Definition: ntuser.h:700
BOOL FASTCALL IntIsWindow(HWND hWnd)
Definition: window.c:180
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1446
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
HWND *FASTCALL IntWinListChildren(PWND Window)
Definition: window.c:278
#define ERR(fmt,...)
Definition: debug.h:110
static HDC hDC
Definition: 3dtext.c:33
#define DCX_CACHE
Definition: winuser.h:2104
#define RDW_ALLCHILDREN
Definition: winuser.h:1211
DWORD state
Definition: ntuser.h:680
#define NULL
Definition: types.h:112
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:918
#define WNDS_SENDERASEBACKGROUND
Definition: ntuser.h:597
#define RDW_CLIPCHILDREN
Definition: painting.h:15
#define WNDS_ERASEBACKGROUND
Definition: ntuser.h:598
#define WM_ERASEBKGND
Definition: winuser.h:1615
#define USERTAG_WINDOWLIST
Definition: tags.h:298
#define WS_VISIBLE
Definition: pedump.c:620
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
DWORD style
Definition: ntuser.h:685

Referenced by co_IntGetUpdateRgn(), co_IntPaintWindows(), co_IntUpdateWindows(), co_UserGetUpdateRect(), co_UserGetUpdateRgn(), co_WinPosSetWindowPos(), IntPaintWindow(), and UserSyncAndPaintWindows().

◆ co_IntUpdateWindows()

VOID FASTCALL co_IntUpdateWindows ( PWND  Wnd,
ULONG  Flags,
BOOL  Recurse 
)

Definition at line 519 of file painting.c.

520 {
521  HWND hWnd = Wnd->head.h;
522 
523  if ( Wnd->hrgnUpdate != NULL || Wnd->state & WNDS_INTERNALPAINT )
524  {
525  if (Wnd->hrgnUpdate)
526  {
527  if (!IntValidateParents(Wnd, Recurse))
528  {
529  return;
530  }
531  }
532 
533  if (Wnd->state & WNDS_INTERNALPAINT)
534  {
535  Wnd->state &= ~WNDS_INTERNALPAINT;
536 
537  if (Wnd->hrgnUpdate == NULL)
538  MsqDecPaintCountQueue(Wnd->head.pti);
539  }
540 
542  Wnd->state &= ~WNDS_UPDATEDIRTY;
543 
544  Wnd->state2 |= WNDS2_WMPAINTSENT;
546 
547  if (Wnd->state & WNDS_PAINTNOTPROCESSED)
548  {
550  UserRefObjectCo(Wnd, &Ref);
552  UserDerefObjectCo(Wnd);
553  }
554  }
555 
556  // Force flags as a toggle. Fixes msg:test_paint_messages:WmChildPaintNc.
557  Flags = (Flags & RDW_NOCHILDREN) ? RDW_NOCHILDREN : RDW_ALLCHILDREN; // All children is the default.
558 
559  /*
560  * Update child windows.
561  */
562 
563  if (!(Flags & RDW_NOCHILDREN) &&
564  (Flags & RDW_ALLCHILDREN) &&
565  !UserIsDesktopWindow(Wnd))
566  {
567  PWND Child;
568 
569  for (Child = Wnd->spwndChild; Child; Child = Child->spwndNext)
570  {
571  /* transparent window, check for non-transparent sibling to paint first, then skip it */
572  if ( Child->ExStyle & WS_EX_TRANSPARENT &&
573  ( Child->hrgnUpdate != NULL || Child->state & WNDS_INTERNALPAINT ) )
574  {
575  PWND Next = Child->spwndNext;
576  while (Next)
577  {
578  if ( Next->hrgnUpdate != NULL || Next->state & WNDS_INTERNALPAINT ) break;
579 
580  Next = Next->spwndNext;
581  }
582 
583  if (Next) continue;
584  }
585 
586  if (Child->style & WS_VISIBLE)
587  {
589  UserRefObjectCo(Child, &Ref);
592  }
593  }
594  }
595 }
#define RDW_NOCHILDREN
Definition: winuser.h:1212
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:194
#define TRUE
Definition: types.h:120
HWND hWnd
Definition: settings.c:17
#define WS_EX_TRANSPARENT
Definition: pedump.c:649
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:27
#define WNDS_PAINTNOTPROCESSED
Definition: ntuser.h:610
#define FALSE
Definition: types.h:117
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFDEVICE Child
Definition: wdffdo.h:533
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:40
THRDESKHEAD head
Definition: ntuser.h:674
Definition: object.h:3
struct _WND * spwndNext
Definition: ntuser.h:690
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
VOID FASTCALL co_IntPaintWindows(PWND Wnd, ULONG Flags, BOOL Recurse)
Definition: painting.c:403
HRGN hrgnUpdate
Definition: ntuser.h:700
BOOL FASTCALL IntValidateParents(PWND Child, BOOL Recurse)
Definition: painting.c:62
VOID FASTCALL co_IntUpdateWindows(PWND Wnd, ULONG Flags, BOOL Recurse)
Definition: painting.c:519
#define WM_PAINT
Definition: winuser.h:1610
VOID FASTCALL MsqDecPaintCountQueue(PTHREADINFO pti)
Definition: msgqueue.c:508
#define WNDS2_WMPAINTSENT
Definition: ntuser.h:624
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1446
Definition: ntuser.h:672
#define RDW_ALLCHILDREN
Definition: winuser.h:1211
DWORD state
Definition: ntuser.h:680
#define NULL
Definition: types.h:112
#define WNDS_INTERNALPAINT
Definition: ntuser.h:600
#define WNDS_UPDATEDIRTY
Definition: ntuser.h:601
DWORD state2
Definition: ntuser.h:681
struct _WND * spwndChild
Definition: ntuser.h:693
#define WS_VISIBLE
Definition: pedump.c:620

Referenced by co_IntUpdateWindows(), IntPrintWindow(), MENU_ShowPopup(), NC_DoButton(), NtUserCallHwndLock(), and UserUpdateWindows().

◆ co_UserExcludeUpdateRgn()

INT FASTCALL co_UserExcludeUpdateRgn ( HDC  hDC,
PWND  Window 
)

Definition at line 2471 of file painting.c.

2472 {
2473  POINT pt;
2474  RECT rc;
2475 
2476  if (Window->hrgnUpdate)
2477  {
2478  if (Window->hrgnUpdate == HRGN_WINDOW)
2479  {
2480  return NtGdiIntersectClipRect(hDC, 0, 0, 0, 0);
2481  }
2482  else
2483  {
2484  INT ret = ERROR;
2485  HRGN hrgn = NtGdiCreateRectRgn(0,0,0,0);
2486 
2487  if ( hrgn && GreGetDCPoint( hDC, GdiGetDCOrg, &pt) )
2488  {
2490  {
2491  NtGdiOffsetRgn(hrgn, pt.x, pt.y);
2492  }
2493  else
2494  {
2495  HRGN hrgnScreen;
2497  hrgnScreen = NtGdiCreateRectRgn(0,0,0,0);
2498  NtGdiCombineRgn(hrgnScreen, hrgnScreen, pm->hrgnMonitor, RGN_OR);
2499 
2500  NtGdiCombineRgn(hrgn, hrgnScreen, NULL, RGN_COPY);
2501 
2502  GreDeleteObject(hrgnScreen);
2503  }
2504 
2505  NtGdiCombineRgn(hrgn, hrgn, Window->hrgnUpdate, RGN_DIFF);
2506 
2507  NtGdiOffsetRgn(hrgn, -pt.x, -pt.y);
2508 
2510 
2512  }
2513  return ret;
2514  }
2515  }
2516  else
2517  {
2518  return GdiGetClipBox( hDC, &rc);
2519  }
2520 }
__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
__kernel_entry W32KAPI INT APIENTRY NtGdiIntersectClipRect(_In_ HDC hdc, _In_ INT xLeft, _In_ INT yTop, _In_ INT xRight, _In_ INT yBottom)
Definition: cliprgn.c:486
#define pt(x, y)
Definition: drawing.c:79
#define ERROR(name)
Definition: error_private.h:53
__kernel_entry W32KAPI INT APIENTRY NtGdiExtSelectClipRgn(_In_ HDC hdc, _In_opt_ HRGN hrgn, _In_ INT iMode)
static LPMONITOREX pm
Definition: localmon.c:45
#define NULLREGION
Definition: wingdi.h:361
int32_t INT
Definition: typedefs.h:58
Definition: window.c:28
#define HRGN_WINDOW
Definition: ntuser.h:344
#define RGN_OR
Definition: wingdi.h:359
#define CLIPRGN
Definition: precomp.h:18
__kernel_entry W32KAPI INT APIENTRY NtGdiOffsetRgn(_In_ HRGN hrgn, _In_ INT cx, _In_ INT cy)
Definition: region.c:3981
int ret
BOOL APIENTRY GreGetDCPoint(HDC hDC, UINT iPoint, PPOINTL Point)
Definition: coord.c:1291
static HRGN hrgn
Definition: win.c:55
__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
#define RGN_DIFF
Definition: wingdi.h:358
#define NULL
Definition: types.h:112
__kernel_entry W32KAPI INT APIENTRY NtGdiGetRandomRgn(_In_ HDC hdc, _In_ HRGN hrgn, _In_ INT iRgn)
PMONITOR NTAPI UserGetPrimaryMonitor(VOID)
Definition: monitor.c:102

Referenced by NtUserExcludeUpdateRgn().

◆ co_UserGetUpdateRect()

BOOL FASTCALL co_UserGetUpdateRect ( PWND  Window,
PRECT  pRect,
BOOL  bErase 
)

Definition at line 1857 of file painting.c.

1858 {
1859  INT RegionType;
1860  BOOL Ret = TRUE;
1861 
1862  if (bErase)
1863  {
1865  UserRefObjectCo(Window, &Ref);
1868  }
1869 
1870  Window->state &= ~WNDS_UPDATEDIRTY;
1871 
1872  if (Window->hrgnUpdate == NULL)
1873  {
1874  pRect->left = pRect->top = pRect->right = pRect->bottom = 0;
1875  Ret = FALSE;
1876  }
1877  else
1878  {
1879  /* Get the update region bounding box. */
1880  if (Window->hrgnUpdate == HRGN_WINDOW)
1881  {
1882  *pRect = Window->rcClient;
1883  ERR("GURt: Caller is retrieving Window Region 1\n");
1884  }
1885  else
1886  {
1887  RegionType = IntGdiGetRgnBox(Window->hrgnUpdate, pRect);
1888 
1889  if (RegionType != ERROR && RegionType != NULLREGION)
1890  RECTL_bIntersectRect(pRect, pRect, &Window->rcClient);
1891  }
1892 
1893  if (IntIntersectWithParents(Window, pRect))
1894  {
1896  {
1897  RECTL_vOffsetRect(pRect,
1898  -Window->rcClient.left,
1899  -Window->rcClient.top);
1900  }
1901  if (Window->pcls->style & CS_OWNDC)
1902  {
1903  HDC hdc;
1904  //DWORD layout;
1906  //layout = NtGdiSetLayout(hdc, -1, 0);
1907  //IntMapWindowPoints( 0, Window, (LPPOINT)pRect, 2 );
1908  GreDPtoLP( hdc, (LPPOINT)pRect, 2 );
1909  //NtGdiSetLayout(hdc, -1, layout);
1911  }
1912  }
1913  else
1914  {
1915  pRect->left = pRect->top = pRect->right = pRect->bottom = 0;
1916  }
1917  }
1918  return Ret;
1919 }
#define RDW_NOCHILDREN
Definition: winuser.h:1212
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:194
#define TRUE
Definition: types.h:120
#define ERROR(name)
Definition: error_private.h:53
static HDC
Definition: imagelist.c:92
#define NULLREGION
Definition: wingdi.h:361
LONG top
Definition: windef.h:307
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:27
#define DCX_USESTYLE
Definition: GetDCEx.c:10
HDC FASTCALL UserGetDCEx(PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
LONG left
Definition: windef.h:306
#define CS_OWNDC
Definition: winuser.h:650
LONG right
Definition: windef.h:308
int32_t INT
Definition: typedefs.h:58
Definition: window.c:28
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:40
BOOL FASTCALL GreDPtoLP(HDC, LPPOINT, INT)
Definition: dcutil.c:7
Definition: object.h:3
#define HRGN_WINDOW
Definition: ntuser.h:344
BOOL FASTCALL IntIntersectWithParents(PWND Child, RECTL *WindowRect)
Definition: painting.c:35
VOID FASTCALL co_IntPaintWindows(PWND Wnd, ULONG Flags, BOOL Recurse)
Definition: painting.c:403
BOOL FASTCALL RECTL_bIntersectRect(_Out_ RECTL *prclDst, _In_ const RECTL *prcl1, _In_ const RECTL *prcl2)
Definition: rect.c:55
INT APIENTRY IntGdiGetRgnBox(HRGN hRgn, PRECTL pRect)
Definition: region.c:2580
HDC hdc
Definition: main.c:9
#define ERR(fmt,...)
Definition: debug.h:110
FORCEINLINE VOID RECTL_vOffsetRect(_Inout_ RECTL *prcl, _In_ INT cx, _In_ INT cy)
Definition: rect.h:31
#define NULL
Definition: types.h:112
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:918
#define WNDS_UPDATEDIRTY
Definition: ntuser.h:601
LONG bottom
Definition: windef.h:309
RegionType

Referenced by NtUserGetUpdateRect().

◆ co_UserGetUpdateRgn()

INT FASTCALL co_UserGetUpdateRgn ( PWND  Window,
HRGN  hRgn,
BOOL  bErase 
)

Definition at line 1785 of file painting.c.

1786 {
1787  int RegionType;
1788  BOOL Type;
1789  RECTL Rect;
1790 
1792 
1793  if (bErase)
1794  {
1796  UserRefObjectCo(Window, &Ref);
1799  }
1800 
1801  Window->state &= ~WNDS_UPDATEDIRTY;
1802 
1803  if (Window->hrgnUpdate == NULL)
1804  {
1805  NtGdiSetRectRgn(hRgn, 0, 0, 0, 0);
1806  return NULLREGION;
1807  }
1808 
1809  Rect = Window->rcClient;
1811 
1812  if (Window->hrgnUpdate == HRGN_WINDOW)
1813  {
1814  // Trap it out.
1815  ERR("GURn: Caller is passing Window Region 1\n");
1816  if (!Type)
1817  {
1818  NtGdiSetRectRgn(hRgn, 0, 0, 0, 0);
1819  return NULLREGION;
1820  }
1821 
1823 
1825  {
1827  -Window->rcClient.left,
1828  -Window->rcClient.top);
1829  }
1831  }
1832  else
1833  {
1834  HRGN hrgnTemp = GreCreateRectRgnIndirect(&Rect);
1835 
1836  RegionType = NtGdiCombineRgn(hRgn, hrgnTemp, Window->hrgnUpdate, RGN_AND);
1837 
1838  if (RegionType == ERROR || RegionType == NULLREGION)
1839  {
1840  if (hrgnTemp) GreDeleteObject(hrgnTemp);
1841  NtGdiSetRectRgn(hRgn, 0, 0, 0, 0);
1842  return RegionType;
1843  }
1844 
1846  {
1848  -Window->rcClient.left,
1849  -Window->rcClient.top);
1850  }
1851  if (hrgnTemp) GreDeleteObject(hrgnTemp);
1852  }
1853  return RegionType;
1854 }
#define RDW_NOCHILDREN
Definition: winuser.h:1212
BOOL NTAPI GreDeleteObject(HGDIOBJ hobj)
Definition: gdiobj.c:1158
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:194
#define ERROR(name)
Definition: error_private.h:53
#define ASSERT_REFS_CO(_obj_)
Definition: userfuncs.h:14
#define NULLREGION
Definition: wingdi.h:361
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:27
static HRGN hRgn
Definition: mapping.c:33
#define RGN_AND
Definition: wingdi.h:356
Definition: window.c:28
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:40
#define GreCreateRectRgnIndirect(prc)
Definition: region.h:96
Definition: object.h:3
#define HRGN_WINDOW
Definition: ntuser.h:344
__kernel_entry W32KAPI BOOL APIENTRY NtGdiSetRectRgn(_In_ HRGN hrgn, _In_ INT xLeft, _In_ INT yTop, _In_ INT xRight, _In_ INT yBottom)
Definition: region.c:4068
BOOL FASTCALL IntIntersectWithParents(PWND Child, RECTL *WindowRect)
Definition: painting.c:35
VOID FASTCALL co_IntPaintWindows(PWND Wnd, ULONG Flags, BOOL Recurse)
Definition: painting.c:403
Type
Definition: Type.h:6
#define GreSetRectRgnIndirect(hRgn, prc)
Definition: region.h:99
__kernel_entry W32KAPI INT APIENTRY NtGdiOffsetRgn(_In_ HRGN hrgn, _In_ INT cx, _In_ INT cy)
Definition: region.c:3981
__kernel_entry W32KAPI INT APIENTRY NtGdiCombineRgn(_In_ HRGN hrgnDst, _In_ HRGN hrgnSrc1, _In_opt_ HRGN hrgnSrc2, _In_ INT iMode)
#define SIMPLEREGION
Definition: wingdi.h:362
#define ERR(fmt,...)
Definition: debug.h:110
FORCEINLINE VOID RECTL_vOffsetRect(_Inout_ RECTL *prcl, _In_ INT cx, _In_ INT cy)
Definition: rect.h:31
#define NULL
Definition: types.h:112
#define WNDS_UPDATEDIRTY
Definition: ntuser.h:601
RegionType
struct Rect Rect

Referenced by IntDefWindowProc(), and NtUserGetUpdateRgn().

◆ co_UserRedrawWindow()

BOOL FASTCALL co_UserRedrawWindow ( PWND  Window,
const RECTL UpdateRect,
PREGION  UpdateRgn,
ULONG  Flags 
)

Definition at line 888 of file painting.c.

893 {
894  PREGION TmpRgn = NULL;
895  TRACE("co_UserRedrawWindow start Rgn %p\n",UpdateRgn);
896 
897  /*
898  * Step 1.
899  * Validation of passed parameters.
900  */
901 
903  {
904  return TRUE; // Just do nothing!!!
905  }
906 
907  if (Window == NULL)
908  {
910  }
911 
912  /*
913  * Step 2.
914  * Transform the parameters UpdateRgn and UpdateRect into
915  * a region hRgn specified in screen coordinates.
916  */
917 
918  if (Flags & (RDW_INVALIDATE | RDW_VALIDATE)) // Both are OKAY!
919  {
920  /* We can't hold lock on GDI objects while doing roundtrips to user mode,
921  * so use a copy instead */
922  if (UpdateRgn)
923  {
924  TmpRgn = IntSysCreateRectpRgn(0, 0, 0, 0);
925 
926  if (UpdateRgn > PRGN_WINDOW)
927  {
928  IntGdiCombineRgn(TmpRgn, UpdateRgn, NULL, RGN_COPY);
929  }
930 
931  if (Window != UserGetDesktopWindow())
932  {
933  REGION_bOffsetRgn(TmpRgn, Window->rcClient.left, Window->rcClient.top);
934  }
935  }
936  else
937  {
938  if (UpdateRect != NULL)
939  {
940  if (Window == UserGetDesktopWindow())
941  {
943  }
944  else
945  {
946  TmpRgn = IntSysCreateRectpRgn(Window->rcClient.left + UpdateRect->left,
947  Window->rcClient.top + UpdateRect->top,
948  Window->rcClient.left + UpdateRect->right,
949  Window->rcClient.top + UpdateRect->bottom);
950  }
951  }
952  else
953  {
956  {
957  if (!RECTL_bIsEmptyRect(&Window->rcWindow))
958  TmpRgn = IntSysCreateRectpRgnIndirect(&Window->rcWindow);
959  }
960  else
961  {
962  if (!RECTL_bIsEmptyRect(&Window->rcClient))
963  TmpRgn = IntSysCreateRectpRgnIndirect(&Window->rcClient);
964  }
965  }
966  }
967  }
968 
969  /* Fixes test RDW_INTERNALPAINT behavior */
970  if (TmpRgn == NULL)
971  {
972  TmpRgn = PRGN_WINDOW; // Need a region so the bits can be set!!!
973  }
974 
975  /*
976  * Step 3.
977  * Adjust the window update region depending on hRgn and flags.
978  */
979 
981  TmpRgn != NULL)
982  {
984  }
985 
986  /*
987  * Step 4.
988  * Repaint and erase windows if needed.
989  */
990 
991  if (Flags & RDW_UPDATENOW)
992  {
994  }
995  else if (Flags & RDW_ERASENOW)
996  {
997  if ((Flags & (RDW_NOCHILDREN|RDW_ALLCHILDREN)) == 0)
999 
1001  }
1002 
1003  /*
1004  * Step 5.
1005  * Cleanup ;-)
1006  */
1007 
1008  if (TmpRgn > PRGN_WINDOW)
1009  {
1010  REGION_Delete(TmpRgn);
1011  }
1012  TRACE("co_UserRedrawWindow exit\n");
1013 
1014  return TRUE;
1015 }
#define RDW_NOINTERNALPAINT
Definition: winuser.h:1207
#define RDW_NOCHILDREN
Definition: winuser.h:1212
VOID FASTCALL UserSyncAndPaintWindows(PWND pWnd, ULONG Flags)
Definition: painting.c:620
#define PRGN_WINDOW
Definition: painting.h:12
#define TRUE
Definition: types.h:120
BOOL FASTCALL REGION_bOffsetRgn(_Inout_ PREGION prgn, _In_ INT cx, _In_ INT cy)
Definition: region.c:2727
#define RDW_FRAME
Definition: winuser.h:1202
Definition: window.c:28
PREGION FASTCALL IntSysCreateRectpRgn(INT LeftRect, INT TopRect, INT RightRect, INT BottomRect)
Definition: region.c:2426
VOID FASTCALL UserUpdateWindows(PWND pWnd, ULONG Flags)
Definition: painting.c:598
BOOL FASTCALL IntIsWindowDrawable(PWND Wnd)
Definition: painting.c:861
Definition: region.h:7
INT FASTCALL IntGdiCombineRgn(PREGION prgnDest, PREGION prgnSrc1, PREGION prgnSrc2, INT iCombineMode)
Definition: region.c:2506
#define IntSysCreateRectpRgnIndirect(prc)
Definition: region.h:93
#define TRACE(s)
Definition: solgame.cpp:4
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
VOID FASTCALL IntInvalidateWindows(PWND Wnd, PREGION Rgn, ULONG Flags)
Definition: painting.c:642
PWND FASTCALL UserGetDesktopWindow(VOID)
Definition: desktop.c:1386
#define RDW_VALIDATE
Definition: winuser.h:1208
#define RDW_INTERNALPAINT
Definition: winuser.h:1203
#define RDW_NOFRAME
Definition: winuser.h:1206
#define RGN_COPY
Definition: wingdi.h:357
#define RDW_ALLCHILDREN
Definition: winuser.h:1211
#define NULL
Definition: types.h:112
#define RDW_UPDATENOW
Definition: winuser.h:1210
#define RDW_ERASENOW
Definition: winuser.h:1209
#define RDW_CLIPCHILDREN
Definition: painting.h:15
FORCEINLINE BOOL RECTL_bIsEmptyRect(_In_ const RECTL *prcl)
Definition: rect.h:44
static int UpdateRect(TreeListData *pData, unsigned uItem, unsigned uSub)
Definition: treelist.c:1529
VOID FASTCALL REGION_Delete(PREGION pRgn)
Definition: region.c:2468
#define RDW_INVALIDATE
Definition: winuser.h:1204

Referenced by co_IntSetScrollInfo(), co_IntShowDesktop(), co_UserFreeWindow(), co_VIS_WindowLayoutChanged(), co_WinPosMinMaximize(), co_WinPosSetWindowPos(), DefWndDoSizeMove(), DesktopWindowProc(), IntDefWindowProc(), IntScrollWindowEx(), IntSetLayeredWindowAttributes(), NtGdiUpdateColors(), NtUserCallHwndParamLock(), and NtUserRedrawWindow().

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( UserPainting  )

◆ IntBeginPaint()

HDC FASTCALL IntBeginPaint ( PWND  Window,
PPAINTSTRUCT  Ps 
)

Definition at line 1435 of file painting.c.

1436 {
1437  RECT Rect;
1438  INT type;
1439  BOOL Erase = FALSE;
1440 
1442 
1443  Window->state2 |= WNDS2_STARTPAINT;
1444  Window->state &= ~WNDS_PAINTNOTPROCESSED;
1445 
1446  if (Window->state & WNDS_SENDNCPAINT)
1447  {
1448  HRGN hRgn;
1449  // Application can keep update dirty.
1450  do
1451  {
1452  Window->state &= ~WNDS_UPDATEDIRTY;
1456  {
1457  /* NOTE: The region can already be deleted! */
1459  }
1460  }
1461  while(Window->state & WNDS_UPDATEDIRTY);
1462  }
1463  else
1464  {
1465  Window->state &= ~WNDS_UPDATEDIRTY;
1466  }
1467 
1468  RtlZeroMemory(Ps, sizeof(PAINTSTRUCT));
1469 
1470  if (Window->state2 & WNDS2_ENDPAINTINVALIDATE)
1471  {
1472  ERR("BP: Another thread invalidated this window\n");
1473  }
1474 
1475  Ps->hdc = UserGetDCEx( Window,
1476  Window->hrgnUpdate,
1478  if (!Ps->hdc)
1479  {
1480  return NULL;
1481  }
1482 
1483  // If set, always clear flags out due to the conditions later on for sending the message.
1484  if (Window->state & WNDS_SENDERASEBACKGROUND)
1485  {
1487  Erase = TRUE;
1488  }
1489 
1490  if (Window->hrgnUpdate != NULL)
1491  {
1492  MsqDecPaintCountQueue(Window->head.pti);
1494  /* The region is part of the dc now and belongs to the process! */
1495  Window->hrgnUpdate = NULL;
1496  }
1497  else
1498  {
1499  if (Window->state & WNDS_INTERNALPAINT)
1500  MsqDecPaintCountQueue(Window->head.pti);
1501  }
1502 
1503  type = GdiGetClipBox(Ps->hdc, &Ps->rcPaint);
1504 
1506 
1507  Window->state &= ~WNDS_INTERNALPAINT;
1508 
1509  if ( Erase && // Set to erase,
1510  type != NULLREGION && // don't erase if the clip box is empty,
1511  (!(Window->pcls->style & CS_PARENTDC) || // not parent dc or
1512  RECTL_bIntersectRect( &Rect, &Rect, &Ps->rcPaint) ) ) // intersecting.
1513  {
1515  if ( Ps->fErase )
1516  {
1518  }
1519  }
1520  else
1521  {
1522  Ps->fErase = FALSE;
1523  }
1524 
1526 
1527  return Ps->hdc;
1528 }
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 WNDS_SENDNCPAINT
Definition: ntuser.h:599
VOID FASTCALL IntSendNCPaint(PWND pWnd, HRGN hRgn)
Definition: painting.c:348
#define NULLREGION
Definition: wingdi.h:361
static HRGN hRgn
Definition: mapping.c:33
#define DCX_USESTYLE
Definition: GetDCEx.c:10
HDC FASTCALL UserGetDCEx(PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
UINT_PTR WPARAM
Definition: windef.h:207
VOID FASTCALL IntGetClientRect(PWND WindowObject, RECTL *Rect)
Definition: winpos.c:91
#define WNDS2_STARTPAINT
Definition: ntuser.h:626
int32_t INT
Definition: typedefs.h:58
#define DCX_INTERSECTRGN
Definition: winuser.h:2112
#define WNDS_PAINTNOTPROCESSED
Definition: ntuser.h:610
Definition: window.c:28
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
HRGN FASTCALL IntGetNCUpdateRgn(PWND Window, BOOL Validate)
Definition: painting.c:260
#define HRGN_WINDOW
Definition: ntuser.h:344
#define UserHMGetHandle(obj)
Definition: ntuser.h:222
void Erase(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, LONG radius)
Definition: drawing.cpp:117
BOOL FASTCALL IntGdiSetRegionOwner(HRGN hRgn, DWORD OwnerMask)
Definition: region.c:2478
#define WNDS2_ENDPAINTINVALIDATE
Definition: ntuser.h:625
BOOL FASTCALL RECTL_bIntersectRect(_Out_ RECTL *prclDst, _In_ const RECTL *prcl1, _In_ const RECTL *prcl2)
Definition: rect.c:55
VOID FASTCALL MsqDecPaintCountQueue(PTHREADINFO pti)
Definition: msgqueue.c:508
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1446
#define GDI_OBJ_HMGR_POWNED
Definition: ntgdihdl.h:117
VOID FASTCALL IntSendChildNCPaint(PWND pWnd)
Definition: painting.c:370
#define ERR(fmt,...)
Definition: debug.h:110
#define NULL
Definition: types.h:112
#define WNDS_INTERNALPAINT
Definition: ntuser.h:600
#define WNDS_SENDERASEBACKGROUND
Definition: ntuser.h:597
#define WNDS_UPDATEDIRTY
Definition: ntuser.h:601
#define WNDS_ERASEBACKGROUND
Definition: ntuser.h:598
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
BOOL FASTCALL co_UserHideCaret(PWND Window OPTIONAL)
Definition: caret.c:237
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define WM_ERASEBKGND
Definition: winuser.h:1615
#define CS_PARENTDC
Definition: winuser.h:651
struct Rect Rect

Referenced by DesktopWindowProc(), IntDefWindowProc(), NtUserBeginPaint(), and PopupMenuWndProc().

◆ IntCalcWindowRgn()

HRGN FASTCALL IntCalcWindowRgn ( PWND  Wnd,
BOOL  Client 
)

Definition at line 209 of file painting.c.

210 {
211  HRGN hRgnWindow;
212 
213  if (Client)
214  {
215  hRgnWindow = NtGdiCreateRectRgn(
216  Wnd->rcClient.left,
217  Wnd->rcClient.top,
218  Wnd->rcClient.right,
219  Wnd->rcClient.bottom);
220  }
221  else
222  {
223  hRgnWindow = NtGdiCreateRectRgn(
224  Wnd->rcWindow.left,
225  Wnd->rcWindow.top,
226  Wnd->rcWindow.right,
227  Wnd->rcWindow.bottom);
228  }
229 
230  if (Wnd->hrgnClip != NULL && !(Wnd->style & WS_MINIMIZE))
231  {
232  NtGdiOffsetRgn(hRgnWindow,
233  -Wnd->rcWindow.left,
234  -Wnd->rcWindow.top);
235  NtGdiCombineRgn(hRgnWindow, hRgnWindow, Wnd->hrgnClip, RGN_AND);
236  NtGdiOffsetRgn(hRgnWindow,
237  Wnd->rcWindow.left,
238  Wnd->rcWindow.top);
239  }
240 
241  return hRgnWindow;
242 }
__kernel_entry W32KAPI HRGN APIENTRY NtGdiCreateRectRgn(_In_ INT xLeft, _In_ INT yTop, _In_ INT xRight, _In_ INT yBottom)
Definition: client.c:28
LONG top
Definition: windef.h:307
RECT rcClient
Definition: ntuser.h:696
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
#define RGN_AND
Definition: wingdi.h:356
#define WS_MINIMIZE
Definition: pedump.c:622
HRGN hrgnClip
Definition: ntuser.h:712
__kernel_entry W32KAPI INT APIENTRY NtGdiOffsetRgn(_In_ HRGN hrgn, _In_ INT cx, _In_ INT cy)
Definition: region.c:3981
RECT rcWindow
Definition: ntuser.h:695
__kernel_entry W32KAPI INT APIENTRY NtGdiCombineRgn(_In_ HRGN hrgnDst, _In_ HRGN hrgnSrc1, _In_opt_ HRGN hrgnSrc2, _In_ INT iMode)
#define NULL
Definition: types.h:112
LONG bottom
Definition: windef.h:309
DWORD style
Definition: ntuser.h:685

Referenced by IntGetNCUpdateRgn().

◆ IntEndPaint()

BOOL FASTCALL IntEndPaint ( PWND  Wnd,
PPAINTSTRUCT  Ps 
)

Definition at line 1532 of file painting.c.

1533 {
1534  HDC hdc = NULL;
1535 
1536  hdc = Ps->hdc;
1537 
1538  UserReleaseDC(Wnd, hdc, TRUE);
1539 
1540  if (Wnd->state2 & WNDS2_ENDPAINTINVALIDATE)
1541  {
1542  ERR("EP: Another thread invalidated this window\n");
1544  }
1545 
1547 
1548  co_UserShowCaret(Wnd);
1549 
1550  return TRUE;
1551 }
#define TRUE
Definition: types.h:120
static HDC
Definition: imagelist.c:92
#define WNDS2_STARTPAINT
Definition: ntuser.h:626
#define WNDS2_ENDPAINTINVALIDATE
Definition: ntuser.h:625
#define WNDS2_WMPAINTSENT
Definition: ntuser.h:624
HDC hdc
Definition: main.c:9
BOOL FASTCALL co_UserShowCaret(PWND Window OPTIONAL)
Definition: caret.c:272
#define ERR(fmt,...)
Definition: debug.h:110
#define NULL
Definition: types.h:112
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:918
DWORD state2
Definition: ntuser.h:681

Referenced by DesktopWindowProc(), IntDefWindowProc(), NtUserEndPaint(), and PopupMenuWndProc().

◆ IntFillWindow()

BOOL FASTCALL IntFillWindow ( PWND  pWndParent,
PWND  pWnd,
HDC  hDC,
HBRUSH  hBrush 
)

Definition at line 1555 of file painting.c.

1559 {
1560  RECT Rect, Rect1;
1561  INT type;
1562 
1563  if (!pWndParent)
1564  pWndParent = pWnd;
1565 
1566  type = GdiGetClipBox(hDC, &Rect);
1567 
1568  IntGetClientRect(pWnd, &Rect1);
1569 
1570  if ( type != NULLREGION && // Clip box is not empty,
1571  (!(pWnd->pcls->style & CS_PARENTDC) || // not parent dc or
1572  RECTL_bIntersectRect( &Rect, &Rect, &Rect1) ) ) // intersecting.
1573  {
1574  POINT ppt;
1575  INT x = 0, y = 0;
1576 
1577  if (!UserIsDesktopWindow(pWndParent))
1578  {
1579  x = pWndParent->rcClient.left - pWnd->rcClient.left;
1580  y = pWndParent->rcClient.top - pWnd->rcClient.top;
1581  }
1582 
1583  GreSetBrushOrg(hDC, x, y, &ppt);
1584 
1585  if ( hBrush < (HBRUSH)CTLCOLOR_MAX )
1586  hBrush = GetControlColor( pWndParent, pWnd, hDC, HandleToUlong(hBrush) + WM_CTLCOLORMSGBOX);
1587 
1588  FillRect(hDC, &Rect, hBrush);
1589 
1590  GreSetBrushOrg(hDC, ppt.x, ppt.y, NULL);
1591 
1592  return TRUE;
1593  }
1594  else
1595  return FALSE;
1596 }
long y
Definition: polytest.cpp:48
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:194
long x
Definition: polytest.cpp:48
#define TRUE
Definition: types.h:120
#define HandleToUlong(h)
Definition: basetsd.h:79
#define NULLREGION
Definition: wingdi.h:361
LONG top
Definition: windef.h:307
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
RECT rcClient
Definition: ntuser.h:696
LONG left
Definition: windef.h:306
VOID FASTCALL IntGetClientRect(PWND WindowObject, RECTL *Rect)
Definition: winpos.c:91
int32_t INT
Definition: typedefs.h:58
HBRUSH FASTCALL GetControlColor(PWND pwndParent, PWND pwnd, HDC hdc, UINT CtlMsg)
Definition: misc.c:146
UINT style
Definition: ntuser.h:563
#define FALSE
Definition: types.h:117
#define WM_CTLCOLORMSGBOX
Definition: winuser.h:1756
BOOL FASTCALL RECTL_bIntersectRect(_Out_ RECTL *prclDst, _In_ const RECTL *prcl1, _In_ const RECTL *prcl2)
Definition: rect.c:55
BOOL FASTCALL GreSetBrushOrg(HDC, INT, INT, LPPOINT)
Definition: dcutil.c:231
#define CTLCOLOR_MAX
Definition: winuser.h:952
static HDC hDC
Definition: 3dtext.c:33
#define NULL
Definition: types.h:112
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
#define CS_PARENTDC
Definition: winuser.h:651
struct Rect Rect
PCLS pcls
Definition: ntuser.h:699

Referenced by NtUserFillWindow().

◆ IntFindWindowToRepaint()

PWND FASTCALL IntFindWindowToRepaint ( PWND  Window,
PTHREADINFO  Thread 
)

Definition at line 1134 of file painting.c.

1135 {
1136  PWND hChild;
1137  PWND TempWindow;
1138 
1139  for (; Window != NULL; Window = Window->spwndNext)
1140  {
1142  {
1143  if (IntIsWindowDirty(Window))
1144  {
1145  /* Make sure all non-transparent siblings are already drawn. */
1146  if (Window->ExStyle & WS_EX_TRANSPARENT)
1147  {
1148  for (TempWindow = Window->spwndNext; TempWindow != NULL;
1149  TempWindow = TempWindow->spwndNext)
1150  {
1151  if (!(TempWindow->ExStyle & WS_EX_TRANSPARENT) &&
1152  IntWndBelongsToThread(TempWindow, Thread) &&
1153  IntIsWindowDirty(TempWindow))
1154  {
1155  return TempWindow;
1156  }
1157  }
1158  }
1159  return Window;
1160  }
1161  }
1162  /* find a child of the specified window that needs repainting */
1163  if (Window->spwndChild)
1164  {
1165  hChild = IntFindWindowToRepaint(Window->spwndChild, Thread);
1166  if (hChild != NULL)
1167  return hChild;
1168  }
1169  }
1170  return Window;
1171 }
DWORD ExStyle
Definition: ntuser.h:683
PWND FASTCALL IntFindWindowToRepaint(PWND Window, PTHREADINFO Thread)
Definition: painting.c:1134
#define IntWndBelongsToThread(WndObj, W32Thread)
Definition: window.h:31
static HTREEITEM hChild
Definition: treeview.c:381
#define WS_EX_TRANSPARENT
Definition: pedump.c:649
Definition: window.c:28
struct _WND * spwndNext
Definition: ntuser.h:690
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2652
int Window
Definition: x11stubs.h:26
Definition: ntuser.h:672
BOOL FASTCALL IntIsWindowDirty(PWND Wnd)
Definition: painting.c:1118
#define NULL
Definition: types.h:112

Referenced by IntGetPaintMessage().

◆ IntFlashWindowEx()

BOOL FASTCALL IntFlashWindowEx ( PWND  pWnd,
PFLASHWINFO  pfwi 
)

Definition at line 1304 of file painting.c.

1305 {
1306  DWORD_PTR FlashState;
1307  UINT uCount = pfwi->uCount;
1308  BOOL Activate = FALSE, Ret = FALSE;
1309 
1310  ASSERT(pfwi);
1311 
1312  FlashState = (DWORD_PTR)UserGetProp(pWnd, AtomFlashWndState, TRUE);
1313 
1314  if (FlashState == FLASHW_FINISHED)
1315  {
1316  // Cycle has finished, kill timer and set this to Stop.
1317  FlashState |= FLASHW_KILLSYSTIMER;
1318  pfwi->dwFlags = FLASHW_STOP;
1319  }
1320  else
1321  {
1322  if (FlashState)
1323  {
1324  if (pfwi->dwFlags == FLASHW_SYSTIMER)
1325  {
1326  // Called from system timer, restore flags, counts and state.
1327  pfwi->dwFlags = LOWORD(FlashState);
1328  uCount = HIWORD(FlashState);
1329  FlashState = MAKELONG(LOWORD(FlashState),0);
1330  }
1331  else
1332  {
1333  // Clean out the trash! Fix SeaMonkey crash after restart.
1334  FlashState = 0;
1335  }
1336  }
1337 
1338  if (FlashState == 0)
1339  { // First time in cycle, setup flash state.
1340  if ( pWnd->state & WNDS_ACTIVEFRAME ||
1341  (pfwi->dwFlags & FLASHW_CAPTION && pWnd->style & (WS_BORDER|WS_DLGFRAME)))
1342  {
1343  FlashState = FLASHW_STARTED|FLASHW_ACTIVE;
1344  }
1345  }
1346 
1347  // Set previous window state.
1348  Ret = !!(FlashState & FLASHW_ACTIVE);
1349 
1350  if ( (pfwi->dwFlags & FLASHW_TIMERNOFG) == FLASHW_TIMERNOFG &&
1351  gpqForeground == pWnd->head.pti->MessageQueue )
1352  {
1353  // Flashing until foreground, set this to Stop.
1354  pfwi->dwFlags = FLASHW_STOP;
1355  }
1356  }
1357 
1358  // Toggle activate flag.
1359  if ( pfwi->dwFlags == FLASHW_STOP )
1360  {
1361  if (gpqForeground && gpqForeground->spwndActive == pWnd)
1362  Activate = TRUE;
1363  else
1364  Activate = FALSE;
1365  }
1366  else
1367  {
1368  Activate = (FlashState & FLASHW_ACTIVE) == 0;
1369  }
1370 
1371  if ( pfwi->dwFlags == FLASHW_STOP || pfwi->dwFlags & FLASHW_CAPTION )
1372  {
1373  co_IntSendMessage(UserHMGetHandle(pWnd), WM_NCACTIVATE, Activate, 0);
1374  }
1375 
1376  // FIXME: Check for a Stop Sign here.
1377  if ( pfwi->dwFlags & FLASHW_TRAY )
1378  {
1379  // Need some shell work here too.
1380  TRACE("FIXME: Flash window no Tray support!\n");
1381  }
1382 
1383  if ( pfwi->dwFlags == FLASHW_STOP )
1384  {
1385  if (FlashState & FLASHW_KILLSYSTIMER)
1386  {
1388  }
1389 
1391  }
1392  else
1393  { // Have a count and started, set timer.
1394  if ( uCount )
1395  {
1396  FlashState |= FLASHW_COUNT;
1397 
1398  if (!(Activate ^ !!(FlashState & FLASHW_STARTED)))
1399  uCount--;
1400 
1401  if (!(FlashState & FLASHW_KILLSYSTIMER))
1402  pfwi->dwFlags |= FLASHW_TIMER;
1403  }
1404 
1405  if (pfwi->dwFlags & FLASHW_TIMER)
1406  {
1407  FlashState |= FLASHW_KILLSYSTIMER;
1408 
1409  IntSetTimer( pWnd,
1411  pfwi->dwTimeout ? pfwi->dwTimeout : gpsi->dtCaretBlink,
1413  TMRF_SYSTEM );
1414  }
1415 
1416  if (FlashState & FLASHW_COUNT && uCount == 0)
1417  {
1418  // Keep spinning? Nothing else to do.
1419  FlashState = FLASHW_FINISHED;
1420  }
1421  else
1422  {
1423  // Save state and flags so this can be restored next time through.
1424  FlashState ^= (FlashState ^ -!!(Activate)) & FLASHW_ACTIVE;
1425  FlashState ^= (FlashState ^ pfwi->dwFlags) & (FLASHW_MASK & ~FLASHW_TIMER);
1426  }
1427  FlashState = MAKELONG(LOWORD(FlashState),uCount);
1428  UserSetProp(pWnd, AtomFlashWndState, (HANDLE)FlashState, TRUE);
1429  }
1430  return Ret;
1431 }
PUSER_MESSAGE_QUEUE gpqForeground
Definition: focus.c:13
UINT_PTR FASTCALL IntSetTimer(PWND Window, UINT_PTR IDEvent, UINT Elapse, TIMERPROC TimerFunc, INT Type)
Definition: timer.c:177
#define DWORD_PTR
Definition: treelist.c:76
#define TRUE
Definition: types.h:120
BOOL FASTCALL IntKillTimer(PWND Window, UINT_PTR IDEvent, BOOL SystemTimer)
Definition: timer.c:573
PSERVERINFO gpsi
Definition: imm.c:17
#define FLASHW_SYSTIMER
Definition: painting.h:4
#define WS_DLGFRAME
Definition: pedump.c:626
#define FLASHW_KILLSYSTIMER
Definition: painting.h:8
#define FALSE
Definition: types.h:117
#define WM_NCACTIVATE
Definition: winuser.h:1678
unsigned int BOOL
Definition: ntddk_ex.h:94
THRDESKHEAD head
Definition: ntuser.h:674
#define MAKELONG(a, b)
Definition: typedefs.h:249
VOID CALLBACK SystemTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
Definition: timer.c:280
#define UserHMGetHandle(obj)
Definition: ntuser.h:222
#define FLASHW_FINISHED
Definition: painting.h:5
#define TRACE(s)
Definition: solgame.cpp:4
#define ASSERT(a)
Definition: mode.c:44
#define TMRF_SYSTEM
Definition: timer.h:20
HANDLE FASTCALL UserGetProp(_In_ PWND Window, _In_ ATOM Atom, _In_ BOOLEAN SystemProp)
Definition: prop.c:46
#define ID_EVENT_SYSTIMER_FLASHWIN
Definition: timer.h:28
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1446
#define FLASHW_ACTIVE
Definition: painting.h:9
#define WNDS_ACTIVEFRAME
Definition: ntuser.h:594
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define WS_BORDER
Definition: pedump.c:625
DWORD state
Definition: ntuser.h:680
unsigned int UINT
Definition: ndis.h:50
#define FLASHW_STARTED
Definition: painting.h:6
#define HIWORD(l)
Definition: typedefs.h:247
#define FLASHW_MASK
Definition: painting.h:3
#define FLASHW_COUNT
Definition: painting.h:7
HANDLE FASTCALL UserRemoveProp(_In_ PWND Window, _In_ ATOM Atom, _In_ BOOLEAN SystemProp)
ATOM AtomFlashWndState
Definition: ntuser.c:22
#define LOWORD(l)
Definition: pedump.c:82
DWORD style
Definition: ntuser.h:685

Referenced by DefWndHandleSetCursor(), NtUserFlashWindowEx(), and SystemTimerProc().

◆ IntGetNCUpdateRgn()

HRGN FASTCALL IntGetNCUpdateRgn ( PWND  Window,
BOOL  Validate 
)

Definition at line 260 of file painting.c.

261 {
262  HRGN hRgnNonClient;
263  HRGN hRgnWindow;
264  UINT RgnType, NcType;
265  RECT update;
266 
267  if (Window->hrgnUpdate != NULL &&
268  Window->hrgnUpdate != HRGN_WINDOW)
269  {
270  hRgnNonClient = IntCalcWindowRgn(Window, FALSE);
271 
272  /*
273  * If region creation fails it's safe to fallback to whole
274  * window region.
275  */
276  if (hRgnNonClient == NULL)
277  {
278  return HRGN_WINDOW;
279  }
280 
281  hRgnWindow = IntCalcWindowRgn(Window, TRUE);
282  if (hRgnWindow == NULL)
283  {
284  GreDeleteObject(hRgnNonClient);
285  return HRGN_WINDOW;
286  }
287 
288  NcType = IntGdiGetRgnBox(hRgnNonClient, &update);
289 
290  RgnType = NtGdiCombineRgn(hRgnNonClient, hRgnNonClient, hRgnWindow, RGN_DIFF);
291 
292  if (RgnType == ERROR)
293  {
294  GreDeleteObject(hRgnWindow);
295  GreDeleteObject(hRgnNonClient);
296  return HRGN_WINDOW;
297  }
298  else if (RgnType == NULLREGION)
299  {
300  GreDeleteObject(hRgnWindow);
301  GreDeleteObject(hRgnNonClient);
302  Window->state &= ~WNDS_UPDATEDIRTY;
303  return NULL;
304  }
305 
306  /*
307  * Remove the nonclient region from the standard update region if
308  * we were asked for it.
309  */
310 
311  if (Validate)
312  {
313  if (NtGdiCombineRgn(Window->hrgnUpdate, Window->hrgnUpdate, hRgnWindow, RGN_AND) == NULLREGION)
314  {
316  GreDeleteObject(Window->hrgnUpdate);
317  Window->state &= ~WNDS_UPDATEDIRTY;
318  Window->hrgnUpdate = NULL;
319  if (!(Window->state & WNDS_INTERNALPAINT))
320  MsqDecPaintCountQueue(Window->head.pti);
321  }
322  }
323 
324  /* check if update rgn contains complete nonclient area */
325  if (NcType == SIMPLEREGION)
326  {
327  RECT window;
329 
330  if (IntEqualRect( &window, &update ))
331  {
332  GreDeleteObject(hRgnNonClient);
333  hRgnNonClient = HRGN_WINDOW;
334  }
335  }
336 
337  GreDeleteObject(hRgnWindow);
338 
339  return hRgnNonClient;
340  }
341  else
342  {
343  return Window->hrgnUpdate;
344  }
345 }
BOOL NTAPI GreDeleteObject(HGDIOBJ hobj)
Definition: gdiobj.c:1158
#define TRUE
Definition: types.h:120
#define ERROR(name)
Definition: error_private.h:53
#define NULLREGION
Definition: wingdi.h:361
#define RGN_AND
Definition: wingdi.h:356
Definition: window.c:28
#define FALSE
Definition: types.h:117
#define HRGN_WINDOW
Definition: ntuser.h:344
BOOL FASTCALL IntGdiSetRegionOwner(HRGN hRgn, DWORD OwnerMask)
Definition: region.c:2478
INT APIENTRY IntGdiGetRgnBox(HRGN hRgn, PRECTL pRect)
Definition: region.c:2580
VOID FASTCALL MsqDecPaintCountQueue(PTHREADINFO pti)
Definition: msgqueue.c:508
#define GDI_OBJ_HMGR_POWNED
Definition: ntgdihdl.h:117
static IHTMLWindow2 * window
Definition: events.c:77
__kernel_entry W32KAPI INT APIENTRY NtGdiCombineRgn(_In_ HRGN hrgnDst, _In_ HRGN hrgnSrc1, _In_opt_ HRGN hrgnSrc2, _In_ INT iMode)
#define SIMPLEREGION
Definition: wingdi.h:362
#define RGN_DIFF
Definition: wingdi.h:358
FORCEINLINE BOOL IntEqualRect(RECTL *lprc1, RECTL *lprc2)
Definition: winpos.h:48
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define WNDS_INTERNALPAINT
Definition: ntuser.h:600
#define WNDS_UPDATEDIRTY
Definition: ntuser.h:601
HRGN FASTCALL IntCalcWindowRgn(PWND Wnd, BOOL Client)
Definition: painting.c:209
BOOL FASTCALL IntGetWindowRect(PWND Wnd, RECTL *Rect)
Definition: winpos.c:120

Referenced by co_IntPaintWindows(), and IntBeginPaint().

◆ IntGetPaintMessage()

BOOL FASTCALL IntGetPaintMessage ( PWND  Window,
UINT  MsgFilterMin,
UINT  MsgFilterMax,
PTHREADINFO  Thread,
MSG Message,
BOOL  Remove 
)

Definition at line 1184 of file painting.c.

1191 {
1192  PWND PaintWnd, StartWnd;
1193 
1194  if ((MsgFilterMin != 0 || MsgFilterMax != 0) &&
1195  (MsgFilterMin > WM_PAINT || MsgFilterMax < WM_PAINT))
1196  return FALSE;
1197 
1198  if (Thread->TIF_flags & TIF_SYSTEMTHREAD )
1199  {
1200  ERR("WM_PAINT is in a System Thread!\n");
1201  }
1202 
1203  StartWnd = UserGetDesktopWindow();
1204  PaintWnd = IntFindWindowToRepaint(StartWnd, Thread);
1205 
1206  Message->hwnd = PaintWnd ? UserHMGetHandle(PaintWnd) : NULL;
1207 
1208  if (Message->hwnd == NULL && Thread->cPaintsReady)
1209  {
1210  // Find note in window.c:"PAINTING BUG".
1211  ERR("WARNING SOMETHING HAS GONE WRONG: Thread marked as containing dirty windows, but no dirty windows found! Counts %u\n",Thread->cPaintsReady);
1212  /* Hack to stop spamming the debug log ! */
1213  Thread->cPaintsReady = 0;
1214  return FALSE;
1215  }
1216 
1217  if (Message->hwnd == NULL)
1218  return FALSE;
1219 
1220  if (!(Window == NULL ||
1221  PaintWnd == Window ||
1222  IntIsChildWindow(Window, PaintWnd))) /* check that it is a child of the specified parent */
1223  return FALSE;
1224 
1225  if (PaintWnd->state & WNDS_INTERNALPAINT)
1226  {
1227  PaintWnd->state &= ~WNDS_INTERNALPAINT;
1228  if (!PaintWnd->hrgnUpdate)
1230  }
1231  PaintWnd->state2 &= ~WNDS2_STARTPAINT;
1232  PaintWnd->state &= ~WNDS_UPDATEDIRTY;
1233 
1234  Window = PaintWnd;
1235  while (Window && !UserIsDesktopWindow(Window))
1236  {
1237  // Role back and check for clip children, do not set if any.
1238  if (Window->spwndParent && !(Window->spwndParent->style & WS_CLIPCHILDREN))
1239  {
1240  PaintWnd->state2 |= WNDS2_WMPAINTSENT;
1241  }
1242  Window = Window->spwndParent;
1243  }
1244 
1245  Message->wParam = Message->lParam = 0;
1246  Message->message = WM_PAINT;
1247  return TRUE;
1248 }
PWND FASTCALL IntFindWindowToRepaint(PWND Window, PTHREADINFO Thread)
Definition: painting.c:1134
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:194
#define TRUE
Definition: types.h:120
#define WNDS2_STARTPAINT
Definition: ntuser.h:626
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define TIF_SYSTEMTHREAD
Definition: ntuser.h:256
Definition: window.c:28
#define FALSE
Definition: types.h:117
#define UserHMGetHandle(obj)
Definition: ntuser.h:222
HRGN hrgnUpdate
Definition: ntuser.h:700
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2652
#define WM_PAINT
Definition: winuser.h:1610
VOID FASTCALL MsqDecPaintCountQueue(PTHREADINFO pti)
Definition: msgqueue.c:508
CHAR Message[80]
Definition: alive.c:5
PWND FASTCALL UserGetDesktopWindow(VOID)
Definition: desktop.c:1386
#define WNDS2_WMPAINTSENT
Definition: ntuser.h:624
#define ERR(fmt,...)
Definition: debug.h:110
Definition: ntuser.h:672
DWORD state
Definition: ntuser.h:680
#define NULL
Definition: types.h:112
#define WNDS_INTERNALPAINT
Definition: ntuser.h:600
#define WNDS_UPDATEDIRTY
Definition: ntuser.h:601
DWORD state2
Definition: ntuser.h:681
BOOL FASTCALL IntIsChildWindow(PWND Parent, PWND BaseWindow)
Definition: window.c:916

Referenced by co_IntPeekMessage().

◆ IntIntersectWithParents()

BOOL FASTCALL IntIntersectWithParents ( PWND  Child,
RECTL WindowRect 
)

Definition at line 35 of file painting.c.

36 {
37  PWND ParentWnd;
38 
39  if (Child->ExStyle & WS_EX_REDIRECTED)
40  return TRUE;
41 
42  ParentWnd = Child->spwndParent;
43  while (ParentWnd != NULL)
44  {
45  if (!(ParentWnd->style & WS_VISIBLE) ||
46  (ParentWnd->style & WS_MINIMIZE) ||
47  !RECTL_bIntersectRect(WindowRect, WindowRect, &ParentWnd->rcClient) )
48  {
49  return FALSE;
50  }
51 
52  if (ParentWnd->ExStyle & WS_EX_REDIRECTED)
53  return TRUE;
54 
55  ParentWnd = ParentWnd->spwndParent;
56  }
57 
58  return TRUE;
59 }
DWORD ExStyle
Definition: ntuser.h:683
#define TRUE
Definition: types.h:120
RECT rcClient
Definition: ntuser.h:696
#define FALSE
Definition: types.h:117
#define WS_MINIMIZE
Definition: pedump.c:622
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFDEVICE Child
Definition: wdffdo.h:533
#define WS_EX_REDIRECTED
Definition: undocuser.h:25
BOOL FASTCALL RECTL_bIntersectRect(_Out_ RECTL *prclDst, _In_ const RECTL *prcl1, _In_ const RECTL *prcl2)
Definition: rect.c:55
Definition: ntuser.h:672
#define NULL
Definition: types.h:112
struct _WND * spwndParent
Definition: ntuser.h:692
#define WS_VISIBLE
Definition: pedump.c:620
DWORD style
Definition: ntuser.h:685

Referenced by co_IntGetUpdateRgn(), co_UserGetUpdateRect(), co_UserGetUpdateRgn(), and IntValidateParents().

◆ IntInvalidateWindows()

VOID FASTCALL IntInvalidateWindows ( PWND  Wnd,
PREGION  Rgn,
ULONG  Flags 
)

Definition at line 642 of file painting.c.

643 {
644  INT RgnType = NULLREGION;
645  BOOL HadPaintMessage;
646 
647  TRACE("IntInvalidateWindows start Rgn %p\n",Rgn);
648 
649  if ( Rgn > PRGN_WINDOW )
650  {
651  /*
652  * If the nonclient is not to be redrawn, clip the region to the client
653  * rect
654  */
655  if ((Flags & RDW_INVALIDATE) != 0 && (Flags & RDW_FRAME) == 0)
656  {
657  PREGION RgnClient;
658 
659  RgnClient = IntSysCreateRectpRgnIndirect(&Wnd->rcClient);
660  if (RgnClient)
661  {
662  RgnType = IntGdiCombineRgn(Rgn, Rgn, RgnClient, RGN_AND);
663  REGION_Delete(RgnClient);
664  }
665  }
666 
667  /*
668  * Clip the given region with window rectangle (or region)
669  */
670 
671  if (!Wnd->hrgnClip || (Wnd->style & WS_MINIMIZE))
672  {
673  PREGION RgnWindow = IntSysCreateRectpRgnIndirect(&Wnd->rcWindow);
674  if (RgnWindow)
675  {
676  RgnType = IntGdiCombineRgn(Rgn, Rgn, RgnWindow, RGN_AND);
677  REGION_Delete(RgnWindow);
678  }
679  }
680  else
681  {
682  PREGION RgnClip = REGION_LockRgn(Wnd->hrgnClip);
683  if (RgnClip)
684  {
685  REGION_bOffsetRgn(Rgn,
686  -Wnd->rcWindow.left,
687  -Wnd->rcWindow.top);
688  RgnType = IntGdiCombineRgn(Rgn, Rgn, RgnClip, RGN_AND);
689  REGION_bOffsetRgn(Rgn,
690  Wnd->rcWindow.left,
691  Wnd->rcWindow.top);
692  REGION_UnlockRgn(RgnClip);
693  }
694  }
695  }
696  else
697  {
698  RgnType = NULLREGION;
699  }
700 
701  /*
702  * Save current state of pending updates
703  */
704 
705  HadPaintMessage = IntIsWindowDirty(Wnd);
706 
707  /*
708  * Update the region and flags
709  */
710 
711  // The following flags are used to invalidate the window.
713  {
714  if (Flags & RDW_INTERNALPAINT)
715  {
716  Wnd->state |= WNDS_INTERNALPAINT;
717  }
718 
719  if (Flags & RDW_INVALIDATE )
720  {
721  PREGION RgnUpdate;
722 
723  Wnd->state &= ~WNDS_NONCPAINT;
724 
725  /* If not the same thread set it dirty. */
726  if (Wnd->head.pti != PsGetCurrentThreadWin32Thread())
727  {
728  Wnd->state |= WNDS_UPDATEDIRTY;
729  if (Wnd->state2 & WNDS2_WMPAINTSENT)
731  }
732 
733  if (Flags & RDW_FRAME)
734  Wnd->state |= WNDS_SENDNCPAINT;
735 
736  if (Flags & RDW_ERASE)
738 
739  if (RgnType != NULLREGION && Rgn > PRGN_WINDOW)
740  {
741  if (Wnd->hrgnUpdate == NULL)
742  {
743  Wnd->hrgnUpdate = NtGdiCreateRectRgn(0, 0, 0, 0);
745  }
746 
747  if (Wnd->hrgnUpdate != HRGN_WINDOW)
748  {
749  RgnUpdate = REGION_LockRgn(Wnd->hrgnUpdate);
750  if (RgnUpdate)
751  {
752  RgnType = IntGdiCombineRgn(RgnUpdate, RgnUpdate, Rgn, RGN_OR);
753  REGION_UnlockRgn(RgnUpdate);
754  if (RgnType == NULLREGION)
755  {
758  Wnd->hrgnUpdate = NULL;
759  }
760  }
761  }
762  }
763 
764  Flags |= RDW_ERASE|RDW_FRAME; // For children.
765 
766  }
767 
768  if (!HadPaintMessage && IntIsWindowDirty(Wnd))
769  {
770  MsqIncPaintCountQueue(Wnd->head.pti);
771  }
772 
773  } // The following flags are used to validate the window.
775  {
776  if (Wnd->state & WNDS_UPDATEDIRTY && !(Flags & RDW_NOUPDATEDIRTY))
777  return;
778 
780  {
781  Wnd->state &= ~WNDS_INTERNALPAINT;
782  }
783 
784  if (Flags & RDW_VALIDATE)
785  {
786  if (Flags & RDW_NOFRAME)
787  Wnd->state &= ~WNDS_SENDNCPAINT;
788 
789  if (Flags & RDW_NOERASE)
791 
792  if (Wnd->hrgnUpdate > HRGN_WINDOW && RgnType != NULLREGION && Rgn > PRGN_WINDOW)
793  {
794  PREGION RgnUpdate = REGION_LockRgn(Wnd->hrgnUpdate);
795 
796  if (RgnUpdate)
797  {
798  RgnType = IntGdiCombineRgn(RgnUpdate, RgnUpdate, Rgn, RGN_DIFF);
799  REGION_UnlockRgn(RgnUpdate);
800 
801  if (RgnType == NULLREGION)
802  {
805  Wnd->hrgnUpdate = NULL;
806  }
807  }
808  }
809  // If update is null, do not erase.
810  if (Wnd->hrgnUpdate == NULL)
811  {
813  }
814  }
815 
816  if (HadPaintMessage && !IntIsWindowDirty(Wnd))
817  {
818  MsqDecPaintCountQueue(Wnd->head.pti);
819  }
820  }
821 
822  /*
823  * Process children if needed
824  */
825 
826  if (!(Flags & RDW_NOCHILDREN) &&
827  !(Wnd->style & WS_MINIMIZE) &&
828  ((Flags & RDW_ALLCHILDREN) || !(Wnd->style & WS_CLIPCHILDREN)))
829  {
830  PWND Child;
831 
832  for (Child = Wnd->spwndChild; Child; Child = Child->spwndNext)
833  {
834  if (Child->style & WS_VISIBLE)
835  {
836  /*
837  * Recursive call to update children hrgnUpdate
838  */
839  PREGION RgnTemp = IntSysCreateRectpRgn(0, 0, 0, 0);
840  if (RgnTemp)
841  {
842  if (Rgn > PRGN_WINDOW) IntGdiCombineRgn(RgnTemp, Rgn, 0, RGN_COPY);
843  IntInvalidateWindows(Child, ((Rgn > PRGN_WINDOW)?RgnTemp:Rgn), Flags);
844  REGION_Delete(RgnTemp);
845  }
846  }
847  }
848  }
849  TRACE("IntInvalidateWindows exit\n");
850 }
#define RDW_NOINTERNALPAINT
Definition: winuser.h:1207
#define RDW_NOCHILDREN
Definition: winuser.h:1212
__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
#define PRGN_WINDOW
Definition: painting.h:12
#define WNDS_SENDNCPAINT
Definition: ntuser.h:599
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
#define NULLREGION
Definition: wingdi.h:361
LONG top
Definition: windef.h:307
BOOL FASTCALL REGION_bOffsetRgn(_Inout_ PREGION prgn, _In_ INT cx, _In_ INT cy)
Definition: region.c:2727
RECT rcClient
Definition: ntuser.h:696
#define RDW_FRAME
Definition: winuser.h:1202
LONG left
Definition: windef.h:306
#define WS_CLIPCHILDREN
Definition: pedump.c:619
PREGION FASTCALL REGION_LockRgn(_In_ HRGN hrgn)
Definition: region.c:2377
int32_t INT
Definition: typedefs.h:58
#define RGN_AND
Definition: wingdi.h:356
PREGION FASTCALL IntSysCreateRectpRgn(INT LeftRect, INT TopRect, INT RightRect, INT BottomRect)
Definition: region.c:2426
#define WS_MINIMIZE
Definition: pedump.c:622
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFDEVICE Child
Definition: wdffdo.h:533
#define RDW_NOUPDATEDIRTY
Definition: painting.h:16
unsigned int BOOL
Definition: ntddk_ex.h:94
THRDESKHEAD head
Definition: ntuser.h:674
HRGN hrgnClip
Definition: ntuser.h:712
#define HRGN_WINDOW
Definition: ntuser.h:344
#define RGN_OR
Definition: wingdi.h:359
Definition: region.h:7
INT FASTCALL IntGdiCombineRgn(PREGION prgnDest, PREGION prgnSrc1, PREGION prgnSrc2, INT iCombineMode)
Definition: region.c:2506
#define IntSysCreateRectpRgnIndirect(prc)
Definition: region.h:93
#define TRACE(s)
Definition: solgame.cpp:4
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define RDW_ERASE
Definition: winuser.h:1201
BOOL FASTCALL IntGdiSetRegionOwner(HRGN hRgn, DWORD OwnerMask)
Definition: region.c:2478
#define WNDS2_ENDPAINTINVALIDATE
Definition: ntuser.h:625
HRGN hrgnUpdate
Definition: ntuser.h:700
VOID FASTCALL MsqDecPaintCountQueue(PTHREADINFO pti)
Definition: msgqueue.c:508
VOID FASTCALL IntInvalidateWindows(PWND Wnd, PREGION Rgn, ULONG Flags)
Definition: painting.c:642
#define RDW_VALIDATE
Definition: winuser.h:1208
#define WNDS2_WMPAINTSENT
Definition: ntuser.h:624
#define RDW_INTERNALPAINT
Definition: winuser.h:1203
#define RDW_NOERASE
Definition: winuser.h:1205
RECT rcWindow
Definition: ntuser.h:695
#define GDI_OBJ_HMGR_POWNED
Definition: ntgdihdl.h:117
#define RDW_NOFRAME
Definition: winuser.h:1206
#define RGN_COPY
Definition: wingdi.h:357
Definition: ntuser.h:672
#define RGN_DIFF
Definition: wingdi.h:358
#define RDW_ALLCHILDREN
Definition: winuser.h:1211
DWORD state
Definition: ntuser.h:680
#define GDI_OBJ_HMGR_PUBLIC
Definition: ntgdihdl.h:116
BOOL FASTCALL IntIsWindowDirty(PWND Wnd)
Definition: painting.c:1118
#define NULL
Definition: types.h:112
#define WNDS_NONCPAINT
Definition: ntuser.h:596
#define WNDS_INTERNALPAINT
Definition: ntuser.h:600
#define WNDS_SENDERASEBACKGROUND
Definition: ntuser.h:597
#define WNDS_UPDATEDIRTY
Definition: ntuser.h:601
VOID FASTCALL MsqIncPaintCountQueue(PTHREADINFO pti)
Definition: msgqueue.c:501
VOID FASTCALL REGION_UnlockRgn(_In_ PREGION prgn)
Definition: region.c:2392
#define WNDS_ERASEBACKGROUND
Definition: ntuser.h:598
DWORD state2
Definition: ntuser.h:681
struct _WND * spwndChild
Definition: ntuser.h:693
#define WS_VISIBLE
Definition: pedump.c:620
VOID FASTCALL REGION_Delete(PREGION pRgn)
Definition: region.c:2468
#define RDW_INVALIDATE
Definition: winuser.h:1204
DWORD style
Definition: ntuser.h:685

Referenced by co_UserRedrawWindow(), co_WinPosSetWindowPos(), IntInvalidateWindows(), IntValidateParent(), IntValidateParents(), PaintSuspendedWindow(), and UserRedrawDesktop().

◆ IntIsWindowDirty()

BOOL FASTCALL IntIsWindowDirty ( PWND  Wnd)

Definition at line 1118 of file painting.c.

1119 {
1120  return ( Wnd->style & WS_VISIBLE &&
1121  ( Wnd->hrgnUpdate != NULL ||
1122  Wnd->state & WNDS_INTERNALPAINT ) );
1123 }
HRGN hrgnUpdate
Definition: ntuser.h:700
DWORD state
Definition: ntuser.h:680
#define NULL
Definition: types.h:112
#define WNDS_INTERNALPAINT
Definition: ntuser.h:600
#define WS_VISIBLE
Definition: pedump.c:620
DWORD style
Definition: ntuser.h:685

Referenced by IntFindWindowToRepaint(), and IntInvalidateWindows().

◆ IntIsWindowDrawable()

BOOL FASTCALL IntIsWindowDrawable ( PWND  Wnd)

Definition at line 861 of file painting.c.

862 {
863  PWND WndObject;
864 
865  for (WndObject = Wnd; WndObject != NULL; WndObject = WndObject->spwndParent)
866  {
867  if ( WndObject->state2 & WNDS2_INDESTROY ||
868  WndObject->state & WNDS_DESTROYED ||
869  !WndObject ||
870  !(WndObject->style & WS_VISIBLE) ||
871  ((WndObject->style & WS_MINIMIZE) && (WndObject != Wnd)))
872  {
873  return FALSE;
874  }
875  }
876 
877  return TRUE;
878 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define WS_MINIMIZE
Definition: pedump.c:622
Definition: ntuser.h:672
DWORD state
Definition: ntuser.h:680
#define NULL
Definition: types.h:112
struct _WND * spwndParent
Definition: ntuser.h:692
DWORD state2
Definition: ntuser.h:681
#define WS_VISIBLE
Definition: pedump.c:620
#define WNDS_DESTROYED
Definition: ntuser.h:619
#define WNDS2_INDESTROY
Definition: ntuser.h:631
DWORD style
Definition: ntuser.h:685

Referenced by co_UserRedrawWindow(), IntScrollWindowEx(), and NtUserScrollWindowEx().

◆ IntPaintWindow()

VOID FASTCALL IntPaintWindow ( PWND  Window)

Definition at line 1177 of file painting.c.

1178 {
1179  // Handle normal painting.
1181 }
#define RDW_NOCHILDREN
Definition: winuser.h:1212
Definition: window.c:28
#define FALSE
Definition: types.h:117
VOID FASTCALL co_IntPaintWindows(PWND Wnd, ULONG Flags, BOOL Recurse)
Definition: painting.c:403

Referenced by IntDispatchMessage().

◆ IntPrintWindow()

BOOL FASTCALL IntPrintWindow ( PWND  pwnd,
HDC  hdcBlt,
UINT  nFlags 
)

Definition at line 1252 of file painting.c.

1256 {
1257  HDC hdcSrc;
1258  INT cx, cy, xSrc, ySrc;
1259 
1260  if ( nFlags & PW_CLIENTONLY)
1261  {
1262  cx = pwnd->rcClient.right - pwnd->rcClient.left;
1263  cy = pwnd->rcClient.bottom - pwnd->rcClient.top;
1264  xSrc = pwnd->rcClient.left - pwnd->rcWindow.left;
1265  ySrc = pwnd->rcClient.top - pwnd->rcWindow.top;
1266  }
1267  else
1268  {
1269  cx = pwnd->rcWindow.right - pwnd->rcWindow.left;
1270  cy = pwnd->rcWindow.bottom - pwnd->rcWindow.top;
1271  xSrc = 0;
1272  ySrc = 0;
1273  }
1274 
1275  // TODO: Setup Redirection for Print.
1276  return FALSE;
1277 
1278  /* Update the window just incase. */
1280 
1282  /* Print window to printer context. */
1283  NtGdiBitBlt( hdcBlt,
1284  0,
1285  0,
1286  cx,
1287  cy,
1288  hdcSrc,
1289  xSrc,
1290  ySrc,
1291  SRCCOPY,
1292  0,
1293  0);
1294 
1295  UserReleaseDC( pwnd, hdcSrc, FALSE);
1296 
1297  // TODO: Release Redirection from Print.
1298 
1299  return TRUE;
1300 }
#define TRUE
Definition: types.h:120
static HDC
Definition: imagelist.c:92
LONG top
Definition: windef.h:307
HDC FASTCALL UserGetDCEx(PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
RECT rcClient
Definition: ntuser.h:696
LONG left
Definition: windef.h:306
static HDC hdcSrc
Definition: xlate.c:32
LONG right
Definition: windef.h:308
int32_t INT
Definition: typedefs.h:58
#define DCX_WINDOW
Definition: winuser.h:2103
#define FALSE
Definition: types.h:117
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:585
__kernel_entry W32KAPI BOOL APIENTRY NtGdiBitBlt(_In_ HDC hdcDst, _In_ INT x, _In_ INT y, _In_ INT cx, _In_ INT cy, _In_opt_ HDC hdcSrc, _In_ INT xSrc, _In_ INT ySrc, _In_ DWORD rop4, _In_ DWORD crBackColor, _In_ FLONG fl)
VOID FASTCALL co_IntUpdateWindows(PWND Wnd, ULONG Flags, BOOL Recurse)
Definition: painting.c:519
RECT rcWindow
Definition: ntuser.h:695
#define DCX_CACHE
Definition: winuser.h:2104
#define RDW_ALLCHILDREN
Definition: winuser.h:1211
#define NULL
Definition: types.h:112
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:918
_Out_opt_ int * cx
Definition: commctrl.h:585
LONG bottom
Definition: windef.h:309
#define SRCCOPY
Definition: wingdi.h:333

Referenced by NtUserPrintWindow().

◆ IntSendChildNCPaint()

VOID FASTCALL IntSendChildNCPaint ( PWND  pWnd)

Definition at line 370 of file painting.c.

371 {
372  pWnd = pWnd->spwndChild;
373  while (pWnd)
374  {
375  if ((pWnd->hrgnUpdate == NULL) && (pWnd->state & WNDS_SENDNCPAINT))
376  {
377  PWND Next;
379 
380  /* Reference, IntSendNCPaint leaves win32k */
381  UserRefObjectCo(pWnd, &Ref);
383 
384  /* Make sure to grab next one before dereferencing/freeing */
385  Next = pWnd->spwndNext;
386  UserDerefObjectCo(pWnd);
387  pWnd = Next;
388  }
389  else
390  {
391  pWnd = pWnd->spwndNext;
392  }
393  }
394 }
#define WNDS_SENDNCPAINT
Definition: ntuser.h:599
VOID FASTCALL IntSendNCPaint(PWND pWnd, HRGN hRgn)
Definition: painting.c:348
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:27
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:40
Definition: object.h:3
#define HRGN_WINDOW
Definition: ntuser.h:344
struct _WND * spwndNext
Definition: ntuser.h:690
HRGN hrgnUpdate
Definition: ntuser.h:700
Definition: ntuser.h:672
DWORD state
Definition: ntuser.h:680
#define NULL
Definition: types.h:112
struct _WND * spwndChild
Definition: ntuser.h:693

Referenced by IntBeginPaint().

◆ IntSendNCPaint()

VOID FASTCALL IntSendNCPaint ( PWND  pWnd,
HRGN  hRgn 
)

Definition at line 348 of file painting.c.

349 {
350  pWnd->state &= ~WNDS_SENDNCPAINT;
351 
352  if ( pWnd == GetW32ThreadInfo()->MessageQueue->spwndActive &&
353  !(pWnd->state & WNDS_ACTIVEFRAME))
354  {
355  pWnd->state |= WNDS_ACTIVEFRAME;
356  pWnd->state &= ~WNDS_NONCPAINT;
357  hRgn = HRGN_WINDOW;
358  }
359 
361  {
363  hRgn = HRGN_WINDOW;
364  }
365 
367 }
#define WNDS_SENDNCPAINT
Definition: ntuser.h:599
static HRGN hRgn
Definition: mapping.c:33
UINT_PTR WPARAM
Definition: windef.h:207
struct _THREADINFO * GetW32ThreadInfo(VOID)
Definition: misc.c:801
#define WM_NCPAINT
Definition: winuser.h:1677
#define HRGN_WINDOW
Definition: ntuser.h:344
#define UserHMGetHandle(obj)
Definition: ntuser.h:222
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1446
#define WNDS_ACTIVEFRAME
Definition: ntuser.h:594
#define WNDS2_FORCEFULLNCPAINTCLIPRGN
Definition: ntuser.h:647
DWORD state
Definition: ntuser.h:680
#define WNDS_NONCPAINT
Definition: ntuser.h:596
DWORD state2
Definition: ntuser.h:681

Referenced by co_IntPaintWindows(), co_WinPosSetWindowPos(), ForceNCPaintErase(), IntBeginPaint(), and IntSendChildNCPaint().

◆ IntSendSyncPaint()

VOID FASTCALL IntSendSyncPaint ( PWND  Wnd,
ULONG  Flags 
)

Definition at line 132 of file painting.c.

133 {
134  PTHREADINFO ptiCur, ptiWnd;
137  BOOL bSend = TRUE;
138 
139  ptiWnd = Wnd->head.pti;
141  /*
142  Not the current thread, Wnd is in send Nonclient paint also in send erase background and it is visiable.
143  */
144  if ( Wnd->head.pti != ptiCur &&
145  Wnd->state & WNDS_SENDNCPAINT &&
147  Wnd->style & WS_VISIBLE)
148  {
149  // For testing, if you see this, break out the Champagne and have a party!
150  TRACE("SendSyncPaint Wnd in State!\n");
151  if (!IsListEmpty(&ptiWnd->SentMessagesListHead))
152  {
153  // Scan sent queue messages to see if we received sync paint messages.
154  Entry = ptiWnd->SentMessagesListHead.Flink;
156  do
157  {
158  ERR("LOOP it\n");
159  if (Message->Msg.message == WM_SYNCPAINT &&
160  Message->Msg.hwnd == UserHMGetHandle(Wnd))
161  { // Already received so exit out.
162  ERR("SendSyncPaint Found one in the Sent Msg Queue!\n");
163  bSend = FALSE;
164  break;
165  }
166  Entry = Message->ListEntry.Flink;
168  }
169  while (Entry != &ptiWnd->SentMessagesListHead);
170  }
171  if (bSend)
172  {
173  TRACE("Sending WM_SYNCPAINT\n");
174  // This message has no parameters. But it does! Pass Flags along.
177  }
178  }
179 
180  // Send to all the children if this is the desktop window.
181  if (UserIsDesktopWindow(Wnd))
182  {
183  if ( Flags & RDW_ALLCHILDREN ||
184  ( !(Flags & RDW_NOCHILDREN) && Wnd->style & WS_CLIPCHILDREN))
185  {
186  PWND spwndChild = Wnd->spwndChild;
187  while(spwndChild)
188  {
189  if ( spwndChild->style & WS_CHILD &&
190  spwndChild->head.pti != ptiCur)
191  {
192  spwndChild = spwndChild->spwndNext;
193  continue;
194  }
195  IntSendSyncPaint( spwndChild, Flags );
196  spwndChild = spwndChild->spwndNext;
197  }
198  }
199  }
200 }
#define WM_SYNCPAINT
Definition: winuser.h:1680
#define RDW_NOCHILDREN
Definition: winuser.h:1212
struct _Entry Entry
Definition: kefuncs.h:629
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:194
#define TRUE
Definition: types.h:120
VOID FASTCALL IntSendSyncPaint(PWND Wnd, ULONG Flags)
Definition: painting.c:132
#define WNDS_SENDNCPAINT
Definition: ntuser.h:599
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
#define WS_CHILD
Definition: pedump.c:617
#define WS_CLIPCHILDREN
Definition: pedump.c:619
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
LIST_ENTRY SentMessagesListHead
Definition: win32.h:96
THRDESKHEAD head
Definition: ntuser.h:674
struct _WND * spwndNext
Definition: ntuser.h:690
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define UserHMGetHandle(obj)
Definition: ntuser.h:222
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
#define TRACE(s)
Definition: solgame.cpp:4
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
CHAR Message[80]
Definition: alive.c:5
#define WNDS_SYNCPAINTPENDING
Definition: ntuser.h:611
Definition: typedefs.h:119
#define ERR(fmt,...)
Definition: debug.h:110
Definition: ntuser.h:672
#define RDW_ALLCHILDREN
Definition: winuser.h:1211
LRESULT FASTCALL co_IntSendMessageNoWait(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1710
DWORD state
Definition: ntuser.h:680
#define WNDS_SENDERASEBACKGROUND
Definition: ntuser.h:597
struct _WND * spwndChild
Definition: ntuser.h:693
#define WS_VISIBLE
Definition: pedump.c:620
base of all file and directory entries
Definition: entries.h:82
DWORD style
Definition: ntuser.h:685

Referenced by IntSendSyncPaint(), and UserSyncAndPaintWindows().

◆ IntValidateParents()

BOOL FASTCALL IntValidateParents ( PWND  Child,
BOOL  Recurse 
)

Definition at line 62 of file painting.c.

63 {
64  RECTL ParentRect, Rect;
65  BOOL Start, Ret = TRUE;
66  PWND ParentWnd = Child;
67  PREGION Rgn = NULL;
68 
69  if (ParentWnd->style & WS_CHILD)
70  {
71  do
72  ParentWnd = ParentWnd->spwndParent;
73  while (ParentWnd->style & WS_CHILD);
74  }
75 
76  // No pending nonclient paints.
77  if (!(ParentWnd->state & WNDS_SYNCPAINTPENDING)) Recurse = FALSE;
78 
79  Start = TRUE;
80  ParentWnd = Child->spwndParent;
81  while (ParentWnd)
82  {
83  if (ParentWnd->style & WS_CLIPCHILDREN)
84  break;
85 
86  if (ParentWnd->hrgnUpdate != 0)
87  {
88  if (Recurse)
89  {
90  Ret = FALSE;
91  break;
92  }
93  // Start with child clipping.
94  if (Start)
95  {
96  Start = FALSE;
97 
98  Rect = Child->rcWindow;
99 
100  if (!IntIntersectWithParents(Child, &Rect)) break;
101 
103 
104  if (Child->hrgnClip)
105  {
106  PREGION RgnClip = REGION_LockRgn(Child->hrgnClip);
107  IntGdiCombineRgn(Rgn, Rgn, RgnClip, RGN_AND);
108  REGION_UnlockRgn(RgnClip);
109  }
110  }
111 
112  ParentRect = ParentWnd->rcWindow;
113 
114  if (!IntIntersectWithParents(ParentWnd, &ParentRect)) break;
115 
116  IntInvalidateWindows( ParentWnd,
117  Rgn,
119  }
120  ParentWnd = ParentWnd->spwndParent;
121  }
122 
123  if (Rgn) REGION_Delete(Rgn);
124 
125  return Ret;
126 }
#define RDW_NOCHILDREN
Definition: winuser.h:1212
#define TRUE
Definition: types.h:120
#define WS_CHILD
Definition: pedump.c:617
#define WS_CLIPCHILDREN
Definition: pedump.c:619
PREGION FASTCALL REGION_LockRgn(_In_ HRGN hrgn)
Definition: region.c:2377
#define RGN_AND
Definition: wingdi.h:356
#define FALSE
Definition: types.h:117
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFDEVICE Child
Definition: wdffdo.h:533
#define RDW_NOUPDATEDIRTY
Definition: painting.h:16
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: region.h:7
INT FASTCALL IntGdiCombineRgn(PREGION prgnDest, PREGION prgnSrc1, PREGION prgnSrc2, INT iCombineMode)
Definition: region.c:2506
BOOL FASTCALL IntIntersectWithParents(PWND Child, RECTL *WindowRect)
Definition: painting.c:35
#define IntSysCreateRectpRgnIndirect(prc)
Definition: region.h:93
HRGN hrgnUpdate
Definition: ntuser.h:700
Definition: partlist.h:33
VOID FASTCALL IntInvalidateWindows(PWND Wnd, PREGION Rgn, ULONG Flags)
Definition: painting.c:642
#define RDW_VALIDATE
Definition: winuser.h:1208
#define WNDS_SYNCPAINTPENDING
Definition: ntuser.h:611
RECT rcWindow
Definition: ntuser.h:695
Definition: ntuser.h:672
DWORD state
Definition: ntuser.h:680
#define NULL
Definition: types.h:112
VOID FASTCALL REGION_UnlockRgn(_In_ PREGION prgn)
Definition: region.c:2392
struct _WND * spwndParent
Definition: ntuser.h:692
VOID FASTCALL REGION_Delete(PREGION pRgn)
Definition: region.c:2468
struct Rect Rect
DWORD style
Definition: ntuser.h:685

Referenced by co_IntUpdateWindows().

◆ NtUserBeginPaint()

HDC APIENTRY NtUserBeginPaint ( HWND  hWnd,
PAINTSTRUCT UnsafePs 
)

Definition at line 1608 of file painting.c.

1609 {
1610  PWND Window = NULL;
1611  PAINTSTRUCT Ps;
1612  NTSTATUS Status;
1613  HDC hDC;
1616 
1617  TRACE("Enter NtUserBeginPaint\n");
1619 
1620  if (!(Window = UserGetWindowObject(hWnd)))
1621  {
1622  RETURN( NULL);
1623  }
1624 
1625  UserRefObjectCo(Window, &Ref);
1626 
1627  hDC = IntBeginPaint(Window, &Ps);
1628 
1629  Status = MmCopyToCaller(UnsafePs, &Ps, sizeof(PAINTSTRUCT));
1630  if (! NT_SUCCESS(Status))
1631  {
1633  RETURN(NULL);
1634  }
1635 
1636  RETURN(hDC);
1637 
1638 CLEANUP:
1640 
1641  TRACE("Leave NtUserBeginPaint, ret=%p\n",_ret_);
1642  UserLeave();
1643  END_CLEANUP;
1644 
1645 }
#define CLEANUP
Definition: ntuser.h:5
LONG NTSTATUS
Definition: precomp.h:26
static HDC
Definition: imagelist.c:92
HWND hWnd
Definition: settings.c:17
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:27
#define MmCopyToCaller(x, y, z)
Definition: mmcopy.h:19
#define RETURN(x)
Definition: window.c:28
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:40
Definition: object.h:3
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:126
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:249
Status
Definition: gdiplustypes.h:24
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define DECLARE_RETURN(type)
Definition: ntuser.h:3
HDC FASTCALL IntBeginPaint(PWND Window, PPAINTSTRUCT Ps)
Definition: painting.c:1435
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:37
Definition: ntuser.h:672
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:258
static HDC hDC
Definition: 3dtext.c:33
#define NULL
Definition: types.h:112
#define END_CLEANUP
Definition: ntuser.h:6

Referenced by BeginPaint().

◆ NtUserDrawCaption()

BOOL APIENTRY NtUserDrawCaption ( HWND  hWnd,
HDC  hDC,
LPCRECT  lpRc,
UINT  uFlags 
)

Definition at line 2462 of file painting.c.

2466 {
2467  return NtUserDrawCaptionTemp(hWnd, hDC, lpRc, 0, 0, NULL, uFlags);
2468 }
HWND hWnd
Definition: settings.c:17
UINT uFlags
Definition: api.c:59
BOOL APIENTRY NtUserDrawCaptionTemp(HWND hWnd, HDC hDC, LPCRECT lpRc, HFONT hFont, HICON hIcon, const PUNICODE_STRING str, UINT uFlags)
Definition: painting.c:2379
static HDC hDC
Definition: 3dtext.c:33
#define NULL
Definition: types.h:112

Referenced by DrawCaption(), RealUserDrawCaption(), and UserPaintCaption().

◆ NtUserDrawCaptionTemp()

BOOL APIENTRY NtUserDrawCaptionTemp ( HWND  hWnd,
HDC  hDC,
LPCRECT  lpRc,
HFONT  hFont,
HICON  hIcon,
const PUNICODE_STRING  str,
UINT  uFlags 
)

Definition at line 2379 of file painting.c.

2387 {
2388  PWND pWnd = NULL;
2389  UNICODE_STRING SafeStr = {0};
2391  RECTL SafeRect;
2392  BOOL Ret;
2393 
2395 
2396  if (hWnd != NULL)
2397  {
2398  if(!(pWnd = UserGetWindowObject(hWnd)))
2399  {
2400  UserLeave();
2401  return FALSE;
2402  }
2403  }
2404 
2405  _SEH2_TRY
2406  {
2407  ProbeForRead(lpRc, sizeof(RECTL), sizeof(ULONG));
2408  RtlCopyMemory(&SafeRect, lpRc, sizeof(RECTL));
2409  if (str != NULL)
2410  {
2411  SafeStr = ProbeForReadUnicodeString(str);
2412  if (SafeStr.Length != 0)
2413  {
2414  ProbeForRead( SafeStr.Buffer,
2415  SafeStr.Length,
2416  sizeof(WCHAR));
2417  }
2418  }
2419  }
2421  {
2423  }
2424  _SEH2_END;
2425 
2426  if (Status != STATUS_SUCCESS)
2427  {
2429  UserLeave();
2430  return FALSE;
2431  }
2432 
2433  if (str != NULL)
2434  Ret = UserDrawCaption(pWnd, hDC, &SafeRect, hFont, hIcon, &SafeStr, uFlags);
2435  else
2436  {
2437  if ( RECTL_bIsEmptyRect(&SafeRect) && hFont == 0 && hIcon == 0 )
2438  {
2439  Ret = TRUE;
2440  if (uFlags & DC_DRAWCAPTIONMD)
2441  {
2442  ERR("NC Caption Mode\n");
2443  UserDrawCaptionBar(pWnd, hDC, uFlags);
2444  goto Exit;
2445  }
2446  else if (uFlags & DC_DRAWFRAMEMD)
2447  {
2448  ERR("NC Paint Mode\n");
2449  NC_DoNCPaint(pWnd, hDC, uFlags); // Update Menus too!
2450  goto Exit;
2451  }
2452  }
2453  Ret = UserDrawCaption(pWnd, hDC, &SafeRect, hFont, hIcon, NULL, uFlags);
2454  }
2455 Exit:
2456  UserLeave();
2457  return Ret;
2458 }
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
HWND hWnd
Definition: settings.c:17
UINT uFlags
Definition: api.c:59
HFONT hFont
Definition: main.c:53
_SEH2_TRY
Definition: create.c:4226
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
LRESULT NC_DoNCPaint(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:1042
const WCHAR * str
#define DC_DRAWFRAMEMD
Definition: undocuser.h:152
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:126
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:249
Status
Definition: gdiplustypes.h:24
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
static void Exit(void)
Definition: sock.c:1331
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:37
#define ERR(fmt,...)
Definition: debug.h:110
Definition: ntuser.h:672
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:258
static HDC hDC
Definition: 3dtext.c:33
VOID UserDrawCaptionBar(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:900
_SEH2_END
Definition: create.c:4400
HICON hIcon
Definition: msconfig.c:44
#define NULL
Definition: types.h:112
#define ProbeForReadUnicodeString(Ptr)
Definition: probe.h:77
FORCEINLINE BOOL RECTL_bIsEmptyRect(_In_ const RECTL *prcl)
Definition: rect.h:44
unsigned int ULONG
Definition: retypes.h:1
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:40
#define STATUS_SUCCESS
Definition: shellext.h:65
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
#define DC_DRAWCAPTIONMD
Definition: undocuser.h:150
BOOL UserDrawCaption(PWND pWnd, HDC hDc, RECTL *lpRc, HFONT hFont, HICON hIcon, const PUNICODE_STRING Str, UINT uFlags)
Definition: painting.c:2197

Referenced by DrawCaptionTempW(), and NtUserDrawCaption().

◆ NtUserEndPaint()

BOOL APIENTRY NtUserEndPaint ( HWND  hWnd,
CONST PAINTSTRUCT pUnsafePs 
)

Definition at line 1655 of file painting.c.

1656 {
1658  PWND Window = NULL;
1659  PAINTSTRUCT Ps;
1662 
1663  TRACE("Enter NtUserEndPaint\n");
1665 
1666  if (!(Window = UserGetWindowObject(hWnd)))
1667  {
1668  RETURN(FALSE);
1669  }
1670 
1671  UserRefObjectCo(Window, &Ref); // Here for the exception.
1672 
1673  _SEH2_TRY
1674  {
1675  ProbeForRead(pUnsafePs, sizeof(*pUnsafePs), 1);
1676  RtlCopyMemory(&Ps, pUnsafePs, sizeof(PAINTSTRUCT));
1677  }
1679  {
1681  }
1682  _SEH2_END
1683  if (!NT_SUCCESS(Status))
1684  {
1685  RETURN(FALSE);
1686  }
1687 
1688  RETURN(IntEndPaint(Window, &Ps));
1689 
1690 CLEANUP:
1692 
1693  TRACE("Leave NtUserEndPaint, ret=%i\n",_ret_);
1694  UserLeave();
1695  END_CLEANUP;
1696 }
#define CLEANUP
Definition: ntuser.h:5
LONG NTSTATUS
Definition: precomp.h:26
HWND hWnd
Definition: settings.c:17
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:27
#define RETURN(x)
_SEH2_TRY
Definition: create.c:4226
Definition: window.c:28
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:40
Definition: object.h:3
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:126
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:249
Status
Definition: gdiplustypes.h:24
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define DECLARE_RETURN(type)
Definition: ntuser.h:3
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
Definition: ntuser.h:672
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:258
_SEH2_END
Definition: create.c:4400
BOOL FASTCALL IntEndPaint(PWND Wnd, PPAINTSTRUCT Ps)
Definition: painting.c:1532
#define NULL
Definition: types.h:112
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:40
#define STATUS_SUCCESS
Definition: shellext.h:65
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
#define END_CLEANUP
Definition: ntuser.h:6

Referenced by EndPaint().

◆ NtUserExcludeUpdateRgn()

INT APIENTRY NtUserExcludeUpdateRgn ( HDC  hDC,
HWND  hWnd 
)

Definition at line 2524 of file painting.c.

2527 {
2528  INT ret = ERROR;
2529  PWND pWnd;
2530 
2531  TRACE("Enter NtUserExcludeUpdateRgn\n");
2533 
2534  pWnd = UserGetWindowObject(hWnd);
2535 
2536  if (hDC && pWnd)
2537  ret = co_UserExcludeUpdateRgn(hDC, pWnd);
2538 
2539  TRACE("Leave NtUserExcludeUpdateRgn, ret=%i\n", ret);
2540 
2541  UserLeave();
2542  return ret;
2543 }
INT FASTCALL co_UserExcludeUpdateRgn(HDC hDC, PWND Window)
Definition: painting.c:2471
#define ERROR(name)
Definition: error_private.h:53
HWND hWnd
Definition: settings.c:17
int32_t INT
Definition: typedefs.h:58
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:126
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:249
#define TRACE(s)
Definition: solgame.cpp:4
int ret
Definition: ntuser.h:672
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:258
static HDC hDC
Definition: 3dtext.c:33

Referenced by ExcludeUpdateRgn().

◆ NtUserFillWindow()

BOOL APIENTRY NtUserFillWindow ( HWND  hWndParent,
HWND  hWnd,
HDC  hDC,
HBRUSH  hBrush 
)

Definition at line 1705 of file painting.c.

1709 {
1710  BOOL ret = FALSE;
1711  PWND pWnd, pWndParent = NULL;
1713 
1714  TRACE("Enter NtUserFillWindow\n");
1716 
1717  if (!hDC)
1718  {
1719  goto Exit;
1720  }
1721 
1722  if (!(pWnd = UserGetWindowObject(hWnd)))
1723  {
1724  goto Exit;
1725  }
1726 
1727  if (hWndParent && !(pWndParent = UserGetWindowObject(hWndParent)))
1728  {
1729  goto Exit;
1730  }
1731 
1732  UserRefObjectCo(pWnd, &Ref);
1733  ret = IntFillWindow( pWndParent, pWnd, hDC, hBrush );
1734  UserDerefObjectCo(pWnd);
1735 
1736 Exit:
1737  TRACE("Leave NtUserFillWindow, ret=%i\n",ret);
1738  UserLeave();
1739  return ret;
1740 }
HWND hWnd
Definition: settings.c:17
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:27
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:40
Definition: object.h:3
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:126
BOOL FASTCALL IntFillWindow(PWND pWndParent, PWND pWnd, HDC hDC, HBRUSH hBrush)
Definition: painting.c:1555
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:249
#define TRACE(s)
Definition: solgame.cpp:4
static void Exit(void)
Definition: sock.c:1331
int ret
Definition: ntuser.h:672
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:258
static HDC hDC
Definition: 3dtext.c:33
#define NULL
Definition: types.h:112

◆ NtUserFlashWindowEx()

BOOL APIENTRY NtUserFlashWindowEx ( IN PFLASHWINFO  pfwi)

Definition at line 1746 of file painting.c.

1747 {
1748  PWND pWnd;
1749  FLASHWINFO finfo = {0};
1750  BOOL Ret = FALSE;
1751 
1753 
1754  _SEH2_TRY
1755  {
1756  ProbeForRead(pfwi, sizeof(FLASHWINFO), 1);
1757  RtlCopyMemory(&finfo, pfwi, sizeof(FLASHWINFO));
1758  }
1760  {
1762  _SEH2_YIELD(goto Exit);
1763  }
1764  _SEH2_END
1765 
1766  if (!( pWnd = ValidateHwndNoErr(finfo.hwnd)) ||
1767  finfo.cbSize != sizeof(FLASHWINFO) ||
1768  finfo.dwFlags & ~(FLASHW_ALL|FLASHW_TIMER|FLASHW_TIMERNOFG) )
1769  {
1771  goto Exit;
1772  }
1773 
1774  Ret = IntFlashWindowEx(pWnd, &finfo);
1775 
1776 Exit:
1777  UserLeave();
1778  return Ret;
1779 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
BOOL FASTCALL IntFlashWindowEx(PWND pWnd, PFLASHWINFO pfwi)
Definition: painting.c:1304
_SEH2_TRY
Definition: create.c:4226
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:249
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
static void Exit(void)
Definition: sock.c:1331
#define ValidateHwndNoErr(hwnd)
Definition: precomp.h:84
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:37
Definition: ntuser.h:672
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:258
_SEH2_END
Definition: create.c:4400
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:40
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:168
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28

Referenced by FlashWindow(), and FlashWindowEx().

◆ NtUserGetUpdateRect()

BOOL APIENTRY NtUserGetUpdateRect ( HWND  hWnd,
LPRECT  UnsafeRect,
BOOL  bErase 
)

Definition at line 1961 of file painting.c.

1962 {
1963  PWND Window;
1964  RECTL Rect;
1965  NTSTATUS Status;
1966  BOOL Ret;
1968 
1969  TRACE("Enter NtUserGetUpdateRect\n");
1971 
1972  if (!(Window = UserGetWindowObject(hWnd)))
1973  {
1974  RETURN(FALSE);
1975  }
1976 
1977  Ret = co_UserGetUpdateRect(Window, &Rect, bErase);
1978 
1979  if (UnsafeRect != NULL)
1980  {
1981  Status = MmCopyToCaller(UnsafeRect, &Rect, sizeof(RECTL));
1982  if (!NT_SUCCESS(Status))
1983  {
1985  RETURN(FALSE);
1986  }
1987  }
1988 
1989  RETURN(Ret);
1990 
1991 CLEANUP:
1992  TRACE("Leave NtUserGetUpdateRect, ret=%i\n",_ret_);
1993  UserLeave();
1994  END_CLEANUP;
1995 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define CLEANUP
Definition: ntuser.h:5
LONG NTSTATUS
Definition: precomp.h:26
HWND hWnd
Definition: settings.c:17
#define MmCopyToCaller(x, y, z)
Definition: mmcopy.h:19
#define RETURN(x)
Definition: window.c:28
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:126
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:249
Status
Definition: gdiplustypes.h:24
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define DECLARE_RETURN(type)
Definition: ntuser.h:3
int Window
Definition: x11stubs.h:26
Definition: ntuser.h:672
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:258
#define NULL
Definition: types.h:112
BOOL FASTCALL co_UserGetUpdateRect(PWND Window, PRECT pRect, BOOL bErase)
Definition: painting.c:1857
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28
struct Rect Rect
#define END_CLEANUP
Definition: ntuser.h:6

Referenced by GetUpdateRect().

◆ NtUserGetUpdateRgn()

INT APIENTRY NtUserGetUpdateRgn ( HWND  hWnd,
HRGN  hRgn,
BOOL  bErase 
)

Definition at line 1929 of file painting.c.

1930 {
1932  PWND Window;
1933  INT ret;
1934 
1935  TRACE("Enter NtUserGetUpdateRgn\n");
1937 
1938  if (!(Window = UserGetWindowObject(hWnd)))
1939  {
1940  RETURN(ERROR);
1941  }
1942 
1943  ret = co_UserGetUpdateRgn(Window, hRgn, bErase);
1944 
1945  RETURN(ret);
1946 
1947 CLEANUP:
1948  TRACE("Leave NtUserGetUpdateRgn, ret=%i\n",_ret_);
1949  UserLeave();
1950  END_CLEANUP;
1951 }
#define CLEANUP
Definition: ntuser.h:5
#define ERROR(name)
Definition: error_private.h:53
HWND hWnd
Definition: settings.c:17
static HRGN hRgn
Definition: mapping.c:33
int32_t INT
Definition: typedefs.h:58
#define RETURN(x)
Definition: window.c:28
INT FASTCALL co_UserGetUpdateRgn(PWND Window, HRGN hRgn, BOOL bErase)
Definition: painting.c:1785
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:126
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:249
#define TRACE(s)
Definition: solgame.cpp:4
#define DECLARE_RETURN(type)
Definition: ntuser.h:3
int Window
Definition: x11stubs.h:26
int ret
Definition: ntuser.h:672
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:258
#define END_CLEANUP
Definition: ntuser.h:6

Referenced by GetUpdateRgn().

◆ NtUserInvalidateRect()

BOOL APIENTRY NtUserInvalidateRect ( HWND  hWnd,
CONST RECT lpUnsafeRect,
BOOL  bErase 
)

Definition at line 2547 of file painting.c.

2551 {
2552  UINT flags = RDW_INVALIDATE | (bErase ? RDW_ERASE : 0);
2553  if (!hWnd)
2554  {
2556  lpUnsafeRect = NULL;
2557  }
2558  return NtUserRedrawWindow(hWnd, lpUnsafeRect, NULL, flags);
2559 }
BOOL APIENTRY NtUserRedrawWindow(HWND hWnd, CONST RECT *lprcUpdate, HRGN hrgnUpdate, UINT flags)
Definition: painting.c:2005
HWND hWnd
Definition: settings.c:17
#define RDW_FRAME
Definition: winuser.h:1202
#define RDW_ERASE
Definition: winuser.h:1201
GLbitfield flags
Definition: glext.h:7161
#define RDW_ALLCHILDREN
Definition: winuser.h:1211
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define RDW_ERASENOW
Definition: winuser.h:1209
#define RDW_INVALIDATE
Definition: winuser.h:1204

Referenced by ComboWndProc_common(), and InvalidateRect().

◆ NtUserInvalidateRgn()

BOOL APIENTRY NtUserInvalidateRgn ( HWND  hWnd,
HRGN  hRgn,
BOOL  bErase 
)

Definition at line 2563 of file painting.c.

2567 {
2568  if (!hWnd)
2569  {
2571  return FALSE;
2572  }
2573  return NtUserRedrawWindow(hWnd, NULL, hRgn, RDW_INVALIDATE | (bErase? RDW_ERASE : 0));
2574 }
BOOL APIENTRY NtUserRedrawWindow(HWND hWnd, CONST RECT *lprcUpdate, HRGN hrgnUpdate, UINT flags)
Definition: painting.c:2005
HWND hWnd
Definition: settings.c:17
static HRGN hRgn
Definition: mapping.c:33
#define FALSE
Definition: types.h:117
#define ERROR_INVALID_WINDOW_HANDLE
Definition: winerror.h:881
#define RDW_ERASE
Definition: winuser.h:1201
#define NULL
Definition: types.h:112
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28
#define RDW_INVALIDATE
Definition: winuser.h:1204

Referenced by InvalidateRgn().

◆ NtUserPrintWindow()

BOOL APIENTRY NtUserPrintWindow ( HWND  hwnd,
HDC  hdcBlt,
UINT  nFlags 
)

Definition at line 2578 of file painting.c.

2582 {
2583  PWND Window;
2584  BOOL Ret = FALSE;
2585 
2587 
2588  if (hwnd)
2589  {
2590  if (!(Window = UserGetWindowObject(hwnd)) ||
2592  {
2593  goto Exit;
2594  }
2595 
2596  if ( Window )
2597  {
2598  /* Validate flags and check it as a mask for 0 or 1. */
2599  if ( (nFlags & PW_CLIENTONLY) == nFlags)
2600  Ret = IntPrintWindow( Window, hdcBlt, nFlags);
2601  else
2603  }
2604  }
2605 Exit:
2606  UserLeave();
2607  return Ret;
2608 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
BOOL FASTCALL IntPrintWindow(PWND pwnd, HDC hdcBlt, UINT nFlags)
Definition: painting.c:1252
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:194
Definition: window.c:28
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:126
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:249
static void Exit(void)
Definition: sock.c:1331
#define UserIsMessageWindow(pWnd)
Definition: desktop.h:197
int Window
Definition: x11stubs.h:26
Definition: ntuser.h:672
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:258
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28

◆ NtUserRedrawWindow()

BOOL APIENTRY NtUserRedrawWindow ( HWND  hWnd,
CONST RECT lprcUpdate,
HRGN  hrgnUpdate,
UINT  flags 
)

Definition at line 2005 of file painting.c.

2010 {
2011  RECTL SafeUpdateRect;
2012  PWND Wnd;
2013  BOOL Ret;
2016  PREGION RgnUpdate = NULL;
2018 
2019  TRACE("Enter NtUserRedrawWindow\n");
2021 
2022  if (!(Wnd = UserGetWindowObject(hWnd ? hWnd : IntGetDesktopWindow())))
2023  {
2024  RETURN( FALSE);
2025  }
2026 
2027  if (lprcUpdate)
2028  {
2029  _SEH2_TRY
2030  {
2031  ProbeForRead(lprcUpdate, sizeof(RECTL), 1);
2032  RtlCopyMemory(&SafeUpdateRect, lprcUpdate, sizeof(RECTL));
2033  }
2035  {
2037  }
2038  _SEH2_END
2039  if (!NT_SUCCESS(Status))
2040  {
2042  RETURN( FALSE);
2043  }
2044  }
2045 
2049  {
2050  /* RedrawWindow fails only in case that flags are invalid */
2052  RETURN( FALSE);
2053  }
2054 
2055  /* We can't hold lock on GDI objects while doing roundtrips to user mode,
2056  * so it will be copied.
2057  */
2058  if (hrgnUpdate > HRGN_WINDOW)
2059  {
2060  RgnUpdate = REGION_LockRgn(hrgnUpdate);
2061  if (!RgnUpdate)
2062  {
2064  RETURN(FALSE);
2065  }
2066  REGION_UnlockRgn(RgnUpdate);
2067  }
2068  else if (hrgnUpdate == HRGN_WINDOW) // Trap it out.
2069  {
2070  ERR("NTRW: Caller is passing Window Region 1\n");
2071  }
2072 
2073  UserRefObjectCo(Wnd, &Ref);
2074 
2075  Ret = co_UserRedrawWindow( Wnd,
2076  lprcUpdate ? &SafeUpdateRect : NULL,
2077  RgnUpdate,
2078  flags);
2079 
2080  UserDerefObjectCo(Wnd);
2081 
2082  RETURN( Ret);
2083 
2084 CLEANUP:
2085  TRACE("Leave NtUserRedrawWindow, ret=%i\n",_ret_);
2086  UserLeave();
2087  END_CLEANUP;
2088 }
#define RDW_NOINTERNALPAINT
Definition: winuser.h:1207
#define RDW_NOCHILDREN
Definition: winuser.h:1212
#define CLEANUP
Definition: ntuser.h:5
LONG NTSTATUS
Definition: precomp.h:26
HWND hWnd
Definition: settings.c:17
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:27
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define RDW_FRAME
Definition: winuser.h:1202
PREGION FASTCALL REGION_LockRgn(_In_ HRGN hrgn)
Definition: region.c:2377
#define RETURN(x)
_SEH2_TRY
Definition: create.c:4226
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:40
Definition: object.h:3
#define HRGN_WINDOW
Definition: ntuser.h:344
Definition: region.h:7
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:126
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:249
Status
Definition: gdiplustypes.h:24
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define RDW_ERASE
Definition: winuser.h:1201
#define DECLARE_RETURN(type)
Definition: ntuser.h:3
GLbitfield flags
Definition: glext.h:7161
#define RDW_VALIDATE
Definition: winuser.h:1208
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
#define RDW_INTERNALPAINT
Definition: winuser.h:1203
#define RDW_NOERASE
Definition: winuser.h:1205
#define RDW_NOFRAME
Definition: winuser.h:1206
#define ERR(fmt,...)
Definition: debug.h:110
Definition: ntuser.h:672
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:258
HWND FASTCALL IntGetDesktopWindow(VOID)
Definition: desktop.c:1374
_SEH2_END
Definition: create.c:4400
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 NULL
Definition: types.h:112
#define RDW_UPDATENOW
Definition: winuser.h:1210
VOID FASTCALL REGION_UnlockRgn(_In_ PREGION prgn)
Definition: region.c:2392
#define RDW_ERASENOW
Definition: winuser.h:1209
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:40
#define STATUS_SUCCESS
Definition: shellext.h:65
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
#define ERROR_INVALID_FLAGS
Definition: winerror.h:583
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28
#define END_CLEANUP
Definition: ntuser.h:6
#define RDW_INVALIDATE
Definition: winuser.h:1204

Referenced by NtUserInvalidateRect(), NtUserInvalidateRgn(), NtUserValidateRect(), RedrawWindow(), SpiSetWallpaper(), and START_TEST().

◆ NtUserValidateRect()

BOOL APIENTRY NtUserValidateRect ( HWND  hWnd,
const RECT lpRect 
)

Definition at line 2614 of file painting.c.

2617 {
2619  if (!hWnd)
2620  {
2622  lpRect = NULL;
2623  }
2624  return NtUserRedrawWindow(hWnd, lpRect, NULL, flags);
2625 }
BOOL APIENTRY NtUserRedrawWindow(HWND hWnd, CONST RECT *lprcUpdate, HRGN hrgnUpdate, UINT flags)
Definition: painting.c:2005
HWND hWnd
Definition: settings.c:17
#define RDW_FRAME
Definition: winuser.h:1202
#define RDW_ERASE
Definition: winuser.h:1201
GLbitfield flags
Definition: glext.h:7161
#define RDW_VALIDATE
Definition: winuser.h:1208
#define RDW_ALLCHILDREN
Definition: winuser.h:1211
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define RDW_ERASENOW
Definition: winuser.h:1209
#define RDW_INVALIDATE
Definition: winuser.h:1204

◆ PaintSuspendedWindow()

VOID FASTCALL PaintSuspendedWindow ( PWND  pwnd,
HRGN  hrgnOrig 
)

Definition at line 1018 of file painting.c.

1019 {
1020  if (pwnd->hrgnUpdate)
1021  {
1022  HDC hDC;
1024  HRGN hrgnTemp;
1025  RECT Rect;
1026  INT type;
1027  PREGION prgn;
1028 
1029  if (pwnd->hrgnUpdate > HRGN_WINDOW)
1030  {
1031  hrgnTemp = NtGdiCreateRectRgn(0, 0, 0, 0);
1032  type = NtGdiCombineRgn( hrgnTemp, pwnd->hrgnUpdate, 0, RGN_COPY);
1033  if (type == ERROR)
1034  {
1035  GreDeleteObject(hrgnTemp);
1036  hrgnTemp = HRGN_WINDOW;
1037  }
1038  }
1039  else
1040  {
1041  hrgnTemp = GreCreateRectRgnIndirect(&pwnd->rcWindow);
1042  }
1043 
1044  if ( hrgnOrig &&
1045  hrgnTemp > HRGN_WINDOW &&
1046  NtGdiCombineRgn(hrgnTemp, hrgnTemp, hrgnOrig, RGN_AND) == NULLREGION)
1047  {
1048  GreDeleteObject(hrgnTemp);
1049  return;
1050  }
1051 
1053 
1054  Rect = pwnd->rcWindow;
1055  RECTL_vOffsetRect(&Rect, -pwnd->rcWindow.left, -pwnd->rcWindow.top);
1056 
1057  // Clear out client area!
1059 
1060  NC_DoNCPaint(pwnd, hDC, Flags); // Redraw without MENUs.
1061 
1062  UserReleaseDC(pwnd, hDC, FALSE);
1063 
1064  prgn = REGION_LockRgn(hrgnTemp);
1066  REGION_UnlockRgn(prgn);
1067 
1068  // Set updates for this window.
1070 
1071  // DCX_KEEPCLIPRGN is set. Check it anyway.
1072  if (hrgnTemp > HRGN_WINDOW && GreIsHandleValid(hrgnTemp)) GreDeleteObject(hrgnTemp);
1073  }
1074 }
__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
HGDIOBJ FASTCALL IntGetSysColorBrush(INT Object)
Definition: stockobj.c:317
#define ERROR(name)
Definition: error_private.h:53
#define WNDS_SENDNCPAINT
Definition: ntuser.h:599
static HDC
Definition: imagelist.c:92
#define NULLREGION
Definition: wingdi.h:361
LONG top
Definition: windef.h:307
#define DCX_USESTYLE
Definition: GetDCEx.c:10
HDC FASTCALL UserGetDCEx(PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
#define RDW_FRAME
Definition: winuser.h:1202
LONG left
Definition: windef.h:306
PREGION FASTCALL REGION_LockRgn(_In_ HRGN hrgn)
Definition: region.c:2377
#define COLOR_WINDOW
Definition: winuser.h:912
int32_t INT
Definition: typedefs.h:58
#define DCX_INTERSECTRGN
Definition: winuser.h:2112
#define DCX_WINDOW
Definition: winuser.h:2103
#define RGN_AND
Definition: wingdi.h:356
#define FALSE
Definition: types.h:117
#define DC_NC
Definition: winuser.h:440
LRESULT NC_DoNCPaint(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:1042
#define GreCreateRectRgnIndirect(prc)
Definition: region.h:96
#define DCX_KEEPCLIPRGN
Definition: undocuser.h:67
#define HRGN_WINDOW
Definition: ntuser.h:344
Definition: region.h:7
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define RDW_ERASE
Definition: winuser.h:1201
HRGN hrgnUpdate
Definition: ntuser.h:700
VOID FASTCALL IntInvalidateWindows(PWND Wnd, PREGION Rgn, ULONG Flags)
Definition: painting.c:642
RECT rcWindow
Definition: ntuser.h:695
__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
FORCEINLINE VOID RECTL_vOffsetRect(_Inout_ RECTL *prcl, _In_ INT cx, _In_ INT cy)
Definition: rect.h:31
static HDC hDC
Definition: 3dtext.c:33
#define DC_NOSENDMSG
Definition: undocuser.h:147
#define RDW_ALLCHILDREN
Definition: winuser.h:1211
DWORD state
Definition: ntuser.h:680
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:918
#define WNDS_SENDERASEBACKGROUND
Definition: ntuser.h:597
#define WNDS_UPDATEDIRTY
Definition: ntuser.h:601
VOID FASTCALL REGION_UnlockRgn(_In_ PREGION prgn)
Definition: region.c:2392
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
struct Rect Rect
#define RDW_INVALIDATE
Definition: winuser.h:1204

Referenced by UpdateTheadChildren().

◆ UpdateTheadChildren()

VOID FASTCALL UpdateTheadChildren ( PWND  pWnd,
HRGN  hRgn 
)

Definition at line 1077 of file painting.c.

1078 {
1079  PaintSuspendedWindow( pWnd, hRgn );
1080 
1081  if (!(pWnd->style & WS_CLIPCHILDREN))
1082  return;
1083 
1084  pWnd = pWnd->spwndChild; // invalidate children if any.
1085  while (pWnd)
1086  {
1087  UpdateTheadChildren( pWnd, hRgn );
1088  pWnd = pWnd->spwndNext;
1089  }
1090 }
static HRGN hRgn
Definition: mapping.c:33
VOID FASTCALL PaintSuspendedWindow(PWND pwnd, HRGN hrgnOrig)
Definition: painting.c:1018
#define WS_CLIPCHILDREN
Definition: pedump.c:619
struct _WND * spwndNext
Definition: ntuser.h:690
VOID FASTCALL UpdateTheadChildren(PWND pWnd, HRGN hRgn)
Definition: painting.c:1077
struct _WND * spwndChild
Definition: ntuser.h:693
DWORD style
Definition: ntuser.h:685

Referenced by UpdateThreadWindows().

◆ UpdateThreadWindows()

VOID FASTCALL UpdateThreadWindows ( PWND  pWnd,
PTHREADINFO  pti,
HRGN  hRgn 
)

Definition at line 1093 of file painting.c.

1094 {
1095  PWND pwndTemp;
1096 
1097  for ( pwndTemp = pWnd;
1098  pwndTemp;
1099  pwndTemp = pwndTemp->spwndNext )
1100  {
1101  if (pwndTemp->head.pti == pti)
1102  {
1104  }
1105  else
1106  {
1107  if (IsThreadSuspended(pwndTemp->head.pti) || MsqIsHung(pwndTemp->head.pti, MSQ_HUNG))
1108  {
1109  UpdateTheadChildren(pwndTemp, hRgn);
1110  }
1111  else
1113  }
1114  }
1115 }
BOOL FASTCALL MsqIsHung(PTHREADINFO pti, DWORD TimeOut)
Definition: msgqueue.c:2193
#define MSQ_HUNG
Definition: msgqueue.h:3
static HRGN hRgn
Definition: mapping.c:33
VOID FASTCALL UserUpdateWindows(PWND pWnd, ULONG Flags)
Definition: painting.c:598
THRDESKHEAD head
Definition: ntuser.h:674
struct _WND * spwndNext
Definition: ntuser.h:690
Definition: ntuser.h:672
BOOL FASTCALL IsThreadSuspended(PTHREADINFO pti)
Definition: msgqueue.c:2224
#define RDW_ALLCHILDREN
Definition: winuser.h:1211
VOID FASTCALL UpdateTheadChildren(PWND pWnd, HRGN hRgn)
Definition: painting.c:1077

Referenced by DefWndDoSizeMove().

◆ UserDrawCaption()

BOOL UserDrawCaption ( PWND  pWnd,
HDC  hDc,
RECTL lpRc,
HFONT  hFont,
HICON  hIcon,
const PUNICODE_STRING  Str,
UINT  uFlags 
)

Definition at line 2197 of file painting.c.

2205 {
2206  BOOL Ret = FALSE;
2207  HBRUSH hBgBrush, hOldBrush = NULL;
2208  RECTL Rect = *lpRc;
2209  BOOL HasIcon;
2210 
2211  RECTL_vMakeWellOrdered(lpRc);
2212 
2213  /* Determine whether the icon needs to be displayed */
2214  if (!hIcon && pWnd != NULL)
2215  {
2216  HasIcon = (uFlags & DC_ICON) && !(uFlags & DC_SMALLCAP) &&
2217  (pWnd->style & WS_SYSMENU) && !(pWnd->ExStyle & WS_EX_TOOLWINDOW);
2218  }
2219  else
2220  HasIcon = (hIcon != NULL);
2221 
2222  // Draw the caption background
2223  if((uFlags & DC_GRADIENT) && !(uFlags & DC_INBUTTON))
2224  {
2225  static GRADIENT_RECT gcap = {0, 1};
2226  TRIVERTEX Vertices[2];
2227  COLORREF Colors[2];
2228 
2231 
2234 
2235  Vertices[0].x = Rect.left;
2236  Vertices[0].y = Rect.top;
2237  Vertices[0].Red = (WORD)Colors[0]<<8;
2238  Vertices[0].Green = (WORD)Colors[0] & 0xFF00;
2239  Vertices[0].Blue = (WORD)(Colors[0]>>8) & 0xFF00;
2240  Vertices[0].Alpha = 0;
2241 
2242  Vertices[1].x = Rect.right;
2243  Vertices[1].y = Rect.bottom;
2244  Vertices[1].Red = (WORD)Colors[1]<<8;
2245  Vertices[1].Green = (WORD)Colors[1] & 0xFF00;
2246  Vertices[1].Blue = (WORD)(Colors[1]>>8) & 0xFF00;
2247  Vertices[1].Alpha = 0;
2248 
2249  if(!GreGradientFill(hDc, Vertices, 2, &gcap, 1, GRADIENT_FILL_RECT_H))
2250  {
2251  ERR("GreGradientFill() failed!\n");
2252  goto cleanup;
2253  }
2254  }
2255  else
2256  {
2257  if(uFlags & DC_INBUTTON)
2258  hBgBrush = IntGetSysColorBrush(COLOR_3DFACE);
2259  else if(uFlags & DC_ACTIVE)
2261  else
2263 
2264  hOldBrush = NtGdiSelectBrush(hDc, hBgBrush);
2265 
2266  if(!hOldBrush)
2267  {
2268  ERR("NtGdiSelectBrush() failed!\n");
2269  goto cleanup;
2270  }
2271 
2272  if(!NtGdiPatBlt(hDc, Rect.left, Rect.top,
2273  Rect.right - Rect.left,
2274  Rect.bottom - Rect.top,
2275  PATCOPY))
2276  {
2277  ERR("NtGdiPatBlt() failed!\n");
2278  goto cleanup;
2279  }
2280  }
2281 
2282  /* Draw icon */
2283  if (HasIcon)
2284  {
2285  PCURICON_OBJECT pIcon = NULL;
2286 
2287  if (hIcon)
2288  {
2289  pIcon = UserGetCurIconObject(hIcon);
2290  }
2291  else if (pWnd)
2292  {
2293  pIcon = NC_IconForWindow(pWnd);
2294  // FIXME: NC_IconForWindow should reference it for us */
2295  if (pIcon)
2296  UserReferenceObject(pIcon);
2297  }
2298 
2299  if (pIcon)
2300  {
2303  LONG x = Rect.left - cx/2 + 1 + (Rect.bottom - Rect.top)/2; // this is really what Window does
2304  LONG y = (Rect.top + Rect.bottom - cy)/2; // center
2305  UserDrawIconEx(hDc, x, y, pIcon, cx, cy, 0, NULL, DI_NORMAL);
2306  UserDereferenceObject(pIcon);
2307  }
2308  else
2309  {
2310  HasIcon = FALSE;
2311  }
2312  }
2313 
2314  if (HasIcon)
2315  Rect.left += Rect.bottom - Rect.top;
2316 
2317  if((uFlags & DC_TEXT))
2318  {
2319  BOOL Set = FALSE;
2320  Rect.left += 2;
2321 
2322  if (Str)
2323  Set = UserDrawCaptionText(pWnd, hDc, Str, &Rect, uFlags, hFont);
2324  else if (pWnd != NULL) // FIXME: Windows does not do that
2325  {
2326  UNICODE_STRING ustr;
2327  ustr.Buffer = pWnd->strName.Buffer; // FIXME: LARGE_STRING truncated!
2328  ustr.Length = (USHORT)min(pWnd->strName.Length, MAXUSHORT);
2330  Set = UserDrawCaptionText(pWnd, hDc, &ustr, &Rect, uFlags, hFont);
2331  }
2332  if (pWnd)
2333  {
2334  if (Set)
2336  else
2338  }
2339  }
2340 
2341  Ret = TRUE;
2342 
2343 cleanup:
2344  if (hOldBrush) NtGdiSelectBrush(hDc, hOldBrush);
2345 
2346  return Ret;
2347 }
DWORD ExStyle
Definition: ntuser.h:683
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
__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
PCURICON_OBJECT FASTCALL UserGetCurIconObject(HCURSOR hCurIcon)
Definition: cursoricon.c:200
HGDIOBJ FASTCALL IntGetSysColorBrush(INT Object)
Definition: stockobj.c:317
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define TRUE
Definition: types.h:120
#define COLOR_INACTIVECAPTION
Definition: winuser.h:910
#define SM_CYSMICON
Definition: winuser.h:1007
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
BOOL FASTCALL UserDereferenceObject(PVOID Object)
Definition: object.c:644
UINT uFlags
Definition: api.c:59
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
HFONT hFont
Definition: main.c:53
static BOOL Set
Definition: pageheap.c:10
__kernel_entry W32KAPI HBRUSH APIENTRY NtGdiSelectBrush(_In_ HDC hdc, _In_ HBRUSH hbrush)
#define DC_ICON
Definition: winuser.h:429
LONG y
Definition: wingdi.h:2785
#define COLOR_3DFACE
Definition: winuser.h:923
#define COLOR_GRADIENTINACTIVECAPTION
Definition: winuser.h:939
#define FALSE
Definition: types.h:117
BOOL UserDrawCaptionText(PWND pWnd, HDC hDc, const PUNICODE_STRING Text, const RECTL *lpRc, UINT uFlags, HFONT hFont)
Definition: painting.c:2091
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:585
#define COLOR_ACTIVECAPTION
Definition: winuser.h:909
BOOL NTAPI GreGradientFill(HDC hdc, PTRIVERTEX pVertex, ULONG nVertex, PVOID pMesh, ULONG nMesh, ULONG ulMode)
Definition: fillshap.c:940
LARGE_UNICODE_STRING strName
Definition: ntuser.h:715
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:194
LONG x
Definition: wingdi.h:2784
DWORD COLORREF
Definition: windef.h:300
Colors
Definition: ansiprsr.h:4
unsigned short WORD
Definition: ntddk_ex.h:93
DWORD FASTCALL IntGetSysColor(INT nIndex)
Definition: stockobj.c:323
#define COLOR_GRADIENTACTIVECAPTION
Definition: winuser.h:938
#define SM_CXSMICON
Definition: winuser.h:1006
#define DI_NORMAL
Definition: wingdi.h:72
#define PATCOPY
Definition: wingdi.h:335
#define ERR(fmt,...)
Definition: debug.h:110
COLOR16 Alpha
Definition: wingdi.h:2789
#define DC_SMALLCAP
Definition: winuser.h:428
unsigned short USHORT
Definition: pedump.c:61
HICON hIcon
Definition: msconfig.c:44
#define min(a, b)
Definition: monoChain.cc:55
#define NULL
Definition: types.h:112
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define MAXUSHORT
Definition: typedefs.h:83
#define WNDS2_CAPTIONTEXTTRUNCATED
Definition: ntuser.h:649
_Out_opt_ int * cx
Definition: commctrl.h:585
COLOR16 Red
Definition: wingdi.h:2786
COLOR16 Blue
Definition: wingdi.h:2788
DWORD state2
Definition: ntuser.h:681
char * cleanup(char *str)
Definition: wpickclick.c:99
COLOR16 Green
Definition: wingdi.h:2787
#define WS_SYSMENU
Definition: pedump.c:629
VOID FASTCALL RECTL_vMakeWellOrdered(_Inout_ RECTL *prcl)
Definition: rect.c:81
#define DC_TEXT
Definition: winuser.h:430
VOID FASTCALL UserReferenceObject(PVOID obj)
Definition: object.c:731
DWORD style
Definition: ntuser.h:685
#define DC_INBUTTON
Definition: winuser.h:431

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

◆ UserDrawCaptionText()

BOOL UserDrawCaptionText ( PWND  pWnd,
HDC  hDc,
const PUNICODE_STRING  Text,
const RECTL lpRc,
UINT  uFlags,
HFONT  hFont 
)

Definition at line 2091 of file painting.c.

2098 {
2099  HFONT hOldFont = NULL;
2100  COLORREF OldTextColor;
2101  NONCLIENTMETRICSW nclm;
2102  NTSTATUS Status;
2103  BOOLEAN bDeleteFont = FALSE;
2104  SIZE Size;
2105  BOOL Ret = TRUE;
2106  ULONG fit = 0, Length;
2107  RECTL r = *lpRc;
2108 
2109  TRACE("UserDrawCaptionText: %wZ\n", Text);
2110 
2111  nclm.cbSize = sizeof(nclm);
2112  if (!UserSystemParametersInfo(SPI_GETNONCLIENTMETRICS, nclm.cbSize, &nclm, 0))
2113  {
2114  ERR("UserSystemParametersInfo() failed!\n");
2115  return FALSE;
2116  }
2117 
2118  if (!hFont)
2119  {
2120  if(uFlags & DC_SMALLCAP)
2121  Status = TextIntCreateFontIndirect(&nclm.lfSmCaptionFont, &hFont);
2122  else
2123  Status = TextIntCreateFontIndirect(&nclm.lfCaptionFont, &hFont);
2124 
2125  if(!NT_SUCCESS(Status))
2126  {
2127  ERR("TextIntCreateFontIndirect() failed! Status: 0x%x\n", Status);
2128  return FALSE;
2129  }
2130 
2131  bDeleteFont = TRUE;
2132  }
2133 
2135 
2136  hOldFont = NtGdiSelectFont(hDc, hFont);
2137 
2138  if(uFlags & DC_INBUTTON)
2139  OldTextColor = IntGdiSetTextColor(hDc, IntGetSysColor(COLOR_BTNTEXT));
2140  else
2141  OldTextColor = IntGdiSetTextColor(hDc,
2143 
2144  // Adjust for system menu.
2145  if (pWnd && pWnd->style & WS_SYSMENU)
2146  {
2147  r.right -= UserGetSystemMetrics(SM_CYCAPTION) - 1;
2148  if ((pWnd->style & (WS_MAXIMIZEBOX | WS_MINIMIZEBOX)) && !(pWnd->ExStyle & WS_EX_TOOLWINDOW))
2149  {
2150  r.right -= UserGetSystemMetrics(SM_CXSIZE) + 1;
2151  r.right -= UserGetSystemMetrics(SM_CXSIZE) + 1;
2152  }
2153  }
2154 
2155  GreGetTextExtentExW(hDc, Text->Buffer, Text->Length/sizeof(WCHAR), r.right - r.left, &fit, 0, &Size, 0);
2156 
2157  Length = (Text->Length/sizeof(WCHAR) == fit ? fit : fit+1);
2158 
2159  if (Text->Length/sizeof(WCHAR) > Length)
2160  {
2161  Ret = FALSE;
2162  }
2163 
2164  if (Ret)
2165  { // Faster while in setup.
2166  UserExtTextOutW( hDc,
2167  lpRc->left,
2168  lpRc->top + (lpRc->bottom - lpRc->top - Size.cy) / 2, // DT_SINGLELINE && DT_VCENTER
2169  ETO_CLIPPED,
2170  (RECTL *)lpRc,
2171  Text->Buffer,
2172  Length);
2173  }
2174  else
2175  {
2176  DrawTextW( hDc,
2177  Text->Buffer,
2178  Text->Length/sizeof(WCHAR),
2179  (RECTL *)&r,
2181  }
2182 
2183  IntGdiSetTextColor(hDc, OldTextColor);
2184 
2185  if (hOldFont)
2186  NtGdiSelectFont(hDc, hOldFont);
2187 
2188  if (bDeleteFont)
2190 
2191  return Ret;
2192 }
DWORD ExStyle
Definition: ntuser.h:683
BOOL NTAPI GreDeleteObject(HGDIOBJ hobj)
Definition: gdiobj.c:1158
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define TRUE
Definition: types.h:120
NTSTATUS FASTCALL TextIntCreateFontIndirect(CONST LPLOGFONTW lf, HFONT *NewFont)
Definition: freetype.c:2051
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
LONG NTSTATUS
Definition: precomp.h:26
long bottom
Definition: polytest.cpp:53
INT FASTCALL IntGdiSetBkMode(HDC hDC, INT backgroundMode)
Definition: dcutil.c:124
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
#define COLOR_CAPTIONTEXT
Definition: winuser.h:916
UINT uFlags
Definition: api.c:59
#define DT_NOPREFIX
Definition: winuser.h:537
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
HFONT hFont
Definition: main.c:53
#define FALSE
Definition: types.h:117
#define DT_LEFT
Definition: winuser.h:534
unsigned int BOOL
Definition: ntddk_ex.h:94
long top
Definition: polytest.cpp:53
#define TRANSPARENT
Definition: wingdi.h:950
unsigned char BOOLEAN
#define DT_END_ELLIPSIS
Definition: winuser.h:529
COLORREF FASTCALL IntGdiSetTextColor(HDC hDC, COLORREF color)
Definition: dcutil.c:172
#define ETO_CLIPPED
Definition: wingdi.h:648
#define DT_VCENTER
Definition: winuser.h:543
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
long left
Definition: polytest.cpp:53
#define DC_ACTIVE
Definition: winuser.h:427
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:194
Status
Definition: gdiplustypes.h:24
__kernel_entry W32KAPI HFONT APIENTRY NtGdiSelectFont(_In_ HDC hdc, _In_ HFONT hf)
Definition: dcobjs.c:597
#define TRACE(s)
Definition: solgame.cpp:4
#define SM_CYCAPTION
Definition: winuser.h:957
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
DWORD COLORREF
Definition: windef.h:300
DWORD FASTCALL IntGetSysColor(INT nIndex)
Definition: stockobj.c:323
BOOL UserExtTextOutW(HDC hdc, INT x, INT y, UINT flags, PRECTL lprc, LPCWSTR lpString, UINT count)
#define COLOR_INACTIVECAPTIONTEXT
Definition: winuser.h:928
#define ERR(fmt,...)
Definition: debug.h:110
#define DT_SINGLELINE
Definition: winuser.h:540
#define DC_SMALLCAP
Definition: winuser.h:428
#define WS_MINIMIZEBOX
Definition: pedump.c:631
#define NULL
Definition: types.h:112
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define SM_CXSIZE
Definition: winuser.h:985
unsigned int ULONG
Definition: retypes.h:1
#define COLOR_BTNTEXT
Definition: winuser.h:927
BOOL FASTCALL UserSystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
Definition: sysparams.c:2090
#define WS_SYSMENU
Definition: pedump.c:629
BOOL FASTCALL GreGetTextExtentExW(HDC hDC, LPCWSTR String, ULONG Count, ULONG MaxExtent, PULONG Fit, PULONG Dx, LPSIZE pSize, FLONG fl)
Definition: text.c:135
char * Text
Definition: combotst.c:136
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:17
DWORD style
Definition: ntuser.h:685
#define DC_INBUTTON
Definition: winuser.h:431

Referenced by UserDrawCaption().

◆ UserExtTextOutW()

BOOL UserExtTextOutW ( HDC  hdc,
INT  x,
INT  y,
UINT  flags,
PRECTL  lprc,
LPCWSTR  lpString,
UINT  count 
)

◆ UserRealizePalette()

INT FASTCALL UserRealizePalette ( HDC  hdc)

Definition at line 2351 of file painting.c.

2352 {
2353  HWND hWnd, hWndDesktop;
2354  DWORD Ret;
2355 
2356  Ret = IntGdiRealizePalette(hdc);
2357  if (Ret) // There was a change.
2358  {
2360  if (hWnd) // Send broadcast if dc is associated with a window.
2361  { // FYI: Thread locked in CallOneParam.
2362  hWndDesktop = IntGetDesktopWindow();
2363  if ( hWndDesktop != hWnd )
2364  {
2365  PWND pWnd = UserGetWindowObject(hWndDesktop);
2366  ERR("RealizePalette Desktop.\n");
2367  hdc = UserGetWindowDC(pWnd);
2369  UserReleaseDC(pWnd,hdc,FALSE);
2370  }
2372  }
2373  }
2374  return Ret;
2375 }
BOOL FASTCALL UserSendNotifyMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:2037
HWND hWnd
Definition: settings.c:17
HDC FASTCALL UserGetWindowDC(PWND Wnd)
Definition: windc.c:947
UINT_PTR WPARAM
Definition: windef.h:207
#define FALSE
Definition: types.h:117
BOOL FASTCALL IntPaintDesktop(HDC hDC)
Definition: desktop.c:1827
HWND FASTCALL IntWindowFromDC(HDC hDc)
Definition: windc.c:894
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:126
#define WM_PALETTECHANGED
Definition: winuser.h:1867
unsigned long DWORD
Definition: ntddk_ex.h:95
HDC hdc
Definition: main.c:9
#define ERR(fmt,...)
Definition: debug.h:110
Definition: ntuser.h:672
HWND FASTCALL IntGetDesktopWindow(VOID)
Definition: desktop.c:1374
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:918
UINT FASTCALL IntGdiRealizePalette(HDC)
Definition: palette.c:731
#define HWND_BROADCAST
Definition: winuser.h:1194

◆ UserSyncAndPaintWindows()

VOID FASTCALL UserSyncAndPaintWindows ( PWND  pWnd,
ULONG  Flags 
)

Definition at line 620 of file painting.c.

621 {
622  PWND Parent = pWnd;
623  // Find parent, if it needs to be painted, leave.
624  while(TRUE)
625  {
626  if ((Parent = Parent->spwndParent) == NULL) break;
627  if ( Parent->style & WS_CLIPCHILDREN ) break;
628  if ( Parent->hrgnUpdate != NULL || Parent->state & WNDS_INTERNALPAINT ) return;
629  }
630 
631  IntSendSyncPaint(pWnd, Flags);
633 }
#define TRUE
Definition: types.h:120
VOID FASTCALL IntSendSyncPaint(PWND Wnd, ULONG Flags)
Definition: painting.c:132
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical 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:728
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define FALSE
Definition: types.h:117
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
VOID FASTCALL co_IntPaintWindows(PWND Wnd, ULONG Flags, BOOL Recurse)
Definition: painting.c:403
Definition: ntuser.h:672
#define NULL
Definition: types.h:112
#define WNDS_INTERNALPAINT
Definition: ntuser.h:600

Referenced by co_UserRedrawWindow(), and