ReactOS  0.4.14-dev-604-gcfdd483
painting.c File Reference
#include <win32k.h>
Include dependency graph for painting.c:

Go to the source code of this file.

Functions

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

Intersect window rectangle with all parent client rectangles.

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

Function Documentation

◆ co_IntPaintWindows()

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

Definition at line 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 ||
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
THRDESKHEAD head
Definition: ntuser.h:659
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
HRGN hrgnUpdate
Definition: ntuser.h:685
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
DWORD state
Definition: ntuser.h:665
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
DWORD style
Definition: ntuser.h:670

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

◆ co_IntUpdateWindows()

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

Definition at line 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 
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
THRDESKHEAD head
Definition: ntuser.h:659
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
DWORD state2
Definition: ntuser.h:666
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:728
struct _WND * spwndChild
Definition: ntuser.h:678
#define WS_VISIBLE
Definition: pedump.c:620

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

◆ co_UserExcludeUpdateRgn()

INT FASTCALL co_UserExcludeUpdateRgn ( HDC  hDC,
PWND  Window 
)

Definition at line 2456 of file painting.c.

2457 {
2458  POINT pt;
2459  RECT rc;
2460 
2461  if (Window->hrgnUpdate)
2462  {
2463  if (Window->hrgnUpdate == HRGN_WINDOW)
2464  {
2465  return NtGdiIntersectClipRect(hDC, 0, 0, 0, 0);
2466  }
2467  else
2468  {
2469  INT ret = ERROR;
2470  HRGN hrgn = NtGdiCreateRectRgn(0,0,0,0);
2471 
2472  if ( hrgn && GreGetDCPoint( hDC, GdiGetDCOrg, &pt) )
2473  {
2475  {
2476  NtGdiOffsetRgn(hrgn, pt.x, pt.y);
2477  }
2478  else
2479  {
2480  HRGN hrgnScreen;
2482  hrgnScreen = NtGdiCreateRectRgn(0,0,0,0);
2483  NtGdiCombineRgn(hrgnScreen, hrgnScreen, pm->hrgnMonitor, RGN_OR);
2484 
2485  NtGdiCombineRgn(hrgn, hrgnScreen, NULL, RGN_COPY);
2486 
2487  GreDeleteObject(hrgnScreen);
2488  }
2489 
2490  NtGdiCombineRgn(hrgn, hrgn, Window->hrgnUpdate, RGN_DIFF);
2491 
2492  NtGdiOffsetRgn(hrgn, -pt.x, -pt.y);
2493 
2495 
2497  }
2498  return ret;
2499  }
2500  }
2501  else
2502  {
2503  return GdiGetClipBox( hDC, &rc);
2504  }
2505 }
__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
__kernel_entry W32KAPI INT APIENTRY NtGdiIntersectClipRect(_In_ HDC hdc, _In_ INT xLeft, _In_ INT yTop, _In_ INT xRight, _In_ INT yBottom)
Definition: cliprgn.c:503
#define pt(x, y)
Definition: drawing.c:79
#define ERROR(name)
Definition: error_private.h:53
__kernel_entry W32KAPI INT APIENTRY NtGdiExtSelectClipRgn(_In_ HDC hdc, _In_opt_ HRGN hrgn, _In_ INT iMode)
static LPMONITOREX pm
Definition: localmon.c:45
#define NULLREGION
Definition: wingdi.h:360
int32_t INT
Definition: typedefs.h:56
Definition: window.c:28
smooth NULL
Definition: ftsmooth.c:416
#define HRGN_WINDOW
Definition: ntuser.h:329
#define RGN_OR
Definition: wingdi.h:358
#define CLIPRGN
Definition: precomp.h:18
__kernel_entry W32KAPI INT APIENTRY NtGdiOffsetRgn(_In_ HRGN hrgn, _In_ INT cx, _In_ INT cy)
Definition: region.c:3981
int ret
BOOL APIENTRY GreGetDCPoint(HDC hDC, UINT iPoint, PPOINTL Point)
Definition: coord.c:1288
static HRGN hrgn
Definition: win.c:55
__kernel_entry W32KAPI INT APIENTRY NtGdiCombineRgn(_In_ HRGN hrgnDst, _In_ HRGN hrgnSrc1, _In_opt_ HRGN hrgnSrc2, _In_ INT iMode)
#define RGN_COPY
Definition: wingdi.h:356
static HDC hDC
Definition: 3dtext.c:33
#define RGN_DIFF
Definition: wingdi.h:357
__kernel_entry W32KAPI INT APIENTRY NtGdiGetRandomRgn(_In_ HDC hdc, _In_ HRGN hrgn, _In_ INT iRgn)
PMONITOR NTAPI UserGetPrimaryMonitor(VOID)
Definition: monitor.c:102

Referenced by NtUserExcludeUpdateRgn().

◆ co_UserGetUpdateRect()

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

Definition at line 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
LONG top
Definition: windef.h:307
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)
LONG left
Definition: windef.h:306
#define CS_OWNDC
Definition: winuser.h:650
LONG right
Definition: windef.h:308
int32_t INT
Definition: typedefs.h:56
Definition: window.c:28
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
LONG bottom
Definition: windef.h:309
RegionType

Referenced by NtUserGetUpdateRect().

◆ co_UserGetUpdateRgn()

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

Definition at line 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:28
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  Window,
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: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: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().

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( UserPainting  )

◆ IntBeginPaint()

HDC FASTCALL IntBeginPaint ( PWND  Window,
PPAINTSTRUCT  Ps 
)

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  {
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:28
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().

◆ IntCalcWindowRgn()

HRGN FASTCALL IntCalcWindowRgn ( PWND  Wnd,
BOOL  Client 
)

Definition at line 209 of file painting.c.

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

Referenced by IntGetNCUpdateRgn().

◆ IntEndPaint()

BOOL FASTCALL IntEndPaint ( PWND  Wnd,
PPAINTSTRUCT  Ps 
)

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");
1530  }
1531 
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
DWORD state2
Definition: ntuser.h:666

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

◆ IntFillWindow()

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

Definition at line 1540 of file painting.c.

