Author: weiden Date: Fri Oct 19 03:39:16 2007 New Revision: 29666
URL: http://svn.reactos.org/svn/reactos?rev=29666&view=rev Log: Allow selecting monitors using the keyboard
Modified: trunk/reactos/dll/cpl/desk/monslctl.c trunk/reactos/dll/cpl/desk/monslctl.h
Modified: trunk/reactos/dll/cpl/desk/monslctl.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/monslctl.c?rev... ============================================================================== --- trunk/reactos/dll/cpl/desk/monslctl.c (original) +++ trunk/reactos/dll/cpl/desk/monslctl.c Fri Oct 19 03:39:16 2007 @@ -626,7 +626,7 @@ infoPtr->SelectedMonitor = -1; infoPtr->DraggingMonitor = -1; infoPtr->ControlExStyle = MSLM_EX_ALLOWSELECTDISABLED | MSLM_EX_HIDENUMBERONSINGLE | - MSLM_EX_SELECTONRIGHTCLICK; + MSLM_EX_SELECTONRIGHTCLICK | MSLM_EX_SELECTBYARROWKEY; return; }
@@ -1251,6 +1251,9 @@ INT Index; POINT pt;
+ if (!infoPtr->HasFocus) + SetFocus(infoPtr->hSelf); + pt.x = (LONG)LOWORD(lParam); pt.y = (LONG)HIWORD(lParam);
@@ -1317,6 +1320,9 @@ }
Ret |= DLGC_WANTARROWS; + + if (infoPtr->ControlExStyle & MSLM_EX_SELECTBYNUMKEY) + Ret |= DLGC_WANTCHARS; break; }
@@ -1400,6 +1406,78 @@
if (OldEnabled != infoPtr->Enabled) MonSelRepaint(infoPtr); + } + break; + } + + case WM_KEYDOWN: + { + INT Index; + + if (infoPtr->ControlExStyle & MSLM_EX_SELECTBYARROWKEY) + { + switch (wParam) + { + case VK_UP: + case VK_LEFT: + { + Index = infoPtr->SelectedMonitor; + + if (infoPtr->MonitorsCount != 0) + { + if (Index < 0) + Index = 0; + else if (Index > 0) + Index--; + } + + if (Index >= 0) + { + MonSelSetCurSelMonitor(infoPtr, + Index, + TRUE); + } + break; + } + + case VK_DOWN: + case VK_RIGHT: + { + Index = infoPtr->SelectedMonitor; + + if (infoPtr->MonitorsCount != 0) + { + if (Index < 0) + Index = (INT)infoPtr->MonitorsCount - 1; + else if (Index < (INT)infoPtr->MonitorsCount - 1) + Index++; + } + + if (infoPtr->SelectedMonitor < infoPtr->MonitorsCount) + { + MonSelSetCurSelMonitor(infoPtr, + Index, + TRUE); + } + break; + } + } + } + break; + } + + case WM_CHAR: + { + if ((infoPtr->ControlExStyle & MSLM_EX_SELECTBYNUMKEY) && + wParam >= '1' && wParam <= '9') + { + INT Index = (INT)(wParam - '1'); + if (Index < (INT)infoPtr->MonitorsCount) + { + MonSelSetCurSelMonitor(infoPtr, + Index, + TRUE); + } } break; }
Modified: trunk/reactos/dll/cpl/desk/monslctl.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/monslctl.h?rev... ============================================================================== --- trunk/reactos/dll/cpl/desk/monslctl.h (original) +++ trunk/reactos/dll/cpl/desk/monslctl.h Fri Oct 19 03:39:16 2007 @@ -7,6 +7,8 @@ #define MSLM_EX_HIDENUMBERONSINGLE 0x4 #define MSLM_EX_HIDENUMBERS 0x8 #define MSLM_EX_SELECTONRIGHTCLICK 0x10 +#define MSLM_EX_SELECTBYNUMKEY 0x20 +#define MSLM_EX_SELECTBYARROWKEY 0x40
/* MONSL_MONINFO Flags */ #define MSL_MIF_DISABLED 0x1 @@ -177,6 +179,11 @@ * * MSLM_EX_SELECTONRIGHTCLICK * Selects a monitor when the user right clicks * on it. + * * MSLM_EX_SELECTBYNUMKEY + * Allows selecting a monitor by using the keys + * '1' to '9'. + * * MSLM_EX_SELECTBYARROWKEY + * Allows selecting a monitor using the arrow keys. * * Returns non-zero value if successful. */