ReactOS 0.4.16-dev-424-ge4748fe
painting.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

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

Functions

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

Macro Definition Documentation

◆ FLASHW_ACTIVE

#define FLASHW_ACTIVE   0x00008000

Definition at line 9 of file painting.h.

◆ FLASHW_COUNT

#define FLASHW_COUNT   0x00002000

Definition at line 7 of file painting.h.

◆ FLASHW_FINISHED

#define FLASHW_FINISHED   0x00000800

Definition at line 5 of file painting.h.

◆ FLASHW_KILLSYSTIMER

#define FLASHW_KILLSYSTIMER   0x00004000

Definition at line 8 of file painting.h.

◆ FLASHW_MASK

#define FLASHW_MASK   0x0000000f

Definition at line 3 of file painting.h.

◆ FLASHW_STARTED

#define FLASHW_STARTED   0x00001000

Definition at line 6 of file painting.h.

◆ FLASHW_SYSTIMER

#define FLASHW_SYSTIMER   0x00000400

Definition at line 4 of file painting.h.

◆ PRGN_MONITOR

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

Definition at line 13 of file painting.h.

◆ PRGN_NULL

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

Definition at line 11 of file painting.h.

◆ PRGN_WINDOW

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

Definition at line 12 of file painting.h.

◆ RDW_CLIPCHILDREN

#define RDW_CLIPCHILDREN   4096

Definition at line 15 of file painting.h.

◆ RDW_NOUPDATEDIRTY

#define RDW_NOUPDATEDIRTY   32768

Definition at line 16 of file painting.h.

Function Documentation

◆ co_IntPaintWindows()

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

Definition at line 403 of file painting.c.

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

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

◆ co_IntUpdateWindows()

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

Definition at line 519 of file painting.c.

