Rebase against 083dea7fce4372840ac18176496a7d05dadd5ad8.

This commit is contained in:
Alistair Leslie-Hughes
2022-03-18 11:29:35 +11:00
parent cd68f05ab3
commit 62db3313d5
10 changed files with 72 additions and 94 deletions

View File

@@ -1,4 +1,4 @@
From f0e7e4d7995867911e47dc54c9087cd7a57b5c90 Mon Sep 17 00:00:00 2001
From 313d448f0e96df2c0b7b68bce8a6c7a2afed4c2e 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
@@ -17,12 +17,12 @@ Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
---
dlls/user32/focus.c | 1 -
dlls/user32/tests/msg.c | 2 +-
dlls/win32u/input.c | 52 +++++++++++++++++++++++++++---------
dlls/win32u/input.c | 40 ++++++++++++++++++++++++------------
dlls/win32u/ntuser_private.h | 1 +
4 files changed, 41 insertions(+), 15 deletions(-)
4 files changed, 29 insertions(+), 15 deletions(-)
diff --git a/dlls/user32/focus.c b/dlls/user32/focus.c
index 4998ac2feb6..f68c6080698 100644
index ff41cf716a1..a044133ab40 100644
--- a/dlls/user32/focus.c
+++ b/dlls/user32/focus.c
@@ -31,7 +31,6 @@
@@ -34,10 +34,10 @@ index 4998ac2feb6..f68c6080698 100644
* FOCUS_MouseActivate
*
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 9164f57fdc2..01cb214acdf 100644
index f28b1151c4d..4dad60d3ad6 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -5571,7 +5571,7 @@ static void test_messages(void)
@@ -5572,7 +5572,7 @@ static void test_messages(void)
ShowWindow(hwnd, SW_MINIMIZE);
flush_events();
@@ -47,29 +47,10 @@ index 9164f57fdc2..01cb214acdf 100644
if (GetWindowLongW( hwnd, GWL_STYLE ) & WS_MINIMIZE)
diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c
index fff732097ba..cbc6cfd6b0d 100644
index 08eded198a3..9ed6dc01a1e 100644
--- a/dlls/win32u/input.c
+++ b/dlls/win32u/input.c
@@ -1180,6 +1180,18 @@ static HWND set_focus_window( HWND hwnd )
return previous;
}
+static UINT win_set_flags( HWND hwnd, UINT set_mask, UINT clear_mask )
+{
+ UINT ret;
+ WND *ptr = get_win_ptr( hwnd );
+
+ if (!ptr || ptr == WND_OTHER_PROCESS || ptr == WND_DESKTOP) return 0;
+ ret = ptr->flags;
+ ptr->flags = (ret & ~clear_mask) | set_mask;
+ release_win_ptr( ptr );
+ return ret;
+}
+
/*******************************************************************
* set_active_window
*/
@@ -1187,7 +1199,7 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus )
@@ -1187,7 +1187,7 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus )
{
HWND previous = get_active_window();
BOOL ret;
@@ -78,7 +59,7 @@ index fff732097ba..cbc6cfd6b0d 100644
CBTACTIVATESTRUCT cbt;
if (previous == hwnd)
@@ -1196,16 +1208,24 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus )
@@ -1196,16 +1196,24 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus )
return TRUE;
}
@@ -112,7 +93,7 @@ index fff732097ba..cbc6cfd6b0d 100644
}
SERVER_START_REQ( set_active_window )
@@ -1225,7 +1245,11 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus )
@@ -1225,7 +1233,11 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus )
if (send_message( hwnd, WM_QUERYNEWPALETTE, 0, 0 ) && user_callbacks)
user_callbacks->pSendMessageTimeoutW( HWND_BROADCAST, WM_PALETTEISCHANGING, (WPARAM)hwnd, 0,
SMTO_ABORTIFHUNG, 2000, NULL );
@@ -125,7 +106,7 @@ index fff732097ba..cbc6cfd6b0d 100644
}
old_thread = previous ? get_window_thread( previous, NULL ) : 0;
@@ -1257,7 +1281,7 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus )
@@ -1257,7 +1269,7 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus )
}
}
@@ -134,7 +115,7 @@ index fff732097ba..cbc6cfd6b0d 100644
{
send_message( hwnd, WM_NCACTIVATE, hwnd == NtUserGetForegroundWindow(), (LPARAM)previous );
send_message( hwnd, WM_ACTIVATE,
@@ -1282,7 +1306,9 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus )
@@ -1282,7 +1294,9 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus )
}
}
@@ -146,10 +127,10 @@ index fff732097ba..cbc6cfd6b0d 100644
/**********************************************************************
diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h
index 6c10a3e77e1..b46f0426368 100644
index 49fd22ca140..3b77f37e9f2 100644
--- a/dlls/win32u/ntuser_private.h
+++ b/dlls/win32u/ntuser_private.h
@@ -109,6 +109,7 @@ typedef struct tagWND
@@ -119,6 +119,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 */