[CONSRV]
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sun, 31 Aug 2014 11:58:50 +0000 (11:58 +0000)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sun, 31 Aug 2014 11:58:50 +0000 (11:58 +0000)
- Some code cleaning.
- Bring back the terminal bell that was added in revision 58253 and disabled in revision 58447.

svn path=/branches/condrv_restructure/; revision=64007

win32ss/user/winsrv/consrv/condrv/dummyterm.c
win32ss/user/winsrv/consrv/frontends/gui/conwnd.c
win32ss/user/winsrv/consrv/frontends/gui/guiterm.c
win32ss/user/winsrv/consrv/frontends/terminal.c
win32ss/user/winsrv/consrv/include/conio.h
win32ss/user/winsrv/consrv/include/conio_winsrv.h
win32ss/user/winsrv/consrv/include/term.h

index a9f6cf6..2b61232 100644 (file)
@@ -25,12 +25,6 @@ DummyDeinitTerminal(IN OUT PTERMINAL This)
 {
 }
 
-static VOID NTAPI
-DummyDrawRegion(IN OUT PTERMINAL This,
-                SMALL_RECT* Region)
-{
-}
-
 
 
 /************ Line discipline ***************/
@@ -76,6 +70,12 @@ DummyWriteStream(IN OUT PTERMINAL This,
 
 
 
+static VOID NTAPI
+DummyDrawRegion(IN OUT PTERMINAL This,
+                SMALL_RECT* Region)
+{
+}
+
 static BOOL NTAPI
 DummySetCursorInfo(IN OUT PTERMINAL This,
                    PCONSOLE_SCREEN_BUFFER ScreenBuffer)
@@ -119,15 +119,6 @@ DummyGetLargestConsoleWindowSize(IN OUT PTERMINAL This,
 {
 }
 
-/*
-static BOOL NTAPI
-DummyGetSelectionInfo(IN OUT PTERMINAL This,
-                      PCONSOLE_SELECTION_INFO pSelectionInfo)
-{
-    return TRUE;
-}
-*/
-
 static BOOL NTAPI
 DummySetPalette(IN OUT PTERMINAL This,
                 HPALETTE PaletteHandle,
@@ -147,11 +138,11 @@ static TERMINAL_VTBL DummyVtbl =
 {
     DummyInitTerminal,
     DummyDeinitTerminal,
-    DummyDrawRegion,
 
     DummyReadStream,
     DummyWriteStream,
 
+    DummyDrawRegion,
     DummySetCursorInfo,
     DummySetScreenInfo,
     DummyResizeTerminal,
@@ -159,7 +150,6 @@ static TERMINAL_VTBL DummyVtbl =
     DummyReleaseScreenBuffer,
     DummyChangeTitle,
     DummyGetLargestConsoleWindowSize,
-    // DummyGetSelectionInfo,
     DummySetPalette,
     DummyShowMouseCursor,
 };
index 11a5a09..4a5102f 100644 (file)
@@ -2435,7 +2435,7 @@ ConWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
         }
 
         case PM_CONSOLE_BEEP:
-            DPRINT1("Beep !!\n");
+            DPRINT1("Beep\n");
             Beep(800, 200);
             break;
 
index 730d9a3..f8f2438 100644 (file)
@@ -675,6 +675,15 @@ GuiWriteStream(IN OUT PFRONTEND This,
     SetTimer(GuiData->hWindow, CONGUI_UPDATE_TIMER, CONGUI_UPDATE_TIME, NULL);
 }
 
+/* static */ VOID NTAPI
+GuiRingBell(IN OUT PFRONTEND This)
+{
+    PGUI_CONSOLE_DATA GuiData = This->Data;
+
+    /* Emit an error beep sound */
+    SendNotifyMessage(GuiData->hWindow, PM_CONSOLE_BEEP, 0, 0);
+}
+
 static BOOL NTAPI
 GuiSetCursorInfo(IN OUT PFRONTEND This,
                  PCONSOLE_SCREEN_BUFFER Buff)
@@ -1083,6 +1092,7 @@ static FRONTEND_VTBL GuiVtbl =
     GuiDeinitFrontEnd,
     GuiDrawRegion,
     GuiWriteStream,
+    GuiRingBell,
     GuiSetCursorInfo,
     GuiSetScreenInfo,
     GuiResizeTerminal,
index de95241..e2484c7 100644 (file)
@@ -288,14 +288,6 @@ ConSrvTermDeinitTerminal(IN OUT PTERMINAL This)
     FrontEnd->Vtbl->DeinitFrontEnd(FrontEnd);
 }
 
-static VOID NTAPI
-ConSrvTermDrawRegion(IN OUT PTERMINAL This,
-                SMALL_RECT* Region)
-{
-    PFRONTEND FrontEnd = This->Data;
-    FrontEnd->Vtbl->DrawRegion(FrontEnd, Region);
-}
-
 
 
 /************ Line discipline ***************/
@@ -588,14 +580,12 @@ ConioWriteConsole(PFRONTEND FrontEnd,
                 }
                 continue;
             }
