Changeset 6171
- Timestamp:
- Nov 27, 2009, 12:30:29 PM (15 years ago)
- Location:
- code/branches/presentation2/src/libraries/core
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2/src/libraries/core/IOConsole.cc
r6141 r6171 51 51 { 52 52 level = (*text)[0]; 53 if (level == -1 || level >= 1 && level <= 6)53 if (level == -1 || (level >= 1 && level <= 6)) 54 54 { 55 55 *text = text->substr(1); … … 117 117 namespace orxonox 118 118 { 119 termios* IOConsole::originalTerminalSettings_s = 0; 120 119 121 namespace EscapeMode 120 122 { … … 133 135 , bStatusPrinted_(false) 134 136 , promptString_("orxonox # ") 135 , originalTerminalSettings_(new termios())136 137 { 137 138 this->setTerminalMode(); … … 168 169 169 170 resetTerminalMode(); 170 delete this->originalTerminalSettings_;171 171 this->shell_->destroy(); 172 172 … … 369 369 { 370 370 termios new_settings; 371 372 tcgetattr(0, this->originalTerminalSettings_); 373 new_settings = *this->originalTerminalSettings_; 371 IOConsole::originalTerminalSettings_s = new termios(); 372 373 tcgetattr(0, this->originalTerminalSettings_s); 374 new_settings = *this->originalTerminalSettings_s; 374 375 new_settings.c_lflag &= ~(ICANON | ECHO); 375 376 //new_settings.c_lflag |= (ISIG | IEXTEN); … … 377 378 new_settings.c_cc[VMIN] = 0; 378 379 tcsetattr(0, TCSANOW, &new_settings); 379 } 380 381 void IOConsole::resetTerminalMode() 382 { 383 tcsetattr(0, TCSANOW, IOConsole::originalTerminalSettings_); 380 atexit(&IOConsole::resetTerminalMode); 381 } 382 383 /*static*/ void IOConsole::resetTerminalMode() 384 { 385 if(IOConsole::originalTerminalSettings_s) 386 { 387 tcsetattr(0, TCSANOW, IOConsole::originalTerminalSettings_s); 388 delete IOConsole::originalTerminalSettings_s; 389 IOConsole::originalTerminalSettings_s = 0; 390 } 384 391 } 385 392 -
code/branches/presentation2/src/libraries/core/IOConsole.h
r6140 r6171 60 60 private: 61 61 void setTerminalMode(); 62 void resetTerminalMode();62 static void resetTerminalMode(); 63 63 void getTerminalSize(); 64 64 bool willPrintStatusLines(); … … 93 93 94 94 #ifdef ORXONOX_PLATFORM_UNIX 95 termios* originalTerminalSettings_;95 static termios* originalTerminalSettings_s; 96 96 #elif defined(ORXONOX_PLATFORM_WINDOWS) 97 97 void moveCursor(int dx, int dy);
Note: See TracChangeset
for help on using the changeset viewer.