diff --git a/Console/retro/Console.cc b/Console/retro/Console.cc index db7ca63be8..f934146055 100644 --- a/Console/retro/Console.cc +++ b/Console/retro/Console.cc @@ -286,13 +286,12 @@ void Console::ProcessOSCseq(char c) return; } ++sequenceStep; - windowName=" "; + windowName=""; break; default: if(c==BEL) // The BEL character ends the sequence. { - windowName[0]=windowName.length(); - SetWTitle(win, (ConstStringPtr)windowName.c_str()); + setWindowName(windowName); OSCseq=false; isProcessingEscSequence=false; sequenceStep=0; diff --git a/Console/retro/Console.h b/Console/retro/Console.h index 6c08d6abd5..c30e7cb7b3 100644 --- a/Console/retro/Console.h +++ b/Console/retro/Console.h @@ -86,14 +86,15 @@ namespace retro short GetRows() const { return rows; } short GetCols() const { return cols; } + virtual void setWindowName(std::string newName) {}; + + void Idle(); bool IsEOF() const { return eof; } - protected: - std::string windowName; - WindowPtr win; private: + std::string windowName; GrafPtr consolePort = nullptr; Rect bounds; Attributes currentAttr; diff --git a/Console/retro/ConsoleWindow.cc b/Console/retro/ConsoleWindow.cc index db71f55258..5ff92023ba 100644 --- a/Console/retro/ConsoleWindow.cc +++ b/Console/retro/ConsoleWindow.cc @@ -36,8 +36,9 @@ ConsoleWindow::ConsoleWindow(Rect r, ConstStr255Param title) { GrafPtr port; //Retro68 Improved Console - windowName="Retro68 Console"; - win = NewWindow(NULL, &r, "\pRetro68 Console", true, 0, (WindowPtr)-1, true, 0); + win = NewWindow(NULL, &r, "\p", true, 0, (WindowPtr)-1, true, 0); + setWindowName("Retro68 Console"); + #if !TARGET_API_MAC_CARBON port = win; @@ -64,6 +65,14 @@ ConsoleWindow::~ConsoleWindow() DisposeWindow(win); } +void ConsoleWindow::setWindowName(std::string newName) +{ + newName=" "+newName; // Convert into Pascal string + newName[0]=newName.length(); + SetWTitle(win, (ConstStringPtr)newName.c_str()); +} + + char ConsoleWindow::WaitNextChar() { EventRecord event; diff --git a/Console/retro/ConsoleWindow.h b/Console/retro/ConsoleWindow.h index 1b787dc769..7756beff83 100644 --- a/Console/retro/ConsoleWindow.h +++ b/Console/retro/ConsoleWindow.h @@ -34,8 +34,10 @@ namespace retro public: ConsoleWindow(Rect r, ConstStr255Param title); ~ConsoleWindow(); + void setWindowName(std::string newName); + private: - //WindowPtr win; + WindowPtr win; virtual char WaitNextChar(); };