X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/35914df1ad94cf128cd0cd7fb8c5848b8ba156fc..5fb0e72d2051c29599c07c54af02960fa2e21fcb:/unix/gtkwin.c diff --git a/unix/gtkwin.c b/unix/gtkwin.c index d6734f4c..584ff1ec 100644 --- a/unix/gtkwin.c +++ b/unix/gtkwin.c @@ -189,6 +189,22 @@ int from_backend(void *frontend, int is_stderr, const char *data, int len) return term_data(inst->term, is_stderr, data, len); } +int from_backend_untrusted(void *frontend, const char *data, int len) +{ + struct gui_data *inst = (struct gui_data *)frontend; + return term_data_untrusted(inst->term, data, len); +} + +int get_userpass_input(prompts_t *p, unsigned char *in, int inlen) +{ + struct gui_data *inst = (struct gui_data *)p->frontend; + int ret; + ret = cmdline_get_passwd_input(p, in, inlen); + if (ret == -1) + ret = term_get_userpass_input(inst->term, p, in, inlen); + return ret; +} + void logevent(void *frontend, const char *string) { struct gui_data *inst = (struct gui_data *)frontend; @@ -1352,7 +1368,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,12 +1423,12 @@ 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; } @@ -1832,7 +1848,7 @@ void sys_cursor(void *frontend, int x, int y) * may want to perform additional actions on any kind of bell (for * example, taskbar flashing in Windows). */ -void beep(void *frontend, int mode) +void do_beep(void *frontend, int mode) { if (mode != BELL_VISUAL) gdk_beep(); @@ -1885,6 +1901,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 +1909,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 +1924,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; }