Skip to content

Commit

Permalink
Merge branch 'elfmz:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
deep-soft authored Jan 27, 2024
2 parents 5ef763c + d079cfe commit b0c7849
Show file tree
Hide file tree
Showing 42 changed files with 1,745 additions and 1,325 deletions.
4 changes: 2 additions & 2 deletions FARStdlib/src/fstd_FUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ SaveConsoleTitle::SaveConsoleTitle(BOOL rest /*= TRUE*/)
Usage = rest;
NeedToRestore = rest;
GET_TIME(LastChange);
WINPORT(GetConsoleTitle)(SaveTitle, ARRAYSIZE(SaveTitle));
WINPORT(GetConsoleTitle)(NULL, SaveTitle, ARRAYSIZE(SaveTitle));
Log(("TITLE: Save"));
}
SaveConsoleTitle::~SaveConsoleTitle()
Expand All @@ -35,7 +35,7 @@ void SaveConsoleTitle::Text(LPCSTR buff)
buff = _buff;
}
*/
WINPORT(SetConsoleTitle)(MB2Wide(buff).c_str());
WINPORT(SetConsoleTitle)(NULL, MB2Wide(buff).c_str());
}

void SaveConsoleTitle::Restore(void) {}
Expand Down
4 changes: 2 additions & 2 deletions FARStdlib/src/fstd_scr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void WINAPI FP_Screen::Save(void)

if (nSaveCount == 0) {
hScreen = FP_Info->SaveScreen(0, 0, -1, -1);
WINPORT(GetConsoleTitle)(SaveTitle, ARRAYSIZE(SaveTitle));
WINPORT(GetConsoleTitle)(NULL, SaveTitle, ARRAYSIZE(SaveTitle));
}

nSaveCount++;
Expand Down Expand Up @@ -52,7 +52,7 @@ void WINAPI FP_Screen::Restore(void)

