@@ -190,37 +190,37 @@ void resizeScreen(bool reload_main_window)
190190 using Global::MainHeight;
191191 using Global::wHeader;
192192 using Global::wFooter;
193-
193+
194194 // update internal screen dimensions
195195 if (reload_main_window)
196196 {
197197 rl_resize_terminal ();
198198 endwin ();
199199 refresh ();
200200 }
201-
201+
202202 MainHeight = LINES -(Config.design == Design::Alternative ? 7 : 4 );
203-
203+
204204 validateScreenSize ();
205-
205+
206206 if (!Config.header_visibility )
207207 MainHeight += 2 ;
208208 if (!Config.statusbar_visibility )
209209 ++MainHeight;
210-
210+
211211 setResizeFlags ();
212-
212+
213213 applyToVisibleWindows (&BaseScreen::resize);
214-
214+
215215 if (Config.header_visibility || Config.design == Design::Alternative)
216216 wHeader->resize (COLS , HeaderHeight);
217-
217+
218218 FooterStartY = LINES -(Config.statusbar_visibility ? 2 : 1 );
219219 wFooter->moveTo (0 , FooterStartY);
220220 wFooter->resize (COLS , Config.statusbar_visibility ? 2 : 1 );
221-
221+
222222 applyToVisibleWindows (&BaseScreen::refresh);
223-
223+
224224 Status::Changes::elapsedTime (false );
225225 Status::Changes::playerState ();
226226 // Note: routines for drawing separator if alternative user
@@ -301,6 +301,36 @@ BaseAction *get(const std::string &name)
301301 return result;
302302}
303303
304+ UpdateEnvironment::UpdateEnvironment ()
305+ : BaseAction(Type::UpdateEnvironment, " update_environment" )
306+ , m_past(boost::posix_time::from_time_t (0 ))
307+ { }
308+
309+ void UpdateEnvironment::run (bool update_timer, bool refresh_window)
310+ {
311+ using Global::Timer;
312+
313+ // update timer, status if necessary etc.
314+ Status::trace (update_timer, true );
315+
316+ // header stuff
317+ if ((myScreen == myPlaylist || myScreen == myBrowser || myScreen == myLyrics)
318+ && (Timer - m_past > boost::posix_time::milliseconds (500 ))
319+ )
320+ {
321+ drawHeader ();
322+ m_past = Timer;
323+ }
324+
325+ if (refresh_window)
326+ myScreen->refreshWindow ();
327+ }
328+
329+ void UpdateEnvironment::run ()
330+ {
331+ run (true , true );
332+ }
333+
304334bool MouseEvent::canBeRun ()
305335{
306336 return Config.mouse_support ;
@@ -2427,6 +2457,7 @@ void populateActions()
24272457 AvailableActions[static_cast <size_t >(a->type ())] = a;
24282458 };
24292459 insert_action (new Actions::Dummy ());
2460+ insert_action (new Actions::UpdateEnvironment ());
24302461 insert_action (new Actions::MouseEvent ());
24312462 insert_action (new Actions::ScrollUp ());
24322463 insert_action (new Actions::ScrollDown ());
0 commit comments