server: Don't update cursor pos in set_window_pos() if window wasn't moved.

Fixes a regression introduced by commit db9a4bc66a.
This commit is contained in:
Paul Gofman 2024-11-13 16:24:07 -06:00 committed by Alexandre Julliard
parent 8e2442584c
commit 698ab75a59
Notes: Alexandre Julliard 2024-11-14 23:13:08 +01:00
Approved-by: Rémi Bernon (@rbernon)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/wine/merge_requests/6812
2 changed files with 18 additions and 2 deletions

View file

@ -6187,6 +6187,13 @@ static const struct message WmMove_mouse[] = {
{ 0 } { 0 }
}; };
static const struct message WmMove_mouse2[] = {
{ WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE },
{ WM_GETTEXT, sent|optional },
{ WM_GETMINMAXINFO, sent|defwinproc },
{ 0 }
};
static void test_setwindowpos(void) static void test_setwindowpos(void)
{ {
HWND hwnd; HWND hwnd;
@ -6253,6 +6260,11 @@ static void test_setwindowpos(void)
ok(res == TRUE, "SetWindowPos expected TRUE, got %Id.\n", res); ok(res == TRUE, "SetWindowPos expected TRUE, got %Id.\n", res);
flush_events(); flush_events();
ok_sequence(WmMove_mouse, "MouseMove", FALSE); ok_sequence(WmMove_mouse, "MouseMove", FALSE);
/* if the window and client rects were not changed WM_MOUSEMOVE is not sent. */
res = SetWindowPos( hwnd, 0, 205, 205, 200, 200, SWP_NOZORDER | SWP_NOACTIVATE );
ok(res == TRUE, "SetWindowPos expected TRUE, got %Id.\n", res);
flush_events();
ok_sequence(WmMove_mouse2, "MouseMove2", FALSE);
ignore_mouse_messages = TRUE; ignore_mouse_messages = TRUE;
DestroyWindow(hwnd); DestroyWindow(hwnd);

View file

@ -2488,7 +2488,7 @@ DECL_HANDLER(get_window_tree)
/* set the position and Z order of a window */ /* set the position and Z order of a window */
DECL_HANDLER(set_window_pos) DECL_HANDLER(set_window_pos)
{ {
rectangle_t window_rect, client_rect, visible_rect, surface_rect, valid_rect; rectangle_t window_rect, client_rect, visible_rect, surface_rect, valid_rect, old_window, old_client;
const rectangle_t *extra_rects = get_req_data(); const rectangle_t *extra_rects = get_req_data();
struct window *previous = NULL; struct window *previous = NULL;
struct window *top, *win = get_window( req->handle ); struct window *top, *win = get_window( req->handle );
@ -2558,9 +2558,13 @@ DECL_HANDLER(set_window_pos)
win->monitor_dpi = req->monitor_dpi; win->monitor_dpi = req->monitor_dpi;
old_style = win->style; old_style = win->style;
old_window = win->window_rect;
old_client = win->client_rect;
set_window_pos( win, previous, flags, &window_rect, &client_rect, set_window_pos( win, previous, flags, &window_rect, &client_rect,
&visible_rect, &surface_rect, &valid_rect ); &visible_rect, &surface_rect, &valid_rect );
if (win->style & old_style & WS_VISIBLE) update_cursor_pos( win->desktop ); if ((win->style & old_style & WS_VISIBLE) && (memcmp( &old_client, &win->client_rect, sizeof(old_client) )
|| memcmp( &old_window, &win->window_rect, sizeof(old_window) )))
update_cursor_pos( win->desktop );
if (win->paint_flags & SET_WINPOS_LAYERED_WINDOW) validate_whole_window( win ); if (win->paint_flags & SET_WINPOS_LAYERED_WINDOW) validate_whole_window( win );