520{
523
524 if ( Wnd->hrgnUpdate != NULL || Wnd->state & WNDS_INTERNALPAINT )
525 {
526 if (Wnd->hrgnUpdate)
527 {
528 if (!IntValidateParents(Wnd, Recurse))
529 {
530 return;
531 }
532 }
533
534 if (Wnd->state & WNDS_INTERNALPAINT)
535 {
536 Wnd->state &= ~WNDS_INTERNALPAINT;
537
538 if (Wnd->hrgnUpdate == NULL)
539 MsqDecPaintCountQueue(Wnd->head.pti);
540 }
541
543 Wnd->state &= ~WNDS_UPDATEDIRTY;
544
546
547 UserRefObjectCo(Wnd, &Ref);
549
550 if (Wnd->state & WNDS_PAINTNOTPROCESSED)
551 {
553 }
555 }
556
557 // Force flags as a toggle. Fixes msg:test_paint_messages:WmChildPaintNc.
558 Flags = (Flags & RDW_NOCHILDREN) ? RDW_NOCHILDREN : RDW_ALLCHILDREN; // All children is the default.
559
560 /*
561 * Update child windows.
562 */
563
564 if (!(Flags & RDW_NOCHILDREN) &&
567 {
568 PWND Child;
569
570 for (Child = Wnd->spwndChild; Child; Child = Child->spwndNext)
571 {
572 /* transparent window, check for non-transparent sibling to paint first, then skip it */
573 if ( Child->ExStyle & WS_EX_TRANSPARENT &&
574 ( Child->hrgnUpdate != NULL || Child->state & WNDS_INTERNALPAINT ) )
575 {
576 PWND Next = Child->spwndNext;
577 while (Next)
578 {
579 if ( Next->hrgnUpdate != NULL || Next->state & WNDS_INTERNALPAINT ) break;
580
581 Next = Next->spwndNext;
582 }
583
584 if (Next) continue;
585 }
586
587 if (Child->style & WS_VISIBLE)
588 {
590 UserRefObjectCo(Child, &Ref);
593 }
594 }
595 }
596}
#define WNDS_INTERNALPAINT
Definition: ntuser.h:617
#define WNDS2_WMPAINTSENT
Definition: ntuser.h:641
#define WNDS_PAINTNOTPROCESSED
Definition: ntuser.h:627
VOID FASTCALL MsqDecPaintCountQueue(PTHREADINFO pti)
Definition: msgqueue.c:508
#define WS_EX_TRANSPARENT
Definition: pedump.c:649
Definition: ntuser.h:694
THRDESKHEAD head
Definition: ntuser.h:695
DWORD state2
Definition: ntuser.h:702
struct _WND * spwndChild
Definition: ntuser.h:714
HRGN hrgnUpdate
Definition: ntuser.h:721
DWORD state
Definition: ntuser.h:701
struct _WND * spwndNext
Definition: ntuser.h:711
BOOL FASTCALL IntValidateParents(PWND Child, BOOL Recurse)
Definition: painting.c:62
VOID FASTCALL co_IntUpdateWindows(PWND Wnd, ULONG Flags, BOOL Recurse)
Definition: painting.c:519
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFDEVICE Child
Definition: wdffdo.h:536
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:194
#define WM_PAINT
Definition: winuser.h:1623

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

◆ co_UserGetUpdateRect()

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

Definition at line 1863 of file painting.c.

1864{
1866 BOOL Ret = TRUE;
1867
1868 if (bErase)
1869 {
1871 UserRefObjectCo(Window, &Ref);
1874 }
1875
1876 Window->state &= ~WNDS_UPDATEDIRTY;
1877
1878 if (Window->hrgnUpdate == NULL)
1879 {
1880 pRect->left = pRect->top = pRect->right = pRect->bottom = 0;
1881 Ret = FALSE;
1882 }
1883 else
1884 {
1885 /* Get the update region bounding box. */
1886 if (Window->hrgnUpdate == HRGN_WINDOW)
1887 {
1888 *pRect = Window->rcClient;
1889 ERR("GURt: Caller is retrieving Window Region 1\n");
1890 }
1891 else
1892 {
1893 RegionType = IntGdiGetRgnBox(Window->hrgnUpdate, pRect);
1894
1896 RECTL_bIntersectRect(pRect, pRect, &Window->rcClient);
1897 }
1898
1899 if (IntIntersectWithParents(Window, pRect))
1900 {
1902 {
1903 RECTL_vOffsetRect(pRect,
1904 -Window->rcClient.left,
1905 -Window->rcClient.top);
1906 }
1907 if (Window->pcls->style & CS_OWNDC)
1908 {
1909 HDC hdc;
1910 //DWORD layout;
1912 //layout = NtGdiSetLayout(hdc, -1, 0);
1913 //IntMapWindowPoints( 0, Window, (LPPOINT)pRect, 2 );
1914 GreDPtoLP( hdc, (LPPOINT)pRect, 2 );
1915 //NtGdiSetLayout(hdc, -1, layout);
1917 }
1918 }
1919 else
1920 {
1921 pRect->left = pRect->top = pRect->right = pRect->bottom = 0;
1922 }
1923 }
1924 return Ret;
1925}
BOOL FASTCALL GreDPtoLP(HDC, LPPOINT, INT)
Definition: dcutil.c:7
#define ERROR(name)
Definition: error_private.h:53
unsigned int BOOL
Definition: ntddk_ex.h:94
RegionType
HDC hdc
Definition: main.c:9
Definition: window.c:28
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
int32_t INT
Definition: typedefs.h:58
BOOL FASTCALL IntIntersectWithParents(PWND Child, RECTL *WindowRect)
Definition: painting.c:35
BOOL FASTCALL RECTL_bIntersectRect(_Out_ RECTL *prclDst, _In_ const RECTL *prcl1, _In_ const RECTL *prcl2)
Definition: rect.c:55
FORCEINLINE VOID RECTL_vOffsetRect(_Inout_ RECTL *prcl, _In_ INT cx, _In_ INT cy)
Definition: rect.h:31
INT APIENTRY IntGdiGetRgnBox(HRGN hRgn, PRECTL pRect)
Definition: region.c:2561
#define NULLREGION
Definition: wingdi.h:361
#define CS_OWNDC
Definition: winuser.h:655

Referenced by NtUserGetUpdateRect().

◆ co_UserGetUpdateRgn()

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

Definition at line 1791 of file painting.c.

1792{
1793 int RegionType;
1794 BOOL Type;
1795 RECTL Rect;
1796
1798
1799 if (bErase)
1800 {
1802 UserRefObjectCo(Window, &Ref);
1805 }
1806
1807 Window->state &= ~WNDS_UPDATEDIRTY;
1808
1809 if (Window->hrgnUpdate == NULL)
1810 {
1811 NtGdiSetRectRgn(hRgn, 0, 0, 0, 0);
1812 return NULLREGION;
1813 }
1814
1815 Rect = Window->rcClient;
1817
1818 if (Window->hrgnUpdate == HRGN_WINDOW)
1819 {
1820 // Trap it out.
1821 ERR("GURn: Caller is passing Window Region 1\n");
1822 if (!Type)
1823 {
1824 NtGdiSetRectRgn(hRgn, 0, 0, 0, 0);
1825 return NULLREGION;
1826 }
1827
1829
1831 {
1833 -Window->rcClient.left,
1834 -Window->rcClient.top);
1835 }
1837 }
1838 else
1839 {
1840 HRGN hrgnTemp = GreCreateRectRgnIndirect(&Rect);
1841
1842 RegionType = NtGdiCombineRgn(hRgn, hrgnTemp, Window->hrgnUpdate, RGN_AND);
1843
1845 {
1846 if (hrgnTemp) GreDeleteObject(hrgnTemp);
1847 NtGdiSetRectRgn(hRgn, 0, 0, 0, 0);
1848 return RegionType;
1849 }
1850
1852 {
1854 -Window->rcClient.left,
1855 -Window->rcClient.top);
1856 }
1857 if (hrgnTemp) GreDeleteObject(hrgnTemp);
1858 }
1859 return RegionType;
1860}
Type
Definition: Type.h:7
static HRGN hRgn
Definition: mapping.c:33
__kernel_entry W32KAPI INT APIENTRY NtGdiCombineRgn(_In_ HRGN hrgnDst, _In_ HRGN hrgnSrc1, _In_opt_ HRGN hrgnSrc2, _In_ INT iMode)
__kernel_entry W32KAPI BOOL APIENTRY NtGdiSetRectRgn(_In_ HRGN hrgn, _In_ INT xLeft, _In_ INT yTop, _In_ INT xRight, _In_ INT yBottom)
Definition: region.c:4048
__kernel_entry W32KAPI INT APIENTRY NtGdiOffsetRgn(_In_ HRGN hrgn, _In_ INT cx, _In_ INT cy)
Definition: region.c:3961
#define GreCreateRectRgnIndirect(prc)
Definition: region.h:96
#define GreSetRectRgnIndirect(hRgn, prc)
Definition: region.h:99
#define ASSERT_REFS_CO(_obj_)
Definition: userfuncs.h:14
#define RGN_AND
Definition: wingdi.h:356
#define SIMPLEREGION
Definition: wingdi.h:362

Referenced by IntDefWindowProc(), and NtUserGetUpdateRgn().

◆ co_UserRedrawWindow()

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

Definition at line 895 of file painting.c.

