diff --git a/src/viewport.cpp b/src/viewport.cpp index f8b64ac85d..6a05d617af 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -369,6 +369,8 @@ static Point _vp_move_offs; static void DoSetViewportPosition(const Window *w, int left, int top, int width, int height) { + IncrementWindowUpdateNumber(); + FOR_ALL_WINDOWS_FROM_BACK_FROM(w, w) { if (left + width > w->left && w->left + w->width > left && diff --git a/src/window.cpp b/src/window.cpp index 06abc0d7a1..49146bed63 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -59,6 +59,8 @@ Window *_z_back_window = NULL; /** If false, highlight is white, otherwise the by the widget defined colour. */ bool _window_highlight_colour = false; +uint64 _window_update_number = 1; + /* * Window that currently has focus. - The main purpose is to generate * #FocusLost events, not to give next window in z-order focus when a @@ -3096,6 +3098,8 @@ void UpdateWindows() { Window *w; + _window_update_number++; + static int highlight_timer = 1; if (--highlight_timer == 0) { highlight_timer = 15; @@ -3138,6 +3142,8 @@ void UpdateWindows() NetworkDrawChatMessage(); /* Redraw mouse cursor in case it was hidden */ DrawMouseCursor(); + + _window_update_number++; } /** diff --git a/src/window_gui.h b/src/window_gui.h index 181ee52dbb..34eee26362 100644 --- a/src/window_gui.h +++ b/src/window_gui.h @@ -149,6 +149,18 @@ extern Window *_z_front_window; extern Window *_z_back_window; extern Window *_focused_window; +inline uint64 GetWindowUpdateNumber() +{ + extern uint64 _window_update_number; + return _window_update_number; +} + +inline void IncrementWindowUpdateNumber() +{ + extern uint64 _window_update_number; + _window_update_number++; +} + /** How do we the window to be placed? */ enum WindowPosition {