Skip to content

Commit 2469ce2

Browse files
authored
[NTUSER][KBSWITCH] Realize Alt+Shift keyboard switch (retry) (reactos#4721)
Alt+Shift is a useful key combination to switch the current keyboard layout. CORE-11737 - Add ID_NEXTLAYOUT command to kbswitch. - Send command ID_NEXTLAYOUT to kbswitch on Alt+Shift key combination in WM_SYSKEYDOWN handling of IntDefWindowProc function. - Make IntFindWindow a non-static function.
1 parent 3887087 commit 2469ce2

File tree

5 files changed

+28
-1
lines changed

5 files changed

+28
-1
lines changed

base/applications/kbswitch/kbswitch.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,12 @@ WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
546546
break;
547547
}
548548

549+
case ID_NEXTLAYOUT:
550+
{
551+
ActivateLayout(hwnd, GetNextLayout());
552+
break;
553+
}
554+
549555
default:
550556
{
551557
ActivateLayout(hwnd, LOWORD(wParam));

base/applications/kbswitch/resource.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@
99
/* Menu items */
1010
#define ID_EXIT 10001
1111
#define ID_PREFERENCES 10002
12+
#define ID_NEXTLAYOUT 10003

win32ss/user/ntuser/defwnd.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,24 @@ IntDefWindowProc(
945945
wParamTmp = UserGetKeyState(VK_SHIFT) & 0x8000 ? SC_PREVWINDOW : SC_NEXTWINDOW;
946946
co_IntSendMessage( Active, WM_SYSCOMMAND, wParamTmp, wParam );
947947
}
948+
else if (wParam == VK_SHIFT) // Alt+Shift
949+
{
950+
RTL_ATOM ClassAtom = 0;
951+
UNICODE_STRING ustrClass, ustrWindow;
952+
HWND hwndSwitch;
953+
954+
RtlInitUnicodeString(&ustrClass, L"kbswitcher");
955+
RtlInitUnicodeString(&ustrWindow, L"");
956+
957+
IntGetAtomFromStringOrAtom(&ustrClass, &ClassAtom);
958+
959+
hwndSwitch = IntFindWindow(UserGetDesktopWindow(), NULL, ClassAtom, &ustrWindow);
960+
if (hwndSwitch)
961+
{
962+
#define ID_NEXTLAYOUT 10003
963+
UserPostMessage(hwndSwitch, WM_COMMAND, ID_NEXTLAYOUT, 0);
964+
}
965+
}
948966
}
949967
else if( wParam == VK_F10 )
950968
{

win32ss/user/ntuser/window.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3040,7 +3040,7 @@ NtUserDestroyWindow(HWND Wnd)
30403040
}
30413041

30423042

3043-
static HWND FASTCALL
3043+
HWND FASTCALL
30443044
IntFindWindow(PWND Parent,
30453045
PWND ChildAfter,
30463046
RTL_ATOM ClassAtom,

win32ss/user/ntuser/window.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ extern PWINDOWLIST gpwlCache;
9898

9999
PWINDOWLIST FASTCALL IntBuildHwndList(PWND pwnd, DWORD dwFlags, PTHREADINFO pti);
100100
VOID FASTCALL IntFreeHwndList(PWINDOWLIST pwlTarget);
101+
HWND FASTCALL IntFindWindow(PWND Parent, PWND ChildAfter, RTL_ATOM ClassAtom,
102+
PUNICODE_STRING WindowName);
101103

102104
/* Undocumented dwFlags for IntBuildHwndList */
103105
#define IACE_LIST 0x0002

0 commit comments

Comments
 (0)