900{
901 PREGION TmpRgn = NULL;
902 TRACE("co_UserRedrawWindow start Rgn %p\n",UpdateRgn);
903
904 /*
905 * Step 1.
906 * Validation of passed parameters.
907 */
908
910 {
911 return TRUE; // Just do nothing!!!
912 }
913
914 if (Window == NULL)
915 {
917 }
918
919 /*
920 * Step 2.
921 * Transform the parameters UpdateRgn and UpdateRect into
922 * a region hRgn specified in screen coordinates.
923 */
924
925 if (Flags & (RDW_INVALIDATE | RDW_VALIDATE)) // Both are OKAY!
926 {
927 /* We can't hold lock on GDI objects while doing roundtrips to user mode,
928 * so use a copy instead */
929 if (UpdateRgn)
930 {
931 TmpRgn = IntSysCreateRectpRgn(0, 0, 0, 0);
932
933 if (UpdateRgn > PRGN_WINDOW)
934 {
935 IntGdiCombineRgn(TmpRgn, UpdateRgn, NULL, RGN_COPY);
936 }
937
939 {
940 REGION_bOffsetRgn(TmpRgn, Window->rcClient.left, Window->rcClient.top);
941 }
942 }
943 else
944 {
945 if (UpdateRect != NULL)
946 {
948 {
950 }
951 else
952 {
953 TmpRgn = IntSysCreateRectpRgn(Window->rcClient.left + UpdateRect->left,
954 Window->rcClient.top + UpdateRect->top,
955 Window->rcClient.left + UpdateRect->right,
956 Window->rcClient.top + UpdateRect->bottom);
957 }
958 }
959 else
960 {
963 {
964 if (!RECTL_bIsEmptyRect(&Window->rcWindow))
965 TmpRgn = IntSysCreateRectpRgnIndirect(&Window->rcWindow);
966 }
967 else
968 {
969 if (!RECTL_bIsEmptyRect(&Window->rcClient))
970 TmpRgn = IntSysCreateRectpRgnIndirect(&Window->rcClient);
971 }
972 }
973 }
974 }
975
976 /* Fixes test RDW_INTERNALPAINT behavior */
977 if (TmpRgn == NULL)
978 {
979 TmpRgn = PRGN_WINDOW; // Need a region so the bits can be set!!!
980 }
981
982 /*
983 * Step 3.
984 * Adjust the window update region depending on hRgn and flags.
985 */
986
988 TmpRgn != NULL)
989 {
991 }
992
993 /*
994 * Step 4.
995 * Repaint and erase windows if needed.
996 */
997
998 if (Flags & RDW_UPDATENOW)
999 {
1001 }
1002 else if (Flags & RDW_ERASENOW)
1003 {
1004 if ((Flags & (RDW_NOCHILDREN|RDW_ALLCHILDREN)) == 0)
1006
1008 }
1009
1010 /*
1011 * Step 5.
1012 * Cleanup ;-)
1013 */
1014
1015 if (TmpRgn > PRGN_WINDOW)
1016 {
1017 REGION_Delete(TmpRgn);
1018 }
1019 TRACE("co_UserRedrawWindow exit\n");
1020
1021 return TRUE;
1022}
#define PRGN_WINDOW
Definition: painting.h:12
#define IntSysCreateRectpRgnIndirect(prc)
Definition: region.h:93
#define TRACE(s)
Definition: solgame.cpp:4
Definition: region.h:8
static int UpdateRect(TreeListData *pData, unsigned uItem, unsigned uSub)
Definition: treelist.c:1529
BOOL FASTCALL IntIsWindowDrawable(PWND Wnd)
Definition: painting.c:868
VOID FASTCALL UserSyncAndPaintWindows(PWND pWnd, ULONG Flags)
Definition: painting.c:621
VOID FASTCALL UserUpdateWindows(PWND pWnd, ULONG Flags)
Definition: painting.c:599
VOID FASTCALL IntInvalidateWindows(PWND Wnd, PREGION Rgn, ULONG Flags)
Definition: painting.c:643
FORCEINLINE BOOL RECTL_bIsEmptyRect(_In_ const RECTL *prcl)
Definition: rect.h:44
VOID FASTCALL REGION_Delete(PREGION pRgn)
Definition: region.c:2449
PREGION FASTCALL IntSysCreateRectpRgn(INT LeftRect, INT TopRect, INT RightRect, INT BottomRect)
Definition: region.c:2407
BOOL FASTCALL REGION_bOffsetRgn(_Inout_ PREGION prgn, _In_ INT cx, _In_ INT cy)
Definition: region.c:2707
INT FASTCALL IntGdiCombineRgn(PREGION prgnDest, PREGION prgnSrc1, PREGION prgnSrc2, INT iCombineMode)
Definition: region.c:2487
PWND FASTCALL UserGetDesktopWindow(VOID)
Definition: desktop.c:1403
#define RGN_COPY
Definition: wingdi.h:357
#define RDW_NOINTERNALPAINT
Definition: winuser.h:1220
#define RDW_UPDATENOW
Definition: winuser.h:1223
#define RDW_ERASENOW
Definition: winuser.h:1222
#define RDW_FRAME
Definition: winuser.h:1215
#define RDW_NOFRAME
Definition: winuser.h:1219
#define RDW_INTERNALPAINT
Definition: winuser.h:1216
#define RDW_VALIDATE
Definition: winuser.h:1221
#define RDW_INVALIDATE
Definition: winuser.h:1217

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

◆ IntBeginPaint()

HDC FASTCALL IntBeginPaint ( PWND  Window,
PPAINTSTRUCT  Ps 
)

Definition at line 1442 of file painting.c.

