ReactOS  0.4.14-dev-98-gb0d4763
vis.c File Reference
#include <win32k.h>
Include dependency graph for vis.c:

Go to the source code of this file.

Functions

 DBG_DEFAULT_CHANNEL (UserWinpos)
 
PREGION FASTCALL VIS_ComputeVisibleRegion (PWND Wnd, BOOLEAN ClientArea, BOOLEAN ClipChildren, BOOLEAN ClipSiblings)
 
VOID FASTCALL co_VIS_WindowLayoutChanged (PWND Wnd, PREGION NewlyExposed)
 

Function Documentation

◆ co_VIS_WindowLayoutChanged()

VOID FASTCALL co_VIS_WindowLayoutChanged ( PWND  Wnd,
PREGION  NewlyExposed 
)

Definition at line 145 of file vis.c.

148 {
149  PWND Parent;
151 
152  ASSERT_REFS_CO(Wnd);
153 
154  Parent = Wnd->spwndParent;
155  if(Parent)
156  {
157  PREGION TempRgn = IntSysCreateRectpRgn(0, 0, 0, 0);
158 
159  if (!TempRgn)
160  return;
161 
162  IntGdiCombineRgn(TempRgn, NewlyExposed, NULL, RGN_COPY);
163  REGION_bOffsetRgn(TempRgn,
164  Wnd->rcWindow.left - Parent->rcClient.left,
165  Wnd->rcWindow.top - Parent->rcClient.top);
166 
167  UserRefObjectCo(Parent, &Ref);
168  co_UserRedrawWindow(Parent, NULL, TempRgn,
172 
173  REGION_Delete(TempRgn);
174  }
175 }
#define ASSERT_REFS_CO(_obj_)
Definition: userfuncs.h:13
LONG top
Definition: windef.h:292
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:25
BOOL FASTCALL REGION_bOffsetRgn(_Inout_ PREGION prgn, _In_ INT cx, _In_ INT cy)
Definition: region.c:2727
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE Parent
Definition: acpixf.h:722
#define RDW_FRAME
Definition: winuser.h:1198
LONG left
Definition: windef.h:291
PREGION FASTCALL IntSysCreateRectpRgn(INT LeftRect, INT TopRect, INT RightRect, INT BottomRect)
Definition: region.c:2426
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:38
Definition: object.h:3
smooth NULL
Definition: ftsmooth.c:416
Definition: region.h:7
INT FASTCALL IntGdiCombineRgn(PREGION prgnDest, PREGION prgnSrc1, PREGION prgnSrc2, INT iCombineMode)
Definition: region.c:2506
#define RDW_ERASE
Definition: winuser.h:1197
RECT rcWindow
Definition: ntuser.h:680
#define RGN_COPY
Definition: wingdi.h:356
Definition: ntuser.h:657
BOOL FASTCALL co_UserRedrawWindow(PWND Window, const RECTL *UpdateRect, PREGION UpdateRgn, ULONG Flags)
Definition: painting.c:876
#define RDW_ALLCHILDREN
Definition: winuser.h:1207
struct _WND * spwndParent
Definition: ntuser.h:677
VOID FASTCALL REGION_Delete(PREGION pRgn)
Definition: region.c:2468
#define RDW_INVALIDATE
Definition: winuser.h:1200

Referenced by co_WinPosSetWindowPos().

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( UserWinpos  )

◆ VIS_ComputeVisibleRegion()

PREGION FASTCALL VIS_ComputeVisibleRegion ( PWND  Wnd,
BOOLEAN  ClientArea,
BOOLEAN  ClipChildren,
BOOLEAN  ClipSiblings 
)

Definition at line 13 of file vis.c.

18 {
19  PREGION VisRgn, ClipRgn;
20  PWND PreviousWindow, CurrentWindow, CurrentSibling;
21 
22  if (!Wnd || !(Wnd->style & WS_VISIBLE))
23  {
24  return NULL;
25  }
26 
27  VisRgn = NULL;
28 
29  if (ClientArea)
30  {
31  VisRgn = IntSysCreateRectpRgnIndirect(&Wnd->rcClient);
32  }
33  else
34  {
35  VisRgn = IntSysCreateRectpRgnIndirect(&Wnd->rcWindow);
36  }
37 
38  /*
39  * Walk through all parent windows and for each clip the visble region
40  * to the parent's client area and exclude all siblings that are over
41  * our window.
42  */
43 
44  PreviousWindow = Wnd;
45  CurrentWindow = Wnd->spwndParent;
46  while (CurrentWindow)
47  {
48  if (!VerifyWnd(CurrentWindow))
49  {
50  ERR("ATM the Current Window or Parent is dead! %p\n",CurrentWindow);
51  if (VisRgn)
52  REGION_Delete(VisRgn);
53  return NULL;
54  }
55 
56  if (!(CurrentWindow->style & WS_VISIBLE))
57  {
58  if (VisRgn)
59  REGION_Delete(VisRgn);
60  return NULL;
61  }
62 
63  ClipRgn = IntSysCreateRectpRgnIndirect(&CurrentWindow->rcClient);
64  IntGdiCombineRgn(VisRgn, VisRgn, ClipRgn, RGN_AND);
65  REGION_Delete(ClipRgn);
66 
67  if ((PreviousWindow->style & WS_CLIPSIBLINGS) ||
68  (PreviousWindow == Wnd && ClipSiblings))
69  {
70  CurrentSibling = CurrentWindow->spwndChild;
71  while ( CurrentSibling != NULL &&
72  CurrentSibling != PreviousWindow )
73  {
74  if ((CurrentSibling->style & WS_VISIBLE) &&
75  !(CurrentSibling->ExStyle & WS_EX_TRANSPARENT))
76  {
77  ClipRgn = IntSysCreateRectpRgnIndirect(&CurrentSibling->rcWindow);
78  /* Combine it with the window region if available */
79  if (CurrentSibling->hrgnClip && !(CurrentSibling->style & WS_MINIMIZE))
80  {
81  PREGION SiblingClipRgn = REGION_LockRgn(CurrentSibling->hrgnClip);
82  if (SiblingClipRgn)
83  {
84  REGION_bOffsetRgn(ClipRgn, -CurrentSibling->rcWindow.left, -CurrentSibling->rcWindow.top);
85  IntGdiCombineRgn(ClipRgn, ClipRgn, SiblingClipRgn, RGN_AND);
86  REGION_bOffsetRgn(ClipRgn, CurrentSibling->rcWindow.left, CurrentSibling->rcWindow.top);
87  REGION_UnlockRgn(SiblingClipRgn);
88  }
89  }
90  IntGdiCombineRgn(VisRgn, VisRgn, ClipRgn, RGN_DIFF);
91  REGION_Delete(ClipRgn);
92  }
93  CurrentSibling = CurrentSibling->spwndNext;
94  }
95  }
96 
97  PreviousWindow = CurrentWindow;
98  CurrentWindow = CurrentWindow->spwndParent;
99  }
100 
101  if (ClipChildren)
102  {
103  CurrentWindow = Wnd->spwndChild;
104  while (CurrentWindow)
105  {
106  if ((CurrentWindow->style & WS_VISIBLE) &&
107  !(CurrentWindow->ExStyle & WS_EX_TRANSPARENT))
108  {
109  ClipRgn = IntSysCreateRectpRgnIndirect(&CurrentWindow->rcWindow);
110  /* Combine it with the window region if available */
111  if (CurrentWindow->hrgnClip && !(CurrentWindow->style & WS_MINIMIZE))
112  {
113  PREGION CurrentRgnClip = REGION_LockRgn(CurrentWindow->hrgnClip);
114  if (CurrentRgnClip)
115  {
116  REGION_bOffsetRgn(ClipRgn, -CurrentWindow->rcWindow.left, -CurrentWindow->rcWindow.top);
117  IntGdiCombineRgn(ClipRgn, ClipRgn, CurrentRgnClip, RGN_AND);
118  REGION_bOffsetRgn(ClipRgn, CurrentWindow->rcWindow.left, CurrentWindow->rcWindow.top);
119  REGION_UnlockRgn(CurrentRgnClip);
120  }
121  }
122  IntGdiCombineRgn(VisRgn, VisRgn, ClipRgn, RGN_DIFF);
123  REGION_Delete(ClipRgn);
124  }
125  CurrentWindow = CurrentWindow->spwndNext;
126  }
127  }
128 
129  if (Wnd->hrgnClip && !(Wnd->style & WS_MINIMIZE))
130  {
131  PREGION WndRgnClip = REGION_LockRgn(Wnd->hrgnClip);
132  if (WndRgnClip)
133  {
134  REGION_bOffsetRgn(VisRgn, -Wnd->rcWindow.left, -Wnd->rcWindow.top);
135  IntGdiCombineRgn(VisRgn, VisRgn, WndRgnClip, RGN_AND);
136  REGION_bOffsetRgn(VisRgn, Wnd->rcWindow.left, Wnd->rcWindow.top);
137  REGION_UnlockRgn(WndRgnClip);
138  }
139  }
140 
141  return VisRgn;
142 }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
DWORD ExStyle
Definition: ntuser.h:668
#define WS_EX_TRANSPARENT
Definition: pedump.c:649
LONG top
Definition: windef.h:292
BOOL FASTCALL REGION_bOffsetRgn(_Inout_ PREGION prgn, _In_ INT cx, _In_ INT cy)
Definition: region.c:2727
RECT rcClient
Definition: ntuser.h:681
LONG left
Definition: windef.h:291
PREGION FASTCALL REGION_LockRgn(_In_ HRGN hrgn)
Definition: region.c:2377
#define RGN_AND
Definition: wingdi.h:355
#define WS_MINIMIZE
Definition: pedump.c:622
smooth NULL
Definition: ftsmooth.c:416
HRGN hrgnClip
Definition: ntuser.h:697
struct _WND * spwndNext
Definition: ntuser.h:675
Definition: region.h:7
INT FASTCALL IntGdiCombineRgn(PREGION prgnDest, PREGION prgnSrc1, PREGION prgnSrc2, INT iCombineMode)
Definition: region.c:2506
#define IntSysCreateRectpRgnIndirect(prc)
Definition: region.h:93
RECT rcWindow
Definition: ntuser.h:680
#define ERR(fmt,...)
Definition: debug.h:109
Definition: ntuser.h:657
#define RGN_DIFF
Definition: wingdi.h:357
VOID FASTCALL REGION_UnlockRgn(_In_ PREGION prgn)
Definition: region.c:2392
struct _WND * spwndParent
Definition: ntuser.h:677
PWND FASTCALL VerifyWnd(PWND pWnd)
Definition: window.c:64
struct _WND * spwndChild
Definition: ntuser.h:678
#define WS_VISIBLE
Definition: pedump.c:620
VOID FASTCALL REGION_Delete(PREGION pRgn)
Definition: region.c:2468
DWORD style
Definition: ntuser.h:670

Referenced by co_WinPosSetWindowPos(), DceGetVisRgn(), and IntEngWndUpdateClipObj().