ReactOS  0.4.14-dev-337-gf981a68
DeferWindowPos.c File Reference
#include "precomp.h"
Include dependency graph for DeferWindowPos.c:

Go to the source code of this file.

Macros

#define EXPECT_NEXT(hWnd1, hWnd2)
 
#define EXPECT_CHAIN(A, B, C, D)
 
#define ok_windowpos(hwnd, x, y, w, h, wnd)
 
#define ok_lasterr(err, s)   ok(GetLastError() == (err), "%s error = %lu\n", s, GetLastError())
 
#define OwnerZOrderAParams   SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOSIZE
 
#define OwnerZOrderBParams   SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOOWNERZORDER
 

Functions

static int get_iwnd (HWND hWnd)
 
LRESULT CALLBACK DWPTestProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 
static void FlushMessages ()
 
static BOOL IsNext (HWND hWnd1, HWND hWnd2)
 
static void set_default_pos ()
 
static void Test_DWP_Error (HWND hWnd, HWND hWnd2)
 
static void Test_DWP_SimpleMsg (HWND hWnd1, HWND hWnd2)
 
static void Test_DWP_OwnerZOrder ()
 
 START_TEST (DeferWindowPos)
 

Variables

HWND hWnd1
 
HWND hWnd2
 
HWND hWnd3
 
HWND hWnd4
 
MSG_ENTRY move1_chain []
 
MSG_ENTRY resize1_chain []
 
MSG_ENTRY move1_2_chain []
 
MSG_ENTRY ZOrder1_chain []
 
MSG_ENTRY ZOrder1and2_chain []
 
MSG_ENTRY OwnerZOrder1A_chain []
 
MSG_ENTRY OwnerZOrder2A_chain []
 
MSG_ENTRY OwnerZOrder3A_chain []
 
MSG_ENTRY OwnerZOrder4A_chain []
 
MSG_ENTRY OwnerZOrder5A_chain []
 
MSG_ENTRY OwnerZOrder1B_chain []
 
MSG_ENTRY OwnerZOrder2B_chain []
 
MSG_ENTRY OwnerZOrder3B_chain []
 
MSG_ENTRY OwnerZOrder4B_chain []
 
MSG_ENTRY OwnerZOrder5B_chain []
 

Macro Definition Documentation

◆ EXPECT_CHAIN

#define EXPECT_CHAIN (   A,
  B,
  C,
  D 
)
Value:
EXPECT_NEXT(hWnd##B, hWnd##C); \
EXPECT_NEXT(hWnd##C, hWnd##D);
#define EXPECT_NEXT(hWnd1, hWnd2)
HWND hWnd
Definition: settings.c:17
Definition: ttei1.cpp:12
#define D(name, bit)
Definition: ttei6.cpp:27
#define B(row, col)

Definition at line 85 of file DeferWindowPos.c.

◆ EXPECT_NEXT

#define EXPECT_NEXT (   hWnd1,
  hWnd2 
)
Value:
"After hwnd%d, expected hwnd%d not hwnd%d\n", \
#define GW_HWNDNEXT
Definition: winuser.h:756
static int get_iwnd(HWND hWnd)
static BOOL IsNext(HWND hWnd1, HWND hWnd2)
HWND WINAPI GetWindow(_In_ HWND, _In_ UINT)
#define ok(value,...)
Definition: atltest.h:57
HWND hWnd1
HWND hWnd2

Definition at line 80 of file DeferWindowPos.c.

◆ ok_lasterr

#define ok_lasterr (   err,
  s 
)    ok(GetLastError() == (err), "%s error = %lu\n", s, GetLastError())

Definition at line 94 of file DeferWindowPos.c.

◆ ok_windowpos

#define ok_windowpos (   hwnd,
  x,
  y,
  w,
  h,
  wnd 
)
Value:
do { RECT rt; GetWindowRect(hwnd, &rt); \
ok(rt.left == (x) && rt.top == (y) && rt.right == (x)+(w) && rt.bottom == (y)+(h), \
"Unexpected %s position: (%ld, %ld) - (%ld, %ld)\n", wnd, rt.left, rt.top, rt.right, rt.bottom); } while (0)
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
LONG top
Definition: windef.h:292
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
LONG bottom
Definition: windef.h:294
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)

Definition at line 90 of file DeferWindowPos.c.

◆ OwnerZOrderAParams

#define OwnerZOrderAParams   SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOSIZE

Definition at line 366 of file DeferWindowPos.c.

◆ OwnerZOrderBParams

Definition at line 401 of file DeferWindowPos.c.

Function Documentation

◆ DWPTestProc()