if (nSaveCount == 0) {
Log(("SCREEN: RESTORE"));
WINPORT(SetConsoleTitle)(SaveTitle);
WINPORT(SetConsoleTitle)(NULL, SaveTitle);
FP_Info->RestoreScreen(hScreen);
FP_Info->Text(0, 0, 0, NULL);
hScreen = NULL;
Expand Down
25 changes: 15 additions & 10 deletions WinPort/WinPort.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@ extern "C" {
const wchar_t *WinPortBackend();

///console API
WINPORT_DECL(ForkConsole,HANDLE,(VOID));
WINPORT_DECL(JoinConsole,VOID,(HANDLE hConsole));

WINPORT_DECL(GetLargestConsoleWindowSize,COORD,(HANDLE hConsoleOutput));
WINPORT_DECL(SetConsoleWindowInfo,BOOL,(HANDLE hConsoleOutput, BOOL bAbsolute, const SMALL_RECT *lpConsoleWindow));
WINPORT_DECL(SetConsoleTitle,BOOL,(const WCHAR *title));
WINPORT_DECL(GetConsoleTitle,DWORD,(WCHAR *title, DWORD max_size));
WINPORT_DECL(SetConsoleTitle,BOOL,(HANDLE hConsoleOutput, const WCHAR *title));
WINPORT_DECL(GetConsoleTitle,DWORD,(HANDLE hConsoleOutput, WCHAR *title, DWORD max_size));
WINPORT_DECL(SetConsoleScreenBufferSize,BOOL,(HANDLE hConsoleOutput,COORD dwSize));
WINPORT_DECL(GetConsoleScreenBufferInfo,BOOL,(HANDLE hConsoleOutput,CONSOLE_SCREEN_BUFFER_INFO *lpConsoleScreenBufferInfo));
WINPORT_DECL(SetConsoleCursorPosition,BOOL,(HANDLE hConsoleOutput,COORD dwCursorPosition));
Expand All @@ -40,7 +43,7 @@ extern "C" {
WINPORT_DECL(WriteConsole,BOOL,(HANDLE hConsoleOutput, const WCHAR *lpBuffer, DWORD nNumberOfCharsToWrite, LPDWORD lpNumberOfCharsWritten, LPVOID lpReserved));
WINPORT_DECL(WriteConsoleOutput,BOOL,(HANDLE hConsoleOutput,const CHAR_INFO *lpBuffer,COORD dwBufferSize,COORD dwBufferCoord,PSMALL_RECT lpScreenRegion));
WINPORT_DECL(WriteConsoleOutputCharacter,BOOL,(HANDLE hConsoleOutput, const WCHAR *lpCharacter, DWORD nLength, COORD dwWriteCoord, LPDWORD lpNumberOfCharsWritten));
WINPORT_DECL(WaitConsoleInput, BOOL,(DWORD dwTimeout));
WINPORT_DECL(WaitConsoleInput, BOOL,(HANDLE hConsoleInput, DWORD dwTimeout));
WINPORT_DECL(ReadConsoleOutput, BOOL, (HANDLE hConsoleOutput, CHAR_INFO *lpBuffer, COORD dwBufferSize, COORD dwBufferCoord, PSMALL_RECT lpScreenRegion));
WINPORT_DECL(FillConsoleOutputAttribute, BOOL, (HANDLE hConsoleOutput, DWORD64 qAttributes, DWORD nLength, COORD dwWriteCoord, LPDWORD lpNumberOfAttrsWritten));
WINPORT_DECL(FillConsoleOutputCharacter, BOOL, (HANDLE hConsoleOutput, WCHAR cCharacter, DWORD nLength, COORD dwWriteCoord, LPDWORD lpNumberOfCharsWritten));
Expand All @@ -64,7 +67,7 @@ extern "C" {
WINPORT_DECL(SetConsoleDisplayMode,BOOL,(DWORD ModeFlags));
WINPORT_DECL(GetConsoleDisplayMode,BOOL,(LPDWORD lpModeFlags));
WINPORT_DECL(SetConsoleWindowMaximized,VOID,(BOOL Maximized));
WINPORT_DECL(GetConsoleColorPalette,BYTE,()); // Returns current color resolution: 4, 8, 24
WINPORT_DECL(GetConsoleColorPalette,BYTE,(HANDLE hConsoleOutput)); // Returns current color resolution: 4, 8, 24

WINPORT_DECL(GenerateConsoleCtrlEvent, BOOL, (DWORD dwCtrlEvent, DWORD dwProcessGroupId ));
WINPORT_DECL(SetConsoleCtrlHandler, BOOL, (PHANDLER_ROUTINE HandlerRoutine, BOOL Add ));
Expand Down Expand Up @@ -98,9 +101,9 @@ extern "C" {
WINPORT_DECL(IsConsoleActive, BOOL, ());
WINPORT_DECL(ConsoleDisplayNotification, VOID, (const WCHAR *title, const WCHAR *text));
WINPORT_DECL(ConsoleBackgroundMode, BOOL, (BOOL TryEnterBackgroundMode));
WINPORT_DECL(SetConsoleFKeyTitles, BOOL, (const CHAR **titles));
WINPORT_DECL(OverrideConsoleColor, VOID, (DWORD Index, DWORD *ColorFG, DWORD *ColorBK)); // 0xffffffff - to apply default color
WINPORT_DECL(SetConsoleRepaintsDefer, VOID, (BOOL Deferring));
WINPORT_DECL(SetConsoleFKeyTitles, BOOL, (HANDLE hConsoleOutput, const CHAR **titles));
WINPORT_DECL(OverrideConsoleColor, VOID, (HANDLE hConsoleOutput, DWORD Index, DWORD *ColorFG, DWORD *ColorBK)); // 0xffffffff - to apply default color
WINPORT_DECL(SetConsoleRepaintsDefer, VOID, (HANDLE hConsoleOutput, BOOL Deferring));

#ifdef WINPORT_REGISTRY
///registry API
Expand Down Expand Up @@ -322,13 +325,15 @@ template <class CHAR_T>

struct ConsoleRepaintsDeferScope
{
ConsoleRepaintsDeferScope()
HANDLE _con_out;

ConsoleRepaintsDeferScope(HANDLE hConOut) : _con_out(hConOut)
{
WINPORT(SetConsoleRepaintsDefer)(TRUE);
WINPORT(SetConsoleRepaintsDefer)(_con_out, TRUE);
}
~ConsoleRepaintsDeferScope()
{
WINPORT(SetConsoleRepaintsDefer)(FALSE);
WINPORT(SetConsoleRepaintsDefer)(_con_out, FALSE);
}
};

Expand Down
Loading

0 comments on commit b0c7849

Please sign in to comment.