mirror of
https://github.com/reactos/reactos.git
synced 2025-04-22 13:10:39 +00:00
Allow selecting monitors using the keyboard
svn path=/trunk/; revision=29666
This commit is contained in:
parent
36f1aa644b
commit
509bef7801
2 changed files with 86 additions and 1 deletions
|
@ -626,7 +626,7 @@ MonSelCreate(IN OUT PMONITORSELWND infoPtr)
|
||||||
infoPtr->SelectedMonitor = -1;
|
infoPtr->SelectedMonitor = -1;
|
||||||
infoPtr->DraggingMonitor = -1;
|
infoPtr->DraggingMonitor = -1;
|
||||||
infoPtr->ControlExStyle = MSLM_EX_ALLOWSELECTDISABLED | MSLM_EX_HIDENUMBERONSINGLE |
|
infoPtr->ControlExStyle = MSLM_EX_ALLOWSELECTDISABLED | MSLM_EX_HIDENUMBERONSINGLE |
|
||||||
MSLM_EX_SELECTONRIGHTCLICK;
|
MSLM_EX_SELECTONRIGHTCLICK | MSLM_EX_SELECTBYARROWKEY;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1251,6 +1251,9 @@ MonitorSelWndProc(IN HWND hwnd,
|
||||||
INT Index;
|
INT Index;
|
||||||
POINT pt;
|
POINT pt;
|
||||||
|
|
||||||
|
if (!infoPtr->HasFocus)
|
||||||
|
SetFocus(infoPtr->hSelf);
|
||||||
|
|
||||||
pt.x = (LONG)LOWORD(lParam);
|
pt.x = (LONG)LOWORD(lParam);
|
||||||
pt.y = (LONG)HIWORD(lParam);
|
pt.y = (LONG)HIWORD(lParam);
|
||||||
|
|
||||||
|
@ -1317,6 +1320,9 @@ MonitorSelWndProc(IN HWND hwnd,
|
||||||
}
|
}
|
||||||
|
|
||||||
Ret |= DLGC_WANTARROWS;
|
Ret |= DLGC_WANTARROWS;
|
||||||
|
|
||||||
|
if (infoPtr->ControlExStyle & MSLM_EX_SELECTBYNUMKEY)
|
||||||
|
Ret |= DLGC_WANTCHARS;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1404,6 +1410,78 @@ MonitorSelWndProc(IN HWND hwnd,
|
||||||
break;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
case MSLM_SETMONITORSINFO:
|
case MSLM_SETMONITORSINFO:
|
||||||
{
|
{
|
||||||
Ret = MonSelSetMonitorsInfo(infoPtr,
|
Ret = MonSelSetMonitorsInfo(infoPtr,
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
#define MSLM_EX_HIDENUMBERONSINGLE 0x4
|
#define MSLM_EX_HIDENUMBERONSINGLE 0x4
|
||||||
#define MSLM_EX_HIDENUMBERS 0x8
|
#define MSLM_EX_HIDENUMBERS 0x8
|
||||||
#define MSLM_EX_SELECTONRIGHTCLICK 0x10
|
#define MSLM_EX_SELECTONRIGHTCLICK 0x10
|
||||||
|
#define MSLM_EX_SELECTBYNUMKEY 0x20
|
||||||
|
#define MSLM_EX_SELECTBYARROWKEY 0x40
|
||||||
|
|
||||||
/* MONSL_MONINFO Flags */
|
/* MONSL_MONINFO Flags */
|
||||||
#define MSL_MIF_DISABLED 0x1
|
#define MSL_MIF_DISABLED 0x1
|
||||||
|
@ -177,6 +179,11 @@ typedef struct _MONSL_MONNMMONITORCHANGING
|
||||||
* * MSLM_EX_SELECTONRIGHTCLICK
|
* * MSLM_EX_SELECTONRIGHTCLICK
|
||||||
* Selects a monitor when the user right clicks
|
* Selects a monitor when the user right clicks
|
||||||
* on it.
|
* 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.
|
* Returns non-zero value if successful.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue