Tiny manual CSE of previous commit.
[u/mdw/putty] / unix / gtkwin.c
index d6734f4..31d1331 100644 (file)
@@ -1352,7 +1352,7 @@ static void real_palette_set(struct gui_data *inst, int n, int r, int g, int b)
 
     gdk_colormap_free_colors(inst->colmap, inst->cols + n, 1);
     gdk_colormap_alloc_colors(inst->colmap, inst->cols + n, 1,
-                             FALSE, FALSE, success);
+                             FALSE, TRUE, success);
     if (!success[0])
        g_error("%s: couldn't allocate colour %d (#%02x%02x%02x)\n", appname,
                n, r, g, b);
@@ -1885,6 +1885,7 @@ void do_text_internal(Context ctx, int x, int y, wchar_t *text, int len,
     GdkGC *gc = dctx->gc;
     int ncombining, combining;
     int nfg, nbg, t, fontid, shadow, rlen, widefactor;
+    int monochrome = gtk_widget_get_visual(inst->area)->depth == 1;
 
     if (attr & TATTR_COMBINING) {
        ncombining = len;
@@ -1892,8 +1893,8 @@ void do_text_internal(Context ctx, int x, int y, wchar_t *text, int len,
     } else
        ncombining = 1;
 
-    nfg = ((attr & ATTR_FGMASK) >> ATTR_FGSHIFT);
-    nbg = ((attr & ATTR_BGMASK) >> ATTR_BGSHIFT);
+    nfg = ((monochrome ? ATTR_DEFFG : (attr & ATTR_FGMASK)) >> ATTR_FGSHIFT);
+    nbg = ((monochrome ? ATTR_DEFBG : (attr & ATTR_BGMASK)) >> ATTR_BGSHIFT);
     if (attr & ATTR_REVERSE) {
        t = nfg;
        nfg = nbg;