LRESULT CALLBACK DWPTestProc ( HWND  hWnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 22 of file DeferWindowPos.c.

23 {
24  int iwnd = get_iwnd(hWnd);
25 
26  if(message > WM_USER || !iwnd || IsDWmMsg(message) || IseKeyMsg(message))
28 
29  switch(message)
30  {
31  case WM_IME_SETCONTEXT:
32  case WM_IME_NOTIFY :
33  case WM_GETICON :
34  case WM_GETTEXT:
35  break;
38  {
39  WINDOWPOS* pwp = (WINDOWPOS*)lParam;
40  ok(wParam==0,"expected wParam=0\n");
42  break;
43  }
44  default:
45  RECORD_MESSAGE(iwnd, message, SENT, 0,0);
46  }
48 }
static int get_iwnd(HWND hWnd)
#define WM_IME_NOTIFY
Definition: winuser.h:1812
Definition: tftpd.h:59
#define WM_GETTEXT
Definition: winuser.h:1600
HWND hWnd
Definition: settings.c:17
HWND hwndInsertAfter
Definition: winuser.h:3563
WPARAM wParam
Definition: combotst.c:138
static BOOL IseKeyMsg(UINT msg)
Definition: msgtrace.h:52
UINT flags
Definition: winuser.h:3568
#define DefWindowProc
Definition: ros2win.h:31
#define WM_IME_SETCONTEXT
Definition: winuser.h:1811
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1643
#define WM_USER
Definition: winuser.h:1877
static BOOL IsDWmMsg(UINT msg)
Definition: msgtrace.h:39
#define ok(value,...)
Definition: atltest.h:57
Definition: msgtrace.h:6
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1644
#define RECORD_MESSAGE(...)
Definition: msgtrace.h:60
LPARAM lParam
Definition: combotst.c:139

Referenced by START_TEST().

◆ FlushMessages()

static void FlushMessages ( )
static

Definition at line 50 of file DeferWindowPos.c.

51 {
52  MSG msg;
53 
54  while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE ))
55  {
56  int iwnd = get_iwnd(msg.hwnd);
57  if(!(msg.message > WM_USER || !iwnd || IsDWmMsg(msg.message) || IseKeyMsg(msg.message)))
58  RECORD_MESSAGE(iwnd, msg.message, POST,0,0);
60  }
61 }
static int get_iwnd(HWND hWnd)
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
#define PeekMessage
Definition: winuser.h:5731
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
static BOOL IseKeyMsg(UINT msg)
Definition: msgtrace.h:52
Definition: msgtrace.h:7
#define WM_USER
Definition: winuser.h:1877
static BOOL IsDWmMsg(UINT msg)
Definition: msgtrace.h:39
#define msg(x)
Definition: auth_time.c:54
#define RECORD_MESSAGE(...)
Definition: msgtrace.h:60
#define PM_REMOVE
Definition: winuser.h:1182

Referenced by set_default_pos(), Test_DWP_Error(), Test_DWP_OwnerZOrder(), and Test_DWP_SimpleMsg().

◆ get_iwnd()

static int get_iwnd ( HWND  hWnd)
static

Definition at line 13 of file DeferWindowPos.c.

14 {
15  if(hWnd == hWnd1) return 1;
16  else if(hWnd == hWnd2) return 2;
17  else if(hWnd == hWnd3) return 3;
18  else if(hWnd == hWnd4) return 4;
19  else return 0;
20 }
HWND hWnd
Definition: settings.c:17
HWND hWnd3
HWND hWnd1
HWND hWnd4
HWND hWnd2

Referenced by DWPTestProc(), and FlushMessages().

◆ IsNext()

static BOOL IsNext ( HWND  hWnd1,
HWND  hWnd2 
)
static

Definition at line 65 of file DeferWindowPos.c.

66 {
67  HWND hWndNext;
68 
69  hWndNext=hWnd1;
70  while((hWndNext = GetWindow(hWndNext,GW_HWNDNEXT)))
71  {
72  if(hWndNext == hWnd2)
73  {
74  return TRUE;
75  }
76  }
77  return FALSE;
78 }
#define GW_HWNDNEXT
Definition: winuser.h:756
#define TRUE
Definition: types.h:120
HWND WINAPI GetWindow(_In_ HWND, _In_ UINT)
HWND hWnd1
HWND hWnd2

◆ set_default_pos()

static void set_default_pos ( )
static

Definition at line 96 of file DeferWindowPos.c.

97 {
103  FlushMessages();
104  EMPTY_CACHE();
105 }
HWND hWnd3
HWND WINAPI SetActiveWindow(_In_ HWND)
static void FlushMessages()
#define SWP_NOACTIVATE
Definition: winuser.h:1227
#define EMPTY_CACHE()
Definition: msgtrace.h:59
HWND hWnd1
#define SWP_SHOWWINDOW
Definition: winuser.h:1233
HWND hWnd4
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
HWND hWnd2
#define SWP_NOOWNERZORDER
Definition: winuser.h:1234

Referenced by START_TEST(), and Test_DWP_OwnerZOrder().

◆ START_TEST()

START_TEST ( DeferWindowPos  )

