X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/085f4a68142a2add09fb1d0b97b4e330460f037b..5a9eb1056517b6ee6efa526a3a6b5a21aa802648:/unix/pterm.c diff --git a/unix/pterm.c b/unix/pterm.c index dcae55c5..dbcb5455 100644 --- a/unix/pterm.c +++ b/unix/pterm.c @@ -83,6 +83,23 @@ char *x_get_default(char *key) return XGetDefault(GDK_DISPLAY(), app_name, key); } +/* + * Default settings that are specific to pterm. + */ +char *platform_default_s(char *name) +{ + if (!strcmp(name, "Font")) + return "fixed"; /* COE_NORMAL works badly in an xterm */ + return NULL; +} + +int platform_default_i(char *name, int def) +{ + if (!strcmp(name, "CloseOnExit")) + return COE_ALWAYS; /* COE_NORMAL works badly in an xterm */ + return def; +} + void ldisc_update(void *frontend, int echo, int edit) { /* @@ -1590,7 +1607,22 @@ void do_text_internal(Context ctx, int x, int y, char *text, int len, * nothing at all; such is life. */ } else if (inst->fontinfo[fontid].is_wide) { - gwcs = smalloc(sizeof(GdkWChar) * (len+1)); + /* + * At least one version of gdk_draw_text_wc() has a + * weird bug whereby it reads `len' elements of the + * input string, but only draws `len/2'. Hence I'm + * going to make its input array twice as long as it + * theoretically needs to be, and pass in twice the + * actual number of characters. If a fixed gdk actually + * takes the doubled length seriously, then (a) the + * array will stand scrutiny up to the full length, (b) + * the spare elements of the array are full of zeroes + * which will probably be an empty glyph in the font, + * and (c) the clip rectangle should prevent it causing + * trouble anyway. + */ + gwcs = smalloc(sizeof(GdkWChar) * (len*2+1)); + memset(gwcs, 0, sizeof(GdkWChar) * (len*2+1)); /* * FIXME: when we have a wide-char equivalent of * from_unicode, use it instead of this.