1544 {
1545  RECT Rect, Rect1;
1546  INT type;
1547 
1548  if (!pWndParent)
1549  pWndParent = pWnd;
1550 
1551  type = GdiGetClipBox(hDC, &Rect);
1552 
1553  IntGetClientRect(pWnd, &Rect1);
1554 
1555  if ( type != NULLREGION && // Clip box is not empty,
1556  (!(pWnd->pcls->style & CS_PARENTDC) || // not parent dc or
1557  RECTL_bIntersectRect( &Rect, &Rect, &Rect1) ) ) // intersecting.
1558  {
1559  POINT ppt;
1560  INT x = 0, y = 0;
1561 
1562  if (!UserIsDesktopWindow(pWndParent))
1563  {
1564  x = pWndParent->rcClient.left - pWnd->rcClient.left;
1565  y = pWndParent->rcClient.top - pWnd->rcClient.top;
1566  }
1567 
1568  GreSetBrushOrg(hDC, x, y, &ppt);
1569 
1570  if ( hBrush < (HBRUSH)CTLCOLOR_MAX )
1571  hBrush = GetControlColor( pWndParent, pWnd, hDC, HandleToUlong(hBrush) + WM_CTLCOLORMSGBOX);
1572 
1573  FillRect(hDC, &Rect, hBrush);
1574 
1575  GreSetBrushOrg(hDC, ppt.x, ppt.y, NULL);
1576 
1577  return TRUE;
1578  }
1579  else
1580  return FALSE;
1581 }
#define TRUE
Definition: types.h:120
long y
Definition: polytest.cpp:48
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:220
long x
Definition: polytest.cpp:48
#define HandleToUlong(h)
Definition: basetsd.h:79
#define NULLREGION
Definition: wingdi.h:360
LONG top
Definition: windef.h:307
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
RECT rcClient
Definition: ntuser.h:681
LONG left
Definition: windef.h:306
VOID FASTCALL IntGetClientRect(PWND WindowObject, RECTL *Rect)
Definition: winpos.c:91
int32_t INT
Definition: typedefs.h:56
HBRUSH FASTCALL GetControlColor(PWND pwndParent, PWND pwnd, HDC hdc, UINT CtlMsg)
Definition: misc.c:145
UINT style
Definition: ntuser.h:548
smooth NULL
Definition: ftsmooth.c:416
#define WM_CTLCOLORMSGBOX
Definition: winuser.h:1748
BOOL FASTCALL RECTL_bIntersectRect(_Out_ RECTL *prclDst, _In_ const RECTL *prcl1, _In_ const RECTL *prcl2)
Definition: rect.c:55
BOOL FASTCALL GreSetBrushOrg(HDC, INT, INT, LPPOINT)
Definition: dcutil.c:231
#define CTLCOLOR_MAX
Definition: winuser.h:948
static HDC hDC
Definition: 3dtext.c:33
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
#define CS_PARENTDC
Definition: winuser.h:651
struct Rect Rect
PCLS pcls
Definition: ntuser.h:684

Referenced by NtUserFillWindow().

◆ IntFindWindowToRepaint()

PWND FASTCALL IntFindWindowToRepaint ( PWND  Window,
PTHREADINFO  Thread 
)

Definition at line 1122 of file painting.c.

1123 {
1124  PWND hChild;
1125  PWND TempWindow;
1126 
1127  for (; Window != NULL; Window = Window->spwndNext)
1128  {
1130  {
1131  if (IntIsWindowDirty(Window))
1132  {
1133  /* Make sure all non-transparent siblings are already drawn. */
1134  if (Window->ExStyle & WS_EX_TRANSPARENT)
1135  {
1136  for (TempWindow = Window->spwndNext; TempWindow != NULL;
1137  TempWindow = TempWindow->spwndNext)
1138  {
1139  if (!(TempWindow->ExStyle & WS_EX_TRANSPARENT) &&
1140  IntWndBelongsToThread(TempWindow, Thread) &&
1141  IntIsWindowDirty(TempWindow))
1142  {
1143  return TempWindow;
1144  }
1145  }
1146  }
1147  return Window;
1148  }
1149  }
1150  /* find a child of the specified window that needs repainting */
1151  if (Window->spwndChild)
1152  {
1153  hChild = IntFindWindowToRepaint(Window->spwndChild, Thread);
1154  if (hChild != NULL)
1155  return hChild;
1156  }
1157  }
1158  return Window;
1159 }
DWORD ExStyle
Definition: ntuser.h:668
PWND FASTCALL IntFindWindowToRepaint(PWND Window, PTHREADINFO Thread)
Definition: painting.c:1122
#define IntWndBelongsToThread(WndObj, W32Thread)
Definition: window.h:31
static HTREEITEM hChild
Definition: treeview.c:381
#define WS_EX_TRANSPARENT
Definition: pedump.c:649
Definition: window.c:28
smooth NULL
Definition: ftsmooth.c:416
struct _WND * spwndNext
Definition: ntuser.h:675
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
int Window
Definition: x11stubs.h:26
Definition: ntuser.h:657
BOOL FASTCALL IntIsWindowDirty(PWND Wnd)
Definition: painting.c:1106

Referenced by IntGetPaintMessage().

◆ IntFlashWindowEx()

BOOL FASTCALL IntFlashWindowEx ( PWND  pWnd,
PFLASHWINFO  pfwi 
)

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
THRDESKHEAD head
Definition: ntuser.h:659
#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
DWORD state
Definition: ntuser.h:665
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
DWORD style
Definition: ntuser.h:670

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

◆ IntGetNCUpdateRgn()

HRGN FASTCALL IntGetNCUpdateRgn ( PWND  Window,
BOOL  Validate 
)

Definition at line 260 of file painting.c.

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

Referenced by co_IntPaintWindows(), and IntBeginPaint().

◆ IntGetPaintMessage()

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

Definition at line 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:28
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  Child,
RECTL WindowRect 
)

Definition at line 35 of file painting.c.