Definition at line 496 of file DeferWindowPos.c.

497 {
498  SetCursorPos(0,0);
499 
500  RegisterSimpleClass(DWPTestProc, L"ownertest");
501  hWnd1 = CreateWindowExW(0, L"ownertest", L"abc", 0, 10, 20,
502  200, 210, NULL, NULL, 0, NULL);
503  hWnd2 = CreateWindowExW(0, L"ownertest", L"def", 0, 30, 40,
504  220, 230, NULL, NULL, 0, NULL);
505  hWnd3 = CreateWindowW(L"ownertest", L"ownertest", WS_OVERLAPPEDWINDOW,
506  20, 350, 300, 300, hWnd1, NULL, 0, NULL);
507  hWnd4 = CreateWindowW(L"ownertest", L"ownertest", WS_OVERLAPPEDWINDOW,
508  250, 250, 200, 200, hWnd1, NULL, 0, NULL);
509 
510  ok(hWnd1 != NULL, "CreateWindow failed\n");
511  ok(hWnd2 != NULL, "CreateWindow failed\n");
512  ok(hWnd3 != NULL, "CreateWindow failed\n");
513  ok(hWnd4 != NULL, "CreateWindow failed\n");
514 
515  set_default_pos();
517 
518  set_default_pos();
520 
521  set_default_pos();
523 
528  }
BOOL WINAPI DestroyWindow(_In_ HWND)
static void Test_DWP_SimpleMsg(HWND hWnd1, HWND hWnd2)
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4217
HWND hWnd3
static void Test_DWP_Error(HWND hWnd, HWND hWnd2)
LRESULT CALLBACK DWPTestProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
smooth NULL
Definition: ftsmooth.c:416
static __inline ATOM RegisterSimpleClass(WNDPROC lpfnWndProc, LPCWSTR lpszClassName)
static void Test_DWP_OwnerZOrder()
BOOL WINAPI SetCursorPos(_In_ int, _In_ int)
Definition: cursoricon.c:2627
static const WCHAR L[]
Definition: oid.c:1250
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
static void set_default_pos()
#define ok(value,...)
Definition: atltest.h:57
HWND hWnd1
HWND hWnd4
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
HWND hWnd2

◆ Test_DWP_Error()

static void Test_DWP_Error ( HWND  hWnd,
HWND  hWnd2 
)
static

Definition at line 107 of file DeferWindowPos.c.

