hide/show: Provide feedback on unsupported platforms

develop
lethosor 2015-02-08 09:30:40 -05:00
parent a1691b6777
commit 15d3b7831f
4 changed files with 25 additions and 11 deletions

@ -864,12 +864,14 @@ void Console::msleep (unsigned int msec)
usleep((msec % 1000000) * 1000); usleep((msec % 1000000) * 1000);
} }
void Console::hide() bool Console::hide()
{ {
//Warmist: don't know if it's possible... //Warmist: don't know if it's possible...
return false;
} }
void Console::show() bool Console::show()
{ {
//Warmist: don't know if it's possible... //Warmist: don't know if it's possible...
return false;
} }

@ -590,12 +590,14 @@ void Console::msleep (unsigned int msec)
Sleep(msec); Sleep(msec);
} }
void Console::hide() bool Console::hide()
{ {
ShowWindow( GetConsoleWindow(), SW_HIDE ); ShowWindow( GetConsoleWindow(), SW_HIDE );
return true;
} }
void Console::show() bool Console::show()
{ {
ShowWindow( GetConsoleWindow(), SW_RESTORE ); ShowWindow( GetConsoleWindow(), SW_RESTORE );
return true;
} }

@ -790,11 +790,21 @@ command_result Core::runCommand(color_ostream &con, const std::string &first, ve
} }
else if(first=="hide") else if(first=="hide")
{ {
getConsole().hide(); if (!getConsole().hide())
{
con.printerr("Could not hide console\n");
return CR_FAILURE;
}
return CR_OK;
} }
else if(first=="show") else if(first=="show")
{ {
getConsole().show(); if (!getConsole().show())
{
con.printerr("Could not show console\n");
return CR_FAILURE;
}
return CR_OK;
} }
else else
{ {

@ -158,8 +158,8 @@ namespace DFHack
bool is_console() { return true; } bool is_console() { return true; }
void hide(); bool hide();
void show(); bool show();
private: private:
Private * d; Private * d;
tthread::recursive_mutex * wlock; tthread::recursive_mutex * wlock;