mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-01-28 22:04:43 -08:00
user32-Mouse_Message_Hwnd: Update patchset and fix a regression related to the DC region.
This commit is contained in:
parent
ae2d23d9f4
commit
c66ae9f084
@ -8721,12 +8721,14 @@ if test "$enable_user32_Mouse_Message_Hwnd" -eq 1; then
|
||||
patch_apply user32-Mouse_Message_Hwnd/0001-user32-Try-harder-to-find-a-target-for-mouse-message.patch
|
||||
patch_apply user32-Mouse_Message_Hwnd/0002-user32-tests-Add-tests-for-clicking-through-layered-.patch
|
||||
patch_apply user32-Mouse_Message_Hwnd/0003-user32-tests-Add-tests-for-window-region-of-layered-.patch
|
||||
patch_apply user32-Mouse_Message_Hwnd/0004-server-Add-support-for-a-layered-window-region.-v2.patch
|
||||
patch_apply user32-Mouse_Message_Hwnd/0004-user32-tests-Add-tests-for-DC-region.patch
|
||||
patch_apply user32-Mouse_Message_Hwnd/0005-server-Add-support-for-a-layered-window-region.-v2.patch
|
||||
(
|
||||
printf '%s\n' '+ { "Dmitry Timoshkov", "user32: Try harder to find a target for mouse messages.", 1 },';
|
||||
printf '%s\n' '+ { "Sebastian Lackner", "user32/tests: Add tests for clicking through layered window.", 1 },';
|
||||
printf '%s\n' '+ { "Sebastian Lackner", "user32/tests: Add tests for window region of layered windows.", 1 },';
|
||||
printf '%s\n' '+ { "Dmitry Timoshkov", "server: Add support for a layered window region.", 2 },';
|
||||
printf '%s\n' '+ { "Sebastian Lackner", "user32/tests: Add tests for DC region.", 1 },';
|
||||
printf '%s\n' '+ { "Dmitry Timoshkov", "server: Add support for a layered window region.", 3 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
|
@ -0,0 +1,85 @@
|
||||
From c9234e0e3cf1c326bd3fae7d931d70d16878b863 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Sun, 17 Sep 2017 19:59:08 +0200
|
||||
Subject: user32/tests: Add tests for DC region.
|
||||
|
||||
---
|
||||
dlls/user32/tests/input.c | 41 +++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 41 insertions(+)
|
||||
|
||||
diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c
|
||||
index 41c7e3f1721..c4316d3041b 100644
|
||||
--- a/dlls/user32/tests/input.c
|
||||
+++ b/dlls/user32/tests/input.c
|
||||
@@ -1992,6 +1992,23 @@ static DWORD WINAPI create_static_win(void *arg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static void get_dc_region(RECT *region, HWND hwnd, DWORD flags)
|
||||
+{
|
||||
+ int region_type;
|
||||
+ HRGN hregion;
|
||||
+ HDC hdc;
|
||||
+
|
||||
+ hdc = GetDCEx(hwnd, 0, flags);
|
||||
+ ok(hdc != NULL, "GetDCEx failed\n");
|
||||
+ hregion = CreateRectRgn(40, 40, 60, 60);
|
||||
+ ok(hregion != NULL, "CreateRectRgn failed\n");
|
||||
+ GetRandomRgn(hdc, hregion, SYSRGN);
|
||||
+ region_type = GetRgnBox(hregion, region);
|
||||
+ ok(region_type == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", region_type);
|
||||
+ DeleteObject(hregion);
|
||||
+ ReleaseDC(hwnd, hdc);
|
||||
+}
|
||||
+
|
||||
static void test_Input_mouse(void)
|
||||
{
|
||||
BOOL got_button_down, got_button_up;
|
||||
@@ -2226,6 +2243,10 @@ static void test_Input_mouse(void)
|
||||
WS_VISIBLE | WS_POPUP, 100, 100, 100, 100, button_win, NULL, NULL, NULL);
|
||||
ok(hwnd != NULL, "CreateWindowEx failed\n");
|
||||
|
||||
+ static_win = CreateWindowA("static", "Title", WS_VISIBLE | WS_CHILD,
|
||||
+ 10, 10, 20, 20, hwnd, NULL, NULL, NULL);
|
||||
+ ok(static_win != NULL, "CreateWindowA failed %u\n", GetLastError());
|
||||
+
|
||||
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);
|
||||
@@ -2337,6 +2358,25 @@ static void test_Input_mouse(void)
|
||||
ok(region_type == ERROR, "expected ERROR, got %d\n", region_type);
|
||||
}
|
||||
|
||||
+ get_dc_region(®ion, hwnd, DCX_PARENTCLIP);
|
||||
+ ok(region.left == 100 && region.top == 100 && region.right == 200 && region.bottom == 200,
|
||||
+ "expected region (100,100)-(200,200), got %s\n", wine_dbgstr_rect(®ion));
|
||||
+ get_dc_region(®ion, hwnd, DCX_WINDOW | DCX_USESTYLE);
|
||||
+ ok(region.left == 100 && region.top == 100 && region.right == 200 && region.bottom == 200,
|
||||
+ "expected region (100,100)-(200,200), got %s\n", wine_dbgstr_rect(®ion));
|
||||
+ get_dc_region(®ion, hwnd, DCX_USESTYLE);
|
||||
+ ok(region.left == 100 && region.top == 100 && region.right == 200 && region.bottom == 200,
|
||||
+ "expected region (100,100)-(200,200), got %s\n", wine_dbgstr_rect(®ion));
|
||||
+ get_dc_region(®ion, static_win, DCX_PARENTCLIP);
|
||||
+ ok(region.left == 100 && region.top == 100 && region.right == 200 && region.bottom == 200,
|
||||
+ "expected region (100,100)-(200,200), got %s\n", wine_dbgstr_rect(®ion));
|
||||
+ get_dc_region(®ion, static_win, DCX_WINDOW | DCX_USESTYLE);
|
||||
+ ok(region.left == 110 && region.top == 110 && region.right == 130 && region.bottom == 130,
|
||||
+ "expected region (110,110)-(130,130), got %s\n", wine_dbgstr_rect(®ion));
|
||||
+ get_dc_region(®ion, static_win, DCX_USESTYLE);
|
||||
+ ok(region.left == 100 && region.top == 100 && region.right == 200 && region.bottom == 200,
|
||||
+ "expected region (100,100)-(200,200), got %s\n", wine_dbgstr_rect(®ion));
|
||||
+
|
||||
got_button_down = got_button_up = FALSE;
|
||||
simulate_click(TRUE, 150, 150);
|
||||
while (wait_for_message(&msg))
|
||||
@@ -2426,6 +2466,7 @@ static void test_Input_mouse(void)
|
||||
ok(got_button_down, "expected WM_LBUTTONDOWN message\n");
|
||||
ok(got_button_up, "expected WM_LBUTTONUP message\n");
|
||||
|
||||
+ DestroyWindow(static_win);
|
||||
DestroyWindow(hwnd);
|
||||
SetCursorPos(pt_org.x, pt_org.y);
|
||||
|
||||
--
|
||||
2.14.1
|
||||
|
@ -1,20 +1,20 @@
|
||||
From 0a05b54ff85992ae187dc095634e0317e30954e9 Mon Sep 17 00:00:00 2001
|
||||
From 90e993f23a08f2782181fee754108a4c52ce3daf Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Timoshkov <dmitry@baikal.ru>
|
||||
Date: Wed, 17 May 2017 23:55:55 +0800
|
||||
Subject: server: Add support for a layered window region. (v2)
|
||||
Subject: server: Add support for a layered window region. (v3)
|
||||
|
||||
---
|
||||
dlls/user32/tests/input.c | 2 --
|
||||
dlls/winex11.drv/bitblt.c | 45 ++++++++++++++++++++++++++++++++++
|
||||
server/protocol.def | 7 ++++++
|
||||
server/window.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++
|
||||
4 files changed, 114 insertions(+), 2 deletions(-)
|
||||
dlls/winex11.drv/bitblt.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
|
||||
server/protocol.def | 7 +++++++
|
||||
server/window.c | 32 ++++++++++++++++++++++++++++++++
|
||||
4 files changed, 84 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c
|
||||
index 08c4c5435c6..87c491657a9 100644
|
||||
index c4316d3041b..8c8993bf4bd 100644
|
||||
--- a/dlls/user32/tests/input.c
|
||||
+++ b/dlls/user32/tests/input.c
|
||||
@@ -2276,13 +2276,11 @@ static void test_Input_mouse(void)
|
||||
@@ -2385,13 +2385,11 @@ static void test_Input_mouse(void)
|
||||
|
||||
if (msg.message == WM_LBUTTONDOWN)
|
||||
{
|
||||
@ -106,10 +106,10 @@ index 80256dce569..ef23e99dce8 100644
|
||||
#endif
|
||||
}
|
||||
diff --git a/server/protocol.def b/server/protocol.def
|
||||
index 7eaaec2b823..f2526c4836c 100644
|
||||
index d90666573dd..50000057838 100644
|
||||
--- a/server/protocol.def
|
||||
+++ b/server/protocol.def
|
||||
@@ -2682,6 +2682,13 @@ enum coords_relative
|
||||
@@ -2728,6 +2728,13 @@ enum coords_relative
|
||||
@END
|
||||
|
||||
|
||||
@ -124,7 +124,7 @@ index 7eaaec2b823..f2526c4836c 100644
|
||||
@REQ(get_update_region)
|
||||
user_handle_t window; /* handle to the window */
|
||||
diff --git a/server/window.c b/server/window.c
|
||||
index f35d6f60a42..672512b3a43 100644
|
||||
index 2f2aae483d5..f66f1d6ac6f 100644
|
||||
--- a/server/window.c
|
||||
+++ b/server/window.c
|
||||
@@ -72,6 +72,7 @@ struct window
|
||||
@ -153,87 +153,7 @@ index f35d6f60a42..672512b3a43 100644
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -875,6 +880,18 @@ static struct region *intersect_window_region( struct region *region, struct win
|
||||
}
|
||||
|
||||
|
||||
+/* intersect the layer region with the specified region, relative to the window parent */
|
||||
+static struct region *intersect_layer_region( struct region *region, struct window *win )
|
||||
+{
|
||||
+ /* make region relative to window rect */
|
||||
+ offset_region( region, -win->window_rect.left, -win->window_rect.top );
|
||||
+ if (!intersect_region( region, region, win->layer_region )) return NULL;
|
||||
+ /* make region relative to parent again */
|
||||
+ offset_region( region, win->window_rect.left, win->window_rect.top );
|
||||
+ return region;
|
||||
+}
|
||||
+
|
||||
+
|
||||
/* convert coordinates from client to screen coords */
|
||||
static inline void client_to_screen( struct window *win, int *x, int *y )
|
||||
{
|
||||
@@ -929,6 +946,11 @@ static struct region *clip_children( struct window *parent, struct window *last,
|
||||
free_region( tmp );
|
||||
return NULL;
|
||||
}
|
||||
+ if (ptr->layer_region && !intersect_layer_region( tmp, ptr ))
|
||||
+ {
|
||||
+ free_region( tmp );
|
||||
+ return NULL;
|
||||
+ }
|
||||
offset_region( tmp, offset_x, offset_y );
|
||||
if (!(region = subtract_region( region, region, tmp ))) break;
|
||||
if (is_region_empty( region )) break;
|
||||
@@ -990,11 +1012,13 @@ static struct region *get_visible_region( struct window *win, unsigned int flags
|
||||
{
|
||||
set_region_rect( region, &win->visible_rect );
|
||||
if (win->win_region && !intersect_window_region( region, win )) goto error;
|
||||
+ if (win->layer_region && !intersect_layer_region( region, win )) goto error;
|
||||
}
|
||||
else
|
||||
{
|
||||
set_region_client_rect( region, win );
|
||||
if (win->win_region && !intersect_window_region( region, win )) goto error;
|
||||
+ if (win->layer_region && !intersect_layer_region( region, win )) goto error;
|
||||
}
|
||||
|
||||
/* clip children */
|
||||
@@ -1039,6 +1063,7 @@ static struct region *get_visible_region( struct window *win, unsigned int flags
|
||||
}
|
||||
set_region_client_rect( tmp, win );
|
||||
if (win->win_region && !intersect_window_region( tmp, win )) goto error;
|
||||
+ if (win->layer_region && !intersect_layer_region( tmp, win )) goto error;
|
||||
if (!intersect_region( region, region, tmp )) goto error;
|
||||
if (is_region_empty( region )) break;
|
||||
}
|
||||
@@ -1071,6 +1096,7 @@ static struct region *clip_pixel_format_children( struct window *parent, struct
|
||||
/* add the visible rect */
|
||||
set_region_rect( clip, &ptr->visible_rect );
|
||||
if (ptr->win_region && !intersect_window_region( clip, ptr )) break;
|
||||
+ if (ptr->layer_region && !intersect_layer_region( clip, ptr )) break;
|
||||
offset_region( clip, offset_x, offset_y );
|
||||
if (!intersect_region( clip, clip, parent_clip )) break;
|
||||
if (!union_region( region, region, clip )) break;
|
||||
@@ -1079,6 +1105,7 @@ static struct region *clip_pixel_format_children( struct window *parent, struct
|
||||
/* subtract the client rect if it uses a custom pixel format */
|
||||
set_region_rect( clip, &ptr->client_rect );
|
||||
if (ptr->win_region && !intersect_window_region( clip, ptr )) break;
|
||||
+ if (ptr->layer_region && !intersect_layer_region( clip, ptr )) break;
|
||||
offset_region( clip, offset_x, offset_y );
|
||||
if (!intersect_region( clip, clip, parent_clip )) break;
|
||||
if ((ptr->paint_flags & PAINT_HAS_PIXEL_FORMAT) && !subtract_region( region, region, clip ))
|
||||
@@ -1105,8 +1132,10 @@ static struct region *get_surface_region( struct window *win )
|
||||
if (!(clip = create_empty_region())) goto error;
|
||||
set_region_rect( region, &win->visible_rect );
|
||||
if (win->win_region && !intersect_window_region( region, win )) goto error;
|
||||
+ if (win->layer_region && !intersect_layer_region( region, win )) goto error;
|
||||
set_region_rect( clip, &win->client_rect );
|
||||
if (win->win_region && !intersect_window_region( clip, win )) goto error;
|
||||
+ if (win->layer_region && !intersect_layer_region( clip, win )) goto error;
|
||||
|
||||
if ((win->paint_flags & PAINT_HAS_PIXEL_FORMAT) && !subtract_region( region, region, clip ))
|
||||
goto error;
|
||||
@@ -1825,6 +1854,14 @@ static void set_window_region( struct window *win, struct region *region, int re
|
||||
@@ -1825,6 +1830,14 @@ static void set_window_region( struct window *win, struct region *region, int re
|
||||
}
|
||||
|
||||
|
||||
@ -248,7 +168,7 @@ index f35d6f60a42..672512b3a43 100644
|
||||
/* destroy a window */
|
||||
void destroy_window( struct window *win )
|
||||
{
|
||||
@@ -1873,6 +1910,7 @@ void destroy_window( struct window *win )
|
||||
@@ -1873,6 +1886,7 @@ void destroy_window( struct window *win )
|
||||
|
||||
detach_window_thread( win );
|
||||
if (win->win_region) free_region( win->win_region );
|
||||
@ -256,7 +176,7 @@ index f35d6f60a42..672512b3a43 100644
|
||||
if (win->update_region) free_region( win->update_region );
|
||||
if (win->class) release_class( win->class );
|
||||
free( win->text );
|
||||
@@ -2537,6 +2575,24 @@ DECL_HANDLER(set_window_region)
|
||||
@@ -2538,6 +2552,24 @@ DECL_HANDLER(set_window_region)
|
||||
}
|
||||
|
||||
|
||||
@ -281,19 +201,6 @@ index f35d6f60a42..672512b3a43 100644
|
||||
/* get a window update region */
|
||||
DECL_HANDLER(get_update_region)
|
||||
{
|
||||
@@ -2633,6 +2689,12 @@ DECL_HANDLER(update_window_zorder)
|
||||
offset_rect( &tmp, -ptr->window_rect.left, -ptr->window_rect.top );
|
||||
if (!rect_in_region( ptr->win_region, &tmp )) continue;
|
||||
}
|
||||
+ if (ptr->layer_region)
|
||||
+ {
|
||||
+ tmp = rect;
|
||||
+ offset_rect( &tmp, -ptr->window_rect.left, -ptr->window_rect.top );
|
||||
+ if (!rect_in_region( ptr->layer_region, &tmp )) continue;
|
||||
+ }
|
||||
/* found a window obscuring the rectangle, now move win above this one */
|
||||
/* making sure to not violate the topmost rule */
|
||||
if (!(ptr->ex_style & WS_EX_TOPMOST) || (win->ex_style & WS_EX_TOPMOST))
|
||||
--
|
||||
2.12.2
|
||||
2.14.1
|
||||
|
Loading…
x
Reference in New Issue
Block a user