diff options
author | Andrzej Rybczak <electricityispower@gmail.com> | 2012-09-15 22:27:50 +0200 |
---|---|---|
committer | Andrzej Rybczak <electricityispower@gmail.com> | 2012-09-15 22:58:32 +0200 |
commit | 14587cb4ec92f078b8f20cf717e7a4e92ae75c5c (patch) | |
tree | cd581d428066d2761c3ee5dde0bcf32ba433b43a /src/clock.cpp | |
parent | f7dba0a578d32677eebdeec76fa5c3204a933d20 (diff) |
abstract shared parts of switchTo methods away
Diffstat (limited to 'src/clock.cpp')
-rw-r--r-- | src/clock.cpp | 35 |
1 files changed, 10 insertions, 25 deletions
diff --git a/src/clock.cpp b/src/clock.cpp index 2ff31a0c..12970323 100644 --- a/src/clock.cpp +++ b/src/clock.cpp @@ -33,6 +33,7 @@ #include "status.h" #include "statusbar.h" #include "title.h" +#include "screen_switcher.h" using Global::MainHeight; using Global::MainStartY; @@ -76,36 +77,20 @@ void Clock::resize() void Clock::switchTo() { - using Global::myLockedScreen; - - if (myScreen == this) - return; - - if (myLockedScreen) - updateInactiveScreen(this); - size_t x_offset, width; getWindowResizeParams(x_offset, width, false); if (Width > width || Height > MainHeight) - { Statusbar::msg("Screen is too small to display clock"); - if (myLockedScreen) - updateInactiveScreen(myLockedScreen); - return; + else + { + SwitchTo::execute(this); + drawHeader(); + Prepare(); + m_pane.refresh(); + // clearing screen apparently fixes the problem with last digits being misrendered + w.clear(); + w.display(); } - - if (hasToBeResized || myLockedScreen) - resize(); - - if (myScreen != this && myScreen->isTabbable()) - Global::myPrevScreen = myScreen; - myScreen = this; - drawHeader(); - Prepare(); - m_pane.refresh(); - // clearing screen apparently fixes the problem with last digits being misrendered - w.clear(); - w.display(); } std::wstring Clock::title() |