From 1c1d94343c5cb54122a5fe5fe46b1569437261e4 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Wed, 10 Sep 2014 13:51:44 +0200 Subject: [PATCH] Fix SetWidgetFont GTK This was testing for an empty font spec in the wrong way, with as a side effect that some pointers to font strings would be interpreted as colors. --- gtk/xoptions.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/gtk/xoptions.c b/gtk/xoptions.c index e144e3d..8b4c98a 100644 --- a/gtk/xoptions.c +++ b/gtk/xoptions.c @@ -263,7 +263,8 @@ int SetWidgetFont (GtkWidget *w, char *s) { PangoFontDescription *pfd; - if (!s || !*s || *s == '#') return 0; // no spec, empty spec or spec of color: fail + if (!s || *s == '#') return 0; // no spec, or spec of color: fail + if(!*(char**)s) return 1; // empty spec: do nothing, but succeed pfd = pango_font_description_from_string(*(char**)s); gtk_widget_modify_font(w, pfd); return 1; @@ -713,6 +714,7 @@ AddHandler (Option *opt, DialogClass dlg, int nr) g_signal_connect(opt->handle, "key-press-event", G_CALLBACK (TypeInProc), (gpointer) (dlg<<16 | (opt - dialogOptions[dlg]))); break; case 5: // game list +printf("use %s\n", appData.gameListFont); SetWidgetFont(opt->handle, (char*) &appData.gameListFont); g_signal_connect(opt->handle, "button-press-event", G_CALLBACK (GameListEvent), (gpointer) 0 ); case 4: // game-list filter -- 1.7.0.4