Author: hbelusca
Date: Mon Aug 4 20:23:33 2014
New Revision: 63806
URL:
http://svn.reactos.org/svn/reactos?rev=63806&view=rev
Log:
[CONSRV]
- Few code reshuffling before more restructuration.
- Some type fixes.
Modified:
branches/condrv_restructure/win32ss/user/winsrv/consrv/condrv/coninput.c
branches/condrv_restructure/win32ss/user/winsrv/consrv/condrv/console.c
branches/condrv_restructure/win32ss/user/winsrv/consrv/condrv/text.c
branches/condrv_restructure/win32ss/user/winsrv/consrv/coninput.c
branches/condrv_restructure/win32ss/user/winsrv/consrv/frontends/input.c
branches/condrv_restructure/win32ss/user/winsrv/consrv/include/conio.h
branches/condrv_restructure/win32ss/user/winsrv/consrv/include/conio_winsrv.h
Modified: branches/condrv_restructure/win32ss/user/winsrv/consrv/condrv/coninput.c
URL:
http://svn.reactos.org/svn/reactos/branches/condrv_restructure/win32ss/user…
==============================================================================
--- branches/condrv_restructure/win32ss/user/winsrv/consrv/condrv/coninput.c [iso-8859-1]
(original)
+++ branches/condrv_restructure/win32ss/user/winsrv/consrv/condrv/coninput.c [iso-8859-1]
Mon Aug 4 20:23:33 2014
@@ -66,103 +66,18 @@
}
-/*
- * This pre-processing code MUST be IN consrv ONLY
- */
-static ULONG
-PreprocessInput(PCONSOLE Console,
- PINPUT_RECORD InputEvent,
- ULONG NumEventsToWrite)
-{
- ULONG NumEvents;
-
- /*
- * Loop each event, and for each, check for pause or unpause
- * and perform adequate behaviour.
- */
- for (NumEvents = NumEventsToWrite; NumEvents > 0; --NumEvents)
- {
- /* Check for pause or unpause */
- if (InputEvent->EventType == KEY_EVENT &&
InputEvent->Event.KeyEvent.bKeyDown)
- {
- WORD vk = InputEvent->Event.KeyEvent.wVirtualKeyCode;
- if (!(Console->PauseFlags & PAUSED_FROM_KEYBOARD))
- {
- DWORD cks = InputEvent->Event.KeyEvent.dwControlKeyState;
- if (Console->InputBuffer.Mode & ENABLE_LINE_INPUT &&
- (vk == VK_PAUSE ||
- (vk == 'S' && (cks & (LEFT_CTRL_PRESSED |
RIGHT_CTRL_PRESSED)) &&
- !(cks & (LEFT_ALT_PRESSED | RIGHT_ALT_PRESSED)))))
- {
- ConioPause(Console, PAUSED_FROM_KEYBOARD);
-
- /* Skip the event */
- RtlMoveMemory(InputEvent,
- InputEvent + 1,
- (NumEvents - 1) * sizeof(INPUT_RECORD));
- --NumEventsToWrite;
- continue;
- }
- }
- else
- {
- if ((vk < VK_SHIFT || vk > VK_CAPITAL) && vk != VK_LWIN
&&
- vk != VK_RWIN && vk != VK_NUMLOCK && vk !=
VK_SCROLL)
- {
- ConioUnpause(Console, PAUSED_FROM_KEYBOARD);
-
- /* Skip the event */
- RtlMoveMemory(InputEvent,
- InputEvent + 1,
- (NumEvents - 1) * sizeof(INPUT_RECORD));
- --NumEventsToWrite;
- continue;
- }
- }
- }
-
- /* Go to the next event */
- ++InputEvent;
- }
-
- return NumEventsToWrite;
-}
-
-/*
- * This post-processing code MUST be IN consrv ONLY
- */
-static VOID
-PostprocessInput(PCONSOLE Console)
-{
- CsrNotifyWait(&Console->ReadWaitQueue,
- FALSE,
- NULL,
- NULL);
- if (!IsListEmpty(&Console->ReadWaitQueue))
- {
- CsrDereferenceWait(&Console->ReadWaitQueue);
- }
-}
-
NTSTATUS
-ConioAddInputEvents(PCONSOLE Console,
- PINPUT_RECORD InputRecords, // InputEvent
- ULONG NumEventsToWrite,
- PULONG NumEventsWritten,
- BOOLEAN AppendToEnd)
+ConDrvAddInputEvents(PCONSOLE Console,
+ PINPUT_RECORD InputRecords, // InputEvent
+ ULONG NumEventsToWrite,
+ PULONG NumEventsWritten,
+ BOOLEAN AppendToEnd)
{
NTSTATUS Status = STATUS_SUCCESS;
ULONG i = 0;
BOOLEAN SetWaitEvent = FALSE;
if (NumEventsWritten) *NumEventsWritten = 0;
-
- /*
- * This pre-processing code MUST be IN consrv ONLY!!
- */
- NumEventsToWrite = PreprocessInput(Console, InputRecords, NumEventsToWrite);
- if (NumEventsToWrite == 0) return STATUS_SUCCESS;
-
/*
* When adding many single events, in the case of repeated mouse move or
@@ -300,6 +215,39 @@
Done:
if (NumEventsWritten) *NumEventsWritten = i;
+ return Status;
+}
+
+
+ULONG
+PreprocessInput(PCONSOLE Console,
+ PINPUT_RECORD InputEvent,
+ ULONG NumEventsToWrite);
+VOID
+PostprocessInput(PCONSOLE Console);
+
+NTSTATUS
+ConioAddInputEvents(PCONSOLE Console,
+ PINPUT_RECORD InputRecords, // InputEvent
+ ULONG NumEventsToWrite,
+ PULONG NumEventsWritten,
+ BOOLEAN AppendToEnd)
+{
+ NTSTATUS Status = STATUS_SUCCESS;
+
+ if (NumEventsWritten) *NumEventsWritten = 0;
+
+ /*
+ * This pre-processing code MUST be IN consrv ONLY!!
+ */
+ NumEventsToWrite = PreprocessInput(Console, InputRecords, NumEventsToWrite);
+ if (NumEventsToWrite == 0) return STATUS_SUCCESS;
+
+ Status = ConDrvAddInputEvents(Console,
+ InputRecords,
+ NumEventsToWrite,
+ NumEventsWritten,
+ AppendToEnd);
/*
* This post-processing code MUST be IN consrv ONLY!!
@@ -307,9 +255,10 @@
// if (NT_SUCCESS(Status))
if (Status == STATUS_SUCCESS) PostprocessInput(Console);
- return STATUS_SUCCESS;
-}
-
+ return Status;
+}
+
+/* Move elsewhere...*/
NTSTATUS
ConioProcessInputEvent(PCONSOLE Console,
PINPUT_RECORD InputEvent)
@@ -377,17 +326,15 @@
if (Console->LineBuffer == NULL)
{
/* Starting a new line */
- Console->LineMaxSize = (WORD)max(256, NumCharsToRead);
+ Console->LineMaxSize = max(256, NumCharsToRead);
Console->LineBuffer = ConsoleAllocHeap(0, Console->LineMaxSize *
sizeof(WCHAR));
if (Console->LineBuffer == NULL) return STATUS_NO_MEMORY;
- Console->LineComplete = FALSE;
- Console->LineUpPressed = FALSE;
+ Console->LinePos = Console->LineSize = ReadControl->nInitialChars;
+ Console->LineComplete = Console->LineUpPressed = FALSE;
Console->LineInsertToggle = Console->InsertMode;
Console->LineWakeupMask = ReadControl->dwCtrlWakeupMask;
- Console->LineSize = ReadControl->nInitialChars;
- Console->LinePos = Console->LineSize;
/*
* Pre-filling the buffer is only allowed in the Unicode API,
@@ -597,6 +544,7 @@
/* Now, add the events */
// if (NumEventsWritten) *NumEventsWritten = 0;
+ // ConDrvAddInputEvents
Status = ConioAddInputEvents(Console,
InputRecord,
NumEventsToWrite,
Modified: branches/condrv_restructure/win32ss/user/winsrv/consrv/condrv/console.c
URL:
http://svn.reactos.org/svn/reactos/branches/condrv_restructure/win32ss/user…
==============================================================================
--- branches/condrv_restructure/win32ss/user/winsrv/consrv/condrv/console.c [iso-8859-1]
(original)
+++ branches/condrv_restructure/win32ss/user/winsrv/consrv/condrv/console.c [iso-8859-1]
Mon Aug 4 20:23:33 2014
@@ -260,7 +260,7 @@
Console->InsertMode = ConsoleInfo->InsertMode;
Console->LineBuffer = NULL;
- Console->LineMaxSize = Console->LineSize = Console->LinePos = 0;
+ Console->LinePos = Console->LineMaxSize = Console->LineSize = 0;
Console->LineComplete = Console->LineUpPressed = FALSE;
Console->LineInsertToggle = Console->InsertMode;
// LineWakeupMask
Modified: branches/condrv_restructure/win32ss/user/winsrv/consrv/condrv/text.c
URL:
http://svn.reactos.org/svn/reactos/branches/condrv_restructure/win32ss/user…
==============================================================================
--- branches/condrv_restructure/win32ss/user/winsrv/consrv/condrv/text.c [iso-8859-1]
(original)
+++ branches/condrv_restructure/win32ss/user/winsrv/consrv/condrv/text.c [iso-8859-1] Mon
Aug 4 20:23:33 2014
@@ -233,16 +233,6 @@
SY += YDelta;
DY += YDelta;
}
-}
-
-DWORD
-ConioEffectiveCursorSize(PCONSOLE Console, DWORD Scale)
-{
- DWORD Size = (Console->ActiveBuffer->CursorInfo.dwSize * Scale + 99) / 100;
- /* If line input in progress, perhaps adjust for insert toggle */
- if (Console->LineBuffer && !Console->LineComplete &&
(Console->InsertMode ? !Console->LineInsertToggle : Console->LineInsertToggle))
- return (Size * 2 <= Scale) ? (Size * 2) : (Size / 2);
- return Size;
}
NTSTATUS
Modified: branches/condrv_restructure/win32ss/user/winsrv/consrv/coninput.c
URL:
http://svn.reactos.org/svn/reactos/branches/condrv_restructure/win32ss/user…
==============================================================================
--- branches/condrv_restructure/win32ss/user/winsrv/consrv/coninput.c [iso-8859-1]
(original)
+++ branches/condrv_restructure/win32ss/user/winsrv/consrv/coninput.c [iso-8859-1] Mon Aug
4 20:23:33 2014
@@ -35,6 +35,88 @@
/* PRIVATE FUNCTIONS **********************************************************/
+
+/*
+ * This pre-processing code MUST be IN consrv ONLY
+ */
+/* static */ ULONG
+PreprocessInput(PCONSOLE Console,
+ PINPUT_RECORD InputEvent,
+ ULONG NumEventsToWrite)
+{
+ ULONG NumEvents;
+
+ /*
+ * Loop each event, and for each, check for pause or unpause
+ * and perform adequate behaviour.
+ */
+ for (NumEvents = NumEventsToWrite; NumEvents > 0; --NumEvents)
+ {
+ /* Check for pause or unpause */
+ if (InputEvent->EventType == KEY_EVENT &&
InputEvent->Event.KeyEvent.bKeyDown)
+ {
+ WORD vk = InputEvent->Event.KeyEvent.wVirtualKeyCode;
+ if (!(Console->PauseFlags & PAUSED_FROM_KEYBOARD))
+ {
+ DWORD cks = InputEvent->Event.KeyEvent.dwControlKeyState;
+ if (Console->InputBuffer.Mode & ENABLE_LINE_INPUT &&
+ (vk == VK_PAUSE ||
+ (vk == 'S' && (cks & (LEFT_CTRL_PRESSED |
RIGHT_CTRL_PRESSED)) &&
+ !(cks & (LEFT_ALT_PRESSED | RIGHT_ALT_PRESSED)))))
+ {
+ ConioPause(Console, PAUSED_FROM_KEYBOARD);
+
+ /* Skip the event */
+ RtlMoveMemory(InputEvent,
+ InputEvent + 1,
+ (NumEvents - 1) * sizeof(INPUT_RECORD));
+ --NumEventsToWrite;
+ continue;
+ }
+ }
+ else
+ {
+ if ((vk < VK_SHIFT || vk > VK_CAPITAL) && vk != VK_LWIN
&&
+ vk != VK_RWIN && vk != VK_NUMLOCK && vk !=
VK_SCROLL)
+ {
+ ConioUnpause(Console, PAUSED_FROM_KEYBOARD);
+
+ /* Skip the event */
+ RtlMoveMemory(InputEvent,
+ InputEvent + 1,
+ (NumEvents - 1) * sizeof(INPUT_RECORD));
+ --NumEventsToWrite;
+ continue;
+ }
+ }
+ }
+
+ /* Go to the next event */
+ ++InputEvent;
+ }
+
+ return NumEventsToWrite;
+}
+
+/*
+ * This post-processing code MUST be IN consrv ONLY
+ */
+/* static */ VOID
+PostprocessInput(PCONSOLE Console)
+{
+ CsrNotifyWait(&Console->ReadWaitQueue,
+ FALSE,
+ NULL,
+ NULL);
+ if (!IsListEmpty(&Console->ReadWaitQueue))
+ {
+ CsrDereferenceWait(&Console->ReadWaitQueue);
+ }
+}
+
+
+
+
static NTSTATUS
WaitBeforeReading(IN PGET_INPUT_INFO InputInfo,
Modified: branches/condrv_restructure/win32ss/user/winsrv/consrv/frontends/input.c
URL:
http://svn.reactos.org/svn/reactos/branches/condrv_restructure/win32ss/user…
==============================================================================
--- branches/condrv_restructure/win32ss/user/winsrv/consrv/frontends/input.c [iso-8859-1]
(original)
+++ branches/condrv_restructure/win32ss/user/winsrv/consrv/frontends/input.c [iso-8859-1]
Mon Aug 4 20:23:33 2014
@@ -204,4 +204,14 @@
KeyState[VK_CONTROL]);
}
+DWORD
+ConioEffectiveCursorSize(PCONSOLE Console, DWORD Scale)
+{
+ DWORD Size = (Console->ActiveBuffer->CursorInfo.dwSize * Scale + 99) / 100;
+ /* If line input in progress, perhaps adjust for insert toggle */
+ if (Console->LineBuffer && !Console->LineComplete &&
(Console->InsertMode ? !Console->LineInsertToggle : Console->LineInsertToggle))
+ return (Size * 2 <= Scale) ? (Size * 2) : (Size / 2);
+ return Size;
+}
+
/* EOF */
Modified: branches/condrv_restructure/win32ss/user/winsrv/consrv/include/conio.h
URL:
http://svn.reactos.org/svn/reactos/branches/condrv_restructure/win32ss/user…
==============================================================================
--- branches/condrv_restructure/win32ss/user/winsrv/consrv/include/conio.h [iso-8859-1]
(original)
+++ branches/condrv_restructure/win32ss/user/winsrv/consrv/include/conio.h [iso-8859-1]
Mon Aug 4 20:23:33 2014
@@ -282,16 +282,16 @@
CONSOLE_INPUT_BUFFER InputBuffer; /* Input buffer of the console */
UINT InputCodePage;
- /** Put those things in TEXTMODE_SCREEN_BUFFER ?? **/
- PWCHAR LineBuffer; /* Current line being input, in line buffered
mode */
- ULONG LineMaxSize; /* Maximum size of line in characters
(including CR+LF) */
- ULONG LineSize; /* Current size of line */
- ULONG LinePos; /* Current position within line */
+ /** Put those things in CONSOLE_INPUT_BUFFER ?? **/
+ PWCHAR LineBuffer; /* Current line being input, in line buffered
mode */
+ ULONG LineMaxSize; /* Maximum size of line in characters
(including CR+LF) */
+ ULONG LineSize; /* Current size of line */
+ ULONG LinePos; /* Current position within line */
BOOLEAN LineComplete; /* User pressed enter, ready to send back to
client */
BOOLEAN LineUpPressed;
BOOLEAN LineInsertToggle; /* Replace character over cursor instead of
inserting */
- ULONG LineWakeupMask; /* Bitmap of which control characters will
end line input */
- /***************************************************/
+ ULONG LineWakeupMask; /* Bitmap of which control characters will
end line input */
+ /*************************************************/
BOOLEAN InsertMode;
Modified: branches/condrv_restructure/win32ss/user/winsrv/consrv/include/conio_winsrv.h
URL:
http://svn.reactos.org/svn/reactos/branches/condrv_restructure/win32ss/user…
==============================================================================
---
branches/condrv_restructure/win32ss/user/winsrv/consrv/include/conio_winsrv.h [iso-8859-1]
(original)
+++
branches/condrv_restructure/win32ss/user/winsrv/consrv/include/conio_winsrv.h [iso-8859-1]
Mon Aug 4 20:23:33 2014
@@ -142,6 +142,9 @@
/* coninput.c */
VOID NTAPI ConioProcessKey(PCONSOLE Console, MSG* msg);
+DWORD ConioEffectiveCursorSize(PCONSOLE Console,
+ DWORD Scale);
+
NTSTATUS
ConioAddInputEvents(PCONSOLE Console,
PINPUT_RECORD InputRecords,
@@ -178,7 +181,5 @@
PWCHAR Buffer,
DWORD Length,
BOOL Attrib);
-DWORD ConioEffectiveCursorSize(PCONSOLE Console,
- DWORD Scale);
/* EOF */