diff options
-rw-r--r-- | programs/xterm/XTerm.ad | 6 | ||||
-rw-r--r-- | programs/xterm/charproc.c | 334 | ||||
-rw-r--r-- | programs/xterm/fontutils.c | 200 | ||||
-rw-r--r-- | programs/xterm/input.c | 13 | ||||
-rw-r--r-- | programs/xterm/main.c | 14 | ||||
-rw-r--r-- | programs/xterm/main.h | 8 | ||||
-rw-r--r-- | programs/xterm/menu.c | 126 | ||||
-rw-r--r-- | programs/xterm/menu.h | 32 | ||||
-rw-r--r-- | programs/xterm/misc.c | 64 | ||||
-rw-r--r-- | programs/xterm/os2main.c | 8 | ||||
-rw-r--r-- | programs/xterm/ptydata.c | 258 | ||||
-rw-r--r-- | programs/xterm/ptyx.h | 68 | ||||
-rw-r--r-- | programs/xterm/screen.c | 110 | ||||
-rw-r--r-- | programs/xterm/util.c | 201 | ||||
-rwxr-xr-x | programs/xterm/uxterm | 4 | ||||
-rw-r--r-- | programs/xterm/version.h | 6 | ||||
-rwxr-xr-x | programs/xterm/vttests/resize.pl | 100 | ||||
-rwxr-xr-x | programs/xterm/vttests/tcapquery.pl | 149 | ||||
-rw-r--r-- | programs/xterm/xterm.h | 39 | ||||
-rw-r--r-- | programs/xterm/xterm.log.html | 59 | ||||
-rw-r--r-- | programs/xterm/xterm.man | 55 | ||||
-rw-r--r-- | programs/xterm/xterm_io.h | 4 | ||||
-rw-r--r-- | programs/xterm/xtermcfg.hin | 5 |
23 files changed, 1470 insertions, 393 deletions
diff --git a/programs/xterm/XTerm.ad b/programs/xterm/XTerm.ad index f3a71bb82..2d60ef54b 100644 --- a/programs/xterm/XTerm.ad +++ b/programs/xterm/XTerm.ad @@ -3,7 +3,7 @@ ! ! ! -! $XFree86: xc/programs/xterm/XTerm.ad,v 3.25 2003/09/21 17:12:44 dickey Exp $ +! $XFree86: xc/programs/xterm/XTerm.ad,v 3.26 2003/10/27 01:07:56 dickey Exp $ *SimpleMenu*BackingStore: NotUseful *SimpleMenu*menuLabel.font: -adobe-helvetica-bold-r-normal--*-120-*-*-*-*-iso8859-* @@ -81,11 +81,13 @@ *fontMenu*font6*Label: Huge *VT100*font6: 10x20 *fontMenu*fontescape*Label: Escape Sequence -*fontMenu*fontsel*Label: Selection +*fontMenu*fontsel*Label: Selection !fontescape and fontsel overridden by application *fontMenu*font-linedrawing*Label: Line-Drawing Characters *fontMenu*font-doublesize*Label: Doublesized Characters *fontMenu*font-loadable*Label: VT220 Soft Fonts +*fontMenu*render-font*Label: TrueType Fonts +*fontMenu*utf8-mode*Label: UTF-8 *VT100.utf8Fonts.font2: -misc-fixed-medium-r-normal--8-80-75-75-c-50-iso10646-1 *VT100.utf8Fonts.font: -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1 diff --git a/programs/xterm/charproc.c b/programs/xterm/charproc.c index bb9a6bf5b..b9015299b 100644 --- a/programs/xterm/charproc.c +++ b/programs/xterm/charproc.c @@ -2,11 +2,11 @@ * $Xorg: charproc.c,v 1.6 2001/02/09 02:06:02 xorgcvs Exp $ */ -/* $XFree86: xc/programs/xterm/charproc.c,v 3.151 2003/11/28 00:49:17 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/charproc.c,v 3.152 2003/12/31 17:12:26 dickey Exp $ */ /* -Copyright 1999-2002,2003 by Thomas E. Dickey +Copyright 1999-2003,2004 by Thomas E. Dickey All Rights Reserved @@ -154,8 +154,8 @@ static void savemodes(XtermWidget termw); static void unparseputn(unsigned int n, int fd); static void window_ops(XtermWidget termw); -#if OPT_BLINK_CURS -static void BlinkCursor(XtPointer closure, XtIntervalId * id); +#if OPT_BLINK_CURS || OPT_BLINK_TEXT +static void HandleBlinking(XtPointer closure, XtIntervalId * id); static void StartBlinking(TScreen * screen); static void StopBlinking(TScreen * screen); #else @@ -356,6 +356,9 @@ static XtActionsRec actionsList[] = { #if OPT_READLINE { "readline-button", ReadLineButton }, #endif +#if OPT_RENDERFONT + { "set-render-font", HandleRenderFont }, +#endif #if OPT_SCO_FUNC_KEYS { "set-sco-function-keys", HandleScoFunctionKeys }, #endif @@ -371,6 +374,9 @@ static XtActionsRec actionsList[] = { { "tek-reset", HandleTekReset }, { "tek-copy", HandleTekCopy }, #endif +#if OPT_WIDE_CHARS + { "set-utf8-mode", HandleUTF8Mode }, +#endif }; /* *INDENT-ON* */ @@ -389,7 +395,7 @@ static XtResource resources[] = Bres(XtNappkeypadDefault, XtCAppkeypadDefault, misc.appkeypadDefault, FALSE), Bres(XtNautoWrap, XtCAutoWrap, misc.autoWrap, TRUE), Bres(XtNawaitInput, XtCAwaitInput, screen.awaitInput, FALSE), - Bres(XtNfreeBoldBox, XtCBoolean, screen.free_bold_box, FALSE), + Bres(XtNfreeBoldBox, XtCFreeBoldBox, screen.free_bold_box, FALSE), Bres(XtNbackarrowKey, XtCBackarrowKey, screen.backarrow_key, TRUE), Bres(XtNboldMode, XtCBoldMode, screen.bold_mode, TRUE), Bres(XtNbrokenSelections, XtCBrokenSelections, screen.brokenSelections, FALSE), @@ -482,12 +488,20 @@ static XtResource resources[] = #if OPT_BLINK_CURS Bres(XtNcursorBlink, XtCCursorBlink, screen.cursor_blink, FALSE), - Ires(XtNcursorOnTime, XtCCursorOnTime, screen.cursor_on, 600), - Ires(XtNcursorOffTime, XtCCursorOffTime, screen.cursor_off, 300), +#endif + +#if OPT_BLINK_CURS + Bres(XtNshowBlinkAsBold, XtCCursorBlink, screen.blink_as_bold, DEFBLINKASBOLD), +#endif + +#if OPT_BLINK_CURS || OPT_BLINK_TEXT + Ires(XtNcursorOnTime, XtCCursorOnTime, screen.blink_on, 600), + Ires(XtNcursorOffTime, XtCCursorOffTime, screen.blink_off, 300), #endif #if OPT_BOX_CHARS - Bres(XtNforceBoxChars, XtCBoolean, screen.force_box_chars, FALSE), + Bres(XtNforceBoxChars, XtCForceBoxChars, screen.force_box_chars, FALSE), + Bres(XtNshowMissingGlyphs, XtCShowMissingGlyphs, screen.force_all_chars, FALSE), #endif #if OPT_BROKEN_OSC @@ -622,9 +636,11 @@ static XtResource resources[] = Bres(XtNrightScrollBar, XtCRightScrollBar, misc.useRight, FALSE), #endif -#ifdef XRENDERFONT +#if OPT_RENDERFONT Ires(XtNfaceSize, XtCFaceSize, misc.face_size, DEFFACESIZE), Sres(XtNfaceName, XtCFaceName, misc.face_name, DEFFACENAME), + Sres(XtNfaceNameDoublesize, XtCFaceNameDoublesize, misc.face_wide_name, DEFFACENAME), + Bres(XtNrenderFont, XtCRenderFont, misc.render_font, TRUE), #endif }; @@ -928,6 +944,25 @@ set_ansi_conformance(TScreen * screen, int level) XSelectInput(XtDisplay((t)), XtWindow((t)), (s)->event_mask); \ } +#define WriteNow() { \ + unsigned single = 0; \ + \ + if (screen->curss) { \ + dotext(screen, \ + screen->gsets[(int) (screen->curss)], \ + print_area, 1); \ + screen->curss = 0; \ + single++; \ + } \ + if (print_used > single) { \ + dotext(screen, \ + screen->gsets[(int) (screen->curgl)], \ + print_area + single, \ + print_used - single); \ + } \ + print_used = 0; \ + } \ + extern int last_written_col, last_written_row; static void @@ -984,22 +1019,9 @@ VTparse(void) #if OPT_WIDE_CHARS if (screen->wide_chars && my_wcwidth(c) == 0) { - unsigned single = 0; int prev, precomposed; - if (screen->curss) { - dotext(screen, screen->gsets[(int) (screen->curss)], - print_area, 1); - screen->curss = 0; - single++; - } - if (print_used > single) { - dotext(screen, - screen->gsets[(int) (screen->curgl)], - print_area + single, - print_used - single); - } - print_used = 0; + WriteNow(); prev = getXtermCell(screen, last_written_row, last_written_col); precomposed = do_precomposition(prev, c); @@ -1146,22 +1168,7 @@ VTparse(void) the buffer and draw it now */ if (iswide(c) != last_was_wide) { - unsigned single = 0; - - if (screen->curss) { - dotext(screen, - screen->gsets[(int) (screen->curss)], - print_area, 1); - screen->curss = 0; - single++; - } - if (print_used > single) { - dotext(screen, - screen->gsets[(int) (screen->curgl)], - print_area + single, - print_used - single); - } - print_used = 0; + WriteNow(); } #endif @@ -1199,22 +1206,7 @@ VTparse(void) if (nextstate == CASE_PRINT || (laststate == CASE_PRINT && print_used)) { - unsigned single = 0; - - if (screen->curss) { - dotext(screen, - screen->gsets[(int) (screen->curss)], - print_area, 1); - screen->curss = 0; - single++; - } - if (print_used > single) { - dotext(screen, - screen->gsets[(int) (screen->curgl)], - print_area + single, - print_used - single); - } - print_used = 0; + WriteNow(); } /* @@ -1723,6 +1715,7 @@ VTparse(void) break; case 5: /* Blink */ term->flags |= BLINK; + StartBlinking(screen); if_OPT_ISO_COLORS(screen, { setExtendedFG(); }); @@ -2482,16 +2475,15 @@ VTparse(void) case CASE_UTF8: /* If we did not set UTF-8 mode from resource or the * command-line, allow it to be enabled/disabled by - * control sequence. To keep the logic simple, require - * that wide_chars have been set during initialization - * so that we have been maintaining data structures for - * wide characters, anyway. Otherwise we would have to - * reallocate everything the first time we turned UTF-8 - * mode on. + * control sequence. */ + if (!screen->wide_chars) { + WriteNow(); + ChangeToWide(screen); + } if (screen->wide_chars && screen->utf8_mode != 2) { - screen->utf8_mode = (c == 'G'); + switchPtyData(screen, &VTbuffer, c == 'G'); TRACE(("UTF8 mode %s\n", screen->utf8_mode ? "ON" : "OFF")); } else { @@ -2810,7 +2802,7 @@ in_put(void) #define TICK (1000/8) #define MIN(a,b) (((a)<(b))?(a):(b)) #define MAX(a,b) (((a)>(b))?(a):(b)) - int tick = MAX(1, MIN(screen->cursor_on, screen->cursor_off)) * TICK; + int tick = MAX(1, MIN(screen->blink_on, screen->blink_off)) * TICK; #endif for (;;) { @@ -2877,7 +2869,7 @@ in_put(void) select_timeout.tv_usec = 50000; time_select = 1; #if OPT_BLINK_CURS - } else if ((screen->cursor_blink && + } else if ((screen->blink_timer != 0 && ((screen->select & FOCUS) || screen->always_highlight)) || (screen->cursor_state == BLINKED_OFF)) { select_timeout.tv_usec = tick; @@ -3305,7 +3297,9 @@ SetCursorBlink(register TScreen * screen, int enable) StartBlinking(screen); } else { screen->cursor_blink = FALSE; +#if !OPT_BLINK_TEXT StopBlinking(screen); +#endif } update_cursorblink(); } @@ -4342,7 +4336,10 @@ VTRun(void) screen->cursor_state = OFF; screen->cursor_set = ON; - StartBlinking(screen); +#if OPT_BLINK_CURS + if (screen->cursor_blink) + StartBlinking(screen); +#endif initPtyData(&VTbuffer); #if OPT_TEK4014 @@ -4746,6 +4743,7 @@ VTInitialize(Widget wrequest, #if OPT_BOX_CHARS init_Bres(screen.force_box_chars); + init_Bres(screen.force_all_chars); #endif init_Bres(screen.free_bold_box); @@ -4762,8 +4760,11 @@ VTInitialize(Widget wrequest, init_Cres(screen.cursorcolor); #if OPT_BLINK_CURS init_Bres(screen.cursor_blink); - init_Ires(screen.cursor_on); - init_Ires(screen.cursor_off); + init_Ires(screen.blink_on); + init_Ires(screen.blink_off); +#endif +#if OPT_BLINK_CURS + init_Ires(screen.blink_as_bold); #endif init_Ires(screen.border); init_Bres(screen.jumpscroll); @@ -4989,6 +4990,13 @@ VTInitialize(Widget wrequest, init_Sres(misc.localefilter); #endif +#if OPT_RENDERFONT + init_Ires(misc.face_size); + init_Sres(misc.face_name); + init_Sres(misc.face_wide_name); + init_Bres(misc.render_font); +#endif + init_Bres(screen.vt100_graphics); init_Bres(screen.wide_chars); init_Bres(misc.cjk_width); @@ -5007,11 +5015,6 @@ VTInitialize(Widget wrequest, init_Bres(screen.bold_mode); init_Bres(screen.underline); -#ifdef XRENDERFONT - wnew->screen.renderFont = 0; - wnew->screen.renderFontBold = 0; - wnew->screen.renderDraw = 0; -#endif wnew->cur_foreground = 0; wnew->cur_background = 0; @@ -5667,6 +5670,8 @@ VTSetValues(Widget cur, return refresh_needed; } +#define setGC(value) set_at = __LINE__, currentGC = value + /* * Shows cursor at new cursor position in screen. */ @@ -5678,6 +5683,7 @@ ShowCursor(void) Char clo; int fg_bg = 0; GC currentGC; + int set_at; Boolean in_selection; Boolean reversed; Pixel fg_pix; @@ -5784,12 +5790,12 @@ ShowCursor(void) if (screen->select || screen->always_highlight) { if (reversed) { /* text is reverse video */ if (screen->cursorGC) { - currentGC = screen->cursorGC; + setGC(screen->cursorGC); } else { - if (flags & (BOLD | BLINK)) { - currentGC = NormalBoldGC(screen); + if (flags & BOLDATTR(screen)) { + setGC(NormalBoldGC(screen)); } else { - currentGC = NormalGC(screen); + setGC(NormalGC(screen)); } } #if OPT_HIGHLIGHT_COLOR @@ -5804,12 +5810,12 @@ ShowCursor(void) EXCHANGE(fg_pix, bg_pix, tmp) } else { /* normal video */ if (screen->reversecursorGC) { - currentGC = screen->reversecursorGC; + setGC(screen->reversecursorGC); } else { - if (flags & (BOLD | BLINK)) { - currentGC = ReverseBoldGC(screen); + if (flags & BOLDATTR(screen)) { + setGC(ReverseBoldGC(screen)); } else { - currentGC = ReverseGC(screen); + setGC(ReverseGC(screen)); } } } @@ -5828,47 +5834,52 @@ ShowCursor(void) fg_pix = hi_pix; } #endif - currentGC = ReverseGC(screen); + setGC(ReverseGC(screen)); XSetForeground(screen->display, currentGC, bg_pix); XSetBackground(screen->display, currentGC, fg_pix); } else { /* normal video */ - currentGC = NormalGC(screen); + setGC(NormalGC(screen)); XSetForeground(screen->display, currentGC, fg_pix); XSetBackground(screen->display, currentGC, bg_pix); } } - TRACE(("ShowCursor calling drawXtermText cur(%d,%d)\n", - screen->cur_row, screen->cur_col)); + if (screen->cursor_busy == 0 + && (screen->cursor_state != ON || screen->cursor_GC != set_at)) { - drawXtermText(screen, flags & DRAWX_MASK, currentGC, - x = CurCursorX(screen, screen->cur_row, cursor_col), - y = CursorY(screen, screen->cur_row), - curXtermChrSet(screen->cur_row), - PAIRED_CHARS(&clo, &chi), 1, 0); + screen->cursor_GC = set_at; + TRACE(("ShowCursor calling drawXtermText cur(%d,%d)\n", + screen->cur_row, screen->cur_col)); -#if OPT_WIDE_CHARS - if (c1l || c1h) { - drawXtermText(screen, (flags & DRAWX_MASK) | NOBACKGROUND, - currentGC, x, y, + drawXtermText(screen, flags & DRAWX_MASK, currentGC, + x = CurCursorX(screen, screen->cur_row, cursor_col), + y = CursorY(screen, screen->cur_row), curXtermChrSet(screen->cur_row), - PAIRED_CHARS(&c1l, &c1h), 1, iswide(base)); + PAIRED_CHARS(&clo, &chi), 1, 0); - if (c2l || c2h) +#if OPT_WIDE_CHARS + if (c1l || c1h) { drawXtermText(screen, (flags & DRAWX_MASK) | NOBACKGROUND, currentGC, x, y, curXtermChrSet(screen->cur_row), - PAIRED_CHARS(&c2l, &c2h), 1, iswide(base)); - } + PAIRED_CHARS(&c1l, &c1h), 1, iswide(base)); + + if (c2l || c2h) + drawXtermText(screen, (flags & DRAWX_MASK) | NOBACKGROUND, + currentGC, x, y, + curXtermChrSet(screen->cur_row), + PAIRED_CHARS(&c2l, &c2h), 1, iswide(base)); + } #endif - if (!screen->select && !screen->always_highlight) { - screen->box->x = x; - screen->box->y = y; - XDrawLines(screen->display, VWindow(screen), - screen->cursoroutlineGC ? screen->cursoroutlineGC - : currentGC, - screen->box, NBOX, CoordModePrevious); + if (!screen->select && !screen->always_highlight) { + screen->box->x = x; + screen->box->y = y; + XDrawLines(screen->display, VWindow(screen), + screen->cursoroutlineGC ? screen->cursoroutlineGC + : currentGC, + screen->box, NBOX, CoordModePrevious); + } } screen->cursor_state = ON; } @@ -5991,57 +6002,126 @@ HideCursor(void) resetXtermGC(screen, flags, in_selection); } -#if OPT_BLINK_CURS +#if OPT_BLINK_CURS || OPT_BLINK_TEXT static void StartBlinking(TScreen * screen) { - if (screen->cursor_blink - && screen->cursor_timer == 0) { + if (screen->blink_timer == 0) { unsigned long interval = (screen->cursor_state == ON ? - screen->cursor_on : screen->cursor_off); + screen->blink_on : screen->blink_off); if (interval == 0) /* wow! */ interval = 1; /* let's humor him anyway */ - screen->cursor_timer = XtAppAddTimeOut(app_con, - interval, - BlinkCursor, - screen); + screen->blink_timer = XtAppAddTimeOut(app_con, + interval, + HandleBlinking, + screen); } } static void StopBlinking(TScreen * screen) { - if (screen->cursor_timer) - XtRemoveTimeOut(screen->cursor_timer); - screen->cursor_timer = 0; + if (screen->blink_timer) + XtRemoveTimeOut(screen->blink_timer); + screen->blink_timer = 0; } +#if OPT_BLINK_TEXT +static Bool +ScrnHasBlinking(TScreen * screen, int row) +{ + Char *attrs = SCRN_BUF_ATTRS(screen, row); + int col; + Bool result = False; + + for (col = 0; col < screen->max_col; ++col) { + if (attrs[col] & BLINK) { + result = True; + break; + } + } + return result; +} +#endif + /* * Blink the cursor by alternately showing/hiding cursor. We leave the timer * running all the time (even though that's a little inefficient) to make the * logic simple. */ static void -BlinkCursor(XtPointer closure, XtIntervalId * id GCC_UNUSED) +HandleBlinking(XtPointer closure, XtIntervalId * id GCC_UNUSED) { TScreen *screen = (TScreen *) closure; + Bool resume = False; - screen->cursor_timer = 0; - if (screen->cursor_state == ON) { - if (screen->select || screen->always_highlight) { - HideCursor(); + screen->blink_timer = 0; + screen->blink_state = !screen->blink_state; + +#if OPT_BLINK_CURS + if (screen->cursor_blink) { + if (screen->cursor_state == ON) { + if (screen->select || screen->always_highlight) { + HideCursor(); + if (screen->cursor_state == OFF) + screen->cursor_state = BLINKED_OFF; + } + } else if (screen->cursor_state == BLINKED_OFF) { + screen->cursor_state = OFF; + ShowCursor(); if (screen->cursor_state == OFF) screen->cursor_state = BLINKED_OFF; } - } else if (screen->cursor_state == BLINKED_OFF) { - screen->cursor_state = OFF; - ShowCursor(); - if (screen->cursor_state == OFF) - screen->cursor_state = BLINKED_OFF; + resume = True; } - StartBlinking(screen); +#endif + +#if OPT_BLINK_TEXT + /* + * Inspect the line on the current screen to see if any have the BLINK flag + * associated with them. Prune off any that have had the corresponding + * cells reset. If any are left, repaint those lines with ScrnRefresh(). + */ + { + int row; + int first_row = screen->max_row; + int last_row = -1; + + for (row = screen->max_row; row >= 0; row--) { + if (ScrnTstBlinked(screen, row)) { + if (ScrnHasBlinking(screen, row)) { + resume = True; + if (row > last_row) + last_row = row; + if (row < first_row) + first_row = row; + } else { + ScrnClrBlinked(screen, row); + } + } + } + /* + * FIXME: this could be a little more efficient, e.g,. by limiting the + * columns which are updated. + */ + if (first_row <= last_row) { + ScrnRefresh(screen, + first_row, + 0, + last_row + 1 - first_row, + screen->max_col, + True); + } + } +#endif + + /* + * If either the cursor or text is blinking, restart the timer. + */ + if (resume) + StartBlinking(screen); } -#endif /* OPT_BLINK_CURS */ +#endif /* OPT_BLINK_CURS || OPT_BLINK_TEXT */ /* * Implement soft or hard (full) reset of the VTxxx emulation. There are a diff --git a/programs/xterm/fontutils.c b/programs/xterm/fontutils.c index 4b6900f1e..193721c07 100644 --- a/programs/xterm/fontutils.c +++ b/programs/xterm/fontutils.c @@ -1,10 +1,10 @@ /* - * $XFree86: xc/programs/xterm/fontutils.c,v 1.43 2003/12/31 17:12:28 dickey Exp $ + * $XFree86: xc/programs/xterm/fontutils.c,v 1.44 2004/01/09 00:10:32 dickey Exp $ */ /************************************************************ -Copyright 1998-2002,2003 by Thomas E. Dickey +Copyright 1998-2003,2004 by Thomas E. Dickey All Rights Reserved @@ -513,7 +513,7 @@ is_double_width_font(XFontStruct * fs) #define is_double_width_font(fs) 0 #endif -#if OPT_WIDE_CHARS && defined(XRENDERFONT) && defined(HAVE_TYPE_FCCHAR32) +#if OPT_WIDE_CHARS && OPT_RENDERFONT && defined(HAVE_TYPE_FCCHAR32) #define HALF_WIDTH_TEST_STRING "1234567890" /* '1234567890' in Chinese characters in UTF-8 */ @@ -859,8 +859,8 @@ xtermLoadFont(TScreen * screen, * characters. Check that they are all present. The null character * (0) is special, and is not used. */ -#ifdef XRENDERFONT - if (screen->renderFont != 0) { +#if OPT_RENDERFONT + if (term->misc.render_font) { /* * FIXME: we shouldn't even be here if we're using Xft. */ @@ -1093,6 +1093,17 @@ xtermSetCursorBox(TScreen * screen) screen->box = VTbox; } +#define CACHE_XFT(dst,src) if (src != 0) {\ + dst[fontnum] = src;\ + TRACE(("%s[%d] = %d (%d,%d) by %d\n",\ + #dst,\ + fontnum,\ + src->height,\ + src->ascent,\ + src->descent,\ + src->max_advance_width));\ + } + /* * Compute useful values for the font/window sizes */ @@ -1104,55 +1115,135 @@ xtermComputeFontInfo(TScreen * screen, { int i, j, width, height; -#ifdef XRENDERFONT - Display *dpy = screen->display; - if (!screen->renderFont && term->misc.face_name) { - XftPattern *pat, *match; - XftResult result; - - pat = XftNameParse(term->misc.face_name); - XftPatternBuild(pat, - XFT_FAMILY, XftTypeString, "mono", - XFT_SIZE, XftTypeInteger, term->misc.face_size, - XFT_SPACING, XftTypeInteger, XFT_MONO, - (void *) 0); - match = XftFontMatch(dpy, DefaultScreen(dpy), pat, &result); - screen->renderFont = XftFontOpenPattern(dpy, match); - if (!screen->renderFont && match) - XftPatternDestroy(match); - if (screen->renderFont) { +#if OPT_RENDERFONT + /* + * xterm contains a lot of references to fonts, assuming they are fixed + * size. This chunk of code overrides the actual font-selection (see + * drawXtermText()), if the user has selected render-font. All of the + * font-loading for fixed-fonts still goes on whether or not this chunk + * overrides it. + */ + if (term->misc.render_font) { + Display *dpy = screen->display; + int fontnum = screen->menu_font_number; + XftFont *norm = screen->renderFontNorm[fontnum]; + XftFont *bold = screen->renderFontBold[fontnum]; +#if OPT_RENDERWIDE + XftFont *wnorm = screen->renderWideNorm[fontnum]; + XftFont *wbold = screen->renderWideBold[fontnum]; +#endif + + if (norm == 0 && term->misc.face_name) { + XftPattern *pat, *match; + XftResult result; + int face_size = term->misc.face_size; + + TRACE(("xtermComputeFontInfo norm(face %s, size %d)\n", + term->misc.face_name, + term->misc.face_size)); + +#if OPT_SHIFT_FONTS + /* + * If the user is switching font-sizes, make it follow the same + * ratios to the default as the fixed fonts would, for easy + * comparison. There will be some differences since the fixed + * fonts have a variety of height/width ratios, but this is simpler + * than adding another resource value - and as noted above, the + * data for the fixed fonts are available. + */ + if (fontnum != fontMenu_fontdefault) { + int num = screen->menu_font_sizes[fontnum]; + int den = screen->menu_font_sizes[0]; + face_size = (1.0 * face_size * num) / den; + } +#endif + + pat = XftNameParse(term->misc.face_name); XftPatternBuild(pat, - XFT_WEIGHT, XftTypeInteger, XFT_WEIGHT_BOLD, - XFT_CHAR_WIDTH, XftTypeInteger, screen->renderFont->max_advance_width, + XFT_FAMILY, XftTypeString, "mono", + XFT_SIZE, XftTypeInteger, face_size, + XFT_SPACING, XftTypeInteger, XFT_MONO, (void *) 0); match = XftFontMatch(dpy, DefaultScreen(dpy), pat, &result); - screen->renderFontBold = XftFontOpenPattern(dpy, match); - if (!screen->renderFontBold && match) + norm = XftFontOpenPattern(dpy, match); + if ((norm == 0) && match) XftPatternDestroy(match); + if (norm != 0) { + XftPatternBuild(pat, + XFT_WEIGHT, XftTypeInteger, XFT_WEIGHT_BOLD, + XFT_CHAR_WIDTH, XftTypeInteger, norm->max_advance_width, + (void *) 0); + match = XftFontMatch(dpy, DefaultScreen(dpy), pat, &result); + bold = XftFontOpenPattern(dpy, match); + if ((bold == 0) && match) + XftPatternDestroy(match); + + /* + * FIXME: just assume that the corresponding font has no + * graphics characters. + */ + if (screen->fnt_boxes) { + screen->fnt_boxes = False; + TRACE(("Xft opened - will %suse internal line-drawing characters\n", + screen->fnt_boxes ? "not " : "")); + } + } + + if (pat) + XftPatternDestroy(pat); + + CACHE_XFT(screen->renderFontNorm, norm); + CACHE_XFT(screen->renderFontBold, bold); /* - * FIXME: just assume that the corresponding font has no graphics - * characters. + * See xtermXftDrawString(). */ - if (screen->fnt_boxes) { - screen->fnt_boxes = False; - TRACE(("Xft opened - will %suse internal line-drawing characters\n", - screen->fnt_boxes ? "not " : "")); +#if OPT_RENDERWIDE + if (norm != 0 && wnorm == 0) { + char *face_name = (term->misc.face_wide_name + ? term->misc.face_wide_name + : term->misc.face_name); + int char_width = norm->max_advance_width * 2; + + TRACE(("xtermComputeFontInfo wide(face %s, char_width %d)\n", + face_name, + char_width)); + + wnorm = XftFontOpen(dpy, DefaultScreen(dpy), + XFT_FAMILY, XftTypeString, face_name, + XFT_SIZE, XftTypeInteger, face_size, + XFT_SPACING, XftTypeInteger, XFT_MONO, + XFT_CHAR_WIDTH, XftTypeInteger, char_width, + (void *) 0); + + wbold = XftFontOpen(dpy, DefaultScreen(dpy), + XFT_FAMILY, XftTypeString, face_name, + XFT_SIZE, XftTypeInteger, face_size, + XFT_SPACING, XftTypeInteger, XFT_MONO, + XFT_CHAR_WIDTH, XftTypeInteger, char_width, + XFT_WEIGHT, XftTypeInteger, XFT_WEIGHT_BOLD, + (void *) 0); + + CACHE_XFT(screen->renderWideNorm, wnorm); + CACHE_XFT(screen->renderWideBold, wbold); } +#endif + } + if (norm == 0) { + term->misc.render_font = False; + update_font_renderfont(); + } else { + win->f_width = norm->max_advance_width; + win->f_height = norm->height; + win->f_ascent = norm->ascent; + win->f_descent = norm->descent; + if (win->f_height < win->f_ascent + win->f_descent) + win->f_height = win->f_ascent + win->f_descent; + if (is_double_width_font_xft(screen->display, norm)) + win->f_width >>= 1; } - if (pat) - XftPatternDestroy(pat); } - if (screen->renderFont) { - win->f_width = screen->renderFont->max_advance_width; - win->f_height = screen->renderFont->height; - win->f_ascent = screen->renderFont->ascent; - win->f_descent = screen->renderFont->descent; - if (win->f_height < win->f_ascent + win->f_descent) - win->f_height = win->f_ascent + win->f_descent; - if (is_double_width_font_xft(screen->display, screen->renderFont)) - win->f_width >>= 1; - } else + if (!term->misc.render_font) #endif { if (is_double_width_font(font)) { @@ -1172,6 +1263,12 @@ xtermComputeFontInfo(TScreen * screen, win->fullheight = height; win->width = width - i; win->height = height - j; + + TRACE(("xtermComputeFontInfo fontsize %dx%d, screensize %dx%d\n", + FontHeight(screen), + FontWidth(screen), + Height(screen), + Width(screen))); } /* save this information as a side-effect for double-sized characters */ @@ -1256,7 +1353,8 @@ xtermMissingChar(unsigned ch, XFontStruct * font) } /* - * The grid is abitrary, enough resolution that nothing's lost in initialization. + * The grid is arbitrary, enough resolution that nothing's lost in + * initialization. */ #define BOX_HIGH 60 #define BOX_WIDE 60 @@ -1432,8 +1530,8 @@ xtermDrawBoxChar(TScreen * screen, int ch, unsigned flags, GC gc, int x, int y) * mode, but have gotten an old-style font. */ if (screen->utf8_mode -#ifdef XRENDERFONT - && screen->renderFont == 0 +#if OPT_RENDERFONT + && !term->misc.render_font #endif && (ch > 127) && (ch != UCS_REPL)) { @@ -1502,19 +1600,17 @@ xtermDrawBoxChar(TScreen * screen, int ch, unsigned flags, GC gc, int x, int y) n = 0; } } - } -#if 0 /* bounding rectangle, for debugging */ - else { + } else if (screen->force_all_chars) { + /* bounding rectangle, for debugging */ XDrawRectangle( screen->display, VWindow(screen), gc, x, y, font_width - 1, font_height - 1); } -#endif XFreeGC(screen->display, gc2); } -#endif +#endif /* OPT_BOX_CHARS */ #if OPT_WIDE_CHARS #define MY_UCS(ucs,dec) case ucs: result = dec; break diff --git a/programs/xterm/input.c b/programs/xterm/input.c index a1e2744e3..889e69498 100644 --- a/programs/xterm/input.c +++ b/programs/xterm/input.c @@ -2,10 +2,10 @@ * $Xorg: input.c,v 1.3 2000/08/17 19:55:08 cpqbld Exp $ */ -/* $XFree86: xc/programs/xterm/input.c,v 3.67 2003/12/03 00:22:57 dawes Exp $ */ +/* $XFree86: xc/programs/xterm/input.c,v 3.69 2003/12/31 17:12:28 dickey Exp $ */ /* - * Copyright 1999-2002,2003 by Thomas E. Dickey + * Copyright 1999-2003,2004 by Thomas E. Dickey * * All Rights Reserved * @@ -354,8 +354,13 @@ Input(TKeyboard * keyboard, #if OPT_TCAP_QUERY if (screen->tc_query >= 0) { keysym = screen->tc_query; - nbytes = 0; - strbuf[0] = 0; + if (keysym != XK_BackSpace) { + nbytes = 0; + strbuf[0] = 0; + } else { + nbytes = 1; + strbuf[0] = 8; + } } else #endif #if OPT_I18N_SUPPORT diff --git a/programs/xterm/main.c b/programs/xterm/main.c index 260a38fc5..da822a572 100644 --- a/programs/xterm/main.c +++ b/programs/xterm/main.c @@ -17,7 +17,7 @@ static char *rid = "$Xorg: main.c,v 1.7 2001/02/09 02:06:02 xorgcvs Exp $"; /*********************************************************** -Copyright 2002,2003 by Thomas E. Dickey +Copyright 2002-2003,2004 by Thomas E. Dickey All Rights Reserved @@ -89,7 +89,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/xterm/main.c,v 3.173 2003/11/25 01:54:43 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/main.c,v 3.174 2003/12/25 22:04:04 dickey Exp $ */ /* main.c */ @@ -778,8 +778,9 @@ static XrmOptionDescRec optionDescList[] = { #ifndef NO_ACTIVE_ICON {"-fi", "*iconFont", XrmoptionSepArg, (caddr_t) NULL}, #endif /* NO_ACTIVE_ICON */ -#ifdef XRENDERFONT +#if OPT_RENDERFONT {"-fa", "*faceName", XrmoptionSepArg, (caddr_t) NULL}, +{"-fd", "*faceNameDoublesize", XrmoptionSepArg, (caddr_t) NULL}, {"-fs", "*faceSize", XrmoptionSepArg, (caddr_t) NULL}, #endif #if OPT_WIDE_CHARS @@ -858,8 +859,8 @@ static XrmOptionDescRec optionDescList[] = { {"+u8", "*utf8", XrmoptionNoArg, (caddr_t) "0"}, #endif #if OPT_LUIT_PROG -{"-lc", "*locale", XrmoptionNoArg, (caddr_t) "True"}, -{"+lc", "*locale", XrmoptionNoArg, (caddr_t) "False"}, +{"-lc", "*locale", XrmoptionNoArg, (caddr_t) "on"}, +{"+lc", "*locale", XrmoptionNoArg, (caddr_t) "off"}, {"-lcc", "*localeFilter",XrmoptionSepArg, (caddr_t) NULL}, {"-en", "*locale", XrmoptionSepArg, (caddr_t) NULL}, #endif @@ -925,8 +926,9 @@ static OptionHelp xtermOptions[] = { { "-fb fontname", "bold text font" }, { "-/+fbb", "turn on/off normal/bold font comparison inhibit"}, { "-/+fbx", "turn off/on linedrawing characters"}, -#ifdef XRENDERFONT +#if OPT_RENDERFONT { "-fa pattern", "FreeType font-selection pattern" }, +{ "-fd pattern", "FreeType Doublesize font-selection pattern" }, { "-fs size", "FreeType font-size" }, #endif #if OPT_WIDE_CHARS diff --git a/programs/xterm/main.h b/programs/xterm/main.h index 01130d5e5..4222c7be6 100644 --- a/programs/xterm/main.h +++ b/programs/xterm/main.h @@ -2,7 +2,7 @@ * $Xorg: main.h,v 1.3 2000/08/17 19:55:09 cpqbld Exp $ */ -/* $XFree86: xc/programs/xterm/main.h,v 3.7 2002/08/17 19:52:26 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/main.h,v 3.8 2003/10/27 01:07:57 dickey Exp $ */ /* * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. @@ -41,6 +41,12 @@ #define DEFFACENAME NULL #define DEFFACESIZE 14 +#if OPT_BLINK_TEXT +#define DEFBLINKASBOLD FALSE +#else +#define DEFBLINKASBOLD TRUE +#endif + #ifndef DEFDELETE_DEL #define DEFDELETE_DEL 2 #endif diff --git a/programs/xterm/menu.c b/programs/xterm/menu.c index a3940b07a..bba80bd9b 100644 --- a/programs/xterm/menu.c +++ b/programs/xterm/menu.c @@ -1,7 +1,7 @@ /* $Xorg: menu.c,v 1.4 2001/02/09 02:06:03 xorgcvs Exp $ */ /* -Copyright 1999-2002,2003 by Thomas E. Dickey +Copyright 1999-2003,2004 by Thomas E. Dickey All Rights Reserved @@ -45,7 +45,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xterm/menu.c,v 3.52 2003/05/21 22:59:13 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/menu.c,v 3.53 2003/10/27 01:07:57 dickey Exp $ */ #include <xterm.h> #include <data.h> @@ -182,6 +182,10 @@ static void do_num_lock PROTO_XT_CALLBACK_ARGS; static void do_meta_esc PROTO_XT_CALLBACK_ARGS; #endif +#if OPT_RENDERFONT +static void do_font_renderfont PROTO_XT_CALLBACK_ARGS; +#endif + #if OPT_SCO_FUNC_KEYS static void do_sco_fkeys PROTO_XT_CALLBACK_ARGS; #endif @@ -210,6 +214,10 @@ static void handle_tekshow (Widget gw, Bool allowswitch); static void handle_vtshow (Widget gw, Bool allowswitch); #endif +#if OPT_WIDE_CHARS +static void do_font_utf8_mode PROTO_XT_CALLBACK_ARGS; +#endif + /* * The order of entries MUST match the values given in menu.h */ @@ -300,6 +308,7 @@ MenuEntry fontMenuEntries[] = { { "fontescape", do_vtfont, NULL }, { "fontsel", do_vtfont, NULL }, /* down to here should match NMENUFONTS in ptyx.h */ + #if OPT_DEC_CHRSET || OPT_BOX_CHARS || OPT_DEC_SOFTFONT { "line1", NULL, NULL }, #if OPT_BOX_CHARS @@ -311,7 +320,18 @@ MenuEntry fontMenuEntries[] = { #if OPT_DEC_SOFTFONT { "font-loadable", do_font_loadable,NULL }, #endif -#endif /* toggles for font extensions */ +#endif /* toggles for DEC font extensions */ + +#if OPT_RENDERFONT || OPT_WIDE_CHARS + { "line2", NULL, NULL }, +#if OPT_RENDERFONT + { "render-font", do_font_renderfont,NULL }, +#endif +#if OPT_WIDE_CHARS + { "utf8-mode", do_font_utf8_mode,NULL }, +#endif +#endif /* toggles for other font extensions */ + }; #if OPT_TEK4014 @@ -629,6 +649,21 @@ domenu(Widget w GCC_UNUSED, fontMenuEntries[fontMenu_font_doublesize].widget, False); #endif +#if OPT_RENDERFONT + update_font_renderfont(); + if (term->misc.face_name == 0) { + set_sensitivity(mw, + fontMenuEntries[fontMenu_render_font].widget, + False); + } +#endif +#if OPT_WIDE_CHARS + update_font_utf8_mode(); + if (term->screen.utf8_mode > 1) + set_sensitivity(mw, + fontMenuEntries[fontMenu_wide_chars].widget, + False); +#endif } FindFontSelection(NULL, True); set_sensitivity(mw, @@ -654,7 +689,7 @@ domenu(Widget w GCC_UNUSED, void HandleCreateMenu(Widget w, - XEvent * event, /* unused */ + XEvent * event, String * params, /* mainMenu, vtMenu, or tekMenu */ Cardinal * param_count) /* 0 or 1 */ { @@ -663,7 +698,7 @@ HandleCreateMenu(Widget w, void HandlePopupMenu(Widget w, - XEvent * event, /* unused */ + XEvent * event, String * params, /* mainMenu, vtMenu, or tekMenu */ Cardinal * param_count) /* 0 or 1 */ { @@ -1309,6 +1344,43 @@ do_font_loadable(Widget gw GCC_UNUSED, } #endif +#if OPT_RENDERFONT +static void +do_font_renderfont(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) +{ + TScreen *screen = &term->screen; + int fontnum = screen->menu_font_number; + String name = term->screen.menu_font_names[fontnum]; + + term->misc.render_font = !term->misc.render_font; + update_font_renderfont(); + xtermLoadFont(screen, xtermFontName(name), True, fontnum); + ScrnRefresh(screen, 0, 0, + screen->max_row + 1, + screen->max_col + 1, True); +} +#endif + +#if OPT_WIDE_CHARS +static void +do_font_utf8_mode(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) +{ + TScreen *screen = &term->screen; + + switchPtyData(screen, &VTbuffer, !screen->utf8_mode); + update_font_utf8_mode(); + /* + * We don't repaint the screen when switching UTF-8 on/off. When switching + * on - the Latin-1 codes should paint as-is. When switching off, that's + * hard to do properly. + */ +} +#endif + /* * tek menu */ @@ -1944,6 +2016,30 @@ HandleFontLoading(Widget w, } #endif +#if OPT_RENDERFONT +void +HandleRenderFont(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) +{ + handle_toggle(do_font_renderfont, term->misc.render_font, + params, *param_count, w, (XtPointer) 0, (XtPointer) 0); +} +#endif + +#if OPT_WIDE_CHARS +void +HandleUTF8Mode(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal * param_count) +{ + handle_toggle(do_font_utf8_mode, term->screen.utf8_mode, + params, *param_count, w, (XtPointer) 0, (XtPointer) 0); +} +#endif + #if OPT_TEK4014 void HandleSetTerminalType(Widget w, @@ -2521,6 +2617,26 @@ update_font_loadable(void) } #endif +#if OPT_RENDERFONT +void +update_font_renderfont(void) +{ + update_menu_item(term->screen.fontMenu, + fontMenuEntries[fontMenu_render_font].widget, + term->misc.render_font); +} +#endif + +#if OPT_WIDE_CHARS +void +update_font_utf8_mode(void) +{ + update_menu_item(term->screen.fontMenu, + fontMenuEntries[fontMenu_wide_chars].widget, + term->screen.utf8_mode); +} +#endif + #if OPT_TEK4014 void update_tekshow(void) diff --git a/programs/xterm/menu.h b/programs/xterm/menu.h index d0e059d4f..529f30f6a 100644 --- a/programs/xterm/menu.h +++ b/programs/xterm/menu.h @@ -1,7 +1,7 @@ /* $Xorg: menu.h,v 1.4 2001/02/09 02:06:03 xorgcvs Exp $ */ /* -Copyright 1999-2001, 2002 by Thomas E. Dickey +Copyright 1999-2001,2004 by Thomas E. Dickey All Rights Reserved @@ -48,7 +48,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xterm/menu.h,v 3.30 2003/03/09 23:39:14 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/menu.h,v 3.31 2003/10/27 01:07:57 dickey Exp $ */ #ifndef included_menu_h #define included_menu_h @@ -99,6 +99,7 @@ extern void HandlePrintControlMode PROTO_XT_ACTIONS_ARGS; extern void HandlePrintScreen PROTO_XT_ACTIONS_ARGS; extern void HandleQuit PROTO_XT_ACTIONS_ARGS; extern void HandleRedraw PROTO_XT_ACTIONS_ARGS; +extern void HandleRenderFont PROTO_XT_ACTIONS_ARGS; extern void HandleReverseVideo PROTO_XT_ACTIONS_ARGS; extern void HandleReverseWrap PROTO_XT_ACTIONS_ARGS; extern void HandleScoFunctionKeys PROTO_XT_ACTIONS_ARGS; @@ -106,10 +107,10 @@ extern void HandleScrollKey PROTO_XT_ACTIONS_ARGS; extern void HandleScrollTtyOutput PROTO_XT_ACTIONS_ARGS; extern void HandleScrollbar PROTO_XT_ACTIONS_ARGS; extern void HandleSendSignal PROTO_XT_ACTIONS_ARGS; +extern void HandleSetPopOnBell PROTO_XT_ACTIONS_ARGS; extern void HandleSetTekText PROTO_XT_ACTIONS_ARGS; extern void HandleSetTerminalType PROTO_XT_ACTIONS_ARGS; extern void HandleSetVisualBell PROTO_XT_ACTIONS_ARGS; -extern void HandleSetPopOnBell PROTO_XT_ACTIONS_ARGS; extern void HandleSoftReset PROTO_XT_ACTIONS_ARGS; extern void HandleSunFunctionKeys PROTO_XT_ACTIONS_ARGS; extern void HandleSunKeyboard PROTO_XT_ACTIONS_ARGS; @@ -117,6 +118,7 @@ extern void HandleTekCopy PROTO_XT_ACTIONS_ARGS; extern void HandleTekPage PROTO_XT_ACTIONS_ARGS; extern void HandleTekReset PROTO_XT_ACTIONS_ARGS; extern void HandleTiteInhibit PROTO_XT_ACTIONS_ARGS; +extern void HandleUTF8Mode PROTO_XT_ACTIONS_ARGS; extern void HandleVisibility PROTO_XT_ACTIONS_ARGS; extern void DoSecureKeyboard (Time tp); @@ -227,6 +229,7 @@ typedef enum { fontMenu_fontescape, fontMenu_fontsel, /* number of non-line items down to here should match NMENUFONTS in ptyx.h */ + #if OPT_DEC_CHRSET || OPT_BOX_CHARS || OPT_DEC_SOFTFONT fontMenu_line1, #if OPT_BOX_CHARS @@ -239,6 +242,17 @@ typedef enum { fontMenu_font_loadable, #endif #endif + +#if OPT_RENDERFONT || OPT_WIDE_CHARS + fontMenu_line2, +#if OPT_RENDERFONT + fontMenu_render_font, +#endif +#if OPT_WIDE_CHARS + fontMenu_wide_chars, +#endif +#endif + fontMenu_LAST } fontMenuIndices; @@ -366,6 +380,18 @@ extern void update_font_loadable(void); #define update_font_loadable() /* nothing */ #endif +#if OPT_RENDERFONT +extern void update_font_renderfont(void); +#else +#define update_font_renderfont() /* nothing */ +#endif + +#if OPT_WIDE_CHARS +extern void update_font_utf8_mode(void); +#else +#define update_font_utf8_mode() /* nothing */ +#endif + #if OPT_TEK4014 extern void update_tekshow(void); extern void update_vttekmode(void); diff --git a/programs/xterm/misc.c b/programs/xterm/misc.c index 2b1f7faf9..59a0f3282 100644 --- a/programs/xterm/misc.c +++ b/programs/xterm/misc.c @@ -2,7 +2,7 @@ * $Xorg: misc.c,v 1.3 2000/08/17 19:55:09 cpqbld Exp $ */ -/* $XFree86: xc/programs/xterm/misc.c,v 3.81 2003/10/27 01:07:57 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/misc.c,v 3.82 2003/12/31 17:12:28 dickey Exp $ */ /* * @@ -667,8 +667,9 @@ QueryMaximize(TScreen * screen, unsigned *width, unsigned *height) *width, *height, root_border)); - *width -= (screen->border * 2), - *height -= (screen->border * 2); + + *width -= (root_border * 2); + *height -= (root_border * 2); hints.flags = PMaxSize; if (XGetWMNormalHints(screen->display, @@ -695,7 +696,7 @@ void RequestMaximize(XtermWidget termw, int maximize) { register TScreen *screen = &termw->screen; - XWindowAttributes win_attrs; + XWindowAttributes wm_attrs, vshell_attrs; unsigned root_width, root_height; if (maximize) { @@ -704,29 +705,39 @@ RequestMaximize(XtermWidget termw, int maximize) if (XGetWindowAttributes(screen->display, WMFrameWindow(termw), - &win_attrs)) { - - if (screen->restore_data != True - || screen->restore_width != root_width - || screen->restore_height != root_height) { - screen->restore_data = True; - screen->restore_x = win_attrs.x; - screen->restore_y = win_attrs.y; - screen->restore_width = win_attrs.width; - screen->restore_height = win_attrs.height; - TRACE(("HandleMaximize: save window position %d,%d size %d,%d\n", - screen->restore_x, - screen->restore_y, - screen->restore_width, - screen->restore_height)); - } + &wm_attrs)) { + + if (XGetWindowAttributes(screen->display, + VShellWindow, + &vshell_attrs)) { + + if (screen->restore_data != True + || screen->restore_width != root_width + || screen->restore_height != root_height) { + screen->restore_data = True; + screen->restore_x = wm_attrs.x + wm_attrs.border_width; + screen->restore_y = wm_attrs.y + wm_attrs.border_width; + screen->restore_width = vshell_attrs.width; + screen->restore_height = vshell_attrs.height; + TRACE(("HandleMaximize: save window position %d,%d size %d,%d\n", + screen->restore_x, + screen->restore_y, + screen->restore_width, + screen->restore_height)); + } - XMoveResizeWindow(screen->display, - VShellWindow, - 0, /* x */ - 0, /* y */ - root_width, - root_height); + /* subtract wm decoration dimensions */ + root_width -= ((wm_attrs.width - vshell_attrs.width) + + (wm_attrs.border_width * 2)); + root_height -= ((wm_attrs.height - vshell_attrs.height) + + (wm_attrs.border_width * 2)); + + XMoveResizeWindow(screen->display, VShellWindow, + 0 + wm_attrs.border_width, /* x */ + 0 + wm_attrs.border_width, /* y */ + root_width, + root_height); + } } } } else { @@ -737,6 +748,7 @@ RequestMaximize(XtermWidget termw, int maximize) screen->restore_width, screen->restore_height)); screen->restore_data = False; + XMoveResizeWindow(screen->display, VShellWindow, screen->restore_x, diff --git a/programs/xterm/os2main.c b/programs/xterm/os2main.c index 0aa2ad473..dee45295c 100644 --- a/programs/xterm/os2main.c +++ b/programs/xterm/os2main.c @@ -5,7 +5,7 @@ #ifndef lint static char *rid = "$XConsortium: main.c,v 1.227.1.2 95/06/29 18:13:15 kaleb Exp $"; #endif /* lint */ -/* $XFree86: xc/programs/xterm/os2main.c,v 3.61 2003/05/19 00:47:33 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/os2main.c,v 3.62 2003/05/21 22:59:13 dickey Exp $ */ /*********************************************************** @@ -342,8 +342,9 @@ static XrmOptionDescRec optionDescList[] = { #ifndef NO_ACTIVE_ICON {"-fi", "*iconFont", XrmoptionSepArg, (caddr_t) NULL}, #endif /* NO_ACTIVE_ICON */ -#ifdef XRENDERFONT +#if OPT_RENDERFONT {"-fa", "*faceName", XrmoptionSepArg, (caddr_t) NULL}, +{"-fd", "*faceNameDoublesize", XrmoptionSepArg, (caddr_t) NULL}, {"-fs", "*faceSize", XrmoptionSepArg, (caddr_t) NULL}, #endif #if OPT_WIDE_CHARS @@ -482,8 +483,9 @@ static OptionHelp xtermOptions[] = { { "-fb fontname", "bold text font" }, { "-/+fbb", "turn on/off normal/bold font comparison inhibit"}, { "-/+fbx", "turn off/on linedrawing characters"}, -#ifdef XRENDERFONT +#if OPT_RENDERFONT { "-fa pattern", "FreeType font-selection pattern" }, +{ "-fd pattern", "FreeType Doublesize font-selection pattern" }, { "-fs size", "FreeType font-size" }, #endif #if OPT_WIDE_CHARS diff --git a/programs/xterm/ptydata.c b/programs/xterm/ptydata.c index 9ceada7b2..b72b28c76 100644 --- a/programs/xterm/ptydata.c +++ b/programs/xterm/ptydata.c @@ -1,10 +1,10 @@ /* - * $XFree86: xc/programs/xterm/ptydata.c,v 1.16 2002/06/01 00:54:49 dickey Exp $ + * $XFree86: xc/programs/xterm/ptydata.c,v 1.17 2002/10/05 17:57:12 dickey Exp $ */ /************************************************************ -Copyright 1999-2001,2002 by Thomas E. Dickey +Copyright 1999-2002,2004 by Thomas E. Dickey All Rights Reserved @@ -51,6 +51,113 @@ authorization. #endif #endif +#if OPT_WIDE_CHARS +/* + * Convert the 8-bit codes in data->buf[] into Unicode in data->buf2[]. + */ +static void +convertPtyData(TScreen * screen, PtyData * data) +{ + int i; + int j = 0; + + TRACE(("converting %d bytes to UTF-8, prior count %d state %#X\n", + data->cnt, + screen->utf_count, + screen->utf_char)); + + data->len2 = data->cnt; + for (i = 0; i < data->cnt; i++) { + unsigned c = data->buf[i]; + + TRACE(("raw[%d] = %#x (convert)\n", i, c)); + /* Combine UTF-8 into Unicode */ + if (c < 0x80) { + /* We received an ASCII character */ + if (screen->utf_count > 0) { + data->inx2[j] = -1; + data->buf2[j++] = UCS_REPL; /* prev. sequence incomplete */ + } + data->inx2[j] = i; + data->buf2[j++] = c; + screen->utf_count = 0; + } else if (c < 0xc0) { + /* We received a continuation byte */ + if (screen->utf_count < 1) { + data->inx2[j] = i; + data->buf2[j++] = UCS_REPL; /* ... unexpectedly */ + } else { + /* Check for overlong UTF-8 sequences for which a shorter + * encoding would exist and replace them with UCS_REPL. + * An overlong UTF-8 sequence can have any of the following + * forms: + * 1100000x 10xxxxxx + * 11100000 100xxxxx 10xxxxxx + * 11110000 1000xxxx 10xxxxxx 10xxxxxx + * 11111000 10000xxx 10xxxxxx 10xxxxxx 10xxxxxx + * 11111100 100000xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx + */ + if (!screen->utf_char && !((c & 0x7f) >> (7 - screen->utf_count))) { + screen->utf_char = UCS_REPL; + } + /* characters outside UCS-2 become UCS_REPL */ + if (screen->utf_char > 0x03ff) { + /* value would be >0xffff */ + screen->utf_char = UCS_REPL; + } else { + screen->utf_char <<= 6; + screen->utf_char |= (c & 0x3f); + } + if ((screen->utf_char >= 0xd800 && + screen->utf_char <= 0xdfff) || + (screen->utf_char == 0xfffe) || + (screen->utf_char == 0xffff)) { + screen->utf_char = UCS_REPL; + } + screen->utf_count--; + if (screen->utf_count == 0) { + data->inx2[j] = i; + data->buf2[j++] = screen->utf_char; + } + } + } else { + /* We received a sequence start byte */ + if (screen->utf_count > 0) { + data->inx2[j] = i; + data->buf2[j++] = UCS_REPL; /* prev. sequence incomplete */ + } + if (c < 0xe0) { + screen->utf_count = 1; + screen->utf_char = (c & 0x1f); + if (!(c & 0x1e)) + screen->utf_char = UCS_REPL; /* overlong sequence */ + } else if (c < 0xf0) { + screen->utf_count = 2; + screen->utf_char = (c & 0x0f); + } else if (c < 0xf8) { + screen->utf_count = 3; + screen->utf_char = (c & 0x07); + } else if (c < 0xfc) { + screen->utf_count = 4; + screen->utf_char = (c & 0x03); + } else if (c < 0xfe) { + screen->utf_count = 5; + screen->utf_char = (c & 0x01); + } else { + data->inx2[j] = i; + data->buf2[j++] = UCS_REPL; + screen->utf_count = 0; + } + } + } + TRACE(("UTF-8 count %d, char %04X input %d/%d bytes\n", + screen->utf_count, + screen->utf_char, + data->cnt, j)); + data->cnt = j; +} +#endif + int getPtyData(TScreen * screen, fd_set * select_mask, PtyData * data) { @@ -86,90 +193,18 @@ getPtyData(TScreen * screen, fd_set * select_mask, PtyData * data) Panic("input: read returned zero\n", 0); #endif } else { + TRACE(("read %d bytes from pty\n", data->cnt)); #if OPT_WIDE_CHARS if (screen->utf8_mode) { - int j = 0; - for (i = 0; i < data->cnt; i++) { - unsigned c = data->buf[i]; - /* Combine UTF-8 into Unicode */ - if (c < 0x80) { - /* We received an ASCII character */ - if (screen->utf_count > 0) - data->buf2[j++] = UCS_REPL; /* prev. sequence incomplete */ - data->buf2[j++] = c; - screen->utf_count = 0; - } else if (c < 0xc0) { - /* We received a continuation byte */ - if (screen->utf_count < 1) { - data->buf2[j++] = UCS_REPL; /* ... unexpectedly */ - } else { - /* Check for overlong UTF-8 sequences for which a shorter - * encoding would exist and replace them with UCS_REPL. - * An overlong UTF-8 sequence can have any of the following - * forms: - * 1100000x 10xxxxxx - * 11100000 100xxxxx 10xxxxxx - * 11110000 1000xxxx 10xxxxxx 10xxxxxx - * 11111000 10000xxx 10xxxxxx 10xxxxxx 10xxxxxx - * 11111100 100000xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx - */ - if (!screen->utf_char && !((c & 0x7f) >> (7 - screen->utf_count))) { - screen->utf_char = UCS_REPL; - } - /* characters outside UCS-2 become UCS_REPL */ - if (screen->utf_char > 0x03ff) { - /* value would be >0xffff */ - screen->utf_char = UCS_REPL; - } else { - screen->utf_char <<= 6; - screen->utf_char |= (c & 0x3f); - } - if ((screen->utf_char >= 0xd800 && - screen->utf_char <= 0xdfff) || - (screen->utf_char == 0xfffe) || - (screen->utf_char == 0xffff)) { - screen->utf_char = UCS_REPL; - } - screen->utf_count--; - if (screen->utf_count == 0) - data->buf2[j++] = screen->utf_char; - } - } else { - /* We received a sequence start byte */ - if (screen->utf_count > 0) - data->buf2[j++] = UCS_REPL; /* prev. sequence incomplete */ - if (c < 0xe0) { - screen->utf_count = 1; - screen->utf_char = (c & 0x1f); - if (!(c & 0x1e)) - screen->utf_char = UCS_REPL; /* overlong sequence */ - } else if (c < 0xf0) { - screen->utf_count = 2; - screen->utf_char = (c & 0x0f); - } else if (c < 0xf8) { - screen->utf_count = 3; - screen->utf_char = (c & 0x07); - } else if (c < 0xfc) { - screen->utf_count = 4; - screen->utf_char = (c & 0x03); - } else if (c < 0xfe) { - screen->utf_count = 5; - screen->utf_char = (c & 0x01); - } else { - data->buf2[j++] = UCS_REPL; - screen->utf_count = 0; - } - } - } /* for (i = 0; i < data->cnt; i++) */ - TRACE(("UTF-8 count %d, char %04X input %d/%d bytes\n", - screen->utf_count, - screen->utf_char, - data->cnt, j)); - data->cnt = j; + convertPtyData(screen, data); } else { - for (i = 0; i < data->cnt; i++) + data->len2 = data->cnt; + for (i = 0; i < data->cnt; i++) { data->ptr[i] = data->buf[i]; + TRACE(("raw[%d] = %#x (normal)\n", i, data->ptr[i])); + } } /* if (screen->utf8_mode) else */ + data->cnt2 = data->cnt; #endif /* read from pty was successful */ if (!screen->output_eight_bits) { @@ -191,6 +226,67 @@ getPtyData(TScreen * screen, fd_set * select_mask, PtyData * data) return 0; } +#if OPT_WIDE_CHARS +/* + * When UTF-8 mode has been turned on/off, we have to readjust the unused + * portion of the PtyData buffer. + */ +void +switchPtyData(TScreen * screen, PtyData * data, int flag) +{ + if (screen->utf8_mode != flag) { + int used = (data->ptr - data->buf2); + int first = data->inx2[used]; + + screen->utf8_mode = flag; + + TRACE(("FIXME turning UTF-8 mode %s after using %d/%d entries (%d bytes)\n", + flag ? "ON" : "OFF", + used, data->cnt2, data->len2)); + + if (flag) { + if (used < data->cnt2 && used > 0) { + int n; + + for (n = used; n < data->cnt2; ++n) { + data->buf[n - used] = data->buf[n]; + } + data->ptr = DecodedData(data); + data->cnt = data->cnt2 - used; + convertPtyData(screen, data); + data->cnt2 = data->cnt; + } + } else { + if (used < data->cnt2 && first > 0) { + int n; + + for (n = first; n < data->len2; ++n) { + data->buf[n - first] = data->buf[n]; + data->buf2[n - first] = data->buf[n]; + TRACE(("raw[%d] = %#x (moved)\n", n - first, data->buf[n])); + } + data->ptr = DecodedData(data); + data->cnt = data->cnt2 - first; + data->cnt2 = data->cnt; + data->len2 = data->cnt; + } + } +#if OPT_TRACE + { + int i; + + for (i = 0; i < data->cnt; i++) { + if (!(i % 8)) + TRACE(("%s", i ? "\n " : "DATA")); + TRACE((" %04X", data->ptr[i])); + } + TRACE(("\n")); + } +#endif + } +} +#endif + void initPtyData(PtyData * data) { diff --git a/programs/xterm/ptyx.h b/programs/xterm/ptyx.h index fbcbdab5e..e002f0bae 100644 --- a/programs/xterm/ptyx.h +++ b/programs/xterm/ptyx.h @@ -2,10 +2,10 @@ * $Xorg: ptyx.h,v 1.3 2000/08/17 19:55:09 cpqbld Exp $ */ -/* $XFree86: xc/programs/xterm/ptyx.h,v 3.110 2003/10/27 01:07:57 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/ptyx.h,v 3.111 2003/12/31 17:12:28 dickey Exp $ */ /* - * Copyright 1999-2002,2003 by Thomas E. Dickey + * Copyright 1999-2003,2004 by Thomas E. Dickey * * All Rights Reserved * @@ -429,6 +429,10 @@ typedef struct { #define OPT_BLINK_CURS 1 /* true if xterm has blinking cursor capability */ #endif +#ifndef OPT_BLINK_TEXT +#define OPT_BLINK_TEXT OPT_BLINK_CURS /* true if xterm has blinking text capability */ +#endif + #ifndef OPT_BOX_CHARS #define OPT_BOX_CHARS 1 /* true if xterm can simulate box-characters */ #endif @@ -557,6 +561,22 @@ typedef struct { #define OPT_READLINE 0 /* mouse-click/paste support for readline */ #endif +#ifndef OPT_RENDERFONT +#ifdef XRENDERFONT +#define OPT_RENDERFONT 1 +#else +#define OPT_RENDERFONT 0 +#endif +#endif + +#ifndef OPT_RENDERWIDE +#if OPT_RENDERFONT && OPT_WIDE_CHARS && defined(HAVE_TYPE_XFTCHARSPEC) +#define OPT_RENDERWIDE 1 +#else +#define OPT_RENDERWIDE 0 +#endif +#endif + #ifndef OPT_SAME_NAME #define OPT_SAME_NAME 1 /* suppress redundant updates of title, icon, etc. */ #endif @@ -867,11 +887,14 @@ typedef unsigned char IChar; /* for 8-bit characters */ #define BUF_SIZE 4096 typedef struct { - int cnt; /* number of chars left to process */ + int cnt; /* number of IChar's left to process */ IChar * ptr; /* pointer into decoded data */ Char buf[BUF_SIZE]; /* we read directly into this */ #if OPT_WIDE_CHARS IChar buf2[BUF_SIZE]; /* ...and may decode into this */ + int inx2[BUF_SIZE]; /* ...saving indices here */ + int cnt2; /* ...and original number of IChar's */ + int len2; /* ...and actual number of bytes in buf[] */ #define DecodedData(data) (data)->buf2 #else #define DecodedData(data) (data)->buf @@ -1206,6 +1229,7 @@ typedef struct { Boolean fnt_boxes; /* true if font has box-chars */ #if OPT_BOX_CHARS Boolean force_box_chars;/* true if we assume that */ + Boolean force_all_chars;/* true to outline missing chars*/ #endif Dimension fnt_wide; Dimension fnt_high; @@ -1223,12 +1247,20 @@ typedef struct { XPoint *box; /* draw unselected cursor */ int cursor_state; /* ON, OFF, or BLINKED_OFF */ + int cursor_busy; /* do not redraw... */ #if OPT_BLINK_CURS Boolean cursor_blink; /* cursor blink enable */ - int cursor_on; /* cursor on time (msecs) */ - int cursor_off; /* cursor off time (msecs) */ - XtIntervalId cursor_timer; /* timer-id for cursor-proc */ #endif +#if OPT_BLINK_TEXT + Boolean blink_as_bold; /* text blink disable */ +#endif +#if OPT_BLINK_CURS || OPT_BLINK_TEXT + int blink_state; /* ON, OFF, or BLINKED_OFF */ + int blink_on; /* cursor on time (msecs) */ + int blink_off; /* cursor off time (msecs) */ + XtIntervalId blink_timer; /* timer-id for cursor-proc */ +#endif + int cursor_GC; /* see ShowCursor() */ int cursor_set; /* requested state */ int cursor_col; /* previous cursor column */ int cursor_row; /* previous cursor row */ @@ -1300,8 +1332,8 @@ typedef struct { #if OPT_MAXIMIZE Boolean restore_data; - unsigned restore_x; - unsigned restore_y; + int restore_x; + int restore_y; unsigned restore_width; unsigned restore_height; #endif @@ -1382,10 +1414,12 @@ typedef struct { long menu_font_sizes[NMENUFONTS]; int menu_font_number; XIC xic; -#ifdef XRENDERFONT - XftFont *renderFont; - XftFont *renderFontBold; - XftDraw *renderDraw; +#if OPT_RENDERFONT + XftFont * renderFontNorm[NMENUFONTS]; + XftFont * renderFontBold[NMENUFONTS]; + XftFont * renderWideNorm[NMENUFONTS]; + XftFont * renderWideBold[NMENUFONTS]; + XftDraw * renderDraw; #endif #if OPT_INPUT_METHOD XFontSet fs; /* fontset for XIM preedit */ @@ -1520,9 +1554,11 @@ typedef struct _Misc { unsigned long meta_left; /* modifier for Meta_L */ unsigned long meta_right; /* modifier for Meta_R */ #endif -#ifdef XRENDERFONT +#if OPT_RENDERFONT char *face_name; + char *face_wide_name; int face_size; + Boolean render_font; #endif } Misc; @@ -1614,6 +1650,12 @@ typedef struct _TekWidgetRec { screen. Used to distinguish blanks from empty parts of the screen when selecting */ +#if OPT_BLINK_CURS +#define BOLDATTR(screen) (BOLD | ((screen)->blink_as_bold ? BLINK : 0)) +#else +#define BOLDATTR(screen) (BOLD | BLINK) +#endif + /* The following attributes make sense in the argument of drawXtermText() */ #define NOBACKGROUND 0x100 /* Used for overstrike */ #define NOTRANSLATION 0x200 /* No scan for chars missing in font */ diff --git a/programs/xterm/screen.c b/programs/xterm/screen.c index 4fe594acb..8b3620dc8 100644 --- a/programs/xterm/screen.c +++ b/programs/xterm/screen.c @@ -3,7 +3,7 @@ */ /* - * Copyright 1999-2002,2003 by Thomas E. Dickey + * Copyright 1999-2003,2004 by Thomas E. Dickey * * All Rights Reserved * @@ -54,7 +54,7 @@ * SOFTWARE. */ -/* $XFree86: xc/programs/xterm/screen.c,v 3.64 2003/10/13 00:58:22 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/screen.c,v 3.65 2003/10/20 00:58:54 dickey Exp $ */ /* screen.c */ @@ -65,6 +65,10 @@ #include <xcharmouse.h> #include <xterm_io.h> +#if OPT_WIDE_CHARS +#include <fontutils.h> +#endif + #include <signal.h> /* @@ -209,6 +213,97 @@ Reallocate(ScrnBuf * sbuf, return move_down ? move_down : -move_up; /* convert to rows */ } +#if OPT_WIDE_CHARS +/* + * This function reallocates memory if changing the number of Buf offsets. + * The code is based on Reallocate(). + */ +static void +ReallocateBufOffsets(ScrnBuf * sbuf, + Char ** sbufaddr, + int nrow, + int ncol, + size_t new_max_offsets) +{ + int i, j, k; + ScrnBuf base; + Char *oldbuf, *tmp; + size_t entries, length; + /* + * As there are 2 buffers (allbuf, altbuf), we cannot change num_ptrs in + * this function. However MAX_PTRS and BUF_PTRS depend on num_ptrs so + * change it now and restore the value when done. + */ + int old_max_ptrs = MAX_PTRS; + + term->num_ptrs = new_max_offsets; + + entries = MAX_PTRS * nrow; + length = BUF_PTRS * nrow * ncol; + oldbuf = *sbufaddr; + + *sbuf = (ScrnBuf) realloc((char *) (*sbuf), entries * sizeof(char *)); + if (*sbuf == 0) + SysError(ERROR_RESIZE); + base = *sbuf; + + if ((tmp = (Char *) calloc(length, sizeof(Char))) == 0) + SysError(ERROR_SREALLOC); + *sbufaddr = tmp; + + for (i = k = 0; i < nrow; i++) { + k += BUF_HEAD; + for (j = BUF_HEAD; j < old_max_ptrs; j++) { + memcpy(tmp, base[k++], ncol); + tmp += ncol; + } + } + + /* + * update the pointers in sbuf + */ + for (i = k = 0, tmp = *sbufaddr; i < nrow; i++) { + for (j = 0; j < BUF_HEAD; j++) + base[k++] = 0; + for (j = BUF_HEAD; j < MAX_PTRS; j++) { + base[k++] = tmp; + tmp += ncol; + } + } + + /* Now free the old buffer and restore num_ptrs */ + free(oldbuf); + term->num_ptrs = old_max_ptrs; +} + +/* + * This function dynamically adds support for wide-characters. + */ +void +ChangeToWide(TScreen * screen) +{ + int new_bufoffset = (OFF_COM2H + 1); + int savelines = screen->scrollWidget ? screen->savelines : 0; + + if (screen->wide_chars) + return; + + if (xtermLoadVTFonts(term, "utf8Fonts", "Utf8Fonts")) { + ReallocateBufOffsets(&screen->allbuf, &screen->sbuf_address, + screen->max_row + 1 + savelines, + screen->max_col + 1, + new_bufoffset); + if (screen->altbuf) + ReallocateBufOffsets(&screen->altbuf, &screen->abuf_address, + screen->max_row + 1, screen->max_col + 1, + new_bufoffset); + screen->wide_chars = True; + term->num_ptrs = new_bufoffset; + screen->visbuf = &screen->allbuf[MAX_PTRS * savelines]; + } +} +#endif + int last_written_row = -1; int last_written_col = -1; @@ -290,6 +385,13 @@ ScreenWrite(TScreen * screen, memcpy(col, str, length); /* This can stand for the present. If it is wrong, we will scribble over it */ } + +#if OPT_BLINK_TEXT + if ((flags & BLINK) && !(screen->blink_as_bold)) { + ScrnSetBlinked(screen, screen->cur_row); + } +#endif + #define ERROR_1 0x20 #define ERROR_2 0x00 if_OPT_WIDE_CHARS(screen, { @@ -764,10 +866,10 @@ ScrnRefresh(TScreen * screen, if_OPT_WIDE_CHARS(screen, { /* This fixes an infinite recursion bug, that leads - to display anomalies. It seems to be related to + to display anomalies. It seems to be related to problems with the selection. */ if (recurse < 3) { - /* adjust to redraw all of a widechar if we just wanted + /* adjust to redraw all of a widechar if we just wanted to draw the right hand half */ if (leftcol > 0 && (chars[leftcol] | (widec[leftcol] << 8)) == HIDDEN_CHAR && diff --git a/programs/xterm/util.c b/programs/xterm/util.c index 237b3ce84..eb9ff06e5 100644 --- a/programs/xterm/util.c +++ b/programs/xterm/util.c @@ -2,10 +2,10 @@ * $Xorg: util.c,v 1.3 2000/08/17 19:55:10 cpqbld Exp $ */ -/* $XFree86: xc/programs/xterm/util.c,v 3.77 2003/10/13 00:58:22 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/util.c,v 3.78 2003/10/27 01:07:57 dickey Exp $ */ /* - * Copyright 1999-2002,2003 by Thomas E. Dickey + * Copyright 1999-2003,2004 by Thomas E. Dickey * * All Rights Reserved * @@ -215,6 +215,7 @@ xtermScroll(TScreen * screen, int amount) int scrolltop; int scrollheight; + screen->cursor_busy += 1; if (screen->cursor_state) HideCursor(); if (amount > i) @@ -296,6 +297,7 @@ xtermScroll(TScreen * screen, int amount) if (refreshheight > 0) ScrnRefresh(screen, refreshtop, 0, refreshheight, screen->max_col + 1, False); + screen->cursor_busy -= 1; } /* @@ -315,6 +317,7 @@ RevScroll(TScreen * screen, int amount) int scrolltop; int scrollheight; + screen->cursor_busy += 1; if (screen->cursor_state) HideCursor(); if (amount > i) @@ -362,6 +365,7 @@ RevScroll(TScreen * screen, int amount) } ScrnInsertLine(screen, screen->visbuf, screen->bot_marg, screen->top_marg, amount, screen->max_col + 1); + screen->cursor_busy -= 1; } /* @@ -1357,7 +1361,7 @@ recolor_cursor(Cursor cursor, /* X cursor ID to set */ return; } -#ifdef XRENDERFONT +#if OPT_RENDERFONT static XftColor * getColor(Pixel pixel) { @@ -1408,7 +1412,8 @@ getColor(Pixel pixel) * See http://bugzilla.mozilla.org/show_bug.cgi?id=196312 */ static void -xtermXftDrawString(XftDraw * draw, +xtermXftDrawString(TScreen * screen, + unsigned flags, XftColor * color, XftFont * font, int x, @@ -1418,33 +1423,70 @@ xtermXftDrawString(XftDraw * draw, int fwidth, int *deltax) { -#if OPT_WIDE_CHARS && defined(HAVE_TYPE_XFTCHARSPEC) - static XftCharSpec *sbuf; - static unsigned slen; +#if OPT_RENDERWIDE + XftFont *wfont; int n; int ncells = 0; /* # of 'half-width' charcells */ + static XftCharSpec *sbuf; + static int slen = 0; + XftFont *lastFont = 0; + XftFont *currFont = 0; + int start = 0; + int charWidth; + FcChar32 wc; + int fontnum = screen->menu_font_number; + + if (len == 0 || !(*text || *text2)) { + return; + } + + if ((flags & BOLDATTR(screen)) + && screen->renderFontBold[fontnum]) { + wfont = screen->renderWideBold[fontnum]; + } else { + wfont = screen->renderWideNorm[fontnum]; + } if ((int) slen < len) { slen = (len + 1) * 2; sbuf = (XftCharSpec *) XtRealloc((char *) sbuf, slen * sizeof(XftCharSpec)); } + for (n = 0; n < len; n++) { - FcChar32 wc; if (text2) wc = *text++ | (*text2++ << 8); else wc = *text++; sbuf[n].ucs4 = wc; sbuf[n].x = x + fwidth * ncells; - ncells += my_wcwidth(wc); sbuf[n].y = y; + charWidth = my_wcwidth(wc); + currFont = (charWidth == 2) ? wfont : font; + ncells += charWidth; + if (lastFont != currFont) { + if (lastFont != 0) { + XftDrawCharSpec(screen->renderDraw, + color, + lastFont, + sbuf + start, + n - start); + } + start = n; + lastFont = currFont; + } } - XftDrawCharSpec(draw, color, font, sbuf, len); + XftDrawCharSpec(screen->renderDraw, + color, + lastFont, + sbuf + start, + n - start); + if (deltax) *deltax = ncells * fwidth; #else - XftDrawString8(draw, + + XftDrawString8(screen->renderDraw, color, font, x, y, (unsigned char *) text, len); @@ -1452,7 +1494,75 @@ xtermXftDrawString(XftDraw * draw, *deltax = len * fwidth; #endif } -#endif /* XRENDERFONT */ +#endif /* OPT_RENDERFONT */ + +#define DrawX(col) x + (col * (font_width)) +#define DrawSegment(first,last) (void)drawXtermText(screen, flags|NOTRANSLATION, gc, DrawX(first), y, chrset, PAIRED_CHARS(text+first, text2+first), last-first, on_wide) + +#if OPT_WIDE_CHARS +/* + * Actually this should be called "groff_workaround()" - for the places where + * groff stomps on compatibility. Still, if enough people get used to it, + * this might someday become a quasi-standard. + */ +static int +ucs_workaround(TScreen * screen, + int ch, + unsigned flags, + GC gc, + int x, + int y, + int chrset, + int on_wide) +{ + int fixed = FALSE; + + if (screen->wide_chars && screen->utf8_mode && ch > 256) { + switch (ch) { + case 0x2010: /* groff "-" */ + case 0x2011: + case 0x2012: + case 0x2013: + case 0x2014: + case 0x2015: + case 0x2212: /* groff "\-" */ + ch = '-'; + fixed = TRUE; + break; + case 0x2018: /* groff "`" */ + ch = '`'; + fixed = TRUE; + break; + case 0x2019: /* groff ' */ + ch = '\''; + fixed = TRUE; + break; + case 0x201C: /* groff lq */ + case 0x201D: /* groff rq */ + ch = '"'; + fixed = TRUE; + break; + } + if (fixed) { + Char text[2]; + Char text2[2]; + + text[0] = ch; + text2[0] = 0; + drawXtermText(screen, + flags, + gc, + x, + y, + chrset, + PAIRED_CHARS(text, text2), + 1, + on_wide); + } + } + return fixed; +} +#endif #if OPT_CLIP_BOLD /* @@ -1480,7 +1590,8 @@ xtermXftDrawString(XftDraw * draw, #endif /* OPT_CLIP_BOLD */ /* - * Draws text with the specified combination of bold/underline + * Draws text with the specified combination of bold/underline. The return + * value is the updated x position. */ int drawXtermText(TScreen * screen, @@ -1516,11 +1627,12 @@ drawXtermText(TScreen * screen, text2 = dbuf; } #endif -#ifdef XRENDERFONT - if (screen->renderFont) { +#if OPT_RENDERFONT + if (term->misc.render_font) { Display *dpy = screen->display; XftFont *font; XGCValues values; + int fontnum = screen->menu_font_number; if (!screen->renderDraw) { int scr; @@ -1532,11 +1644,11 @@ drawXtermText(TScreen * screen, screen->renderDraw = XftDrawCreate(dpy, draw, visual, DefaultColormap(dpy, scr)); } - if ((flags & (BOLD | BLINK)) - && screen->renderFontBold) - font = screen->renderFontBold; + if ((flags & BOLDATTR(screen)) + && screen->renderFontBold[fontnum]) + font = screen->renderFontBold[fontnum]; else - font = screen->renderFont; + font = screen->renderFontNorm[fontnum]; XGetGCValues(dpy, gc, GCForeground | GCBackground, &values); if (!(flags & NOBACKGROUND)) XftDrawRect(screen->renderDraw, @@ -1569,7 +1681,7 @@ drawXtermText(TScreen * screen, if (ch > 0 && ch < 32) { /* line drawing character time */ if (last > first) { - xtermXftDrawString(screen->renderDraw, + xtermXftDrawString(screen, flags, getColor(values.foreground), font, curX, y, PAIRED_CHARS(text + first, @@ -1591,7 +1703,7 @@ drawXtermText(TScreen * screen, } } if (last > first) { - xtermXftDrawString(screen->renderDraw, + xtermXftDrawString(screen, flags, getColor(values.foreground), font, curX, y, PAIRED_CHARS(text + first, text2 + first), @@ -1600,7 +1712,7 @@ drawXtermText(TScreen * screen, } else #endif /* OPT_BOX_CHARS */ { - xtermXftDrawString(screen->renderDraw, + xtermXftDrawString(screen, flags, getColor(values.foreground), font, x, y, PAIRED_CHARS(text, text2), len, FontWidth(screen), NULL); @@ -1614,7 +1726,7 @@ drawXtermText(TScreen * screen, } return x + len * FontWidth(screen); } -#endif /* XRENDERFONT */ +#endif /* OPT_RENDERFONT */ #if OPT_DEC_CHRSET if (CSET_DOUBLE(chrset)) { /* We could try drawing double-size characters in the icon, but @@ -1752,7 +1864,7 @@ drawXtermText(TScreen * screen, if (!(flags & CHARBYCHAR) && screen->fnt_prop) { int adj, width; GC fillGC = gc; /* might be cursorGC */ - XFontStruct *fs = ((flags & (BOLD | BLINK)) + XFontStruct *fs = ((flags & BOLDATTR(screen)) ? screen->fnt_bold : screen->fnt_norm); @@ -1788,8 +1900,6 @@ drawXtermText(TScreen * screen, return x; } #if OPT_BOX_CHARS -#define DrawX(col) x + (col * (font_width)) -#define DrawSegment(first,last) (void)drawXtermText(screen, flags|NOTRANSLATION, gc, DrawX(first), y, chrset, PAIRED_CHARS(text+first, text2+first), last-first, on_wide) /* If the font is incomplete, draw some substitutions */ if (!(flags & NOTRANSLATION) && (!screen->fnt_boxes || screen->force_box_chars)) { @@ -1818,7 +1928,11 @@ drawXtermText(TScreen * screen, if (isMissing) { if (last > first) DrawSegment(first, last); - xtermDrawBoxChar(screen, ch, flags, gc, DrawX(last), y); +#if OPT_WIDE_CHARS + if (!ucs_workaround(screen, ch, flags, gc, DrawX(last), y, + chrset, on_wide)) +#endif + xtermDrawBoxChar(screen, ch, flags, gc, DrawX(last), y); first = last + 1; } } @@ -1884,7 +1998,7 @@ drawXtermText(TScreen * screen, } else if (wideness && (screen->fnt_dwd->fid || screen->fnt_dwdb->fid)) { underline_len = real_length = len * 2; - if ((flags & (BOLD | BLINK)) != 0 + if ((flags & BOLDATTR(screen)) != 0 && screen->fnt_dwdb->fid) { XSetFont(screen->display, gc, screen->fnt_dwdb->fid); ascent_adjust = screen->fnt_dwdb->ascent - screen->fnt_norm->ascent; @@ -1893,7 +2007,7 @@ drawXtermText(TScreen * screen, ascent_adjust = screen->fnt_dwd->ascent - screen->fnt_norm->ascent; } /* fix ascent */ - } else if ((flags & (BOLD | BLINK)) != 0 + } else if ((flags & BOLDATTR(screen)) != 0 && screen->fnt_bold->fid) { XSetFont(screen->display, gc, screen->fnt_bold->fid); } else { @@ -1911,7 +2025,7 @@ drawXtermText(TScreen * screen, x, y + ascent_adjust, sbuf, n); - if ((flags & (BOLD | BLINK)) && screen->enbolden) { + if ((flags & BOLDATTR(screen)) && screen->enbolden) { beginClipping(screen, gc, font_width, len); XDrawString16(screen->display, VWindow(screen), gc, x + 1, y + ascent_adjust, sbuf, n); @@ -1928,7 +2042,7 @@ drawXtermText(TScreen * screen, XDrawImageString(screen->display, VWindow(screen), gc, x, y, (char *) text, len); underline_len = len; - if ((flags & (BOLD | BLINK)) && screen->enbolden) { + if ((flags & BOLDATTR(screen)) && screen->enbolden) { beginClipping(screen, gc, font_width, len); XDrawString(screen->display, VWindow(screen), gc, x + 1, y, (char *) text, len); @@ -1958,6 +2072,7 @@ updatedXtermGC(TScreen * screen, int flags, int fg_bg, Bool hilite) int my_bg = extract_bg(fg_bg, flags); Pixel fg_pix = getXtermForeground(flags, my_fg); Pixel bg_pix = getXtermBackground(flags, my_bg); + Pixel xx_pix; #if OPT_HIGHLIGHT_COLOR Pixel hi_pix = screen->highlightcolor; #endif @@ -1966,7 +2081,7 @@ updatedXtermGC(TScreen * screen, int flags, int fg_bg, Bool hilite) checkVeryBoldColors(flags, my_fg); if (ReverseOrHilite(screen, flags, hilite)) { - if (flags & (BOLD | BLINK)) + if (flags & BOLDATTR(screen)) gc = ReverseBoldGC(screen); else gc = ReverseGC(screen); @@ -1980,17 +2095,25 @@ updatedXtermGC(TScreen * screen, int flags, int fg_bg, Bool hilite) fg_pix = hi_pix; } #endif - XSetForeground(screen->display, gc, bg_pix); - XSetBackground(screen->display, gc, fg_pix); + xx_pix = bg_pix; + bg_pix = fg_pix; + fg_pix = xx_pix; } else { - if (flags & (BOLD | BLINK)) + if (flags & BOLDATTR(screen)) gc = NormalBoldGC(screen); else gc = NormalGC(screen); - XSetForeground(screen->display, gc, fg_pix); - XSetBackground(screen->display, gc, bg_pix); } + +#if OPT_BLINK_TEXT + if ((screen->blink_state == ON) && (flags & BLINK)) { + fg_pix = bg_pix; + } +#endif + + XSetForeground(screen->display, gc, fg_pix); + XSetBackground(screen->display, gc, bg_pix); return gc; } @@ -2009,7 +2132,7 @@ resetXtermGC(TScreen * screen, int flags, Bool hilite) checkVeryBoldColors(flags, term->cur_foreground); if (ReverseOrHilite(screen, flags, hilite)) { - if (flags & (BOLD | BLINK)) + if (flags & BOLDATTR(screen)) gc = ReverseBoldGC(screen); else gc = ReverseGC(screen); @@ -2018,7 +2141,7 @@ resetXtermGC(TScreen * screen, int flags, Bool hilite) XSetBackground(screen->display, gc, fg_pix); } else { - if (flags & (BOLD | BLINK)) + if (flags & BOLDATTR(screen)) gc = NormalBoldGC(screen); else gc = NormalGC(screen); diff --git a/programs/xterm/uxterm b/programs/xterm/uxterm index 0010b7253..8dc4e0182 100755 --- a/programs/xterm/uxterm +++ b/programs/xterm/uxterm @@ -1,5 +1,5 @@ #!/bin/sh -# $XFree86: xc/programs/xterm/uxterm,v 1.6 2003/03/09 23:39:14 dickey Exp $ +# $XFree86: xc/programs/xterm/uxterm,v 1.7 2003/12/18 21:12:16 dickey Exp $ # wrapper script to setup xterm with UTF-8 locale program=xterm @@ -23,7 +23,7 @@ do eval 'value=$'$name if test -n "$value" ; then case $value in - *.UTF-8) + *.utf8|*.UTF8|*.utf-8|*.UTF-8) found=yes ;; C|POSIX) diff --git a/programs/xterm/version.h b/programs/xterm/version.h index 3bfdae72b..c7c99d560 100644 --- a/programs/xterm/version.h +++ b/programs/xterm/version.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/xterm/version.h,v 3.94 2003/12/03 02:28:13 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/version.h,v 3.95 2003/12/31 17:12:28 dickey Exp $ */ /* * These definitions are used to build the string that's printed in response to @@ -6,5 +6,5 @@ * XFree86 to which this version of xterm has been built. The number in * parentheses is my patch number (T.Dickey). */ -#define XTERM_PATCH 184 -#define XFREE86_VERSION "XFree86 4.3.99.903" +#define XTERM_PATCH 185 +#define XFREE86_VERSION "XFree86 4.4" diff --git a/programs/xterm/vttests/resize.pl b/programs/xterm/vttests/resize.pl new file mode 100755 index 000000000..1410fc0dc --- /dev/null +++ b/programs/xterm/vttests/resize.pl @@ -0,0 +1,100 @@ +#!/usr/bin/perl +# $XFree86$ +# +# -- Thomas Dickey (2004/3/3) +# resize.sh rewritten into Perl for comparison. +# See also Term::ReadKey. + +use IO::Handle; + +sub write_tty { + open TTY, "+</dev/tty" or die("Cannot open /dev/tty\n"); + autoflush TTY 1; + print TTY @_; + close TTY; +} + +sub get_reply { + open TTY, "+</dev/tty" or die("Cannot open /dev/tty\n"); + autoflush TTY 1; + $old=`stty -g`; + system "stty raw -echo min 0 time 5"; + + print TTY @_; + my $reply=<TTY>; + close TTY; + system "stty $old"; + return $reply; +} + +sub csi_field { + my $first = @_[0]; + my $second = @_[1]; + $first =~ s/^[^0-9]+//; + while ( --$second > 0 ) { + $first =~ s/^[\d]+//; + $first =~ s/^[^\d]+//; + } + $first =~ s/[^\d]+.*$//; + return $first; +} + +$original=get_reply("\x1b[18t"); +if ( $original =~ /\x1b\[8;\d+;\d+t/ ) { + $high=csi_field($original,2); + $wide=csi_field($original,3); + printf "parsed terminal size $high,$wide\n"; +} else { + die "Cannot get terminal size via escape sequence\n"; +} +# +$maximize=get_reply("\x1b[19t"); +if ( $maximize =~ /\x1b\[9;\d+;\d+t/ ) { + $maxhigh=csi_field($maximize,2); + $maxwide=csi_field($maximize,3); + $maxhigh != 0 or $maxhigh = $high * 2; + $maxwide != 0 or $maxwide = $wide * 2; + printf "parsed terminal maxsize $maxhigh,$maxwide\n"; +} else { + die "Cannot get terminal size via escape sequence\n"; +} + +sub catch_zap { + $zapped++; +} +$SIG{INT} = \&catch_zap; +$SIG{QUIT} = \&catch_zap; +$SIG{KILL} = \&catch_zap; +$SIG{HUP} = \&catch_zap; +$SIG{TERM} = \&catch_zap; + +$w=$wide; +$h=$high; +$a=1; +$zapped=0; +while ( $zapped == 0 ) +{ +# sleep 1 + printf "resizing to $h by $w\n"; + write_tty("\x1b[8;$h;$w" . "t"); + if ( $a == 1 ) { + if ( $w == $maxwide ) { + $h += $a; + if ( $h = $maxhigh ) { + $a = -1; + } + } else { + $w += $a; + } + } else { + if ( $w == $wide ) { + $h += $a; + if ( $h = $high ) { + $a=1; + } + } else { + $w += $a; + } + } +} +write_tty($original); diff --git a/programs/xterm/vttests/tcapquery.pl b/programs/xterm/vttests/tcapquery.pl new file mode 100755 index 000000000..db067a639 --- /dev/null +++ b/programs/xterm/vttests/tcapquery.pl @@ -0,0 +1,149 @@ +#!/usr/bin/perl +# $XFree86$ +# +# -- Thomas Dickey (2004/3/3) +# Test the tcap-query option of xterm. + +use IO::Handle; + +sub write_tty { + open TTY, "+</dev/tty" or die("Cannot open /dev/tty\n"); + autoflush TTY 1; + print TTY @_; + close TTY; +} + +sub get_reply { + open TTY, "+</dev/tty" or die("Cannot open /dev/tty\n"); + autoflush TTY 1; + $old=`stty -g`; + system "stty raw -echo min 0 time 5"; + + print TTY @_; + my $reply=<TTY>; + close TTY; + system "stty $old"; + return $reply; +} + +sub csi_field { + my $first = @_[0]; + my $second = @_[1]; + $first =~ s/^[^0-9]+//; + while ( --$second > 0 ) { + $first =~ s/^[\d]+//; + $first =~ s/^[^\d]+//; + } + $first =~ s/[^\d]+.*$//; + return $first; +} + +sub hexified { + my $value = @_[0]; + my $result = ""; + for ( $n = 0; $n < length($value); ++$n) { + $result .= sprintf("%02X", ord substr($value,$n,1)); + } + return $result; +} + +sub query_tcap { + my $tcap = @_[0]; + my $tinfo = @_[1]; + my $param1 = hexified($tcap); + my $param2 = hexified($tinfo); + + #FIXME: should be able to do both at once + #$reply=get_reply("\x1bP+q" . $param1 . ";" . $param2 . "\x1b\\"); + $reply=get_reply("\x1bP+q" . $param1 . "\x1b\\"); + + if ( $reply =~ /\x1bP1\+r[[:xdigit:]]+=[[:xdigit:]]*.*/ ) { + my $value = $reply; + + $value =~ s/^.*=//; + $value =~ s/[^[:xdigit:]]*//; # FIXME: should work, but doesn't + $value =~ s/\x1b.*//; # ...do this anyway + + my $result = ""; + for ( $n = 0; $n < length($value); $n += 2) { + my $k = hex substr($value,$n,2); + if ( $k == 0x1b ) { + $result .= "\\E"; + } elsif ( $k == 0x7f ) { + $result .= "^?"; + } elsif ( $k == 32 ) { + $result .= "\\s"; + } elsif ( $k < 32 ) { + $result .= sprintf("^%c", $k + 64); + } elsif ( $k > 128 ) { + $result .= sprintf("\\%03o", $k); + } else { + $result .= chr($k); + } + } + + printf "$tcap=$result\n"; + } +} + +# See xtermcapKeycode() +query_tcap( "#2", "kHOM"); +query_tcap( "#4", "kLFT"); +query_tcap( "%1", "khlp"); +query_tcap( "%i", "kRIT"); +query_tcap( "*6", "kslt"); +query_tcap( "*7", "kEND"); +query_tcap( "@0", "kfnd"); +query_tcap( "@7", "kend"); +query_tcap( "F1", "kf11"); +query_tcap( "F2", "kf12"); +query_tcap( "F3", "kf13"); +query_tcap( "F4", "kf14"); +query_tcap( "F5", "kf15"); +query_tcap( "F6", "kf16"); +query_tcap( "F7", "kf17"); +query_tcap( "F8", "kf18"); +query_tcap( "F9", "kf19"); +query_tcap( "FA", "kf20"); +query_tcap( "FB", "kf21"); +query_tcap( "FC", "kf22"); +query_tcap( "FD", "kf23"); +query_tcap( "FE", "kf24"); +query_tcap( "FF", "kf25"); +query_tcap( "FG", "kf26"); +query_tcap( "FH", "kf27"); +query_tcap( "FI", "kf28"); +query_tcap( "FJ", "kf29"); +query_tcap( "FK", "kf30"); +query_tcap( "FL", "kf31"); +query_tcap( "FM", "kf32"); +query_tcap( "FN", "kf33"); +query_tcap( "FO", "kf34"); +query_tcap( "FP", "kf35"); +query_tcap( "FQ", "kf36"); +query_tcap( "FR", "kf37"); +query_tcap( "K1", "ka1"); +query_tcap( "K4", "kc1"); +query_tcap( "k1", "kf1"); +query_tcap( "k2", "kf2"); +query_tcap( "k3", "kf3"); +query_tcap( "k4", "kf4"); +query_tcap( "k5", "kf5"); +query_tcap( "k6", "kf6"); +query_tcap( "k7", "kf7"); +query_tcap( "k8", "kf8"); +query_tcap( "k9", "kf9"); +query_tcap( "k;", "kf10"); +query_tcap( "kB", "kcbt"); +query_tcap( "kC", "kclr"); +query_tcap( "kD", "kdch1"); +query_tcap( "kI", "kich1"); +query_tcap( "kN", "knp"); +query_tcap( "kP", "kpp"); +query_tcap( "kb", "kbs"); +query_tcap( "kd", "kcud1"); +query_tcap( "kh", "khome"); +query_tcap( "kl", "kcub1"); +query_tcap( "kr", "kcuf1"); +query_tcap( "ku", "kcuu1"); +query_tcap( "Co", "colors"); diff --git a/programs/xterm/xterm.h b/programs/xterm/xterm.h index 14e85cd6c..70938a103 100644 --- a/programs/xterm/xterm.h +++ b/programs/xterm/xterm.h @@ -1,8 +1,8 @@ -/* $XFree86: xc/programs/xterm/xterm.h,v 3.93 2003/12/18 21:12:16 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/xterm.h,v 3.94 2004/02/01 02:14:46 dickey Exp $ */ /************************************************************ -Copyright 1999-2002,2003 by Thomas E. Dickey +Copyright 1999-2003,2004 by Thomas E. Dickey All Rights Reserved @@ -317,6 +317,7 @@ extern int errno; #define XtNeightBitInput "eightBitInput" #define XtNeightBitOutput "eightBitOutput" #define XtNfaceName "faceName" +#define XtNfaceNameDoublesize "faceNameDoublesize" #define XtNfaceSize "faceSize" #define XtNfont1 "font1" #define XtNfont2 "font2" @@ -362,6 +363,7 @@ extern int errno; #define XtNprinterControlMode "printerControlMode" #define XtNprinterExtent "printerExtent" #define XtNprinterFormFeed "printerFormFeed" +#define XtNrenderFont "renderFont" #define XtNresizeGravity "resizeGravity" #define XtNreverseWrap "reverseWrap" #define XtNrightScrollBar "rightScrollBar" @@ -372,6 +374,8 @@ extern int errno; #define XtNscrollPos "scrollPos" #define XtNscrollTtyOutput "scrollTtyOutput" #define XtNshiftFonts "shiftFonts" +#define XtNshowBlinkAsBold "showBlinkAsBold" +#define XtNshowMissingGlyphs "showMissingGlyphs" #define XtNsignalInhibit "signalInhibit" #define XtNtekGeometry "tekGeometry" #define XtNtekInhibit "tekInhibit" @@ -433,6 +437,7 @@ extern int errno; #define XtCEightBitInput "EightBitInput" #define XtCEightBitOutput "EightBitOutput" #define XtCFaceName "FaceName" +#define XtCFaceNameDoublesize "FaceNameDoublesize" #define XtCFaceSize "FaceSize" #define XtCFont1 "Font1" #define XtCFont2 "Font2" @@ -442,6 +447,8 @@ extern int errno; #define XtCFont6 "Font6" #define XtCFontDoublesize "FontDoublesize" #define XtCFontStyle "FontStyle" +#define XtCForceBoxChars "ForceBoxChars" +#define XtCFreeBoldBox "FreeBoldBox" #define XtCHighlightSelection "HighlightSelection" #define XtCHpLowerleftBugCompat "HpLowerleftBugCompat" #define XtCI18nSelections "I18nSelections" @@ -470,6 +477,7 @@ extern int errno; #define XtCPrinterControlMode "PrinterControlMode" #define XtCPrinterExtent "PrinterExtent" #define XtCPrinterFormFeed "PrinterFormFeed" +#define XtCRenderFont "RenderFont" #define XtCResizeGravity "ResizeGravity" #define XtCReverseWrap "ReverseWrap" #define XtCRightScrollBar "RightScrollBar" @@ -479,6 +487,8 @@ extern int errno; #define XtCScrollLines "ScrollLines" #define XtCScrollPos "ScrollPos" #define XtCShiftFonts "ShiftFonts" +#define XtCShowBlinkAsBold "ShowBlinkAsBold" +#define XtCShowMissingGlyphs "ShowMissingGlyphs" #define XtCSignalInhibit "SignalInhibit" #define XtCTekInhibit "TekInhibit" #define XtCTekSmall "TekSmall" @@ -748,6 +758,7 @@ extern void initPtyData (PtyData *data); #if OPT_WIDE_CHARS extern Char * convertToUTF8(Char *lp, unsigned c); +extern void switchPtyData(TScreen *screen, PtyData *data, int f); extern void writePtyData(int f, IChar *d, unsigned len); #else #define writePtyData(f,d,len) v_write(f,d,len) @@ -766,16 +777,28 @@ extern void ScrnInsertChar (TScreen *screen, int n); extern void ScrnInsertLine (TScreen *screen, ScrnBuf sb, int last, int where, int n, int size); extern void ScrnRefresh (TScreen *screen, int toprow, int leftcol, int nrows, int ncols, Bool force); -#define ScrnClrWrapped(screen, row) \ +#define ScrnClrFlag(screen, row, flag) \ SCRN_BUF_FLAGS(screen, row + screen->topline) = \ - (Char *)((long)SCRN_BUF_FLAGS(screen, row + screen->topline) & ~ LINEWRAPPED) + (Char *)((long)SCRN_BUF_FLAGS(screen, row + screen->topline) & ~ (flag)) -#define ScrnSetWrapped(screen, row) \ +#define ScrnSetFlag(screen, row, flag) \ SCRN_BUF_FLAGS(screen, row + screen->topline) = \ - (Char *)(((long)SCRN_BUF_FLAGS(screen, row + screen->topline) | LINEWRAPPED)) + (Char *)(((long)SCRN_BUF_FLAGS(screen, row + screen->topline) | (flag))) -#define ScrnTstWrapped(screen, row) \ - ((row + screen->savelines + screen->topline) >= 0 && ((long)SCRN_BUF_FLAGS(screen, row + screen->topline) & LINEWRAPPED) != 0) +#define ScrnTstFlag(screen, row, flag) \ + ((row + screen->savelines + screen->topline) >= 0 && ((long)SCRN_BUF_FLAGS(screen, row + screen->topline) & (flag)) != 0) + +#define ScrnClrBlinked(screen, row) ScrnClrFlag(screen, row, BLINK) +#define ScrnSetBlinked(screen, row) ScrnSetFlag(screen, row, BLINK) +#define ScrnTstBlinked(screen, row) ScrnTstFlag(screen, row, BLINK) + +#define ScrnClrWrapped(screen, row) ScrnClrFlag(screen, row, LINEWRAPPED) +#define ScrnSetWrapped(screen, row) ScrnSetFlag(screen, row, LINEWRAPPED) +#define ScrnTstWrapped(screen, row) ScrnTstFlag(screen, row, LINEWRAPPED) + +#if OPT_WIDE_CHARS +extern void ChangeToWide(TScreen * screen); +#endif /* scrollbar.c */ extern void DoResizeScreen (XtermWidget xw); diff --git a/programs/xterm/xterm.log.html b/programs/xterm/xterm.log.html index 80c762c7a..9138194e8 100644 --- a/programs/xterm/xterm.log.html +++ b/programs/xterm/xterm.log.html @@ -1,7 +1,7 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!-- ***************************************************************************** - * Copyright 1996-2002,2003 by Thomas E. Dickey * + * Copyright 1996-2003,2004 by Thomas E. Dickey * * All Rights Reserved. * * * * Permission to use, copy, modify, and distribute this software and its * @@ -30,7 +30,7 @@ </HEAD> <BODY> <HR> -Copyright 1997-2002,2003 by <A +Copyright 1997-2003,2004 by <A HREF="mailto:dickey@invisible-island.net">Thomas E. Dickey</A> <HR> <H1>Contents</H1> @@ -43,7 +43,7 @@ in the XFree86 CHANGELOG (found in the unbundled tree, xc/programs/Xserver/hw/xfree86). <UL> -<LI><A HREF="#xterm_dev">Development - 2004/1/31 - XFree86 4.3.99.903</A> +<LI><A HREF="#xterm_185">Patch #185 - 2004/3/3 - XFree86 4.4</A> <LI><A HREF="#xterm_184">Patch #184 - 2003/12/31 - XFree86 4.3.99.903</A> <LI><A HREF="#xterm_183">Patch #183 - 2003/12/26 - XFree86 4.3.99.903</A> <LI><A HREF="#xterm_182">Patch #182 - 2003/12/2 - XFree86 4.3.99.901</A> @@ -231,8 +231,59 @@ xc/programs/Xserver/hw/xfree86). <LI><A HREF="#xterm_01">Patch #1 - 1996/1/6</A> </UL> -<H1><A NAME="xterm_dev">Development - 2004/1/31 - XFree86 4.3.99.903</A></H1> +<H1><A NAME="xterm_185">Patch #185 - 2004/3/3 - XFree86 4.4</A></H1> <ul> + <li>fix tcap-query logic for the backspace key (XFree86 Bugzilla #1233, + report/patch by Anton Kovalenko). + + <li>add test-scripts resize.pl and tcapquery.pl + + <li>add translation to ASCII of commonly-used characters that groff + translates to Unicode, when the font in use does not provide the + corresponding glyphs (Debian #219551). + + <li>modify RequestMaximize(), which performs maximize/restore via + control sequences, to account for window-frame (patch by + Jess Thrysoee). + + <li>improve pattern used in <code>uxterm</code> to check for UTF-8 + locale, e.g., for HPUX (patch by H Merijn Brand). + + <li>add <code>-fd</code> option and resource + <code>faceNameDoublesize</code> to specify double-wide fonts with + Xft (adapted from patch by Zarick Lau). + + <li>change a couple of resource classes from "Boolean" to specific + values: <code>freeBoldBox</code>, <code>forceBoxChars</code>. + + <li>add resource <code>showMissingGlyphs</code> to outline places on + the screen where a font lacks the corresponding glyph. + + <li>add resource <code>showBlinkAsBold</code> to control whether + blinking text should be shown as bold or actual blinking text. + + <li>improve logic in ShowCursor() to avoid repainting the cursor when + it is already visible, e.g., in response to the DECTCEM escape + sequence. This also addresses XFree86 Bugzilla #1158. + + <li>implement blinking text, using the timer for blinking cursor. + + <li>modify FreeType support to allow resizing the font, in the same + ways the window can be resized if fixed fonts are used. The + relative font sizes are derived from the fixed font sizes. + + <li>add menu items and corresponding actions for switching on/off + the UTF-8 mode and Xft (TrueType) support. + + <li>add logic to handle switching UTF-8 mode on/off. It worked if + the escape sequences were flushed, but if data was mixed in with + the same write, some were not handled properly (report by + Nicolas George). + + <li>modify to allow turning UTF-8 mode via escape sequence even if + <code>-wc</code> option was not given at startup (patch by Peter + Berg Larsen). + <li>amend fix for XFree86 Bugzilla #981, adjusting for savedlines value (report by Tim Adye). diff --git a/programs/xterm/xterm.man b/programs/xterm/xterm.man index 4fb784dab..d8e209de0 100644 --- a/programs/xterm/xterm.man +++ b/programs/xterm/xterm.man @@ -1,7 +1,7 @@ .\" $Xorg: xterm.man,v 1.4 2001/02/09 02:06:03 xorgcvs Exp $ .\" .\" -.\" Copyright 1996-2002,2003 by Thomas E. Dickey +.\" Copyright 1996-2003,2004 by Thomas E. Dickey .\" .\" All Rights Reserved .\" @@ -54,7 +54,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xterm/xterm.man,v 3.98 2003/11/23 05:40:37 dawes Exp $ +.\" $XFree86: xc/programs/xterm/xterm.man,v 3.99 2003/11/23 23:53:14 dickey Exp $ .\" .\" updated by Thomas E. Dickey for XFree86, July 1996 - November 2003. .TH XTERM 1 __vendorversion__ @@ -95,8 +95,6 @@ The VT102 emulation is fairly complete, but does not support autorepeat. Double-size characters are displayed properly if your font server supports scalable fonts. -Blinking characters are partially implemented; -the emulation is functional but does not have the appearance of a real VT102. The VT220 emulation does not support soft fonts, it is otherwise complete. .IR Termcap (5) entries that work with @@ -420,6 +418,11 @@ If any are missing, xterm will draw the characters directly. This option indicates that \fIxterm\fP should assume that the normal and bold fonts have VT100 line-drawing characters. .TP 8 +.BI \-fd " pattern" +This option sets the pattern for double-width fonts selected from the FreeType +library if support for that library was compiled into xterm. +This corresponds to the \fBfaceNameDoublesize\fP resource. +.TP 8 .BI \-fi " font" This option sets the font for active icons if that feature was compiled into xterm. @@ -1490,11 +1493,13 @@ The default is ``black.'' .B "cursorOffTime (\fPclass\fB CursorOffTime)" Specifies the duration of the "off" part of the cursor blink cycle-time in milliseconds. +The same timer is used for text blinking. The default is 300. .TP 8 .B "cursorOnTime (\fPclass\fB CursorOnTime)" Specifies the duration of the "on" part of the cursor blink cycle-time, in milliseconds. +The same timer is used for text blinking. The default is 600. .TP 8 .B "highlightColor (\fPclass\fB HighlightColor)" @@ -1546,6 +1551,13 @@ If not specified, or if there is no match for both normal and bold fonts, \fIxterm\fR uses the \fBfont\fP and related resources. .TP 8 +.B "faceNameDoublesize (\fPclass\fB FaceNameDoublesize)" +Specify an double-width font for cases where an application requires +this, e.g., in CJK applications. +There is no default. +If the application uses double-wide characters and this resource is not given, +\fIxterm\fP will use a scaled version of the font given by \fBfaceName\fP. +.TP 8 .B "faceSize (\fPclass\fB FaceSize)" Specify the pointsize for fonts selected from the FreeType library if support for that library was compiled into \fIxterm\fR. @@ -1585,7 +1597,7 @@ The default is ``true''. If disabled, \fIxterm\fP will simulate doublesize characters by drawing normal characters with spaces between them. .TP 8 -.B "forceBoxChars (\fPclass\fB Boolean)" +.B "forceBoxChars (\fPclass\fB ForceBoxChars)" Specifies whether \fIxterm\fP should assume the normal and bold fonts have VT100 line-drawing characters. If ``false'', \fIxterm\fP will check for missing characters in the 1-31 @@ -1600,7 +1612,7 @@ that would normally appear in the text color change color. The default is ``black.'' .TP 8 -.B "freeBoldBox (\fPclass\fB Boolean)" +.B "freeBoldBox (\fPclass\fB freeBoldBox)" Specifies whether \fIxterm\fP should assume the bounding boxes for normal and bold fonts are compatible. If ``false'', \fIxterm\fP compares them and will reject choices of @@ -1857,6 +1869,11 @@ Controls whether a form feed is sent to the printer at the end of a print page function. The default is ``false.'' .TP 8 +.B "renderFont (\fPclass\fB RenderFont)" +If \fIxterm\fR is built with the Xft library, +this controls whether the \fBfaceName\fR resource is used. +The default is ``true.'' +.TP 8 .B "resizeGravity (\fPclass\fB ResizeGravity)" Affects the behavior when the window is resized to be taller or shorter. @@ -1922,6 +1939,18 @@ Specifies whether to enable the actions the shifted KP_Add and KP_Subtract. The default is ``true.'' .TP 8 +.B "showBlinkAsBold (\fPclass\fB ShowBlinkAsBold)" +Tells \fIxterm\fP whether to display text with blink-attribute the same +as bold. +If \fIxterm\fP has not been configured to support blinking text, +the default is ``true.'', which corresponds to older versions of xterm, +otherwise the default is ``false.'' +.TP 8 +.B "showMissingGlyphs (\fPclass\fB ShowMissingGlyphs)" +Tells \fIxterm\fP whether to display a box outlining places where +a character has been used that the font does not represent. +The default is ``false.'' +.TP 8 .B "signalInhibit (\fPclass\fB SignalInhibit)" Specifies whether or not the entries in the ``Main Options'' menu for sending signals to \fIxterm\fP should be disallowed. @@ -2300,6 +2329,12 @@ This entry invokes the \fBset-font-linedrawing(s)\fP action. .TP 8 .B "font-doublesize (\fPclass\fB SmeBSB)" This entry invokes the \fBset-font-doublesize(s)\fP action. +.TP 8 +.B "render-font (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-render-font(s)\fP action. +.TP 8 +.B "utf8-mode (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-utf8-mode(s)\fP action. . .PP The \fItekMenu\fP has the following entries: @@ -2980,6 +3015,10 @@ This action toggles the state of the \fBnumLock\fP resource. This action toggles the \fBpopOnBell\fP resource and is also invoked by the \fBpoponbell\fP entry in \fIvtMenu\fP. .TP 8 +.B "set-render-font(\fIon/off/toggle\fP)" +This action toggles the \fBrenderFont\fP resource and is also invoked by +the \fBrender-font\fP entry in \fIfontMenu\fP. +.TP 8 .B "set-reverse-video(\fIon/off/toggle\fP)" This action toggles the \fIreverseVideo\fP resource and is also invoked by the \fBreversevideo\fP entry in \fIvtMenu\fP. @@ -3030,6 +3069,10 @@ It is also invoked by the This action toggles the \fBtiteInhibit\fP resource, which controls switching between the alternate and current screens. .TP 8 +.B "set-utf8-mode(\fIon/off/toggle\fP)" +This action toggles the \fButf8\fP resource and is also invoked by +the \fButf8-mode\fP entry in \fIfontMenu\fP. +.TP 8 .B "set-visibility(\fIvt/tek\fP,\fIon/off/toggle\fP)" This action controls whether or not the \fIvt\fP or \fItek\fP windows are visible. diff --git a/programs/xterm/xterm_io.h b/programs/xterm/xterm_io.h index 9222fe9cb..43edafc11 100644 --- a/programs/xterm/xterm_io.h +++ b/programs/xterm/xterm_io.h @@ -1,9 +1,9 @@ /* - * $XFree86: xc/programs/xterm/xterm_io.h,v 1.12 2003/12/25 22:04:05 dickey Exp $ + * $XFree86: xc/programs/xterm/xterm_io.h,v 1.13 2004/01/07 04:28:07 dawes Exp $ */ /* - * Copyright 2000-2002,2003 by Thomas E. Dickey + * Copyright 2000-2003,2004 by Thomas E. Dickey * * All Rights Reserved * diff --git a/programs/xterm/xtermcfg.hin b/programs/xterm/xtermcfg.hin index 7b3722366..a848a82bc 100644 --- a/programs/xterm/xtermcfg.hin +++ b/programs/xterm/xtermcfg.hin @@ -1,10 +1,10 @@ /* - * $XFree86: xc/programs/xterm/xtermcfg.hin,v 3.46 2003/05/21 22:59:14 dickey Exp $ + * $XFree86: xc/programs/xterm/xtermcfg.hin,v 3.47 2003/10/27 01:07:58 dickey Exp $ */ /************************************************************ -Copyright 1997-2002,2003 by Thomas E. Dickey +Copyright 1997-2003,2004 by Thomas E. Dickey All Rights Reserved @@ -73,6 +73,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #undef OPT_88_COLORS /* CF_ARG_ENABLE(88-color) */ #undef OPT_AIX_COLORS /* CF_ARG_DISABLE(16-color) */ #undef OPT_BLINK_CURS /* CF_ARG_DISABLE(blink-cursor) */ +#undef OPT_BLINK_TEXT /* CF_ARG_DISABLE(blink-text) */ #undef OPT_BOX_CHARS /* CF_ARG_DISABLE(boxchars) */ #undef OPT_BROKEN_OSC /* CF_ARG_ENABLE(broken-osc) */ #undef OPT_BROKEN_ST /* CF_ARG_DISABLE(broken-st) */ |