ReactOS  0.4.14-dev-317-g96040ec
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 391 of file painting.c.

392 {
393  HDC hDC;
394  HWND hWnd = Wnd->head.h;
395  HRGN TempRegion = NULL;
396 
397  Wnd->state &= ~WNDS_PAINTNOTPROCESSED;
398 
399  if (Wnd->state & WNDS_SENDNCPAINT ||
400  Wnd->state & WNDS_SENDERASEBACKGROUND)
401  {
402  if (!(Wnd->style & WS_VISIBLE))
403  {
405  return;
406  }
407  else
408  {
409  if (Wnd->hrgnUpdate == NULL)
410  {
412  }
413 
414  if (Wnd->head.pti == PsGetCurrentThreadWin32Thread())
415  {
416  if (Wnd->state & WNDS_SENDNCPAINT)
417  {
418  TempRegion = IntGetNCUpdateRgn(Wnd, TRUE);
419 
420  IntSendNCPaint(Wnd, TempRegion);
421 
422  if (TempRegion > HRGN_WINDOW && GreIsHandleValid(TempRegion))
423  {
424  /* NOTE: The region can already be deleted! */
425  GreDeleteObject(TempRegion);
426  }
427  }
428 
429  if (Wnd->state & WNDS_SENDERASEBACKGROUND)
430  {
432  if (Wnd->hrgnUpdate)
433  {
434  hDC = UserGetDCEx( Wnd,
435  Wnd->hrgnUpdate,
437 
438  if (Wnd->head.pti->ppi != pti->ppi)
439  {
440  ERR("Sending DC to another Process!!!\n");
441  }
442 
444  // Kill the loop, so Clear before we send.
446  {
448  }
449  UserReleaseDC(Wnd, hDC, FALSE);
450  }
451  }
452  }
453 
454  }
455  }
456 
457  /*
458  * Check that the window is still valid at this point
459  */
460  if (!IntIsWindow(hWnd))
461  {
462  return;
463  }
464 
465  /*
466  * Paint child windows.
467  */
468 
469  if (!(Flags & RDW_NOCHILDREN) &&
470  !(Wnd->style & WS_MINIMIZE) &&
471  ( Flags & RDW_ALLCHILDREN ||
472  (Flags & RDW_CLIPCHILDREN && Wnd->style & WS_CLIPCHILDREN) ) )
473  {
474  HWND *List, *phWnd;
476 
477  if ((List = IntWinListChildren(Wnd)))
478  {
479  for (phWnd = List; *phWnd; ++phWnd)
480  {
481  if ((Wnd = UserGetWindowObject(*phWnd)) == NULL)
482  continue;
483 
484  if (Wnd->head.pti != pti && Wnd->style & WS_CHILD)
485  continue;
486 
487  if (Wnd->style & WS_VISIBLE)
488  {
490  UserRefObjectCo(Wnd, &Ref);
492  UserDerefObjectCo(Wnd);
493  }
494  }
496  }
497  }
498 }
#define RDW_NOCHILDREN
Definition: winuser.h:1208
BOOL NTAPI GreDeleteObject(HGDIOBJ hobj)
Definition: gdiobj.c:1155
#define TRUE
Definition: types.h:120
BOOL NTAPI GreIsHandleValid(HGDIOBJ hobj)
Definition: gdiobj.c:1143
#define WNDS_SENDNCPAINT
Definition: ntuser.h:584
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:2104
PPROCESSINFO ppi
Definition: win32.h:87
#define WNDS_PAINTNOTPROCESSED
Definition: ntuser.h:595
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#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:66
smooth NULL
Definition: ftsmooth.c:416
#define HRGN_WINDOW
Definition: ntuser.h:329
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
LIST_ENTRY List
Definition: psmgr.c:57
VOID FASTCALL co_IntPaintWindows(PWND Wnd, ULONG Flags, BOOL Recurse)
Definition: painting.c:391
BOOL FASTCALL IntIsWindow(HWND hWnd)
Definition: window.c:157
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1281
HWND *FASTCALL IntWinListChildren(PWND Window)
Definition: window.c:255
#define ERR(fmt,...)
Definition: debug.h:109
static HDC hDC
Definition: 3dtext.c:33
#define DCX_CACHE
Definition: winuser.h:2096
#define RDW_ALLCHILDREN
Definition: winuser.h:1207
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:917
#define WNDS_SENDERASEBACKGROUND
Definition: ntuser.h:582
#define RDW_CLIPCHILDREN
Definition: painting.h:15
#define WNDS_ERASEBACKGROUND
Definition: ntuser.h:583
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define WM_ERASEBKGND
Definition: winuser.h:1607
#define USERTAG_WINDOWLIST
Definition: tags.h:297
#define WS_VISIBLE
Definition: pedump.c:620

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 507 of file painting.c.

508 {
509  HWND hWnd = Wnd->head.h;
510 
511  if ( Wnd->hrgnUpdate != NULL || Wnd->state & WNDS_INTERNALPAINT )
512  {
513  if (Wnd->hrgnUpdate)
514  {
515  if (!IntValidateParents(Wnd, Recurse))
516  {
517  return;
518  }
519  }
520 
521  if (Wnd->state & WNDS_INTERNALPAINT)
522  {
523  Wnd->state &= ~WNDS_INTERNALPAINT;
524 
525  if (Wnd->hrgnUpdate == NULL)
526  MsqDecPaintCountQueue(Wnd->head.pti);
527  }
528 
529  Wnd->state |= WNDS_PAINTNOTPROCESSED;
530  Wnd->state &= ~WNDS_UPDATEDIRTY;
531 
532  Wnd->state2 |= WNDS2_WMPAINTSENT;
534 
535  if (Wnd->state & WNDS_PAINTNOTPROCESSED)
536  {
538  UserRefObjectCo(Wnd, &Ref);
540  UserDerefObjectCo(Wnd);
541  }
542  }
543 
544  // Force flags as a toggle. Fixes msg:test_paint_messages:WmChildPaintNc.
545  Flags = (Flags & RDW_NOCHILDREN) ? RDW_NOCHILDREN : RDW_ALLCHILDREN; // All children is the default.
546 
547  /*
548  * Update child windows.
549  */
550 
551  if (!(Flags & RDW_NOCHILDREN) &&
552  (Flags & RDW_ALLCHILDREN) &&
553  !UserIsDesktopWindow(Wnd))
554  {
555  PWND Child;
556 
557  for (Child = Wnd->spwndChild; Child; Child = Child->spwndNext)
558  {
559  /* transparent window, check for non-transparent sibling to paint first, then skip it */
560  if ( Child->ExStyle & WS_EX_TRANSPARENT &&
561  ( Child->hrgnUpdate != NULL || Child->state & WNDS_INTERNALPAINT ) )
562  {
563  PWND Next = Child->spwndNext;
564  while (Next)
565  {
566  if ( Next->hrgnUpdate != NULL || Next->state & WNDS_INTERNALPAINT ) break;
567 
568  Next = Next->spwndNext;
569  }
570 
571  if (Next) continue;
572  }
573 
574  if (Child->style & WS_VISIBLE)
575  {
577  UserRefObjectCo(Child, &Ref);
580  }
581  }
582  }
583 }
#define RDW_NOCHILDREN
Definition: winuser.h:1208
#define TRUE
Definition: types.h:120
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:220
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:595
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:38
Definition: object.h:3
smooth NULL
Definition: ftsmooth.c:416
struct _WND * spwndNext
Definition: ntuser.h:675
VOID FASTCALL co_IntPaintWindows(PWND Wnd, ULONG Flags, BOOL Recurse)
Definition: painting.c:391
HRGN hrgnUpdate
Definition: ntuser.h:685
BOOL FASTCALL IntValidateParents(PWND Child, BOOL Recurse)
Definition: painting.c:62
VOID FASTCALL co_IntUpdateWindows(PWND Wnd, ULONG Flags, BOOL Recurse)
Definition: painting.c:507
#define WM_PAINT
Definition: winuser.h:1602
VOID FASTCALL MsqDecPaintCountQueue(PTHREADINFO pti)
Definition: msgqueue.c:508
#define WNDS2_WMPAINTSENT
Definition: ntuser.h:609
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1281
Definition: ntuser.h:657
#define RDW_ALLCHILDREN
Definition: winuser.h:1207
DWORD state
Definition: ntuser.h:665
#define WNDS_INTERNALPAINT
Definition: ntuser.h:585
#define WNDS_UPDATEDIRTY
Definition: ntuser.h:586
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 ACPI_HANDLE Child
Definition: acpixf.h:722
#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 1842 of file painting.c.

1843 {
1844  INT RegionType;
1845  BOOL Ret = TRUE;
1846 
1847  if (bErase)
1848  {
1850  UserRefObjectCo(Window, &Ref);
1853  }
1854 
1855  Window->state &= ~WNDS_UPDATEDIRTY;
1856 
1857  if (Window->hrgnUpdate == NULL)
1858  {
1859  pRect->left = pRect->top = pRect->right = pRect->bottom = 0;
1860  Ret = FALSE;
1861  }
1862  else
1863  {
1864  /* Get the update region bounding box. */
1865  if (Window->hrgnUpdate == HRGN_WINDOW)
1866  {
1867  *pRect = Window->rcClient;
1868  ERR("GURt: Caller is retrieving Window Region 1\n");
1869  }
1870  else
1871  {
1872  RegionType = IntGdiGetRgnBox(Window->hrgnUpdate, pRect);
1873 
1874  if (RegionType != ERROR && RegionType != NULLREGION)
1875  RECTL_bIntersectRect(pRect, pRect, &Window->rcClient);
1876  }
1877 
1878  if (IntIntersectWithParents(Window, pRect))
1879  {
1881  {
1882  RECTL_vOffsetRect(pRect,
1883  -Window->rcClient.left,
1884  -Window->rcClient.top);
1885  }
1886  if (Window->pcls->style & CS_OWNDC)
1887  {
1888  HDC hdc;
1889  //DWORD layout;
1891  //layout = NtGdiSetLayout(hdc, -1, 0);
1892  //IntMapWindowPoints( 0, Window, (LPPOINT)pRect, 2 );
1893  GreDPtoLP( hdc, (LPPOINT)pRect, 2 );
1894  //NtGdiSetLayout(hdc, -1, layout);
1896  }
1897  }
1898  else
1899  {
1900  pRect->left = pRect->top = pRect->right = pRect->bottom = 0;
1901  }
1902  }
1903  return Ret;
1904 }
#define RDW_NOCHILDREN
Definition: winuser.h:1208
#define TRUE
Definition: types.h:120
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:220
#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:56
Definition: window.c:29
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
smooth NULL
Definition: ftsmooth.c:416
#define HRGN_WINDOW
Definition: ntuser.h:329
BOOL FASTCALL IntIntersectWithParents(PWND Child, RECTL *WindowRect)
Definition: painting.c:35
VOID FASTCALL co_IntPaintWindows(PWND Wnd, ULONG Flags, BOOL Recurse)
Definition: painting.c:391
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:109
FORCEINLINE VOID RECTL_vOffsetRect(_Inout_ RECTL *prcl, _In_ INT cx, _In_ INT cy)
Definition: rect.h:31
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:917
#define WNDS_UPDATEDIRTY
Definition: ntuser.h:586
RegionType

Referenced by NtUserGetUpdateRect().

◆ co_UserGetUpdateRgn()

INT FASTCALL co_UserGetUpdateRgn ( PWND  ,
HRGN  ,
BOOL   
)

Definition at line 1770 of file painting.c.

1771 {
1772  int RegionType;
1773  BOOL Type;
1774  RECTL Rect;
1775 
1777 
1778  if (bErase)
1779  {
1781  UserRefObjectCo(Window, &Ref);
1784  }
1785 
1786  Window->state &= ~WNDS_UPDATEDIRTY;
1787 
1788  if (Window->hrgnUpdate == NULL)
1789  {
1790  NtGdiSetRectRgn(hRgn, 0, 0, 0, 0);
1791  return NULLREGION;
1792  }
1793 
1794  Rect = Window->rcClient;
1796 
1797  if (Window->hrgnUpdate == HRGN_WINDOW)
1798  {
1799  // Trap it out.
1800  ERR("GURn: Caller is passing Window Region 1\n");
1801  if (!Type)
1802  {
1803  NtGdiSetRectRgn(hRgn, 0, 0, 0, 0);
1804  return NULLREGION;
1805  }
1806 
1808 
1810  {
1812  -Window->rcClient.left,
1813  -Window->rcClient.top);
1814  }
1816  }
1817  else
1818  {
1819  HRGN hrgnTemp = GreCreateRectRgnIndirect(&Rect);
1820 
1821  RegionType = NtGdiCombineRgn(hRgn, hrgnTemp, Window->hrgnUpdate, RGN_AND);
1822 
1823  if (RegionType == ERROR || RegionType == NULLREGION)
1824  {
1825  if (hrgnTemp) GreDeleteObject(hrgnTemp);
1826  NtGdiSetRectRgn(hRgn, 0, 0, 0, 0);
1827  return RegionType;
1828  }
1829 
1831  {
1833  -Window->rcClient.left,
1834  -Window->rcClient.top);
1835  }
1836  if (hrgnTemp) GreDeleteObject(hrgnTemp);
1837  }
1838  return RegionType;
1839 }
#define RDW_NOCHILDREN
Definition: winuser.h:1208
BOOL NTAPI GreDeleteObject(HGDIOBJ hobj)
Definition: gdiobj.c:1155
Type
Definition: Type.h:6
#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:29
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
smooth NULL
Definition: ftsmooth.c:416
#define HRGN_WINDOW
Definition: ntuser.h:329
__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:391
#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:109
FORCEINLINE VOID RECTL_vOffsetRect(_Inout_ RECTL *prcl, _In_ INT cx, _In_ INT cy)
Definition: rect.h:31
#define WNDS_UPDATEDIRTY
Definition: ntuser.h:586
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 876 of file painting.c.

