shithub: puzzles

Download patch

ref: 26c669a6b2892b97b4a9bc6842f633291951fdbd
parent: d14999949c018255b5100a317ea1b7b9b74dfc6e
author: Simon Tatham <anakin@pobox.com>
date: Tue Sep 14 06:55:06 EDT 2010

Jonas Koelker reports that using the version of GTK currently in
Debian sid (2.20.1), there's a redraw problem when the window has a
different aspect ratio from the puzzle (due to resizing or
maximising): pieces of the window outside the real puzzle rectangle
don't get redrawn when exposed (e.g. by the drop-down menus).

Introduced code to explicitly redraw the whole exposed area,
including the parts that fall outside the pixmap. This makes the
problem go away in my hasty test install of sid, and doesn't seem to
affect the build on lenny.

[originally from svn r8997]

--- a/gtk.c
+++ b/gtk.c
@@ -411,6 +411,32 @@
 static void repaint_rectangle(frontend *fe, GtkWidget *widget,
 			      int x, int y, int w, int h)
 {
+    if (x < fe->ox) {
+	gdk_draw_rectangle(widget->window,
+			   widget->style->bg_gc[GTK_WIDGET_STATE(fe->area)],
+			   TRUE, x, y, fe->ox - x, h);
+	w -= (fe->ox - x);
+	x = fe->ox;
+    }
+    if (y < fe->oy) {
+	gdk_draw_rectangle(widget->window,
+			   widget->style->bg_gc[GTK_WIDGET_STATE(fe->area)],
+			   TRUE, x, y, w, fe->oy - y);
+	h -= (fe->oy - y);
+	y = fe->oy;
+    }
+    if (w > fe->pw) {
+	gdk_draw_rectangle(widget->window,
+			   widget->style->bg_gc[GTK_WIDGET_STATE(fe->area)],
+			   TRUE, x + fe->pw, y, w - fe->pw, h);
+	w = fe->pw;
+    }
+    if (h > fe->ph) {
+	gdk_draw_rectangle(widget->window,
+			   widget->style->bg_gc[GTK_WIDGET_STATE(fe->area)],
+			   TRUE, x, y + fe->ph, w, h - fe->ph);
+	h = fe->ph;
+    }
     gdk_draw_pixmap(widget->window,
 		    widget->style->fg_gc[GTK_WIDGET_STATE(fe->area)],
 		    fe->pixmap,