ReactOS  0.4.15-dev-3175-g222acf5
painting.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define FLASHW_MASK   0x0000000f
 
#define FLASHW_SYSTIMER   0x00000400
 
#define FLASHW_FINISHED   0x00000800
 
#define FLASHW_STARTED   0x00001000
 
#define FLASHW_COUNT   0x00002000
 
#define FLASHW_KILLSYSTIMER   0x00004000
 
#define FLASHW_ACTIVE   0x00008000
 
#define PRGN_NULL   ((PREGION)0) /* NULL empty region */
 
#define PRGN_WINDOW   ((PREGION)1) /* region from window rcWindow */
 
#define PRGN_MONITOR   ((PREGION)2) /* region from monitor region. */
 
#define RDW_CLIPCHILDREN   4096
 
#define RDW_NOUPDATEDIRTY   32768
 

Functions

BOOL FASTCALL co_UserRedrawWindow (PWND Wnd, const RECTL *UpdateRect, PREGION UpdateRgn, ULONG Flags)
 
VOID FASTCALL IntInvalidateWindows (PWND Window, PREGION Rgn, ULONG Flags)
 
BOOL FASTCALL IntGetPaintMessage (PWND Window, UINT MsgFilterMin, UINT MsgFilterMax, PTHREADINFO Thread, MSG *Message, BOOL Remove)
 
INT FASTCALL UserRealizePalette (HDC)
 
INT FASTCALL co_UserGetUpdateRgn (PWND, HRGN, BOOL)
 
BOOL FASTCALL co_UserGetUpdateRect (PWND, PRECT, BOOL)
 
VOID FASTCALL co_IntPaintWindows (PWND Window, ULONG Flags, BOOL Recurse)
 
VOID FASTCALL IntSendSyncPaint (PWND, ULONG)
 
VOID FASTCALL co_IntUpdateWindows (PWND, ULONG, BOOL)
 
BOOL FASTCALL IntIsWindowDirty (PWND)
 
BOOL FASTCALL IntEndPaint (PWND, PPAINTSTRUCT)
 
HDC FASTCALL IntBeginPaint (PWND, PPAINTSTRUCT)
 
PCURICON_OBJECT FASTCALL NC_IconForWindow (PWND)
 
BOOL FASTCALL IntFlashWindowEx (PWND, PFLASHWINFO)
 
BOOL FASTCALL IntIntersectWithParents (PWND, RECTL *)
 
BOOL FASTCALL IntIsWindowDrawable (PWND)
 
BOOL UserDrawCaption (PWND, HDC, RECTL *, HFONT, HICON, const PUNICODE_STRING, UINT)
 
VOID FASTCALL UpdateThreadWindows (PWND, PTHREADINFO, HRGN)
 
VOID FASTCALL UserSyncAndPaintWindows (PWND pWnd, ULONG Flags)
 
VOID FASTCALL IntPaintWindow (PWND)
 
VOID FASTCALL IntSendNCPaint (PWND, HRGN)
 

Macro Definition Documentation

◆ FLASHW_ACTIVE

#define FLASHW_ACTIVE   0x00008000

Definition at line 9 of file painting.h.

◆ FLASHW_COUNT

#define FLASHW_COUNT   0x00002000

Definition at line 7 of file painting.h.

◆ FLASHW_FINISHED

#define FLASHW_FINISHED   0x00000800

Definition at line 5 of file painting.h.

◆ FLASHW_KILLSYSTIMER

#define FLASHW_KILLSYSTIMER   0x00004000

Definition at line 8 of file painting.h.

◆ FLASHW_MASK

#define FLASHW_MASK   0x0000000f

Definition at line 3 of file painting.h.

◆ FLASHW_STARTED

#define FLASHW_STARTED   0x00001000

Definition at line 6 of file painting.h.

◆ FLASHW_SYSTIMER

#define FLASHW_SYSTIMER   0x00000400

Definition at line 4 of file painting.h.

◆ PRGN_MONITOR

#define PRGN_MONITOR   ((PREGION)2) /* region from monitor region. */

Definition at line 13 of file painting.h.

◆ PRGN_NULL

#define PRGN_NULL   ((PREGION)0) /* NULL empty region */

Definition at line 11 of file painting.h.

◆ PRGN_WINDOW

#define PRGN_WINDOW   ((PREGION)1) /* region from window rcWindow */

Definition at line 12 of file painting.h.

◆ RDW_CLIPCHILDREN

#define RDW_CLIPCHILDREN   4096

Definition at line 15 of file painting.h.

◆ RDW_NOUPDATEDIRTY

#define RDW_NOUPDATEDIRTY   32768

Definition at line 16 of file painting.h.

Function Documentation

◆ co_IntPaintWindows()

