Author: hbelusca
Date: Sat Mar 30 22:54:47 2013
New Revision: 58620
URL:
http://svn.reactos.org/svn/reactos?rev=58620&view=rev
Log:
[CONSRV]
- Compile with Vista+ defines.
- Add basic mouse events support. Tested with Far Manager.
Modified:
branches/ros-csrss/include/psdk/wincon.h
branches/ros-csrss/win32ss/user/consrv/CMakeLists.txt
branches/ros-csrss/win32ss/user/consrv/coninput.c
branches/ros-csrss/win32ss/user/consrv/conio.h
branches/ros-csrss/win32ss/user/consrv/frontends/gui/guiterm.c
Modified: branches/ros-csrss/include/psdk/wincon.h
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/include/psdk/wincon.h…
==============================================================================
--- branches/ros-csrss/include/psdk/wincon.h [iso-8859-1] (original)
+++ branches/ros-csrss/include/psdk/wincon.h [iso-8859-1] Sat Mar 30 22:54:47 2013
@@ -53,28 +53,46 @@
#define ENABLE_PROCESSED_OUTPUT 0x0001
#define ENABLE_WRAP_AT_EOL_OUTPUT 0x0002
-#define KEY_EVENT 1
-#define MOUSE_EVENT 2
-#define WINDOW_BUFFER_SIZE_EVENT 4
-#define MENU_EVENT 8
-#define FOCUS_EVENT 16
-#define CAPSLOCK_ON 128
-#define ENHANCED_KEY 256
-#define RIGHT_ALT_PRESSED 1
-#define LEFT_ALT_PRESSED 2
-#define RIGHT_CTRL_PRESSED 4
-#define LEFT_CTRL_PRESSED 8
-#define SHIFT_PRESSED 16
-#define NUMLOCK_ON 32
-#define SCROLLLOCK_ON 64
-#define FROM_LEFT_1ST_BUTTON_PRESSED 1
-#define RIGHTMOST_BUTTON_PRESSED 2
-#define FROM_LEFT_2ND_BUTTON_PRESSED 4
-#define FROM_LEFT_3RD_BUTTON_PRESSED 8
-#define FROM_LEFT_4TH_BUTTON_PRESSED 16
-#define MOUSE_MOVED 1
-#define DOUBLE_CLICK 2
-#define MOUSE_WHEELED 4
+/*
+ * Event types
+ */
+#define KEY_EVENT 0x0001
+#define MOUSE_EVENT 0x0002
+#define WINDOW_BUFFER_SIZE_EVENT 0x0004
+#define MENU_EVENT 0x0008
+#define FOCUS_EVENT 0x0010
+
+/*
+ * ControlKeyState flags
+ */
+#define RIGHT_ALT_PRESSED 0x0001
+#define LEFT_ALT_PRESSED 0x0002
+#define RIGHT_CTRL_PRESSED 0x0004
+#define LEFT_CTRL_PRESSED 0x0008
+#define SHIFT_PRESSED 0x0010
+#define NUMLOCK_ON 0x0020
+#define SCROLLLOCK_ON 0x0040
+#define CAPSLOCK_ON 0x0080
+#define ENHANCED_KEY 0x0100
+
+/*
+ * ButtonState flags
+ */
+#define FROM_LEFT_1ST_BUTTON_PRESSED 0x0001
+#define RIGHTMOST_BUTTON_PRESSED 0x0002
+#define FROM_LEFT_2ND_BUTTON_PRESSED 0x0004
+#define FROM_LEFT_3RD_BUTTON_PRESSED 0x0008
+#define FROM_LEFT_4TH_BUTTON_PRESSED 0x0010
+
+/*
+ * Mouse event flags
+ */
+#define MOUSE_MOVED 0x0001
+#define DOUBLE_CLICK 0x0002
+#define MOUSE_WHEELED 0x0004
+#if (_WIN32_WINNT >= 0x0600)
+#define MOUSE_HWHEELED 0x0008
+#endif
typedef struct _CONSOLE_READCONSOLE_CONTROL {
ULONG nLength;
Modified: branches/ros-csrss/win32ss/user/consrv/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/C…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/CMakeLists.txt [iso-8859-1] (original)
+++ branches/ros-csrss/win32ss/user/consrv/CMakeLists.txt [iso-8859-1] Sat Mar 30 22:54:47
2013
@@ -1,3 +1,6 @@
+
+remove_definitions(-D_WIN32_WINNT=0x502)
+add_definitions(-D_WIN32_WINNT=0x600)
include_directories(
${REACTOS_SOURCE_DIR}/include/reactos/subsys
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] Sat Mar 30 22:54:47
2013
@@ -48,9 +48,9 @@
}
}
-static NTSTATUS FASTCALL
-ConioProcessChar(PCONSOLE Console,
- PINPUT_RECORD InputEvent)
+NTSTATUS FASTCALL
+ConioProcessInputEvent(PCONSOLE Console,
+ PINPUT_RECORD InputEvent)
{
ConsoleInput *ConInRec;
@@ -273,7 +273,7 @@
}
return;
}
- ConioProcessChar(Console, &er);
+ ConioProcessInputEvent(Console, &er);
}
static NTSTATUS
@@ -792,7 +792,7 @@
&AsciiChar);
}
- Status = ConioProcessChar(Console, InputRecord++);
+ Status = ConioProcessInputEvent(Console, InputRecord++);
}
ConSrvReleaseInputBuffer(InputBuffer, TRUE);
Modified: branches/ros-csrss/win32ss/user/consrv/conio.h
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/c…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/conio.h [iso-8859-1] (original)
+++ branches/ros-csrss/win32ss/user/consrv/conio.h [iso-8859-1] Sat Mar 30 22:54:47 2013
@@ -249,6 +249,8 @@
#define ConSrvReleaseInputBuffer(Buff, IsConsoleLocked) \
ConSrvReleaseObject(&(Buff)->Header, (IsConsoleLocked))
VOID WINAPI ConioProcessKey(PCONSOLE Console, MSG* msg);
+NTSTATUS FASTCALL ConioProcessInputEvent(PCONSOLE Console,
+ PINPUT_RECORD InputEvent);
/* conoutput.c */
#define ConioRectHeight(Rect) \
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] Sat Mar 30
22:54:47 2013
@@ -885,64 +885,148 @@
goto Quit;
}
- switch (msg)
- {
- case WM_LBUTTONDOWN:
- {
- Console->Selection.dwSelectionAnchor = PointToCoord(GuiData, lParam);
- SetCapture(GuiData->hWindow);
- Console->Selection.dwFlags |= CONSOLE_SELECTION_IN_PROGRESS |
CONSOLE_MOUSE_SELECTION | CONSOLE_MOUSE_DOWN;
- GuiConsoleUpdateSelection(Console,
&Console->Selection.dwSelectionAnchor);
- break;
- }
-
- case WM_LBUTTONUP:
- {
- COORD c;
-
- if (!(Console->Selection.dwFlags & CONSOLE_MOUSE_DOWN)) break;
-
- c = PointToCoord(GuiData, lParam);
- Console->Selection.dwFlags &= ~CONSOLE_MOUSE_DOWN;
- GuiConsoleUpdateSelection(Console, &c);
- ReleaseCapture();
-
- break;
- }
-
- case WM_RBUTTONDOWN:
- {
- if (!(Console->Selection.dwFlags & CONSOLE_SELECTION_NOT_EMPTY))
+ if (Console->QuickEdit)
+ {
+ switch (msg)
+ {
+ case WM_LBUTTONDOWN:
{
- GuiConsolePaste(GuiData);
+ Console->Selection.dwSelectionAnchor = PointToCoord(GuiData, lParam);
+ SetCapture(GuiData->hWindow);
+ Console->Selection.dwFlags |= CONSOLE_SELECTION_IN_PROGRESS |
CONSOLE_MOUSE_SELECTION | CONSOLE_MOUSE_DOWN;
+ GuiConsoleUpdateSelection(Console,
&Console->Selection.dwSelectionAnchor);
+ break;
}
- else
+
+ case WM_LBUTTONUP:
{
- GuiConsoleCopy(GuiData);
-
- /* Clear the selection */
- GuiConsoleUpdateSelection(Console, NULL);
+ COORD c;
+
+ if (!(Console->Selection.dwFlags & CONSOLE_MOUSE_DOWN)) break;
+
+ c = PointToCoord(GuiData, lParam);
+ Console->Selection.dwFlags &= ~CONSOLE_MOUSE_DOWN;
+ GuiConsoleUpdateSelection(Console, &c);
+ ReleaseCapture();
+
+ break;
}
- break;
- }
-
- case WM_MOUSEMOVE:
- {
- COORD c;
-
- if (!(wParam & MK_LBUTTON)) break;
- if (!(Console->Selection.dwFlags & CONSOLE_MOUSE_DOWN)) break;
-
- c = PointToCoord(GuiData, lParam); /* TODO: Scroll buffer to bring c into
view */
- GuiConsoleUpdateSelection(Console, &c);
-
- break;
- }
-
- default:
- Ret = FALSE;
- break;
+ case WM_RBUTTONDOWN:
+ {
+ if (!(Console->Selection.dwFlags & CONSOLE_SELECTION_NOT_EMPTY))
+ {
+ GuiConsolePaste(GuiData);
+ }
+ else
+ {
+ GuiConsoleCopy(GuiData);
+
+ /* Clear the selection */
+ GuiConsoleUpdateSelection(Console, NULL);
+ }
+
+ break;
+ }
+
+ case WM_MOUSEMOVE:
+ {
+ COORD c;
+
+ if (!(wParam & MK_LBUTTON)) break;
+ if (!(Console->Selection.dwFlags & CONSOLE_MOUSE_DOWN)) break;
+
+ c = PointToCoord(GuiData, lParam); /* TODO: Scroll buffer to bring c into
view */
+ GuiConsoleUpdateSelection(Console, &c);
+
+ break;
+ }
+
+ default:
+ Ret = FALSE;
+ break;
+ }
+ }
+ else if (Console->InputBuffer.Mode & ENABLE_MOUSE_INPUT)
+ {
+ INPUT_RECORD er;
+ DWORD dwButtonState = 0;
+ DWORD dwEventFlags = 0;
+
+ switch (msg)
+ {
+ case WM_LBUTTONDOWN:
+ dwButtonState = FROM_LEFT_1ST_BUTTON_PRESSED;
+ dwEventFlags = 0;
+ break;
+
+ case WM_LBUTTONUP:
+ 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;
+ break;
+
+ case WM_RBUTTONDBLCLK:
+ dwButtonState = RIGHTMOST_BUTTON_PRESSED;
+ 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;
+ dwEventFlags = MOUSE_WHEELED;
+ break;
+
+ case WM_MOUSEHWHEEL:
+ dwButtonState = 0;
+ dwEventFlags = MOUSE_HWHEELED;
+ break;
+
+ default:
+ Ret = FALSE;
+ 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);
}
LeaveCriticalSection(&Console->Lock);
@@ -1340,7 +1424,6 @@
GuiConsoleHandleTimer(GuiData);
break;
- case WM_MOUSEMOVE:
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
case WM_LBUTTONDBLCLK:
@@ -1350,7 +1433,9 @@
case WM_MBUTTONDOWN:
case WM_MBUTTONUP:
case WM_MBUTTONDBLCLK:
+ case WM_MOUSEMOVE:
case WM_MOUSEWHEEL:
+ case WM_MOUSEHWHEEL:
{
Result = GuiConsoleHandleMouse(GuiData, msg, wParam, lParam);
break;