window.c
changeset 1867 8de1958719fe
parent 1744 1677a99b0daf
child 1891 92a3b0aa0946
--- a/window.c	Sat May 28 16:59:51 2005 +0000
+++ b/window.c	Sat May 28 17:01:26 2005 +0000
@@ -1541,13 +1541,11 @@
 void InvalidateWidget(Window *w, byte widget_index)
 {
 	const Widget *wi = &w->widget[widget_index];
-//	if (wi->left != -2) {
-		SetDirtyBlocks(
-			w->left + wi->left,
-			w->top + wi->top,
-			w->left + wi->right + 1,
-			w->top + wi->bottom + 1);
-//	}
+
+	/* Don't redraw the window if the widget is invisible or of no-type */
+	if (wi->type == WWT_EMPTY || HASBIT(w->hidden_state, widget_index)) return;
+
+	SetDirtyBlocks(w->left + wi->left, w->top + wi->top, w->left + wi->right + 1, w->top + wi->bottom + 1);
 }
 
 void InvalidateWindowWidget(byte cls, WindowNumber number, byte widget_index)