Skip to content

Commit 2543e21

Browse files
authored
[USER32] Alt+Tab: Don't switch to IME-related window (reactos#8061)
The application switcher (Alt+Tab) shouldn't switch to IME-related (CS_IME) windows. JIRA issue: CORE-19268
1 parent 1395e7e commit 2543e21

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

win32ss/user/user32/controls/appswitch.c

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
/*
2-
* COPYRIGHT: See COPYING in the top level directory
3-
* PROJECT: ReactOS system libraries
4-
* FILE: win32ss/user/user32/controls/appswitch.c
5-
* PURPOSE: app switching functionality
6-
* PROGRAMMERS: Johannes Anderwald ([email protected])
7-
* David Quintana ([email protected])
8-
* Katayama Hirofumi MZ ([email protected])
2+
* PROJECT: ReactOS user32.dll
3+
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4+
* PURPOSE: App switching functionality
5+
* COPYRIGHT: Copyright Johannes Anderwald ([email protected])
6+
* Copyright David Quintana ([email protected])
7+
* Copyright Katayama Hirofumi MZ ([email protected])
98
*/
109

1110
//
@@ -259,7 +258,7 @@ static HWND GetNiceRootOwner(HWND hwnd)
259258
// c.f. https://devblogs.microsoft.com/oldnewthing/20071008-00/?p=24863
260259
BOOL IsAltTabWindow(HWND hwnd)
261260
{
262-
DWORD ExStyle;
261+
LONG_PTR ExStyle, ClassStyle;
263262
RECT rc;
264263
HWND hwndTry, hwndWalk;
265264
WCHAR szClass[64];
@@ -269,7 +268,7 @@ BOOL IsAltTabWindow(HWND hwnd)
269268
return FALSE;
270269

271270
// must not be WS_EX_TOOLWINDOW nor WS_EX_NOACTIVATE
272-
ExStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
271+
ExStyle = GetWindowLongPtrW(hwnd, GWL_EXSTYLE);
273272
if (ExStyle & (WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE))
274273
return FALSE;
275274

@@ -286,6 +285,11 @@ BOOL IsAltTabWindow(HWND hwnd)
286285
return TRUE;
287286
}
288287

288+
// must not be an IME-related window
289+
ClassStyle = GetClassLongPtrW(hwnd, GCL_STYLE);
290+
if (ClassStyle & CS_IME)
291+
return FALSE;
292+
289293
// get 'nice' root owner
290294
hwndWalk = GetNiceRootOwner(hwnd);
291295

0 commit comments

Comments
 (0)