VOID FASTCALL co_IntPaintWindows ( PWND  Window,
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 ||
412  Wnd->state & WNDS_SENDERASEBACKGROUND)
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:1208
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:590
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:25
#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:2105
PPROCESSINFO ppi
Definition: win32.h:89
#define WNDS_PAINTNOTPROCESSED
Definition: ntuser.h:601
#define FALSE
Definition: types.h:117
#define WS_MINIMIZE
Definition: pedump.c:622
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:38
HRGN FASTCALL IntGetNCUpdateRgn(PWND Window, BOOL Validate)
Definition: painting.c:260
Definition: object.h:3
#define DCX_KEEPCLIPRGN
Definition: undocuser.h:67
#define HRGN_WINDOW
Definition: ntuser.h:335
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
VOID FASTCALL co_IntPaintWindows(PWND Wnd, ULONG Flags, BOOL Recurse)
Definition: painting.c:403
BOOL FASTCALL IntIsWindow(HWND hWnd)
Definition: window.c:157
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:255
#define ERR(fmt,...)
Definition: debug.h:110
static HDC hDC
Definition: 3dtext.c:33
#define DCX_CACHE
Definition: winuser.h:2097
#define RDW_ALLCHILDREN
Definition: winuser.h:1207
#define NULL
Definition: types.h:112
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:917
#define WNDS_SENDERASEBACKGROUND
Definition: ntuser.h:588
#define RDW_CLIPCHILDREN
Definition: painting.h:15
#define WNDS_ERASEBACKGROUND
Definition: ntuser.h:589
#define WM_ERASEBKGND
Definition: winuser.h:1608
#define USERTAG_WINDOWLIST
Definition: tags.h:297
#define WS_VISIBLE
Definition: pedump.c:620
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099

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

◆ co_IntUpdateWindows()

VOID FASTCALL co_IntUpdateWindows ( PWND  ,
ULONG  ,
BOOL   
)

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 
541  Wnd->state |= WNDS_PAINTNOTPROCESSED;
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:1208
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:220
#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:25
#define WNDS_PAINTNOTPROCESSED
Definition: ntuser.h:601
#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:38
Definition: object.h:3
struct _WND * spwndNext
Definition: ntuser.h:681
_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:691
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:1603
VOID FASTCALL MsqDecPaintCountQueue(PTHREADINFO pti)
Definition: msgqueue.c:508
#define WNDS2_WMPAINTSENT
Definition: ntuser.h:615
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1446
Definition: ntuser.h:663
#define RDW_ALLCHILDREN
Definition: winuser.h:1207
DWORD state
Definition: ntuser.h:671
#define NULL
Definition: types.h:112
#define WNDS_INTERNALPAINT
Definition: ntuser.h:591
#define WNDS_UPDATEDIRTY
Definition: ntuser.h:592
#define WS_VISIBLE
Definition: pedump.c:620

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

◆ co_UserGetUpdateRect()

BOOL FASTCALL co_UserGetUpdateRect ( PWND  ,
PRECT  ,
BOOL   
)

Definition at line 1854 of file painting.c.