-            // /* --- BEL ---*/
-            // else if (Buffer[i] == L'\a')
-            // {
-                // // FIXME: This MUST BE moved to the terminal emulator frontend!!
-                // DPRINT1("Bell\n");
-                // // SendNotifyMessage(Console->hWindow, PM_CONSOLE_BEEP, 0, 0);
-                // continue;
-            // }
+            /* --- BEL ---*/
+            else if (Buffer[i] == L'\a')
+            {
+                FrontEnd->Vtbl->RingBell(FrontEnd);
+                continue;
+            }
         }
         UpdateRect.Left  = min(UpdateRect.Left, Buff->CursorPosition.X);
         UpdateRect.Right = max(UpdateRect.Right, Buff->CursorPosition.X);
@@ -656,6 +646,14 @@ ConSrvTermWriteStream(IN OUT PTERMINAL This,
 
 
 
+static VOID NTAPI
+ConSrvTermDrawRegion(IN OUT PTERMINAL This,
+                SMALL_RECT* Region)
+{
+    PFRONTEND FrontEnd = This->Data;
+    FrontEnd->Vtbl->DrawRegion(FrontEnd, Region);
+}
+
 static BOOL NTAPI
 ConSrvTermSetCursorInfo(IN OUT PTERMINAL This,
                    PCONSOLE_SCREEN_BUFFER ScreenBuffer)
@@ -714,16 +712,6 @@ ConSrvTermGetLargestConsoleWindowSize(IN OUT PTERMINAL This,
     FrontEnd->Vtbl->GetLargestConsoleWindowSize(FrontEnd, pSize);
 }
 
-/*
-static BOOL NTAPI
-ConSrvTermGetSelectionInfo(IN OUT PTERMINAL This,
-                      PCONSOLE_SELECTION_INFO pSelectionInfo)
-{
-    PFRONTEND FrontEnd = This->Data;
-    return FrontEnd->Vtbl->GetSelectionInfo(FrontEnd, pSelectionInfo);
-}
-*/
-
 static BOOL NTAPI
 ConSrvTermSetPalette(IN OUT PTERMINAL This,
                 HPALETTE PaletteHandle,
@@ -745,11 +733,11 @@ static TERMINAL_VTBL ConSrvTermVtbl =
 {
     ConSrvTermInitTerminal,
     ConSrvTermDeinitTerminal,
-    ConSrvTermDrawRegion,
 
     ConSrvTermReadStream,
     ConSrvTermWriteStream,
 
+    ConSrvTermDrawRegion,
     ConSrvTermSetCursorInfo,
     ConSrvTermSetScreenInfo,
     ConSrvTermResizeTerminal,
@@ -757,7 +745,6 @@ static TERMINAL_VTBL ConSrvTermVtbl =
     ConSrvTermReleaseScreenBuffer,
     ConSrvTermChangeTitle,
     ConSrvTermGetLargestConsoleWindowSize,
-    // ConSrvTermGetSelectionInfo,
     ConSrvTermSetPalette,
     ConSrvTermShowMouseCursor,
 };
index b425fc9..ccf21a7 100644 (file)
@@ -194,10 +194,6 @@ typedef struct _TERMINAL_VTBL
                                    IN struct _CONSOLE* Console);
     VOID (NTAPI *DeinitTerminal)(IN OUT PTERMINAL This);
 
-    /* Interface used for both text-mode and graphics screen buffers */
-    VOID (NTAPI *DrawRegion)(IN OUT PTERMINAL This,
-                             SMALL_RECT* Region);
-
 
 
 /************ Line discipline ***************/
@@ -222,6 +218,9 @@ typedef struct _TERMINAL_VTBL
 
 
 
+    /* Interface used for both text-mode and graphics screen buffers */
+    VOID (NTAPI *DrawRegion)(IN OUT PTERMINAL This,
+                             SMALL_RECT* Region);
     BOOL (NTAPI *SetCursorInfo)(IN OUT PTERMINAL This,
                                 PCONSOLE_SCREEN_BUFFER ScreenBuffer);
     BOOL (NTAPI *SetScreenInfo)(IN OUT PTERMINAL This,
@@ -239,8 +238,6 @@ typedef struct _TERMINAL_VTBL
     VOID (NTAPI *ChangeTitle)(IN OUT PTERMINAL This);
     VOID (NTAPI *GetLargestConsoleWindowSize)(IN OUT PTERMINAL This,
                                               PCOORD pSize);
-    // BOOL (NTAPI *GetSelectionInfo)(IN OUT PTERMINAL This,
-                                   // PCONSOLE_SELECTION_INFO pSelectionInfo);
     BOOL (NTAPI *SetPalette)(IN OUT PTERMINAL This,
                              HPALETTE PaletteHandle,
                              UINT PaletteUsage);
index e353066..30185ec 100644 (file)
@@ -58,6 +58,7 @@ typedef struct _FRONTEND_VTBL
                               UINT ScrolledLines,
                               PWCHAR Buffer,
                               UINT Length);
+    VOID (NTAPI *RingBell)(IN OUT PFRONTEND This);
     BOOL (NTAPI *SetCursorInfo)(IN OUT PFRONTEND This,
                                 PCONSOLE_SCREEN_BUFFER ScreenBuffer);
     BOOL (NTAPI *SetScreenInfo)(IN OUT PFRONTEND This,
index 1671ca7..beb3cb8 100644 (file)
@@ -8,11 +8,7 @@
 
 #pragma once
 
-/* Macros used to call functions in the FRONTEND_VTBL virtual table */
-
-#define TermDrawRegion(Console, Region) \
-    (Console)->TermIFace.Vtbl->DrawRegion(&(Console)->TermIFace, (Region))
-
+/* Macros used to call functions in the TERMINAL_VTBL virtual table */
 
 #define TermReadStream(Console, ExeName, /**/ Unicode, /**/ Buffer, ReadControl, NumCharsToRead, NumCharsRead) \
     (Console)->TermIFace.Vtbl->ReadStream(&(Console)->TermIFace, (ExeName), /**/ (Unicode), /**/ \
@@ -23,6 +19,8 @@
                                            (Length), (Attrib))
 
 
+#define TermDrawRegion(Console, Region) \
+    (Console)->TermIFace.Vtbl->DrawRegion(&(Console)->TermIFace, (Region))
 #define TermSetCursorInfo(Console, ScreenBuffer) \
     (Console)->TermIFace.Vtbl->SetCursorInfo(&(Console)->TermIFace, (ScreenBuffer))
 #define TermSetScreenInfo(Console, ScreenBuffer, OldCursorX, OldCursorY) \
     (Console)->TermIFace.Vtbl->SetActiveScreenBuffer(&(Console)->TermIFace)
 #define TermReleaseScreenBuffer(Console, ScreenBuffer) \
     (Console)->TermIFace.Vtbl->ReleaseScreenBuffer(&(Console)->TermIFace, (ScreenBuffer))
-#define TermRefreshInternalInfo(Console) \
-    (Console)->FrontEndIFace.Vtbl->RefreshInternalInfo(&(Console)->FrontEndIFace)
-
 #define TermChangeTitle(Console) \
     (Console)->TermIFace.Vtbl->ChangeTitle(&(Console)->TermIFace)
+#define TermGetLargestConsoleWindowSize(Console, pSize) \
+    (Console)->TermIFace.Vtbl->GetLargestConsoleWindowSize(&(Console)->TermIFace, (pSize))
+#define TermSetPalette(Console, PaletteHandle, PaletteUsage) \
+    (Console)->TermIFace.Vtbl->SetPalette(&(Console)->TermIFace, (PaletteHandle), (PaletteUsage))
+#define TermShowMouseCursor(Console, Show) \
+    (Console)->TermIFace.Vtbl->ShowMouseCursor(&(Console)->TermIFace, (Show))
+
+
+/* Macros used to call functions in the FRONTEND_VTBL virtual table */
+
+#define TermRefreshInternalInfo(Console) \
+    (Console)->FrontEndIFace.Vtbl->RefreshInternalInfo(&(Console)->FrontEndIFace)
 #define TermChangeIcon(Console, IconHandle) \
     (Console)->FrontEndIFace.Vtbl->ChangeIcon(&(Console)->FrontEndIFace, (IconHandle))
 #define TermGetConsoleWindowHandle(Console) \
     (Console)->FrontEndIFace.Vtbl->GetConsoleWindowHandle(&(Console)->FrontEndIFace)
-#define TermGetLargestConsoleWindowSize(Console, pSize) \
-    (Console)->TermIFace.Vtbl->GetLargestConsoleWindowSize(&(Console)->TermIFace, (pSize))
 #define TermGetSelectionInfo(Console, pSelectionInfo) \
     (Console)->FrontEndIFace.Vtbl->GetSelectionInfo(&(Console)->FrontEndIFace, (pSelectionInfo))
-#define TermSetPalette(Console, PaletteHandle, PaletteUsage) \
-    (Console)->TermIFace.Vtbl->SetPalette(&(Console)->TermIFace, (PaletteHandle), (PaletteUsage))
 #define TermGetDisplayMode(Console) \
     (Console)->FrontEndIFace.Vtbl->GetDisplayMode(&(Console)->FrontEndIFace)
 #define TermSetDisplayMode(Console, NewMode) \
     (Console)->FrontEndIFace.Vtbl->SetDisplayMode(&(Console)->FrontEndIFace, (NewMode))
-#define TermShowMouseCursor(Console, Show) \
-    (Console)->TermIFace.Vtbl->ShowMouseCursor(&(Console)->TermIFace, (Show))
 #define TermSetMouseCursor(Console, CursorHandle) \
     (Console)->FrontEndIFace.Vtbl->SetMouseCursor(&(Console)->FrontEndIFace, (CursorHandle))
 #define TermMenuControl(Console, CmdIdLow, CmdIdHigh) \