ReactOS  0.4.14-dev-293-g2b39b42
SetActiveWindow.c File Reference
#include "precomp.h"
Include dependency graph for SetActiveWindow.c:

Go to the source code of this file.

Functions

static int get_iwnd (HWND hWnd)
 
LRESULT CALLBACK OwnerTestProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 
static void FlushMessages ()
 
static void create_test_windows ()
 
static void set_default_zorder ()
 
static void destroy_test_window ()
 
void Test_msg_simple ()
 
 START_TEST (SetActiveWindow)
 

Variables

HWND hWnd1
 
HWND hWnd2
 
MSG_ENTRY activate2to1_chain []
 
MSG_ENTRY activate1to2_chain []
 

Function Documentation

◆ create_test_windows()

static void create_test_windows ( )
static

Definition at line 69 of file SetActiveWindow.c.

70 {
71  RegisterSimpleClass(OwnerTestProc, L"ownertest");
72  hWnd1 = CreateWindowW(L"ownertest", L"ownertest", WS_OVERLAPPEDWINDOW,
73  20, 20, 300, 300, NULL, NULL, 0, NULL);
74 
75  hWnd2 = CreateWindowW(L"ownertest", L"ownertest", WS_OVERLAPPEDWINDOW,
76  200, 200, 300, 300, NULL, NULL, 0, NULL);
77 }
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4217
LRESULT CALLBACK OwnerTestProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
HWND hWnd2
HWND hWnd1
smooth NULL
Definition: ftsmooth.c:416
static __inline ATOM RegisterSimpleClass(WNDPROC lpfnWndProc, LPCWSTR lpszClassName)
static const WCHAR L[]
Definition: oid.c:1250
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637

Referenced by Test_msg_simple().

◆ destroy_test_window()

static void destroy_test_window ( )
static

Definition at line 88 of file SetActiveWindow.c.

89 {
92  UnregisterClassW(L"testClass", 0);
93 }
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)
BOOL WINAPI DestroyWindow(_In_ HWND)
HWND hWnd2
HWND hWnd1
static const WCHAR L[]
Definition: oid.c:1250

Referenced by Test_msg_simple().

◆ FlushMessages()

static void FlushMessages ( )
static

Definition at line 56 of file SetActiveWindow.c.

57 {
58  MSG msg;
59 
60  while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE ))
61  {
62  int iwnd = get_iwnd(msg.hwnd);
63  if(!(msg.message > WM_USER || !iwnd || IsDWmMsg(msg.message) || IseKeyMsg(msg.message)))
64  RECORD_MESSAGE(iwnd, msg.message, POST,0,0);
66  }
67 }
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
static int get_iwnd(HWND hWnd)
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_zorder(), and Test_msg_simple().

◆ get_iwnd()

static int get_iwnd ( HWND  hWnd)
static

Definition at line 13 of file SetActiveWindow.c.

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

Referenced by FlushMessages(), and OwnerTestProc().

◆ OwnerTestProc()

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

Definition at line 20 of file SetActiveWindow.c.