881 {
882  PREGION TmpRgn = NULL;
883  TRACE("co_UserRedrawWindow start Rgn %p\n",UpdateRgn);
884 
885  /*
886  * Step 1.
887  * Validation of passed parameters.
888  */
889 
891  {
892  return TRUE; // Just do nothing!!!
893  }
894 
895  if (Window == NULL)
896  {
898  }
899 
900  /*
901  * Step 2.
902  * Transform the parameters UpdateRgn and UpdateRect into
903  * a region hRgn specified in screen coordinates.
904  */
905 
906  if (Flags & (RDW_INVALIDATE | RDW_VALIDATE)) // Both are OKAY!
907  {
908  /* We can't hold lock on GDI objects while doing roundtrips to user mode,
909  * so use a copy instead */
910  if (UpdateRgn)
911  {
912  TmpRgn = IntSysCreateRectpRgn(0, 0, 0, 0);
913 
914  if (UpdateRgn > PRGN_WINDOW)
915  {
916  IntGdiCombineRgn(TmpRgn, UpdateRgn, NULL, RGN_COPY);
917  }
918 
919  if (Window != UserGetDesktopWindow())
920  {
921  REGION_bOffsetRgn(TmpRgn, Window->rcClient.left, Window->rcClient.top);
922  }
923  }
924  else
925  {
926  if (UpdateRect != NULL)
927  {
928  if (Window == UserGetDesktopWindow())
929  {
931  }
932  else
933  {
934  TmpRgn = IntSysCreateRectpRgn(Window->rcClient.left + UpdateRect->left,
935  Window->rcClient.top + UpdateRect->top,
936  Window->rcClient.left + UpdateRect->right,
937  Window->rcClient.top + UpdateRect->bottom);
938  }
939  }
940  else
941  {
944  {
945  if (!RECTL_bIsEmptyRect(&Window->rcWindow))
946  TmpRgn = IntSysCreateRectpRgnIndirect(&Window->rcWindow);
947  }
948  else
949  {
950  if (!RECTL_bIsEmptyRect(&Window->rcClient))
951  TmpRgn = IntSysCreateRectpRgnIndirect(&Window->rcClient);
952  }
953  }
954  }
955  }
956 
957  /* Fixes test RDW_INTERNALPAINT behavior */
958  if (TmpRgn == NULL)
959  {
960  TmpRgn = PRGN_WINDOW; // Need a region so the bits can be set!!!
961  }
962 
963  /*
964  * Step 3.
965  * Adjust the window update region depending on hRgn and flags.
966  */
967 
969  TmpRgn != NULL)
970  {
972  }
973 
974  /*
975  * Step 4.
976  * Repaint and erase windows if needed.
977  */
978 
979  if (Flags & RDW_UPDATENOW)
980  {
982  }
983  else if (Flags & RDW_ERASENOW)
984  {
985  if ((Flags & (RDW_NOCHILDREN|RDW_ALLCHILDREN)) == 0)
987 
989  }
990 
991  /*
992  * Step 5.
993  * Cleanup ;-)
994  */
995 
996  if (TmpRgn > PRGN_WINDOW)
997  {
998  REGION_Delete(TmpRgn);
999  }
1000  TRACE("co_UserRedrawWindow exit\n");
1001 
1002  return TRUE;
1003 }
#define RDW_NOINTERNALPAINT
Definition: winuser.h:1203
#define RDW_NOCHILDREN
Definition: winuser.h:1208
#define TRUE
Definition: types.h:120
VOID FASTCALL UserSyncAndPaintWindows(PWND pWnd, ULONG Flags)
Definition: painting.c:608
#define PRGN_WINDOW
Definition: painting.h:12
BOOL FASTCALL REGION_bOffsetRgn(_Inout_ PREGION prgn, _In_ INT cx, _In_ INT cy)
Definition: region.c:2727
#define RDW_FRAME
Definition: winuser.h:1198
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
Definition: window.c:29
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:586
BOOL FASTCALL IntIsWindowDrawable(PWND Wnd)
Definition: painting.c:849
smooth NULL
Definition: ftsmooth.c:416
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
VOID FASTCALL IntInvalidateWindows(PWND Wnd, PREGION Rgn, ULONG Flags)
Definition: painting.c:630
PWND FASTCALL UserGetDesktopWindow(VOID)
Definition: desktop.c:1349
#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 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 1422 of file painting.c.