1855 {
1856  INT RegionType;
1857  BOOL Ret = TRUE;
1858 
1859  if (bErase)
1860  {
1862  UserRefObjectCo(Window, &Ref);
1865  }
1866 
1867  Window->state &= ~WNDS_UPDATEDIRTY;
1868 
1869  if (Window->hrgnUpdate == NULL)
1870  {
1871  pRect->left = pRect->top = pRect->right = pRect->bottom = 0;
1872  Ret = FALSE;
1873  }
1874  else
1875  {
1876  /* Get the update region bounding box. */
1877  if (Window->hrgnUpdate == HRGN_WINDOW)
1878  {
1879  *pRect = Window->rcClient;
1880  ERR("GURt: Caller is retrieving Window Region 1\n");
1881  }
1882  else
1883  {
1884  RegionType = IntGdiGetRgnBox(Window->hrgnUpdate, pRect);
1885 
1886  if (RegionType != ERROR && RegionType != NULLREGION)
1887  RECTL_bIntersectRect(pRect, pRect, &Window->rcClient);
1888  }
1889 
1890  if (IntIntersectWithParents(Window, pRect))
1891  {
1893  {
1894  RECTL_vOffsetRect(pRect,
1895  -Window->rcClient.left,
1896  -Window->rcClient.top);
1897  }
1898  if (Window->pcls->style & CS_OWNDC)
1899  {
1900  HDC hdc;
1901  //DWORD layout;
1903  //layout = NtGdiSetLayout(hdc, -1, 0);
1904  //IntMapWindowPoints( 0, Window, (LPPOINT)pRect, 2 );
1905  GreDPtoLP( hdc, (LPPOINT)pRect, 2 );
1906  //NtGdiSetLayout(hdc, -1, layout);
1908  }
1909  }
1910  else
1911  {
1912  pRect->left = pRect->top = pRect->right = pRect->bottom = 0;
1913  }
1914  }
1915  return Ret;
1916 }
#define RDW_NOCHILDREN
Definition: winuser.h:1208
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:220
#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:360
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:25
#define DCX_USESTYLE
Definition: GetDCEx.c:10
HDC FASTCALL UserGetDCEx(PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
#define CS_OWNDC
Definition: winuser.h:650
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:38
BOOL FASTCALL GreDPtoLP(HDC, LPPOINT, INT)
Definition: dcutil.c:7
Definition: object.h:3
#define HRGN_WINDOW
Definition: ntuser.h:335
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:917
#define WNDS_UPDATEDIRTY
Definition: ntuser.h:592
RegionType

Referenced by NtUserGetUpdateRect().

◆ co_UserGetUpdateRgn()

INT FASTCALL co_UserGetUpdateRgn ( PWND  ,
HRGN  ,
BOOL   
)

Definition at line 1782 of file painting.c.

1783 {
1784  int RegionType;
1785  BOOL Type;
1786  RECTL Rect;
1787 
1789 
1790  if (bErase)
1791  {
1793  UserRefObjectCo(Window, &Ref);
1796  }
1797 
1798  Window->state &= ~WNDS_UPDATEDIRTY;
1799 
1800  if (Window->hrgnUpdate == NULL)
1801  {
1802  NtGdiSetRectRgn(hRgn, 0, 0, 0, 0);
1803  return NULLREGION;
1804  }
1805 
1806  Rect = Window->rcClient;
1808 
1809  if (Window->hrgnUpdate == HRGN_WINDOW)
1810  {
1811  // Trap it out.
1812  ERR("GURn: Caller is passing Window Region 1\n");
1813  if (!Type)
1814  {
1815  NtGdiSetRectRgn(hRgn, 0, 0, 0, 0);
1816  return NULLREGION;
1817  }
1818 
1820 
1822  {
1824  -Window->rcClient.left,
1825  -Window->rcClient.top);
1826  }
1828  }
1829  else
1830  {
1831  HRGN hrgnTemp = GreCreateRectRgnIndirect(&Rect);
1832 
1833  RegionType = NtGdiCombineRgn(hRgn, hrgnTemp, Window->hrgnUpdate, RGN_AND);
1834 
1835  if (RegionType == ERROR || RegionType == NULLREGION)
1836  {
1837  if (hrgnTemp) GreDeleteObject(hrgnTemp);
1838  NtGdiSetRectRgn(hRgn, 0, 0, 0, 0);
1839  return RegionType;
1840  }
1841 
1843  {
1845  -Window->rcClient.left,
1846  -Window->rcClient.top);
1847  }
1848  if (hrgnTemp) GreDeleteObject(hrgnTemp);
1849  }
1850  return RegionType;
1851 }
#define RDW_NOCHILDREN
Definition: winuser.h:1208
BOOL NTAPI GreDeleteObject(HGDIOBJ hobj)
Definition: gdiobj.c:1158
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:220
#define ERROR(name)
Definition: error_private.h:53
#define ASSERT_REFS_CO(_obj_)
Definition: userfuncs.h:13
#define NULLREGION
Definition: wingdi.h:360
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:25
static HRGN hRgn
Definition: mapping.c:33
#define RGN_AND
Definition: wingdi.h:355
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:38
#define GreCreateRectRgnIndirect(prc)
Definition: region.h:96
Definition: object.h:3
#define HRGN_WINDOW
Definition: ntuser.h:335
__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:361
#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:592
RegionType
struct Rect Rect

Referenced by IntDefWindowProc(), and NtUserGetUpdateRgn().

◆ co_UserRedrawWindow()

