ReactOS 0.4.15-dev-8119-g4fb2fdb
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: debug.h:113
#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:92
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:40
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:122
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:1445
#define USERTAG_WINDOWLIST
Definition: tags.h:298
HWND *FASTCALL IntWinListChildren(PWND Window)
Definition: window.c:274
BOOL FASTCALL IntIsWindow(HWND hWnd)
Definition: window.c:176
UINT_PTR WPARAM
Definition: windef.h:207
#define WM_ERASEBKGND
Definition: winuser.h:1625
#define DCX_CACHE
Definition: winuser.h:2114
#define RDW_NOCHILDREN
Definition: winuser.h:1222
#define DCX_INTERSECTRGN
Definition: winuser.h:2122
#define RDW_ALLCHILDREN
Definition: winuser.h:1221
_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{
522
523 if ( Wnd->hrgnUpdate != NULL || Wnd->state & WNDS_INTERNALPAINT )
524 {
525 if (Wnd->hrgnUpdate)
526 {
527 if (!IntValidateParents(Wnd, Recurse))
528 {
529 return;
530 }
531 }
532
533 if (Wnd->state & WNDS_INTERNALPAINT)
534 {
535 Wnd->state &= ~WNDS_INTERNALPAINT;
536
537 if (Wnd->hrgnUpdate == NULL)
538 MsqDecPaintCountQueue(Wnd->head.pti);
539 }
540
542 Wnd->state &= ~WNDS_UPDATEDIRTY;
543
546
547 if (Wnd->state & WNDS_PAINTNOTPROCESSED)
548 {
550 UserRefObjectCo(Wnd, &Ref);
553 }
554 }
555
556 // Force flags as a toggle. Fixes msg:test_paint_messages:WmChildPaintNc.
557 Flags = (Flags & RDW_NOCHILDREN) ? RDW_NOCHILDREN : RDW_ALLCHILDREN; // All children is the default.
558
559 /*
560 * Update child windows.
561 */
562
563 if (!(Flags & RDW_NOCHILDREN) &&
566 {
567 PWND Child;
568
569 for (Child = Wnd->spwndChild; Child; Child = Child->spwndNext)
570 {
571 /* transparent window, check for non-transparent sibling to paint first, then skip it */
572 if ( Child->ExStyle & WS_EX_TRANSPARENT &&
573 ( Child->hrgnUpdate != NULL || Child->state & WNDS_INTERNALPAINT ) )
574 {
575 PWND Next = Child->spwndNext;
576 while (Next)
577 {
578 if ( Next->hrgnUpdate != NULL || Next->state & WNDS_INTERNALPAINT ) break;
579
580 Next = Next->spwndNext;
581 }
582
583 if (Next) continue;
584 }
585
586 if (Child->style & WS_VISIBLE)
587 {
589 UserRefObjectCo(Child, &Ref);
592 }
593 }
594 }
595}
#define 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:1620

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

1863{
1865 BOOL Ret = TRUE;
1866
1867 if (bErase)
1868 {
1870 UserRefObjectCo(Window, &Ref);
1873 }
1874
1875 Window->state &= ~WNDS_UPDATEDIRTY;
1876
1877 if (Window->hrgnUpdate == NULL)
1878 {
1879 pRect->left = pRect->top = pRect->right = pRect->bottom = 0;
1880 Ret = FALSE;
1881 }
1882 else
1883 {
1884 /* Get the update region bounding box. */
1885 if (Window->hrgnUpdate == HRGN_WINDOW)
1886 {
1887 *pRect = Window->rcClient;
1888 ERR("GURt: Caller is retrieving Window Region 1\n");
1889 }
1890 else
1891 {
1892 RegionType = IntGdiGetRgnBox(Window->hrgnUpdate, pRect);
1893
1895 RECTL_bIntersectRect(pRect, pRect, &Window->rcClient);
1896 }
1897
1898 if (IntIntersectWithParents(Window, pRect))
1899 {
1901 {
1902 RECTL_vOffsetRect(pRect,
1903 -Window->rcClient.left,
1904 -Window->rcClient.top);
1905 }
1906 if (Window->pcls->style & CS_OWNDC)
1907 {
1908 HDC hdc;
1909 //DWORD layout;
1911 //layout = NtGdiSetLayout(hdc, -1, 0);
1912 //IntMapWindowPoints( 0, Window, (LPPOINT)pRect, 2 );
1913 GreDPtoLP( hdc, (LPPOINT)pRect, 2 );
1914 //NtGdiSetLayout(hdc, -1, layout);
1916 }
1917 }
1918 else
1919 {
1920 pRect->left = pRect->top = pRect->right = pRect->bottom = 0;
1921 }
1922 }
1923 return Ret;
1924}
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 1790 of file painting.c.

1791{
1792 int RegionType;
1793 BOOL Type;
1794 RECTL Rect;
1795
1797
1798 if (bErase)
1799 {
1801 UserRefObjectCo(Window, &Ref);
1804 }
1805
1806 Window->state &= ~WNDS_UPDATEDIRTY;
1807
1808 if (Window->hrgnUpdate == NULL)
1809 {
1810 NtGdiSetRectRgn(hRgn, 0, 0, 0, 0);
1811 return NULLREGION;
1812 }
1813
1814 Rect = Window->rcClient;
1816
1817 if (Window->hrgnUpdate == HRGN_WINDOW)
1818 {
1819 // Trap it out.
1820 ERR("GURn: Caller is passing Window Region 1\n");
1821 if (!Type)
1822 {
1823 NtGdiSetRectRgn(hRgn, 0, 0, 0, 0);
1824 return NULLREGION;
1825 }
1826
1828
1830 {
1832 -Window->rcClient.left,
1833 -Window->rcClient.top);
1834 }
1836 }
1837 else
1838 {
1839 HRGN hrgnTemp = GreCreateRectRgnIndirect(&Rect);
1840
1841 RegionType = NtGdiCombineRgn(hRgn, hrgnTemp, Window->hrgnUpdate, RGN_AND);
1842
1844 {
1845 if (hrgnTemp) GreDeleteObject(hrgnTemp);
1846 NtGdiSetRectRgn(hRgn, 0, 0, 0, 0);
1847 return RegionType;
1848 }
1849
1851 {
1853 -Window->rcClient.left,
1854 -Window->rcClient.top);
1855 }
1856 if (hrgnTemp) GreDeleteObject(hrgnTemp);
1857 }
1858 return RegionType;
1859}
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 894 of file painting.c.

