[CONSRV]
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Thu, 10 Oct 2013 01:16:02 +0000 (01:16 +0000)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Thu, 10 Oct 2013 01:16:02 +0000 (01:16 +0000)
- Macros renaming.
- When switching active screen buffers, do it a bit more properly, i.e. announce it to the terminal emulator (aka. frontend) so that it will be able to change the associated console palette, be able to support displaying multi screen buffers or displaying another screen buffer than the active one (for debugging purposes or whatever), etc...

There are still some hacks and commented code, which whill be cleaned when I'll be sure that everything works and is not broken somewhere.

svn path=/trunk/; revision=60593

21 files changed:
reactos/win32ss/user/winsrv/consrv/condrv/coninput.c
reactos/win32ss/user/winsrv/consrv/condrv/conoutput.c
reactos/win32ss/user/winsrv/consrv/condrv/console.c
reactos/win32ss/user/winsrv/consrv/condrv/dummyfrontend.c
reactos/win32ss/user/winsrv/consrv/condrv/graphics.c
reactos/win32ss/user/winsrv/consrv/condrv/text.c
reactos/win32ss/user/winsrv/consrv/coninput.c
reactos/win32ss/user/winsrv/consrv/conoutput.c
reactos/win32ss/user/winsrv/consrv/conoutput.h
reactos/win32ss/user/winsrv/consrv/console.c
reactos/win32ss/user/winsrv/consrv/frontendctl.c
reactos/win32ss/user/winsrv/consrv/frontends/gui/guisettings.c
reactos/win32ss/user/winsrv/consrv/frontends/gui/guisettings.h
reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c
reactos/win32ss/user/winsrv/consrv/frontends/input.c
reactos/win32ss/user/winsrv/consrv/frontends/tui/tuiterm.c
reactos/win32ss/user/winsrv/consrv/handle.c
reactos/win32ss/user/winsrv/consrv/include/conio.h
reactos/win32ss/user/winsrv/consrv/include/term.h [moved from reactos/win32ss/user/winsrv/consrv/include/conio2.h with 56% similarity]
reactos/win32ss/user/winsrv/consrv/lineinput.c
reactos/win32ss/user/winsrv/consrv/settings.c

index d013ea8..783daa8 100644 (file)
@@ -11,7 +11,7 @@
 
 #include "consrv.h"
 #include "include/conio.h"
-#include "include/conio2.h"
+#include "include/term.h"
 #include "handle.h"
 #include "lineinput.h"
 
@@ -128,6 +128,11 @@ PurgeInputBuffer(PCONSOLE Console)
     CloseHandle(Console->InputBuffer.ActiveEvent);
 }
 