1443{
1444 RECT Rect;
1445 INT type;
1446 BOOL Erase = FALSE;
1447
1449
1450 Window->state2 |= WNDS2_STARTPAINT;
1451 Window->state &= ~WNDS_PAINTNOTPROCESSED;
1452
1453 if (Window->state & WNDS_SENDNCPAINT)
1454 {
1455 HRGN hRgn;
1456 // Application can keep update dirty.
1457 do
1458 {
1459 Window->state &= ~WNDS_UPDATEDIRTY;
1463 {
1464 /* NOTE: The region can already be deleted! */
1466 }
1467 }
1468 while(Window->state & WNDS_UPDATEDIRTY);
1469 }
1470 else
1471 {
1472 Window->state &= ~WNDS_UPDATEDIRTY;
1473 }
1474
1475 RtlZeroMemory(Ps, sizeof(PAINTSTRUCT));
1476
1477 if (Window->state2 & WNDS2_ENDPAINTINVALIDATE)
1478 {
1479 ERR("BP: Another thread invalidated this window\n");
1480 }
1481
1482 Ps->hdc = UserGetDCEx( Window,
1483 Window->hrgnUpdate,
1485 if (!Ps->hdc)
1486 {
1487 return NULL;
1488 }
1489
1490 // If set, always clear flags out due to the conditions later on for sending the message.
1491 if (Window->state & WNDS_SENDERASEBACKGROUND)
1492 {
1494 Erase = TRUE;
1495 }
1496
1497 if (Window->hrgnUpdate != NULL)
1498 {
1499 MsqDecPaintCountQueue(Window->head.pti);
1501 /* The region is part of the dc now and belongs to the process! */
1502 Window->hrgnUpdate = NULL;
1503 }
1504 else
1505 {
1506 if (Window->state & WNDS_INTERNALPAINT)
1507 MsqDecPaintCountQueue(Window->head.pti);
1508 }
1509
1510 type = GdiGetClipBox(Ps->hdc, &Ps->rcPaint);
1511
1513
1514 Window->state &= ~WNDS_INTERNALPAINT;
1515
1516 if ( Erase && // Set to erase,
1517 type != NULLREGION && // don't erase if the clip box is empty,
1518 (!(Window->pcls->style & CS_PARENTDC) || // not parent dc or
1519 RECTL_bIntersectRect( &Rect, &Rect, &Ps->rcPaint) ) ) // intersecting.
1520 {
1522 if ( Ps->fErase )
1523 {
1525 }
1526 }
1527 else
1528 {
1529 Ps->fErase = FALSE;
1530 }
1531
1533
1534 return Ps->hdc;
1535}
void Erase(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, LONG radius)
Definition: drawing.cpp:115
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define WNDS2_ENDPAINTINVALIDATE
Definition: ntuser.h:642
#define WNDS_UPDATEDIRTY
Definition: ntuser.h:618
#define WNDS2_STARTPAINT
Definition: ntuser.h:643
#define GDI_OBJ_HMGR_POWNED
Definition: ntgdihdl.h:117
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
VOID FASTCALL IntSendChildNCPaint(PWND pWnd)
Definition: painting.c:370
BOOL FASTCALL IntGdiSetRegionOwner(HRGN hRgn, DWORD OwnerMask)
Definition: region.c:2459
BOOL FASTCALL co_UserHideCaret(PWND Window OPTIONAL)
Definition: caret.c:226
VOID FASTCALL IntGetClientRect(PWND WindowObject, RECTL *Rect)
Definition: winpos.c:92
#define CS_PARENTDC
Definition: winuser.h:656

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

◆ IntEndPaint()

BOOL FASTCALL IntEndPaint ( PWND  Wnd,
PPAINTSTRUCT  Ps 
)

Definition at line 1539 of file painting.c.

1540{
1541 HDC hdc = NULL;
1542
1543 hdc = Ps->hdc;
1544
1545 UserReleaseDC(Wnd, hdc, TRUE);
1546
1548 {
1549 ERR("EP: Another thread invalidated this window\n");
1550 Wnd->state2 &= ~WNDS2_ENDPAINTINVALIDATE;
1551 }
1552
1554
1555 co_UserShowCaret(Wnd);
1556
1557 return TRUE;
1558}
BOOL FASTCALL co_UserShowCaret(PWND Window OPTIONAL)
Definition: caret.c:262

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

◆ IntFlashWindowEx()

BOOL FASTCALL IntFlashWindowEx ( PWND  pWnd,
PFLASHWINFO  pfwi 
)

Definition at line 1311 of file painting.c.

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

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

◆ IntGetPaintMessage()

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

Definition at line 1191 of file painting.c.

1198{
1199 PWND PaintWnd, StartWnd;
1200
1201 if ((MsgFilterMin != 0 || MsgFilterMax != 0) &&
1202 (MsgFilterMin > WM_PAINT || MsgFilterMax < WM_PAINT))
1203 return FALSE;
1204
1205 if (Thread->TIF_flags & TIF_SYSTEMTHREAD )
1206 {
1207 ERR("WM_PAINT is in a System Thread!\n");
1208 }
1209
1210 StartWnd = UserGetDesktopWindow();
1211 PaintWnd = IntFindWindowToRepaint(StartWnd, Thread);
1212
1213 Message->hwnd = PaintWnd ? UserHMGetHandle(PaintWnd) : NULL;
1214
1215 if (Message->hwnd == NULL && Thread->cPaintsReady)
1216 {
1217 // Find note in window.c:"PAINTING BUG".
1218 ERR("WARNING SOMETHING HAS GONE WRONG: Thread marked as containing dirty windows, but no dirty windows found! Counts %u\n",Thread->cPaintsReady);
1219 /* Hack to stop spamming the debug log ! */
1220 Thread->cPaintsReady = 0;
1221 return FALSE;
1222 }
1223
1224 if (Message->hwnd == NULL)
1225 return FALSE;
1226
1227 if (!(Window == NULL ||
1228 PaintWnd == Window ||
1229 IntIsChildWindow(Window, PaintWnd))) /* check that it is a child of the specified parent */
1230 return FALSE;
1231
1232 if (PaintWnd->state & WNDS_INTERNALPAINT)
1233 {
1234 PaintWnd->state &= ~WNDS_INTERNALPAINT;
1235 if (!PaintWnd->hrgnUpdate)
1237 }
1238 PaintWnd->state2 &= ~WNDS2_STARTPAINT;
1239 PaintWnd->state &= ~WNDS_UPDATEDIRTY;
1240
1241 Window = PaintWnd;
1242 while (Window && !UserIsDesktopWindow(Window))
1243 {
1244 // Role back and check for clip children, do not set if any.
1245 if (Window->spwndParent && !(Window->spwndParent->style & WS_CLIPCHILDREN))
1246 {
1247 PaintWnd->state2 |= WNDS2_WMPAINTSENT;
1248 }
1249 Window = Window->spwndParent;
1250 }
1251
1252 Message->wParam = Message->lParam = 0;
1253 Message->message = WM_PAINT;
1254 return TRUE;
1255}
static const WCHAR Message[]
Definition: register.c:74
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
#define TIF_SYSTEMTHREAD
Definition: ntuser.h:265
PWND FASTCALL IntFindWindowToRepaint(PWND Window, PTHREADINFO Thread)
Definition: painting.c:1141
BOOL FASTCALL IntIsChildWindow(PWND Parent, PWND BaseWindow)
Definition: window.c:930

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:704
RECT rcClient
Definition: ntuser.h:717
struct _WND * spwndParent
Definition: ntuser.h:713
#define WS_EX_REDIRECTED
Definition: undocuser.h:25

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

◆ IntInvalidateWindows()

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

Definition at line 643 of file painting.c.

644{
645 INT RgnType = NULLREGION;
646 BOOL HadPaintMessage;
647
648 TRACE("IntInvalidateWindows start Rgn %p\n",Rgn);
649
650 if ( Rgn > PRGN_WINDOW )
651 {
652 /*
653 * If the nonclient is not to be redrawn, clip the region to the client
654 * rect
655 */
656 if ((Flags & RDW_INVALIDATE) != 0 && (Flags & RDW_FRAME) == 0)
657 {
658 PREGION RgnClient;
659
660 RgnClient = IntSysCreateRectpRgnIndirect(&Wnd->rcClient);
661 if (RgnClient)
662 {
663 RgnType = IntGdiCombineRgn(Rgn, Rgn, RgnClient, RGN_AND);
664 REGION_Delete(RgnClient);
665 }
666 }
667
668 /*
669 * Clip the given region with window rectangle (or region)
670 */
671
672 if (!Wnd->hrgnClip || (Wnd->style & WS_MINIMIZE))
673 {
674 PREGION RgnWindow = IntSysCreateRectpRgnIndirect(&Wnd->rcWindow);
675 if (RgnWindow)
676 {
677 RgnType = IntGdiCombineRgn(Rgn, Rgn, RgnWindow, RGN_AND);
678 REGION_Delete(RgnWindow);
679 }
680 }
681 else
682 {
683 PREGION RgnClip = REGION_LockRgn(Wnd->hrgnClip);
684 if (RgnClip)
685 {
687 -Wnd->rcWindow.left,
688 -Wnd->rcWindow.top);
689 RgnType = IntGdiCombineRgn(Rgn, Rgn, RgnClip, RGN_AND);
691 Wnd->rcWindow.left,
692 Wnd->rcWindow.top);
693 REGION_UnlockRgn(RgnClip);
694 }
695 }
696 }
697 else
698 {
699 RgnType = NULLREGION;
700 }
701
702 /* Nothing to paint, just return */
703 if ((RgnType == NULLREGION && (Flags & RDW_INVALIDATE)) || RgnType == ERROR)
704 {
705 return;
706 }
707
708 /*
709 * Save current state of pending updates
710 */
711
712 HadPaintMessage = IntIsWindowDirty(Wnd);
713
714 /*
715 * Update the region and flags
716 */
717
718 // The following flags are used to invalidate the window.
720 {
722 {
723 Wnd->state |= WNDS_INTERNALPAINT;
724 }
725
726 if (Flags & RDW_INVALIDATE )
727 {
728 PREGION RgnUpdate;
729
730 Wnd->state &= ~WNDS_NONCPAINT;
731
732 /* If not the same thread set it dirty. */
733 if (Wnd->head.pti != PsGetCurrentThreadWin32Thread())
734 {
735 Wnd->state |= WNDS_UPDATEDIRTY;
736 if (Wnd->state2 & WNDS2_WMPAINTSENT)
737 Wnd->state2 |= WNDS2_ENDPAINTINVALIDATE;
738 }
739
740 if (Flags & RDW_FRAME)
741 Wnd->state |= WNDS_SENDNCPAINT;
742
743 if (Flags & RDW_ERASE)
744 Wnd->state |= WNDS_SENDERASEBACKGROUND;
745
746 if (RgnType != NULLREGION && Rgn > PRGN_WINDOW)
747 {
748 if (Wnd->hrgnUpdate == NULL)
749 {
750 Wnd->hrgnUpdate = NtGdiCreateRectRgn(0, 0, 0, 0);
752 }
753
754 if (Wnd->hrgnUpdate != HRGN_WINDOW)
755 {
756 RgnUpdate = REGION_LockRgn(Wnd->hrgnUpdate);
757 if (RgnUpdate)
758 {
759 RgnType = IntGdiCombineRgn(RgnUpdate, RgnUpdate, Rgn, RGN_OR);
760 REGION_UnlockRgn(RgnUpdate);
761 if (RgnType == NULLREGION)
762 {
764 GreDeleteObject(Wnd->hrgnUpdate);
765 Wnd->hrgnUpdate = NULL;
766 }
767 }
768 }
769 }
770
771 Flags |= RDW_ERASE|RDW_FRAME; // For children.
772
773 }
774
775 if (!HadPaintMessage && IntIsWindowDirty(Wnd))
776 {
777 MsqIncPaintCountQueue(Wnd->head.pti);
778 }
779
780 } // The following flags are used to validate the window.
782 {
783 if (Wnd->state & WNDS_UPDATEDIRTY && !(Flags & RDW_NOUPDATEDIRTY))
784 return;
785
787 {
788 Wnd->state &= ~WNDS_INTERNALPAINT;
789 }
790
791 if (Flags & RDW_VALIDATE)
792 {
793 if (Flags & RDW_NOFRAME)
794 Wnd->state &= ~WNDS_SENDNCPAINT;
795
796 if (Flags & RDW_NOERASE)
798
799 if (Wnd->hrgnUpdate > HRGN_WINDOW && RgnType != NULLREGION && Rgn > PRGN_WINDOW)
800 {
801 PREGION RgnUpdate = REGION_LockRgn(Wnd->hrgnUpdate);
802
803 if (RgnUpdate)
804 {
805 RgnType = IntGdiCombineRgn(RgnUpdate, RgnUpdate, Rgn, RGN_DIFF);
806 REGION_UnlockRgn(RgnUpdate);
807
808 if (RgnType == NULLREGION)
809 {
811 GreDeleteObject(Wnd->hrgnUpdate);
812 Wnd->hrgnUpdate = NULL;
813 }
814 }
815 }
816 // If update is null, do not erase.
817 if (Wnd->hrgnUpdate == NULL)
818 {
820 }
821 }
822
823 if (HadPaintMessage && !IntIsWindowDirty(Wnd))
824 {
825 MsqDecPaintCountQueue(Wnd->head.pti);
826 }
827 }
828
829 /*
830 * Process children if needed
831 */
832
833 if (!(Flags & RDW_NOCHILDREN) &&
834 !(Wnd->style & WS_MINIMIZE) &&
835 ((Flags & RDW_ALLCHILDREN) || !(Wnd->style & WS_CLIPCHILDREN)))
836 {
837 PWND Child;
838
839 for (Child = Wnd->spwndChild; Child; Child = Child->spwndNext)
840 {
841 if (Child->style & WS_VISIBLE)
842 {
843 /*
844 * Recursive call to update children hrgnUpdate
845 */
846 PREGION RgnTemp = IntSysCreateRectpRgn(0, 0, 0, 0);
847 if (RgnTemp)
848 {
849 if (Rgn > PRGN_WINDOW) IntGdiCombineRgn(RgnTemp, Rgn, 0, RGN_COPY);
850 IntInvalidateWindows(Child, ((Rgn > PRGN_WINDOW)?RgnTemp:Rgn), Flags);
851 REGION_Delete(RgnTemp);
852 }
853 }
854 }
855 }
856 TRACE("IntInvalidateWindows exit\n");
857}
VOID FASTCALL MsqIncPaintCountQueue(PTHREADINFO pti)
Definition: msgqueue.c:501
__kernel_entry W32KAPI HRGN APIENTRY NtGdiCreateRectRgn(_In_ INT xLeft, _In_ INT yTop, _In_ INT xRight, _In_ INT yBottom)
#define GDI_OBJ_HMGR_PUBLIC
Definition: ntgdihdl.h:116
#define RDW_NOUPDATEDIRTY
Definition: painting.h:16
BOOL FASTCALL IntIsWindowDirty(PWND Wnd)
Definition: painting.c:1125
PREGION FASTCALL REGION_LockRgn(_In_ HRGN hrgn)
Definition: region.c:2358
VOID FASTCALL REGION_UnlockRgn(_In_ PREGION prgn)
Definition: region.c:2373
#define RGN_DIFF
Definition: wingdi.h:358
#define RGN_OR
Definition: wingdi.h:359
#define RDW_ERASE
Definition: winuser.h:1214
#define RDW_NOERASE
Definition: winuser.h:1218

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