899{
900 PREGION TmpRgn = NULL;
901 TRACE("co_UserRedrawWindow start Rgn %p\n",UpdateRgn);
902
903 /*
904 * Step 1.
905 * Validation of passed parameters.
906 */
907
909 {
910 return TRUE; // Just do nothing!!!
911 }
912
913 if (Window == NULL)
914 {
916 }
917
918 /*
919 * Step 2.
920 * Transform the parameters UpdateRgn and UpdateRect into
921 * a region hRgn specified in screen coordinates.
922 */
923
924 if (Flags & (RDW_INVALIDATE | RDW_VALIDATE)) // Both are OKAY!
925 {
926 /* We can't hold lock on GDI objects while doing roundtrips to user mode,
927 * so use a copy instead */
928 if (UpdateRgn)
929 {
930 TmpRgn = IntSysCreateRectpRgn(0, 0, 0, 0);
931
932 if (UpdateRgn > PRGN_WINDOW)
933 {
934 IntGdiCombineRgn(TmpRgn, UpdateRgn, NULL, RGN_COPY);
935 }
936
938 {
939 REGION_bOffsetRgn(TmpRgn, Window->rcClient.left, Window->rcClient.top);
940 }
941 }
942 else
943 {
944 if (UpdateRect != NULL)
945 {
947 {
949 }
950 else
951 {
952 TmpRgn = IntSysCreateRectpRgn(Window->rcClient.left + UpdateRect->left,
953 Window->rcClient.top + UpdateRect->top,
954 Window->rcClient.left + UpdateRect->right,
955 Window->rcClient.top + UpdateRect->bottom);
956 }
957 }
958 else
959 {
962 {
963 if (!RECTL_bIsEmptyRect(&Window->rcWindow))
964 TmpRgn = IntSysCreateRectpRgnIndirect(&Window->rcWindow);
965 }
966 else
967 {
968 if (!RECTL_bIsEmptyRect(&Window->rcClient))
969 TmpRgn = IntSysCreateRectpRgnIndirect(&Window->rcClient);
970 }
971 }
972 }
973 }
974
975 /* Fixes test RDW_INTERNALPAINT behavior */
976 if (TmpRgn == NULL)
977 {
978 TmpRgn = PRGN_WINDOW; // Need a region so the bits can be set!!!
979 }
980
981 /*
982 * Step 3.
983 * Adjust the window update region depending on hRgn and flags.
984 */
985
987 TmpRgn != NULL)
988 {
990 }
991
992 /*
993 * Step 4.
994 * Repaint and erase windows if needed.
995 */
996
997 if (Flags & RDW_UPDATENOW)
998 {
1000 }
1001 else if (Flags & RDW_ERASENOW)
1002 {
1003 if ((Flags & (RDW_NOCHILDREN|RDW_ALLCHILDREN)) == 0)
1005
1007 }
1008
1009 /*
1010 * Step 5.
1011 * Cleanup ;-)
1012 */
1013
1014 if (TmpRgn > PRGN_WINDOW)
1015 {
1016 REGION_Delete(TmpRgn);
1017 }
1018 TRACE("co_UserRedrawWindow exit\n");
1019
1020 return TRUE;
1021}
#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:867
VOID FASTCALL UserSyncAndPaintWindows(PWND pWnd, ULONG Flags)
Definition: painting.c:620
VOID FASTCALL UserUpdateWindows(PWND pWnd, ULONG Flags)
Definition: painting.c:598
VOID FASTCALL IntInvalidateWindows(PWND Wnd, PREGION Rgn, ULONG Flags)
Definition: painting.c:642
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:1386
#define RGN_COPY
Definition: wingdi.h:357
#define RDW_NOINTERNALPAINT
Definition: winuser.h:1217
#define RDW_UPDATENOW
Definition: winuser.h:1220
#define RDW_ERASENOW
Definition: winuser.h:1219
#define RDW_FRAME
Definition: winuser.h:1212
#define RDW_NOFRAME
Definition: winuser.h:1216
#define RDW_INTERNALPAINT
Definition: winuser.h:1213
#define RDW_VALIDATE
Definition: winuser.h:1218
#define RDW_INVALIDATE
Definition: winuser.h:1214

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

