https://git.reactos.org/?p=reactos.git;a=commitdiff;h=00dd17e6e5854fc32b07e…
commit 00dd17e6e5854fc32b07e4ac9de5c4e553178e4a
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Sun Dec 16 08:42:20 2018 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Sun Dec 16 08:42:20 2018 +0900
[USER32] App Switcher Arrow keys (#1136)
Implement Arrow keys on App Switcher (Alt+Tab). CORE-15449
---
win32ss/user/user32/controls/appswitch.c | 67 +++++++++++++++++++++++++++++---
1 file changed, 62 insertions(+), 5 deletions(-)
diff --git a/win32ss/user/user32/controls/appswitch.c
b/win32ss/user/user32/controls/appswitch.c
index b3314602e0..fb9f396d8c 100644
--- a/win32ss/user/user32/controls/appswitch.c
+++ b/win32ss/user/user32/controls/appswitch.c
@@ -480,6 +480,50 @@ void RotateTasks(BOOL bShift)
}
}
+static void MoveLeft(void)
+{
+ selectedWindow = selectedWindow - 1;
+ if (selectedWindow < 0)
+ selectedWindow = windowCount - 1;
+ InvalidateRect(switchdialog, NULL, TRUE);
+}
+
+static void MoveRight(void)
+{
+ selectedWindow = (selectedWindow + 1) % windowCount;
+ InvalidateRect(switchdialog, NULL, TRUE);
+}
+
+static void MoveUp(void)
+{
+ INT iRow = selectedWindow / nCols;
+ INT iCol = selectedWindow % nCols;
+
+ --iRow;
+ if (iRow < 0)
+ iRow = nRows - 1;
+
+ selectedWindow = iRow * nCols + iCol;
+ if (selectedWindow >= windowCount)
+ selectedWindow = windowCount - 1;
+ InvalidateRect(switchdialog, NULL, TRUE);
+}
+
+static void MoveDown(void)
+{
+ INT iRow = selectedWindow / nCols;
+ INT iCol = selectedWindow % nCols;
+
+ ++iRow;
+ if (iRow >= nRows)
+ iRow = 0;
+
+ selectedWindow = iRow * nCols + iCol;
+ if (selectedWindow >= windowCount)
+ selectedWindow = windowCount - 1;
+ InvalidateRect(switchdialog, NULL, TRUE);
+}
+
VOID
DestroyAppWindows(VOID)
{
@@ -595,21 +639,34 @@ LRESULT WINAPI DoAppSwitch( WPARAM wParam, LPARAM lParam )
if (Esc) break;
if (GetKeyState(VK_SHIFT) < 0)
{
- selectedWindow = selectedWindow - 1;
- if (selectedWindow < 0)
- selectedWindow = windowCount - 1;
+ MoveLeft();
}
else
{
- selectedWindow = (selectedWindow + 1)%windowCount;
+ MoveRight();
}
- InvalidateRect(switchdialog, NULL, TRUE);
}
else if ( msg.wParam == VK_ESCAPE )
{
if (!Esc) break;
RotateTasks(GetKeyState(VK_SHIFT) < 0);
}
+ else if ( msg.wParam == VK_LEFT )
+ {
+ MoveLeft();
+ }
+ else if ( msg.wParam == VK_RIGHT )
+ {
+ MoveRight();
+ }
+ else if ( msg.wParam == VK_UP )
+ {
+ MoveUp();
+ }
+ else if ( msg.wParam == VK_DOWN )
+ {
+ MoveDown();
+ }
}
break;
}