108 {
109  HDWP hDwp;
110  BOOL ret;
111 
112  ok_windowpos(hWnd1, 10, 20, 200, 210, "Window 1");
113  ok_windowpos(hWnd2, 30, 40, 220, 230, "Window 2");
114 
115  /* close invalid handles */
118  ok(ret == 0, "EndDeferWindowPos succeeded with invalid handle\n");
119  ok_lasterr(ERROR_INVALID_DWP_HANDLE, "EndDeferWindowPos");
120 
122  ret = EndDeferWindowPos((HDWP)-1);
123  ok(ret == 0, "EndDeferWindowPos succeeded with invalid handle\n");
124  ok_lasterr(ERROR_INVALID_DWP_HANDLE, "EndDeferWindowPos");
125 
126  /* negative window count */
128  hDwp = BeginDeferWindowPos(-1);
129  ok(hDwp == NULL, "BeginDeferWindowPos failed\n");
130  ok_lasterr(ERROR_INVALID_PARAMETER, "BeginDeferWindowPos");
131 
132  /* zero windows */
134  hDwp = BeginDeferWindowPos(0);
135  ok(hDwp != NULL, "BeginDeferWindowPos failed\n");
136  ok_lasterr(DNS_ERROR_RCODE_NXRRSET, "BeginDeferWindowPos");
137  ret = EndDeferWindowPos(hDwp);
138  ok(ret != 0, "EndDeferWindowPos failed\n");
139  ok_lasterr(DNS_ERROR_RCODE_NXRRSET, "EndDeferWindowPos");
140 
141  /* more windows than expected */
143  hDwp = BeginDeferWindowPos(0);
144  ok(hDwp != NULL, "BeginDeferWindowPos failed\n");
145  ok_lasterr(DNS_ERROR_RCODE_NXRRSET, "BeginDeferWindowPos");
146  hDwp = DeferWindowPos(hDwp, hWnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER);
147  ok(hDwp != NULL, "DeferWindowPos failed\n");
148  ok_lasterr(DNS_ERROR_RCODE_NXRRSET, "DeferWindowPos");
149  ret = EndDeferWindowPos(hDwp);
150  ok(ret != 0, "EndDeferWindowPos failed\n");
151  ok(GetLastError() == ERROR_SUCCESS /* win7 sp1/x64 */
152  || GetLastError() == ERROR_INVALID_WINDOW_HANDLE /* 2k3 sp1/x86 */,
153  "EndDeferWindowPos error = %lu\n", GetLastError());
154  ok_windowpos(hWnd, 10, 20, 200, 210, "Window 1");
155 
156  /* more windows than expected 2 */
158  hDwp = BeginDeferWindowPos(1);
159  ok(hDwp != NULL, "BeginDeferWindowPos failed\n");
160  ok_lasterr(DNS_ERROR_RCODE_NXRRSET, "BeginDeferWindowPos");
161  hDwp = DeferWindowPos(hDwp, hWnd, NULL, 30, 20, 190, 195, SWP_NOZORDER);
162  ok(hDwp != NULL, "DeferWindowPos failed\n");
163  ok_lasterr(DNS_ERROR_RCODE_NXRRSET, "DeferWindowPos");
164  hDwp = DeferWindowPos(hDwp, hWnd2, NULL, 20, 30, 195, 190, SWP_NOZORDER);
165  ok(hDwp != NULL, "DeferWindowPos failed\n");
166  ok_lasterr(DNS_ERROR_RCODE_NXRRSET, "DeferWindowPos");
167  ret = EndDeferWindowPos(hDwp);
168  ok(ret != 0, "EndDeferWindowPos failed\n");
169  ok_lasterr(ERROR_SUCCESS, "EndDeferWindowPos");
170  ok_windowpos(hWnd, 30, 20, 190, 195, "Window 1");
171  ok_windowpos(hWnd2, 20, 30, 195, 190, "Window 2");
172 
173  /* fewer windows than expected */
174  MoveWindow(hWnd, 10, 20, 200, 210, FALSE);
176  hDwp = BeginDeferWindowPos(2);
177  ok(hDwp != NULL, "BeginDeferWindowPos failed\n");
178  ok_lasterr(DNS_ERROR_RCODE_NXRRSET, "BeginDeferWindowPos");
179  hDwp = DeferWindowPos(hDwp, hWnd, NULL, 20, 10, 210, 200, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER);
180  ok(hDwp != NULL, "DeferWindowPos failed\n");
181  ok_lasterr(DNS_ERROR_RCODE_NXRRSET, "DeferWindowPos");
182  ret = EndDeferWindowPos(hDwp);
183  ok(ret != 0, "EndDeferWindowPos failed\n");
184  ok_lasterr(DNS_ERROR_RCODE_NXRRSET, "EndDeferWindowPos");
185  ok_windowpos(hWnd, 10, 20, 200, 210, "Window 1");
186 
187  /* no operation, 1 window */
189  hDwp = BeginDeferWindowPos(1);
190  ok(hDwp != NULL, "BeginDeferWindowPos failed\n");
191  ok_lasterr(DNS_ERROR_RCODE_NXRRSET, "BeginDeferWindowPos");
192  hDwp = DeferWindowPos(hDwp, hWnd, NULL, 20, 10, 210, 200, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER);
193  ok(hDwp != NULL, "DeferWindowPos failed\n");
194  ok_lasterr(DNS_ERROR_RCODE_NXRRSET, "DeferWindowPos");
195  ret = EndDeferWindowPos(hDwp);
196  ok(ret != 0, "EndDeferWindowPos failed\n");
197  ok_lasterr(DNS_ERROR_RCODE_NXRRSET, "EndDeferWindowPos");
198  ok_windowpos(hWnd, 10, 20, 200, 210, "Window 1");
199 
200  /* same window twice */
202  hDwp = BeginDeferWindowPos(2);
203  ok(hDwp != NULL, "BeginDeferWindowPos failed\n");
204  ok_lasterr(DNS_ERROR_RCODE_NXRRSET, "BeginDeferWindowPos");
205  hDwp = DeferWindowPos(hDwp, hWnd, NULL, 80, 90, 220, 210, SWP_NOZORDER);
206  ok(hDwp != NULL, "DeferWindowPos failed\n");
207  ok_lasterr(DNS_ERROR_RCODE_NXRRSET, "DeferWindowPos");
208  hDwp = DeferWindowPos(hDwp, hWnd, NULL, 100, 110, 230, 250, SWP_NOZORDER);
209  ok(hDwp != NULL, "DeferWindowPos failed\n");
210  ok_lasterr(DNS_ERROR_RCODE_NXRRSET, "DeferWindowPos");
211  ret = EndDeferWindowPos(hDwp);
212  ok(ret != 0, "EndDeferWindowPos failed\n");
213  ok_lasterr(ERROR_SUCCESS, "EndDeferWindowPos");
214  ok_windowpos(hWnd, 100, 110, 230, 250, "Window 1");
215 
216  /* move & resize operation, 1 window */
218  hDwp = BeginDeferWindowPos(1);
219  ok(hDwp != NULL, "BeginDeferWindowPos failed\n");
220  ok_lasterr(DNS_ERROR_RCODE_NXRRSET, "BeginDeferWindowPos");
221  hDwp = DeferWindowPos(hDwp, hWnd, NULL, 20, 10, 210, 200, SWP_NOZORDER);
222  ok(hDwp != NULL, "DeferWindowPos failed\n");
223  ok_lasterr(DNS_ERROR_RCODE_NXRRSET, "DeferWindowPos");
224  ret = EndDeferWindowPos(hDwp);
225  ok(ret != 0, "EndDeferWindowPos failed\n");
226  ok_lasterr(ERROR_SUCCESS, "EndDeferWindowPos");
227  ok_windowpos(hWnd, 20, 10, 210, 200, "Window 1");
228 
229  /* move & resize operation, 2 windows */
231  hDwp = BeginDeferWindowPos(2);
232  ok(hDwp != NULL, "BeginDeferWindowPos failed\n");
233  ok_lasterr(DNS_ERROR_RCODE_NXRRSET, "BeginDeferWindowPos");
234  hDwp = DeferWindowPos(hDwp, hWnd, NULL, 50, 60, 230, 240, SWP_NOZORDER);
235  ok(hDwp != NULL, "DeferWindowPos failed\n");
236  ok_lasterr(DNS_ERROR_RCODE_NXRRSET, "DeferWindowPos");
237  hDwp = DeferWindowPos(hDwp, hWnd2, NULL, 70, 80, 250, 260, SWP_NOZORDER);
238  ok(hDwp != NULL, "DeferWindowPos failed\n");
239  ok_lasterr(DNS_ERROR_RCODE_NXRRSET, "DeferWindowPos");
240  ret = EndDeferWindowPos(hDwp);
241  ok(ret != 0, "EndDeferWindowPos failed\n");
242  ok_lasterr(ERROR_SUCCESS, "EndDeferWindowPos");
243  ok_windowpos(hWnd, 50, 60, 230, 240, "Window 1");
244  ok_windowpos(hWnd2, 70, 80, 250, 260, "Window 2");
245 
246  FlushMessages();
247  EMPTY_CACHE();
248 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define ERROR_INVALID_DWP_HANDLE
Definition: winerror.h:886
HDWP WINAPI BeginDeferWindowPos(_In_ int)
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ok_windowpos(hwnd, x, y, w, h, wnd)
HWND hWnd
Definition: settings.c:17
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define SWP_NOZORDER
Definition: winuser.h:1232
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ok_lasterr(err, s)
BOOL WINAPI EndDeferWindowPos(_In_ HDWP)
smooth NULL
Definition: ftsmooth.c:416
static void FlushMessages()
#define ERROR_INVALID_WINDOW_HANDLE
Definition: winerror.h:881
HDWP WINAPI DeferWindowPos(_In_ HDWP, _In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SetLastError(x)
Definition: compat.h:417
int ret
#define EMPTY_CACHE()
Definition: msgtrace.h:59
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
#define DNS_ERROR_RCODE_NXRRSET
Definition: winerror.h:1855
#define SWP_NOSIZE
Definition: winuser.h:1230
#define ok(value,...)
Definition: atltest.h:57
HWND hWnd1
#define SWP_NOMOVE
Definition: winuser.h:1229
HWND hWnd2

Referenced by START_TEST().

◆ Test_DWP_OwnerZOrder()

static void Test_DWP_OwnerZOrder ( )
static

Definition at line 428 of file DeferWindowPos.c.

429 {
430  EXPECT_CHAIN(4,3,1,2);
431 
432  /* test how SetWindowPos can change the z order of owner windows */
433  /* note that SWP_NOACTIVATE must be used because otherwise
434  SetWindowPos will call SetWindowPos again with different parameters */
435  SetWindowPos(hWnd1, 0, 0,0,0,0, OwnerZOrderAParams);
436  FlushMessages();
438  EXPECT_CHAIN(4,3,1,2);
439 
440  SetWindowPos(hWnd2, 0, 0,0,0,0, OwnerZOrderAParams);
441  FlushMessages();
443  EXPECT_CHAIN(2,4,3,1);
444 
445  SetWindowPos(hWnd3, 0, 0,0,0,0, OwnerZOrderAParams);
446  FlushMessages();
448  EXPECT_CHAIN(3,4,1,2);
449 
450  SetWindowPos(hWnd1, 0, 0,0,0,0, OwnerZOrderAParams);
451  FlushMessages();
453  EXPECT_CHAIN(3,4,1,2);
454 
455  SetWindowPos(hWnd4, 0, 0,0,0,0, OwnerZOrderAParams);
456  FlushMessages();
458  EXPECT_CHAIN(4,3,1,2);
459 
460  /* now do the same thing one more time with SWP_NOOWNERZORDER */
461  /* SWP_NOACTIVATE is needed because without it SetActiveWindow
462  will be calledit and it will call SetWindowPos again
463  WITHOUT SWP_NOOWNERZORDER. that means that
464  in order for SWP_NOOWNERZORDER to have effect we have to use
465  SWP_NOACTIVATE as well */
466  set_default_pos();
467  EXPECT_CHAIN(4,3,2,1);
468 
469  SetWindowPos(hWnd1, 0, 0,0,0,0, OwnerZOrderBParams);
470  FlushMessages();
472  EXPECT_CHAIN(1,4,3,2);
473 
474  SetWindowPos(hWnd2, 0, 0,0,0,0, OwnerZOrderBParams);
475  FlushMessages();
477  EXPECT_CHAIN(2,1,4,3);
478 
479  SetWindowPos(hWnd3, 0, 0,0,0,0, OwnerZOrderBParams);
480  FlushMessages();
482  EXPECT_CHAIN(3,2,1,4);
483 
484  SetWindowPos(hWnd1, 0, 0,0,0,0, OwnerZOrderBParams);
485  FlushMessages();
487  EXPECT_CHAIN(1,3,2,4);
488 
489  SetWindowPos(hWnd4, 0, 0,0,0,0, OwnerZOrderBParams);
490  FlushMessages();
492  EXPECT_CHAIN(4,1,3,2);
493 
494 }
MSG_ENTRY OwnerZOrder5A_chain[]
MSG_ENTRY OwnerZOrder3B_chain[]
MSG_ENTRY OwnerZOrder4B_chain[]
MSG_ENTRY OwnerZOrder2A_chain[]
HWND hWnd3
MSG_ENTRY OwnerZOrder2B_chain[]
MSG_ENTRY OwnerZOrder1B_chain[]
#define OwnerZOrderAParams
static void FlushMessages()
#define COMPARE_CACHE(msg_chain)
Definition: msgtrace.h:57
#define EXPECT_CHAIN(A, B, C, D)
#define OwnerZOrderBParams
static void set_default_pos()
MSG_ENTRY OwnerZOrder1A_chain[]
MSG_ENTRY OwnerZOrder3A_chain[]
HWND hWnd1
HWND hWnd4
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
HWND hWnd2
MSG_ENTRY OwnerZOrder5B_chain[]
MSG_ENTRY OwnerZOrder4A_chain[]

Referenced by START_TEST().

◆ Test_DWP_SimpleMsg()

static void Test_DWP_SimpleMsg ( HWND  hWnd1,
HWND  hWnd2 
)
static

Definition at line 290 of file DeferWindowPos.c.

291 {
292  HDWP hdwp;
293  BOOL ret;
294 
295  SetWindowPos(hWnd1, 0, 10,20,100,100,0);
296  SetWindowPos(hWnd2, 0, 10,20,100,100,0);
297  FlushMessages();
298  EMPTY_CACHE();
299 
300  /* move hWnd1 */
301  hdwp = BeginDeferWindowPos(1);
302  ok(hdwp != NULL, "BeginDeferWindowPos failed\n");
303  hdwp = DeferWindowPos(hdwp, hWnd1, HWND_TOP, 20, 30, 100, 100, SWP_NOACTIVATE|SWP_NOOWNERZORDER);
304  ok(hdwp != NULL, "DeferWindowPos failed\n");
305  FlushMessages();
307  ret = EndDeferWindowPos(hdwp);
308  ok(ret != 0, "EndDeferWindowPos failed\n");
309  FlushMessages();
311 
312  /* resize hWnd1 */
313  hdwp = BeginDeferWindowPos(1);
314  ok(hdwp != NULL, "BeginDeferWindowPos failed\n");
315  hdwp = DeferWindowPos(hdwp, hWnd1, HWND_TOP, 20, 30, 110, 110, SWP_NOACTIVATE|SWP_NOOWNERZORDER);
316  ok(hdwp != NULL, "DeferWindowPos failed\n");
317  FlushMessages();
319  ret = EndDeferWindowPos(hdwp);
320  ok(ret != 0, "EndDeferWindowPos failed\n");
321  FlushMessages();
323 
324  /* move both windows */
325  hdwp = BeginDeferWindowPos(1);
326  ok(hdwp != NULL, "BeginDeferWindowPos failed\n");
327  hdwp = DeferWindowPos(hdwp, hWnd1, HWND_TOP, 30, 40, 110, 110, SWP_NOACTIVATE|SWP_NOOWNERZORDER);
328  ok(hdwp != NULL, "DeferWindowPos failed\n");
329  hdwp = DeferWindowPos(hdwp, hWnd2, HWND_TOP, 30, 40, 100, 100, SWP_NOACTIVATE|SWP_NOOWNERZORDER);
330  ok(hdwp != NULL, "DeferWindowPos failed\n");
331  FlushMessages();
333  ret = EndDeferWindowPos(hdwp);
334  ok(ret != 0, "EndDeferWindowPos failed\n");
335  FlushMessages();
337 
338  /* change the z-order of the first window */
339  hdwp = BeginDeferWindowPos(1);
340  ok(hdwp != NULL, "BeginDeferWindowPos failed\n");
342  ok(hdwp != NULL, "DeferWindowPos failed\n");
343  FlushMessages();
345  ret = EndDeferWindowPos(hdwp);
346  ok(ret != 0, "EndDeferWindowPos failed\n");
347  FlushMessages();
349 
350  /* change the z-order of both windows */
351  hdwp = BeginDeferWindowPos(2);
352  ok(hdwp != NULL, "BeginDeferWindowPos failed\n");
354  ok(hdwp != NULL, "DeferWindowPos failed\n");
356  ok(hdwp != NULL, "DeferWindowPos failed\n");
357  FlushMessages();
359  ret = EndDeferWindowPos(hdwp);
360  ok(ret != 0, "EndDeferWindowPos failed\n");
361  FlushMessages();
363 
364 }
HDWP WINAPI BeginDeferWindowPos(_In_ int)
MSG_ENTRY move1_2_chain[]
MSG_ENTRY resize1_chain[]
#define HWND_TOP
Definition: winuser.h:1193
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI EndDeferWindowPos(_In_ HDWP)
smooth NULL
Definition: ftsmooth.c:416
MSG_ENTRY ZOrder1and2_chain[]
static void FlushMessages()
#define HWND_BOTTOM
Definition: winuser.h:1191
HDWP WINAPI DeferWindowPos(_In_ HDWP, _In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
MSG_ENTRY ZOrder1_chain[]
#define COMPARE_CACHE(msg_chain)
Definition: msgtrace.h:57
#define SWP_NOACTIVATE
Definition: winuser.h:1227
int ret
#define EMPTY_CACHE()
Definition: msgtrace.h:59
#define SWP_NOSIZE
Definition: winuser.h:1230
#define ok(value,...)
Definition: atltest.h:57
HWND hWnd1
#define SWP_NOMOVE
Definition: winuser.h:1229
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
MSG_ENTRY move1_chain[]
MSG_ENTRY empty_chain[]
Definition: msgtrace.c:20
HWND hWnd2
#define SWP_NOOWNERZORDER
Definition: winuser.h:1234

Referenced by START_TEST().

Variable Documentation

◆ hWnd1

◆ hWnd2

◆ hWnd3

◆ hWnd4

HWND hWnd4

Definition at line 10 of file DeferWindowPos.c.

Referenced by get_iwnd(), set_default_pos(), START_TEST(), and Test_DWP_OwnerZOrder().

◆ move1_2_chain

MSG_ENTRY move1_2_chain[]
Initial value:
={
{1,WM_MOVE},
{2,WM_MOVE},
{0,0}}
#define WM_MOVE
Definition: winuser.h:1592
#define SWP_NOZORDER
Definition: winuser.h:1232
#define SWP_NOACTIVATE
Definition: winuser.h:1227
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1643
#define SWP_NOSIZE
Definition: winuser.h:1230
Definition: msgtrace.h:6
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1644
#define SWP_NOCLIENTSIZE
Definition: msg.h:29
#define WM_GETMINMAXINFO
Definition: winuser.h:1622
#define SWP_NOOWNERZORDER
Definition: winuser.h:1234

Definition at line 266 of file DeferWindowPos.c.

Referenced by Test_DWP_SimpleMsg().

◆ move1_chain

MSG_ENTRY move1_chain[]
Initial value:
={
{1,WM_MOVE},
{0,0}}
#define WM_MOVE
Definition: winuser.h:1592
#define SWP_NOACTIVATE
Definition: winuser.h:1227
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1643
#define SWP_NOSIZE
Definition: winuser.h:1230
Definition: msgtrace.h:6
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1644
#define SWP_NOCLIENTSIZE
Definition: msg.h:29
#define WM_GETMINMAXINFO
Definition: winuser.h:1622
#define SWP_NOOWNERZORDER
Definition: winuser.h:1234

Definition at line 250 of file DeferWindowPos.c.

Referenced by Test_DWP_SimpleMsg().

◆ OwnerZOrder1A_chain

MSG_ENTRY OwnerZOrder1A_chain[]
Initial value:

Definition at line 368 of file DeferWindowPos.c.

Referenced by Test_DWP_OwnerZOrder().

◆ OwnerZOrder1B_chain

MSG_ENTRY OwnerZOrder1B_chain[]
Initial value:
={
{0,0}}
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1643
#define OwnerZOrderBParams
Definition: msgtrace.h:6
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1644
#define SWP_NOCLIENTMOVE
Definition: msg.h:30
#define SWP_NOCLIENTSIZE
Definition: msg.h:29

Definition at line 403 of file DeferWindowPos.c.

Referenced by Test_DWP_OwnerZOrder().

◆ OwnerZOrder2A_chain

MSG_ENTRY OwnerZOrder2A_chain[]
Initial value:
={
{0,0}}
#define OwnerZOrderAParams
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1643
Definition: msgtrace.h:6
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1644
#define SWP_NOCLIENTMOVE
Definition: msg.h:30
#define SWP_NOCLIENTSIZE
Definition: msg.h:29

Definition at line 374 of file DeferWindowPos.c.

Referenced by Test_DWP_OwnerZOrder().

◆ OwnerZOrder2B_chain

MSG_ENTRY OwnerZOrder2B_chain[]
Initial value:
={
{0,0}}
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1643
#define OwnerZOrderBParams
Definition: msgtrace.h:6
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1644
#define SWP_NOCLIENTMOVE
Definition: msg.h:30
#define SWP_NOCLIENTSIZE
Definition: msg.h:29

Definition at line 408 of file DeferWindowPos.c.

Referenced by Test_DWP_OwnerZOrder().

◆ OwnerZOrder3A_chain

MSG_ENTRY OwnerZOrder3A_chain[]

◆ OwnerZOrder3B_chain

MSG_ENTRY OwnerZOrder3B_chain[]
Initial value:
={
{0,0}}
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1643
#define OwnerZOrderBParams
Definition: msgtrace.h:6
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1644
#define SWP_NOCLIENTMOVE
Definition: msg.h:30
#define SWP_NOCLIENTSIZE
Definition: msg.h:29

Definition at line 413 of file DeferWindowPos.c.

Referenced by Test_DWP_OwnerZOrder().

◆ OwnerZOrder4A_chain

MSG_ENTRY OwnerZOrder4A_chain[]
Initial value:

Definition at line 388 of file DeferWindowPos.c.

Referenced by Test_DWP_OwnerZOrder().

◆ OwnerZOrder4B_chain

MSG_ENTRY OwnerZOrder4B_chain[]
Initial value:
={
{0,0}}
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1643
#define OwnerZOrderBParams
Definition: msgtrace.h:6
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1644
#define SWP_NOCLIENTMOVE
Definition: msg.h:30
#define SWP_NOCLIENTSIZE
Definition: msg.h:29

Definition at line 418 of file DeferWindowPos.c.

Referenced by Test_DWP_OwnerZOrder().

◆ OwnerZOrder5A_chain

MSG_ENTRY OwnerZOrder5A_chain[]
Initial value:
={
{0,0}}
#define OwnerZOrderAParams
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1643
Definition: msgtrace.h:6
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1644
#define SWP_NOCLIENTMOVE
Definition: msg.h:30
#define SWP_NOCLIENTSIZE
Definition: msg.h:29

Definition at line 394 of file DeferWindowPos.c.

Referenced by Test_DWP_OwnerZOrder().

◆ OwnerZOrder5B_chain

MSG_ENTRY OwnerZOrder5B_chain[]
Initial value:
={
{0,0}}
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1643
#define OwnerZOrderBParams
Definition: msgtrace.h:6
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1644
#define SWP_NOCLIENTMOVE
Definition: msg.h:30
#define SWP_NOCLIENTSIZE
Definition: msg.h:29

Definition at line 423 of file DeferWindowPos.c.

Referenced by Test_DWP_OwnerZOrder().

◆ resize1_chain

MSG_ENTRY resize1_chain[]
Initial value:
={
{1,WM_SIZE},
{0,0}}
#define WM_NCCALCSIZE
Definition: winuser.h:1667
#define SWP_NOZORDER
Definition: winuser.h:1232
#define WM_SIZE
Definition: winuser.h:1593
#define SWP_NOACTIVATE
Definition: winuser.h:1227
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1643
Definition: msgtrace.h:6
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1644
#define SWP_NOCLIENTMOVE
Definition: msg.h:30
#define SWP_NOMOVE
Definition: winuser.h:1229
#define WM_GETMINMAXINFO
Definition: winuser.h:1622
#define SWP_NOOWNERZORDER
Definition: winuser.h:1234

Definition at line 257 of file DeferWindowPos.c.

Referenced by Test_DWP_SimpleMsg().

◆ ZOrder1_chain

MSG_ENTRY ZOrder1_chain[]
Initial value:
={
{0,0}}
#define SWP_NOACTIVATE
Definition: winuser.h:1227
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1643
#define SWP_NOSIZE
Definition: winuser.h:1230
Definition: msgtrace.h:6
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1644
#define SWP_NOCLIENTMOVE
Definition: msg.h:30
#define SWP_NOMOVE
Definition: winuser.h:1229
#define SWP_NOCLIENTSIZE
Definition: msg.h:29
#define SWP_NOOWNERZORDER
Definition: winuser.h:1234

Definition at line 278 of file DeferWindowPos.c.

Referenced by Test_DWP_SimpleMsg().

◆ ZOrder1and2_chain

MSG_ENTRY ZOrder1and2_chain[]
Initial value:

Definition at line 283 of file DeferWindowPos.c.

Referenced by Test_DWP_SimpleMsg().