◆ IntIsWindowDirty()

BOOL FASTCALL IntIsWindowDirty ( PWND  Wnd)

Definition at line 1125 of file painting.c.

1126{
1127 return ( Wnd->style & WS_VISIBLE &&
1128 ( Wnd->hrgnUpdate != NULL ||
1129 Wnd->state & WNDS_INTERNALPAINT ) );
1130}

Referenced by IntFindWindowToRepaint(), and IntInvalidateWindows().

◆ IntIsWindowDrawable()

BOOL FASTCALL IntIsWindowDrawable ( PWND  Wnd)

Definition at line 868 of file painting.c.

869{
870 PWND WndObject;
871
872 for (WndObject = Wnd; WndObject != NULL; WndObject = WndObject->spwndParent)
873 {
874 if ( WndObject->state2 & WNDS2_INDESTROY ||
875 WndObject->state & WNDS_DESTROYED ||
876 !WndObject ||
877 !(WndObject->style & WS_VISIBLE) ||
878 ((WndObject->style & WS_MINIMIZE) && (WndObject != Wnd)))
879 {
880 return FALSE;
881 }
882 }
883
884 return TRUE;
885}
#define WNDS_DESTROYED
Definition: ntuser.h:636
#define WNDS2_INDESTROY
Definition: ntuser.h:648

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

