- 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
#include "consrv.h"
#include "include/conio.h"
-#include "include/conio2.h"
+#include "include/term.h"
#include "handle.h"
#include "lineinput.h"
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,
#include "consrv.h"
#include "console.h"
#include "include/conio.h"
-#include "include/conio2.h"
+#include "include/term.h"
#include "conoutput.h"
#include "handle.h"
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
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);
if (ActiveBuffer)
{
ConioInitRect(&Region, 0, 0, ActiveBuffer->ViewSize.Y - 1, ActiveBuffer->ViewSize.X - 1);
- ConioDrawRegion(Console, &Region);
+ TermDrawRegion(Console, &Region);
}
}
{
PCONSOLE Console = Buffer->Header.Console;
Console->ActiveBuffer = Buffer;
- ConioResizeTerminal(Console);
- // ConioDrawConsole(Console);
+ // InterlockedExchangePointer(&Console->ActiveBuffer, Buffer);
+ TermSetActiveScreenBuffer(Console);
}
NTSTATUS NTAPI
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;
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;
}
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);
// 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;
}
#include "consrv.h"
#include "include/conio.h"
-#include "include/conio2.h"
+#include "include/term.h"
#include "handle.h"
#include "procinit.h"
#include "alias.h"
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;
}
{
}
+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,
DummySetCursorInfo,
DummySetScreenInfo,
DummyResizeTerminal,
+ DummySetActiveScreenBuffer,
+ DummyReleaseScreenBuffer,
DummyProcessKeyCallback,
DummyRefreshInternalInfo,
DummyChangeTitle,
#include "consrv.h"
#include "include/conio.h"
-#include "include/conio2.h"
+#include "include/term.h"
#include "conoutput.h"
#include "handle.h"
#include "consrv.h"
#include "include/conio.h"
-#include "include/conio2.h"
+#include "include/term.h"
#include "conoutput.h"
#include "handle.h"
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;
}
}
- ConioDrawRegion(Console, &CapturedWriteRegion);
+ TermDrawRegion(Console, &CapturedWriteRegion);
WriteRegion->Left = CapturedWriteRegion.Left;
WriteRegion->Top = CapturedWriteRegion.Top ;
if ((PCONSOLE_SCREEN_BUFFER)Buffer == Console->ActiveBuffer)
{
ConioComputeUpdateRect(Buffer, &UpdateRect, WriteCoord, NumCodesToWrite);
- ConioDrawRegion(Console, &UpdateRect);
+ TermDrawRegion(Console, &UpdateRect);
}
// EndCoord->X = X;
if ((PCONSOLE_SCREEN_BUFFER)Buffer == Console->ActiveBuffer)
{
ConioComputeUpdateRect(Buffer, &UpdateRect, WriteCoord, NumCodesToWrite);
- ConioDrawRegion(Console, &UpdateRect);
+ TermDrawRegion(Console, &UpdateRect);
}
// CodesWritten = Written; // NumCodesToWrite;
ASSERT(Console == Buffer->Header.Console);
Status = ConioResizeBuffer(Console, Buffer, *Size);
- if (NT_SUCCESS(Status)) ConioResizeTerminal(Console);
+ if (NT_SUCCESS(Status)) TermResizeTerminal(Console);
return Status;
}
if (ConioGetIntersection(&UpdateRegion, &UpdateRegion, &CapturedClipRectangle))
{
/* Draw update region */
- ConioDrawRegion(Console, &UpdateRegion);
+ TermDrawRegion(Console, &UpdateRegion);
}
}
#include "consrv.h"
#include "include/conio.h"
-#include "include/conio2.h"
+#include "include/term.h"
#include "handle.h"
#include "lineinput.h"
#include "consrv.h"
#include "console.h"
#include "include/conio.h"
-#include "include/conio2.h"
+#include "include/term.h"
#include "conoutput.h"
#include "handle.h"
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 */
#include "consrv.h"
#include "include/conio.h"
-#include "include/conio2.h"
+#include "include/term.h"
#include "handle.h"
#include "procinit.h"
#include "alias.h"
TitleRequest->Title,
TitleRequest->Length);
- if (NT_SUCCESS(Status)) ConioChangeTitle(Console);
+ if (NT_SUCCESS(Status)) TermChangeTitle(Console);
ConSrvReleaseConsole(Console, TRUE);
return Status;
#include "consrv.h"
#include "include/conio.h"
-#include "include/conio2.h"
+#include "include/term.h"
#include "conoutput.h"
#include "console.h"
#include "handle.h"
&Console, TRUE);
if (!NT_SUCCESS(Status)) return Status;
- GetDisplayModeRequest->DisplayMode = ConioGetDisplayMode(Console);
+ GetDisplayModeRequest->DisplayMode = TermGetDisplayMode(Console);
ConSrvReleaseConsole(Console, TRUE);
return STATUS_SUCCESS;
Console = Buff->Header.Console;
- if (ConioSetDisplayMode(Console, SetDisplayModeRequest->DisplayMode))
+ if (TermSetDisplayMode(Console, SetDisplayModeRequest->DisplayMode))
{
SetDisplayModeRequest->NewSBDim = Buff->ScreenBufferSize;
Status = STATUS_SUCCESS;
if (!NT_SUCCESS(Status)) return Status;
Console = Buff->Header.Console;
- ConioGetLargestConsoleWindowSize(Console, &GetLargestWindowSizeRequest->Size);
+ TermGetLargestConsoleWindowSize(Console, &GetLargestWindowSizeRequest->Size);
ConSrvReleaseScreenBuffer(Buff, TRUE);
return STATUS_SUCCESS;
Console = Buff->Header.Console;
- ShowCursorRequest->RefCount = ConioShowMouseCursor(Console, ShowCursorRequest->Show);
+ ShowCursorRequest->RefCount = TermShowMouseCursor(Console, ShowCursorRequest->Show);
ConSrvReleaseScreenBuffer(Buff, TRUE);
return STATUS_SUCCESS;
Console = Buff->Header.Console;
- Success = ConioSetMouseCursor(Console, SetCursorRequest->hCursor);
+ Success = TermSetMouseCursor(Console, SetCursorRequest->hCursor);
ConSrvReleaseScreenBuffer(Buff, TRUE);
return (Success ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL);
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;
&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);
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;
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);
{
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;
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;
#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)
/**************************************************************/
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,
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;
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);
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);
Success = FALSE;
goto Quit;
}
- ActiveBuffer = ConDrvGetActiveScreenBuffer(Console);
+ // ActiveBuffer = ConDrvGetActiveScreenBuffer(Console);
+ ActiveBuffer = GuiData->ActiveBuffer;
hDC = BeginPaint(GuiData->hWindow, &ps);
if (hDC != NULL &&
if (!ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE)) return;
- ActiveBuffer = ConDrvGetActiveScreenBuffer(Console);
+ // ActiveBuffer = ConDrvGetActiveScreenBuffer(Console);
+ ActiveBuffer = GuiData->ActiveBuffer;
if (Console->Selection.dwFlags & CONSOLE_SELECTION_IN_PROGRESS)
{
if (!ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE)) return;
- Buff = ConDrvGetActiveScreenBuffer(Console);
+ Buff = GuiData->ActiveBuffer; // ConDrvGetActiveScreenBuffer(Console);
if (GetType(Buff) == TEXTMODE_BUFFER)
{
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;
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)
{
{
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)
{
if (!ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE)) return;
- ActiveBuffer = ConDrvGetActiveScreenBuffer(Console);
+ // ActiveBuffer = ConDrvGetActiveScreenBuffer(Console);
+ ActiveBuffer = GuiData->ActiveBuffer;
GetScreenBufferSizeUnits(ActiveBuffer, GuiData, &WidthUnit, &HeightUnit);
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;
if (!ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE)) return 0;
- Buff = ConDrvGetActiveScreenBuffer(Console);
+ Buff = GuiData->ActiveBuffer; // ConDrvGetActiveScreenBuffer(Console);
if (uMsg == WM_HSCROLL)
{
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.
{
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);
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 */
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)
{
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);
}
{
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);
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,
return;
}
- ActiveBuffer = ConDrvGetActiveScreenBuffer(GuiData->Console);
+ // ActiveBuffer = ConDrvGetActiveScreenBuffer(GuiData->Console);
+ ActiveBuffer = GuiData->ActiveBuffer;
if (ActiveBuffer)
{
GetScreenBufferSizeUnits(ActiveBuffer, GuiData, &WidthUnit, &HeightUnit);
GuiSetCursorInfo,
GuiSetScreenInfo,
GuiResizeTerminal,
+ GuiSetActiveScreenBuffer,
+ GuiReleaseScreenBuffer,
GuiProcessKeyCallback,
GuiRefreshInternalInfo,
GuiChangeTitle,
#include "consrv.h"
#include "include/conio.h"
-#include "include/conio2.h"
+#include "include/term.h"
#include "coninput.h"
#define NDEBUG
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;
}
// /* 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
#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"
_InterlockedIncrement(&Console->ReferenceCount);
/* Update the internal info of the terminal */
- ConioRefreshInternalInfo(Console);
+ TermRefreshInternalInfo(Console);
return STATUS_SUCCESS;
}
_InterlockedIncrement(&Console->ReferenceCount);
/* Update the internal info of the terminal */
- ConioRefreshInternalInfo(Console);
+ TermRefreshInternalInfo(Console);
Status = STATUS_SUCCESS;
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);
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,
/*
* 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 */
* 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 *******************************************************************/
#include "consrv.h"
#include "console.h"
#include "include/conio.h"
-#include "include/conio2.h"
+#include "include/term.h"
#define NDEBUG
#include <debug.h>
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;
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 */
#include "consrv.h"
#include "include/conio.h"
-#include "include/conio2.h"
+#include "include/term.h"
#include "include/settings.h"
#include <stdio.h> // for swprintf
}
}
+
+/*
+ * 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)
SizeChanged = TRUE;
}
- if (SizeChanged) ConioResizeTerminal(Console);
+ if (SizeChanged) TermResizeTerminal(Console);
}
}
else // if (GetType(ActiveBuffer) == GRAPHICS_BUFFER)