* in xterm function key mode we change which two...
*/
case GDK_KP_Add:
- if (inst->cfg.funky_type == 2) {
+ if (inst->cfg.funky_type == FUNKY_XTERM) {
if (event->state & GDK_SHIFT_MASK)
xkey = 'l';
else
break;
}
/* Reorder edit keys to physical order */
- if (inst->cfg.funky_type == 3 && code <= 6)
+ if (inst->cfg.funky_type == FUNKY_VT400 && code <= 6)
code = "\0\2\1\4\5\3\6"[code];
if (inst->term->vt52_mode && code > 0 && code <= 6) {
goto done;
}
- if (inst->cfg.funky_type == 5 && /* SCO function keys */
+ if (inst->cfg.funky_type == FUNKY_SCO && /* SCO function keys */
code >= 11 && code <= 34) {
char codes[] = "MNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz@[\\]^_`{";
int index = 0;
use_ucsoutput = FALSE;
goto done;
}
- if (inst->cfg.funky_type == 5 && /* SCO small keypad */
+ if (inst->cfg.funky_type == FUNKY_SCO && /* SCO small keypad */
code >= 1 && code <= 6) {
char codes[] = "HL.FIG";
if (code == 3) {
use_ucsoutput = FALSE;
goto done;
}
- if ((inst->term->vt52_mode || inst->cfg.funky_type == 4) &&
+ if ((inst->term->vt52_mode || inst->cfg.funky_type == FUNKY_VT100P) &&
code >= 11 && code <= 24) {
int offt = 0;
if (code > 15)
use_ucsoutput = FALSE;
goto done;
}
- if (inst->cfg.funky_type == 1 && code >= 11 && code <= 15) {
+ if (inst->cfg.funky_type == FUNKY_LINUX && code >= 11 && code <= 15) {
end = 1 + sprintf(output+1, "\x1B[[%c", code + 'A' - 11);
use_ucsoutput = FALSE;
goto done;
}
- if (inst->cfg.funky_type == 2 && code >= 11 && code <= 14) {
+ if (inst->cfg.funky_type == FUNKY_XTERM && code >= 11 && code <= 14) {
if (inst->term->vt52_mode)
end = 1 + sprintf(output+1, "\x1B%c", code + 'P' - 11);
else
*
* We are allowed to fiddle with the contents of `text'.
*/
-void do_text_internal(Context ctx, int x, int y, char *text, int len,
+void do_text_internal(Context ctx, int x, int y, wchar_t *text, int len,
unsigned long attr, int lattr)
{
struct draw_ctx *dctx = (struct draw_ctx *)ctx;
struct gui_data *inst = dctx->inst;
GdkGC *gc = dctx->gc;
-
+ int ncombining, combining;
int nfg, nbg, t, fontid, shadow, rlen, widefactor;
+ if (attr & TATTR_COMBINING) {
+ ncombining = len;
+ len = 1;
+ } else
+ ncombining = 1;
+
nfg = ((attr & ATTR_FGMASK) >> ATTR_FGSHIFT);
nfg = 2 * (nfg & 0xF) + (nfg & 0x10 ? 1 : 0);
nbg = ((attr & ATTR_BGMASK) >> ATTR_BGSHIFT);
shadow = 1;
}
- if (lattr != LATTR_NORM) {
+ if ((lattr & LATTR_MODE) != LATTR_NORM) {
x *= 2;
if (x >= inst->term->cols)
return;
wchar_t *wcs;
int i;
- wcs = snewn(len+1, wchar_t);
- for (i = 0; i < len; i++) {
- wcs[i] = (wchar_t) ((attr & CSET_MASK) + (text[i] & CHAR_MASK));
+ wcs = snewn(len*ncombining+1, wchar_t);
+ for (i = 0; i < len*ncombining; i++) {
+ wcs[i] = text[i];
}
if (inst->fonts[fontid] == NULL) {
* FIXME: when we have a wide-char equivalent of
* from_unicode, use it instead of this.
*/
- for (i = 0; i <= len; i++)
- gwcs[i] = wcs[i];
- gdk_draw_text_wc(inst->pixmap, inst->fonts[fontid], gc,
- x*inst->font_width+inst->cfg.window_border,
- y*inst->font_height+inst->cfg.window_border+inst->fonts[0]->ascent,
- gwcs, len*2);
+ for (combining = 0; combining < ncombining; combining++) {
+ for (i = 0; i <= len; i++)
+ gwcs[i] = wcs[i + combining];
+ gdk_draw_text_wc(inst->pixmap, inst->fonts[fontid], gc,
+ x*inst->font_width+inst->cfg.window_border,
+ y*inst->font_height+inst->cfg.window_border+inst->fonts[0]->ascent,
+ gwcs, len*2);
+ if (shadow)
+ gdk_draw_text_wc(inst->pixmap, inst->fonts[fontid], gc,
+ x*inst->font_width+inst->cfg.window_border+inst->cfg.shadowboldoffset,
+ y*inst->font_height+inst->cfg.window_border+inst->fonts[0]->ascent,
+ gwcs, len*2);
+ }
sfree(gwcs);
} else {
gcs = snewn(len+1, gchar);
- wc_to_mb(inst->fontinfo[fontid].charset, 0,
- wcs, len, gcs, len, ".", NULL, NULL);
- gdk_draw_text(inst->pixmap, inst->fonts[fontid], gc,
- x*inst->font_width+inst->cfg.window_border,
- y*inst->font_height+inst->cfg.window_border+inst->fonts[0]->ascent,
- gcs, len);
+ for (combining = 0; combining < ncombining; combining++) {
+ wc_to_mb(inst->fontinfo[fontid].charset, 0,
+ wcs + combining, len, gcs, len, ".", NULL, NULL);
+ gdk_draw_text(inst->pixmap, inst->fonts[fontid], gc,
+ x*inst->font_width+inst->cfg.window_border,
+ y*inst->font_height+inst->cfg.window_border+inst->fonts[0]->ascent,
+ gcs, len);
+ if (shadow)
+ gdk_draw_text(inst->pixmap, inst->fonts[fontid], gc,
+ x*inst->font_width+inst->cfg.window_border+inst->cfg.shadowboldoffset,
+ y*inst->font_height+inst->cfg.window_border+inst->fonts[0]->ascent,
+ gcs, len);
+ }
sfree(gcs);
}
sfree(wcs);
}
- if (shadow) {
- gdk_draw_text(inst->pixmap, inst->fonts[fontid], gc,
- x*inst->font_width+inst->cfg.window_border + inst->cfg.shadowboldoffset,
- y*inst->font_height+inst->cfg.window_border+inst->fonts[0]->ascent,
- text, len);
- }
-
if (attr & ATTR_UNDER) {
int uheight = inst->fonts[0]->ascent + 1;
if (uheight >= inst->font_height)
y*inst->font_height + uheight + inst->cfg.window_border);
}
- if (lattr != LATTR_NORM) {
+ if ((lattr & LATTR_MODE) != LATTR_NORM) {
/*
* I can't find any plausible StretchBlt equivalent in the
* X server, so I'm going to do this the slow and painful
len * inst->font_width - i, inst->font_height);
}
len *= 2;
- if (lattr != LATTR_WIDE) {
+ if ((lattr & LATTR_MODE) != LATTR_WIDE) {
int dt, db;
/* Now stretch vertically, in the same way. */
- if (lattr == LATTR_BOT)
+ if ((lattr & LATTR_MODE) == LATTR_BOT)
dt = 0, db = 1;
else
dt = 1, db = 0;
}
}
-void do_text(Context ctx, int x, int y, char *text, int len,
+void do_text(Context ctx, int x, int y, wchar_t *text, int len,
unsigned long attr, int lattr)
{
struct draw_ctx *dctx = (struct draw_ctx *)ctx;
widefactor = 1;
}
- if (lattr != LATTR_NORM) {
+ if ((lattr & LATTR_MODE) != LATTR_NORM) {
x *= 2;
if (x >= inst->term->cols)
return;
len*widefactor*inst->font_width, inst->font_height);
}
-void do_cursor(Context ctx, int x, int y, char *text, int len,
+void do_cursor(Context ctx, int x, int y, wchar_t *text, int len,
unsigned long attr, int lattr)
{
struct draw_ctx *dctx = (struct draw_ctx *)ctx;
struct gui_data *inst = dctx->inst;
GdkGC *gc = dctx->gc;
- int passive, widefactor;
+ int active, passive, widefactor;
if (attr & TATTR_PASCURS) {
attr &= ~TATTR_PASCURS;
passive = 0;
if ((attr & TATTR_ACTCURS) && inst->cfg.cursor_type != 0) {
attr &= ~TATTR_ACTCURS;
- }
+ active = 1;
+ } else
+ active = 0;
do_text_internal(ctx, x, y, text, len, attr, lattr);
if (attr & ATTR_WIDE) {
widefactor = 1;
}
- if (lattr != LATTR_NORM) {
+ if ((lattr & LATTR_MODE) != LATTR_NORM) {
x *= 2;
if (x >= inst->term->cols)
return;
int char_width;
- if ((attr & ATTR_WIDE) || lattr != LATTR_NORM)
+ if ((attr & ATTR_WIDE) || (lattr & LATTR_MODE) != LATTR_NORM)
char_width = 2*inst->font_width;
else
char_width = inst->font_width;
startx += dx;
starty += dy;
}
- } else {
+ } else if (active) {
gdk_draw_line(inst->pixmap, gc, startx, starty,
startx + (length-1) * dx, starty + (length-1) * dy);
- }
+ } /* else no cursor (e.g., blinked off) */
}
gdk_draw_pixmap(inst->area->window, gc, inst->pixmap,