◆ IntPaintWindow()

VOID FASTCALL IntPaintWindow ( PWND  Window)

Definition at line 1184 of file painting.c.

1185{
1186 // Handle normal painting.
1188}

Referenced by IntDispatchMessage().

◆ 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;
358 }
359
361 {
362 pWnd->state2 &= ~WNDS2_FORCEFULLNCPAINTCLIPRGN;
364 }
365
367}
#define WNDS2_FORCEFULLNCPAINTCLIPRGN
Definition: ntuser.h:664
struct _THREADINFO * GetW32ThreadInfo(VOID)
Definition: misc.c:807
#define WM_NCPAINT
Definition: winuser.h:1690

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

◆ IntSendSyncPaint()

VOID FASTCALL IntSendSyncPaint ( PWND  Wnd,
ULONG  Flags 
)

Definition at line 132 of file painting.c.

133{
134 PTHREADINFO ptiCur, ptiWnd;
137 BOOL bSend = TRUE;
138
139 ptiWnd = Wnd->head.pti;
141 /*
142 Not the current thread, Wnd is in send Nonclient paint also in send erase background and it is visiable.
143 */
144 if ( Wnd->head.pti != ptiCur &&
145 Wnd->state & WNDS_SENDNCPAINT &&
147 Wnd->style & WS_VISIBLE)
148 {
149 // For testing, if you see this, break out the Champagne and have a party!
150 TRACE("SendSyncPaint Wnd in State!\n");
151 if (!IsListEmpty(&ptiWnd->SentMessagesListHead))
152 {
153 // Scan sent queue messages to see if we received sync paint messages.
156 do
157 {
158 TRACE("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 IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
#define WNDS_SYNCPAINTPENDING
Definition: ntuser.h:628
base of all file and directory entries
Definition: entries.h:83
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
LIST_ENTRY SentMessagesListHead
Definition: win32.h:100
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
VOID FASTCALL IntSendSyncPaint(PWND Wnd, ULONG Flags)
Definition: painting.c:132
LRESULT FASTCALL co_IntSendMessageNoWait(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1763
#define WM_SYNCPAINT
Definition: winuser.h:1693

Referenced by IntSendSyncPaint(), and UserSyncAndPaintWindows().

◆ NC_IconForWindow()

PCURICON_OBJECT FASTCALL NC_IconForWindow ( PWND  pWnd)

Definition at line 733 of file nonclient.c.

734{
735 PCURICON_OBJECT pIcon = NULL;
736 HICON hIcon;
737
739 if (!hIcon) hIcon = UserGetProp(pWnd, gpsi->atomIconProp, TRUE);
740
741 if (!hIcon && pWnd->pcls->spicnSm)
742 return pWnd->pcls->spicnSm;
743 if (!hIcon && pWnd->pcls->spicn)
744 return pWnd->pcls->spicn;
745
746 // WARNING: Wine code has this test completely wrong. The following is how
747 // Windows behaves for windows having the WS_EX_DLGMODALFRAME style set:
748 // it does not use the default icon! And it does not check for DS_MODALFRAME.
749 if (!hIcon && !(pWnd->ExStyle & WS_EX_DLGMODALFRAME))
750 {
751 hIcon = gpsi->hIconSmWindows; // Both are IDI_WINLOGO Small
752 if (!hIcon) hIcon = gpsi->hIconWindows; // Reg size.
753 }
754 if (hIcon)
755 {
757 hIcon,
759 }
760 return pIcon;
761}
struct _CURICON_OBJECT * PCURICON_OBJECT
@ TYPE_CURSOR
Definition: ntuser.h:43
static HICON
Definition: imagelist.c:80
HICON hIcon
Definition: msconfig.c:44
#define WS_EX_DLGMODALFRAME
Definition: pedump.c:645
struct _CURICON_OBJECT * spicn
Definition: ntuser.h:585
struct _CURICON_OBJECT * spicnSm
Definition: ntuser.h:590
PCLS pcls
Definition: ntuser.h:720
ATOM atomIconProp
Definition: ntuser.h:1066
ATOM atomIconSmProp
Definition: ntuser.h:1065
PUSER_HANDLE_TABLE gHandleTable
Definition: object.c:13
PVOID UserGetObjectNoErr(PUSER_HANDLE_TABLE ht, HANDLE handle, HANDLE_TYPE type)
Definition: object.c:481

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

◆ UpdateThreadWindows()

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

Definition at line 1100 of file painting.c.

1101{
1102 PWND pwndTemp;
1103
1104 for ( pwndTemp = pWnd;
1105 pwndTemp;
1106 pwndTemp = pwndTemp->spwndNext )
1107 {
1108 if (pwndTemp->head.pti == pti)
1109 {
1111 }
1112 else
1113 {
1114 if (IsThreadSuspended(pwndTemp->head.pti) || MsqIsHung(pwndTemp->head.pti, MSQ_HUNG))
1115 {
1116 UpdateTheadChildren(pwndTemp, hRgn);
1117 }
1118 else
1120 }
1121 }
1122}
BOOL FASTCALL IsThreadSuspended(PTHREADINFO pti)
Definition: msgqueue.c:2180
BOOL FASTCALL MsqIsHung(PTHREADINFO pti, DWORD TimeOut)
Definition: msgqueue.c:2149
#define MSQ_HUNG
Definition: msgqueue.h:3
VOID FASTCALL UpdateTheadChildren(PWND pWnd, HRGN hRgn)
Definition: painting.c:1084

Referenced by DefWndDoSizeMove().

◆ UserDrawCaption()

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

Definition at line 2192 of file painting.c.

2200{
2201 BOOL Ret = FALSE;
2202 HBRUSH hBgBrush, hOldBrush = NULL;
2203 RECTL Rect = *lpRc;
2204 BOOL HasIcon;
2205
2207
2208 /* Determine whether the icon needs to be displayed */
2209 if (!hIcon && pWnd != NULL)
2210 {
2211 HasIcon = (uFlags & DC_ICON) && !(uFlags & DC_SMALLCAP) &&
2212 (pWnd->style & WS_SYSMENU) && !(pWnd->ExStyle & WS_EX_TOOLWINDOW);
2213 }
2214 else
2215 HasIcon = (hIcon != NULL);
2216
2217 // Draw the caption background
2218 if((uFlags & DC_GRADIENT) && !(uFlags & DC_INBUTTON))
2219 {
2220 static GRADIENT_RECT gcap = {0, 1};
2221 TRIVERTEX Vertices[2];
2222 COLORREF Colors[2];
2223
2226
2229
2230 Vertices[0].x = Rect.left;
2231 Vertices[0].y = Rect.top;
2232 Vertices[0].Red = (WORD)Colors[0]<<8;
2233 Vertices[0].Green = (WORD)Colors[0] & 0xFF00;
2234 Vertices[0].Blue = (WORD)(Colors[0]>>8) & 0xFF00;
2235 Vertices[0].Alpha = 0;
2236
2237 Vertices[1].x = Rect.right;
2238 Vertices[1].y = Rect.bottom;
2239 Vertices[1].Red = (WORD)Colors[1]<<8;
2240 Vertices[1].Green = (WORD)Colors[1] & 0xFF00;
2241 Vertices[1].Blue = (WORD)(Colors[1]>>8) & 0xFF00;
2242 Vertices[1].Alpha = 0;
2243
2244 if(!GreGradientFill(hDc, Vertices, 2, &gcap, 1, GRADIENT_FILL_RECT_H))
2245 {
2246 ERR("GreGradientFill() failed!\n");
2247 goto cleanup;
2248 }
2249 }
2250 else
2251 {
2252 if(uFlags & DC_INBUTTON)
2254 else if(uFlags & DC_ACTIVE)
2256 else
2258
2259 hOldBrush = NtGdiSelectBrush(hDc, hBgBrush);
2260
2261 if(!hOldBrush)
2262 {
2263 ERR("NtGdiSelectBrush() failed!\n");
2264 goto cleanup;
2265 }
2266
2267 if(!NtGdiPatBlt(hDc, Rect.left, Rect.top,
2268 Rect.right - Rect.left,
2269 Rect.bottom - Rect.top,
2270 PATCOPY))
2271 {
2272 ERR("NtGdiPatBlt() failed!\n");
2273 goto cleanup;
2274 }
2275 }
2276
2277 /* Draw icon */
2278 if (HasIcon)
2279 {
2280 PCURICON_OBJECT pIcon = NULL;
2281
2282 if (hIcon)
2283 {
2284 pIcon = UserGetCurIconObject(hIcon);
2285 }
2286 else if (pWnd)
2287 {
2288 pIcon = NC_IconForWindow(pWnd);
2289 // FIXME: NC_IconForWindow should reference it for us */
2290 if (pIcon)
2291 UserReferenceObject(pIcon);
2292 }
2293
2294 if (pIcon)
2295 {
2298 LONG x = Rect.left - cx/2 + 1 + (Rect.bottom - Rect.top)/2; // this is really what Window does
2299 LONG y = (Rect.top + Rect.bottom - cy)/2; // center
2300 UserDrawIconEx(hDc, x, y, pIcon, cx, cy, 0, NULL, DI_NORMAL);
2301 UserDereferenceObject(pIcon);
2302 }
2303 else
2304 {
2305 HasIcon = FALSE;
2306 }
2307 }
2308
2309 if (HasIcon)
2310 Rect.left += Rect.bottom - Rect.top;
2311
2312 if((uFlags & DC_TEXT))
2313 {
2314 BOOL Set = FALSE;
2315 Rect.left += 2;
2316
2317 if (Str)
2318 Set = UserDrawCaptionText(pWnd, hDc, Str, &Rect, uFlags, hFont);
2319 else if (pWnd != NULL) // FIXME: Windows does not do that
2320 {
2321 UNICODE_STRING ustr;
2322 ustr.Buffer = pWnd->strName.Buffer; // FIXME: LARGE_STRING truncated!
2323 ustr.Length = (USHORT)min(pWnd->strName.Length, MAXUSHORT);
2325 Set = UserDrawCaptionText(pWnd, hDc, &ustr, &Rect, uFlags, hFont);
2326 }
2327 if (pWnd)
2328 {
2329 if (Set)
2330 pWnd->state2 &= ~WNDS2_CAPTIONTEXTTRUNCATED;
2331 else
2333 }
2334 }
2335
2336 Ret = TRUE;
2337
2338cleanup:
2339 if (hOldBrush) NtGdiSelectBrush(hDc, hOldBrush);
2340
2341 return Ret;
2342}
Colors
Definition: ansiprsr.h:4
HFONT hFont
Definition: main.c:53
#define DC_ACTIVE
Definition: dc21x4.h:120
UINT uFlags
Definition: api.c:59
static void cleanup(void)
Definition: main.c:1335
unsigned short WORD
Definition: ntddk_ex.h:93
BOOL NTAPI GreGradientFill(HDC hdc, PTRIVERTEX pVertex, ULONG nVertex, PVOID pMesh, ULONG nMesh, ULONG ulMode)
Definition: fillshap.c:940
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define WNDS2_CAPTIONTEXTTRUNCATED
Definition: ntuser.h:666
HGDIOBJ FASTCALL IntGetSysColorBrush(INT Object)
Definition: stockobj.c:317
DWORD FASTCALL IntGetSysColor(INT nIndex)
Definition: stockobj.c:323
#define min(a, b)
Definition: monoChain.cc:55
__kernel_entry W32KAPI HBRUSH APIENTRY NtGdiSelectBrush(_In_ HDC hdc, _In_ HBRUSH hbrush)
__kernel_entry W32KAPI BOOL APIENTRY NtGdiPatBlt(_In_ HDC hdcDest, _In_ INT x, _In_ INT y, _In_ INT cx, _In_ INT cy, _In_ DWORD dwRop)
Definition: bitblt.c:992
static BOOL Set
Definition: pageheap.c:10
#define WS_SYSMENU
Definition: pedump.c:629
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
_Out_opt_ int * cx
Definition: commctrl.h:585
COLOR16 Red
Definition: wingdi.h:2786
LONG y
Definition: wingdi.h:2785
COLOR16 Green
Definition: wingdi.h:2787
COLOR16 Alpha
Definition: wingdi.h:2789
COLOR16 Blue
Definition: wingdi.h:2788
LONG x
Definition: wingdi.h:2784
USHORT MaximumLength
Definition: env_spec_w32.h:370
LARGE_UNICODE_STRING strName
Definition: ntuser.h:736
#define MAXUSHORT
Definition: typedefs.h:83
BOOL UserDrawCaptionText(PWND pWnd, HDC hDc, const PUNICODE_STRING Text, const RECTL *lpRc, UINT uFlags, HFONT hFont)
Definition: painting.c:2086
VOID FASTCALL RECTL_vMakeWellOrdered(_Inout_ RECTL *prcl)
Definition: rect.c:81
PCURICON_OBJECT FASTCALL UserGetCurIconObject(HCURSOR hCurIcon)
Definition: cursoricon.c:200
BOOL UserDrawIconEx(HDC hDc, INT xLeft, INT yTop, PCURICON_OBJECT pIcon, INT cxWidth, INT cyHeight, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags)
Definition: cursoricon.c:1689
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:214
PCURICON_OBJECT FASTCALL NC_IconForWindow(PWND pWnd)
Definition: nonclient.c:733
BOOL FASTCALL UserDereferenceObject(PVOID Object)
Definition: object.c:644
VOID FASTCALL UserReferenceObject(PVOID obj)
Definition: object.c:731
DWORD COLORREF
Definition: windef.h:300
#define DI_NORMAL
Definition: wingdi.h:72
#define PATCOPY
Definition: wingdi.h:335
#define DC_INBUTTON
Definition: winuser.h:431
#define COLOR_GRADIENTINACTIVECAPTION
Definition: winuser.h:948
#define COLOR_ACTIVECAPTION
Definition: winuser.h:918
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define SM_CYSMICON
Definition: winuser.h:1016
#define COLOR_INACTIVECAPTION
Definition: winuser.h:919
#define COLOR_GRADIENTACTIVECAPTION
Definition: winuser.h:947
#define SM_CXSMICON
Definition: winuser.h:1015
#define DC_TEXT
Definition: winuser.h:430
#define DC_ICON
Definition: winuser.h:429
#define DC_SMALLCAP
Definition: winuser.h:428
#define COLOR_3DFACE
Definition: winuser.h:932

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

◆ UserRealizePalette()

INT FASTCALL UserRealizePalette ( HDC  hdc)

Definition at line 2346 of file painting.c.

2347{
2348 HWND hWnd, hWndDesktop;
2349 DWORD Ret;
2350
2352 if (Ret) // There was a change.
2353 {
2355 if (hWnd) // Send broadcast if dc is associated with a window.
2356 { // FYI: Thread locked in CallOneParam.
2357 hWndDesktop = IntGetDesktopWindow();
2358 if ( hWndDesktop != hWnd )
2359 {
2360 PWND pWnd = UserGetWindowObject(hWndDesktop);
2361 ERR("RealizePalette Desktop.\n");
2362 hdc = UserGetWindowDC(pWnd);
2364 UserReleaseDC(pWnd,hdc,FALSE);
2365 }
2367 }
2368 }
2369 return Ret;
2370}
UINT FASTCALL IntGdiRealizePalette(HDC)
Definition: palette.c:731
HWND FASTCALL IntWindowFromDC(HDC hDc)
Definition: windc.c:894
unsigned long DWORD
Definition: ntddk_ex.h:95
HDC FASTCALL UserGetWindowDC(PWND Wnd)
Definition: windc.c:947
HWND FASTCALL IntGetDesktopWindow(VOID)
Definition: desktop.c:1391
BOOL FASTCALL IntPaintDesktop(HDC hDC)
Definition: desktop.c:1852
BOOL FASTCALL UserSendNotifyMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:2090
#define HWND_BROADCAST
Definition: winuser.h:1207
#define WM_PALETTECHANGED
Definition: winuser.h:1880

◆ UserSyncAndPaintWindows()

VOID FASTCALL UserSyncAndPaintWindows ( PWND  pWnd,
ULONG  Flags 
)

Definition at line 621 of file painting.c.

622{
623 PWND Parent = pWnd;
624 // Find parent, if it needs to be painted, leave.
625 while(TRUE)
626 {
627 if ((Parent = Parent->spwndParent) == NULL) break;
628 if ( Parent->style & WS_CLIPCHILDREN ) break;
629 if ( Parent->hrgnUpdate != NULL || Parent->state & WNDS_INTERNALPAINT ) return;
630 }
631
632 IntSendSyncPaint(pWnd, Flags);
634}
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE Parent
Definition: acpixf.h:732

Referenced by co_UserRedrawWindow(), and co_WinPosSetWindowPos().