shithub: puzzles

Download patch

ref: 4e5a0a3d67e95f515f8bef7cb9bbd103cab89aa7
parent: 2206a1aa25f783759cdf2336310357c33823dc21
author: Simon Tatham <anakin@pobox.com>
date: Sat May 1 03:53:53 EDT 2004

Wrap the status bar in a viewport, to avoid it expanding if the text
doesn't fit in it. This not only looked ugly, but caused unnecessary
calls to configure_area() and kept destroying the pixmap.

[originally from svn r4180]

--- a/gtk.c
+++ b/gtk.c
@@ -510,13 +510,25 @@
     }
 
     if (midend_wants_statusbar(fe->me)) {
+	GtkWidget *viewport;
+	GtkRequisition req;
+
+	viewport = gtk_viewport_new(NULL, NULL);
+	gtk_viewport_set_shadow_type(GTK_VIEWPORT(viewport), GTK_SHADOW_NONE);
 	fe->statusbar = gtk_statusbar_new();
-	gtk_box_pack_end(vbox, fe->statusbar, FALSE, FALSE, 0);
+	gtk_container_add(GTK_CONTAINER(viewport), fe->statusbar);
+	gtk_widget_show(viewport);
+	gtk_box_pack_end(vbox, viewport, FALSE, FALSE, 0);
 	gtk_widget_show(fe->statusbar);
 	fe->statusctx = gtk_statusbar_get_context_id
 	    (GTK_STATUSBAR(fe->statusbar), "game");
 	gtk_statusbar_push(GTK_STATUSBAR(fe->statusbar), fe->statusctx,
-			   "");
+			   "test");
+	gtk_widget_size_request(fe->statusbar, &req);
+#if 0
+	/* For GTK 2.0, should we be using gtk_widget_set_size_request? */
+#endif
+	gtk_widget_set_usize(viewport, x, req.height);
     } else
 	fe->statusbar = NULL;