21 {
22  int iwnd = get_iwnd(hWnd);
23 
24  if(message > WM_USER || !iwnd || IsDWmMsg(message) || IseKeyMsg(message))
26 
27  switch(message)
28  {
29  case WM_QUERYNEWPALETTE:
30  {
31  HDC hdc = GetDC(0);
33  ok( bits == 8 , "expected WM_QUERYNEWPALETTE only on 8bpp\n");
34  ReleaseDC(0, hdc);
35  return FALSE;
36  }
37  case WM_IME_SETCONTEXT:
38  case WM_IME_NOTIFY :
39  case WM_GETICON :
40  case WM_GETTEXT:
41  break;
44  {
45  WINDOWPOS* pwp = (WINDOWPOS*)lParam;
46  ok(wParam==0,"expected wParam=0\n");
48  break;
49  }
50  default:
51  RECORD_MESSAGE(iwnd, message, SENT, 0,0);
52  }
54 }
#define BITSPIXEL
Definition: wingdi.h:719
#define WM_IME_NOTIFY
Definition: winuser.h:1812
Definition: tftpd.h:59
HDC WINAPI GetDC(_In_opt_ HWND)
#define WM_GETTEXT
Definition: winuser.h:1600
static HDC
Definition: imagelist.c:92
HWND hWnd
Definition: settings.c:17
HWND hwndInsertAfter
Definition: winuser.h:3563
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
WPARAM wParam
Definition: combotst.c:138
static BOOL IseKeyMsg(UINT msg)
Definition: msgtrace.h:52
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
static int get_iwnd(HWND hWnd)
UINT flags
Definition: winuser.h:3568
#define DefWindowProc
Definition: ros2win.h:31
#define WM_QUERYNEWPALETTE
Definition: winuser.h:1860
#define WM_IME_SETCONTEXT
Definition: winuser.h:1811
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1643
HDC hdc
Definition: main.c:9
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#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 create_test_windows().

◆ set_default_zorder()

static void set_default_zorder ( )
static

Definition at line 79 of file SetActiveWindow.c.

80 {
83 
84  FlushMessages();
85  EMPTY_CACHE();
86 }
HWND hWnd2
HWND hWnd1
static void FlushMessages()
#define EMPTY_CACHE()
Definition: msgtrace.h:59
#define SWP_NOSIZE
Definition: winuser.h:1230
#define SWP_SHOWWINDOW
Definition: winuser.h:1233
#define SWP_NOREPOSITION
Definition: winuser.h:1235
#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)

Referenced by Test_msg_simple().

◆ START_TEST()

START_TEST ( SetActiveWindow  )

Definition at line 135 of file SetActiveWindow.c.

136 {
137  Test_msg_simple();
138 }
void Test_msg_simple()

◆ Test_msg_simple()

void Test_msg_simple ( )

Definition at line 117 of file SetActiveWindow.c.

118 {
119  SetCursorPos(0,0);
120 
123 
125  FlushMessages();
127 
129  FlushMessages();
131 
133 }
static void create_test_windows()
static void destroy_test_window()
HWND WINAPI SetActiveWindow(_In_ HWND)
HWND hWnd2
HWND hWnd1
static void set_default_zorder()
#define COMPARE_CACHE(msg_chain)
Definition: msgtrace.h:57
BOOL WINAPI SetCursorPos(_In_ int, _In_ int)
Definition: cursoricon.c:2627
static void FlushMessages()
MSG_ENTRY activate2to1_chain[]
MSG_ENTRY activate1to2_chain[]

Referenced by START_TEST().

Variable Documentation

◆ activate1to2_chain

MSG_ENTRY activate1to2_chain[]
Initial value:
={
{0,0}}
#define WM_NCACTIVATE
Definition: winuser.h:1670
#define WM_KILLFOCUS
Definition: winuser.h:1596
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1643
#define SWP_NOSIZE
Definition: winuser.h:1230
#define WM_ACTIVATE
Definition: winuser.h:1594
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_SETFOCUS
Definition: winuser.h:1595
#define SWP_NOCLIENTSIZE
Definition: msg.h:29

Definition at line 106 of file SetActiveWindow.c.

Referenced by Test_msg_simple().

◆ activate2to1_chain

MSG_ENTRY activate2to1_chain[]
Initial value:
={
{0,0}}
#define WM_NCACTIVATE
Definition: winuser.h:1670
#define WM_KILLFOCUS
Definition: winuser.h:1596
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1643
#define SWP_NOSIZE
Definition: winuser.h:1230
#define WM_ACTIVATE
Definition: winuser.h:1594
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_SETFOCUS
Definition: winuser.h:1595
#define SWP_NOCLIENTSIZE
Definition: msg.h:29

Definition at line 95 of file SetActiveWindow.c.

Referenced by Test_msg_simple().

◆ hWnd1

◆ hWnd2