X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=unix%2Fgtkwin.c;h=6818fff85016369a23ad71c7a4122efb2f6f6c90;hb=49d2cf19accb059b3b68d1fc2b78e606a578c3e8;hp=2f4943d823742e5c81508b405107ae6b8875ec39;hpb=fb581ac62541bfe09ebbc1de07ef678998b9a539;p=PuTTY.git diff --git a/unix/gtkwin.c b/unix/gtkwin.c index 2f4943d8..6818fff8 100644 --- a/unix/gtkwin.c +++ b/unix/gtkwin.c @@ -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); @@ -1407,19 +1407,19 @@ void palette_reset(void *frontend) for (i = 0; i < NEXTCOLOURS; i++) { if (i < 216) { int r = i / 36, g = (i / 6) % 6, b = i % 6; - inst->cols[i+16].red = r * 0x3333; - inst->cols[i+16].green = g * 0x3333; - inst->cols[i+16].blue = b * 0x3333; + inst->cols[i+16].red = r ? r * 0x2828 + 0x3737 : 0; + inst->cols[i+16].green = g ? g * 0x2828 + 0x3737 : 0; + inst->cols[i+16].blue = b ? b + 0x2828 + 0x3737 : 0; } else { int shade = i - 216; - shade = (shade + 1) * 0xFFFF / (NEXTCOLOURS - 216 + 1); + shade = shade * 0x0a0a + 0x0808; inst->cols[i+16].red = inst->cols[i+16].green = inst->cols[i+16].blue = shade; } } gdk_colormap_alloc_colors(inst->colmap, inst->cols, NALLCOLOURS, - FALSE, FALSE, success); + FALSE, TRUE, success); for (i = 0; i < NALLCOLOURS; i++) { if (!success[i]) g_error("%s: couldn't allocate colour %d (#%02x%02x%02x)\n", @@ -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,9 +1893,9 @@ 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); - if (attr & ATTR_REVERSE) { + nfg = ((monochrome ? ATTR_DEFFG : (attr & ATTR_FGMASK)) >> ATTR_FGSHIFT); + nbg = ((monochrome ? ATTR_DEFBG : (attr & ATTR_BGMASK)) >> ATTR_BGSHIFT); + if (!!(attr & ATTR_REVERSE) ^ (monochrome && (attr & TATTR_ACTCURS))) { t = nfg; nfg = nbg; nbg = t; @@ -1907,7 +1908,7 @@ void do_text_internal(Context ctx, int x, int y, wchar_t *text, int len, if (nbg < 16) nbg |= 8; else if (nbg >= 256) nbg |= 1; } - if (attr & TATTR_ACTCURS) { + if ((attr & TATTR_ACTCURS) && !monochrome) { nfg = 260; nbg = 261; }