diff --git a/src/ncmpcpp.cpp b/src/ncmpcpp.cpp index 168dc76d..0b0b88bd 100644 --- a/src/ncmpcpp.cpp +++ b/src/ncmpcpp.cpp @@ -186,9 +186,6 @@ int main(int argc, char *argv[]) gettimeofday(&now, 0); - // this type of casting is absolutely hillarious lol - Screen *&myWindow = *(Screen **)(void *)&myScreen; - while (!main_exit) { if (!Mpd->Connected()) @@ -246,10 +243,9 @@ int main(int argc, char *argv[]) // header stuff end myScreen->Update(); + myScreen->RefreshWindow(); + myScreen->ReadKey(input); - myWindow->Main()->Display(); - - myWindow->Main()->ReadKey(input); if (input == ERR) continue; diff --git a/src/screen.h b/src/screen.h index c847f3b4..51919583 100644 --- a/src/screen.h +++ b/src/screen.h @@ -43,6 +43,8 @@ class BasicScreen virtual void Update() { } virtual void Refresh() = 0; + virtual void RefreshWindow() = 0; + virtual void ReadKey(int &) = 0; virtual void Scroll(Where, const int * = 0) = 0; virtual void EnterPressed() { } @@ -70,6 +72,8 @@ template class Screen : public BasicScreen WindowType *&Main(); virtual void Refresh(); + virtual void RefreshWindow(); + virtual void ReadKey(int &input); virtual void Scroll(Where where, const int *); protected: @@ -91,6 +95,16 @@ template void Screen::Refresh() w->Display(); } +template void Screen::RefreshWindow() +{ + w->Display(); +} + +template void Screen::ReadKey(int &input) +{ + w->ReadKey(input); +} + template void Screen::Scroll(Where where, const int *key) { if (!Config.fancy_scrolling && key)