Add a monotonically incrementing counter to UpdateWindows calls
This is for checking draw cache validity
This commit is contained in:
@@ -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 &&
|
||||
|
@@ -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++;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -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 {
|
||||
|
Reference in New Issue
Block a user