36 {
37  PWND ParentWnd;
38 
39  if (Child->ExStyle & WS_EX_REDIRECTED)
40  return TRUE;
41 
42  ParentWnd = Child->spwndParent;
43  while (ParentWnd != NULL)
44  {
45  if (!(ParentWnd->style & WS_VISIBLE) ||
46  (ParentWnd->style & WS_MINIMIZE) ||
47  !RECTL_bIntersectRect(WindowRect, WindowRect, &ParentWnd->rcClient) )
48  {
49  return FALSE;
50  }
51 
52  if (ParentWnd->ExStyle & WS_EX_REDIRECTED)
53  return TRUE;
54 
55  ParentWnd = ParentWnd->spwndParent;
56  }
57 
58  return TRUE;
59 }
DWORD ExStyle
Definition: ntuser.h: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:728
#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  Wnd,
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)
719  }
720 
721  if (Flags & RDW_FRAME)
722  Wnd->state |= WNDS_SENDNCPAINT;
723 
724  if (Flags & RDW_ERASE)
726 
727  if (RgnType != NULLREGION && Rgn > PRGN_WINDOW)
728  {
729  if (Wnd->hrgnUpdate == NULL)
730  {
731  Wnd->hrgnUpdate = NtGdiCreateRectRgn(0, 0, 0, 0);
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  {
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  {
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
LONG top
Definition: windef.h:307
BOOL FASTCALL REGION_bOffsetRgn(_Inout_ PREGION prgn, _In_ INT cx, _In_ INT cy)
Definition: region.c:2727
RECT rcClient
Definition: ntuser.h:681
#define RDW_FRAME
Definition: winuser.h:1198
LONG left
Definition: windef.h:306
#define WS_CLIPCHILDREN
Definition: pedump.c:619
PREGION FASTCALL REGION_LockRgn(_In_ HRGN hrgn)
Definition: region.c:2377
int32_t INT
Definition: typedefs.h: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
THRDESKHEAD head
Definition: ntuser.h:659
smooth NULL
Definition: ftsmooth.c:416
HRGN hrgnClip
Definition: ntuser.h:697
#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
HRGN hrgnUpdate
Definition: ntuser.h:685
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
RECT rcWindow
Definition: ntuser.h:680
#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
DWORD state
Definition: ntuser.h:665
#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
DWORD state2
Definition: ntuser.h:666
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:728
struct _WND * spwndChild
Definition: ntuser.h:678
#define WS_VISIBLE
Definition: pedump.c:620
VOID FASTCALL REGION_Delete(PREGION pRgn)
Definition: region.c:2468
#define RDW_INVALIDATE
Definition: winuser.h:1200
DWORD style
Definition: ntuser.h:670

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

◆ IntIsWindowDirty()

BOOL FASTCALL IntIsWindowDirty ( PWND  Wnd)

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
HRGN hrgnUpdate
Definition: ntuser.h:685
DWORD state
Definition: ntuser.h:665
#define WNDS_INTERNALPAINT
Definition: ntuser.h:585
#define WS_VISIBLE
Definition: pedump.c:620
DWORD style
Definition: ntuser.h:670

Referenced by IntFindWindowToRepaint(), and IntInvalidateWindows().

◆ IntIsWindowDrawable()

BOOL FASTCALL IntIsWindowDrawable ( PWND  Wnd)

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  Window)

Definition at line 1165 of file painting.c.

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

Referenced by IntDispatchMessage().

◆ IntPrintWindow()

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

Definition at line 1240 of file painting.c.

1244 {
1245  HDC hdcSrc;
1246  INT cx, cy, xSrc, ySrc;
1247 
1248  if ( nFlags & PW_CLIENTONLY)
1249  {
1250  cx = pwnd->rcClient.right - pwnd->rcClient.left;
1251  cy = pwnd->rcClient.bottom - pwnd->rcClient.top;
1252  xSrc = pwnd->rcClient.left - pwnd->rcWindow.left;
1253  ySrc = pwnd->rcClient.top - pwnd->rcWindow.top;
1254  }
1255  else
1256  {
1257  cx = pwnd->rcWindow.right - pwnd->rcWindow.left;
1258  cy = pwnd->rcWindow.bottom - pwnd->rcWindow.top;
1259  xSrc = 0;
1260  ySrc = 0;
1261  }
1262 
1263  // TODO: Setup Redirection for Print.
1264  return FALSE;
1265 
1266  /* Update the window just incase. */
1268 
1270  /* Print window to printer context. */
1271  NtGdiBitBlt( hdcBlt,
1272  0,
1273  0,
1274  cx,
1275  cy,
1276  hdcSrc,
1277  xSrc,
1278  ySrc,
1279  SRCCOPY,
1280  0,
1281  0);
1282 
1283  UserReleaseDC( pwnd, hdcSrc, FALSE);
1284 
1285  // TODO: Release Redirection from Print.
1286 
1287  return TRUE;
1288 }
#define TRUE
Definition: types.h:120
static HDC
Definition: imagelist.c:92
LONG top
Definition: windef.h:307
HDC FASTCALL UserGetDCEx(PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
RECT rcClient
Definition: ntuser.h:681
LONG left
Definition: windef.h:306
static HDC hdcSrc
Definition: xlate.c:32
LONG right
Definition: windef.h:308
int32_t INT
Definition: typedefs.h:56
#define DCX_WINDOW
Definition: winuser.h:2095
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:581
smooth NULL
Definition: ftsmooth.c:416
__kernel_entry W32KAPI BOOL APIENTRY NtGdiBitBlt(_In_ HDC hdcDst, _In_ INT x, _In_ INT y, _In_ INT cx, _In_ INT cy, _In_opt_ HDC hdcSrc, _In_ INT xSrc, _In_ INT ySrc, _In_ DWORD rop4, _In_ DWORD crBackColor, _In_ FLONG fl)
VOID FASTCALL co_IntUpdateWindows(PWND Wnd, ULONG Flags, BOOL Recurse)
Definition: painting.c:507
RECT rcWindow
Definition: ntuser.h:680
#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
_Out_opt_ int * cx
Definition: commctrl.h:581
LONG bottom
Definition: windef.h:309
#define SRCCOPY
Definition: wingdi.h:332

Referenced by NtUserPrintWindow().

◆ IntSendChildNCPaint()

VOID FASTCALL IntSendChildNCPaint ( PWND  pWnd)

Definition at line 370 of file painting.c.

371 {
372  for (pWnd = pWnd->spwndChild; pWnd; pWnd = pWnd->spwndNext)
373  {
374  if ((pWnd->hrgnUpdate == NULL) && (pWnd->state & WNDS_SENDNCPAINT))
375  {
377  UserRefObjectCo(pWnd, &Ref);
379  UserDerefObjectCo(pWnd);
380  }
381  }
382 }
#define WNDS_SENDNCPAINT
Definition: ntuser.h:584
VOID FASTCALL IntSendNCPaint(PWND pWnd, HRGN hRgn)
Definition: painting.c:348
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:25
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:38
Definition: object.h:3
smooth NULL
Definition: ftsmooth.c:416
#define HRGN_WINDOW
Definition: ntuser.h:329
struct _WND * spwndNext
Definition: ntuser.h:675
HRGN hrgnUpdate
Definition: ntuser.h:685
DWORD state
Definition: ntuser.h:665
struct _WND * spwndChild
Definition: ntuser.h:678

Referenced by IntBeginPaint().

◆ IntSendNCPaint()

VOID FASTCALL IntSendNCPaint ( PWND  pWnd,
HRGN  hRgn 
)

Definition at line 348 of file painting.c.

349 {
350  pWnd->state &= ~WNDS_SENDNCPAINT;
351 
352  if ( pWnd == GetW32ThreadInfo()->MessageQueue->spwndActive &&
353  !(pWnd->state & WNDS_ACTIVEFRAME))
354  {
355  pWnd->state |= WNDS_ACTIVEFRAME;
356  pWnd->state &= ~WNDS_NONCPAINT;
357  hRgn = HRGN_WINDOW;
358  }
359 
361  {
363  hRgn = HRGN_WINDOW;
364  }
365 
367 }
#define WNDS_SENDNCPAINT
Definition: ntuser.h: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
DWORD state
Definition: ntuser.h:665
#define WNDS_NONCPAINT
Definition: ntuser.h:581
DWORD state2
Definition: ntuser.h:666

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

◆ IntSendSyncPaint()

VOID FASTCALL IntSendSyncPaint ( PWND  Wnd,
ULONG  Flags 
)

Definition at line 132 of file painting.c.

133 {
134  PTHREADINFO ptiCur, ptiWnd;
137  BOOL bSend = TRUE;
138 
139  ptiWnd = Wnd->head.pti;
141  /*
142  Not the current thread, Wnd is in send Nonclient paint also in send erase background and it is visiable.
143  */
144  if ( Wnd->head.pti != ptiCur &&
145  Wnd->state & WNDS_SENDNCPAINT &&
147  Wnd->style & WS_VISIBLE)
148  {
149  // For testing, if you see this, break out the Champagne and have a party!
150  TRACE("SendSyncPaint Wnd in State!\n");
151  if (!IsListEmpty(&ptiWnd->SentMessagesListHead))
152  {
153  // Scan sent queue messages to see if we received sync paint messages.
154  Entry = ptiWnd->SentMessagesListHead.Flink;
156  do
157  {
158  ERR("LOOP it\n");
159  if (Message->Msg.message == WM_SYNCPAINT &&
160  Message->Msg.hwnd == UserHMGetHandle(Wnd))
161  { // Already received so exit out.
162  ERR("SendSyncPaint Found one in the Sent Msg Queue!\n");
163  bSend = FALSE;
164  break;
165  }
166  Entry = Message->ListEntry.Flink;
168  }
169  while (Entry != &ptiWnd->SentMessagesListHead);
170  }
171  if (bSend)
172  {
173  TRACE("Sending WM_SYNCPAINT\n");
174  // This message has no parameters. But it does! Pass Flags along.
177  }
178  }
179 
180  // Send to all the children if this is the desktop window.
181  if (UserIsDesktopWindow(Wnd))
182  {
183  if ( Flags & RDW_ALLCHILDREN ||
184  ( !(Flags & RDW_NOCHILDREN) && Wnd->style & WS_CLIPCHILDREN))
185  {
186  PWND spwndChild = Wnd->spwndChild;
187  while(spwndChild)
188  {
189  if ( spwndChild->style & WS_CHILD &&
190  spwndChild->head.pti != ptiCur)
191  {
192  spwndChild = spwndChild->spwndNext;
193  continue;
194  }
195  IntSendSyncPaint( spwndChild, Flags );
196  spwndChild = spwndChild->spwndNext;
197  }
198  }
199  }
200 }
#define WM_SYNCPAINT
Definition: winuser.h: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
DWORD state
Definition: ntuser.h:665
#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().

◆ IntValidateParents()

BOOL FASTCALL IntValidateParents ( PWND  Child,
BOOL  Recurse 
)

Definition at line 62 of file painting.c.

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

Referenced by co_IntUpdateWindows().

◆ NtUserBeginPaint()

HDC APIENTRY NtUserBeginPaint ( HWND  hWnd,
PAINTSTRUCT UnsafePs 
)

Definition at line 1593 of file painting.c.

1594 {
1595  PWND Window = NULL;
1596  PAINTSTRUCT Ps;
1597  NTSTATUS Status;
1598  HDC hDC;
1601 
1602  TRACE("Enter NtUserBeginPaint\n");
1604 
1605  if (!(Window = UserGetWindowObject(hWnd)))
1606  {
1607  RETURN( NULL);
1608  }
1609 
1610  UserRefObjectCo(Window, &Ref);
1611 
1612  hDC = IntBeginPaint(Window, &Ps);
1613 
1614  Status = MmCopyToCaller(UnsafePs, &Ps, sizeof(PAINTSTRUCT));
1615  if (! NT_SUCCESS(Status))
1616  {
1618  RETURN(NULL);
1619  }
1620 
1621  RETURN(hDC);
1622 
1623 CLEANUP:
1625 
1626  TRACE("Leave NtUserBeginPaint, ret=%p\n",_ret_);
1627  UserLeave();
1628  END_CLEANUP;
1629 
1630 }
#define CLEANUP
Definition: ntuser.h:5
#define RETURN(value)
Definition: ntuser.h:4
LONG NTSTATUS
Definition: precomp.h:26
static HDC
Definition: imagelist.c:92
HWND hWnd
Definition: settings.c:17
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:25
#define MmCopyToCaller(x, y, z)
Definition: mmcopy.h:19
Definition: window.c:28
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:38
Definition: object.h:3
smooth NULL
Definition: ftsmooth.c:416
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:247
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define DECLARE_RETURN(type)
Definition: ntuser.h:3
HDC FASTCALL IntBeginPaint(PWND Window, PPAINTSTRUCT Ps)
Definition: painting.c:1422
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
Status
Definition: gdiplustypes.h:24
Definition: ntuser.h:657
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:255
static HDC hDC
Definition: 3dtext.c:33
#define END_CLEANUP
Definition: ntuser.h:6

Referenced by BeginPaint().

◆ NtUserDrawCaption()

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

Definition at line 2447 of file painting.c.

2451 {
2452  return NtUserDrawCaptionTemp(hWnd, hDC, lpRc, 0, 0, NULL, uFlags);
2453 }
HWND hWnd
Definition: settings.c:17
UINT uFlags
Definition: api.c:59
BOOL APIENTRY NtUserDrawCaptionTemp(HWND hWnd, HDC hDC, LPCRECT lpRc, HFONT hFont, HICON hIcon, const PUNICODE_STRING str, UINT uFlags)
Definition: painting.c:2364
smooth NULL
Definition: ftsmooth.c:416
static HDC hDC
Definition: 3dtext.c:33

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

◆ NtUserDrawCaptionTemp()

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

Definition at line 2364 of file painting.c.

2372 {
2373  PWND pWnd = NULL;
2374  UNICODE_STRING SafeStr = {0};
2376  RECTL SafeRect;
2377  BOOL Ret;
2378 
2380 
2381  if (hWnd != NULL)
2382  {
2383  if(!(pWnd = UserGetWindowObject(hWnd)))
2384  {
2385  UserLeave();
2386  return FALSE;
2387  }
2388  }
2389 
2390  _SEH2_TRY
2391  {
2392  ProbeForRead(lpRc, sizeof(RECTL), sizeof(ULONG));
2393  RtlCopyMemory(&SafeRect, lpRc, sizeof(RECTL));
2394  if (str != NULL)
2395  {
2396  SafeStr = ProbeForReadUnicodeString(str);
2397  if (SafeStr.Length != 0)
2398  {
2399  ProbeForRead( SafeStr.Buffer,
2400  SafeStr.Length,
2401  sizeof(WCHAR));
2402  }
2403  }
2404  }
2406  {
2408  }
2409  _SEH2_END;
2410 
2411  if (Status != STATUS_SUCCESS)
2412  {
2414  UserLeave();
2415  return FALSE;
2416  }
2417 
2418  if (str != NULL)
2419  Ret = UserDrawCaption(pWnd, hDC, &SafeRect, hFont, hIcon, &SafeStr, uFlags);
2420  else
2421  {
2422  if ( RECTL_bIsEmptyRect(&SafeRect) && hFont == 0 && hIcon == 0 )
2423  {
2424  Ret = TRUE;
2425  if (uFlags & DC_DRAWCAPTIONMD)
2426  {
2427  ERR("NC Caption Mode\n");
2428  UserDrawCaptionBar(pWnd, hDC, uFlags);
2429  goto Exit;
2430  }
2431  else if (uFlags & DC_DRAWFRAMEMD)
2432  {
2433  ERR("NC Paint Mode\n");
2434  NC_DoNCPaint(pWnd, hDC, uFlags); // Update Menus too!
2435  goto Exit;
2436  }
2437  }
2438  Ret = UserDrawCaption(pWnd, hDC, &SafeRect, hFont, hIcon, NULL, uFlags);
2439  }
2440 Exit:
2441  UserLeave();
2442  return Ret;
2443 }
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
LONG NTSTATUS
Definition: precomp.h:26
HWND hWnd
Definition: settings.c:17
UINT uFlags
Definition: api.c:59
HFONT hFont
Definition: main.c:53
_SEH2_TRY
Definition: create.c:4250
unsigned int BOOL
Definition: ntddk_ex.h:94
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
LRESULT NC_DoNCPaint(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:1042
const WCHAR * str
#define DC_DRAWFRAMEMD
Definition: undocuser.h:151
smooth NULL
Definition: ftsmooth.c:416
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:247
__wchar_t WCHAR
Definition: xmlstorage.h:180
static void Exit(void)
Definition: sock.c:1331
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
Status
Definition: gdiplustypes.h:24
#define ERR(fmt,...)
Definition: debug.h:109
Definition: ntuser.h:657
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:255
static HDC hDC
Definition: 3dtext.c:33
VOID UserDrawCaptionBar(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:900
_SEH2_END
Definition: create.c:4424
HICON hIcon
Definition: msconfig.c:44
#define ProbeForReadUnicodeString(Ptr)
Definition: probe.h:77
FORCEINLINE BOOL RECTL_bIsEmptyRect(_In_ const RECTL *prcl)
Definition: rect.h:44
unsigned int ULONG
Definition: retypes.h:1
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
return STATUS_SUCCESS
Definition: btrfs.c:2938
#define DC_DRAWCAPTIONMD
Definition: undocuser.h:149
BOOL UserDrawCaption(PWND pWnd, HDC hDc, RECTL *lpRc, HFONT hFont, HICON hIcon, const PUNICODE_STRING Str, UINT uFlags)
Definition: painting.c:2182

Referenced by DrawCaptionTempW(), and NtUserDrawCaption().

◆ NtUserEndPaint()

BOOL APIENTRY NtUserEndPaint ( HWND  hWnd,
CONST PAINTSTRUCT pUnsafePs 
)

Definition at line 1640 of file painting.c.

1641 {
1643  PWND Window = NULL;
1644  PAINTSTRUCT Ps;
1647 
1648  TRACE("Enter NtUserEndPaint\n");
1650 
1651  if (!(Window = UserGetWindowObject(hWnd)))
1652  {
1653  RETURN(FALSE);
1654  }
1655 
1656  UserRefObjectCo(Window, &Ref); // Here for the exception.
1657 
1658  _SEH2_TRY
1659  {
1660  ProbeForRead(pUnsafePs, sizeof(*pUnsafePs), 1);
1661  RtlCopyMemory(&Ps, pUnsafePs, sizeof(PAINTSTRUCT));
1662  }
1664  {
1666  }
1667  _SEH2_END
1668  if (!NT_SUCCESS(Status))
1669  {
1670  RETURN(FALSE);
1671  }
1672 
1673  RETURN(IntEndPaint(Window, &Ps));
1674 
1675 CLEANUP:
1677 
1678  TRACE("Leave NtUserEndPaint, ret=%i\n",_ret_);
1679  UserLeave();
1680  END_CLEANUP;
1681 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define CLEANUP
Definition: ntuser.h:5
#define RETURN(value)
Definition: ntuser.h:4
LONG NTSTATUS
Definition: precomp.h:26
HWND hWnd
Definition: settings.c:17
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:25
_SEH2_TRY
Definition: create.c:4250
Definition: window.c:28
unsigned int BOOL
Definition: ntddk_ex.h:94
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:38
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
Definition: object.h:3
smooth NULL
Definition: ftsmooth.c:416
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:247
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define DECLARE_RETURN(type)
Definition: ntuser.h:3
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
Status
Definition: gdiplustypes.h:24
Definition: ntuser.h:657
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:255
_SEH2_END
Definition: create.c:4424
BOOL FASTCALL IntEndPaint(PWND Wnd, PPAINTSTRUCT Ps)
Definition: painting.c:1518
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
return STATUS_SUCCESS
Definition: btrfs.c:2938
#define END_CLEANUP
Definition: ntuser.h:6

Referenced by EndPaint().

◆ NtUserExcludeUpdateRgn()

INT APIENTRY NtUserExcludeUpdateRgn ( HDC  hDC,
HWND  hWnd 
)

Definition at line 2509 of file painting.c.

2512 {
2513  INT ret = ERROR;
2514  PWND pWnd;
2515 
2516  TRACE("Enter NtUserExcludeUpdateRgn\n");
2518 
2519  pWnd = UserGetWindowObject(hWnd);
2520 
2521  if (hDC && pWnd)
2522  ret = co_UserExcludeUpdateRgn(hDC, pWnd);
2523 
2524  TRACE("Leave NtUserExcludeUpdateRgn, ret=%i\n", ret);
2525 
2526  UserLeave();
2527  return ret;
2528 }
INT FASTCALL co_UserExcludeUpdateRgn(HDC hDC, PWND Window)
Definition: painting.c:2456
#define ERROR(name)
Definition: error_private.h:53
HWND hWnd
Definition: settings.c:17
int32_t INT
Definition: typedefs.h:56
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:247
#define TRACE(s)
Definition: solgame.cpp:4
int ret
Definition: ntuser.h:657
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:255
static HDC hDC
Definition: 3dtext.c:33

Referenced by ExcludeUpdateRgn().

◆ NtUserFillWindow()

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

Definition at line 1690 of file painting.c.

1694 {
1695  BOOL ret = FALSE;
1696  PWND pWnd, pWndParent = NULL;
1698 
1699  TRACE("Enter NtUserFillWindow\n");
1701 
1702  if (!hDC)
1703  {
1704  goto Exit;
1705  }
1706 
1707  if (!(pWnd = UserGetWindowObject(hWnd)))
1708  {
1709  goto Exit;
1710  }
1711 
1712  if (hWndParent && !(pWndParent = UserGetWindowObject(hWndParent)))
1713  {
1714  goto Exit;
1715  }
1716 
1717  UserRefObjectCo(pWnd, &Ref);
1718  ret = IntFillWindow( pWndParent, pWnd, hDC, hBrush );
1719  UserDerefObjectCo(pWnd);
1720 
1721 Exit:
1722  TRACE("Leave NtUserFillWindow, ret=%i\n",ret);
1723  UserLeave();
1724  return ret;
1725 }
HWND hWnd
Definition: settings.c:17
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:25
unsigned int BOOL
Definition: ntddk_ex.h:94
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:38
Definition: object.h:3
smooth NULL
Definition: ftsmooth.c:416
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
BOOL FASTCALL IntFillWindow(PWND pWndParent, PWND pWnd, HDC hDC, HBRUSH hBrush)
Definition: painting.c:1540
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:247
#define TRACE(s)
Definition: solgame.cpp:4
static void Exit(void)
Definition: sock.c:1331
int ret
Definition: ntuser.h:657
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:255
static HDC hDC
Definition: 3dtext.c:33

◆ NtUserFlashWindowEx()

BOOL APIENTRY NtUserFlashWindowEx ( IN PFLASHWINFO  pfwi)

Definition at line 1731 of file painting.c.

1732 {
1733  PWND pWnd;
1734  FLASHWINFO finfo = {0};
1735  BOOL Ret = FALSE;
1736 
1738 
1739  _SEH2_TRY
1740  {
1741  ProbeForRead(pfwi, sizeof(FLASHWINFO), 1);
1742  RtlCopyMemory(&finfo, pfwi, sizeof(FLASHWINFO));
1743  }
1745  {
1747  _SEH2_YIELD(goto Exit);
1748  }
1749  _SEH2_END
1750 
1751  if (!( pWnd = ValidateHwndNoErr(finfo.hwnd)) ||
1752  finfo.cbSize != sizeof(FLASHWINFO) ||
1753  finfo.dwFlags & ~(FLASHW_ALL|FLASHW_TIMER|FLASHW_TIMERNOFG) )
1754  {
1756  goto Exit;
1757  }
1758 
1759  Ret = IntFlashWindowEx(pWnd, &finfo);
1760 
1761 Exit:
1762  UserLeave();
1763  return Ret;
1764 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
BOOL FASTCALL IntFlashWindowEx(PWND pWnd, PFLASHWINFO pfwi)
Definition: painting.c:1292
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
PWND FASTCALL ValidateHwndNoErr(HWND hWnd)
Definition: window.c:96
_SEH2_TRY
Definition: create.c:4250
unsigned int BOOL
Definition: ntddk_ex.h:94
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:247
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
static void Exit(void)
Definition: sock.c:1331
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
Definition: ntuser.h:657
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:255
_SEH2_END
Definition: create.c:4424
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

Referenced by FlashWindow(), and FlashWindowEx().

◆ NtUserGetUpdateRect()

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

Definition at line 1946 of file painting.c.

1947 {
1948  PWND Window;
1949  RECTL Rect;
1950  NTSTATUS Status;
1951  BOOL Ret;
1953 
1954  TRACE("Enter NtUserGetUpdateRect\n");
1956 
1957  if (!(Window = UserGetWindowObject(hWnd)))
1958  {
1959  RETURN(FALSE);
1960  }
1961 
1962  Ret = co_UserGetUpdateRect(Window, &Rect, bErase);
1963 
1964  if (UnsafeRect != NULL)
1965  {
1966  Status = MmCopyToCaller(UnsafeRect, &Rect, sizeof(RECTL));
1967  if (!NT_SUCCESS(Status))
1968  {
1970  RETURN(FALSE);
1971  }
1972  }
1973 
1974  RETURN(Ret);
1975 
1976 CLEANUP:
1977  TRACE("Leave NtUserGetUpdateRect, ret=%i\n",_ret_);
1978  UserLeave();
1979  END_CLEANUP;
1980 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define CLEANUP
Definition: ntuser.h:5
#define RETURN(value)
Definition: ntuser.h:4
LONG NTSTATUS
Definition: precomp.h:26
HWND hWnd
Definition: settings.c:17
#define MmCopyToCaller(x, y, z)
Definition: mmcopy.h:19
Definition: window.c:28
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:247
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define DECLARE_RETURN(type)
Definition: ntuser.h:3
int Window
Definition: x11stubs.h:26
Status
Definition: gdiplustypes.h:24
Definition: ntuser.h:657
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:255
BOOL FASTCALL co_UserGetUpdateRect(PWND Window, PRECT pRect, BOOL bErase)
Definition: painting.c:1842
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
struct Rect Rect
#define END_CLEANUP
Definition: ntuser.h:6

Referenced by GetUpdateRect().

◆ NtUserGetUpdateRgn()

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

Definition at line 1914 of file painting.c.

1915 {
1917  PWND Window;
1918  INT ret;
1919 
1920  TRACE("Enter NtUserGetUpdateRgn\n");
1922 
1923  if (!(Window = UserGetWindowObject(hWnd)))
1924  {
1925  RETURN(ERROR);
1926  }
1927 
1928  ret = co_UserGetUpdateRgn(Window, hRgn, bErase);
1929 
1930  RETURN(ret);
1931 
1932 CLEANUP:
1933  TRACE("Leave NtUserGetUpdateRgn, ret=%i\n",_ret_);
1934  UserLeave();
1935  END_CLEANUP;
1936 }
#define CLEANUP
Definition: ntuser.h:5
#define RETURN(value)
Definition: ntuser.h:4
#define ERROR(name)
Definition: error_private.h:53
HWND hWnd
Definition: settings.c:17
static HRGN hRgn
Definition: mapping.c:33
int32_t INT
Definition: typedefs.h:56
Definition: window.c:28
INT FASTCALL co_UserGetUpdateRgn(PWND Window, HRGN hRgn, BOOL bErase)
Definition: painting.c:1770
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:247
#define TRACE(s)
Definition: solgame.cpp:4
#define DECLARE_RETURN(type)
Definition: ntuser.h:3
int Window
Definition: x11stubs.h:26
int ret
Definition: ntuser.h:657
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:255
#define END_CLEANUP
Definition: ntuser.h:6

Referenced by GetUpdateRgn().

◆ NtUserInvalidateRect()

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

Definition at line 2532 of file painting.c.

2536 {
2537  UINT flags = RDW_INVALIDATE | (bErase ? RDW_ERASE : 0);
2538  if (!hWnd)
2539  {
2541  lpUnsafeRect = NULL;
2542  }
2543  return NtUserRedrawWindow(hWnd, lpUnsafeRect, NULL, flags);
2544 }
BOOL APIENTRY NtUserRedrawWindow(HWND hWnd, CONST RECT *lprcUpdate, HRGN hrgnUpdate, UINT flags)
Definition: painting.c:1990
HWND hWnd
Definition: settings.c:17
#define RDW_FRAME
Definition: winuser.h:1198
smooth NULL
Definition: ftsmooth.c:416
#define RDW_ERASE
Definition: winuser.h:1197
GLbitfield flags
Definition: glext.h:7161
#define RDW_ALLCHILDREN
Definition: winuser.h:1207
unsigned int UINT
Definition: ndis.h:50
#define RDW_ERASENOW
Definition: winuser.h:1205
#define RDW_INVALIDATE
Definition: winuser.h:1200

Referenced by ComboWndProc_common(), and InvalidateRect().

◆ NtUserInvalidateRgn()

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

Definition at line 2548 of file painting.c.

2552 {
2553  if (!hWnd)
2554  {
2556  return FALSE;
2557  }
2558  return NtUserRedrawWindow(hWnd, NULL, hRgn, RDW_INVALIDATE | (bErase? RDW_ERASE : 0));
2559 }
BOOL APIENTRY NtUserRedrawWindow(HWND hWnd, CONST RECT *lprcUpdate, HRGN hrgnUpdate, UINT flags)
Definition: painting.c:1990
HWND hWnd
Definition: settings.c:17
static HRGN hRgn
Definition: mapping.c:33
smooth NULL
Definition: ftsmooth.c:416
#define ERROR_INVALID_WINDOW_HANDLE
Definition: winerror.h:881
#define RDW_ERASE
Definition: winuser.h:1197
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
#define RDW_INVALIDATE
Definition: winuser.h:1200

Referenced by InvalidateRgn().

◆ NtUserPrintWindow()

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

Definition at line 2563 of file painting.c.

2567 {
2568  PWND Window;
2569  BOOL Ret = FALSE;
2570 
2572 
2573  if (hwnd)
2574  {
2575  if (!(Window = UserGetWindowObject(hwnd)) ||
2577  {
2578  goto Exit;
2579  }
2580 
2581  if ( Window )
2582  {
2583  /* Validate flags and check it as a mask for 0 or 1. */
2584  if ( (nFlags & PW_CLIENTONLY) == nFlags)
2585  Ret = IntPrintWindow( Window, hdcBlt, nFlags);
2586  else
2588  }
2589  }
2590 Exit:
2591  UserLeave();
2592  return Ret;
2593 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
BOOL FASTCALL IntPrintWindow(PWND pwnd, HDC hdcBlt, UINT nFlags)
Definition: painting.c:1240
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:220
Definition: window.c:28
unsigned int BOOL
Definition: ntddk_ex.h:94
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:247
static void Exit(void)
Definition: sock.c:1331
#define UserIsMessageWindow(pWnd)
Definition: desktop.h:223
int Window
Definition: x11stubs.h:26
Definition: ntuser.h:657
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:255
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

◆ NtUserRedrawWindow()

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

Definition at line 1990 of file painting.c.

1995 {
1996  RECTL SafeUpdateRect;
1997  PWND Wnd;
1998  BOOL Ret;
2001  PREGION RgnUpdate = NULL;
2003 
2004  TRACE("Enter NtUserRedrawWindow\n");
2006 
2007  if (!(Wnd = UserGetWindowObject(hWnd ? hWnd : IntGetDesktopWindow())))
2008  {
2009  RETURN( FALSE);
2010  }
2011 
2012  if (lprcUpdate)
2013  {
2014  _SEH2_TRY
2015  {
2016  ProbeForRead(lprcUpdate, sizeof(RECTL), 1);
2017  RtlCopyMemory(&SafeUpdateRect, lprcUpdate, sizeof(RECTL));
2018  }
2020  {
2022  }
2023  _SEH2_END
2024  if (!NT_SUCCESS(Status))
2025  {
2027  RETURN( FALSE);
2028  }
2029  }
2030 
2034  {
2035  /* RedrawWindow fails only in case that flags are invalid */
2037  RETURN( FALSE);
2038  }
2039 
2040  /* We can't hold lock on GDI objects while doing roundtrips to user mode,
2041  * so it will be copied.
2042  */
2043  if (hrgnUpdate > HRGN_WINDOW)
2044  {
2045  RgnUpdate = REGION_LockRgn(hrgnUpdate);
2046  if (!RgnUpdate)
2047  {
2049  RETURN(FALSE);
2050  }
2051  REGION_UnlockRgn(RgnUpdate);
2052  }
2053  else if (hrgnUpdate == HRGN_WINDOW) // Trap it out.
2054  {
2055  ERR("NTRW: Caller is passing Window Region 1\n");
2056  }
2057 
2058  UserRefObjectCo(Wnd, &Ref);
2059 
2060  Ret = co_UserRedrawWindow( Wnd,
2061  lprcUpdate ? &SafeUpdateRect : NULL,
2062  RgnUpdate,
2063  flags);
2064 
2065  UserDerefObjectCo(Wnd);
2066 
2067  RETURN( Ret);
2068 
2069 CLEANUP:
2070  TRACE("Leave NtUserRedrawWindow, ret=%i\n",_ret_);
2071  UserLeave();
2072  END_CLEANUP;
2073 }
#define RDW_NOINTERNALPAINT
Definition: winuser.h:1203
#define RDW_NOCHILDREN
Definition: winuser.h:1208
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define CLEANUP
Definition: ntuser.h:5
#define RETURN(value)
Definition: ntuser.h:4
LONG NTSTATUS
Definition: precomp.h:26
HWND hWnd
Definition: settings.c:17
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:25
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define RDW_FRAME
Definition: winuser.h:1198
PREGION FASTCALL REGION_LockRgn(_In_ HRGN hrgn)
Definition: region.c:2377
_SEH2_TRY
Definition: create.c:4250
unsigned int BOOL
Definition: ntddk_ex.h:94
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:38
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
Definition: object.h:3
smooth NULL
Definition: ftsmooth.c:416
#define HRGN_WINDOW
Definition: ntuser.h:329
Definition: region.h:7
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:247
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define RDW_ERASE
Definition: winuser.h:1197
#define DECLARE_RETURN(type)
Definition: ntuser.h:3
GLbitfield flags
Definition: glext.h:7161
#define RDW_VALIDATE
Definition: winuser.h:1204
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
#define RDW_INTERNALPAINT
Definition: winuser.h:1199
#define RDW_NOERASE
Definition: winuser.h:1201
#define RDW_NOFRAME
Definition: winuser.h:1202
Status
Definition: gdiplustypes.h:24
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define ERR(fmt,...)
Definition: debug.h:109
Definition: ntuser.h:657
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:255
HWND FASTCALL IntGetDesktopWindow(VOID)
Definition: desktop.c:1338
_SEH2_END
Definition: create.c:4424
BOOL FASTCALL co_UserRedrawWindow(PWND Window, const RECTL *UpdateRect, PREGION UpdateRgn, ULONG Flags)
Definition: painting.c:876
#define RDW_ALLCHILDREN
Definition: winuser.h:1207
#define RDW_UPDATENOW
Definition: winuser.h:1206
VOID FASTCALL REGION_UnlockRgn(_In_ PREGION prgn)
Definition: region.c:2392
#define RDW_ERASENOW
Definition: winuser.h:1205
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
return STATUS_SUCCESS
Definition: btrfs.c:2938
#define ERROR_INVALID_FLAGS
Definition: winerror.h:583
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
#define END_CLEANUP
Definition: ntuser.h:6
#define RDW_INVALIDATE
Definition: winuser.h:1200

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

◆ NtUserValidateRect()

BOOL APIENTRY NtUserValidateRect ( HWND  hWnd,
const RECT lpRect 
)

Definition at line 2599 of file painting.c.

2602 {
2604  if (!hWnd)
2605  {
2607  lpRect = NULL;
2608  }
2609  return NtUserRedrawWindow(hWnd, lpRect, NULL, flags);
2610 }
BOOL APIENTRY NtUserRedrawWindow(HWND hWnd, CONST RECT *lprcUpdate, HRGN hrgnUpdate, UINT flags)
Definition: painting.c:1990
HWND hWnd
Definition: settings.c:17
#define RDW_FRAME
Definition: winuser.h:1198
smooth NULL
Definition: ftsmooth.c:416
#define RDW_ERASE
Definition: winuser.h:1197
GLbitfield flags
Definition: glext.h:7161
#define RDW_VALIDATE
Definition: winuser.h:1204
#define RDW_ALLCHILDREN
Definition: winuser.h:1207
unsigned int UINT
Definition: ndis.h:50
#define RDW_ERASENOW
Definition: winuser.h:1205
#define RDW_INVALIDATE
Definition: winuser.h:1200

◆ PaintSuspendedWindow()

VOID FASTCALL PaintSuspendedWindow ( PWND  pwnd,
HRGN  hrgnOrig 
)

Definition at line 1006 of file painting.c.

1007 {
1008  if (pwnd->hrgnUpdate)
1009  {
1010  HDC hDC;
1012  HRGN hrgnTemp;
1013  RECT Rect;
1014  INT type;
1015  PREGION prgn;
1016 
1017  if (pwnd->hrgnUpdate > HRGN_WINDOW)
1018  {
1019  hrgnTemp = NtGdiCreateRectRgn(0, 0, 0, 0);
1020  type = NtGdiCombineRgn( hrgnTemp, pwnd->hrgnUpdate, 0, RGN_COPY);
1021  if (type == ERROR)
1022  {
1023  GreDeleteObject(hrgnTemp);
1024  hrgnTemp = HRGN_WINDOW;
1025  }
1026  }
1027  else
1028  {
1029  hrgnTemp = GreCreateRectRgnIndirect(&pwnd->rcWindow);
1030  }
1031 
1032  if ( hrgnOrig &&
1033  hrgnTemp > HRGN_WINDOW &&
1034  NtGdiCombineRgn(hrgnTemp, hrgnTemp, hrgnOrig, RGN_AND) == NULLREGION)
1035  {
1036  GreDeleteObject(hrgnTemp);
1037  return;
1038  }
1039 
1041 
1042  Rect = pwnd->rcWindow;
1043  RECTL_vOffsetRect(&Rect, -pwnd->rcWindow.left, -pwnd->rcWindow.top);
1044 
1045  // Clear out client area!
1047 
1048  NC_DoNCPaint(pwnd, hDC, Flags); // Redraw without MENUs.
1049 
1050  UserReleaseDC(pwnd, hDC, FALSE);
1051 
1052  prgn = REGION_LockRgn(hrgnTemp);
1054  REGION_UnlockRgn(prgn);
1055 
1056  // Set updates for this window.
1058 
1059  // DCX_KEEPCLIPRGN is set. Check it anyway.
1060  if (hrgnTemp > HRGN_WINDOW && GreIsHandleValid(hrgnTemp)) GreDeleteObject(hrgnTemp);
1061  }
1062 }
__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
BOOL NTAPI GreIsHandleValid(HGDIOBJ hobj)
Definition: gdiobj.c:1143
HGDIOBJ FASTCALL IntGetSysColorBrush(INT Object)
Definition: stockobj.c:317
#define ERROR(name)
Definition: error_private.h:53
#define WNDS_SENDNCPAINT
Definition: ntuser.h:584
static HDC
Definition: imagelist.c:92
#define NULLREGION
Definition: wingdi.h:360
LONG top
Definition: windef.h:307
#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)
#define RDW_FRAME
Definition: winuser.h:1198
LONG left
Definition: windef.h:306
PREGION FASTCALL REGION_LockRgn(_In_ HRGN hrgn)
Definition: region.c:2377
#define COLOR_WINDOW
Definition: winuser.h:908
int32_t INT
Definition: typedefs.h:56
#define DCX_INTERSECTRGN
Definition: winuser.h:2104
#define DCX_WINDOW
Definition: winuser.h:2095
#define RGN_AND
Definition: wingdi.h:355
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define DC_NC
Definition: winuser.h:440
LRESULT NC_DoNCPaint(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:1042
#define GreCreateRectRgnIndirect(prc)
Definition: region.h:96
#define DCX_KEEPCLIPRGN
Definition: undocuser.h:66
#define HRGN_WINDOW
Definition: ntuser.h:329
Definition: region.h:7
#define RDW_ERASE
Definition: winuser.h:1197
HRGN hrgnUpdate
Definition: ntuser.h:685
VOID FASTCALL IntInvalidateWindows(PWND Wnd, PREGION Rgn, ULONG Flags)
Definition: painting.c:630
RECT rcWindow
Definition: ntuser.h:680
__kernel_entry W32KAPI INT APIENTRY NtGdiCombineRgn(_In_ HRGN hrgnDst, _In_ HRGN hrgnSrc1, _In_opt_ HRGN hrgnSrc2, _In_ INT iMode)
#define RGN_COPY
Definition: wingdi.h:356
FORCEINLINE VOID RECTL_vOffsetRect(_Inout_ RECTL *prcl, _In_ INT cx, _In_ INT cy)
Definition: rect.h:31
static HDC hDC
Definition: 3dtext.c:33
#define DC_NOSENDMSG
Definition: undocuser.h:146
#define RDW_ALLCHILDREN
Definition: winuser.h:1207
DWORD state
Definition: ntuser.h:665
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:917
#define WNDS_SENDERASEBACKGROUND
Definition: ntuser.h:582
#define WNDS_UPDATEDIRTY
Definition: ntuser.h:586
VOID FASTCALL REGION_UnlockRgn(_In_ PREGION prgn)
Definition: region.c:2392
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
struct Rect Rect
#define RDW_INVALIDATE
Definition: winuser.h:1200

Referenced by UpdateTheadChildren().

◆ UpdateTheadChildren()

VOID FASTCALL UpdateTheadChildren ( PWND  pWnd,
HRGN  hRgn 
)

Definition at line 1065 of file painting.c.

1066 {
1067  PaintSuspendedWindow( pWnd, hRgn );
1068 
1069  if (!(pWnd->style & WS_CLIPCHILDREN))
1070  return;
1071 
1072  pWnd = pWnd->spwndChild; // invalidate children if any.
1073  while (pWnd)
1074  {
1075  UpdateTheadChildren( pWnd, hRgn );
1076  pWnd = pWnd->spwndNext;
1077  }
1078 }
static HRGN hRgn
Definition: mapping.c:33
VOID FASTCALL PaintSuspendedWindow(PWND pwnd, HRGN hrgnOrig)
Definition: painting.c:1006
#define WS_CLIPCHILDREN
Definition: pedump.c:619
struct _WND * spwndNext
Definition: ntuser.h:675
VOID FASTCALL UpdateTheadChildren(PWND pWnd, HRGN hRgn)
Definition: painting.c:1065
struct _WND * spwndChild
Definition: ntuser.h:678
DWORD style
Definition: ntuser.h:670

Referenced by UpdateThreadWindows().

◆ UpdateThreadWindows()

VOID FASTCALL UpdateThreadWindows ( PWND  pWnd,
PTHREADINFO  pti,
HRGN  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  pWnd,
HDC  hDc,
RECTL lpRc,
HFONT  hFont,
HICON  hIcon,
const PUNICODE_STRING  Str,
UINT  uFlags 
)

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);
2315  Set = UserDrawCaptionText(pWnd, hDc, &ustr, &Rect, uFlags, hFont);
2316  }
2317  if (pWnd)
2318  {
2319  if (Set)
2321  else
2323  }
2324  }
2325 
2326  Ret = TRUE;
2327 
2328 cleanup:
2329  if (hOldBrush) NtGdiSelectBrush(hDc, hOldBrush);
2330 
2331  return Ret;
2332 }
DWORD ExStyle
Definition: ntuser.h:668
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:2784
#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
LARGE_UNICODE_STRING strName
Definition: ntuser.h:700
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:109
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
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:2785
COLOR16 Blue
Definition: wingdi.h:2787
DWORD state2
Definition: ntuser.h:666
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
DWORD style
Definition: ntuser.h:670
#define DC_INBUTTON
Definition: winuser.h:431

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

◆ UserDrawCaptionText()

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

Definition at line 2076 of file painting.c.

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

Referenced by UserDrawCaption().

◆ UserExtTextOutW()

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

◆ UserRealizePalette()

INT FASTCALL UserRealizePalette ( HDC  hdc)

Definition at line 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:728
#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().

◆ UserUpdateWindows()

VOID FASTCALL UserUpdateWindows ( PWND  pWnd,
ULONG  Flags 
)

Definition at line 586 of file painting.c.

587 {
588  // If transparent and any sibling windows below needs to be painted, leave.
589  if (pWnd->ExStyle & WS_EX_TRANSPARENT)
590  {
591  PWND Next = pWnd->spwndNext;
592 
593  while(Next)
594  {
595  if ( Next->head.pti == pWnd->head.pti &&
596  ( Next->hrgnUpdate != NULL || Next->state & WNDS_INTERNALPAINT) )
597  {
598  return;
599  }
600 
601  Next = Next->spwndNext;
602  }
603  }
605 }
DWORD ExStyle
Definition: ntuser.h:668
#define WS_EX_TRANSPARENT
Definition: pedump.c:649
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
THRDESKHEAD head
Definition: ntuser.h:659
smooth NULL
Definition: ftsmooth.c:416
struct _WND * spwndNext
Definition: ntuser.h:675
HRGN hrgnUpdate
Definition: ntuser.h:685
VOID FASTCALL co_IntUpdateWindows(PWND Wnd, ULONG Flags, BOOL Recurse)
Definition: painting.c:507
Definition: ntuser.h:657
DWORD state
Definition: ntuser.h:665