shithub: puzzles

Download patch

ref: 695b6be363115a0aefc5a25b93432d9362ad4cf7
parent: 7905d6dc07b5ba89fc3dfded3642fbcd599ae8e9
author: Simon Tatham <anakin@pobox.com>
date: Wed Jun 1 02:54:14 EDT 2005

Chris Emerson observed the same status-bar flicker under GTK as I
did under Windows, so here's his patch (blatantly copied from my own
fix in windows.c :-).

[originally from svn r5891]

--- a/gtk.c
+++ b/gtk.c
@@ -78,6 +78,7 @@
     GtkWidget *cfgbox;
     char *paste_data;
     int paste_data_len;
+    char *laststatus;
 };
 
 void get_random_seed(void **randseed, int *randseedsize)
@@ -103,9 +104,14 @@
     assert(fe->statusbar);
 
     rewritten = midend_rewrite_statusbar(fe->me, text);
-    gtk_statusbar_pop(GTK_STATUSBAR(fe->statusbar), fe->statusctx);
-    gtk_statusbar_push(GTK_STATUSBAR(fe->statusbar), fe->statusctx, rewritten);
-    sfree(rewritten);
+    if (!fe->laststatus || strcmp(rewritten, fe->laststatus)) {
+	gtk_statusbar_pop(GTK_STATUSBAR(fe->statusbar), fe->statusctx);
+	gtk_statusbar_push(GTK_STATUSBAR(fe->statusbar), fe->statusctx, rewritten);
+	sfree(fe->laststatus);
+	fe->laststatus = rewritten;
+    } else {
+	sfree(rewritten);
+    }
 }
 
 void start_draw(frontend *fe)
@@ -1203,6 +1209,8 @@
     fe->pixmap = NULL;
     fe->fonts = NULL;
     fe->nfonts = fe->fontsize = 0;
+
+    fe->laststatus = NULL;
 
     fe->paste_data = NULL;
     fe->paste_data_len = 0;