Rebase against c7431990d815e664cf22267142b76cc59f21d192.

This commit is contained in:
Alistair Leslie-Hughes
2023-06-13 09:20:03 +10:00
parent 8273be2218
commit 117d2b2107
11 changed files with 92 additions and 216 deletions

View File

@@ -1,4 +1,4 @@
From 364612d585a26bb8b4b9f8428103585e05f7ee78 Mon Sep 17 00:00:00 2001
From 8c830f61a85e634b1fc135f6fe90a1dd5e45d158 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= <gabrielopcode@gmail.com>
Date: Mon, 22 Jul 2019 15:29:25 +0300
Subject: [PATCH] user32/focus: Prevent a recursive loop with the activation
@@ -15,15 +15,15 @@ actually depend on this behavior, so it is needed.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46274
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
---
dlls/win32u/input.c | 41 ++++++++++++++++++++++++------------
dlls/win32u/input.c | 42 +++++++++++++++++++++++++-----------
dlls/win32u/ntuser_private.h | 1 +
2 files changed, 29 insertions(+), 13 deletions(-)
2 files changed, 30 insertions(+), 13 deletions(-)
diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c
index f3b724e7010..9f89f21059f 100644
index cbdd4b195d3..241d07cefd2 100644
--- a/dlls/win32u/input.c
+++ b/dlls/win32u/input.c
@@ -1599,7 +1599,7 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus )
@@ -1810,7 +1810,7 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus )
{
HWND previous = get_active_window();
BOOL ret;
@@ -32,8 +32,8 @@ index f3b724e7010..9f89f21059f 100644
CBTACTIVATESTRUCT cbt;
if (previous == hwnd)
@@ -1608,16 +1608,24 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus )
return TRUE;
@@ -1819,16 +1819,24 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus )
goto done;
}
- /* call CBT hook chain */
@@ -66,7 +66,7 @@ index f3b724e7010..9f89f21059f 100644
}
SERVER_START_REQ( set_active_window )
@@ -1637,7 +1645,11 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus )
@@ -1848,7 +1856,11 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus )
if (send_message( hwnd, WM_QUERYNEWPALETTE, 0, 0 ))
send_message_timeout( HWND_BROADCAST, WM_PALETTEISCHANGING, (WPARAM)hwnd, 0,
SMTO_ABORTIFHUNG, 2000, FALSE );
@@ -79,7 +79,7 @@ index f3b724e7010..9f89f21059f 100644
}
old_thread = previous ? get_window_thread( previous, NULL ) : 0;
@@ -1669,7 +1681,7 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus )
@@ -1880,7 +1892,7 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus )
}
}
@@ -88,28 +88,26 @@ index f3b724e7010..9f89f21059f 100644
{
send_message( hwnd, WM_NCACTIVATE, hwnd == NtUserGetForegroundWindow(), (LPARAM)previous );
send_message( hwnd, WM_ACTIVATE,
@@ -1689,12 +1701,15 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus )
/* Do not change focus if the window is no more active */
if (hwnd == info.hwndActive)
{
+ /* this line exists to keep this patch from applying in the wrong place */
if (!info.hwndFocus || !hwnd || NtUserGetAncestor( info.hwndFocus, GA_ROOT ) != hwnd)
set_focus_window( hwnd );
@@ -1914,9 +1926,13 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus )
}
}
- return TRUE;
+clear_flags:
+ win_set_flags(hwnd, 0, WIN_IS_IN_ACTIVATION);
+
done:
if (hwnd) clip_fullscreen_window( hwnd, FALSE );
- return TRUE;
+
+ return ret;
}
/**********************************************************************
diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h
index 8287126258e..38ac4498a83 100644
index b39e38db5d6..4be55209265 100644
--- a/dlls/win32u/ntuser_private.h
+++ b/dlls/win32u/ntuser_private.h
@@ -104,6 +104,7 @@ typedef struct tagWND
@@ -100,6 +100,7 @@ typedef struct tagWND
#define WIN_NEEDS_SHOW_OWNEDPOPUP 0x0020 /* WM_SHOWWINDOW:SC_SHOW must be sent in the next ShowOwnedPopup call */
#define WIN_CHILDREN_MOVED 0x0040 /* children may have moved, ignore stored positions */
#define WIN_HAS_IME_WIN 0x0080 /* the window has been registered with imm32 */
@@ -118,5 +116,5 @@ index 8287126258e..38ac4498a83 100644
#define WND_OTHER_PROCESS ((WND *)1) /* returned by get_win_ptr on unknown window handles */
#define WND_DESKTOP ((WND *)2) /* returned by get_win_ptr on the desktop window */
--
2.37.2
2.40.1