1423 {
1424  RECT Rect;
1425  INT type;
1426  BOOL Erase = FALSE;
1427 
1429 
1430  Window->state2 |= WNDS2_STARTPAINT;
1431  Window->state &= ~WNDS_PAINTNOTPROCESSED;
1432 
1433  if (Window->state & WNDS_SENDNCPAINT)
1434  {
1435  HRGN hRgn;
1436  // Application can keep update dirty.
1437  do
1438  {
1439  Window->state &= ~WNDS_UPDATEDIRTY;
1443  {
1444  /* NOTE: The region can already be deleted! */
1446  }
1447  }
1448  while(Window->state & WNDS_UPDATEDIRTY);
1449  }
1450  else
1451  {
1452  Window->state &= ~WNDS_UPDATEDIRTY;
1453  }
1454 
1455  RtlZeroMemory(Ps, sizeof(PAINTSTRUCT));
1456 
1457  if (Window->state2 & WNDS2_ENDPAINTINVALIDATE)
1458  {
1459  ERR("BP: Another thread invalidated this window\n");
1460  }
1461 
1462  Ps->hdc = UserGetDCEx( Window,
1463  Window->hrgnUpdate,
1465  if (!Ps->hdc)
1466  {
1467  return NULL;
1468  }
1469 
1470  // If set, always clear flags out due to the conditions later on for sending the message.
1471  if (Window->state & WNDS_SENDERASEBACKGROUND)
1472  {
1474  Erase = TRUE;
1475  }
1476 
1477  if (Window->hrgnUpdate != NULL)
1478  {
1479  MsqDecPaintCountQueue(Window->head.pti);
1481  /* The region is part of the dc now and belongs to the process! */
1482  Window->hrgnUpdate = NULL;
1483  }
1484  else
1485  {
1486  if (Window->state & WNDS_INTERNALPAINT)
1487  MsqDecPaintCountQueue(Window->head.pti);
1488  }
1489 
1490  type = GdiGetClipBox(Ps->hdc, &Ps->rcPaint);
1491 
1493 
1494  Window->state &= ~WNDS_INTERNALPAINT;
1495 
1496  if ( Erase && // Set to erase,
1497  type != NULLREGION && // don't erase if the clip box is empty,
1498  (!(Window->pcls->style & CS_PARENTDC) || // not parent dc or
1499  RECTL_bIntersectRect( &Rect, &Rect, &Ps->rcPaint) ) ) // intersecting.
1500  {
1501  Ps->fErase = !co_IntSendMessage(UserHMGetHandle(Window), WM_ERASEBKGND, (WPARAM)Ps->hdc, 0);
1502  if ( Ps->fErase )
1503  {
1505  }
1506  }
1507  else
1508  {
1509  Ps->fErase = FALSE;
1510  }
1511 
1513 
1514  return Ps->hdc;
1515 }
BOOL NTAPI GreDeleteObject(HGDIOBJ hobj)
Definition: gdiobj.c:1155
#define TRUE
Definition: types.h:120
BOOL NTAPI GreIsHandleValid(HGDIOBJ hobj)
Definition: gdiobj.c:1143
#define WNDS_SENDNCPAINT
Definition: ntuser.h:584
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
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
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:611
int32_t INT
Definition: typedefs.h:56
#define DCX_INTERSECTRGN
Definition: winuser.h:2104
#define WNDS_PAINTNOTPROCESSED
Definition: ntuser.h:595
Definition: window.c:29
unsigned int BOOL
Definition: ntddk_ex.h:94
HRGN FASTCALL IntGetNCUpdateRgn(PWND Window, BOOL Validate)
Definition: painting.c:260
smooth NULL
Definition: ftsmooth.c:416
#define HRGN_WINDOW
Definition: ntuser.h:329
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
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:610
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:1281
#define GDI_OBJ_HMGR_POWNED
Definition: ntgdihdl.h:117
VOID FASTCALL IntSendChildNCPaint(PWND pWnd)
Definition: painting.c:370
#define ERR(fmt,...)
Definition: debug.h:109
#define WNDS_INTERNALPAINT
Definition: ntuser.h:585
#define WNDS_SENDERASEBACKGROUND
Definition: ntuser.h:582
#define WNDS_UPDATEDIRTY
Definition: ntuser.h:586
#define WNDS_ERASEBACKGROUND
Definition: ntuser.h:583
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
BOOL FASTCALL co_UserHideCaret(PWND Window OPTIONAL)
Definition: caret.c:234
#define WM_ERASEBKGND
Definition: winuser.h:1607
#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 1518 of file painting.c.

1519 {
1520  HDC hdc = NULL;
1521 
1522  hdc = Ps->hdc;
1523 
1524  UserReleaseDC(Wnd, hdc, TRUE);
1525 
1526  if (Wnd->state2 & WNDS2_ENDPAINTINVALIDATE)
1527  {
1528  ERR("EP: Another thread invalidated this window\n");
1529  Wnd->state2 &= ~WNDS2_ENDPAINTINVALIDATE;
1530  }
1531 
1532  Wnd->state2 &= ~(WNDS2_WMPAINTSENT|WNDS2_STARTPAINT);
1533 
1534  co_UserShowCaret(Wnd);
1535 
1536  return TRUE;
1537 }
#define TRUE
Definition: types.h:120
static HDC
Definition: imagelist.c:92
#define WNDS2_STARTPAINT
Definition: ntuser.h:611
smooth NULL
Definition: ftsmooth.c:416
#define WNDS2_ENDPAINTINVALIDATE
Definition: ntuser.h:610
#define WNDS2_WMPAINTSENT
Definition: ntuser.h:609
HDC hdc
Definition: main.c:9
BOOL FASTCALL co_UserShowCaret(PWND Window OPTIONAL)
Definition: caret.c:269
#define ERR(fmt,...)
Definition: debug.h:109
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 1292 of file painting.c.

1293 {
1294  DWORD_PTR FlashState;
1295  UINT uCount = pfwi->uCount;
1296  BOOL Activate = FALSE, Ret = FALSE;
1297 
1298  ASSERT(pfwi);
1299 
1300  FlashState = (DWORD_PTR)UserGetProp(pWnd, AtomFlashWndState, TRUE);
1301 
1302  if (FlashState == FLASHW_FINISHED)
1303  {
1304  // Cycle has finished, kill timer and set this to Stop.
1305  FlashState |= FLASHW_KILLSYSTIMER;
1306  pfwi->dwFlags = FLASHW_STOP;
1307  }
1308  else
1309  {
1310  if (FlashState)
1311  {
1312  if (pfwi->dwFlags == FLASHW_SYSTIMER)
1313  {
1314  // Called from system timer, restore flags, counts and state.
1315  pfwi->dwFlags = LOWORD(FlashState);
1316  uCount = HIWORD(FlashState);
1317  FlashState = MAKELONG(LOWORD(FlashState),0);
1318  }
1319  else
1320  {
1321  // Clean out the trash! Fix SeaMonkey crash after restart.
1322  FlashState = 0;
1323  }
1324  }
1325 
1326  if (FlashState == 0)
1327  { // First time in cycle, setup flash state.
1328  if ( pWnd->state & WNDS_ACTIVEFRAME ||
1329  (pfwi->dwFlags & FLASHW_CAPTION && pWnd->style & (WS_BORDER|WS_DLGFRAME)))
1330  {
1331  FlashState = FLASHW_STARTED|FLASHW_ACTIVE;
1332  }
1333  }
1334 
1335  // Set previous window state.
1336  Ret = !!(FlashState & FLASHW_ACTIVE);
1337 
1338  if ( (pfwi->dwFlags & FLASHW_TIMERNOFG) == FLASHW_TIMERNOFG &&
1339  gpqForeground == pWnd->head.pti->MessageQueue )
1340  {
1341  // Flashing until foreground, set this to Stop.
1342  pfwi->dwFlags = FLASHW_STOP;
1343  }
1344  }
1345 
1346  // Toggle activate flag.
1347  if ( pfwi->dwFlags == FLASHW_STOP )
1348  {
1349  if (gpqForeground && gpqForeground->spwndActive == pWnd)
1350  Activate = TRUE;
1351  else
1352  Activate = FALSE;
1353  }
1354  else
1355  {
1356  Activate = (FlashState & FLASHW_ACTIVE) == 0;
1357  }
1358 
1359  if ( pfwi->dwFlags == FLASHW_STOP || pfwi->dwFlags & FLASHW_CAPTION )
1360  {
1361  co_IntSendMessage(UserHMGetHandle(pWnd), WM_NCACTIVATE, Activate, 0);
1362  }
1363 
1364  // FIXME: Check for a Stop Sign here.
1365  if ( pfwi->dwFlags & FLASHW_TRAY )
1366  {
1367  // Need some shell work here too.
1368  TRACE("FIXME: Flash window no Tray support!\n");
1369  }
1370 
1371  if ( pfwi->dwFlags == FLASHW_STOP )
1372  {
1373  if (FlashState & FLASHW_KILLSYSTIMER)
1374  {
1376  }
1377 
1379  }
1380  else
1381  { // Have a count and started, set timer.
1382  if ( uCount )
1383  {
1384  FlashState |= FLASHW_COUNT;
1385 
1386  if (!(Activate ^ !!(FlashState & FLASHW_STARTED)))
1387  uCount--;
1388 
1389  if (!(FlashState & FLASHW_KILLSYSTIMER))
1390  pfwi->dwFlags |= FLASHW_TIMER;
1391  }
1392 
1393  if (pfwi->dwFlags & FLASHW_TIMER)
1394  {
1395  FlashState |= FLASHW_KILLSYSTIMER;
1396 
1397  IntSetTimer( pWnd,
1399  pfwi->dwTimeout ? pfwi->dwTimeout : gpsi->dtCaretBlink,
1401  TMRF_SYSTEM );
1402  }
1403 
1404  if (FlashState & FLASHW_COUNT && uCount == 0)
1405  {
1406  // Keep spinning? Nothing else to do.
1407  FlashState = FLASHW_FINISHED;
1408  }
1409  else
1410  {
1411  // Save state and flags so this can be restored next time through.
1412  FlashState ^= (FlashState ^ -!!(Activate)) & FLASHW_ACTIVE;
1413  FlashState ^= (FlashState ^ pfwi->dwFlags) & (FLASHW_MASK & ~FLASHW_TIMER);
1414  }
1415  FlashState = MAKELONG(LOWORD(FlashState),uCount);
1416  UserSetProp(pWnd, AtomFlashWndState, (HANDLE)FlashState, TRUE);
1417  }
1418  return Ret;
1419 }
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 TRUE
Definition: types.h:120
#define DWORD_PTR
Definition: treelist.c:76
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 WM_NCACTIVATE
Definition: winuser.h:1670
unsigned int BOOL
Definition: ntddk_ex.h:94
#define MAKELONG(a, b)
Definition: typedefs.h:248
VOID CALLBACK SystemTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
Definition: timer.c:280
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
#define FLASHW_FINISHED
Definition: painting.h:5
#define TRACE(s)
Definition: solgame.cpp:4
#define TMRF_SYSTEM
Definition: timer.h:20
HANDLE FASTCALL UserGetProp(_In_ PWND Window, _In_ ATOM Atom, _In_ BOOLEAN SystemProp)
Definition: prop.c:46
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ID_EVENT_SYSTIMER_FLASHWIN
Definition: timer.h:28
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1281
#define FLASHW_ACTIVE
Definition: painting.h:9
#define WNDS_ACTIVEFRAME
Definition: ntuser.h:579
uint32_t DWORD_PTR
Definition: typedefs.h:63
#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:246
#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 1172 of file painting.c.

1179 {
1180  PWND PaintWnd, StartWnd;
1181 
1182  if ((MsgFilterMin != 0 || MsgFilterMax != 0) &&
1183  (MsgFilterMin > WM_PAINT || MsgFilterMax < WM_PAINT))
1184  return FALSE;
1185 
1186  if (Thread->TIF_flags & TIF_SYSTEMTHREAD )
1187  {
1188  ERR("WM_PAINT is in a System Thread!\n");
1189  }
1190 
1191  StartWnd = UserGetDesktopWindow();
1192  PaintWnd = IntFindWindowToRepaint(StartWnd, Thread);
1193 
1194  Message->hwnd = PaintWnd ? UserHMGetHandle(PaintWnd) : NULL;
1195 
1196  if (Message->hwnd == NULL && Thread->cPaintsReady)
1197  {
1198  // Find note in window.c:"PAINTING BUG".
1199  ERR("WARNING SOMETHING HAS GONE WRONG: Thread marked as containing dirty windows, but no dirty windows found! Counts %u\n",Thread->cPaintsReady);
1200  /* Hack to stop spamming the debug log ! */
1201  Thread->cPaintsReady = 0;
1202  return FALSE;
1203  }
1204 
1205  if (Message->hwnd == NULL)
1206  return FALSE;
1207 
1208  if (!(Window == NULL ||
1209  PaintWnd == Window ||
1210  IntIsChildWindow(Window, PaintWnd))) /* check that it is a child of the specified parent */
1211  return FALSE;
1212 
1213  if (PaintWnd->state & WNDS_INTERNALPAINT)
1214  {
1215  PaintWnd->state &= ~WNDS_INTERNALPAINT;
1216  if (!PaintWnd->hrgnUpdate)
1218  }
1219  PaintWnd->state2 &= ~WNDS2_STARTPAINT;
1220  PaintWnd->state &= ~WNDS_UPDATEDIRTY;
1221 
1222  Window = PaintWnd;
1223  while (Window && !UserIsDesktopWindow(Window))
1224  {
1225  // Role back and check for clip children, do not set if any.
1226  if (Window->spwndParent && !(Window->spwndParent->style & WS_CLIPCHILDREN))
1227  {
1228  PaintWnd->state2 |= WNDS2_WMPAINTSENT;
1229  }
1230  Window = Window->spwndParent;
1231  }
1232 
1233  Message->wParam = Message->lParam = 0;
1234  Message->message = WM_PAINT;
1235  return TRUE;
1236 }
#define TRUE
Definition: types.h:120
PWND FASTCALL IntFindWindowToRepaint(PWND Window, PTHREADINFO Thread)
Definition: painting.c:1122
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:220
#define WNDS2_STARTPAINT
Definition: ntuser.h:611
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define TIF_SYSTEMTHREAD
Definition: ntuser.h:242
Definition: window.c:29
smooth NULL
Definition: ftsmooth.c:416
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
HRGN hrgnUpdate
Definition: ntuser.h:685
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
#define WM_PAINT
Definition: winuser.h:1602
VOID FASTCALL MsqDecPaintCountQueue(PTHREADINFO pti)
Definition: msgqueue.c:508
CHAR Message[80]
Definition: alive.c:5
PWND FASTCALL UserGetDesktopWindow(VOID)
Definition: desktop.c:1349
#define WNDS2_WMPAINTSENT
Definition: ntuser.h:609
#define ERR(fmt,...)
Definition: debug.h:109
Definition: ntuser.h:657
DWORD state
Definition: ntuser.h:665
#define WNDS_INTERNALPAINT
Definition: ntuser.h:585
#define WNDS_UPDATEDIRTY
Definition: ntuser.h:586
DWORD state2
Definition: ntuser.h:666
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:668
#define TRUE
Definition: types.h:120
RECT rcClient
Definition: ntuser.h:681
#define WS_MINIMIZE
Definition: pedump.c:622
smooth NULL
Definition: ftsmooth.c:416
#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:657
struct _WND * spwndParent
Definition: ntuser.h:677
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 ACPI_HANDLE Child
Definition: acpixf.h:722
#define WS_VISIBLE
Definition: pedump.c:620
DWORD style
Definition: ntuser.h:670

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

◆ IntInvalidateWindows()

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

Definition at line 630 of file painting.c.

631 {
632  INT RgnType = NULLREGION;
633  BOOL HadPaintMessage;
634 
635  TRACE("IntInvalidateWindows start Rgn %p\n",Rgn);
636 
637  if ( Rgn > PRGN_WINDOW )
638  {
639  /*
640  * If the nonclient is not to be redrawn, clip the region to the client
641  * rect
642  */
643  if ((Flags & RDW_INVALIDATE) != 0 && (Flags & RDW_FRAME) == 0)
644  {
645  PREGION RgnClient;
646 
647  RgnClient = IntSysCreateRectpRgnIndirect(&Wnd->rcClient);
648  if (RgnClient)
649  {
650  RgnType = IntGdiCombineRgn(Rgn, Rgn, RgnClient, RGN_AND);
651  REGION_Delete(RgnClient);
652  }
653  }
654 
655  /*
656  * Clip the given region with window rectangle (or region)
657  */
658 
659  if (!Wnd->hrgnClip || (Wnd->style & WS_MINIMIZE))
660  {
661  PREGION RgnWindow = IntSysCreateRectpRgnIndirect(&Wnd->rcWindow);
662  if (RgnWindow)
663  {
664  RgnType = IntGdiCombineRgn(Rgn, Rgn, RgnWindow, RGN_AND);
665  REGION_Delete(RgnWindow);
666  }
667  }
668  else
669  {
670  PREGION RgnClip = REGION_LockRgn(Wnd->hrgnClip);
671  if (RgnClip)
672  {
673  REGION_bOffsetRgn(Rgn,
674  -Wnd->rcWindow.left,
675  -Wnd->rcWindow.top);
676  RgnType = IntGdiCombineRgn(Rgn, Rgn, RgnClip, RGN_AND);
677  REGION_bOffsetRgn(Rgn,
678  Wnd->rcWindow.left,
679  Wnd->rcWindow.top);
680  REGION_UnlockRgn(RgnClip);
681  }
682  }
683  }
684  else
685  {
686  RgnType = NULLREGION;
687  }
688 
689  /*
690  * Save current state of pending updates
691  */
692 
693  HadPaintMessage = IntIsWindowDirty(Wnd);
694 
695  /*
696  * Update the region and flags
697  */
698 
699  // The following flags are used to invalidate the window.
701  {
702  if (Flags & RDW_INTERNALPAINT)
703  {
704  Wnd->state |= WNDS_INTERNALPAINT;
705  }
706 
707  if (Flags & RDW_INVALIDATE )
708  {
709  PREGION RgnUpdate;
710 
711  Wnd->state &= ~WNDS_NONCPAINT;
712 
713  /* If not the same thread set it dirty. */
714  if (Wnd->head.pti != PsGetCurrentThreadWin32Thread())
715  {
716  Wnd->state |= WNDS_UPDATEDIRTY;
717  if (Wnd->state2 & WNDS2_WMPAINTSENT)
718  Wnd->state2 |= WNDS2_ENDPAINTINVALIDATE;
719  }
720 
721  if (Flags & RDW_FRAME)
722  Wnd->state |= WNDS_SENDNCPAINT;
723 
724  if (Flags & RDW_ERASE)
725  Wnd->state |= WNDS_SENDERASEBACKGROUND;
726 
727  if (RgnType != NULLREGION && Rgn > PRGN_WINDOW)
728  {
729  if (Wnd->hrgnUpdate == NULL)
730  {
731  Wnd->hrgnUpdate = NtGdiCreateRectRgn(0, 0, 0, 0);
732  IntGdiSetRegionOwner(Wnd->hrgnUpdate, GDI_OBJ_HMGR_PUBLIC);
733  }
734 
735  if (Wnd->hrgnUpdate != HRGN_WINDOW)
736  {
737  RgnUpdate = REGION_LockRgn(Wnd->hrgnUpdate);
738  if (RgnUpdate)
739  {
740  RgnType = IntGdiCombineRgn(RgnUpdate, RgnUpdate, Rgn, RGN_OR);
741  REGION_UnlockRgn(RgnUpdate);
742  if (RgnType == NULLREGION)
743  {
744  IntGdiSetRegionOwner(Wnd->hrgnUpdate, GDI_OBJ_HMGR_POWNED);
745  GreDeleteObject(Wnd->hrgnUpdate);
746  Wnd->hrgnUpdate = NULL;
747  }
748  }
749  }
750  }
751 
752  Flags |= RDW_ERASE|RDW_FRAME; // For children.
753 
754  }
755 
756  if (!HadPaintMessage && IntIsWindowDirty(Wnd))
757  {
758  MsqIncPaintCountQueue(Wnd->head.pti);
759  }
760 
761  } // The following flags are used to validate the window.
763  {
764  if (Wnd->state & WNDS_UPDATEDIRTY && !(Flags & RDW_NOUPDATEDIRTY))
765  return;
766 
768  {
769  Wnd->state &= ~WNDS_INTERNALPAINT;
770  }
771 
772  if (Flags & RDW_VALIDATE)
773  {
774  if (Flags & RDW_NOFRAME)
775  Wnd->state &= ~WNDS_SENDNCPAINT;
776 
777  if (Flags & RDW_NOERASE)
779 
780  if (Wnd->hrgnUpdate > HRGN_WINDOW && RgnType != NULLREGION && Rgn > PRGN_WINDOW)
781  {
782  PREGION RgnUpdate = REGION_LockRgn(Wnd->hrgnUpdate);
783 
784  if (RgnUpdate)
785  {
786  RgnType = IntGdiCombineRgn(RgnUpdate, RgnUpdate, Rgn, RGN_DIFF);
787  REGION_UnlockRgn(RgnUpdate);
788 
789  if (RgnType == NULLREGION)
790  {
791  IntGdiSetRegionOwner(Wnd->hrgnUpdate, GDI_OBJ_HMGR_POWNED);
792  GreDeleteObject(Wnd->hrgnUpdate);
793  Wnd->hrgnUpdate = NULL;
794  }
795  }
796  }
797  // If update is null, do not erase.
798  if (Wnd->hrgnUpdate == NULL)
799  {
801  }
802  }
803 
804  if (HadPaintMessage && !IntIsWindowDirty(Wnd))
805  {
806  MsqDecPaintCountQueue(Wnd->head.pti);
807  }
808  }
809 
810  /*
811  * Process children if needed
812  */
813 
814  if (!(Flags & RDW_NOCHILDREN) &&
815  !(Wnd->style & WS_MINIMIZE) &&
816  ((Flags & RDW_ALLCHILDREN) || !(Wnd->style & WS_CLIPCHILDREN)))
817  {
818  PWND Child;
819 
820  for (Child = Wnd->spwndChild; Child; Child = Child->spwndNext)
821  {
822  if (Child->style & WS_VISIBLE)
823  {
824  /*
825  * Recursive call to update children hrgnUpdate
826  */
827  PREGION RgnTemp = IntSysCreateRectpRgn(0, 0, 0, 0);
828  if (RgnTemp)
829  {
830  if (Rgn > PRGN_WINDOW) IntGdiCombineRgn(RgnTemp, Rgn, 0, RGN_COPY);
831  IntInvalidateWindows(Child, ((Rgn > PRGN_WINDOW)?RgnTemp:Rgn), Flags);
832  REGION_Delete(RgnTemp);
833  }
834  }
835  }
836  }
837  TRACE("IntInvalidateWindows exit\n");
838 }
#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:1155
#define PRGN_WINDOW
Definition: painting.h:12
#define WNDS_SENDNCPAINT
Definition: ntuser.h:584
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:56
#define RGN_AND
Definition: wingdi.h:355
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
PREGION FASTCALL IntSysCreateRectpRgn(INT LeftRect, INT TopRect, INT RightRect, INT BottomRect)
Definition: region.c:2426
#define WS_MINIMIZE
Definition: pedump.c:622
#define RDW_NOUPDATEDIRTY
Definition: painting.h:16
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define HRGN_WINDOW
Definition: ntuser.h:329
#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
#define RDW_ERASE
Definition: winuser.h:1197
BOOL FASTCALL IntGdiSetRegionOwner(HRGN hRgn, DWORD OwnerMask)
Definition: region.c:2478
#define WNDS2_ENDPAINTINVALIDATE
Definition: ntuser.h:610
VOID FASTCALL MsqDecPaintCountQueue(PTHREADINFO pti)
Definition: msgqueue.c:508
VOID FASTCALL IntInvalidateWindows(PWND Wnd, PREGION Rgn, ULONG Flags)
Definition: painting.c:630
#define RDW_VALIDATE
Definition: winuser.h:1204
#define WNDS2_WMPAINTSENT
Definition: ntuser.h:609
#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:657
#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:1106
#define WNDS_NONCPAINT
Definition: ntuser.h:581
#define WNDS_INTERNALPAINT
Definition: ntuser.h:585
#define WNDS_SENDERASEBACKGROUND
Definition: ntuser.h:582
#define WNDS_UPDATEDIRTY
Definition: ntuser.h:586
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:583
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 ACPI_HANDLE Child
Definition: acpixf.h:722
#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 1106 of file painting.c.

1107 {
1108  return ( Wnd->style & WS_VISIBLE &&
1109  ( Wnd->hrgnUpdate != NULL ||
1110  Wnd->state & WNDS_INTERNALPAINT ) );
1111 }
smooth NULL
Definition: ftsmooth.c:416
#define WNDS_INTERNALPAINT
Definition: ntuser.h:585
#define WS_VISIBLE
Definition: pedump.c:620

Referenced by IntFindWindowToRepaint(), and IntInvalidateWindows().

◆ IntIsWindowDrawable()

BOOL FASTCALL IntIsWindowDrawable ( PWND  )

Definition at line 849 of file painting.c.

850 {
851  PWND WndObject;
852 
853  for (WndObject = Wnd; WndObject != NULL; WndObject = WndObject->spwndParent)
854  {
855  if ( WndObject->state2 & WNDS2_INDESTROY ||
856  WndObject->state & WNDS_DESTROYED ||
857  !WndObject ||
858  !(WndObject->style & WS_VISIBLE) ||
859  ((WndObject->style & WS_MINIMIZE) && (WndObject != Wnd)))
860  {
861  return FALSE;
862  }
863  }
864 
865  return TRUE;
866 }
#define TRUE
Definition: types.h:120
#define WS_MINIMIZE
Definition: pedump.c:622
smooth NULL
Definition: ftsmooth.c:416
Definition: ntuser.h:657
DWORD state
Definition: ntuser.h:665
struct _WND * spwndParent
Definition: ntuser.h:677
DWORD state2
Definition: ntuser.h:666
#define WS_VISIBLE
Definition: pedump.c:620
#define WNDS_DESTROYED
Definition: ntuser.h:604
#define WNDS2_INDESTROY
Definition: ntuser.h:616
DWORD style
Definition: ntuser.h:670

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

◆ IntPaintWindow()

VOID FASTCALL IntPaintWindow ( PWND  )

Definition at line 1165 of file painting.c.

1166 {
1167  // Handle normal painting.
1169 }
#define RDW_NOCHILDREN
Definition: winuser.h:1208
Definition: window.c:29
VOID FASTCALL co_IntPaintWindows(PWND Wnd, ULONG Flags, BOOL Recurse)
Definition: painting.c:391

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:584
static HRGN hRgn
Definition: mapping.c:33
UINT_PTR WPARAM
Definition: windef.h:207
struct _THREADINFO * GetW32ThreadInfo(VOID)
Definition: misc.c:781
#define WM_NCPAINT
Definition: winuser.h:1669
#define HRGN_WINDOW
Definition: ntuser.h:329
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1281
#define WNDS_ACTIVEFRAME
Definition: ntuser.h:579
#define WNDS2_FORCEFULLNCPAINTCLIPRGN
Definition: ntuser.h:632
#define WNDS_NONCPAINT
Definition: ntuser.h:581

Referenced by co_IntPaintWindows(), 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:1672
#define RDW_NOCHILDREN
Definition: winuser.h:1208
#define TRUE
Definition: types.h:120
struct _Entry Entry
Definition: kefuncs.h:640
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:220
VOID FASTCALL IntSendSyncPaint(PWND Wnd, ULONG Flags)
Definition: painting.c:132
#define WNDS_SENDNCPAINT
Definition: ntuser.h:584
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
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
unsigned int BOOL
Definition: ntddk_ex.h:94
LIST_ENTRY SentMessagesListHead
Definition: win32.h:99
THRDESKHEAD head
Definition: ntuser.h:659
struct _WND * spwndNext
Definition: ntuser.h:675
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:208
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
#define TRACE(s)
Definition: solgame.cpp:4
CHAR Message[80]
Definition: alive.c:5
#define WNDS_SYNCPAINTPENDING
Definition: ntuser.h:596
Definition: typedefs.h:117
#define ERR(fmt,...)
Definition: debug.h:109
Definition: ntuser.h:657
#define RDW_ALLCHILDREN
Definition: winuser.h:1207
LRESULT FASTCALL co_IntSendMessageNoWait(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1547
#define WNDS_SENDERASEBACKGROUND
Definition: ntuser.h:582
struct _WND * spwndChild
Definition: ntuser.h:678
#define WS_VISIBLE
Definition: pedump.c:620
base of all file and directory entries
Definition: entries.h:82
DWORD style
Definition: ntuser.h:670

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  if (!hIcon) 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
#define TRUE
Definition: types.h:120
PVOID UserGetObjectNoErr(PUSER_HANDLE_TABLE ht, HANDLE handle, HANDLE_TYPE type)
Definition: object.c:448
PSERVERINFO gpsi
Definition: main.c:27
smooth NULL
Definition: ftsmooth.c:416
#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:1019
HICON hIcon
Definition: msconfig.c:44
ATOM atomIconSmProp
Definition: ntuser.h:1018
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 1081 of file painting.c.

1082 {
1083  PWND pwndTemp;
1084 
1085  for ( pwndTemp = pWnd;
1086  pwndTemp;
1087  pwndTemp = pwndTemp->spwndNext )
1088  {
1089  if (pwndTemp->head.pti == pti)
1090  {
1092  }
1093  else
1094  {
1095  if (IsThreadSuspended(pwndTemp->head.pti) || MsqIsHung(pwndTemp->head.pti))
1096  {
1097  UpdateTheadChildren(pwndTemp, hRgn);
1098  }
1099  else
1101  }
1102  }
1103 }
BOOL FASTCALL MsqIsHung(PTHREADINFO pti)
Definition: msgqueue.c:2194
static HRGN hRgn
Definition: mapping.c:33
VOID FASTCALL UserUpdateWindows(PWND pWnd, ULONG Flags)
Definition: painting.c:586
THRDESKHEAD head
Definition: ntuser.h:659
struct _WND * spwndNext
Definition: ntuser.h:675
Definition: ntuser.h:657
BOOL FASTCALL IsThreadSuspended(PTHREADINFO pti)
Definition: msgqueue.c:2206
#define RDW_ALLCHILDREN
Definition: winuser.h:1207
VOID FASTCALL UpdateTheadChildren(PWND pWnd, HRGN hRgn)
Definition: painting.c:1065

Referenced by DefWndDoSizeMove().

◆ UserDrawCaption()

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

Definition at line 2182 of file painting.c.

2190 {
2191  BOOL Ret = FALSE;
2192  HBRUSH hBgBrush, hOldBrush = NULL;
2193  RECTL Rect = *lpRc;
2194  BOOL HasIcon;
2195 
2196  RECTL_vMakeWellOrdered(lpRc);
2197 
2198  /* Determine whether the icon needs to be displayed */
2199  if (!hIcon && pWnd != NULL)
2200  {
2201  HasIcon = (uFlags & DC_ICON) && !(uFlags & DC_SMALLCAP) &&
2202  (pWnd->style & WS_SYSMENU) && !(pWnd->ExStyle & WS_EX_TOOLWINDOW);
2203  }
2204  else
2205  HasIcon = (hIcon != NULL);
2206 
2207  // Draw the caption background
2208  if((uFlags & DC_GRADIENT) && !(uFlags & DC_INBUTTON))
2209  {
2210  static GRADIENT_RECT gcap = {0, 1};
2211  TRIVERTEX Vertices[2];
2212  COLORREF Colors[2];
2213 
2216 
2219 
2220  Vertices[0].x = Rect.left;
2221  Vertices[0].y = Rect.top;
2222  Vertices[0].Red = (WORD)Colors[0]<<8;
2223  Vertices[0].Green = (WORD)Colors[0] & 0xFF00;
2224  Vertices[0].Blue = (WORD)(Colors[0]>>8) & 0xFF00;
2225  Vertices[0].Alpha = 0;
2226 
2227  Vertices[1].x = Rect.right;
2228  Vertices[1].y = Rect.bottom;
2229  Vertices[1].Red = (WORD)Colors[1]<<8;
2230  Vertices[1].Green = (WORD)Colors[1] & 0xFF00;
2231  Vertices[1].Blue = (WORD)(Colors[1]>>8) & 0xFF00;
2232  Vertices[1].Alpha = 0;
2233 
2234  if(!GreGradientFill(hDc, Vertices, 2, &gcap, 1, GRADIENT_FILL_RECT_H))
2235  {
2236  ERR("GreGradientFill() failed!\n");
2237  goto cleanup;
2238  }
2239  }
2240  else
2241  {
2242  if(uFlags & DC_INBUTTON)
2243  hBgBrush = IntGetSysColorBrush(COLOR_3DFACE);
2244  else if(uFlags & DC_ACTIVE)
2246  else
2248 
2249  hOldBrush = NtGdiSelectBrush(hDc, hBgBrush);
2250 
2251  if(!hOldBrush)
2252  {
2253  ERR("NtGdiSelectBrush() failed!\n");
2254  goto cleanup;
2255  }
2256 
2257  if(!NtGdiPatBlt(hDc, Rect.left, Rect.top,
2258  Rect.right - Rect.left,
2259  Rect.bottom - Rect.top,
2260  PATCOPY))
2261  {
2262  ERR("NtGdiPatBlt() failed!\n");
2263  goto cleanup;
2264  }
2265  }
2266 
2267  /* Draw icon */
2268  if (HasIcon)
2269  {
2270  PCURICON_OBJECT pIcon = NULL;
2271 
2272  if (hIcon)
2273  {
2274  pIcon = UserGetCurIconObject(hIcon);
2275  }
2276  else if (pWnd)
2277  {
2278  pIcon = NC_IconForWindow(pWnd);
2279  // FIXME: NC_IconForWindow should reference it for us */
2280  if (pIcon)
2281  UserReferenceObject(pIcon);
2282  }
2283 
2284  if (pIcon)
2285  {
2288  LONG x = Rect.left - cx/2 + 1 + (Rect.bottom - Rect.top)/2; // this is really what Window does
2289  LONG y = (Rect.top + Rect.bottom - cy)/2; // center
2290  UserDrawIconEx(hDc, x, y, pIcon, cx, cy, 0, NULL, DI_NORMAL);
2291  UserDereferenceObject(pIcon);
2292  }
2293  else
2294  {
2295  HasIcon = FALSE;
2296  }
2297  }
2298 
2299  if (HasIcon)
2300  Rect.left += Rect.bottom - Rect.top;
2301 
2302  if((uFlags & DC_TEXT))
2303  {
2304  BOOL Set = FALSE;
2305  Rect.left += 2;
2306 
2307  if (Str)
2308  Set = UserDrawCaptionText(pWnd, hDc, Str, &Rect, uFlags, hFont);
2309  else if (pWnd != NULL) // FIXME: Windows does not do that
2310  {
2311  UNICODE_STRING ustr;
2312  ustr.Buffer = pWnd->strName.Buffer; // FIXME: LARGE_STRING truncated!
2313  ustr.Length = (USHORT)min(pWnd->strName.Length, MAXUSHORT);
2314  ustr.MaximumLength = (USHORT)min(pWnd->strName.MaximumLength, MAXUSHORT);
2315  Set = UserDrawCaptionText(pWnd, hDc, &ustr, &Rect, uFlags, hFont);
2316  }
2317  if (pWnd)
2318  {
2319  if (Set)
2320  pWnd->state2 &= ~WNDS2_CAPTIONTEXTTRUNCATED;
2321  else
2322  pWnd->state2 |= WNDS2_CAPTIONTEXTTRUNCATED;
2323  }
2324  }
2325 
2326  Ret = TRUE;
2327 
2328 cleanup:
2329  if (hOldBrush) NtGdiSelectBrush(hDc, hOldBrush);
2330 
2331  return Ret;
2332 }
BOOL UserDrawIconEx(HDC hDc, INT xLeft, INT yTop, PCURICON_OBJECT pIcon, INT cxWidth, INT cyHeight, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags)
Definition: cursoricon.c:1688
#define TRUE
Definition: types.h:120
__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:919
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 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:2780
#define COLOR_3DFACE
Definition: winuser.h:919
#define COLOR_GRADIENTINACTIVECAPTION
Definition: winuser.h:935
BOOL UserDrawCaptionText(PWND pWnd, HDC hDc, const PUNICODE_STRING Text, const RECTL *lpRc, UINT uFlags, HFONT hFont)
Definition: painting.c:2076
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:581
smooth NULL
Definition: ftsmooth.c:416
#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:2779
DWORD COLORREF
Definition: windef.h:285
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:109
COLOR16 Alpha
Definition: wingdi.h:2784
#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
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define MAXUSHORT
Definition: typedefs.h:81
#define WNDS2_CAPTIONTEXTTRUNCATED
Definition: ntuser.h:634
_Out_opt_ int * cx
Definition: commctrl.h:581
COLOR16 Red
Definition: wingdi.h:2781
COLOR16 Blue
Definition: wingdi.h:2783
char * cleanup(char *str)
Definition: wpickclick.c:99
COLOR16 Green
Definition: wingdi.h:2782
#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 2336 of file painting.c.

2337 {
2338  HWND hWnd, hWndDesktop;
2339  DWORD Ret;
2340 
2341  Ret = IntGdiRealizePalette(hdc);
2342  if (Ret) // There was a change.
2343  {
2345  if (hWnd) // Send broadcast if dc is associated with a window.
2346  { // FYI: Thread locked in CallOneParam.
2347  hWndDesktop = IntGetDesktopWindow();
2348  if ( hWndDesktop != hWnd )
2349  {
2350  PWND pWnd = UserGetWindowObject(hWndDesktop);
2351  ERR("RealizePalette Desktop.");
2352  hdc = UserGetWindowDC(pWnd);
2354  UserReleaseDC(pWnd,hdc,FALSE);
2355  }
2357  }
2358  }
2359  return Ret;
2360 }
BOOL FASTCALL UserSendNotifyMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1874
HWND hWnd
Definition: settings.c:17
HDC FASTCALL UserGetWindowDC(PWND Wnd)
Definition: windc.c:946
UINT_PTR WPARAM
Definition: windef.h:207
BOOL FASTCALL IntPaintDesktop(HDC hDC)
Definition: desktop.c:1791
HWND FASTCALL IntWindowFromDC(HDC hDc)
Definition: windc.c:893
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
#define WM_PALETTECHANGED
Definition: winuser.h:1859
unsigned long DWORD
Definition: ntddk_ex.h:95
HDC hdc
Definition: main.c:9
#define ERR(fmt,...)
Definition: debug.h:109
Definition: ntuser.h:657
HWND FASTCALL IntGetDesktopWindow(VOID)
Definition: desktop.c:1338
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 608 of file painting.c.

609 {
610  PWND Parent = pWnd;
611  // Find parent, if it needs to be painted, leave.
612  while(TRUE)
613  {
614  if ((Parent = Parent->spwndParent) == NULL) break;
615  if ( Parent->style & WS_CLIPCHILDREN ) break;
616  if ( Parent->hrgnUpdate != NULL || Parent->state & WNDS_INTERNALPAINT ) return;
617  }
618 
619  IntSendSyncPaint(pWnd, Flags);
621 }
#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:722
#define WS_CLIPCHILDREN
Definition: pedump.c:619
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
smooth NULL
Definition: ftsmooth.c:416
VOID FASTCALL co_IntPaintWindows(PWND Wnd, ULONG Flags, BOOL Recurse)
Definition: painting.c:391
Definition: ntuser.h:657
#define WNDS_INTERNALPAINT
Definition: ntuser.h:585

Referenced by co_UserRedrawWindow(), and co_WinPosSetWindowPos().