1442{
1443 RECT Rect;
1444 INT type;
1445 BOOL Erase = FALSE;
1446
1448
1449 Window->state2 |= WNDS2_STARTPAINT;
1450 Window->state &= ~WNDS_PAINTNOTPROCESSED;
1451
1452 if (Window->state & WNDS_SENDNCPAINT)
1453 {
1454 HRGN hRgn;
1455 // Application can keep update dirty.
1456 do
1457 {
1458 Window->state &= ~WNDS_UPDATEDIRTY;
1462 {
1463 /* NOTE: The region can already be deleted! */
1465 }
1466 }
1467 while(Window->state & WNDS_UPDATEDIRTY);
1468 }
1469 else
1470 {
1471 Window->state &= ~WNDS_UPDATEDIRTY;
1472 }
1473
1474 RtlZeroMemory(Ps, sizeof(PAINTSTRUCT));
1475
1476 if (Window->state2 & WNDS2_ENDPAINTINVALIDATE)
1477 {
1478 ERR("BP: Another thread invalidated this window\n");
1479 }
1480
1481 Ps->hdc = UserGetDCEx( Window,
1482 Window->hrgnUpdate,
1484 if (!Ps->hdc)
1485 {
1486 return NULL;
1487 }
1488
1489 // If set, always clear flags out due to the conditions later on for sending the message.
1490 if (Window->state & WNDS_SENDERASEBACKGROUND)
1491 {
1493 Erase = TRUE;
1494 }
1495
1496 if (Window->hrgnUpdate != NULL)
1497 {
1498 MsqDecPaintCountQueue(Window->head.pti);
1500 /* The region is part of the dc now and belongs to the process! */
1501 Window->hrgnUpdate = NULL;
1502 }
1503 else
1504 {
1505 if (Window->state & WNDS_INTERNALPAINT)
1506 MsqDecPaintCountQueue(Window->head.pti);
1507 }
1508
1509 type = GdiGetClipBox(Ps->hdc, &Ps->rcPaint);
1510
1512
1513 Window->state &= ~WNDS_INTERNALPAINT;
1514
1515 if ( Erase && // Set to erase,
1516 type != NULLREGION && // don't erase if the clip box is empty,
1517 (!(Window->pcls->style & CS_PARENTDC) || // not parent dc or
1518 RECTL_bIntersectRect( &Rect, &Rect, &Ps->rcPaint) ) ) // intersecting.
1519 {
1521 if ( Ps->fErase )
1522 {
1524 }
1525 }
1526 else
1527 {
1528 Ps->fErase = FALSE;
1529 }
1530
1532
1533 return Ps->hdc;
1534}
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 1538 of file painting.c.

1539{
1540 HDC hdc = NULL;
1541
1542 hdc = Ps->hdc;
1543
1544 UserReleaseDC(Wnd, hdc, TRUE);
1545
1547 {
1548 ERR("EP: Another thread invalidated this window\n");
1549 Wnd->state2 &= ~WNDS2_ENDPAINTINVALIDATE;
1550 }
1551
1553
1554 co_UserShowCaret(Wnd);
1555
1556 return TRUE;
1557}
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 1310 of file painting.c.

1311{
1312 DWORD_PTR FlashState;
1313 UINT uCount = pfwi->uCount;
1314 BOOL Activate = FALSE, Ret = FALSE;
1315
1316 ASSERT(pfwi);
1317
1318 FlashState = (DWORD_PTR)UserGetProp(pWnd, AtomFlashWndState, TRUE);
1319
1320 if (FlashState == FLASHW_FINISHED)
1321 {
1322 // Cycle has finished, kill timer and set this to Stop.
1323 FlashState |= FLASHW_KILLSYSTIMER;
1324 pfwi->dwFlags = FLASHW_STOP;
1325 }
1326 else
1327 {
1328 if (FlashState)
1329 {
1330 if (pfwi->dwFlags == FLASHW_SYSTIMER)
1331 {
1332 // Called from system timer, restore flags, counts and state.
1333 pfwi->dwFlags = LOWORD(FlashState);
1334 uCount = HIWORD(FlashState);
1335 FlashState = MAKELONG(LOWORD(FlashState),0);
1336 }
1337 else
1338 {
1339 // Clean out the trash! Fix SeaMonkey crash after restart.
1340 FlashState = 0;
1341 }
1342 }
1343
1344 if (FlashState == 0)
1345 { // First time in cycle, setup flash state.
1346 if ( pWnd->state & WNDS_ACTIVEFRAME ||
1347 (pfwi->dwFlags & FLASHW_CAPTION && pWnd->style & (WS_BORDER|WS_DLGFRAME)))
1348 {
1349 FlashState = FLASHW_STARTED|FLASHW_ACTIVE;
1350 }
1351 }
1352
1353 // Set previous window state.
1354 Ret = !!(FlashState & FLASHW_ACTIVE);
1355
1356 if ( (pfwi->dwFlags & FLASHW_TIMERNOFG) == FLASHW_TIMERNOFG &&
1357 gpqForeground == pWnd->head.pti->MessageQueue )
1358 {
1359 // Flashing until foreground, set this to Stop.
1360 pfwi->dwFlags = FLASHW_STOP;
1361 }
1362 }
1363
1364 // Toggle activate flag.
1365 if ( pfwi->dwFlags == FLASHW_STOP )
1366 {
1367 if (gpqForeground && gpqForeground->spwndActive == pWnd)
1368 Activate = TRUE;
1369 else
1370 Activate = FALSE;
1371 }
1372 else
1373 {
1374 Activate = (FlashState & FLASHW_ACTIVE) == 0;
1375 }
1376
1377 if ( pfwi->dwFlags == FLASHW_STOP || pfwi->dwFlags & FLASHW_CAPTION )
1378 {
1379 co_IntSendMessage(UserHMGetHandle(pWnd), WM_NCACTIVATE, Activate, 0);
1380 }
1381
1382 // FIXME: Check for a Stop Sign here.
1383 if ( pfwi->dwFlags & FLASHW_TRAY )
1384 {
1385 // Need some shell work here too.
1386 TRACE("FIXME: Flash window no Tray support!\n");
1387 }
1388
1389 if ( pfwi->dwFlags == FLASHW_STOP )
1390 {
1391 if (FlashState & FLASHW_KILLSYSTIMER)
1392 {
1394 }
1395
1397 }
1398 else
1399 { // Have a count and started, set timer.
1400 if ( uCount )
1401 {
1402 FlashState |= FLASHW_COUNT;
1403
1404 if (!(Activate ^ !!(FlashState & FLASHW_STARTED)))
1405 uCount--;
1406
1407 if (!(FlashState & FLASHW_KILLSYSTIMER))
1408 pfwi->dwFlags |= FLASHW_TIMER;
1409 }
1410
1411 if (pfwi->dwFlags & FLASHW_TIMER)
1412 {
1413 FlashState |= FLASHW_KILLSYSTIMER;
1414
1415 IntSetTimer( pWnd,
1417 pfwi->dwTimeout ? pfwi->dwTimeout : gpsi->dtCaretBlink,
1419 TMRF_SYSTEM );
1420 }
1421
1422 if (FlashState & FLASHW_COUNT && uCount == 0)
1423 {
1424 // Keep spinning? Nothing else to do.
1425 FlashState = FLASHW_FINISHED;
1426 }
1427 else
1428 {
1429 // Save state and flags so this can be restored next time through.
1430 FlashState ^= (FlashState ^ -!!(Activate)) & FLASHW_ACTIVE;
1431 FlashState ^= (FlashState ^ pfwi->dwFlags) & (FLASHW_MASK & ~FLASHW_TIMER);
1432 }
1433 FlashState = MAKELONG(LOWORD(FlashState),uCount);
1434 UserSetProp(pWnd, AtomFlashWndState, (HANDLE)FlashState, TRUE);
1435 }
1436 return Ret;
1437}
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:280
BOOL FASTCALL IntKillTimer(PWND Window, UINT_PTR IDEvent, BOOL SystemTimer)
Definition: timer.c:573
UINT_PTR FASTCALL IntSetTimer(PWND Window, UINT_PTR IDEvent, UINT Elapse, TIMERPROC TimerFunc, INT Type)
Definition: timer.c:177
#define TMRF_SYSTEM
Definition: timer.h:20
#define ID_EVENT_SYSTIMER_FLASHWIN
Definition: timer.h:28
#define WM_NCACTIVATE
Definition: winuser.h:1688

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

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

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

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

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

◆ IntIsWindowDirty()

BOOL FASTCALL IntIsWindowDirty ( PWND  Wnd)

Definition at line 1124 of file painting.c.

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

Referenced by IntFindWindowToRepaint(), and IntInvalidateWindows().

◆ IntIsWindowDrawable()

BOOL FASTCALL IntIsWindowDrawable ( PWND  Wnd)

Definition at line 867 of file painting.c.

868{
869 PWND WndObject;
870
871 for (WndObject = Wnd; WndObject != NULL; WndObject = WndObject->spwndParent)
872 {
873 if ( WndObject->state2 & WNDS2_INDESTROY ||
874 WndObject->state & WNDS_DESTROYED ||
875 !WndObject ||
876 !(WndObject->style & WS_VISIBLE) ||
877 ((WndObject->style & WS_MINIMIZE) && (WndObject != Wnd)))
878 {
879 return FALSE;
880 }
881 }
882
883 return TRUE;
884}
#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 1183 of file painting.c.

1184{
1185 // Handle normal painting.
1187}

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:805
#define WM_NCPAINT
Definition: winuser.h:1687

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 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 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:1713
#define WM_SYNCPAINT
Definition: winuser.h:1690

Referenced by IntSendSyncPaint(), and UserSyncAndPaintWindows().

◆ NC_IconForWindow()

PCURICON_OBJECT FASTCALL NC_IconForWindow ( PWND  pWnd)

Definition at line 705 of file nonclient.c.

706{
707 PCURICON_OBJECT pIcon = NULL;
708 HICON hIcon;
709
711 if (!hIcon) hIcon = UserGetProp(pWnd, gpsi->atomIconProp, TRUE);
712
713 if (!hIcon && pWnd->pcls->spicnSm)
714 return pWnd->pcls->spicnSm;
715 if (!hIcon && pWnd->pcls->spicn)
716 return pWnd->pcls->spicn;
717
718 // WARNING: Wine code has this test completely wrong. The following is how
719 // Windows behaves for windows having the WS_EX_DLGMODALFRAME style set:
720 // it does not use the default icon! And it does not check for DS_MODALFRAME.
721 if (!hIcon && !(pWnd->ExStyle & WS_EX_DLGMODALFRAME))
722 {
723 hIcon = gpsi->hIconSmWindows; // Both are IDI_WINLOGO Small
724 if (!hIcon) hIcon = gpsi->hIconWindows; // Reg size.
725 }
726 if (hIcon)
727 {
729 hIcon,
731 }
732 return pIcon;
733}
struct _CURICON_OBJECT * PCURICON_OBJECT
@ TYPE_CURSOR
Definition: ntuser.h:43
static HICON
Definition: imagelist.c:84
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 1099 of file painting.c.

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

Referenced by DefWndDoSizeMove().

◆ UserDrawCaption()

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

Definition at line 2191 of file painting.c.

2199{
2200 BOOL Ret = FALSE;
2201 HBRUSH hBgBrush, hOldBrush = NULL;
2202 RECTL Rect = *lpRc;
2203 BOOL HasIcon;
2204
2206
2207 /* Determine whether the icon needs to be displayed */
2208 if (!hIcon && pWnd != NULL)
2209 {
2210 HasIcon = (uFlags & DC_ICON) && !(uFlags & DC_SMALLCAP) &&
2211 (pWnd->style & WS_SYSMENU) && !(pWnd->ExStyle & WS_EX_TOOLWINDOW);
2212 }
2213 else
2214 HasIcon = (hIcon != NULL);
2215
2216 // Draw the caption background
2217 if((uFlags & DC_GRADIENT) && !(uFlags & DC_INBUTTON))
2218 {
2219 static GRADIENT_RECT gcap = {0, 1};
2220 TRIVERTEX Vertices[2];
2221 COLORREF Colors[2];
2222
2225
2228
2229 Vertices[0].x = Rect.left;
2230 Vertices[0].y = Rect.top;
2231 Vertices[0].Red = (WORD)Colors[0]<<8;
2232 Vertices[0].Green = (WORD)Colors[0] & 0xFF00;
2233 Vertices[0].Blue = (WORD)(Colors[0]>>8) & 0xFF00;
2234 Vertices[0].Alpha = 0;
2235
2236 Vertices[1].x = Rect.right;
2237 Vertices[1].y = Rect.bottom;
2238 Vertices[1].Red = (WORD)Colors[1]<<8;
2239 Vertices[1].Green = (WORD)Colors[1] & 0xFF00;
2240 Vertices[1].Blue = (WORD)(Colors[1]>>8) & 0xFF00;
2241 Vertices[1].Alpha = 0;
2242
2243 if(!GreGradientFill(hDc, Vertices, 2, &gcap, 1, GRADIENT_FILL_RECT_H))
2244 {
2245 ERR("GreGradientFill() failed!\n");
2246 goto cleanup;
2247 }
2248 }
2249 else
2250 {
2251 if(uFlags & DC_INBUTTON)
2253 else if(uFlags & DC_ACTIVE)
2255 else
2257
2258 hOldBrush = NtGdiSelectBrush(hDc, hBgBrush);
2259
2260 if(!hOldBrush)
2261 {
2262 ERR("NtGdiSelectBrush() failed!\n");
2263 goto cleanup;
2264 }
2265
2266 if(!NtGdiPatBlt(hDc, Rect.left, Rect.top,
2267 Rect.right - Rect.left,
2268 Rect.bottom - Rect.top,
2269 PATCOPY))
2270 {
2271 ERR("NtGdiPatBlt() failed!\n");
2272 goto cleanup;
2273 }
2274 }
2275
2276 /* Draw icon */
2277 if (HasIcon)
2278 {
2279 PCURICON_OBJECT pIcon = NULL;
2280
2281 if (hIcon)
2282 {
2283 pIcon = UserGetCurIconObject(hIcon);
2284 }
2285 else if (pWnd)
2286 {
2287 pIcon = NC_IconForWindow(pWnd);
2288 // FIXME: NC_IconForWindow should reference it for us */
2289 if (pIcon)
2290 UserReferenceObject(pIcon);
2291 }
2292
2293 if (pIcon)
2294 {
2297 LONG x = Rect.left - cx/2 + 1 + (Rect.bottom - Rect.top)/2; // this is really what Window does
2298 LONG y = (Rect.top + Rect.bottom - cy)/2; // center
2299 UserDrawIconEx(hDc, x, y, pIcon, cx, cy, 0, NULL, DI_NORMAL);
2300 UserDereferenceObject(pIcon);
2301 }
2302 else
2303 {
2304 HasIcon = FALSE;
2305 }
2306 }
2307
2308 if (HasIcon)
2309 Rect.left += Rect.bottom - Rect.top;
2310
2311 if((uFlags & DC_TEXT))
2312 {
2313 BOOL Set = FALSE;
2314 Rect.left += 2;
2315
2316 if (Str)
2317 Set = UserDrawCaptionText(pWnd, hDc, Str, &Rect, uFlags, hFont);
2318 else if (pWnd != NULL) // FIXME: Windows does not do that
2319 {
2320 UNICODE_STRING ustr;
2321 ustr.Buffer = pWnd->strName.Buffer; // FIXME: LARGE_STRING truncated!
2322 ustr.Length = (USHORT)min(pWnd->strName.Length, MAXUSHORT);
2324 Set = UserDrawCaptionText(pWnd, hDc, &ustr, &Rect, uFlags, hFont);
2325 }
2326 if (pWnd)
2327 {
2328 if (Set)
2329 pWnd->state2 &= ~WNDS2_CAPTIONTEXTTRUNCATED;
2330 else
2332 }
2333 }
2334
2335 Ret = TRUE;
2336
2337cleanup:
2338 if (hOldBrush) NtGdiSelectBrush(hDc, hOldBrush);
2339
2340 return Ret;
2341}
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:984
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:2085
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:213
PCURICON_OBJECT FASTCALL NC_IconForWindow(PWND pWnd)
Definition: nonclient.c:705
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:945
#define COLOR_ACTIVECAPTION
Definition: winuser.h:915
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define SM_CYSMICON
Definition: winuser.h:1013
#define COLOR_INACTIVECAPTION
Definition: winuser.h:916
#define COLOR_GRADIENTACTIVECAPTION
Definition: winuser.h:944
#define SM_CXSMICON
Definition: winuser.h:1012
#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:929

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

◆ UserRealizePalette()

INT FASTCALL UserRealizePalette ( HDC  hdc)

Definition at line 2345 of file painting.c.

2346{
2347 HWND hWnd, hWndDesktop;
2348 DWORD Ret;
2349
2351 if (Ret) // There was a change.
2352 {
2354 if (hWnd) // Send broadcast if dc is associated with a window.
2355 { // FYI: Thread locked in CallOneParam.
2356 hWndDesktop = IntGetDesktopWindow();
2357 if ( hWndDesktop != hWnd )
2358 {
2359 PWND pWnd = UserGetWindowObject(hWndDesktop);
2360 ERR("RealizePalette Desktop.\n");
2361 hdc = UserGetWindowDC(pWnd);
2363 UserReleaseDC(pWnd,hdc,FALSE);
2364 }
2366 }
2367 }
2368 return Ret;
2369}
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:1374
BOOL FASTCALL IntPaintDesktop(HDC hDC)
Definition: desktop.c:1835
BOOL FASTCALL UserSendNotifyMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:2040
#define HWND_BROADCAST
Definition: winuser.h:1204
#define WM_PALETTECHANGED
Definition: winuser.h:1877

◆ UserSyncAndPaintWindows()

VOID FASTCALL UserSyncAndPaintWindows ( PWND  pWnd,
ULONG  Flags 
)

Definition at line 620 of file painting.c.

621{
622 PWND Parent = pWnd;
623 // Find parent, if it needs to be painted, leave.
624 while(TRUE)
625 {
626 if ((Parent = Parent->spwndParent) == NULL) break;
627 if ( Parent->style & WS_CLIPCHILDREN ) break;
628 if ( Parent->hrgnUpdate != NULL || Parent->state & WNDS_INTERNALPAINT ) return;
629 }
630
631 IntSendSyncPaint(pWnd, Flags);
633}
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().