Rebase against c963c4141a0d4f6601c37f11d79de186be0da6a9.

This commit is contained in:
Zebediah Figura 2024-01-26 17:31:02 -06:00
parent fbae1b5a2c
commit 065d60e3d7
3 changed files with 1 additions and 359 deletions

View File

@ -1,200 +0,0 @@
From f3b9bbdd8acf2918aa9e1f17227c70ab24c4651c Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Mon, 29 May 2017 05:30:44 +0200
Subject: [PATCH] user32/tests: Add tests for clicking through layered window.
FIXME:
* It seems like the color key channels are swapped between Windows and Wine.
This can be tested by replacing the (128, 128, 128) with something else.
* Add tests with WS_CHILD layered Windows. On Windows this is supported for
>= Win8, but only when a manifest is present.
---
dlls/user32/tests/input.c | 156 ++++++++++++++++++++++++++++++++++++++
1 file changed, 156 insertions(+)
diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c
index 5135a2456cb..5bae753be6f 100644
--- a/dlls/user32/tests/input.c
+++ b/dlls/user32/tests/input.c
@@ -52,6 +52,7 @@
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
+#include "wingdi.h"
#include "winnls.h"
#include "winreg.h"
#include "ddk/hidsdi.h"
@@ -3252,6 +3253,7 @@ static void test_Input_mouse(void)
struct thread_data thread_data;
HANDLE thread;
DWORD thread_id;
+ WNDCLASSA wclass;
POINT pt, pt_org;
MSG msg;
BOOL ret;
@@ -3466,6 +3468,160 @@ static void test_Input_mouse(void)
ok(got_button_up, "expected WM_LBUTTONUP message\n");
DestroyWindow(hwnd);
ok(ReleaseCapture(), "ReleaseCapture failed\n");
+
+ wclass.style = 0;
+ wclass.lpfnWndProc = WndProc;
+ wclass.cbClsExtra = 0;
+ wclass.cbWndExtra = 0;
+ wclass.hInstance = GetModuleHandleA(NULL);
+ wclass.hIcon = LoadIconA(0, (LPCSTR)IDI_APPLICATION);
+ wclass.hCursor = LoadCursorA(NULL, (LPCSTR)IDC_ARROW);
+ wclass.hbrBackground = CreateSolidBrush(RGB(128, 128, 128));
+ wclass.lpszMenuName = NULL;
+ wclass.lpszClassName = "InputLayeredTestClass";
+ RegisterClassA( &wclass );
+
+ /* click through layered window with alpha channel / color key */
+ hwnd = CreateWindowA(wclass.lpszClassName, "InputLayeredTest",
+ WS_VISIBLE | WS_POPUP, 100, 100, 100, 100, button_win, NULL, NULL, NULL);
+ ok(hwnd != NULL, "CreateWindowEx failed\n");
+
+ SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
+ SetWindowLongA(hwnd, GWL_EXSTYLE, GetWindowLongA(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED);
+ ret = SetLayeredWindowAttributes(hwnd, 0, 255, LWA_ALPHA);
+ ok(ret, "SetLayeredWindowAttributes failed\n");
+ while (wait_for_message(&msg)) DispatchMessageA(&msg);
+ Sleep(100);
+
+ got_button_down = got_button_up = FALSE;
+ simulate_click(TRUE, 150, 150);
+ while (wait_for_message(&msg))
+ {
+ DispatchMessageA(&msg);
+
+ if (msg.message == WM_LBUTTONDOWN)
+ {
+ ok(msg.hwnd == hwnd, "msg.hwnd = %p\n", msg.hwnd);
+ got_button_down = TRUE;
+ }
+ else if (msg.message == WM_LBUTTONUP)
+ {
+ ok(msg.hwnd == hwnd, "msg.hwnd = %p\n", msg.hwnd);
+ got_button_up = TRUE;
+ break;
+ }
+ }
+ ok(got_button_down, "expected WM_LBUTTONDOWN message\n");
+ ok(got_button_up, "expected WM_LBUTTONUP message\n");
+
+ ret = SetLayeredWindowAttributes(hwnd, 0, 0, LWA_ALPHA);
+ ok(ret, "SetLayeredWindowAttributes failed\n");
+ while (wait_for_message(&msg)) DispatchMessageA(&msg);
+ Sleep(100);
+
+ got_button_down = got_button_up = FALSE;
+ simulate_click(TRUE, 150, 150);
+ while (wait_for_message(&msg))
+ {
+ DispatchMessageA(&msg);
+
+ if (msg.message == WM_LBUTTONDOWN)
+ {
+ todo_wine
+ ok(msg.hwnd == button_win, "msg.hwnd = %p\n", msg.hwnd);
+ got_button_down = TRUE;
+ }
+ else if (msg.message == WM_LBUTTONUP)
+ {
+ todo_wine
+ ok(msg.hwnd == button_win, "msg.hwnd = %p\n", msg.hwnd);
+ got_button_up = TRUE;
+ break;
+ }
+ }
+ ok(got_button_down || broken(!got_button_down), "expected WM_LBUTTONDOWN message\n");
+ ok(got_button_up, "expected WM_LBUTTONUP message\n");
+
+ ret = SetLayeredWindowAttributes(hwnd, RGB(0, 255, 0), 255, LWA_ALPHA | LWA_COLORKEY);
+ ok(ret, "SetLayeredWindowAttributes failed\n");
+ while (wait_for_message(&msg)) DispatchMessageA(&msg);
+ Sleep(100);
+
+ got_button_down = got_button_up = FALSE;
+ simulate_click(TRUE, 150, 150);
+ while (wait_for_message(&msg))
+ {
+ DispatchMessageA(&msg);
+
+ if (msg.message == WM_LBUTTONDOWN)
+ {
+ ok(msg.hwnd == hwnd, "msg.hwnd = %p\n", msg.hwnd);
+ got_button_down = TRUE;
+ }
+ else if (msg.message == WM_LBUTTONUP)
+ {
+ ok(msg.hwnd == hwnd, "msg.hwnd = %p\n", msg.hwnd);
+ got_button_up = TRUE;
+ break;
+ }
+ }
+ ok(got_button_down, "expected WM_LBUTTONDOWN message\n");
+ ok(got_button_up, "expected WM_LBUTTONUP message\n");
+
+ ret = SetLayeredWindowAttributes(hwnd, RGB(128, 128, 128), 0, LWA_COLORKEY);
+ ok(ret, "SetLayeredWindowAttributes failed\n");
+ while (wait_for_message(&msg)) DispatchMessageA(&msg);
+ Sleep(100);
+
+ got_button_down = got_button_up = FALSE;
+ simulate_click(TRUE, 150, 150);
+ while (wait_for_message(&msg))
+ {
+ DispatchMessageA(&msg);
+
+ if (msg.message == WM_LBUTTONDOWN)
+ {
+ todo_wine
+ ok(msg.hwnd == button_win, "msg.hwnd = %p\n", msg.hwnd);
+ got_button_down = TRUE;
+ }
+ else if (msg.message == WM_LBUTTONUP)
+ {
+ todo_wine
+ ok(msg.hwnd == button_win, "msg.hwnd = %p\n", msg.hwnd);
+ got_button_up = TRUE;
+ break;
+ }
+ }
+ ok(got_button_down, "expected WM_LBUTTONDOWN message\n");
+ ok(got_button_up, "expected WM_LBUTTONUP message\n");
+
+ SetWindowLongA(hwnd, GWL_EXSTYLE, GetWindowLongA(hwnd, GWL_EXSTYLE) & ~WS_EX_LAYERED);
+ while (wait_for_message(&msg)) DispatchMessageA(&msg);
+ Sleep(100);
+
+ got_button_down = got_button_up = FALSE;
+ simulate_click(TRUE, 150, 150);
+ while (wait_for_message(&msg))
+ {
+ DispatchMessageA(&msg);
+
+ if (msg.message == WM_LBUTTONDOWN)
+ {
+ ok(msg.hwnd == hwnd, "msg.hwnd = %p\n", msg.hwnd);
+ got_button_down = TRUE;
+ }
+ else if (msg.message == WM_LBUTTONUP)
+ {
+ ok(msg.hwnd == hwnd, "msg.hwnd = %p\n", msg.hwnd);
+ got_button_up = TRUE;
+ break;
+ }
+ }
+ ok(got_button_down, "expected WM_LBUTTONDOWN message\n");
+ ok(got_button_up, "expected WM_LBUTTONUP message\n");
+
+ DestroyWindow(hwnd);
SetCursorPos(pt_org.x, pt_org.y);
CloseHandle(thread_data.start_event);
--
2.30.2

View File

@ -1,158 +0,0 @@
From 32b50b0699f61ac8faee5e9be41b8f0fbe31ff9e Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Mon, 29 May 2017 06:04:18 +0200
Subject: [PATCH] user32/tests: Add tests for window region of layered windows.
---
dlls/user32/tests/input.c | 72 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 71 insertions(+), 1 deletion(-)
diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c
index d2043a1553f..bf6377c8c8d 100644
--- a/dlls/user32/tests/input.c
+++ b/dlls/user32/tests/input.c
@@ -331,6 +331,7 @@ static int (WINAPI *pGetMouseMovePointsEx) (UINT, LPMOUSEMOVEPOINT, LPMOUSEMOVEP
static UINT (WINAPI *pGetRawInputDeviceList) (PRAWINPUTDEVICELIST, PUINT, UINT);
static UINT (WINAPI *pGetRawInputDeviceInfoW) (HANDLE, UINT, void *, UINT *);
static UINT (WINAPI *pGetRawInputDeviceInfoA) (HANDLE, UINT, void *, UINT *);
+static int (WINAPI *pGetWindowRgnBox)(HWND, LPRECT);
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
/**********************adapted from input.c **********************************/
@@ -357,6 +358,7 @@ static void init_function_pointers(void)
GET_PROC(GetRawInputDeviceList);
GET_PROC(GetRawInputDeviceInfoW);
GET_PROC(GetRawInputDeviceInfoA);
+ GET_PROC(GetWindowRgnBox);
hdll = GetModuleHandleA("kernel32");
GET_PROC(IsWow64Process);
@@ -3857,6 +3859,9 @@ static void test_Input_mouse(void)
DWORD thread_id;
WNDCLASSA wclass;
POINT pt, pt_org;
+ int region_type;
+ HRGN hregion;
+ RECT region;
MSG msg;
BOOL ret;
@@ -4084,7 +4089,7 @@ static void test_Input_mouse(void)
ok(ReleaseCapture(), "ReleaseCapture failed\n");
wclass.style = 0;
- wclass.lpfnWndProc = WndProc;
+ wclass.lpfnWndProc = static_hook_proc;
wclass.cbClsExtra = 0;
wclass.cbWndExtra = 0;
wclass.hInstance = GetModuleHandleA(NULL);
@@ -4107,6 +4112,12 @@ static void test_Input_mouse(void)
while (wait_for_message(&msg)) DispatchMessageA(&msg);
Sleep(100);
+ if (pGetWindowRgnBox)
+ {
+ region_type = pGetWindowRgnBox(hwnd, &region);
+ ok(region_type == ERROR, "expected ERROR, got %d\n", region_type);
+ }
+
got_button_down = got_button_up = FALSE;
simulate_click(TRUE, 150, 150);
while (wait_for_message(&msg))
@@ -4133,6 +4144,12 @@ static void test_Input_mouse(void)
while (wait_for_message(&msg)) DispatchMessageA(&msg);
Sleep(100);
+ if (pGetWindowRgnBox)
+ {
+ region_type = pGetWindowRgnBox(hwnd, &region);
+ ok(region_type == ERROR, "expected ERROR, got %d\n", region_type);
+ }
+
got_button_down = got_button_up = FALSE;
simulate_click(TRUE, 150, 150);
while (wait_for_message(&msg))
@@ -4161,6 +4178,12 @@ static void test_Input_mouse(void)
while (wait_for_message(&msg)) DispatchMessageA(&msg);
Sleep(100);
+ if (pGetWindowRgnBox)
+ {
+ region_type = pGetWindowRgnBox(hwnd, &region);
+ ok(region_type == ERROR, "expected ERROR, got %d\n", region_type);
+ }
+
got_button_down = got_button_up = FALSE;
simulate_click(TRUE, 150, 150);
while (wait_for_message(&msg))
@@ -4187,6 +4210,12 @@ static void test_Input_mouse(void)
while (wait_for_message(&msg)) DispatchMessageA(&msg);
Sleep(100);
+ if (pGetWindowRgnBox)
+ {
+ region_type = pGetWindowRgnBox(hwnd, &region);
+ ok(region_type == ERROR, "expected ERROR, got %d\n", region_type);
+ }
+
got_button_down = got_button_up = FALSE;
simulate_click(TRUE, 150, 150);
while (wait_for_message(&msg))
@@ -4214,6 +4243,12 @@ static void test_Input_mouse(void)
while (wait_for_message(&msg)) DispatchMessageA(&msg);
Sleep(100);
+ if (pGetWindowRgnBox)
+ {
+ region_type = pGetWindowRgnBox(hwnd, &region);
+ ok(region_type == ERROR, "expected ERROR, got %d\n", region_type);
+ }
+
got_button_down = got_button_up = FALSE;
simulate_click(TRUE, 150, 150);
while (wait_for_message(&msg))
@@ -4235,6 +4270,41 @@ static void test_Input_mouse(void)
ok(got_button_down, "expected WM_LBUTTONDOWN message\n");
ok(got_button_up, "expected WM_LBUTTONUP message\n");
+ hregion = CreateRectRgn(0, 0, 10, 10);
+ ok(hregion != NULL, "CreateRectRgn failed\n");
+ ret = SetWindowRgn(hwnd, hregion, TRUE);
+ ok(ret, "SetWindowRgn failed\n");
+ DeleteObject(hregion);
+ while (wait_for_message(&msg)) DispatchMessageA(&msg);
+ Sleep(1000);
+
+ if (pGetWindowRgnBox)
+ {
+ region_type = pGetWindowRgnBox(hwnd, &region);
+ ok(region_type == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", region_type);
+ }
+
+ got_button_down = got_button_up = FALSE;
+ simulate_click(TRUE, 150, 150);
+ while (wait_for_message(&msg))
+ {
+ DispatchMessageA(&msg);
+
+ if (msg.message == WM_LBUTTONDOWN)
+ {
+ ok(msg.hwnd == button_win, "msg.hwnd = %p\n", msg.hwnd);
+ got_button_down = TRUE;
+ }
+ else if (msg.message == WM_LBUTTONUP)
+ {
+ ok(msg.hwnd == button_win, "msg.hwnd = %p\n", msg.hwnd);
+ got_button_up = TRUE;
+ break;
+ }
+ }
+ ok(got_button_down, "expected WM_LBUTTONDOWN message\n");
+ ok(got_button_up, "expected WM_LBUTTONUP message\n");
+
DestroyWindow(hwnd);
SetCursorPos(pt_org.x, pt_org.y);
--
2.43.0

View File

@ -1 +1 @@
eb5993a7c6fbc1cd9deac0dceabc8f1c76e14ba8
c963c4141a0d4f6601c37f11d79de186be0da6a9