actions: toggle screen lock: check if screen is lockable before asking for width

This commit is contained in:
Andrzej Rybczak
2015-04-18 20:51:03 +02:00
parent ccad8fcf06
commit 7bcf79109f
20 changed files with 31 additions and 62 deletions

View File

@@ -1564,14 +1564,18 @@ void ToggleScreenLock::run()
{
using Global::wFooter;
using Global::myLockedScreen;
// FIXME: check if screen can be locked before prompting for width
if (myLockedScreen != 0)
const char *msg_unlockable_screen = "Current screen can't be locked";
if (myLockedScreen != nullptr)
{
BaseScreen::unlock();
Actions::setResizeFlags();
myScreen->resize();
Statusbar::print("Screen unlocked");
}
else if (!myScreen->isLockable())
{
Statusbar::print(msg_unlockable_screen);
}
else
{
unsigned part = Config.locked_screen_width_part*100;
@@ -1586,7 +1590,7 @@ void ToggleScreenLock::run()
if (myScreen->lock())
Statusbar::printf("Screen locked (with %1%%% width)", part);
else
Statusbar::print("Current screen can't be locked");
Statusbar::print(msg_unlockable_screen);
}
}