Author: hbelusca
Date: Sun Mar 31 00:34:13 2013
New Revision: 58623
URL:
http://svn.reactos.org/svn/reactos?rev=58623&view=rev
Log:
[PSDK]
Introduce GET_KEYSTATE_WPARAM, GET_NCHITTEST_WPARAM, GET_XBUTTON_WPARAM macros.
[CONSRV]
Fix double-click, mouse scrolling and add support for control keys.
Modified:
branches/ros-csrss/include/psdk/winuser.h
branches/ros-csrss/win32ss/user/consrv/coninput.c
branches/ros-csrss/win32ss/user/consrv/frontends/gui/guiterm.c
Modified: branches/ros-csrss/include/psdk/winuser.h
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/include/psdk/winuser.…
==============================================================================
--- branches/ros-csrss/include/psdk/winuser.h [iso-8859-1] (original)
+++ branches/ros-csrss/include/psdk/winuser.h [iso-8859-1] Sun Mar 31 00:34:13 2013
@@ -1833,17 +1833,24 @@
#define WM_APP 32768
#define WM_GETTITLEBARINFOEX 0x033F
-#define XBUTTON1 0x0001
-#define XBUTTON2 0x0002
-
#if (_WIN32_WINNT >= 0x0400)
#define WHEEL_DELTA 120
-#define GET_WHEEL_DELTA_WPARAM(wparam) ((short)HIWORD (wparam))
+#define GET_WHEEL_DELTA_WPARAM(wParam) ((short)HIWORD(wParam))
#define WHEEL_PAGESCROLL UINT_MAX
#endif
+
+#if (_WIN32_WINNT >= 0x0500)
+#define GET_KEYSTATE_WPARAM(wParam) (LOWORD(wParam))
+#define GET_NCHITTEST_WPARAM(wParam) ((short)LOWORD(wParam))
+#define GET_XBUTTON_WPARAM(wParam) (HIWORD(wParam))
+#define XBUTTON1 0x0001
+#define XBUTTON2 0x0002
+#endif
+
#if (_WIN32_WINNT >= 0x0501)
#define WM_THEMECHANGED 794
#endif
+
#define BM_CLICK 245
#define BM_GETCHECK 240
#define BM_GETIMAGE 246
Modified: branches/ros-csrss/win32ss/user/consrv/coninput.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/c…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/coninput.c [iso-8859-1] (original)
+++ branches/ros-csrss/win32ss/user/consrv/coninput.c [iso-8859-1] Sun Mar 31 00:34:13
2013
@@ -102,17 +102,17 @@
}
static DWORD FASTCALL
-ConioGetShiftState(PBYTE KeyState)
+ConioGetShiftState(PBYTE KeyState, LPARAM lParam)
{
DWORD ssOut = 0;
- if (KeyState[VK_CAPITAL] & 1)
+ if (KeyState[VK_CAPITAL] & 0x01)
ssOut |= CAPSLOCK_ON;
- if (KeyState[VK_NUMLOCK] & 1)
+ if (KeyState[VK_NUMLOCK] & 0x01)
ssOut |= NUMLOCK_ON;
- if (KeyState[VK_SCROLL] & 1)
+ if (KeyState[VK_SCROLL] & 0x01)
ssOut |= SCROLLLOCK_ON;
if (KeyState[VK_SHIFT] & 0x80)
@@ -127,6 +127,10 @@
ssOut |= LEFT_ALT_PRESSED;
if (KeyState[VK_RMENU] & 0x80)
ssOut |= RIGHT_ALT_PRESSED;
+
+ /* See WM_CHAR MSDN documentation for instance */
+ if (lParam & 0x01000000)
+ ssOut |= ENHANCED_KEY;
return ssOut;
}
@@ -161,7 +165,7 @@
msg->message == WM_SYSKEYDOWN || msg->message == WM_SYSCHAR;
GetKeyboardState(KeyState);
- ShiftState = ConioGetShiftState(KeyState);
+ ShiftState = ConioGetShiftState(KeyState, msg->lParam);
if (msg->message == WM_CHAR || msg->message == WM_SYSCHAR)
{
Modified: branches/ros-csrss/win32ss/user/consrv/frontends/gui/guiterm.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/f…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/frontends/gui/guiterm.c [iso-8859-1]
(original)
+++ branches/ros-csrss/win32ss/user/consrv/frontends/gui/guiterm.c [iso-8859-1] Sun Mar 31
00:34:13 2013
@@ -950,8 +950,10 @@
else if (Console->InputBuffer.Mode & ENABLE_MOUSE_INPUT)
{
INPUT_RECORD er;
- DWORD dwButtonState = 0;
- DWORD dwEventFlags = 0;
+ WORD wKeyState = GET_KEYSTATE_WPARAM(wParam);
+ DWORD dwButtonState = 0;
+ DWORD dwControlKeyState = 0;
+ DWORD dwEventFlags = 0;
switch (msg)
{
@@ -960,24 +962,39 @@
dwEventFlags = 0;
break;
+ case WM_MBUTTONDOWN:
+ dwButtonState = FROM_LEFT_2ND_BUTTON_PRESSED;
+ dwEventFlags = 0;
+ break;
+
+ case WM_RBUTTONDOWN:
+ dwButtonState = RIGHTMOST_BUTTON_PRESSED;
+ dwEventFlags = 0;
+ break;
+
case WM_LBUTTONUP:
dwButtonState = 0;
dwEventFlags = 0;
break;
+ case WM_MBUTTONUP:
+ dwButtonState = 0;
+ dwEventFlags = 0;
+ break;
+
+ case WM_RBUTTONUP:
+ dwButtonState = 0;
+ dwEventFlags = 0;
+ break;
+
case WM_LBUTTONDBLCLK:
dwButtonState = FROM_LEFT_1ST_BUTTON_PRESSED;
dwEventFlags = DOUBLE_CLICK;
break;
- case WM_RBUTTONDOWN:
- dwButtonState = RIGHTMOST_BUTTON_PRESSED;
- dwEventFlags = 0;
- break;
-
- case WM_RBUTTONUP:
- dwButtonState = 0;
- dwEventFlags = 0;
+ case WM_MBUTTONDBLCLK:
+ dwButtonState = FROM_LEFT_2ND_BUTTON_PRESSED;
+ dwEventFlags = DOUBLE_CLICK;
break;
case WM_RBUTTONDBLCLK:
@@ -985,33 +1002,18 @@
dwEventFlags = DOUBLE_CLICK;
break;
- case WM_MBUTTONDOWN:
- dwButtonState = FROM_LEFT_2ND_BUTTON_PRESSED;
- dwEventFlags = 0;
- break;
-
- case WM_MBUTTONUP:
- dwButtonState = 0;
- dwEventFlags = 0;
- break;
-
- case WM_MBUTTONDBLCLK:
- dwButtonState = FROM_LEFT_2ND_BUTTON_PRESSED;
- dwEventFlags = DOUBLE_CLICK;
- break;
-
case WM_MOUSEMOVE:
dwButtonState = 0;
dwEventFlags = MOUSE_MOVED;
break;
case WM_MOUSEWHEEL:
- dwButtonState = 0;
+ dwButtonState = GET_WHEEL_DELTA_WPARAM(wParam) << 16;
dwEventFlags = MOUSE_WHEELED;
break;
case WM_MOUSEHWHEEL:
- dwButtonState = 0;
+ dwButtonState = GET_WHEEL_DELTA_WPARAM(wParam) << 16;
dwEventFlags = MOUSE_HWHEELED;
break;
@@ -1020,13 +1022,43 @@
break;
}
- er.EventType = MOUSE_EVENT;
- er.Event.MouseEvent.dwMousePosition = PointToCoord(GuiData, lParam);
- er.Event.MouseEvent.dwButtonState = dwButtonState;
- er.Event.MouseEvent.dwControlKeyState = 0;
- er.Event.MouseEvent.dwEventFlags = dwEventFlags;
-
- ConioProcessInputEvent(Console, &er);
+ if (Ret)
+ {
+ if (wKeyState & MK_LBUTTON)
+ dwButtonState |= FROM_LEFT_1ST_BUTTON_PRESSED;
+ if (wKeyState & MK_MBUTTON)
+ dwButtonState |= FROM_LEFT_2ND_BUTTON_PRESSED;
+ if (wKeyState & MK_RBUTTON)
+ dwButtonState |= RIGHTMOST_BUTTON_PRESSED;
+
+ if (GetKeyState(VK_RMENU) & 0x8000)
+ dwControlKeyState |= RIGHT_ALT_PRESSED;
+ if (GetKeyState(VK_LMENU) & 0x8000)
+ dwControlKeyState |= LEFT_ALT_PRESSED;
+ if (GetKeyState(VK_RCONTROL) & 0x8000)
+ dwControlKeyState |= RIGHT_CTRL_PRESSED;
+ if (GetKeyState(VK_LCONTROL) & 0x8000)
+ dwControlKeyState |= LEFT_CTRL_PRESSED;
+ if (GetKeyState(VK_SHIFT) & 0x8000)
+ dwControlKeyState |= SHIFT_PRESSED;
+ if (GetKeyState(VK_NUMLOCK) & 0x0001)
+ dwControlKeyState |= NUMLOCK_ON;
+ if (GetKeyState(VK_SCROLL) & 0x0001)
+ dwControlKeyState |= SCROLLLOCK_ON;
+ if (GetKeyState(VK_CAPITAL) & 0x0001)
+ dwControlKeyState |= CAPSLOCK_ON;
+ /* See WM_CHAR MSDN documentation for instance */
+ if (lParam & 0x01000000)
+ dwControlKeyState |= ENHANCED_KEY;
+
+ er.EventType = MOUSE_EVENT;
+ er.Event.MouseEvent.dwMousePosition = PointToCoord(GuiData, lParam);
+ er.Event.MouseEvent.dwButtonState = dwButtonState;
+ er.Event.MouseEvent.dwControlKeyState = dwControlKeyState;
+ er.Event.MouseEvent.dwEventFlags = dwEventFlags;
+
+ ConioProcessInputEvent(Console, &er);
+ }
}
LeaveCriticalSection(&Console->Lock);
@@ -1425,14 +1457,14 @@
break;
case WM_LBUTTONDOWN:
+ case WM_MBUTTONDOWN:
+ case WM_RBUTTONDOWN:
case WM_LBUTTONUP:
+ case WM_MBUTTONUP:
+ case WM_RBUTTONUP:
case WM_LBUTTONDBLCLK:
- case WM_RBUTTONDOWN:
- case WM_RBUTTONUP:
+ case WM_MBUTTONDBLCLK:
case WM_RBUTTONDBLCLK:
- case WM_MBUTTONDOWN:
- case WM_MBUTTONUP:
- case WM_MBUTTONDBLCLK:
case WM_MOUSEMOVE:
case WM_MOUSEWHEEL:
case WM_MOUSEHWHEEL:
@@ -1693,7 +1725,7 @@
wc.cbSize = sizeof(WNDCLASSEXW);
wc.lpszClassName = GUI_CONSOLE_WINDOW_CLASS;
wc.lpfnWndProc = GuiConsoleWndProc;
- wc.style = 0;
+ wc.style = CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
wc.hInstance = ConSrvDllInstance;
wc.hIcon = ghDefaultIcon;
wc.hIconSm = ghDefaultIconSm;