BOOL FASTCALL co_UserRedrawWindow ( PWND  Wnd,
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:1203
#define RDW_NOCHILDREN
Definition: winuser.h:1208
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:1198
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:1353
#define RDW_VALIDATE
Definition: winuser.h:1204
#define RDW_INTERNALPAINT
Definition: winuser.h:1199
#define RDW_NOFRAME
Definition: winuser.h:1202
#define RGN_COPY
Definition: wingdi.h:356
#define RDW_ALLCHILDREN
Definition: winuser.h:1207
#define NULL
Definition: types.h:112
#define RDW_UPDATENOW
Definition: winuser.h:1206
#define RDW_ERASENOW
Definition: winuser.h:1205
#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:1200

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

◆ IntBeginPaint()

HDC FASTCALL IntBeginPaint ( PWND  ,
PPAINTSTRUCT   
)

Definition at line 1434 of file painting.c.

1435 {
1436  RECT Rect;
1437  INT type;
1438  BOOL Erase = FALSE;
1439 
1441 
1442  Window->state2 |= WNDS2_STARTPAINT;
1443  Window->state &= ~WNDS_PAINTNOTPROCESSED;
1444 
1445  if (Window->state & WNDS_SENDNCPAINT)
1446  {
1447  HRGN hRgn;
1448  // Application can keep update dirty.
1449  do
1450  {
1451  Window->state &= ~WNDS_UPDATEDIRTY;
1455  {
1456  /* NOTE: The region can already be deleted! */
1458  }
1459  }
1460  while(Window->state & WNDS_UPDATEDIRTY);
1461  }
1462  else
1463  {
1464  Window->state &= ~WNDS_UPDATEDIRTY;
1465  }
1466 
1467  RtlZeroMemory(Ps, sizeof(PAINTSTRUCT));
1468 
1469  if (Window->state2 & WNDS2_ENDPAINTINVALIDATE)
1470  {
1471  ERR("BP: Another thread invalidated this window\n");
1472  }
1473 
1474  Ps->hdc = UserGetDCEx( Window,
1475  Window->hrgnUpdate,
1477  if (!Ps->hdc)
1478  {
1479  return NULL;
1480  }
1481 
1482  // If set, always clear flags out due to the conditions later on for sending the message.
1483  if (Window->state & WNDS_SENDERASEBACKGROUND)
1484  {
1486  Erase = TRUE;
1487  }
1488 
1489  if (Window->hrgnUpdate != NULL)
1490  {
1491  MsqDecPaintCountQueue(Window->head.pti);
1493  /* The region is part of the dc now and belongs to the process! */
1494  Window->hrgnUpdate = NULL;
1495  }
1496  else
1497  {
1498  if (Window->state & WNDS_INTERNALPAINT)
1499  MsqDecPaintCountQueue(Window->head.pti);
1500  }
1501 
1502  type = GdiGetClipBox(Ps->hdc, &Ps->rcPaint);
1503 
1505 
1506  Window->state &= ~WNDS_INTERNALPAINT;
1507 
1508  if ( Erase && // Set to erase,
1509  type != NULLREGION && // don't erase if the clip box is empty,
1510  (!(Window->pcls->style & CS_PARENTDC) || // not parent dc or
1511  RECTL_bIntersectRect( &Rect, &Rect, &Ps->rcPaint) ) ) // intersecting.
1512  {
1513  Ps->fErase = !co_IntSendMessage(UserHMGetHandle(Window), WM_ERASEBKGND, (WPARAM)Ps->hdc, 0);
1514  if ( Ps->fErase )
1515  {
1517  }
1518  }
1519  else
1520  {
1521  Ps->fErase = FALSE;
1522  }
1523 
1525 
1526  return Ps->hdc;
1527 }
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:590
VOID FASTCALL IntSendNCPaint(PWND pWnd, HRGN hRgn)
Definition: painting.c:348
#define NULLREGION
Definition: wingdi.h:360
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:617
int32_t INT
Definition: typedefs.h:58
#define DCX_INTERSECTRGN
Definition: winuser.h:2105
#define WNDS_PAINTNOTPROCESSED
Definition: ntuser.h:601
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:335
#define UserHMGetHandle(obj)
Definition: ntuser.h:213
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:616
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:591
#define WNDS_SENDERASEBACKGROUND
Definition: ntuser.h:588
#define WNDS_UPDATEDIRTY
Definition: ntuser.h:592
#define WNDS_ERASEBACKGROUND
Definition: ntuser.h:589
#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:1608
#define CS_PARENTDC
Definition: winuser.h:651
struct Rect Rect

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

◆ IntEndPaint()

BOOL FASTCALL IntEndPaint ( PWND  ,
PPAINTSTRUCT   
)

Definition at line 1530 of file painting.c.

1531 {
1532  HDC hdc = NULL;
1533 
1534  hdc = Ps->hdc;
1535 
1536  UserReleaseDC(Wnd, hdc, TRUE);
1537 
1538  if (Wnd->state2 & WNDS2_ENDPAINTINVALIDATE)
1539  {
1540  ERR("EP: Another thread invalidated this window\n");
1541  Wnd->state2 &= ~WNDS2_ENDPAINTINVALIDATE;
1542  }
1543 
1544  Wnd->state2 &= ~(WNDS2_WMPAINTSENT|WNDS2_STARTPAINT);
1545 
1546  co_UserShowCaret(Wnd);
1547 
1548  return TRUE;
1549 }
#define TRUE
Definition: types.h:120
static HDC
Definition: imagelist.c:92
#define WNDS2_STARTPAINT
Definition: ntuser.h:617
#define WNDS2_ENDPAINTINVALIDATE
Definition: ntuser.h:616
#define WNDS2_WMPAINTSENT
Definition: ntuser.h:615
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:917

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

◆ IntFlashWindowEx()

BOOL FASTCALL IntFlashWindowEx ( PWND  ,
PFLASHWINFO   
)

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:12
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
#define FLASHW_SYSTIMER
Definition: painting.h:4
#define WS_DLGFRAME
Definition: pedump.c:626
PSERVERINFO gpsi
Definition: main.c:27
#define FLASHW_KILLSYSTIMER
Definition: painting.h:8
#define FALSE
Definition: types.h:117
#define WM_NCACTIVATE
Definition: winuser.h:1671
unsigned int BOOL
Definition: ntddk_ex.h:94
#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:213
#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:585
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define WS_BORDER
Definition: pedump.c:625
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

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

◆ 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:220
#define TRUE
Definition: types.h:120
#define WNDS2_STARTPAINT
Definition: ntuser.h:617
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define TIF_SYSTEMTHREAD
Definition: ntuser.h:247
Definition: window.c:28
#define FALSE
Definition: types.h:117
#define UserHMGetHandle(obj)
Definition: ntuser.h:213
HRGN hrgnUpdate
Definition: ntuser.h:691
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2652
#define WM_PAINT
Definition: winuser.h:1603
VOID FASTCALL MsqDecPaintCountQueue(PTHREADINFO pti)
Definition: msgqueue.c:508
CHAR Message[80]
Definition: alive.c:5
PWND FASTCALL UserGetDesktopWindow(VOID)
Definition: desktop.c:1353
#define WNDS2_WMPAINTSENT
Definition: ntuser.h:615
#define ERR(fmt,...)
Definition: debug.h:110
Definition: ntuser.h:663
DWORD state
Definition: ntuser.h:671
#define NULL
Definition: types.h:112
#define WNDS_INTERNALPAINT
Definition: ntuser.h:591
#define WNDS_UPDATEDIRTY
Definition: ntuser.h:592
DWORD state2
Definition: ntuser.h:672
BOOL FASTCALL IntIsChildWindow(PWND Parent, PWND BaseWindow)
Definition: window.c:882

Referenced by co_IntPeekMessage().

◆ IntIntersectWithParents()

BOOL FASTCALL IntIntersectWithParents ( PWND  ,
RECTL  
)

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:674
#define TRUE
Definition: types.h:120
RECT rcClient
Definition: ntuser.h:687
#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:663
#define NULL
Definition: types.h:112
struct _WND * spwndParent
Definition: ntuser.h:683
#define WS_VISIBLE
Definition: pedump.c:620
DWORD style
Definition: ntuser.h:676

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

◆ IntInvalidateWindows()

VOID FASTCALL IntInvalidateWindows ( PWND  Window,
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)
730  Wnd->state2 |= WNDS2_ENDPAINTINVALIDATE;
731  }
732 
733  if (Flags & RDW_FRAME)
734  Wnd->state |= WNDS_SENDNCPAINT;
735 
736  if (Flags & RDW_ERASE)
737  Wnd->state |= WNDS_SENDERASEBACKGROUND;
738 
739  if (RgnType != NULLREGION && Rgn > PRGN_WINDOW)
740  {
741  if (Wnd->hrgnUpdate == NULL)
742  {
743  Wnd->hrgnUpdate = NtGdiCreateRectRgn(0, 0, 0, 0);
744  IntGdiSetRegionOwner(Wnd->hrgnUpdate, GDI_OBJ_HMGR_PUBLIC);
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  {
756  IntGdiSetRegionOwner(Wnd->hrgnUpdate, GDI_OBJ_HMGR_POWNED);
757  GreDeleteObject(Wnd->hrgnUpdate);
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  {
803  IntGdiSetRegionOwner(Wnd->hrgnUpdate, GDI_OBJ_HMGR_POWNED);
804  GreDeleteObject(Wnd->hrgnUpdate);
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:1203
#define RDW_NOCHILDREN
Definition: winuser.h:1208
__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:590
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
#define NULLREGION
Definition: wingdi.h:360
BOOL FASTCALL REGION_bOffsetRgn(_Inout_ PREGION prgn, _In_ INT cx, _In_ INT cy)
Definition: region.c:2727
#define RDW_FRAME
Definition: winuser.h:1198
#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:355
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
#define HRGN_WINDOW
Definition: ntuser.h:335
#define RGN_OR
Definition: wingdi.h:358
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:1197
BOOL FASTCALL IntGdiSetRegionOwner(HRGN hRgn, DWORD OwnerMask)
Definition: region.c:2478
#define WNDS2_ENDPAINTINVALIDATE
Definition: ntuser.h:616
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:1204
#define WNDS2_WMPAINTSENT
Definition: ntuser.h:615
#define RDW_INTERNALPAINT
Definition: winuser.h:1199
#define RDW_NOERASE
Definition: winuser.h:1201
#define GDI_OBJ_HMGR_POWNED
Definition: ntgdihdl.h:117
#define RDW_NOFRAME
Definition: winuser.h:1202
#define RGN_COPY
Definition: wingdi.h:356
Definition: ntuser.h:663
#define RGN_DIFF
Definition: wingdi.h:357
#define RDW_ALLCHILDREN
Definition: winuser.h:1207
#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:587
#define WNDS_INTERNALPAINT
Definition: ntuser.h:591
#define WNDS_SENDERASEBACKGROUND
Definition: ntuser.h:588
#define WNDS_UPDATEDIRTY
Definition: ntuser.h:592
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:589
#define WS_VISIBLE
Definition: pedump.c:620
VOID FASTCALL REGION_Delete(PREGION pRgn)
Definition: region.c:2468
#define RDW_INVALIDATE
Definition: winuser.h:1200

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

◆ IntIsWindowDirty()

BOOL FASTCALL IntIsWindowDirty ( PWND  )

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 }
#define NULL
Definition: types.h:112
#define WNDS_INTERNALPAINT
Definition: ntuser.h:591
#define WS_VISIBLE
Definition: pedump.c:620

Referenced by IntFindWindowToRepaint(), and IntInvalidateWindows().

◆ IntIsWindowDrawable()

BOOL FASTCALL IntIsWindowDrawable ( PWND  )

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:663
DWORD state
Definition: ntuser.h:671
#define NULL
Definition: types.h:112
struct _WND * spwndParent
Definition: ntuser.h:683
DWORD state2
Definition: ntuser.h:672
#define WS_VISIBLE
Definition: pedump.c:620
#define WNDS_DESTROYED
Definition: ntuser.h:610
#define WNDS2_INDESTROY
Definition: ntuser.h:622
DWORD style
Definition: ntuser.h:676

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

◆ IntPaintWindow()

VOID FASTCALL IntPaintWindow ( PWND  )

Definition at line 1177 of file painting.c.

1178 {
1179  // Handle normal painting.
1181 }
#define RDW_NOCHILDREN
Definition: winuser.h:1208
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().

◆ IntSendNCPaint()

VOID FASTCALL IntSendNCPaint ( PWND  ,
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 
360  if (pWnd->state2 & WNDS2_FORCEFULLNCPAINTCLIPRGN)
361  {
362  pWnd->state2 &= ~WNDS2_FORCEFULLNCPAINTCLIPRGN;
363  hRgn = HRGN_WINDOW;
364  }
365 
367 }
#define WNDS_SENDNCPAINT
Definition: ntuser.h:590
static HRGN hRgn
Definition: mapping.c:33
UINT_PTR WPARAM
Definition: windef.h:207
struct _THREADINFO * GetW32ThreadInfo(VOID)
Definition: misc.c:782
#define WM_NCPAINT
Definition: winuser.h:1670
#define HRGN_WINDOW
Definition: ntuser.h:335
#define UserHMGetHandle(obj)
Definition: ntuser.h:213
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1446
#define WNDS_ACTIVEFRAME
Definition: ntuser.h:585
#define WNDS2_FORCEFULLNCPAINTCLIPRGN
Definition: ntuser.h:638
#define WNDS_NONCPAINT
Definition: ntuser.h:587

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

◆ IntSendSyncPaint()

VOID FASTCALL IntSendSyncPaint ( PWND  ,
ULONG   
)

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 &&
146  Wnd->state & WNDS_SENDERASEBACKGROUND &&
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.
176  Wnd->state |= WNDS_SYNCPAINTPENDING;
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:1673
#define RDW_NOCHILDREN
Definition: winuser.h:1208
struct _Entry Entry
Definition: kefuncs.h:627
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:220
#define TRUE
Definition: types.h:120
VOID FASTCALL IntSendSyncPaint(PWND Wnd, ULONG Flags)
Definition: painting.c:132
#define WNDS_SENDNCPAINT
Definition: ntuser.h:590
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:101
THRDESKHEAD head
Definition: ntuser.h:665
struct _WND * spwndNext
Definition: ntuser.h:681
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:213
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:602
Definition: typedefs.h:119
#define ERR(fmt,...)
Definition: debug.h:110
Definition: ntuser.h:663
#define RDW_ALLCHILDREN
Definition: winuser.h:1207
LRESULT FASTCALL co_IntSendMessageNoWait(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1710
#define WNDS_SENDERASEBACKGROUND
Definition: ntuser.h:588
struct _WND * spwndChild
Definition: ntuser.h:684
#define WS_VISIBLE
Definition: pedump.c:620
base of all file and directory entries
Definition: entries.h:82
DWORD style
Definition: ntuser.h:676

Referenced by IntSendSyncPaint(), and UserSyncAndPaintWindows().

◆ NC_IconForWindow()

PCURICON_OBJECT FASTCALL NC_IconForWindow ( PWND  )

Definition at line 681 of file nonclient.c.

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

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

◆ UpdateThreadWindows()

VOID FASTCALL UpdateThreadWindows ( PWND  ,
PTHREADINFO  ,
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:2194
#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:665
struct _WND * spwndNext
Definition: ntuser.h:681
Definition: ntuser.h:663
BOOL FASTCALL IsThreadSuspended(PTHREADINFO pti)
Definition: msgqueue.c:2225
#define RDW_ALLCHILDREN
Definition: winuser.h:1207
VOID FASTCALL UpdateTheadChildren(PWND pWnd, HRGN hRgn)
Definition: painting.c:1077

Referenced by DefWndDoSizeMove().

◆ UserDrawCaption()

BOOL UserDrawCaption ( PWND  ,
HDC  ,
RECTL ,
HFONT  ,
HICON  ,
const  PUNICODE_STRING,
UINT   
)

Definition at line 2194 of file painting.c.

2202 {
2203  BOOL Ret = FALSE;
2204  HBRUSH hBgBrush, hOldBrush = NULL;
2205  RECTL Rect = *lpRc;
2206  BOOL HasIcon;
2207 
2208  RECTL_vMakeWellOrdered(lpRc);
2209 
2210  /* Determine whether the icon needs to be displayed */
2211  if (!hIcon && pWnd != NULL)
2212  {
2213  HasIcon = (uFlags & DC_ICON) && !(uFlags & DC_SMALLCAP) &&
2214  (pWnd->style & WS_SYSMENU) && !(pWnd->ExStyle & WS_EX_TOOLWINDOW);
2215  }
2216  else
2217  HasIcon = (hIcon != NULL);
2218 
2219  // Draw the caption background
2220  if((uFlags & DC_GRADIENT) && !(uFlags & DC_INBUTTON))
2221  {
2222  static GRADIENT_RECT gcap = {0, 1};
2223  TRIVERTEX Vertices[2];
2224  COLORREF Colors[2];
2225 
2228 
2231 
2232  Vertices[0].x = Rect.left;
2233  Vertices[0].y = Rect.top;
2234  Vertices[0].Red = (WORD)Colors[0]<<8;
2235  Vertices[0].Green = (WORD)Colors[0] & 0xFF00;
2236  Vertices[0].Blue = (WORD)(Colors[0]>>8) & 0xFF00;
2237  Vertices[0].Alpha = 0;
2238 
2239  Vertices[1].x = Rect.right;
2240  Vertices[1].y = Rect.bottom;
2241  Vertices[1].Red = (WORD)Colors[1]<<8;
2242  Vertices[1].Green = (WORD)Colors[1] & 0xFF00;
2243  Vertices[1].Blue = (WORD)(Colors[1]>>8) & 0xFF00;
2244  Vertices[1].Alpha = 0;
2245 
2246  if(!GreGradientFill(hDc, Vertices, 2, &gcap, 1, GRADIENT_FILL_RECT_H))
2247  {
2248  ERR("GreGradientFill() failed!\n");
2249  goto cleanup;
2250  }
2251  }
2252  else
2253  {
2254  if(uFlags & DC_INBUTTON)
2255  hBgBrush = IntGetSysColorBrush(COLOR_3DFACE);
2256  else if(uFlags & DC_ACTIVE)
2258  else
2260 
2261  hOldBrush = NtGdiSelectBrush(hDc, hBgBrush);
2262 
2263  if(!hOldBrush)
2264  {
2265  ERR("NtGdiSelectBrush() failed!\n");
2266  goto cleanup;
2267  }
2268 
2269  if(!NtGdiPatBlt(hDc, Rect.left, Rect.top,
2270  Rect.right - Rect.left,
2271  Rect.bottom - Rect.top,
2272  PATCOPY))
2273  {
2274  ERR("NtGdiPatBlt() failed!\n");
2275  goto cleanup;
2276  }
2277  }
2278 
2279  /* Draw icon */
2280  if (HasIcon)
2281  {
2282  PCURICON_OBJECT pIcon = NULL;
2283 
2284  if (hIcon)
2285  {
2286  pIcon = UserGetCurIconObject(hIcon);
2287  }
2288  else if (pWnd)
2289  {
2290  pIcon = NC_IconForWindow(pWnd);
2291  // FIXME: NC_IconForWindow should reference it for us */
2292  if (pIcon)
2293  UserReferenceObject(pIcon);
2294  }
2295 
2296  if (pIcon)
2297  {
2300  LONG x = Rect.left - cx/2 + 1 + (Rect.bottom - Rect.top)/2; // this is really what Window does
2301  LONG y = (Rect.top + Rect.bottom - cy)/2; // center
2302  UserDrawIconEx(hDc, x, y, pIcon, cx, cy, 0, NULL, DI_NORMAL);
2303  UserDereferenceObject(pIcon);
2304  }
2305  else
2306  {
2307  HasIcon = FALSE;
2308  }
2309  }
2310 
2311  if (HasIcon)
2312  Rect.left += Rect.bottom - Rect.top;
2313 
2314  if((uFlags & DC_TEXT))
2315  {
2316  BOOL Set = FALSE;
2317  Rect.left += 2;
2318 
2319  if (Str)
2320  Set = UserDrawCaptionText(pWnd, hDc, Str, &Rect, uFlags, hFont);
2321  else if (pWnd != NULL) // FIXME: Windows does not do that
2322  {
2323  UNICODE_STRING ustr;
2324  ustr.Buffer = pWnd->strName.Buffer; // FIXME: LARGE_STRING truncated!
2325  ustr.Length = (USHORT)min(pWnd->strName.Length, MAXUSHORT);
2326  ustr.MaximumLength = (USHORT)min(pWnd->strName.MaximumLength, MAXUSHORT);
2327  Set = UserDrawCaptionText(pWnd, hDc, &ustr, &Rect, uFlags, hFont);
2328  }
2329  if (pWnd)
2330  {
2331  if (Set)
2332  pWnd->state2 &= ~WNDS2_CAPTIONTEXTTRUNCATED;
2333  else
2334  pWnd->state2 |= WNDS2_CAPTIONTEXTTRUNCATED;
2335  }
2336  }
2337 
2338  Ret = TRUE;
2339 
2340 cleanup:
2341  if (hOldBrush) NtGdiSelectBrush(hDc, hOldBrush);
2342 
2343  return Ret;
2344 }
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:980
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:906
#define SM_CYSMICON
Definition: winuser.h:1003
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
BOOL FASTCALL UserDereferenceObject(PVOID Object)
Definition: object.c:610
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:2784
#define COLOR_3DFACE
Definition: winuser.h:919
#define COLOR_GRADIENTINACTIVECAPTION
Definition: winuser.h:935
#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:2088
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:905
BOOL NTAPI GreGradientFill(HDC hdc, PTRIVERTEX pVertex, ULONG nVertex, PVOID pMesh, ULONG nMesh, ULONG ulMode)
Definition: fillshap.c:871
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:180
LONG x
Definition: wingdi.h:2783
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:934
#define SM_CXSMICON
Definition: winuser.h:1002
#define DI_NORMAL
Definition: wingdi.h:72
#define PATCOPY
Definition: wingdi.h:334
#define ERR(fmt,...)
Definition: debug.h:110
COLOR16 Alpha
Definition: wingdi.h:2788
#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:640
_Out_opt_ int * cx
Definition: commctrl.h:585
COLOR16 Red
Definition: wingdi.h:2785
COLOR16 Blue
Definition: wingdi.h:2787
char * cleanup(char *str)
Definition: wpickclick.c:99
COLOR16 Green
Definition: wingdi.h:2786
#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:697
#define DC_INBUTTON
Definition: winuser.h:431

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

◆ UserRealizePalette()

INT FASTCALL UserRealizePalette ( HDC  )

Definition at line 2348 of file painting.c.

2349 {
2350  HWND hWnd, hWndDesktop;
2351  DWORD Ret;
2352 
2353  Ret = IntGdiRealizePalette(hdc);
2354  if (Ret) // There was a change.
2355  {
2357  if (hWnd) // Send broadcast if dc is associated with a window.
2358  { // FYI: Thread locked in CallOneParam.
2359  hWndDesktop = IntGetDesktopWindow();
2360  if ( hWndDesktop != hWnd )
2361  {
2362  PWND pWnd = UserGetWindowObject(hWndDesktop);
2363  ERR("RealizePalette Desktop.");
2364  hdc = UserGetWindowDC(pWnd);
2366  UserReleaseDC(pWnd,hdc,FALSE);
2367  }
2369  }
2370  }
2371  return Ret;
2372 }
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:946
UINT_PTR WPARAM
Definition: windef.h:207
#define FALSE
Definition: types.h:117
BOOL FASTCALL IntPaintDesktop(HDC hDC)
Definition: desktop.c:1795
HWND FASTCALL IntWindowFromDC(HDC hDc)
Definition: windc.c:893
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
#define WM_PALETTECHANGED
Definition: winuser.h:1860
unsigned long DWORD
Definition: ntddk_ex.h:95
HDC hdc
Definition: main.c:9
#define ERR(fmt,...)
Definition: debug.h:110
Definition: ntuser.h:663
HWND FASTCALL IntGetDesktopWindow(VOID)
Definition: desktop.c:1342
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:917
UINT FASTCALL IntGdiRealizePalette(HDC)
Definition: palette.c:731
#define HWND_BROADCAST
Definition: winuser.h:1190

◆ 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:663
#define NULL
Definition: types.h:112
#define WNDS_INTERNALPAINT
Definition: ntuser.h:591

Referenced by co_UserRedrawWindow(), and co_WinPosSetWindowPos().