screen_switcher between current and last screen

Setting the new config variable "screen_switcher_browser_only" to "no"
will make the "key_screen_switcher" key switch between the current and
the last used screen, sort of like the Alt+Tab window switching
mechanism in many window managers.

This (intendedly) works only for the "main" screens (playlist, browser,
media library, etc.) and not for info/lyrics/server info. Those screens
can be closed with the screen_switcher key, but the will not be
remembered.

indentation correction in config
This commit is contained in:
Frank Blendinger
2009-12-06 22:49:01 +01:00
committed by Andrzej Rybczak
parent 64f64895ac
commit b504b346af
27 changed files with 83 additions and 5 deletions

View File

@@ -73,6 +73,7 @@ using namespace MPD;
BasicScreen *Global::myScreen;
BasicScreen *Global::myOldScreen;
BasicScreen *Global::myPrevScreen;
Window *Global::wHeader;
Window *Global::wFooter;
@@ -276,6 +277,12 @@ int main(int argc, char *argv[])
wFooter->AddFDCallback(Mpd.GetFD(), StatusbarMPDCallback);
wFooter->CreateHistory();
// initialize screens to browser as default previous screen
myScreen = myBrowser;
myPrevScreen = myBrowser;
myOldScreen = myBrowser;
// go to playlist
myPlaylist->SwitchTo();
myPlaylist->UpdateTimer();
@@ -1915,10 +1922,20 @@ int main(int argc, char *argv[])
}
else if (Keypressed(input, Key.ScreenSwitcher))
{
if (myScreen == myPlaylist)
myBrowser->SwitchTo();
if (Config.screen_switcher_browser_only)
{
if (myScreen == myPlaylist)
myBrowser->SwitchTo();
else
myPlaylist->SwitchTo();
}
else
myPlaylist->SwitchTo();
{
if (myScreen->isTabbable())
myPrevScreen->SwitchTo();
else
myOldScreen->SwitchTo();
}
}
else if (Keypressed(input, Key.Playlist))
{