+/*
+ * This function explicitely references Console->ActiveBuffer
+ * (and also makes use of keyboard functions...).
+ * It is possible that it will move into frontends...
+ */
 VOID NTAPI
 ConDrvProcessKey(IN PCONSOLE Console,
                  IN BOOLEAN Down,
index e0c4340..8aa6203 100644 (file)
@@ -12,7 +12,7 @@
 #include "consrv.h"
 #include "console.h"
 #include "include/conio.h"
-#include "include/conio2.h"
+#include "include/term.h"
 #include "conoutput.h"
 #include "handle.h"
 
@@ -84,14 +84,12 @@ ConDrvCreateScreenBuffer(OUT PCONSOLE_SCREEN_BUFFER* Buffer,
 
     if (BufferType == CONSOLE_TEXTMODE_BUFFER)
     {
-        Status = TEXTMODE_BUFFER_Initialize(Buffer,
-                                            Console,
+        Status = TEXTMODE_BUFFER_Initialize(Buffer, Console,
                                             (PTEXTMODE_BUFFER_INFO)ScreenBufferInfo);
     }
     else if (BufferType == CONSOLE_GRAPHICS_BUFFER)
     {
-        Status = GRAPHICS_BUFFER_Initialize(Buffer,
-                                            Console,
+        Status = GRAPHICS_BUFFER_Initialize(Buffer, Console,
                                             (PGRAPHICS_BUFFER_INFO)ScreenBufferInfo);
     }
     else
@@ -115,18 +113,33 @@ ConioDeleteScreenBuffer(PCONSOLE_SCREEN_BUFFER Buffer)
     PCONSOLE Console = Buffer->Header.Console;
     PCONSOLE_SCREEN_BUFFER NewBuffer;
 
+    /*
+     * We should notify temporarily the frontend because we are susceptible
+     * to delete the screen buffer it is using (which may be different from
+     * the active screen buffer in some cases), and because, if it actually
+     * uses the active screen buffer, we are going to nullify its pointer to
+     * change it.
+     */
+    TermReleaseScreenBuffer(Console, Buffer);
+
     RemoveEntryList(&Buffer->ListEntry);
     if (Buffer == Console->ActiveBuffer)
     {
         /* Delete active buffer; switch to most recently created */
-        Console->ActiveBuffer = NULL;
         if (!IsListEmpty(&Console->BufferList))
         {
             NewBuffer = CONTAINING_RECORD(Console->BufferList.Flink,
                                           CONSOLE_SCREEN_BUFFER,
                                           ListEntry);
+
+            /* Tie console to new buffer and signal the change to the frontend */
             ConioSetActiveScreenBuffer(NewBuffer);
         }
+        else
+        {
+            Console->ActiveBuffer = NULL;
+            // InterlockedExchangePointer(&Console->ActiveBuffer, NULL);
+        }
     }
 
     CONSOLE_SCREEN_BUFFER_Destroy(Buffer);
@@ -141,7 +154,7 @@ ConioDrawConsole(PCONSOLE Console)
     if (ActiveBuffer)
     {
         ConioInitRect(&Region, 0, 0, ActiveBuffer->ViewSize.Y - 1, ActiveBuffer->ViewSize.X - 1);
-        ConioDrawRegion(Console, &Region);
+        TermDrawRegion(Console, &Region);
     }
 }
 
@@ -150,8 +163,8 @@ ConioSetActiveScreenBuffer(PCONSOLE_SCREEN_BUFFER Buffer)
 {
     PCONSOLE Console = Buffer->Header.Console;
     Console->ActiveBuffer = Buffer;
-    ConioResizeTerminal(Console);
-    // ConioDrawConsole(Console);
+    // InterlockedExchangePointer(&Console->ActiveBuffer, Buffer);
+    TermSetActiveScreenBuffer(Console);
 }
 
 NTSTATUS NTAPI
@@ -172,7 +185,7 @@ ConDrvSetConsoleActiveScreenBuffer(IN PCONSOLE Console,
         ConioDeleteScreenBuffer(Console->ActiveBuffer);
     }
 
-    /* Tie console to new buffer */
+    /* Tie console to new buffer and signal the change to the frontend */
     ConioSetActiveScreenBuffer(Buffer);
 
     return STATUS_SUCCESS;
@@ -198,7 +211,7 @@ ConDrvInvalidateBitMapRect(IN PCONSOLE Console,
     ASSERT(Console == Buffer->Header.Console);
 
     /* If the output buffer is the current one, redraw the correct portion of the screen */
-    if (Buffer == Console->ActiveBuffer) ConioDrawRegion(Console, Region);
+    if (Buffer == Console->ActiveBuffer) TermDrawRegion(Console, Region);
 
     return STATUS_SUCCESS;
 }
@@ -255,7 +268,7 @@ ConDrvSetConsoleCursorInfo(IN PCONSOLE Console,
         Buffer->CursorInfo.dwSize   = Size;
         Buffer->CursorInfo.bVisible = Visible;
 
-        Success = ConioSetCursorInfo(Console, (PCONSOLE_SCREEN_BUFFER)Buffer);
+        Success = TermSetCursorInfo(Console, (PCONSOLE_SCREEN_BUFFER)Buffer);
     }
 
     return (Success ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL);
@@ -286,7 +299,7 @@ ConDrvSetConsoleCursorPosition(IN PCONSOLE Console,
     // Buffer->CursorPosition.X = Position->X;
     // Buffer->CursorPosition.Y = Position->Y;
     if ( ((PCONSOLE_SCREEN_BUFFER)Buffer == Console->ActiveBuffer) &&
-         (!ConioSetScreenInfo(Console, (PCONSOLE_SCREEN_BUFFER)Buffer, OldCursorX, OldCursorY)) )
+         (!TermSetScreenInfo(Console, (PCONSOLE_SCREEN_BUFFER)Buffer, OldCursorX, OldCursorY)) )
     {
         return STATUS_UNSUCCESSFUL;
     }
index fa4562f..12982f1 100644 (file)
@@ -12,7 +12,7 @@
 
 #include "consrv.h"
 #include "include/conio.h"
-#include "include/conio2.h"
+#include "include/term.h"
 #include "handle.h"
 #include "procinit.h"
 #include "alias.h"
@@ -1010,7 +1010,7 @@ ConDrvSetConsoleTitle(IN PCONSOLE Console,
     RtlCopyMemory(Console->Title.Buffer, Title, Console->Title.Length);
     Console->Title.Buffer[Console->Title.Length / sizeof(WCHAR)] = L'\0';
 
-    // ConioChangeTitle(Console);
+    // TermChangeTitle(Console);
     return STATUS_SUCCESS;
 }
 
index fe8c43f..38e563d 100644 (file)
@@ -67,6 +67,17 @@ DummyResizeTerminal(IN OUT PFRONTEND This)
 {
 }
 
+static VOID NTAPI
+DummySetActiveScreenBuffer(IN OUT PFRONTEND This)
+{
+}
+
+static VOID NTAPI
+DummyReleaseScreenBuffer(IN OUT PFRONTEND This,
+                         IN PCONSOLE_SCREEN_BUFFER ScreenBuffer)
+{
+}
+
 static BOOL NTAPI
 DummyProcessKeyCallback(IN OUT PFRONTEND This,
                         MSG* msg,
@@ -158,6 +169,8 @@ static FRONTEND_VTBL DummyVtbl =
     DummySetCursorInfo,
     DummySetScreenInfo,
     DummyResizeTerminal,
+    DummySetActiveScreenBuffer,
+    DummyReleaseScreenBuffer,
     DummyProcessKeyCallback,
     DummyRefreshInternalInfo,
     DummyChangeTitle,
index 7c1f070..de5c25e 100644 (file)
@@ -13,7 +13,7 @@
 
 #include "consrv.h"
 #include "include/conio.h"
-#include "include/conio2.h"
+#include "include/term.h"
 #include "conoutput.h"
 #include "handle.h"
 
index f6b3b50..074e67d 100644 (file)
@@ -11,7 +11,7 @@
 
 #include "consrv.h"
 #include "include/conio.h"
-#include "include/conio2.h"
+#include "include/term.h"
 #include "conoutput.h"
 #include "handle.h"
 
@@ -584,8 +584,8 @@ ConioWriteConsole(PCONSOLE Console,
 
     if (!ConioIsRectEmpty(&UpdateRect) && (PCONSOLE_SCREEN_BUFFER)Buff == Console->ActiveBuffer)
     {
-        ConioWriteStream(Console, &UpdateRect, CursorStartX, CursorStartY,
-                         ScrolledLines, Buffer, Length);
+        TermWriteStream(Console, &UpdateRect, CursorStartX, CursorStartY,
+                        ScrolledLines, Buffer, Length);
     }
 
     return STATUS_SUCCESS;
@@ -731,7 +731,7 @@ ConDrvWriteConsoleOutput(IN PCONSOLE Console,
         }
     }
 
-    ConioDrawRegion(Console, &CapturedWriteRegion);
+    TermDrawRegion(Console, &CapturedWriteRegion);
 
     WriteRegion->Left   = CapturedWriteRegion.Left;
     WriteRegion->Top    = CapturedWriteRegion.Top ;
@@ -1053,7 +1053,7 @@ ConDrvWriteConsoleOutputString(IN PCONSOLE Console,
     if ((PCONSOLE_SCREEN_BUFFER)Buffer == Console->ActiveBuffer)
     {
         ConioComputeUpdateRect(Buffer, &UpdateRect, WriteCoord, NumCodesToWrite);
-        ConioDrawRegion(Console, &UpdateRect);
+        TermDrawRegion(Console, &UpdateRect);
     }
 
     // EndCoord->X = X;
@@ -1151,7 +1151,7 @@ ConDrvFillConsoleOutput(IN PCONSOLE Console,
     if ((PCONSOLE_SCREEN_BUFFER)Buffer == Console->ActiveBuffer)
     {
         ConioComputeUpdateRect(Buffer, &UpdateRect, WriteCoord, NumCodesToWrite);
-        ConioDrawRegion(Console, &UpdateRect);
+        TermDrawRegion(Console, &UpdateRect);
     }
 
     // CodesWritten = Written; // NumCodesToWrite;
@@ -1212,7 +1212,7 @@ ConDrvSetConsoleScreenBufferSize(IN PCONSOLE Console,
     ASSERT(Console == Buffer->Header.Console);
 
     Status = ConioResizeBuffer(Console, Buffer, *Size);
-    if (NT_SUCCESS(Status)) ConioResizeTerminal(Console);
+    if (NT_SUCCESS(Status)) TermResizeTerminal(Console);
 
     return Status;
 }
@@ -1292,7 +1292,7 @@ ConDrvScrollConsoleScreenBuffer(IN PCONSOLE Console,
         if (ConioGetIntersection(&UpdateRegion, &UpdateRegion, &CapturedClipRectangle))
         {
             /* Draw update region */
-            ConioDrawRegion(Console, &UpdateRegion);
+            TermDrawRegion(Console, &UpdateRegion);
         }
     }
 
index 6476e74..3288a88 100644 (file)
@@ -11,7 +11,7 @@
 
 #include "consrv.h"
 #include "include/conio.h"
-#include "include/conio2.h"
+#include "include/term.h"
 #include "handle.h"
 #include "lineinput.h"
 
index b9d0a5e..3076965 100644 (file)
@@ -12,7 +12,7 @@
 #include "consrv.h"
 #include "console.h"
 #include "include/conio.h"
-#include "include/conio2.h"
+#include "include/term.h"
 #include "conoutput.h"
 #include "handle.h"
 
index 966a6ab..420f2b7 100644 (file)
@@ -40,7 +40,7 @@ NTSTATUS FASTCALL ConDrvCreateScreenBuffer(OUT PCONSOLE_SCREEN_BUFFER* Buffer,
 VOID WINAPI ConioDeleteScreenBuffer(PCONSOLE_SCREEN_BUFFER Buffer);
 // VOID FASTCALL ConioSetActiveScreenBuffer(PCONSOLE_SCREEN_BUFFER Buffer);
 
-PCONSOLE_SCREEN_BUFFER
-ConDrvGetActiveScreenBuffer(IN PCONSOLE Console);
+// PCONSOLE_SCREEN_BUFFER
+// ConDrvGetActiveScreenBuffer(IN PCONSOLE Console);
 
 /* EOF */
index 1b0e788..4f95d28 100644 (file)
@@ -12,7 +12,7 @@
 
 #include "consrv.h"
 #include "include/conio.h"
-#include "include/conio2.h"
+#include "include/term.h"
 #include "handle.h"
 #include "procinit.h"
 #include "alias.h"
@@ -545,7 +545,7 @@ CSR_API(SrvSetConsoleTitle)
                                    TitleRequest->Title,
                                    TitleRequest->Length);
 
-    if (NT_SUCCESS(Status)) ConioChangeTitle(Console);
+    if (NT_SUCCESS(Status)) TermChangeTitle(Console);
 
     ConSrvReleaseConsole(Console, TRUE);
     return Status;
index 05665b4..b6a6d95 100644 (file)
@@ -10,7 +10,7 @@
 
 #include "consrv.h"
 #include "include/conio.h"
-#include "include/conio2.h"
+#include "include/term.h"
 #include "conoutput.h"
 #include "console.h"
 #include "handle.h"
@@ -132,7 +132,7 @@ CSR_API(SrvGetConsoleDisplayMode)
                               &Console, TRUE);
     if (!NT_SUCCESS(Status)) return Status;
 
-    GetDisplayModeRequest->DisplayMode = ConioGetDisplayMode(Console);
+    GetDisplayModeRequest->DisplayMode = TermGetDisplayMode(Console);
 
     ConSrvReleaseConsole(Console, TRUE);
     return STATUS_SUCCESS;
@@ -154,7 +154,7 @@ CSR_API(SrvSetConsoleDisplayMode)
 
     Console = Buff->Header.Console;
 
-    if (ConioSetDisplayMode(Console, SetDisplayModeRequest->DisplayMode))
+    if (TermSetDisplayMode(Console, SetDisplayModeRequest->DisplayMode))
     {
         SetDisplayModeRequest->NewSBDim = Buff->ScreenBufferSize;
         Status = STATUS_SUCCESS;
@@ -183,7 +183,7 @@ CSR_API(SrvGetLargestConsoleWindowSize)
     if (!NT_SUCCESS(Status)) return Status;
 
     Console = Buff->Header.Console;
-    ConioGetLargestConsoleWindowSize(Console, &GetLargestWindowSizeRequest->Size);
+    TermGetLargestConsoleWindowSize(Console, &GetLargestWindowSizeRequest->Size);
 
     ConSrvReleaseScreenBuffer(Buff, TRUE);
     return STATUS_SUCCESS;
@@ -205,7 +205,7 @@ CSR_API(SrvShowConsoleCursor)
 
     Console = Buff->Header.Console;
 
-    ShowCursorRequest->RefCount = ConioShowMouseCursor(Console, ShowCursorRequest->Show);
+    ShowCursorRequest->RefCount = TermShowMouseCursor(Console, ShowCursorRequest->Show);
 
     ConSrvReleaseScreenBuffer(Buff, TRUE);
     return STATUS_SUCCESS;
@@ -231,7 +231,7 @@ CSR_API(SrvSetConsoleCursor)
 
     Console = Buff->Header.Console;
 
-    Success = ConioSetMouseCursor(Console, SetCursorRequest->hCursor);
+    Success = TermSetMouseCursor(Console, SetCursorRequest->hCursor);
 
     ConSrvReleaseScreenBuffer(Buff, TRUE);
     return (Success ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL);
@@ -253,9 +253,9 @@ CSR_API(SrvConsoleMenuControl)
 
     Console = Buff->Header.Console;
 
-    MenuControlRequest->hMenu = ConioMenuControl(Console,
-                                                 MenuControlRequest->dwCmdIdLow,
-                                                 MenuControlRequest->dwCmdIdHigh);
+    MenuControlRequest->hMenu = TermMenuControl(Console,
+                                                MenuControlRequest->dwCmdIdLow,
+                                                MenuControlRequest->dwCmdIdHigh);
 
     ConSrvReleaseScreenBuffer(Buff, TRUE);
     return STATUS_SUCCESS;
@@ -272,7 +272,7 @@ CSR_API(SrvSetConsoleMenuClose)
                               &Console, TRUE);
     if (!NT_SUCCESS(Status)) return Status;
 
-    Success = ConioSetMenuClose(Console, SetMenuCloseRequest->Enable);
+    Success = TermSetMenuClose(Console, SetMenuCloseRequest->Enable);
 
     ConSrvReleaseConsole(Console, TRUE);
     return (Success ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL);
@@ -287,7 +287,7 @@ CSR_API(SrvGetConsoleWindow)
     Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
     if (!NT_SUCCESS(Status)) return Status;
 
-    GetWindowRequest->WindowHandle = ConioGetConsoleWindowHandle(Console);
+    GetWindowRequest->WindowHandle = TermGetConsoleWindowHandle(Console);
 
     ConSrvReleaseConsole(Console, TRUE);
     return STATUS_SUCCESS;
@@ -302,7 +302,7 @@ CSR_API(SrvSetConsoleIcon)
     Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
     if (!NT_SUCCESS(Status)) return Status;
 
-    Status = (ConioChangeIcon(Console, SetIconRequest->WindowIcon)
+    Status = (TermChangeIcon(Console, SetIconRequest->WindowIcon)
                 ? STATUS_SUCCESS
                 : STATUS_UNSUCCESSFUL);
 
index dc22dfc..6dac933 100644 (file)
@@ -227,7 +227,7 @@ GuiConsoleShowConsoleProperties(PGUI_CONSOLE_DATA GuiData,
 {
     NTSTATUS Status;
     PCONSOLE Console = GuiData->Console;
-    PCONSOLE_SCREEN_BUFFER ActiveBuffer = Console->ActiveBuffer;
+    PCONSOLE_SCREEN_BUFFER ActiveBuffer = GuiData->ActiveBuffer;
     PCONSOLE_PROCESS_DATA ProcessData;
     HANDLE hSection = NULL, hClientSection = NULL;
     LARGE_INTEGER SectionSize;
index 0b02011..2e62fbe 100644 (file)
@@ -65,6 +65,7 @@ typedef struct _GUI_CONSOLE_DATA
     UINT CharHeight;
 
     PCONSOLE Console;           /* Pointer to the owned console */
+    PCONSOLE_SCREEN_BUFFER ActiveBuffer;    /* Pointer to the active screen buffer (then maybe the previous Console member is redundant?? Or not...) */
     GUI_CONSOLE_INFO GuiInfo;   /* GUI terminal settings */
 } GUI_CONSOLE_DATA, *PGUI_CONSOLE_DATA;
 
index 33727eb..740fc43 100644 (file)
@@ -64,16 +64,18 @@ typedef struct _GUI_INIT_INFO
 #define GWLP_CONSOLE_LEADER_PID 0
 #define GWLP_CONSOLE_LEADER_TID 4
 
-#define SetConsoleWndConsoleLeaderCID(GuiData)  \
-do {                                            \
-    PCONSOLE_PROCESS_DATA ProcessData;          \
-    CLIENT_ID ConsoleLeaderCID;                 \
+#define SetConsoleWndConsoleLeaderCID(GuiData)                              \
+do {                                                                        \
+    PCONSOLE_PROCESS_DATA ProcessData;                                      \
+    CLIENT_ID ConsoleLeaderCID;                                             \
     ProcessData = CONTAINING_RECORD((GuiData)->Console->ProcessList.Blink,  \
                                     CONSOLE_PROCESS_DATA,                   \
                                     ConsoleLink);                           \
     ConsoleLeaderCID = ProcessData->Process->ClientId;                      \
-    SetWindowLongPtrW((GuiData)->hWindow, GWLP_CONSOLE_LEADER_PID, (LONG_PTR)(ConsoleLeaderCID.UniqueProcess));  \
-    SetWindowLongPtrW((GuiData)->hWindow, GWLP_CONSOLE_LEADER_TID, (LONG_PTR)(ConsoleLeaderCID.UniqueThread ));  \
+    SetWindowLongPtrW((GuiData)->hWindow, GWLP_CONSOLE_LEADER_PID,          \
+                      (LONG_PTR)(ConsoleLeaderCID.UniqueProcess));          \
+    SetWindowLongPtrW((GuiData)->hWindow, GWLP_CONSOLE_LEADER_TID,          \
+                      (LONG_PTR)(ConsoleLeaderCID.UniqueThread ));          \
 } while (0)
 /**************************************************************/
 
@@ -264,7 +266,8 @@ GuiConsoleHandleSysMenuCommand(PGUI_CONSOLE_DATA GuiData, WPARAM wParam, LPARAM
         Ret = FALSE;
         goto Quit;
     }
-    ActiveBuffer = ConDrvGetActiveScreenBuffer(Console);
+    // ActiveBuffer = ConDrvGetActiveScreenBuffer(Console);
+    ActiveBuffer = GuiData->ActiveBuffer;
 
     /*
      * In case the selected menu item belongs to the user-reserved menu id range,
@@ -392,8 +395,8 @@ GuiConsoleMoveWindow(PGUI_CONSOLE_DATA GuiData)
 static VOID
 GuiConsoleResizeWindow(PGUI_CONSOLE_DATA GuiData)
 {
-    PCONSOLE Console = GuiData->Console;
-    PCONSOLE_SCREEN_BUFFER Buff = ConDrvGetActiveScreenBuffer(Console);
+    // PCONSOLE Console = GuiData->Console;
+    PCONSOLE_SCREEN_BUFFER Buff = GuiData->ActiveBuffer; // ConDrvGetActiveScreenBuffer(Console);
     SCROLLINFO sInfo;
 
     DWORD Width, Height;
@@ -471,8 +474,8 @@ GuiConsoleSwitchFullScreen(PGUI_CONSOLE_DATA GuiData)
         memset(&dmScreenSettings, 0, sizeof(dmScreenSettings));
         dmScreenSettings.dmSize       = sizeof(dmScreenSettings);
         dmScreenSettings.dmDisplayFixedOutput = DMDFO_CENTER; // DMDFO_STRETCH // DMDFO_DEFAULT
-        dmScreenSettings.dmPelsWidth  = 640; // Console->ActiveBuffer->ViewSize.X * GuiData->CharWidth;
-        dmScreenSettings.dmPelsHeight = 480; // Console->ActiveBuffer->ViewSize.Y * GuiData->CharHeight;
+        dmScreenSettings.dmPelsWidth  = 640; // GuiData->ActiveBuffer->ViewSize.X * GuiData->CharWidth;
+        dmScreenSettings.dmPelsHeight = 480; // GuiData->ActiveBuffer->ViewSize.Y * GuiData->CharHeight;
         dmScreenSettings.dmBitsPerPel = 32;
         dmScreenSettings.dmFields     = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
         ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN);
@@ -588,8 +591,8 @@ GuiConsoleHandleNcCreate(HWND hWnd, LPCREATESTRUCTW Create)
 static VOID
 SmallRectToRect(PGUI_CONSOLE_DATA GuiData, PRECT Rect, PSMALL_RECT SmallRect)
 {
-    PCONSOLE Console = GuiData->Console;
-    PCONSOLE_SCREEN_BUFFER Buffer = ConDrvGetActiveScreenBuffer(Console);
+    // PCONSOLE Console = GuiData->Console;
+    PCONSOLE_SCREEN_BUFFER Buffer = GuiData->ActiveBuffer; // ConDrvGetActiveScreenBuffer(Console);
     UINT WidthUnit, HeightUnit;
 
     GetScreenBufferSizeUnits(Buffer, GuiData, &WidthUnit, &HeightUnit);
@@ -687,7 +690,8 @@ GuiConsoleHandlePaint(PGUI_CONSOLE_DATA GuiData)
         Success = FALSE;
         goto Quit;
     }
-    ActiveBuffer = ConDrvGetActiveScreenBuffer(Console);
+    // ActiveBuffer = ConDrvGetActiveScreenBuffer(Console);
+    ActiveBuffer = GuiData->ActiveBuffer;
 
     hDC = BeginPaint(GuiData->hWindow, &ps);
     if (hDC != NULL &&
@@ -768,7 +772,8 @@ GuiConsoleHandleKey(PGUI_CONSOLE_DATA GuiData, UINT msg, WPARAM wParam, LPARAM l
 
     if (!ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE)) return;
 
-    ActiveBuffer = ConDrvGetActiveScreenBuffer(Console);
+    // ActiveBuffer = ConDrvGetActiveScreenBuffer(Console);
+    ActiveBuffer = GuiData->ActiveBuffer;
 
     if (Console->Selection.dwFlags & CONSOLE_SELECTION_IN_PROGRESS)
     {
@@ -940,7 +945,7 @@ GuiConsoleHandleTimer(PGUI_CONSOLE_DATA GuiData)
 
     if (!ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE)) return;
 
-    Buff = ConDrvGetActiveScreenBuffer(Console);
+    Buff = GuiData->ActiveBuffer; // ConDrvGetActiveScreenBuffer(Console);
 
     if (GetType(Buff) == TEXTMODE_BUFFER)
     {
@@ -1063,8 +1068,8 @@ GuiConsoleHandleNcDestroy(HWND hWnd)
 static COORD
 PointToCoord(PGUI_CONSOLE_DATA GuiData, LPARAM lParam)
 {
-    PCONSOLE Console = GuiData->Console;
-    PCONSOLE_SCREEN_BUFFER Buffer = ConDrvGetActiveScreenBuffer(Console);
+    // PCONSOLE Console = GuiData->Console;
+    PCONSOLE_SCREEN_BUFFER Buffer = GuiData->ActiveBuffer; // ConDrvGetActiveScreenBuffer(Console);
     COORD Coord;
     UINT  WidthUnit, HeightUnit;
 
@@ -1343,7 +1348,7 @@ GuiConsoleCopy(PGUI_CONSOLE_DATA GuiData)
     if (OpenClipboard(GuiData->hWindow) == TRUE)
     {
         PCONSOLE Console = GuiData->Console;
-        PCONSOLE_SCREEN_BUFFER Buffer = ConDrvGetActiveScreenBuffer(Console);
+        PCONSOLE_SCREEN_BUFFER Buffer = GuiData->ActiveBuffer; // ConDrvGetActiveScreenBuffer(Console);
 
         if (GetType(Buffer) == TEXTMODE_BUFFER)
         {
@@ -1370,8 +1375,8 @@ GuiConsolePaste(PGUI_CONSOLE_DATA GuiData)
 {
     if (OpenClipboard(GuiData->hWindow) == TRUE)
     {
-        PCONSOLE Console = GuiData->Console;
-        PCONSOLE_SCREEN_BUFFER Buffer = ConDrvGetActiveScreenBuffer(Console);
+        // PCONSOLE Console = GuiData->Console;
+        PCONSOLE_SCREEN_BUFFER Buffer = GuiData->ActiveBuffer; // ConDrvGetActiveScreenBuffer(Console);
 
         if (GetType(Buffer) == TEXTMODE_BUFFER)
         {
@@ -1396,7 +1401,8 @@ GuiConsoleGetMinMaxInfo(PGUI_CONSOLE_DATA GuiData, PMINMAXINFO minMaxInfo)
 
     if (!ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE)) return;
 
-    ActiveBuffer = ConDrvGetActiveScreenBuffer(Console);
+    // ActiveBuffer = ConDrvGetActiveScreenBuffer(Console);
+    ActiveBuffer = GuiData->ActiveBuffer;
 
     GetScreenBufferSizeUnits(ActiveBuffer, GuiData, &WidthUnit, &HeightUnit);
 
@@ -1428,7 +1434,7 @@ GuiConsoleResize(PGUI_CONSOLE_DATA GuiData, WPARAM wParam, LPARAM lParam)
     if ((GuiData->WindowSizeLock == FALSE) &&
         (wParam == SIZE_RESTORED || wParam == SIZE_MAXIMIZED || wParam == SIZE_MINIMIZED))
     {
-        PCONSOLE_SCREEN_BUFFER Buff = ConDrvGetActiveScreenBuffer(Console);
+        PCONSOLE_SCREEN_BUFFER Buff = GuiData->ActiveBuffer; // ConDrvGetActiveScreenBuffer(Console);
         DWORD windx, windy, charx, chary;
         UINT  WidthUnit, HeightUnit;
 
@@ -1522,7 +1528,7 @@ GuiConsoleHandleScroll(PGUI_CONSOLE_DATA GuiData, UINT uMsg, WPARAM wParam)
 
     if (!ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE)) return 0;
 
-    Buff = ConDrvGetActiveScreenBuffer(Console);
+    Buff = GuiData->ActiveBuffer; // ConDrvGetActiveScreenBuffer(Console);
 
     if (uMsg == WM_HSCROLL)
     {
@@ -1647,6 +1653,9 @@ GuiConsoleWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
     GuiData = GuiGetGuiData(hWnd);
     if (GuiData == NULL) return DefWindowProcW(hWnd, msg, wParam, lParam);
 
+    // TEMPORARY HACK until all of the functions can deal with a NULL GuiData->ActiveBuffer ...
+    if (GuiData->ActiveBuffer == NULL) return DefWindowProcW(hWnd, msg, wParam, lParam);
+
     /*
      * Just retrieve a pointer to the console in case somebody needs it.
      * It is not NULL because it was checked in GuiGetGuiData.
@@ -1865,14 +1874,16 @@ GuiConsoleWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
         {
             if (ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE))
             {
+                BOOL SetFocus = (msg == WM_SETFOCUS);
                 INPUT_RECORD er;
+
                 er.EventType = FOCUS_EVENT;
-                er.Event.FocusEvent.bSetFocus = (msg == WM_SETFOCUS);
+                er.Event.FocusEvent.bSetFocus = SetFocus;
                 ConioProcessInputEvent(Console, &er);
 
-                if (msg == WM_SETFOCUS)
+                if (SetFocus)
                     DPRINT1("TODO: Create console caret\n");
-                else // if (msg == WM_KILLFOCUS)
+                else
                     DPRINT1("TODO: Destroy console caret\n");
 
                 LeaveCriticalSection(&Console->Lock);
@@ -2247,7 +2258,8 @@ GuiInitFrontEnd(IN OUT PFRONTEND This,
         return STATUS_UNSUCCESSFUL;
     }
     /* HACK */ Console->TermIFace.Data = (PVOID)GuiData; /* HACK */
-    GuiData->Console = Console;
+    GuiData->Console      = Console;
+    GuiData->ActiveBuffer = Console->ActiveBuffer;
     GuiData->hWindow = NULL;
 
     /* The console can be resized */
@@ -2441,7 +2453,7 @@ GuiWriteStream(IN OUT PFRONTEND This,
 
     if (NULL == GuiData || NULL == GuiData->hWindow) return;
 
-    Buff = ConDrvGetActiveScreenBuffer(GuiData->Console);
+    Buff = GuiData->ActiveBuffer; // ConDrvGetActiveScreenBuffer(GuiData->Console);
     if (GetType(Buff) != TEXTMODE_BUFFER) return;
 
     if (0 != ScrolledLines)
@@ -2490,7 +2502,7 @@ GuiSetCursorInfo(IN OUT PFRONTEND This,
 {
     PGUI_CONSOLE_DATA GuiData = This->Data;
 
-    if (ConDrvGetActiveScreenBuffer(GuiData->Console) == Buff)
+    if (/*ConDrvGetActiveScreenBuffer(GuiData->Console)*/GuiData->ActiveBuffer == Buff)
     {
         GuiInvalidateCell(This, Buff->CursorPosition.X, Buff->CursorPosition.Y);
     }
@@ -2506,7 +2518,7 @@ GuiSetScreenInfo(IN OUT PFRONTEND This,
 {
     PGUI_CONSOLE_DATA GuiData = This->Data;
 
-    if (ConDrvGetActiveScreenBuffer(GuiData->Console) == Buff)
+    if (/*ConDrvGetActiveScreenBuffer(GuiData->Console)*/GuiData->ActiveBuffer == Buff)
     {
         /* Redraw char at old position (remove cursor) */
         GuiInvalidateCell(This, OldCursorX, OldCursorY);
@@ -2531,6 +2543,62 @@ GuiResizeTerminal(IN OUT PFRONTEND This)
     PostMessageW(GuiData->hWindow, PM_RESIZE_TERMINAL, 0, 0);
 }
 
+static VOID WINAPI
+GuiSetActiveScreenBuffer(IN OUT PFRONTEND This)
+{
+    PGUI_CONSOLE_DATA GuiData = This->Data;
+
+    EnterCriticalSection(&GuiData->Lock);
+    GuiData->WindowSizeLock = TRUE;
+
+    InterlockedExchangePointer(&GuiData->ActiveBuffer,
+                                GuiData->Console->ActiveBuffer);
+
+    GuiData->WindowSizeLock = FALSE;
+    LeaveCriticalSection(&GuiData->Lock);
+
+    GuiResizeTerminal(This);
+    // ConioDrawConsole(Console);
+
+    // FIXME: Change the palette.
+}
+
+static VOID WINAPI
+GuiReleaseScreenBuffer(IN OUT PFRONTEND This,
+                       IN PCONSOLE_SCREEN_BUFFER ScreenBuffer)
+{
+    PGUI_CONSOLE_DATA GuiData = This->Data;
+
+    /*
+     * If we were notified to release a screen buffer that is not actually
+     * ours, then just ignore the notification...
+     */
+    if (ScreenBuffer != GuiData->ActiveBuffer) return;
+
+    /*
+     * ... else, we must release our active buffer. Two cases are present:
+     * - If ScreenBuffer (== GuiData->ActiveBuffer) IS NOT the console
+     *   active screen buffer, then we can safely switch to it.
+     * - If ScreenBuffer IS the console active screen buffer, we must release
+     *   it BUT and that's all.
+     */
+
+    if (ScreenBuffer != GuiData->Console->ActiveBuffer)
+    {
+        GuiSetActiveScreenBuffer(This);
+    }
+    else
+    {
+        EnterCriticalSection(&GuiData->Lock);
+        GuiData->WindowSizeLock = TRUE;
+
+        InterlockedExchangePointer(&GuiData->ActiveBuffer, NULL);
+
+        GuiData->WindowSizeLock = FALSE;
+        LeaveCriticalSection(&GuiData->Lock);
+    }
+}
+
 static BOOL WINAPI
 GuiProcessKeyCallback(IN OUT PFRONTEND This,
                       MSG* msg,
@@ -2653,7 +2721,8 @@ GuiGetLargestConsoleWindowSize(IN OUT PFRONTEND This,
         return;
     }
 
-    ActiveBuffer = ConDrvGetActiveScreenBuffer(GuiData->Console);
+    // ActiveBuffer = ConDrvGetActiveScreenBuffer(GuiData->Console);
+    ActiveBuffer = GuiData->ActiveBuffer;
     if (ActiveBuffer)
     {
         GetScreenBufferSizeUnits(ActiveBuffer, GuiData, &WidthUnit, &HeightUnit);
@@ -2783,6 +2852,8 @@ static FRONTEND_VTBL GuiVtbl =
     GuiSetCursorInfo,
     GuiSetScreenInfo,
     GuiResizeTerminal,
+    GuiSetActiveScreenBuffer,
+    GuiReleaseScreenBuffer,
     GuiProcessKeyCallback,
     GuiRefreshInternalInfo,
     GuiChangeTitle,
index b077946..541dfa3 100644 (file)
@@ -11,7 +11,7 @@
 
 #include "consrv.h"
 #include "include/conio.h"
-#include "include/conio2.h"
+#include "include/term.h"
 #include "coninput.h"
 
 #define NDEBUG
@@ -104,12 +104,12 @@ ConioProcessKey(PCONSOLE Console, MSG* msg)
         UnicodeChar = (1 == RetChars ? Chars[0] : 0);
     }
 
-    if (ConioProcessKeyCallback(Console,
-                                msg,
-                                KeyState[VK_MENU],
-                                ShiftState,
-                                VirtualKeyCode,
-                                Down))
+    if (TermProcessKeyCallback(Console,
+                               msg,
+                               KeyState[VK_MENU],
+                               ShiftState,
+                               VirtualKeyCode,
+                               Down))
     {
         return;
     }
index 84ae5c4..d7c55ae 100644 (file)
@@ -482,7 +482,7 @@ TuiInitFrontEnd(IN OUT PFRONTEND This,
 
     // /* The console cannot be resized anymore */
     // Console->FixedSize = TRUE; // MUST be placed AFTER the call to ConioResizeBuffer !!
-    // // ConioResizeTerminal(Console);
+    // // TermResizeTerminal(Console);
 
     /*
      * Contrary to what we do in the GUI front-end, here we create
index 47900de..066a190 100644 (file)
@@ -12,7 +12,7 @@
 
 #include "consrv.h"
 #include "include/conio.h"
-#include "include/conio2.h"
+#include "include/term.h"
 #include "handle.h"
 #include "include/console.h"
 #include "console.h"
@@ -551,7 +551,7 @@ ConSrvAllocateConsole(PCONSOLE_PROCESS_DATA ProcessData,
     _InterlockedIncrement(&Console->ReferenceCount);
 
     /* Update the internal info of the terminal */
-    ConioRefreshInternalInfo(Console);
+    TermRefreshInternalInfo(Console);
 
     return STATUS_SUCCESS;
 }
@@ -629,7 +629,7 @@ ConSrvInheritConsole(PCONSOLE_PROCESS_DATA ProcessData,
     _InterlockedIncrement(&Console->ReferenceCount);
 
     /* Update the internal info of the terminal */
-    ConioRefreshInternalInfo(Console);
+    TermRefreshInternalInfo(Console);
 
     Status = STATUS_SUCCESS;
 
@@ -666,7 +666,7 @@ ConSrvRemoveConsole(PCONSOLE_PROCESS_DATA ProcessData)
         RemoveEntryList(&ProcessData->ConsoleLink);
 
         /* Update the internal info of the terminal */
-        ConioRefreshInternalInfo(Console);
+        TermRefreshInternalInfo(Console);
 
         /* Release the console */
         DPRINT("ConSrvRemoveConsole - Decrement Console->ReferenceCount = %lu\n", Console->ReferenceCount);
index 3ef623f..154373f 100644 (file)
@@ -203,6 +203,9 @@ typedef struct _FRONTEND_VTBL
                                  SHORT OldCursorX,
                                  SHORT OldCursorY);
     VOID (WINAPI *ResizeTerminal)(IN OUT PFRONTEND This);
+    VOID (WINAPI *SetActiveScreenBuffer)(IN OUT PFRONTEND This);
+    VOID (WINAPI *ReleaseScreenBuffer)(IN OUT PFRONTEND This,
+                                       IN PCONSOLE_SCREEN_BUFFER ScreenBuffer);
     BOOL (WINAPI *ProcessKeyCallback)(IN OUT PFRONTEND This,
                                       MSG* msg,
                                       BYTE KeyStateMenu,
@@ -1,8 +1,8 @@
 /*
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS Console Server DLL
- * FILE:            win32ss/user/winsrv/consrv/conio.h
- * PURPOSE:         Internal Console I/O Interface
+ * FILE:            win32ss/user/winsrv/consrv/include/term.h
+ * PURPOSE:         Internal Frontend Interface
  * PROGRAMMERS:     Hermes Belusca-Maito (hermes.belusca@sfr.fr)
  */
 
 
 /* Macros used to call functions in the FRONTEND_VTBL virtual table */
 
-#define ConioDrawRegion(Console, Region) \
+#define TermDrawRegion(Console, Region) \
     (Console)->TermIFace.Vtbl->DrawRegion(&(Console)->TermIFace, (Region))
-#define ConioWriteStream(Console, Block, CurStartX, CurStartY, ScrolledLines, Buffer, Length) \
+#define TermWriteStream(Console, Block, CurStartX, CurStartY, ScrolledLines, Buffer, Length) \
     (Console)->TermIFace.Vtbl->WriteStream(&(Console)->TermIFace, (Block), (CurStartX), (CurStartY), \
                                            (ScrolledLines), (Buffer), (Length))
-#define ConioSetCursorInfo(Console, Buff) \
-    (Console)->TermIFace.Vtbl->SetCursorInfo(&(Console)->TermIFace, (Buff))
-#define ConioSetScreenInfo(Console, Buff, OldCursorX, OldCursorY) \
-    (Console)->TermIFace.Vtbl->SetScreenInfo(&(Console)->TermIFace, (Buff), (OldCursorX), (OldCursorY))
-#define ConioResizeTerminal(Console) \
+#define TermSetCursorInfo(Console, ScreenBuffer) \
+    (Console)->TermIFace.Vtbl->SetCursorInfo(&(Console)->TermIFace, (ScreenBuffer))
+#define TermSetScreenInfo(Console, ScreenBuffer, OldCursorX, OldCursorY) \
+    (Console)->TermIFace.Vtbl->SetScreenInfo(&(Console)->TermIFace, (ScreenBuffer), (OldCursorX), (OldCursorY))
+#define TermResizeTerminal(Console) \
     (Console)->TermIFace.Vtbl->ResizeTerminal(&(Console)->TermIFace)
-#define ConioProcessKeyCallback(Console, Msg, KeyStateMenu, ShiftState, VirtualKeyCode, Down) \
+#define TermSetActiveScreenBuffer(Console) \
+    (Console)->TermIFace.Vtbl->SetActiveScreenBuffer(&(Console)->TermIFace)
+#define TermReleaseScreenBuffer(Console, ScreenBuffer) \
+    (Console)->TermIFace.Vtbl->ReleaseScreenBuffer(&(Console)->TermIFace, (ScreenBuffer))
+#define TermProcessKeyCallback(Console, Msg, KeyStateMenu, ShiftState, VirtualKeyCode, Down) \
     (Console)->TermIFace.Vtbl->ProcessKeyCallback(&(Console)->TermIFace, (Msg), (KeyStateMenu), (ShiftState), (VirtualKeyCode), (Down))
-#define ConioRefreshInternalInfo(Console) \
+#define TermRefreshInternalInfo(Console) \
     (Console)->TermIFace.Vtbl->RefreshInternalInfo(&(Console)->TermIFace)
 
-#define ConioChangeTitle(Console) \
+#define TermChangeTitle(Console) \
     (Console)->TermIFace.Vtbl->ChangeTitle(&(Console)->TermIFace)
-#define ConioChangeIcon(Console, hWindowIcon) \
+#define TermChangeIcon(Console, hWindowIcon) \
     (Console)->TermIFace.Vtbl->ChangeIcon(&(Console)->TermIFace, (hWindowIcon))
-#define ConioGetConsoleWindowHandle(Console) \
+#define TermGetConsoleWindowHandle(Console) \
     (Console)->TermIFace.Vtbl->GetConsoleWindowHandle(&(Console)->TermIFace)
-#define ConioGetLargestConsoleWindowSize(Console, pSize) \
+#define TermGetLargestConsoleWindowSize(Console, pSize) \
     (Console)->TermIFace.Vtbl->GetLargestConsoleWindowSize(&(Console)->TermIFace, (pSize))
-#define ConioGetDisplayMode(Console) \
+#define TermGetDisplayMode(Console) \
     (Console)->TermIFace.Vtbl->GetDisplayMode(&(Console)->TermIFace)
-#define ConioSetDisplayMode(Console, NewMode) \
+#define TermSetDisplayMode(Console, NewMode) \
     (Console)->TermIFace.Vtbl->SetDisplayMode(&(Console)->TermIFace, (NewMode))
-#define ConioShowMouseCursor(Console, Show) \
+#define TermShowMouseCursor(Console, Show) \
     (Console)->TermIFace.Vtbl->ShowMouseCursor(&(Console)->TermIFace, (Show))
-#define ConioSetMouseCursor(Console, hCursor) \
+#define TermSetMouseCursor(Console, hCursor) \
     (Console)->TermIFace.Vtbl->SetMouseCursor(&(Console)->TermIFace, (hCursor))
-#define ConioMenuControl(Console, CmdIdLow, CmdIdHigh) \
+#define TermMenuControl(Console, CmdIdLow, CmdIdHigh) \
     (Console)->TermIFace.Vtbl->MenuControl(&(Console)->TermIFace, (CmdIdLow), (CmdIdHigh))
-#define ConioSetMenuClose(Console, Enable) \
+#define TermSetMenuClose(Console, Enable) \
     (Console)->TermIFace.Vtbl->SetMenuClose(&(Console)->TermIFace, (Enable))
 
 /* EOF */
index 5124096..b19082c 100644 (file)
@@ -4,6 +4,8 @@
  * FILE:            win32ss/user/winsrv/consrv/lineinput.c
  * PURPOSE:         Console line input functions
  * PROGRAMMERS:     Jeffrey Morlan
+ *
+ * NOTE: It's something frontend-related... (--> read my mind... ;) )
  */
 
 /* INCLUDES *******************************************************************/
@@ -11,7 +13,7 @@
 #include "consrv.h"
 #include "console.h"
 #include "include/conio.h"
-#include "include/conio2.h"
+#include "include/term.h"
 
 #define NDEBUG
 #include <debug.h>
@@ -184,7 +186,7 @@ LineInputSetPos(PCONSOLE Console, UINT Pos)
 
         Buffer->CursorPosition.X = XY % Buffer->ScreenBufferSize.X;
         Buffer->CursorPosition.Y = XY / Buffer->ScreenBufferSize.X;
-        ConioSetScreenInfo(Console, Buffer, OldCursorX, OldCursorY);
+        TermSetScreenInfo(Console, Buffer, OldCursorX, OldCursorY);
     }
 
     Console->LinePos = Pos;
@@ -309,7 +311,7 @@ LineInputKeyDown(PCONSOLE Console, KEY_EVENT_RECORD *KeyEvent)
     case VK_INSERT:
         /* Toggle between insert and overstrike */
         Console->LineInsertToggle = !Console->LineInsertToggle;
-        ConioSetCursorInfo(Console, Console->ActiveBuffer);
+        TermSetCursorInfo(Console, Console->ActiveBuffer);
         return;
     case VK_DELETE:
         /* Remove character to right of cursor */
index 738d5bf..f538adc 100644 (file)
@@ -11,7 +11,7 @@
 
 #include "consrv.h"
 #include "include/conio.h"
-#include "include/conio2.h"
+#include "include/term.h"
 #include "include/settings.h"
 
 #include <stdio.h> // for swprintf
@@ -440,6 +440,11 @@ ConSrvGetDefaultSettings(IN OUT PCONSOLE_INFO ConsoleInfo,
     }
 }
 
+
+/*
+ * NOTE: This function explicitely references Console->ActiveBuffer.
+ * It is possible that it should go into some frontend...
+ */
 VOID
 ConSrvApplyUserSettings(IN PCONSOLE Console,
                         IN PCONSOLE_INFO ConsoleInfo)
@@ -534,7 +539,7 @@ ConSrvApplyUserSettings(IN PCONSOLE Console,
                     SizeChanged = TRUE;
             }
 
-            if (SizeChanged) ConioResizeTerminal(Console);
+            if (SizeChanged) TermResizeTerminal(Console);
         }
     }
     else // if (GetType(ActiveBuffer) == GRAPHICS_BUFFER)