diff --git a/app/xterm/INSTALL b/app/xterm/INSTALL index 9d555fc8f..2554ca29f 100644 --- a/app/xterm/INSTALL +++ b/app/xterm/INSTALL @@ -1,4 +1,4 @@ --- $XTermId: INSTALL,v 1.148 2013/06/23 20:22:46 tom Exp $ +-- $XTermId: INSTALL,v 1.149 2013/08/04 19:33:14 tom Exp $ ------------------------------------------------------------------------------- -- Copyright 1997-2012,2013 by Thomas E. Dickey -- @@ -30,23 +30,12 @@ ------------------------------------------------------------------------------- Xterm was originally built as part of the X Window System source tree, using -imake to generate a Makefile from Imakefile. You can also use the configure -script to generate a Makefile from Makefile.in: +imake to generate a Makefile from Imakefile. - + If you have imake (or xmkmf), then you can use those directly, - or use the configure script, which normally uses those tools - to obtain the special definitions needed to build xterm. +An example Imakefile is provided for legacy use. - Ultimately, imake will not be necessary, since it is possible - to add configure tests that derive the information that imake - would supply. - - + You need the Athena widgets (or a clone, such as Xaw3d or - neXtaw), to provide the popup menus. - -Even if you have imake, the configure script is still convenient because -it allows you to build different configurations more easily than with -imake, simply by specifying options to the configure script. +The preferred method uses the configure script to generate a Makefile from +Makefile.in Options: ------- @@ -221,6 +210,15 @@ The options (in alphabetic order): tool. Normally these chunks of memory are retained as long as xterm is running. + --disable-luit disable support for luit filter (Unicode translation) + + Luit is a filter that can be run between an arbitrary application and a + UTF-8 terminal emulator. It will convert application output from the + locale's encoding into UTF-8, and convert terminal input from UTF-8 + into the locale's encoding. + + This is normally enabled, relying upon "--enable-wide-chars". + --disable-maximize disable actions for iconify/deiconify/maximize/restore Do not compile-in code that implements runtime 'actions' for @@ -341,6 +339,12 @@ The options (in alphabetic order): A genuine vt100 emulates a vt52. + --disable-wide-chars disable wide-character support + + The wide-character code supports Unicode and UTF-8. + + This is normally enabled. + --disable-ziconbeep disable -ziconbeep option Do not compile-in code that modifies the icon's title and sounds a @@ -436,15 +440,6 @@ The options (in alphabetic order): Logging was disabled in X11R5 xterm because of security problems. They were addressed in X11R6, but the feature was not reinstated. - --enable-luit enable support for luit filter (Unicode translation) - - Luit is a filter that can be run between an arbitrary application and a - UTF-8 terminal emulator. It will convert application output from the - locale's encoding into UTF-8, and convert terminal input from UTF-8 - into the locale's encoding. - - This sets "--enable-wide-chars" as a side-effect. - --enable-meta-sends-esc set default metaSendsEscape resource (default: no) This sets the default resource value, which is shown in the manpage. @@ -523,11 +518,6 @@ The options (in alphabetic order): I use this option regularly, and correct all but a few (difficult) problems. - --enable-wide-chars enable wide-character support - - Compile-in code that supports 16-bit characters. Includes support - for UTF-8. - --enable-xmc-glitch test: enable xmc magic-cookie emulation Compile-in code that simulates the terminfo "magic cookie" glitch. diff --git a/app/xterm/MANIFEST b/app/xterm/MANIFEST index 5675bd8dd..499d9ab9d 100644 --- a/app/xterm/MANIFEST +++ b/app/xterm/MANIFEST @@ -1,4 +1,4 @@ -MANIFEST for xterm-296, version xterm-296 +MANIFEST for xterm-300, version xterm-300 -------------------------------------------------------------------------------- MANIFEST this file 256colres.h resource-definitions for 256-color mode @@ -48,6 +48,7 @@ fontutils.c xterm functions for (re)loading fonts fontutils.h interface of fontutils.c gen-pc-fkeys.pl script to generate extended function-key terminfo graphics.c graphics support functions for 'xterm' +graphics.h interface of graphics.c input.c VT100 key-symbol and function-key translation install-sh install-script (needed by configure) keysym2ucs.c lookup-table for UTF-8 to keysyms diff --git a/app/xterm/THANKS b/app/xterm/THANKS index dbcc4af6b..a38ebf9a1 100644 --- a/app/xterm/THANKS +++ b/app/xterm/THANKS @@ -1,4 +1,4 @@ --- $XTermId: THANKS,v 1.9 2013/07/04 23:04:24 tom Exp $ +-- $XTermId: THANKS,v 1.11 2013/08/08 08:24:07 tom Exp $ -- vile:txtmode fk=8bit There's no AUTHORS file in this distribution; it would be redundant since I (Thomas E. Dickey) have done more than 80% of the work on xterm since 1996. @@ -81,6 +81,7 @@ H Merijn Brand Hasso Tepper Holger Veit Ilya Zakharevich +Iwamoto Kouichi James Armstrong Jason Bacon Jason Vas Dias @@ -149,6 +150,7 @@ Peter Berg Larsen Pierre Lombard Richard Braakman Richard Griswold +Richard Tollerton Rob Braun Robert Brady Robert Earl diff --git a/app/xterm/Tekproc.c b/app/xterm/Tekproc.c index be2eeb1b0..74521eb3a 100644 --- a/app/xterm/Tekproc.c +++ b/app/xterm/Tekproc.c @@ -1,7 +1,7 @@ -/* $XTermId: Tekproc.c,v 1.193 2012/09/07 09:08:44 tom Exp $ */ +/* $XTermId: Tekproc.c,v 1.194 2012/09/07 09:08:44 tom Exp $ */ /* - * Copyright 2001-2010,2011 by Thomas E. Dickey + * Copyright 2001-2011,2012 by Thomas E. Dickey * * All Rights Reserved * diff --git a/app/xterm/VTPrsTbl.c b/app/xterm/VTPrsTbl.c index 7414ee918..9f67957c8 100644 --- a/app/xterm/VTPrsTbl.c +++ b/app/xterm/VTPrsTbl.c @@ -1,7 +1,7 @@ -/* $XTermId: VTPrsTbl.c,v 1.69 2012/09/10 23:28:14 tom Exp $ */ +/* $XTermId: VTPrsTbl.c,v 1.73 2013/08/21 23:50:44 tom Exp $ */ /* - * Copyright 1999-2011,2012 by Thomas E. Dickey + * Copyright 1999-2012,2013 by Thomas E. Dickey * * All Rights Reserved * @@ -5971,7 +5971,7 @@ CASE_ESC_IGNORE, CASE_ESC_IGNORE, /* $ % & ' */ CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_SCS_PERCENT, CASE_ESC_IGNORE, CASE_ESC_IGNORE, /* ( ) * + */ @@ -6000,9 +6000,9 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* < = > ? */ -CASE_GROUND_STATE, CASE_GSETS, -CASE_GROUND_STATE, +CASE_GSETS, +CASE_GSETS, CASE_GROUND_STATE, /* @ A B C */ CASE_GROUND_STATE, @@ -6045,7 +6045,7 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* ` a b c */ -CASE_GROUND_STATE, +CASE_GSETS, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -6131,7 +6131,7 @@ CASE_ESC_IGNORE, CASE_ESC_IGNORE, /* currency yen brokenbar section */ CASE_ESC_IGNORE, -CASE_ESC_IGNORE, +CASE_SCS_PERCENT, CASE_ESC_IGNORE, CASE_ESC_IGNORE, /* diaeresis copyright ordfeminine guillemotleft */ @@ -6160,9 +6160,9 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* onequarter onehalf threequarters questiondown */ -CASE_GROUND_STATE, CASE_GSETS, -CASE_GROUND_STATE, +CASE_GSETS, +CASE_GSETS, CASE_GROUND_STATE, /* Agrave Aacute Acircumflex Atilde */ CASE_GROUND_STATE, @@ -6205,7 +6205,7 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* agrave aacute acircumflex atilde */ -CASE_GROUND_STATE, +CASE_GSETS, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -7222,6 +7222,330 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_IGNORE, }; + +Const PARSE_T scs_pct_table[] = /* SCS % */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_ENQ, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* FF CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_SO, +CASE_SI, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_GROUND_STATE, +CASE_IGNORE, +CASE_GROUND_STATE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* $ % & ' */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* ( ) * + */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* , - . / */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* 0 1 2 3 */ +CASE_GSETS_PERCENT, +CASE_GROUND_STATE, +CASE_GSETS_PERCENT, +CASE_GSETS_PERCENT, +/* 4 5 6 7 */ +CASE_GROUND_STATE, +CASE_GSETS_PERCENT, +CASE_GSETS_PERCENT, +CASE_GROUND_STATE, +/* 8 9 : ; */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* < = > ? */ +CASE_GROUND_STATE, +CASE_GSETS_PERCENT, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* @ A B C */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* D E F G */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* H I J K */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* L M N O */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* P Q R S */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* T U V W */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* X Y Z [ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* \ ] ^ _ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ` a b c */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* d e f g */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* h i j k */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* l m n o */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* p q r s */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* t u v w */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* x y z { */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* | } ~ DEL */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, +CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* currency yen brokenbar section */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* notsign hyphen registered macron */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* acute mu paragraph periodcentered */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* cedilla onesuperior masculine guillemotright */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* onequarter onehalf threequarters questiondown */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_GSETS_PERCENT, +CASE_GROUND_STATE, +CASE_GSETS_PERCENT, +CASE_GROUND_STATE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_GROUND_STATE, +CASE_GSETS_PERCENT, +CASE_GSETS_PERCENT, +CASE_GROUND_STATE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_GROUND_STATE, +CASE_GSETS_PERCENT, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Eth Ntilde Ograve Oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* agrave aacute acircumflex atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* adiaeresis aring ae ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* igrave iacute icircumflex idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* eth ntilde ograve oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ocircumflex otilde odiaeresis division */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* oslash ugrave uacute ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +}; #endif /* OPT_WIDE_CHARS */ #if OPT_VT52_MODE diff --git a/app/xterm/VTparse.def b/app/xterm/VTparse.def index 0c0917321..820c6b408 100644 --- a/app/xterm/VTparse.def +++ b/app/xterm/VTparse.def @@ -1,10 +1,10 @@ -# $XTermId: VTparse.def,v 1.46 2012/09/10 23:26:44 tom Exp $ +# $XTermId: VTparse.def,v 1.47 2013/08/19 00:39:14 tom Exp $ # # vile:confmode rs=lf # ----------------------------------------------------------------------------- # this file is part of xterm # -# Copyright 1996-2011,2012 by Thomas E. Dickey +# Copyright 1996-2012,2013 by Thomas E. Dickey # # All Rights Reserved # @@ -197,3 +197,5 @@ CASE_VPR CASE_ANSI_SC CASE_ANSI_RC CASE_ESC_COLON +CASE_SCS_PERCENT +CASE_GSETS_PERCENT diff --git a/app/xterm/VTparse.h b/app/xterm/VTparse.h index 464c62395..5ee7a8e54 100644 --- a/app/xterm/VTparse.h +++ b/app/xterm/VTparse.h @@ -1,7 +1,7 @@ -/* $XTermId: VTparse.h,v 1.61 2013/06/23 21:12:13 tom Exp $ */ +/* $XTermId: VTparse.h,v 1.62 2013/08/19 00:39:54 tom Exp $ */ /* - * Copyright 2002-2011,2012 by Thomas E. Dickey + * Copyright 2002-2012,2013 by Thomas E. Dickey * * All Rights Reserved * @@ -106,6 +106,7 @@ extern Const PARSE_T vt52_ignore_table[]; #if OPT_WIDE_CHARS extern Const PARSE_T esc_pct_table[]; +extern Const PARSE_T scs_pct_table[]; #endif /* @@ -278,5 +279,7 @@ extern Const PARSE_T esc_pct_table[]; #define CASE_ANSI_SC 156 #define CASE_ANSI_RC 157 #define CASE_ESC_COLON 158 +#define CASE_SCS_PERCENT 159 +#define CASE_GSETS_PERCENT 160 #endif /* included_VTparse_h */ diff --git a/app/xterm/button.c b/app/xterm/button.c index 79ec8bd7d..8b39e3b09 100644 --- a/app/xterm/button.c +++ b/app/xterm/button.c @@ -1,4 +1,4 @@ -/* $XTermId: button.c,v 1.458 2013/07/01 00:50:20 tom Exp $ */ +/* $XTermId: button.c,v 1.465 2013/11/27 00:43:43 tom Exp $ */ /* * Copyright 1999-2012,2013 by Thomas E. Dickey @@ -147,24 +147,24 @@ static Time lastButton3DoubleDownTime = 0; static CELL lastButton3; /* At the release time */ #endif /* OPT_READLINE */ -static Char *SaveText(TScreen * screen, int row, int scol, int ecol, - Char * lp, int *eol); -static int Length(TScreen * screen, int row, int scol, int ecol); -static void ComputeSelect(XtermWidget xw, CELL * startc, CELL * endc, Bool extend); +static Char *SaveText(TScreen *screen, int row, int scol, int ecol, + Char *lp, int *eol); +static int Length(TScreen *screen, int row, int scol, int ecol); +static void ComputeSelect(XtermWidget xw, CELL *startc, CELL *endc, Bool extend); static void EditorButton(XtermWidget xw, XButtonEvent * event); -static void EndExtend(XtermWidget w, XEvent * event, String * params, Cardinal +static void EndExtend(XtermWidget w, XEvent * event, String *params, Cardinal num_params, Bool use_cursor_loc); -static void ExtendExtend(XtermWidget xw, const CELL * cell); -static void PointToCELL(TScreen * screen, int y, int x, CELL * cell); -static void ReHiliteText(XtermWidget xw, CELL * first, CELL * last); -static void SaltTextAway(XtermWidget xw, CELL * cellc, CELL * cell); -static void SelectSet(XtermWidget xw, XEvent * event, String * params, Cardinal num_params); +static void ExtendExtend(XtermWidget xw, const CELL *cell); +static void PointToCELL(TScreen *screen, int y, int x, CELL *cell); +static void ReHiliteText(XtermWidget xw, CELL *first, CELL *last); +static void SaltTextAway(XtermWidget xw, CELL *cellc, CELL *cell); +static void SelectSet(XtermWidget xw, XEvent * event, String *params, Cardinal num_params); static void SelectionReceived PROTO_XT_SEL_CB_ARGS; -static void StartSelect(XtermWidget xw, const CELL * cell); +static void StartSelect(XtermWidget xw, const CELL *cell); static void TrackDown(XtermWidget xw, XButtonEvent * event); -static void TrackText(XtermWidget xw, const CELL * first, const CELL * last); -static void _OwnSelection(XtermWidget xw, String * selections, Cardinal count); -static void do_select_end(XtermWidget xw, XEvent * event, String * params, +static void TrackText(XtermWidget xw, const CELL *first, const CELL *last); +static void _OwnSelection(XtermWidget xw, String *selections, Cardinal count); +static void do_select_end(XtermWidget xw, XEvent * event, String *params, Cardinal *num_params, Bool use_cursor_loc); #define MOUSE_LIMIT (255 - 32) @@ -174,7 +174,7 @@ static void do_select_end(XtermWidget xw, XEvent * event, String * params, #define EXT_MOUSE_START (127 - 32) static int -MouseLimit(TScreen * screen) +MouseLimit(TScreen *screen) { int mouse_limit; @@ -194,7 +194,7 @@ MouseLimit(TScreen * screen) } static unsigned -EmitMousePosition(TScreen * screen, Char line[], unsigned count, int value) +EmitMousePosition(TScreen *screen, Char line[], unsigned count, int value) { int mouse_limit = MouseLimit(screen); @@ -237,7 +237,7 @@ EmitMousePosition(TScreen * screen, Char line[], unsigned count, int value) } static unsigned -EmitMousePositionSeparator(TScreen * screen, Char line[], unsigned count) +EmitMousePositionSeparator(TScreen *screen, Char line[], unsigned count) { switch (screen->extend_coords) { case SET_SGR_EXT_MODE_MOUSE: @@ -726,7 +726,7 @@ CheckLocatorPosition(XtermWidget xw, XButtonEvent * event) #if OPT_READLINE static int -isClick1_clean(TScreen * screen, XButtonEvent * event) +isClick1_clean(TScreen *screen, XButtonEvent * event) { int delta; @@ -755,7 +755,7 @@ isClick1_clean(TScreen * screen, XButtonEvent * event) } static int -isDoubleClick3(TScreen * screen, XButtonEvent * event) +isDoubleClick3(TScreen *screen, XButtonEvent * event) { int delta; @@ -794,7 +794,7 @@ isDoubleClick3(TScreen * screen, XButtonEvent * event) } static int -CheckSecondPress3(TScreen * screen, XEvent * event) +CheckSecondPress3(TScreen *screen, XEvent * event) { int delta; @@ -833,7 +833,7 @@ CheckSecondPress3(TScreen * screen, XEvent * event) } static int -rowOnCurrentLine(TScreen * screen, +rowOnCurrentLine(TScreen *screen, int line, int *deltap) /* must be XButtonEvent */ { @@ -863,13 +863,13 @@ rowOnCurrentLine(TScreen * screen, } static int -eventRow(TScreen * screen, XEvent * event) /* must be XButtonEvent */ +eventRow(TScreen *screen, XEvent * event) /* must be XButtonEvent */ { return (event->xbutton.y - screen->border) / FontHeight(screen); } static int -eventColBetween(TScreen * screen, XEvent * event) /* must be XButtonEvent */ +eventColBetween(TScreen *screen, XEvent * event) /* must be XButtonEvent */ { /* Correct by half a width - we are acting on a boundary, not on a cell. */ return ((event->xbutton.x - OriginX(screen) + (FontWidth(screen) - 1) / 2) @@ -877,7 +877,7 @@ eventColBetween(TScreen * screen, XEvent * event) /* must be XButtonEvent */ } static int -ReadLineMovePoint(TScreen * screen, int col, int ldelta) +ReadLineMovePoint(TScreen *screen, int col, int ldelta) { Char line[6]; unsigned count = 0; @@ -900,7 +900,7 @@ ReadLineMovePoint(TScreen * screen, int col, int ldelta) } static int -ReadLineDelete(TScreen * screen, CELL * cell1, CELL * cell2) +ReadLineDelete(TScreen *screen, CELL *cell1, CELL *cell2) { int del; @@ -913,7 +913,7 @@ ReadLineDelete(TScreen * screen, CELL * cell1, CELL * cell2) } static void -readlineExtend(TScreen * screen, XEvent * event) +readlineExtend(TScreen *screen, XEvent * event) { int ldelta1, ldelta2; @@ -940,7 +940,7 @@ readlineExtend(TScreen * screen, XEvent * event) void DiredButton(Widget w, XEvent * event, /* must be XButtonEvent */ - String * params GCC_UNUSED, /* selections */ + String *params GCC_UNUSED, /* selections */ Cardinal *num_params GCC_UNUSED) { XtermWidget xw; @@ -971,7 +971,7 @@ DiredButton(Widget w, void ReadLineButton(Widget w, XEvent * event, /* must be XButtonEvent */ - String * params GCC_UNUSED, /* selections */ + String *params GCC_UNUSED, /* selections */ Cardinal *num_params GCC_UNUSED) { XtermWidget xw; @@ -1028,7 +1028,7 @@ ReadLineButton(Widget w, void ViButton(Widget w, XEvent * event, /* must be XButtonEvent */ - String * params GCC_UNUSED, /* selections */ + String *params GCC_UNUSED, /* selections */ Cardinal *num_params GCC_UNUSED) { XtermWidget xw; @@ -1067,7 +1067,7 @@ ViButton(Widget w, void HandleSelectExtend(Widget w, XEvent * event, /* must be XMotionEvent */ - String * params GCC_UNUSED, + String *params GCC_UNUSED, Cardinal *num_params GCC_UNUSED) { XtermWidget xw; @@ -1076,7 +1076,7 @@ HandleSelectExtend(Widget w, TScreen *screen = TScreenOf(xw); CELL cell; - TRACE(("HandleSelectExtend\n")); + TRACE(("HandleSelectExtend @%ld\n", event->xmotion.time)); screen->selection_time = event->xmotion.time; switch (screen->eventMode) { @@ -1103,7 +1103,7 @@ HandleSelectExtend(Widget w, void HandleKeyboardSelectExtend(Widget w, XEvent * event GCC_UNUSED, /* must be XButtonEvent */ - String * params GCC_UNUSED, + String *params GCC_UNUSED, Cardinal *num_params GCC_UNUSED) { XtermWidget xw; @@ -1119,13 +1119,14 @@ HandleKeyboardSelectExtend(Widget w, static void do_select_end(XtermWidget xw, XEvent * event, /* must be XButtonEvent */ - String * params, /* selections */ + String *params, /* selections */ Cardinal *num_params, Bool use_cursor_loc) { TScreen *screen = TScreenOf(xw); screen->selection_time = event->xbutton.time; + TRACE(("do_select_end @%ld\n", screen->selection_time)); switch (screen->eventMode) { case NORMAL: (void) SendMousePosition(xw, event); @@ -1143,7 +1144,7 @@ do_select_end(XtermWidget xw, void HandleSelectEnd(Widget w, XEvent * event, /* must be XButtonEvent */ - String * params, /* selections */ + String *params, /* selections */ Cardinal *num_params) { XtermWidget xw; @@ -1157,7 +1158,7 @@ HandleSelectEnd(Widget w, void HandleKeyboardSelectEnd(Widget w, XEvent * event, /* must be XButtonEvent */ - String * params, /* selections */ + String *params, /* selections */ Cardinal *num_params) { XtermWidget xw; @@ -1174,7 +1175,7 @@ HandleKeyboardSelectEnd(Widget w, void HandleCopySelection(Widget w, XEvent * event, - String * params, /* list of targets */ + String *params, /* list of targets */ Cardinal *num_params) { XtermWidget xw; @@ -1204,7 +1205,7 @@ DECtoASCII(unsigned ch) #if OPT_WIDE_CHARS static Cardinal -addXtermChar(Char ** buffer, Cardinal *used, Cardinal offset, unsigned value) +addXtermChar(Char **buffer, Cardinal *used, Cardinal offset, unsigned value) { if (offset + 1 >= *used) { *used = 1 + (2 * (offset + 1)); @@ -1221,7 +1222,7 @@ addXtermChar(Char ** buffer, Cardinal *used, Cardinal offset, unsigned value) * or ASCII/Latin-1 equivalents for special cases. */ static Char * -UTF8toLatin1(TScreen * screen, Char * s, unsigned long len, unsigned long *result) +UTF8toLatin1(TScreen *screen, Char *s, unsigned long len, unsigned long *result) { static Char *buffer; static Cardinal used; @@ -1449,7 +1450,7 @@ overrideTargets(Widget w, String value, Atom ** resultp) #if OPT_WIDE_CHARS static Atom * -allocUtf8Targets(Widget w, TScreen * screen) +allocUtf8Targets(Widget w, TScreen *screen) { Atom **resultp = &(screen->selection_targets_utf8); @@ -1485,7 +1486,7 @@ allocUtf8Targets(Widget w, TScreen * screen) #endif static Atom * -alloc8bitTargets(Widget w, TScreen * screen) +alloc8bitTargets(Widget w, TScreen *screen) { Atom **resultp = &(screen->selection_targets_8bit); @@ -1569,7 +1570,7 @@ UnmapSelections(XtermWidget xw) * call to XmuInternStrings(). */ static String * -MapSelections(XtermWidget xw, String * params, Cardinal num_params) +MapSelections(XtermWidget xw, String *params, Cardinal num_params) { String *result = params; @@ -1676,7 +1677,7 @@ static void xtermGetSelection(Widget w, Time ev_time, - String * params, /* selections in precedence order */ + String *params, /* selections in precedence order */ Cardinal num_params, Atom * targets) { @@ -1691,7 +1692,7 @@ xtermGetSelection(Widget w, if ((xw = getXtermWidget(w)) == 0) return; - TRACE(("xtermGetSelection num_params %d\n", num_params)); + TRACE(("xtermGetSelection num_params %d @%ld\n", num_params, ev_time)); params = MapSelections(xw, params, num_params); XmuInternStrings(XtDisplay(w), params, (Cardinal) 1, &selection); @@ -1765,7 +1766,7 @@ xtermGetSelection(Widget w, #if OPT_TRACE && OPT_WIDE_CHARS static void -GettingSelection(Display * dpy, Atom type, Char * line, unsigned long len) +GettingSelection(Display *dpy, Atom type, Char *line, unsigned long len) { Char *cp; char *name; @@ -1799,7 +1800,7 @@ ABCDEFGHIJKLMNOPQRSTUVWXYZ\ abcdefghijklmnopqrstuvwxyz\ 0123456789+/"; static void -base64_flush(TScreen * screen) +base64_flush(TScreen *screen) { Char x; switch (screen->base64_count) { @@ -1824,11 +1825,75 @@ base64_flush(TScreen * screen) } #endif /* OPT_PASTE64 */ +/* + * Translate ISO-8859-1 or UTF-8 data to NRCS. + */ static void -_qWriteSelectionData(XtermWidget xw, Char * lag, unsigned length) +ToNational(TScreen *screen, Char *buffer, unsigned *length) +{ + int gsetL = screen->gsets[screen->curgl]; + int gsetR = screen->gsets[screen->curgr]; + unsigned chr, out, gl, gr; + Char *p; + +#if OPT_WIDE_CHARS + if ((screen->utf8_nrc_mode | screen->utf8_mode) != uFalse) { + PtyData *data = TypeXtMallocX(PtyData, *length); + + memset(data, 0, sizeof(*data)); + data->next = data->buffer; + data->last = data->buffer + *length; + memcpy(data->buffer, buffer, (size_t) *length); + p = buffer; + while (data->next < data->last) { + if (!decodeUtf8(data)) { + data->utf_size = 1; + data->utf_data = data->next[0]; + } + data->next += data->utf_size; + chr = data->utf_data; + out = chr; + if ((gl = xtermCharSetIn(screen, chr, gsetL)) != chr) { + out = gl; + } else if ((gr = xtermCharSetIn(screen, chr, gsetR)) != chr) { + out = gr; + } + *p++ = (Char) ((out < 256) ? out : ' '); + } + *length = (unsigned) (p - buffer); + free(data); + } else +#endif + { + for (p = buffer; (int) (p - buffer) < (int) *length; ++p) { + chr = *p; + out = chr; + if ((gl = xtermCharSetIn(screen, chr, gsetL)) != chr) { + out = gl; + } else if ((gr = xtermCharSetIn(screen, chr, gsetR)) != chr) { + out = gr; + } + *p = (Char) out; + } + } +} + +static void +_qWriteSelectionData(XtermWidget xw, Char *lag, unsigned length) { TScreen *screen = TScreenOf(xw); + /* + * If we are pasting into a window which is using NRCS, we want to map + * the text from the normal encoding (ISO-8859-1 or UTF-8) into the coding + * that an application would use to write characters with NRCS. + * + * TODO: handle conversion from UTF-8, and adjust length. This can be done + * in the same buffer because the target is always 8-bit. + */ + if ((xw->flags & NATIONAL) && (length != 0)) { + ToNational(screen, lag, &length); + } #if OPT_PASTE64 if (screen->base64_paste) { /* Send data as base64 */ @@ -1893,7 +1958,7 @@ _qWriteSelectionData(XtermWidget xw, Char * lag, unsigned length) } static void -_WriteSelectionData(XtermWidget xw, Char * line, size_t length) +_WriteSelectionData(XtermWidget xw, Char *line, size_t length) { /* Write data to pty a line at a time. */ /* Doing this one line at a time may no longer be necessary @@ -1943,7 +2008,7 @@ _WriteSelectionData(XtermWidget xw, Char * line, size_t length) #if OPT_READLINE static void -_WriteKey(TScreen * screen, const Char * in) +_WriteKey(TScreen *screen, const Char *in) { Char line[16]; unsigned count = 0; @@ -1990,7 +2055,7 @@ removeControls(XtermWidget xw, char *value) } } #if OPT_WIDE_CHARS - else if (screen->utf8_inparse) + else if (screen->utf8_inparse || screen->utf8_nrc_mode) ++dst; #endif #if OPT_C1_PRINT || OPT_WIDE_CHARS @@ -2164,7 +2229,7 @@ SelectionReceived(Widget w, void HandleInsertSelection(Widget w, XEvent * event, /* assumed to be XButtonEvent* */ - String * params, /* selections in precedence order */ + String *params, /* selections in precedence order */ Cardinal *num_params) { XtermWidget xw; @@ -2226,7 +2291,7 @@ EvalSelectUnit(XtermWidget xw, static void do_select_start(XtermWidget xw, XEvent * event, /* must be XButtonEvent* */ - CELL * cell) + CELL *cell) { TScreen *screen = TScreenOf(xw); @@ -2249,7 +2314,7 @@ do_select_start(XtermWidget xw, void HandleSelectStart(Widget w, XEvent * event, /* must be XButtonEvent* */ - String * params GCC_UNUSED, + String *params GCC_UNUSED, Cardinal *num_params GCC_UNUSED) { XtermWidget xw; @@ -2275,7 +2340,7 @@ HandleSelectStart(Widget w, void HandleKeyboardSelectStart(Widget w, XEvent * event, /* must be XButtonEvent* */ - String * params GCC_UNUSED, + String *params GCC_UNUSED, Cardinal *num_params GCC_UNUSED) { XtermWidget xw; @@ -2316,7 +2381,7 @@ TrackDown(XtermWidget xw, XButtonEvent * event) void TrackMouse(XtermWidget xw, int func, - CELL * start, + CELL *start, int firstrow, int lastrow) { @@ -2340,7 +2405,7 @@ TrackMouse(XtermWidget xw, } static void -StartSelect(XtermWidget xw, const CELL * cell) +StartSelect(XtermWidget xw, const CELL *cell) { TScreen *screen = TScreenOf(xw); @@ -2367,7 +2432,7 @@ StartSelect(XtermWidget xw, const CELL * cell) static void EndExtend(XtermWidget xw, XEvent * event, /* must be XButtonEvent */ - String * params, /* selections */ + String *params, /* selections */ Cardinal num_params, Bool use_cursor_loc) { @@ -2460,7 +2525,7 @@ EndExtend(XtermWidget xw, void HandleSelectSet(Widget w, XEvent * event, - String * params, + String *params, Cardinal *num_params) { XtermWidget xw; @@ -2475,7 +2540,7 @@ HandleSelectSet(Widget w, static void SelectSet(XtermWidget xw, XEvent * event GCC_UNUSED, - String * params, + String *params, Cardinal num_params) { TScreen *screen = TScreenOf(xw); @@ -2496,7 +2561,7 @@ SelectSet(XtermWidget xw, static void do_start_extend(XtermWidget xw, XEvent * event, /* must be XButtonEvent* */ - String * params GCC_UNUSED, + String *params GCC_UNUSED, Cardinal *num_params GCC_UNUSED, Bool use_cursor_loc) { @@ -2563,7 +2628,7 @@ do_start_extend(XtermWidget xw, } static void -ExtendExtend(XtermWidget xw, const CELL * cell) +ExtendExtend(XtermWidget xw, const CELL *cell) { TScreen *screen = TScreenOf(xw); int coord = Coordinate(screen, cell); @@ -2597,7 +2662,7 @@ ExtendExtend(XtermWidget xw, const CELL * cell) void HandleStartExtend(Widget w, XEvent * event, /* must be XButtonEvent* */ - String * params, /* unused */ + String *params, /* unused */ Cardinal *num_params) /* unused */ { XtermWidget xw; @@ -2611,7 +2676,7 @@ HandleStartExtend(Widget w, void HandleKeyboardStartExtend(Widget w, XEvent * event, /* must be XButtonEvent* */ - String * params, /* unused */ + String *params, /* unused */ Cardinal *num_params) /* unused */ { XtermWidget xw; @@ -2623,7 +2688,7 @@ HandleKeyboardStartExtend(Widget w, } void -ScrollSelection(TScreen * screen, int amount, Bool always) +ScrollSelection(TScreen *screen, int amount, Bool always) { int minrow = INX2ROW(screen, -screen->savedlines); int maxrow = INX2ROW(screen, screen->max_row); @@ -2677,7 +2742,7 @@ ScrollSelection(TScreen * screen, int amount, Bool always) /*ARGSUSED*/ void -ResizeSelection(TScreen * screen GCC_UNUSED, int rows, int cols) +ResizeSelection(TScreen *screen GCC_UNUSED, int rows, int cols) { rows--; /* decr to get 0-max */ cols--; @@ -2716,10 +2781,10 @@ iswide(int i) #endif static void -PointToCELL(TScreen * screen, +PointToCELL(TScreen *screen, int y, int x, - CELL * cell) + CELL *cell) /* Convert pixel coordinates to character coordinates. Rows are clipped between firstValidRow and lastValidRow. Columns are clipped between to be 0 or greater, but are not clipped to some @@ -2753,7 +2818,7 @@ PointToCELL(TScreen * screen, * Find the last column at which text was drawn on the given row. */ static int -LastTextCol(TScreen * screen, LineData * ld, int row) +LastTextCol(TScreen *screen, LineData *ld, int row) { int i = -1; Char *ch; @@ -2873,7 +2938,7 @@ SetCharacterClassRange(int low, /* in range of [0..255] */ #endif static int -class_of(LineData * ld, CELL * cell) +class_of(LineData *ld, CELL *cell) { CELL temp = *cell; int result = 0; @@ -2904,9 +2969,9 @@ class_of(LineData * ld, CELL * cell) * beginning of the next line. */ static Boolean -okPosition(TScreen * screen, - LineData ** ld, - CELL * cell) +okPosition(TScreen *screen, + LineData **ld, + CELL *cell) { Boolean result = True; @@ -2923,9 +2988,9 @@ okPosition(TScreen * screen, } static void -trimLastLine(TScreen * screen, - LineData ** ld, - CELL * last) +trimLastLine(TScreen *screen, + LineData **ld, + CELL *last) { if (screen->cutNewline && last->row < screen->max_row) { last->col = 0; @@ -2940,7 +3005,7 @@ trimLastLine(TScreen * screen, * Returns the first row of a wrapped line. */ static int -firstRowOfLine(TScreen * screen, int row, Bool visible) +firstRowOfLine(TScreen *screen, int row, Bool visible) { LineData *ld = 0; int limit = visible ? 0 : -screen->savedlines; @@ -2957,7 +3022,7 @@ firstRowOfLine(TScreen * screen, int row, Bool visible) * Returns the last row of a wrapped line. */ static int -lastRowOfLine(TScreen * screen, int row) +lastRowOfLine(TScreen *screen, int row) { LineData *ld; @@ -2973,7 +3038,7 @@ lastRowOfLine(TScreen * screen, int row) * Returns the number of cells on the range of rows. */ static unsigned -lengthOfLines(TScreen * screen, int firstRow, int lastRow) +lengthOfLines(TScreen *screen, int firstRow, int lastRow) { unsigned length = 0; int n; @@ -2993,7 +3058,7 @@ lengthOfLines(TScreen * screen, int firstRow, int lastRow) * the line. */ static char * -make_indexed_text(TScreen * screen, int row, unsigned length, int *indexed) +make_indexed_text(TScreen *screen, int row, unsigned length, int *indexed) { Char *result = 0; size_t need = (length + 1); @@ -3079,7 +3144,7 @@ indexToCol(int *indexed, int len, int off) * set the cell to the actual row/column values. */ static void -columnToCell(TScreen * screen, int row, int col, CELL * cell) +columnToCell(TScreen *screen, int row, int col, CELL *cell) { while (row < screen->max_row) { LineData *ld = GET_LINEDATA(screen, row); @@ -3110,7 +3175,7 @@ columnToCell(TScreen * screen, int row, int col, CELL * cell) * Given a cell, find the corresponding column offset. */ static int -cellToColumn(TScreen * screen, CELL * cell) +cellToColumn(TScreen *screen, CELL *cell) { LineData *ld = 0; int col = cell->col; @@ -3129,7 +3194,7 @@ cellToColumn(TScreen * screen, CELL * cell) } static void -do_select_regex(TScreen * screen, CELL * startc, CELL * endc) +do_select_regex(TScreen *screen, CELL *startc, CELL *endc) { LineData *ld = GET_LINEDATA(screen, startc->row); int inx = ((screen->numberOfClicks - 1) % screen->maxClicks); @@ -3242,8 +3307,8 @@ do_select_regex(TScreen * screen, CELL * startc, CELL * endc) */ static void ComputeSelect(XtermWidget xw, - CELL * startc, - CELL * endc, + CELL *startc, + CELL *endc, Bool extend) { TScreen *screen = TScreenOf(xw); @@ -3444,8 +3509,8 @@ ComputeSelect(XtermWidget xw, /* Guaranteed (first.row, first.col) <= (last.row, last.col) */ static void TrackText(XtermWidget xw, - const CELL * firstp, - const CELL * lastp) + const CELL *firstp, + const CELL *lastp) { TScreen *screen = TScreenOf(xw); int from, to; @@ -3497,8 +3562,8 @@ TrackText(XtermWidget xw, /* Guaranteed that (first->row, first->col) <= (last->row, last->col) */ static void ReHiliteText(XtermWidget xw, - CELL * firstp, - CELL * lastp) + CELL *firstp, + CELL *lastp) { TScreen *screen = TScreenOf(xw); int i; @@ -3543,8 +3608,8 @@ ReHiliteText(XtermWidget xw, */ static void SaltTextAway(XtermWidget xw, - CELL * cellc, - CELL * cell) + CELL *cellc, + CELL *cell) { TScreen *screen = TScreenOf(xw); int i, j = 0; @@ -3619,14 +3684,14 @@ SaltTextAway(XtermWidget xw, #if OPT_PASTE64 void -ClearSelectionBuffer(TScreen * screen) +ClearSelectionBuffer(TScreen *screen) { screen->selection_length = 0; screen->base64_count = 0; } static void -AppendStrToSelectionBuffer(TScreen * screen, Char * text, size_t len) +AppendStrToSelectionBuffer(TScreen *screen, Char *text, size_t len) { if (len != 0) { int j = (int) (screen->selection_length + len); /* New length */ @@ -3658,7 +3723,7 @@ AppendStrToSelectionBuffer(TScreen * screen, Char * text, size_t len) } void -AppendToSelectionBuffer(TScreen * screen, unsigned c) +AppendToSelectionBuffer(TScreen *screen, unsigned c) { unsigned six; Char ch; @@ -3707,7 +3772,7 @@ AppendToSelectionBuffer(TScreen * screen, unsigned c) } void -CompleteSelection(XtermWidget xw, String * args, Cardinal len) +CompleteSelection(XtermWidget xw, String *args, Cardinal len) { TScreen *screen = TScreenOf(xw); @@ -3986,7 +4051,7 @@ SelectionDone(Widget w GCC_UNUSED, static void _OwnSelection(XtermWidget xw, - String * selections, + String *selections, Cardinal count) { TScreen *screen = TScreenOf(xw); @@ -4050,7 +4115,7 @@ _OwnSelection(XtermWidget xw, } static void -ResetSelectionState(TScreen * screen) +ResetSelectionState(TScreen *screen) { screen->selection_count = 0; screen->startH = zeroCELL; @@ -4113,7 +4178,7 @@ UnhiliteSelection(XtermWidget xw) /* returns number of chars in line from scol to ecol out */ /* ARGSUSED */ static int -Length(TScreen * screen, +Length(TScreen *screen, int row, int scol, int ecol) @@ -4128,11 +4193,11 @@ Length(TScreen * screen, /* copies text into line, preallocated */ static Char * -SaveText(TScreen * screen, +SaveText(TScreen *screen, int row, int scol, int ecol, - Char * lp, /* pointer to where to put the text */ + Char *lp, /* pointer to where to put the text */ int *eol) { LineData *ld; @@ -4165,7 +4230,7 @@ SaveText(TScreen * screen, /* Combining characters attached to double-width characters are in memory attached to the HIDDEN_CHAR */ if_OPT_WIDE_CHARS(screen, { - if (screen->utf8_mode != uFalse) { + if ((screen->utf8_nrc_mode | screen->utf8_mode) != uFalse) { unsigned ch; size_t off; for_each_combData(off, ld) { @@ -4179,7 +4244,7 @@ SaveText(TScreen * screen, continue; } previous = c; - if (screen->utf8_mode != uFalse) { + if ((screen->utf8_nrc_mode | screen->utf8_mode) != uFalse) { lp = convertToUTF8(lp, (c != 0) ? c : ' '); if_OPT_WIDE_CHARS(screen, { unsigned ch; @@ -4252,8 +4317,8 @@ BtnCode(XButtonEvent * event, int button) } static unsigned -EmitButtonCode(TScreen * screen, - Char * line, +EmitButtonCode(TScreen *screen, + Char *line, unsigned count, XButtonEvent * event, int button) @@ -4494,9 +4559,9 @@ static char * getSelectionString(XtermWidget xw, Widget w, XEvent * event, - String * params, + String *params, Cardinal *num_params, - CELL * start, CELL * finish) + CELL *start, CELL *finish) { TScreen *screen = TScreenOf(xw); #if OPT_PASTE64 @@ -4541,7 +4606,7 @@ getSelectionString(XtermWidget xw, /* obtain data from the screen, passing the endpoints to caller's parameters */ static char * -getDataFromScreen(XtermWidget xw, String method, CELL * start, CELL * finish) +getDataFromScreen(XtermWidget xw, String method, CELL *start, CELL *finish) { TScreen *screen = TScreenOf(xw); @@ -4712,7 +4777,7 @@ tokenizeFormat(String format) } static void -formatVideoAttrs(XtermWidget xw, char *buffer, CELL * cell) +formatVideoAttrs(XtermWidget xw, char *buffer, CELL *cell) { TScreen *screen = TScreenOf(xw); LineData *ld = GET_LINEDATA(screen, cell->row); @@ -4773,8 +4838,8 @@ static char * expandFormat(XtermWidget xw, const char *format, char *data, - CELL * start, - CELL * finish) + CELL *start, + CELL *finish) { char *result = 0; if (!IsEmpty(format)) { @@ -4908,7 +4973,7 @@ freeArgv(char *blob, char **argv) void HandleExecFormatted(Widget w, XEvent * event GCC_UNUSED, - String * params, /* selections */ + String *params, /* selections */ Cardinal *num_params) { XtermWidget xw; @@ -4940,7 +5005,7 @@ HandleExecFormatted(Widget w, void HandleExecSelectable(Widget w, XEvent * event GCC_UNUSED, - String * params, /* selections */ + String *params, /* selections */ Cardinal *num_params) { XtermWidget xw; @@ -4975,7 +5040,7 @@ HandleExecSelectable(Widget w, void HandleInsertFormatted(Widget w, XEvent * event GCC_UNUSED, - String * params, /* selections */ + String *params, /* selections */ Cardinal *num_params) { XtermWidget xw; @@ -5004,7 +5069,7 @@ HandleInsertFormatted(Widget w, void HandleInsertSelectable(Widget w, XEvent * event GCC_UNUSED, - String * params, /* selections */ + String *params, /* selections */ Cardinal *num_params) { XtermWidget xw; diff --git a/app/xterm/charproc.c b/app/xterm/charproc.c index e615cd249..4991f68ed 100644 --- a/app/xterm/charproc.c +++ b/app/xterm/charproc.c @@ -1,4 +1,4 @@ -/* $XTermId: charproc.c,v 1.1300 2013/07/04 15:19:32 tom Exp $ */ +/* $XTermId: charproc.c,v 1.1319 2013/11/26 20:38:11 tom Exp $ */ /* * Copyright 1999-2012,2013 by Thomas E. Dickey @@ -137,8 +137,8 @@ #include #include -typedef void (*BitFunc) (unsigned * /* p */ , - unsigned /* mask */ ); +typedef int (*BitFunc) (unsigned * /* p */ , + unsigned /* mask */ ); static IChar doinput(void); static int set_character_class(char * /*s */ ); @@ -157,9 +157,9 @@ static void ToAlternate(XtermWidget /* xw */ , Bool /* clearFirst */ ); static void ansi_modes(XtermWidget termw, BitFunc /* func */ ); -static void bitclr(unsigned *p, unsigned mask); -static void bitcpy(unsigned *p, unsigned q, unsigned mask); -static void bitset(unsigned *p, unsigned mask); +static int bitclr(unsigned *p, unsigned mask); +static int bitcpy(unsigned *p, unsigned q, unsigned mask); +static int bitset(unsigned *p, unsigned mask); static void dpmodes(XtermWidget /* xw */ , BitFunc /* func */ ); static void restoremodes(XtermWidget /* xw */ ); @@ -557,6 +557,7 @@ static XtResource xterm_resources[] = Bres(XtNforceBoxChars, XtCForceBoxChars, screen.force_box_chars, False), Bres(XtNforcePackedFont, XtCForcePackedFont, screen.force_packed, True), Bres(XtNshowMissingGlyphs, XtCShowMissingGlyphs, screen.force_all_chars, False), + Bres(XtNassumeAllChars, XtCAssumeAllChars, screen.assume_all_chars, True), #endif #if OPT_BROKEN_OSC @@ -885,7 +886,7 @@ xtermAddInput(Widget w) #if OPT_ISO_COLORS #ifdef EXP_BOGUS_FG static Bool -CheckBogusForeground(TScreen * screen, const char *tag) +CheckBogusForeground(TScreen *screen, const char *tag) { int row = -1, col = -1, pass; Bool isClear = True; @@ -1070,14 +1071,14 @@ reset_SGR_Colors(XtermWidget xw) #endif /* OPT_ISO_COLORS */ void -resetCharsets(TScreen * screen) +resetCharsets(TScreen *screen) { TRACE(("resetCharsets\n")); - screen->gsets[0] = 'B'; /* ASCII_G */ - screen->gsets[1] = 'B'; /* ASCII_G */ - screen->gsets[2] = 'B'; /* ASCII_G */ - screen->gsets[3] = 'B'; /* ASCII_G */ + screen->gsets[0] = nrc_ASCII; + screen->gsets[1] = nrc_ASCII; + screen->gsets[2] = nrc_ASCII; + screen->gsets[3] = nrc_ASCII; screen->curgl = 0; /* G0 => GL. */ screen->curgr = 2; /* G2 => GR. */ @@ -1089,13 +1090,28 @@ resetCharsets(TScreen * screen) #endif } +static void +modified_DECNRCM(XtermWidget xw) +{ +#if OPT_WIDE_CHARS + TScreen *screen = TScreenOf(xw); + if (screen->wide_chars && (screen->utf8_mode || screen->utf8_nrc_mode)) { + int enabled = ((xw->flags & NATIONAL) != 0); + int modefix; + EXCHANGE(screen->utf8_nrc_mode, screen->utf8_mode, modefix); + switchPtyData(screen, !enabled); + TRACE(("UTF8 mode temporarily %s\n", enabled ? "ON" : "OFF")); + } +#endif +} + /* * VT300 and up support three ANSI conformance levels, defined according to * the dpANSI X3.134.1 standard. DEC's manuals equate levels 1 and 2, and * are unclear. This code is written based on the manuals. */ static void -set_ansi_conformance(TScreen * screen, int level) +set_ansi_conformance(TScreen *screen, int level) { TRACE(("set_ansi_conformance(%d) dec_level %d:%d, ansi_level %d\n", level, @@ -1107,13 +1123,13 @@ set_ansi_conformance(TScreen * screen, int level) case 1: /* FALLTHRU */ case 2: - screen->gsets[0] = 'B'; /* G0 is ASCII */ - screen->gsets[1] = 'B'; /* G1 is ISO Latin-1 */ + screen->gsets[0] = nrc_ASCII; /* G0 is ASCII */ + screen->gsets[1] = nrc_ASCII; /* G1 is ISO Latin-1 */ screen->curgl = 0; screen->curgr = 1; break; case 3: - screen->gsets[0] = 'B'; /* G0 is ASCII */ + screen->gsets[0] = nrc_ASCII; /* G0 is ASCII */ screen->curgl = 0; break; } @@ -1125,7 +1141,7 @@ set_ansi_conformance(TScreen * screen, int level) * different, so we have at least two lines in the scrolling region. */ void -set_tb_margins(TScreen * screen, int top, int bottom) +set_tb_margins(TScreen *screen, int top, int bottom) { TRACE(("set_tb_margins %d..%d, prior %d..%d\n", top, bottom, @@ -1142,7 +1158,7 @@ set_tb_margins(TScreen * screen, int top, int bottom) } void -set_lr_margins(TScreen * screen, int left, int right) +set_lr_margins(TScreen *screen, int left, int right) { TRACE(("set_lr_margins %d..%d, prior %d..%d\n", left, right, @@ -1162,14 +1178,14 @@ set_lr_margins(TScreen * screen, int left, int right) #define reset_lr_margins(screen) set_lr_margins(screen, 0, screen->max_col) static void -reset_margins(TScreen * screen) +reset_margins(TScreen *screen) { reset_tb_margins(screen); reset_lr_margins(screen); } void -set_max_col(TScreen * screen, int cols) +set_max_col(TScreen *screen, int cols) { TRACE(("set_max_col %d, prior %d\n", cols, screen->max_col)); if (cols < 0) @@ -1178,7 +1194,7 @@ set_max_col(TScreen * screen, int cols) } void -set_max_row(TScreen * screen, int rows) +set_max_row(TScreen *screen, int rows) { TRACE(("set_max_row %d, prior %d\n", rows, screen->max_row)); if (rows < 0) @@ -1256,6 +1272,7 @@ which_table(Const PARSE_T * table) #endif #if OPT_WIDE_CHARS else WHICH_TABLE (esc_pct_table); + else WHICH_TABLE (scs_pct_table); #endif #if OPT_VT52_MODE else WHICH_TABLE (vt52_table); @@ -1350,7 +1367,7 @@ struct ParseState { static struct ParseState myState; static void -init_groundtable(TScreen * screen, struct ParseState *sp) +init_groundtable(TScreen *screen, struct ParseState *sp) { (void) screen; @@ -1367,7 +1384,7 @@ init_groundtable(TScreen * screen, struct ParseState *sp) static void select_charset(struct ParseState *sp, int type, int size) { - TRACE(("select_charset %#x %d\n", type, size)); + TRACE(("select_charset %d %d\n", type, size)); sp->scstype = type; sp->scssize = size; if (size == 94) { @@ -1377,6 +1394,87 @@ select_charset(struct ParseState *sp, int type, int size) } } +static void +decode_scs(XtermWidget xw, int which, int prefix, int suffix) +{ + /* *INDENT-OFF* */ + static struct { + DECNRCM_codes result; + int prefix; + int suffix; + int min_level; + int max_level; + int need_nrc; + } table[] = { + { nrc_ASCII, 0, 'B', 1, 9, 0 }, + { nrc_British, 0, 'A', 1, 9, 0 }, + { nrc_DEC_Spec_Graphic, 0, '0', 1, 9, 0 }, + { nrc_DEC_Alt_Chars, 0, '1', 1, 1, 0 }, + { nrc_DEC_Alt_Graphics, 0, '2', 1, 1, 0 }, + /* VT2xx */ + { nrc_DEC_Supp, 0, '<', 2, 9, 0 }, + { nrc_Dutch, 0, '4', 2, 9, 1 }, + { nrc_Finnish, 0, '5', 2, 9, 1 }, + { nrc_Finnish2, 0, 'C', 2, 9, 1 }, + { nrc_French, 0, 'R', 2, 9, 1 }, + { nrc_French2, 0, 'f', 2, 9, 1 }, + { nrc_French_Canadian, 0, 'Q', 2, 9, 1 }, + { nrc_German, 0, 'K', 2, 9, 1 }, + { nrc_Italian, 0, 'Y', 2, 9, 1 }, + { nrc_Norwegian_Danish2, 0, 'E', 2, 9, 1 }, + { nrc_Norwegian_Danish3, 0, '6', 2, 9, 1 }, + { nrc_Spanish, 0, 'Z', 2, 9, 1 }, + { nrc_Swedish, 0, '7', 2, 9, 1 }, + { nrc_Swedish2, 0, 'H', 2, 9, 1 }, + { nrc_Swiss, 0, '=', 2, 9, 1 }, + /* VT3xx */ + { nrc_British_Latin_1, 0, 'A', 3, 9, 1 }, + { nrc_DEC_Supp_Graphic, '%', '5', 3, 9, 0 }, + { nrc_DEC_Technical, 0, '>', 3, 9, 0 }, + { nrc_French_Canadian2, 0, '9', 3, 9, 1 }, + { nrc_Norwegian_Danish, 0, '`', 3, 9, 1 }, + { nrc_Portugese, '%', '6', 3, 9, 1 }, +#if 0 + /* VT5xx (not implemented) */ + { nrc_Cyrillic, '&', '4', 5, 9, 0 }, + { nrc_Greek, '"', '?', 5, 9, 0 }, + { nrc_Greek_Supp, 0, 'F', 5, 9, 0 }, + { nrc_Hebrew, '"', '4', 5, 9, 0 }, + { nrc_Hebrew2, '%', '=', 5, 9, 1 }, + { nrc_Hebrew_Supp, 0, 'H', 5, 9, 0 }, + { nrc_Latin_5_Supp, 0, 'M', 5, 9, 0 }, + { nrc_Latin_Cyrillic, 0, 'L', 5, 9, 0 }, + { nrc_Russian, '&', '5', 5, 9, 1 }, + { nrc_SCS_NRCS, '%', '3', 5, 9, 0 }, + { nrc_Turkish, '%', '0', 5, 9, 0 }, + { nrc_Turkish2, '%', '2', 5, 9, 1 }, +#endif + }; + /* *INDENT-ON* */ + + TScreen *screen = TScreenOf(xw); + Cardinal n; + DECNRCM_codes result = nrc_Unknown; + + suffix &= 0x7f; + for (n = 0; n < XtNumber(table); ++n) { + if (prefix == table[n].prefix + && suffix == table[n].suffix + && screen->vtXX_level >= table[n].min_level + && screen->vtXX_level <= table[n].max_level + && (table[n].need_nrc == 0 || (xw->flags & NATIONAL) != 0)) { + result = table[n].result; + break; + } + } + if (result != nrc_Unknown) { + screen->gsets[which] = result; + TRACE(("setting G%d to %s\n", which, visibleScsCode((int) result))); + } else { + TRACE(("...unknown GSET\n")); + } +} + /* * Given a parameter number, and subparameter (starting in each case from zero) * return the corresponding index into the parameter array. If the combination @@ -2823,8 +2921,18 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp) : "CPR"))); /* CPR */ /* DECXCPR (with page=1) */ - reply.a_param[count++] = (ParmType) (screen->cur_row + 1); - reply.a_param[count++] = (ParmType) (screen->cur_col + 1); + value = (screen->cur_row + 1); + if ((xw->flags & ORIGIN) != 0) { + value -= screen->top_marg; + } + reply.a_param[count++] = (ParmType) value; + + value = (screen->cur_col + 1); + if ((xw->flags & ORIGIN) != 0) { + value -= screen->lft_marg; + } + reply.a_param[count++] = (ParmType) value; + if (sp->private_function && screen->vtXX_level >= 4) { /* VT420 */ reply.a_param[count++] = 1; @@ -3031,8 +3139,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp) case CASE_GSETS: TRACE(("CASE_GSETS(%d) = '%c'\n", sp->scstype, c)); - if (screen->vtXX_level != 0) - screen->gsets[sp->scstype] = CharOf(c); + decode_scs(xw, sp->scstype, 0, (int) c); ResetState(sp); break; @@ -3808,6 +3915,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp) break; #if OPT_WIDE_CHARS case CASE_ESC_PERCENT: + TRACE(("CASE_ESC_PERCENT\n")); sp->parsestate = esc_pct_table; break; @@ -3834,6 +3942,17 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp) } ResetState(sp); break; + + case CASE_SCS_PERCENT: + TRACE(("CASE_SCS_PERCENT\n")); + sp->parsestate = scs_pct_table; + break; + + case CASE_GSETS_PERCENT: + TRACE(("CASE_GSETS_PERCENT(%d) = '%c'\n", sp->scstype, c)); + decode_scs(xw, sp->scstype, '%', (int) c); + ResetState(sp); + break; #endif #if OPT_MOD_FKEYS case CASE_SET_MOD_FKEYS: @@ -3977,7 +4096,7 @@ static Char *v_bufend; /* end of physical buffer */ or generated by us in response to a query ESC sequence. */ void -v_write(int f, const Char * data, unsigned len) +v_write(int f, const Char *data, unsigned len) { int riten; @@ -4140,7 +4259,7 @@ v_write(int f, const Char * data, unsigned len) } static void -updateCursor(TScreen * screen) +updateCursor(TScreen *screen) { if (screen->cursor_set != screen->cursor_state) { if (screen->cursor_set) @@ -4152,7 +4271,7 @@ updateCursor(TScreen * screen) #if OPT_BLINK_CURS || OPT_BLINK_TEXT static void -reallyStopBlinking(TScreen * screen) +reallyStopBlinking(TScreen *screen) { if (screen->cursor_state == BLINKED_OFF) { /* force cursor to display if it is enabled */ @@ -4496,7 +4615,7 @@ WrapLine(XtermWidget xw) void dotext(XtermWidget xw, int charset, - IChar * buf, /* start of characters to process */ + IChar *buf, /* start of characters to process */ Cardinal len) /* end */ { TScreen *screen = TScreenOf(xw); @@ -4517,11 +4636,7 @@ dotext(XtermWidget xw, right = screen->max_col; } #if OPT_WIDE_CHARS - /* don't translate if we use UTF-8, and are not handling legacy support - * for line-drawing characters. - */ - if ((screen->utf8_mode == uFalse) - || (screen->vt100_graphics)) + if (screen->vt100_graphics) #endif if (!xtermCharSetOut(xw, buf, buf + len, charset)) return; @@ -4659,7 +4774,7 @@ dotext(XtermWidget xw, #if OPT_WIDE_CHARS unsigned -visual_width(IChar * str, Cardinal len) +visual_width(IChar *str, Cardinal len) { /* returns the visual width of a string (doublewide characters count as 2, normalwide characters count as 1) */ @@ -4683,7 +4798,7 @@ static void HandleStructNotify(Widget w GCC_UNUSED, XtPointer closure GCC_UNUSED, XEvent * event, - Boolean * cont GCC_UNUSED) + Boolean *cont GCC_UNUSED) { XtermWidget xw = term; @@ -4767,7 +4882,7 @@ HandleStructNotify(Widget w GCC_UNUSED, #if OPT_BLINK_CURS static void -SetCursorBlink(TScreen * screen, Bool enable) +SetCursorBlink(TScreen *screen, Bool enable) { screen->cursor_blink = (Boolean) enable; if (DoStartBlinking(screen)) { @@ -4784,7 +4899,7 @@ SetCursorBlink(TScreen * screen, Bool enable) } void -ToggleCursorBlink(TScreen * screen) +ToggleCursorBlink(TScreen *screen) { SetCursorBlink(screen, (Bool) (!(screen->cursor_blink))); } @@ -4989,7 +5104,11 @@ dpmodes(XtermWidget xw, BitFunc func) update_cursesemul(); break; case srm_DECNRCM: /* national charset (VT220) */ - (*func) (&xw->flags, NATIONAL); + if (screen->vtXX_level >= 2) { + if ((*func) (&xw->flags, NATIONAL)) { + modified_DECNRCM(xw); + } + } break; case srm_MARGIN_BELL: /* margin bell */ set_bool_mode(screen->marginbell); @@ -5067,7 +5186,6 @@ dpmodes(XtermWidget xw, BitFunc func) } else { reset_lr_margins(screen); } - CursorSet(screen, 0, 0, xw->flags); } break; #if OPT_SIXEL_GRAPHICS @@ -5336,7 +5454,9 @@ savemodes(XtermWidget xw) DoSM(DP_X_MORE, screen->curses); break; case srm_DECNRCM: /* national charset (VT220) */ - DoSM(DP_DECNRCM, xw->flags & NATIONAL); + if (screen->vtXX_level >= 2) { + DoSM(DP_DECNRCM, xw->flags & NATIONAL); + } break; case srm_MARGIN_BELL: /* margin bell */ DoSM(DP_X_MARGIN, screen->marginbell); @@ -5616,7 +5736,10 @@ restoremodes(XtermWidget xw) update_cursesemul(); break; case srm_DECNRCM: /* national charset (VT220) */ - bitcpy(&xw->flags, screen->save_modes[DP_DECNRCM], NATIONAL); + if (screen->vtXX_level >= 2) { + if (bitcpy(&xw->flags, screen->save_modes[DP_DECNRCM], NATIONAL)) + modified_DECNRCM(xw); + } break; case srm_MARGIN_BELL: /* margin bell */ if ((DoRM(DP_X_MARGIN, screen->marginbell)) == 0) @@ -5668,7 +5791,6 @@ restoremodes(XtermWidget xw) } else { reset_lr_margins(screen); } - CursorSet(screen, 0, 0, xw->flags); break; #if OPT_SIXEL_GRAPHICS case srm_DECSDM: /* sixel scrolling */ @@ -6198,29 +6320,35 @@ window_ops(XtermWidget xw) /* * set a bit in a word given a pointer to the word and a mask. */ -static void +static int bitset(unsigned *p, unsigned mask) { + unsigned before = *p; *p |= mask; + return (before != *p); } /* * clear a bit in a word given a pointer to the word and a mask. */ -static void +static int bitclr(unsigned *p, unsigned mask) { + unsigned before = *p; *p &= ~mask; + return (before != *p); } /* * Copy bits from one word to another, given a mask */ -static void +static int bitcpy(unsigned *p, unsigned q, unsigned mask) { + unsigned before = *p; bitclr(p, mask); bitset(p, q & mask); + return (before != *p); } void @@ -6236,7 +6364,7 @@ unparseputc1(XtermWidget xw, int c) } void -unparseseq(XtermWidget xw, ANSI * ap) +unparseseq(XtermWidget xw, ANSI *ap) { int c; int i; @@ -6318,7 +6446,7 @@ unparseputc(XtermWidget xw, int c) unsigned len; if ((screen->unparse_len + 2) >= sizeof(screen->unparse_bfr) / sizeof(IChar)) - unparse_end(xw); + unparse_end(xw); len = screen->unparse_len; @@ -6452,7 +6580,7 @@ SwitchBufs(XtermWidget xw, int toBuf, Bool clearFirst) } Bool -CheckBufPtrs(TScreen * screen) +CheckBufPtrs(TScreen *screen) { return (screen->visbuf != 0 #if OPT_SAVE_LINES @@ -6465,7 +6593,7 @@ CheckBufPtrs(TScreen * screen) * Swap buffer line pointers between alternate and regular screens. */ void -SwitchBufPtrs(TScreen * screen, int toBuf GCC_UNUSED) +SwitchBufPtrs(TScreen *screen, int toBuf GCC_UNUSED) { if (CheckBufPtrs(screen)) { #if OPT_SAVE_LINES @@ -6565,7 +6693,7 @@ static void VTNonMaskableEvent(Widget w GCC_UNUSED, XtPointer closure GCC_UNUSED, XEvent * event, - Boolean * cont GCC_UNUSED) + Boolean *cont GCC_UNUSED) { switch (event->type) { case GraphicsExpose: @@ -7069,6 +7197,44 @@ set_flags_from_list(char *target, } } +#if OPT_RENDERFONT +static void +trimSizeFromFace(char *face_name, float *face_size) +{ + char *first = strstr(face_name, ":size="); + if (first == 0) { + first = face_name; + } else { + first++; + } + if (!strncmp(first, "size=", (size_t) 5)) { + char *last = strchr(first, ':'); + char mark; + float value; + char extra; + if (last == 0) + last = first + strlen(first); + mark = *last; + *last = '\0'; + if (sscanf(first, "size=%g%c", &value, &extra) == 1) { + TRACE(("...trimmed size from font: %g\n", value)); + if (face_size != 0) + *face_size = value; + } + if (mark) { + while ((*first++ = *++last) != '\0') { + ; + } + } else { + if (first != face_name) + --first; + *first = '\0'; + } + TRACE(("...after trimming, font = \"%s\"\n", face_name)); + } +} +#endif + /* ARGSUSED */ static void VTInitialize(Widget wrequest, @@ -7269,6 +7435,7 @@ VTInitialize(Widget wrequest, init_Bres(screen.force_box_chars); init_Bres(screen.force_packed); init_Bres(screen.force_all_chars); + init_Bres(screen.assume_all_chars); #endif init_Bres(screen.free_bold_box); init_Bres(screen.allowBoldFonts); @@ -7725,6 +7892,8 @@ VTInitialize(Widget wrequest, } init_Sres(misc.face_name); init_Sres(misc.face_wide_name); + trimSizeFromFace(wnew->misc.face_wide_name, (float *) 0); + trimSizeFromFace(wnew->misc.face_name, &(wnew->misc.face_size[0])); init_Sres(misc.render_font_s); wnew->work.render_font = (Boolean) extendedBoolean(wnew->misc.render_font_s, @@ -8194,7 +8363,7 @@ VTDestroy(Widget w GCC_UNUSED) } static void * -getProperty(Display * dpy, +getProperty(Display *dpy, Window w, Atom req_type, const char *prop_name) @@ -8728,7 +8897,7 @@ VTRealize(Widget w, #define USE_XIM_INSTANTIATE_CB static void -xim_instantiate_cb(Display * display, +xim_instantiate_cb(Display *display, XPointer client_data GCC_UNUSED, XPointer call_data GCC_UNUSED) { @@ -8795,7 +8964,7 @@ xim_create_fs(XtermWidget xw) xw->misc.xim_fs_ascent = (*fonts)->ascent; } } - return (Boolean) ! (xw->misc.cannot_im); + return (Boolean) !(xw->misc.cannot_im); } static void @@ -9622,7 +9791,7 @@ HideCursor(void) #if OPT_BLINK_CURS || OPT_BLINK_TEXT static void -StartBlinking(TScreen * screen) +StartBlinking(TScreen *screen) { if (screen->blink_timer == 0) { unsigned long interval = (unsigned long) ((screen->cursor_state == ON) @@ -9638,7 +9807,7 @@ StartBlinking(TScreen * screen) } static void -StopBlinking(TScreen * screen) +StopBlinking(TScreen *screen) { if (screen->blink_timer) { XtRemoveTimeOut(screen->blink_timer); @@ -9651,7 +9820,7 @@ StopBlinking(TScreen * screen) #if OPT_BLINK_TEXT Bool -LineHasBlinking(TScreen * screen, LineData * ld) +LineHasBlinking(TScreen *screen, LineData *ld) { int col; Bool result = False; @@ -9748,7 +9917,7 @@ HandleBlinking(XtPointer closure, XtIntervalId * id GCC_UNUSED) #endif /* OPT_BLINK_CURS || OPT_BLINK_TEXT */ void -RestartBlinking(TScreen * screen GCC_UNUSED) +RestartBlinking(TScreen *screen GCC_UNUSED) { #if OPT_BLINK_CURS || OPT_BLINK_TEXT if (screen->blink_timer == 0) { @@ -10050,7 +10219,7 @@ set_character_class(char *s) static void HandleKeymapChange(Widget w, XEvent * event GCC_UNUSED, - String * params, + String *params, Cardinal *param_count) { static XtTranslations keymap, original; @@ -10103,7 +10272,7 @@ HandleKeymapChange(Widget w, static void HandleBell(Widget w GCC_UNUSED, XEvent * event GCC_UNUSED, - String * params, /* [0] = volume */ + String *params, /* [0] = volume */ Cardinal *param_count) /* 0 or 1 */ { int percent = (*param_count) ? atoi(params[0]) : 0; @@ -10115,7 +10284,7 @@ HandleBell(Widget w GCC_UNUSED, static void HandleVisualBell(Widget w GCC_UNUSED, XEvent * event GCC_UNUSED, - String * params GCC_UNUSED, + String *params GCC_UNUSED, Cardinal *param_count GCC_UNUSED) { VisualBell(); @@ -10125,7 +10294,7 @@ HandleVisualBell(Widget w GCC_UNUSED, static void HandleIgnore(Widget w, XEvent * event, - String * params GCC_UNUSED, + String *params GCC_UNUSED, Cardinal *param_count GCC_UNUSED) { XtermWidget xw; diff --git a/app/xterm/charsets.c b/app/xterm/charsets.c index 45bea7381..fbad58a0c 100644 --- a/app/xterm/charsets.c +++ b/app/xterm/charsets.c @@ -1,7 +1,7 @@ -/* $XTermId: charsets.c,v 1.42 2011/09/11 14:40:17 tom Exp $ */ +/* $XTermId: charsets.c,v 1.67 2013/12/01 16:38:13 tom Exp $ */ /* - * Copyright 1998-2009,2011 by Thomas E. Dickey + * Copyright 1998-2011,2013 by Thomas E. Dickey * * All Rights Reserved * @@ -55,188 +55,443 @@ * The latter reference, though easier to read, has a few errors and omissions. */ +#define map_NRCS_Dutch(code) \ + switch (code) { \ + MAP(0x23, XK_sterling); \ + MAP(0x40, XK_threequarters); \ + UNI(0x5b, 0x0133); /* ij ligature */ \ + MAP(0x5c, XK_onehalf); \ + MAP(0x5d, XK_bar); \ + MAP(0x7b, XK_diaeresis); \ + UNI(0x7c, 0x0192); /* florin */ \ + MAP(0x7d, XK_onequarter); \ + MAP(0x7e, XK_acute); \ + } + +#define map_NRCS_Finnish(code) \ + switch (code) { \ + MAP(0x5b, XK_Adiaeresis); \ + MAP(0x5c, XK_Odiaeresis); \ + MAP(0x5d, XK_Aring); \ + MAP(0x5e, XK_Udiaeresis); \ + MAP(0x60, XK_eacute); \ + MAP(0x7b, XK_adiaeresis); \ + MAP(0x7c, XK_odiaeresis); \ + MAP(0x7d, XK_aring); \ + MAP(0x7e, XK_udiaeresis); \ + } + +#define map_NRCS_French(code) \ + switch (code) { \ + MAP(0x23, XK_sterling); \ + MAP(0x40, XK_agrave); \ + MAP(0x5b, XK_degree); \ + MAP(0x5c, XK_ccedilla); \ + MAP(0x5d, XK_section); \ + MAP(0x7b, XK_eacute); \ + MAP(0x7c, XK_ugrave); \ + MAP(0x7d, XK_egrave); \ + MAP(0x7e, XK_diaeresis); \ + } + +#define map_NRCS_French_Canadian(code) \ + switch (code) { \ + MAP(0x40, XK_agrave); \ + MAP(0x5b, XK_acircumflex); \ + MAP(0x5c, XK_ccedilla); \ + MAP(0x5d, XK_ecircumflex); \ + MAP(0x5e, XK_icircumflex); \ + MAP(0x60, XK_ocircumflex); \ + MAP(0x7b, XK_eacute); \ + MAP(0x7c, XK_ugrave); \ + MAP(0x7d, XK_egrave); \ + MAP(0x7e, XK_ucircumflex); \ + } + +#define map_NRCS_German(code) \ + switch (code) { \ + MAP(0x40, XK_section); \ + MAP(0x5b, XK_Adiaeresis); \ + MAP(0x5c, XK_Odiaeresis); \ + MAP(0x5d, XK_Udiaeresis); \ + MAP(0x7b, XK_adiaeresis); \ + MAP(0x7c, XK_odiaeresis); \ + MAP(0x7d, XK_udiaeresis); \ + MAP(0x7e, XK_ssharp); \ + } + +#define map_NRCS_Italian(code) \ + switch (code) { \ + MAP(0x23, XK_sterling); \ + MAP(0x40, XK_section); \ + MAP(0x5b, XK_degree); \ + MAP(0x5c, XK_ccedilla); \ + MAP(0x5d, XK_eacute); \ + MAP(0x60, XK_ugrave); \ + MAP(0x7b, XK_agrave); \ + MAP(0x7c, XK_ograve); \ + MAP(0x7d, XK_egrave); \ + MAP(0x7e, XK_igrave); \ + } + +#define map_NRCS_Norwegian_Danish(code) \ + switch (code) { \ + MAP(0x40, XK_Adiaeresis); \ + MAP(0x5b, XK_AE); \ + MAP(0x5c, XK_Ooblique); \ + MAP(0x5d, XK_Aring); \ + MAP(0x5e, XK_Udiaeresis); \ + MAP(0x60, XK_adiaeresis); \ + MAP(0x7b, XK_ae); \ + MAP(0x7c, XK_oslash); \ + MAP(0x7d, XK_aring); \ + MAP(0x7e, XK_udiaeresis); \ + } + +#define map_NRCS_Portuguese(code) \ + switch (code) { \ + MAP(0x5b, XK_Atilde); \ + MAP(0x5c, XK_Ccedilla); \ + MAP(0x5d, XK_Otilde); \ + MAP(0x7b, XK_atilde); \ + MAP(0x7c, XK_ccedilla); \ + MAP(0x7d, XK_otilde); \ + } + +#define map_NRCS_Spanish(code) \ + switch (code) { \ + MAP(0x23, XK_sterling); \ + MAP(0x40, XK_section); \ + MAP(0x5b, XK_exclamdown); \ + MAP(0x5c, XK_Ntilde); \ + MAP(0x5d, XK_questiondown); \ + MAP(0x7b, XK_degree); \ + MAP(0x7c, XK_ntilde); \ + MAP(0x7d, XK_ccedilla); \ + } + +#define map_NRCS_Swedish(code) \ + switch (code) { \ + MAP(0x40, XK_Eacute); \ + MAP(0x5b, XK_Adiaeresis); \ + MAP(0x5c, XK_Odiaeresis); \ + MAP(0x5d, XK_Aring); \ + MAP(0x5e, XK_Udiaeresis); \ + MAP(0x60, XK_eacute); \ + MAP(0x7b, XK_adiaeresis); \ + MAP(0x7c, XK_odiaeresis); \ + MAP(0x7d, XK_aring); \ + MAP(0x7e, XK_udiaeresis); \ + } + +#define map_NRCS_Swiss(code) \ + switch (code) { \ + MAP(0x23, XK_ugrave); \ + MAP(0x40, XK_agrave); \ + MAP(0x5b, XK_eacute); \ + MAP(0x5c, XK_ccedilla); \ + MAP(0x5d, XK_ecircumflex); \ + MAP(0x5e, XK_icircumflex); \ + MAP(0x5f, XK_egrave); \ + MAP(0x60, XK_ocircumflex); \ + MAP(0x7b, XK_adiaeresis); \ + MAP(0x7c, XK_odiaeresis); \ + MAP(0x7d, XK_udiaeresis); \ + MAP(0x7e, XK_ucircumflex); \ + } + +/* + * Unlike NRCS, which splices a few characters onto ASCII, the supplementary + * character sets are complete, normally mapped to GR. Most of these mappings + * rely upon glyphs not found in ISO-8859-1. We can display most of those + * using Unicode, thereby supporting specialized applications that use SCS + * with luit, subject to the limitation that select/paste will give meaningless + * results in terms of the application which uses these mappings. + * + * Since the VT320, etc, use only 8-bit encodings, there is no plausible + * argument to be made that these mappings "use" UTF-8, even though there is + * a hidden step in the terminal emulator which relies upon UTF-8. + */ +#define map_SCS_DEC_Supp(code,dft) \ + switch (code) { \ + XXX(0x24, 0x2e2e); \ + XXX(0x26, 0x2e2e); \ + XXX(0x2c, 0x2e2e); \ + XXX(0x2d, 0x2e2e); \ + XXX(0x2e, 0x2e2e); \ + XXX(0x2f, 0x2e2e); \ + XXX(0x34, 0x2e2e); \ + XXX(0x38, 0x2e2e); \ + XXX(0x3e, 0x2e2e); \ + UNI(0x47, 0x2426); \ + MAP(0x48, 0xc7); \ + MAP(0x49, 0xc8); \ + MAP(0x4a, 0xc9); \ + MAP(0x4b, 0xca); \ + MAP(0x4c, 0xcb); \ + MAP(0x4d, 0xcc); \ + MAP(0x4e, 0xcd); \ + MAP(0x4f, 0xce); \ + XXX(0x50, 0x2e2e); \ + UNI(0x57, 0x0152); \ + XXX(0x5e, 0x2e2e); \ + XXX(0x70, 0x2e2e); \ + UNI(0x77, 0x0153); \ + MAP(0x7d, 0xff); \ + XXX(0x7e, 0x2e2e); \ + default: dft; break; \ + } + +#define map_SCS_DEC_Supp_Graphic(code,dft) \ + switch (code) { \ + XXX(0x24, 0x2e2e); \ + XXX(0x26, 0x2e2e); \ + XXX(0x2c, 0x2e2e); \ + XXX(0x2d, 0x2e2e); \ + XXX(0x2e, 0x2e2e); \ + XXX(0x2f, 0x2e2e); \ + XXX(0x34, 0x2e2e); \ + XXX(0x38, 0x2e2e); \ + XXX(0x3e, 0x2e2e); \ + XXX(0x50, 0x2e2e); \ + UNI(0x57, 0x0152); \ + XXX(0x5e, 0x2e2e); \ + XXX(0x70, 0x2e2e); \ + UNI(0x77, 0x0153); \ + MAP(0x7d, 0xff); \ + XXX(0x7e, 0x2e2e); \ + XXX(0x7f, 0x2e2e); \ + default: dft; break; \ + } + + /* derived from http://www.vt100.net/charsets/technical.html */ +#if OPT_WIDE_CHARS +#define map_SCS_DEC_Technical(code) \ + switch (code) { \ + UNI(0x21, 0x23b7); /* RADICAL SYMBOL BOTTOM Centred left to right, so that it joins up with 02/02 */ \ + UNI(0x22, 0x250c); /* BOX DRAWINGS LIGHT DOWN AND RIGHT */ \ + UNI(0x23, 0x2500); /* BOX DRAWINGS LIGHT HORIZONTAL */ \ + UNI(0x24, 0x2320); /* TOP HALF INTEGRAL with the proviso that the stem is vertical, to join with 02/06 */ \ + UNI(0x25, 0x2321); /* BOTTOM HALF INTEGRAL with the proviso above. */ \ + UNI(0x26, 0x2502); /* BOX DRAWINGS LIGHT VERTICAL */ \ + UNI(0x27, 0x23a1); /* LEFT SQUARE BRACKET UPPER CORNER Joins vertically to 02/06, 02/08. Doesn't join to its right. */ \ + UNI(0x28, 0x23a3); /* LEFT SQUARE BRACKET LOWER CORNER Joins vertically to 02/06, 02/07. Doesn't join to its right. */ \ + UNI(0x29, 0x23a4); /* RIGHT SQUARE BRACKET UPPER CORNER Joins vertically to 026, 02a. Doesn't join to its left. */ \ + UNI(0x2a, 0x23a6); /* RIGHT SQUARE BRACKET LOWER CORNER Joins vertically to 026, 029. Doesn't join to its left. */ \ + UNI(0x2b, 0x239b); /* LEFT PARENTHESIS UPPER HOOK Joins vertically to 026, 02c, 02/15. Doesn't join to its right. */ \ + UNI(0x2c, 0x239d); /* LEFT PARENTHESIS LOWER HOOK Joins vertically to 026, 02b, 02/15. Doesn't join to its right. */ \ + UNI(0x2d, 0x239e); /* RIGHT PARENTHESIS UPPER HOOK Joins vertically to 026, 02e, 03/00. Doesn't join to its left. */ \ + UNI(0x2e, 0x23a0); /* RIGHT PARENTHESIS LOWER HOOK Joins vertically to 026, 02d, 03/00. Doesn't join to its left. */ \ + UNI(0x2f, 0x23a8); /* LEFT CURLY BRACKET MIDDLE PIECE Joins vertically to 026, 02b, 02c. */ \ + UNI(0x30, 0x23ac); /* RIGHT CURLY BRACKET MIDDLE PIECE Joins vertically to 02/06, 02d, 02e. */ \ + XXX(0x31, 0x2426); /* Top Left Sigma. Joins to right with 02/03, 03/05. Joins diagonally below right with 03/03, 03/07. */ \ + XXX(0x32, 0x2426); /* Bottom Left Sigma. Joins to right with 02/03, 03/06. Joins diagonally above right with 03/04, 03/07. */ \ + XXX(0x33, 0x2426); /* Top Diagonal Sigma. Line for joining 03/01 to 03/04 or 03/07. */ \ + XXX(0x34, 0x2426); /* Bottom Diagonal Sigma. Line for joining 03/02 to 03/03 or 03/07. */ \ + XXX(0x35, 0x2426); /* Top Right Sigma. Joins to left with 02/03, 03/01. */ \ + XXX(0x36, 0x2426); /* Bottom Right Sigma. Joins to left with 02/03, 03/02. */ \ + XXX(0x37, 0x2426); /* Middle Sigma. Joins diagonally with 03/01, 03/02, 03/03, 03/04. */ \ + XXX(0x38, 0x2426); /* undefined */ \ + XXX(0x39, 0x2426); /* undefined */ \ + XXX(0x3a, 0x2426); /* undefined */ \ + XXX(0x3b, 0x2426); /* undefined */ \ + UNI(0x3c, 0x2264); /* LESS-THAN OR EQUAL TO */ \ + UNI(0x3d, 0x2260); /* NOT EQUAL TO */ \ + UNI(0x3e, 0x2265); /* GREATER-THAN OR EQUAL TO */ \ + UNI(0x3f, 0x222B); /* INTEGRAL */ \ + UNI(0x40, 0x2234); /* THEREFORE */ \ + UNI(0x41, 0x221d); /* PROPORTIONAL TO */ \ + UNI(0x42, 0x221e); /* INFINITY */ \ + UNI(0x43, 0x00f7); /* DIVISION SIGN */ \ + UNI(0x44, 0x039a); /* GREEK CAPITAL DELTA */ \ + UNI(0x45, 0x2207); /* NABLA */ \ + UNI(0x46, 0x03a6); /* GREEK CAPITAL LETTER PHI */ \ + UNI(0x47, 0x0393); /* GREEK CAPITAL LETTER GAMMA */ \ + UNI(0x48, 0x223c); /* TILDE OPERATOR */ \ + UNI(0x49, 0x2243); /* ASYMPTOTICALLY EQUAL TO */ \ + UNI(0x4a, 0x0398); /* GREEK CAPITAL LETTER THETA */ \ + UNI(0x4b, 0x00d7); /* MULTIPLICATION SIGN */ \ + UNI(0x4c, 0x039b); /* GREEK CAPITAL LETTER LAMDA */ \ + UNI(0x4d, 0x21d4); /* LEFT RIGHT DOUBLE ARROW */ \ + UNI(0x4e, 0x21d2); /* RIGHTWARDS DOUBLE ARROW */ \ + UNI(0x4f, 0x2261); /* IDENTICAL TO */ \ + UNI(0x50, 0x03a0); /* GREEK CAPITAL LETTER PI */ \ + UNI(0x51, 0x03a8); /* GREEK CAPITAL LETTER PSI */ \ + UNI(0x52, 0x2426); /* undefined */ \ + UNI(0x53, 0x03a3); /* GREEK CAPITAL LETTER SIGMA */ \ + XXX(0x54, 0x2426); /* undefined */ \ + XXX(0x55, 0x2426); /* undefined */ \ + UNI(0x56, 0x221a); /* SQUARE ROOT */ \ + UNI(0x57, 0x03a9); /* GREEK CAPITAL LETTER OMEGA */ \ + UNI(0x58, 0x039e); /* GREEK CAPITAL LETTER XI */ \ + UNI(0x59, 0x03a5); /* GREEK CAPITAL LETTER UPSILON */ \ + UNI(0x5a, 0x2282); /* SUBSET OF */ \ + UNI(0x5b, 0x2283); /* SUPERSET OF */ \ + UNI(0x5c, 0x2229); /* INTERSECTION */ \ + UNI(0x5d, 0x222a); /* UNION */ \ + UNI(0x5e, 0x2227); /* LOGICAL AND */ \ + UNI(0x5f, 0x2228); /* LOGICAL OR */ \ + UNI(0x60, 0x00ac); /* NOT SIGN */ \ + UNI(0x61, 0x03b1); /* GREEK SMALL LETTER ALPHA */ \ + UNI(0x62, 0x03b2); /* GREEK SMALL LETTER BETA */ \ + UNI(0x63, 0x03c7); /* GREEK SMALL LETTER CHI */ \ + UNI(0x64, 0x03b4); /* GREEK SMALL LETTER DELTA */ \ + UNI(0x65, 0x03b5); /* GREEK SMALL LETTER EPSILON */ \ + UNI(0x66, 0x03c6); /* GREEK SMALL LETTER PHI */ \ + UNI(0x67, 0x03b3); /* GREEK SMALL LETTER GAMMA */ \ + UNI(0x68, 0x03b7); /* GREEK SMALL LETTER ETA */ \ + UNI(0x69, 0x03b9); /* GREEK SMALL LETTER IOTA */ \ + UNI(0x6a, 0x03b8); /* GREEK SMALL LETTER THETA */ \ + UNI(0x6b, 0x03ba); /* GREEK SMALL LETTER KAPPA */ \ + UNI(0x6c, 0x03bb); /* GREEK SMALL LETTER LAMDA */ \ + XXX(0x6d, 0x2426); /* undefined */ \ + UNI(0x6e, 0x03bd); /* GREEK SMALL LETTER NU */ \ + UNI(0x6f, 0x2202); /* PARTIAL DIFFERENTIAL */ \ + UNI(0x70, 0x03c0); /* GREEK SMALL LETTER PI */ \ + UNI(0x71, 0x03c8); /* GREEK SMALL LETTER PSI */ \ + UNI(0x72, 0x03c1); /* GREEK SMALL LETTER RHO */ \ + UNI(0x73, 0x03c3); /* GREEK SMALL LETTER SIGMA */ \ + UNI(0x74, 0x03c4); /* GREEK SMALL LETTER TAU */ \ + XXX(0x75, 0x2426); /* undefined */ \ + UNI(0x76, 0x0192); /* LATIN SMALL LETTER F WITH HOOK Probably chosen for its meaning of "function" */ \ + UNI(0x77, 0x03c9); /* GREEK SMALL LETTER OMEGA */ \ + UNI(0x78, 0x03bE); /* GREEK SMALL LETTER XI */ \ + UNI(0x79, 0x03c5); /* GREEK SMALL LETTER UPSILON */ \ + UNI(0x7a, 0x03b6); /* GREEK SMALL LETTER ZETA */ \ + UNI(0x7b, 0x2190); /* LEFTWARDS ARROW */ \ + UNI(0x7c, 0x2191); /* UPWARDS ARROW */ \ + UNI(0x7d, 0x2192); /* RIGHTWARDS ARROW */ \ + UNI(0x7e, 0x2193); /* DOWNWARDS ARROW */ \ + } +#else +#define map_SCS_DEC_Technical(code) /* nothing */ +#endif /* OPT_WIDE_CHARS */ + /* * Translate an input keysym to the corresponding NRC keysym. */ unsigned -xtermCharSetIn(unsigned code, int charset) +xtermCharSetIn(TScreen *screen, unsigned code, int charset) { #define MAP(to, from) case from: code = to; break - if (code >= 128 && code < 256) { - switch (charset) { - case 'A': /* United Kingdom set (or Latin 1) */ - if (code == XK_sterling) - code = 0x23; - code &= 0x7f; - break; +#if OPT_WIDE_CHARS +#define UNI(to, from) case from: if (screen->utf8_nrc_mode) code = to; break +#else +#define UNI(to, from) case from: break +#endif + +#define XXX(to, from) /* no defined mapping to 0..255 */ + + TRACE(("CHARSET-IN GL=%s(G%d) GR=%s(G%d) SS%d\n\t%s\n", + visibleScsCode(screen->gsets[screen->curgl]), screen->curgl, + visibleScsCode(screen->gsets[screen->curgr]), screen->curgr, + screen->curss, + visibleUChar(code))); + + switch (charset) { + case nrc_British: /* United Kingdom set (or Latin 1) */ + if (code == XK_sterling) + code = 0x23; + code &= 0x7f; + break; #if OPT_XMC_GLITCH - case '?': + case nrc_Unknown: #endif - case '1': /* Alternate Character ROM standard characters */ - case '2': /* Alternate Character ROM special graphics */ - case 'B': /* ASCII set */ - break; + case nrc_DEC_Alt_Chars: + case nrc_DEC_Alt_Graphics: + case nrc_ASCII: + break; - case '0': /* special graphics (line drawing) */ - break; + case nrc_DEC_Spec_Graphic: + break; - case '4': /* Dutch */ - switch (code) { - MAP(0x23, XK_sterling); - MAP(0x40, XK_threequarters); - MAP(0x5b, XK_ydiaeresis); - MAP(0x5c, XK_onehalf); - MAP(0x5d, XK_bar); /* glyph is not ISO-8859-1 */ - MAP(0x7b, XK_diaeresis); - MAP(0x7c, XK_f); /* glyph is not ISO-8859-1 */ - MAP(0x7d, XK_onequarter); - MAP(0x7e, XK_acute); - } - break; + case nrc_DEC_Supp: + map_SCS_DEC_Supp(code, code &= 0x7f); + break; - case 'C': - case '5': /* Finnish */ - switch (code) { - MAP(0x5b, XK_Adiaeresis); - MAP(0x5c, XK_Odiaeresis); - MAP(0x5d, XK_Aring); - MAP(0x5e, XK_Udiaeresis); - MAP(0x60, XK_eacute); - MAP(0x7b, XK_adiaeresis); - MAP(0x7c, XK_odiaeresis); - MAP(0x7d, XK_aring); - MAP(0x7e, XK_udiaeresis); - } - break; + case nrc_DEC_Supp_Graphic: + map_SCS_DEC_Supp_Graphic(code, code |= 0x80); + break; - case 'R': /* French */ - switch (code) { - MAP(0x23, XK_sterling); - MAP(0x40, XK_agrave); - MAP(0x5b, XK_degree); - MAP(0x5c, XK_ccedilla); - MAP(0x5d, XK_section); - MAP(0x7b, XK_eacute); - MAP(0x7c, XK_ugrave); - MAP(0x7d, XK_egrave); - MAP(0x7e, XK_diaeresis); - } - break; + case nrc_DEC_Technical: + map_SCS_DEC_Technical(code); + break; - case 'Q': /* French Canadian */ - switch (code) { - MAP(0x40, XK_agrave); - MAP(0x5b, XK_acircumflex); - MAP(0x5c, XK_ccedilla); - MAP(0x5d, XK_ecircumflex); - MAP(0x5e, XK_icircumflex); - MAP(0x60, XK_ocircumflex); - MAP(0x7b, XK_eacute); - MAP(0x7c, XK_ugrave); - MAP(0x7d, XK_egrave); - MAP(0x7e, XK_ucircumflex); - } - break; + case nrc_Dutch: + map_NRCS_Dutch(code); + break; - case 'K': /* German */ - switch (code) { - MAP(0x40, XK_section); - MAP(0x5b, XK_Adiaeresis); - MAP(0x5c, XK_Odiaeresis); - MAP(0x5d, XK_Udiaeresis); - MAP(0x7b, XK_adiaeresis); - MAP(0x7c, XK_odiaeresis); - MAP(0x7d, XK_udiaeresis); - MAP(0x7e, XK_ssharp); - } - break; + case nrc_Finnish: + case nrc_Finnish2: + map_NRCS_Finnish(code); + break; - case 'Y': /* Italian */ - switch (code) { - MAP(0x23, XK_sterling); - MAP(0x40, XK_section); - MAP(0x5b, XK_degree); - MAP(0x5c, XK_ccedilla); - MAP(0x5d, XK_eacute); - MAP(0x60, XK_ugrave); - MAP(0x7b, XK_agrave); - MAP(0x7c, XK_ograve); - MAP(0x7d, XK_egrave); - MAP(0x7e, XK_igrave); - } - break; + case nrc_French: + case nrc_French2: + map_NRCS_French(code); + break; - case 'E': - case '6': /* Norwegian/Danish */ - switch (code) { - MAP(0x40, XK_Adiaeresis); - MAP(0x5b, XK_AE); - MAP(0x5c, XK_Ooblique); - MAP(0x5d, XK_Aring); - MAP(0x5e, XK_Udiaeresis); - MAP(0x60, XK_adiaeresis); - MAP(0x7b, XK_ae); - MAP(0x7c, XK_oslash); - MAP(0x7d, XK_aring); - MAP(0x7e, XK_udiaeresis); - } - break; + case nrc_French_Canadian: + map_NRCS_French_Canadian(code); + break; - case 'Z': /* Spanish */ - switch (code) { - MAP(0x23, XK_sterling); - MAP(0x40, XK_section); - MAP(0x5b, XK_exclamdown); - MAP(0x5c, XK_Ntilde); - MAP(0x5d, XK_questiondown); - MAP(0x7b, XK_degree); - MAP(0x7c, XK_ntilde); - MAP(0x7d, XK_ccedilla); - } - break; + case nrc_German: + map_NRCS_German(code); + break; - case 'H': - case '7': /* Swedish */ - switch (code) { - MAP(0x40, XK_Eacute); - MAP(0x5b, XK_Adiaeresis); - MAP(0x5c, XK_Odiaeresis); - MAP(0x5d, XK_Aring); - MAP(0x5e, XK_Udiaeresis); - MAP(0x60, XK_eacute); - MAP(0x7b, XK_adiaeresis); - MAP(0x7c, XK_odiaeresis); - MAP(0x7d, XK_aring); - MAP(0x7e, XK_udiaeresis); - } - break; + case nrc_Hebrew: + case nrc_Hebrew2: + /* FIXME */ + break; - case '=': /* Swiss */ - switch (code) { - MAP(0x23, XK_ugrave); - MAP(0x40, XK_agrave); - MAP(0x5b, XK_eacute); - MAP(0x5c, XK_ccedilla); - MAP(0x5d, XK_ecircumflex); - MAP(0x5e, XK_icircumflex); - MAP(0x5f, XK_egrave); - MAP(0x60, XK_ocircumflex); - MAP(0x7b, XK_adiaeresis); - MAP(0x7c, XK_odiaeresis); - MAP(0x7d, XK_udiaeresis); - MAP(0x7e, XK_ucircumflex); - } - break; + case nrc_Italian: + map_NRCS_Italian(code); + break; - default: /* any character sets we don't recognize */ - break; - } - code &= 0x7f; /* NRC in any case is 7-bit */ + case nrc_Norwegian_Danish: + case nrc_Norwegian_Danish2: + case nrc_Norwegian_Danish3: + map_NRCS_Norwegian_Danish(code); + break; + + case nrc_Portugese: + map_NRCS_Portuguese(code); + break; + + case nrc_SCS_NRCS: /* vt5xx - probably Serbo/Croatian */ + /* FIXME */ + break; + + case nrc_Spanish: + map_NRCS_Spanish(code); + break; + + case nrc_Swedish2: + case nrc_Swedish: + map_NRCS_Swedish(code); + break; + + case nrc_Swiss: + map_NRCS_Swiss(code); + break; + + case nrc_Turkish: + case nrc_Turkish2: + /* FIXME */ + break; + + default: /* any character sets we don't recognize */ + break; } + code &= 0x7f; /* NRC in any case is 7-bit */ + TRACE(("->\t%s\n", + visibleUChar(code))); return code; #undef MAP +#undef UNI +#undef XXX } /* @@ -244,7 +499,7 @@ xtermCharSetIn(unsigned code, int charset) * DEC graphic characters in cells 0-31, and otherwise is ISO-8859-1. */ int -xtermCharSetOut(XtermWidget xw, IChar * buf, IChar * ptr, int leftset) +xtermCharSetOut(XtermWidget xw, IChar *buf, IChar *ptr, int leftset) { IChar *s; TScreen *screen = TScreenOf(xw); @@ -253,11 +508,19 @@ xtermCharSetOut(XtermWidget xw, IChar * buf, IChar * ptr, int leftset) #define MAP(from, to) case from: chr = to; break - TRACE(("CHARSET GL=%c(G%d) GR=%c(G%d) SS%d\n\t%s\n", - leftset, screen->curgl, - rightset, screen->curgr, +#if OPT_WIDE_CHARS +#define UNI(from, to) case from: if (screen->utf8_nrc_mode) chr = to; break +#define XXX(from, to) UNI(from, to) +#else +#define UNI(old, new) chr = old; break +#define XXX(from, to) /* nothing */ +#endif + + TRACE(("CHARSET-OUT GL=%s(G%d) GR=%s(G%d) SS%d\n\t%s\n", + visibleScsCode(leftset), screen->curgl, + visibleScsCode(rightset), screen->curgr, screen->curss, - visibleIChar(buf, (unsigned) (ptr - buf)))); + visibleIChars(buf, (unsigned) (ptr - buf)))); for (s = buf; s < ptr; ++s) { int eight = CharOf(E2A(*s)); @@ -272,22 +535,29 @@ xtermCharSetOut(XtermWidget xw, IChar * buf, IChar * ptr, int leftset) * the replacement character and other non-8bit codes into bogus * 8bit codes. */ - if (screen->utf8_mode) { + if (screen->utf8_mode || screen->utf8_nrc_mode) { if (*s > 255) continue; } #endif + if (*s < 32) + continue; + switch (cs) { - case 'A': /* United Kingdom set (or Latin 1) */ + case nrc_British_Latin_1: + /* FALLTHRU */ + case nrc_British: /* United Kingdom set (or Latin 1) */ if ((xw->flags & NATIONAL) || (screen->vtXX_level <= 1)) { + if ((xw->flags & NATIONAL)) { + chr = seven; + } if (chr == 0x23) { -#if OPT_WIDE_CHARS - chr = (screen->utf8_mode - ? 0xa3 - : XTERM_POUND); -#else chr = XTERM_POUND; +#if OPT_WIDE_CHARS + if (screen->utf8_nrc_mode) { + chr = 0xa3; + } #endif } } else { @@ -296,17 +566,17 @@ xtermCharSetOut(XtermWidget xw, IChar * buf, IChar * ptr, int leftset) break; #if OPT_XMC_GLITCH - case '?': + case nrc_Unknown: #endif - case '1': /* Alternate Character ROM standard characters */ - case '2': /* Alternate Character ROM special graphics */ - case 'B': /* ASCII set */ + case nrc_DEC_Alt_Chars: + case nrc_DEC_Alt_Graphics: + case nrc_ASCII: break; - case '0': /* special graphics (line drawing) */ + case nrc_DEC_Spec_Graphic: if (seven > 0x5f && seven <= 0x7e) { #if OPT_WIDE_CHARS - if (screen->utf8_mode) + if (screen->utf8_mode || screen->utf8_nrc_mode) chr = (int) dec2ucs((unsigned) (seven - 0x5f)); else #endif @@ -316,152 +586,80 @@ xtermCharSetOut(XtermWidget xw, IChar * buf, IChar * ptr, int leftset) } break; - case '4': /* Dutch */ - switch (chr = seven) { - MAP(0x23, XK_sterling); - MAP(0x40, XK_threequarters); - MAP(0x5b, XK_ydiaeresis); - MAP(0x5c, XK_onehalf); - MAP(0x5d, XK_bar); - MAP(0x7b, XK_diaeresis); - MAP(0x7c, XK_f); - MAP(0x7d, XK_onequarter); - MAP(0x7e, XK_acute); - } + case nrc_DEC_Supp: + map_SCS_DEC_Supp(chr = seven, chr |= 0x80); break; - case 'C': - case '5': /* Finnish */ - switch (chr = seven) { - MAP(0x5b, XK_Adiaeresis); - MAP(0x5c, XK_Odiaeresis); - MAP(0x5d, XK_Aring); - MAP(0x5e, XK_Udiaeresis); - MAP(0x60, XK_eacute); - MAP(0x7b, XK_adiaeresis); - MAP(0x7c, XK_odiaeresis); - MAP(0x7d, XK_aring); - MAP(0x7e, XK_udiaeresis); - } + case nrc_DEC_Supp_Graphic: + map_SCS_DEC_Supp_Graphic(chr = seven, chr |= 0x80); break; - case 'R': /* French */ - switch (chr = seven) { - MAP(0x23, XK_sterling); - MAP(0x40, XK_agrave); - MAP(0x5b, XK_degree); - MAP(0x5c, XK_ccedilla); - MAP(0x5d, XK_section); - MAP(0x7b, XK_eacute); - MAP(0x7c, XK_ugrave); - MAP(0x7d, XK_egrave); - MAP(0x7e, XK_diaeresis); - } + case nrc_DEC_Technical: + map_SCS_DEC_Technical(chr = seven); break; - case 'Q': /* French Canadian */ - switch (chr = seven) { - MAP(0x40, XK_agrave); - MAP(0x5b, XK_acircumflex); - MAP(0x5c, XK_ccedilla); - MAP(0x5d, XK_ecircumflex); - MAP(0x5e, XK_icircumflex); - MAP(0x60, XK_ocircumflex); - MAP(0x7b, XK_eacute); - MAP(0x7c, XK_ugrave); - MAP(0x7d, XK_egrave); - MAP(0x7e, XK_ucircumflex); - } + case nrc_Dutch: + map_NRCS_Dutch(chr = seven); break; - case 'K': /* German */ - switch (chr = seven) { - MAP(0x40, XK_section); - MAP(0x5b, XK_Adiaeresis); - MAP(0x5c, XK_Odiaeresis); - MAP(0x5d, XK_Udiaeresis); - MAP(0x7b, XK_adiaeresis); - MAP(0x7c, XK_odiaeresis); - MAP(0x7d, XK_udiaeresis); - MAP(0x7e, XK_ssharp); - } + case nrc_Finnish: + case nrc_Finnish2: + map_NRCS_Finnish(chr = seven); break; - case 'Y': /* Italian */ - switch (chr = seven) { - MAP(0x23, XK_sterling); - MAP(0x40, XK_section); - MAP(0x5b, XK_degree); - MAP(0x5c, XK_ccedilla); - MAP(0x5d, XK_eacute); - MAP(0x60, XK_ugrave); - MAP(0x7b, XK_agrave); - MAP(0x7c, XK_ograve); - MAP(0x7d, XK_egrave); - MAP(0x7e, XK_igrave); - } + case nrc_French: + case nrc_French2: + map_NRCS_French(chr = seven); break; - case 'E': - case '6': /* Norwegian/Danish */ - switch (chr = seven) { - MAP(0x40, XK_Adiaeresis); - MAP(0x5b, XK_AE); - MAP(0x5c, XK_Ooblique); - MAP(0x5d, XK_Aring); - MAP(0x5e, XK_Udiaeresis); - MAP(0x60, XK_adiaeresis); - MAP(0x7b, XK_ae); - MAP(0x7c, XK_oslash); - MAP(0x7d, XK_aring); - MAP(0x7e, XK_udiaeresis); - } + case nrc_French_Canadian: + case nrc_French_Canadian2: + map_NRCS_French_Canadian(chr = seven); break; - case 'Z': /* Spanish */ - switch (chr = seven) { - MAP(0x23, XK_sterling); - MAP(0x40, XK_section); - MAP(0x5b, XK_exclamdown); - MAP(0x5c, XK_Ntilde); - MAP(0x5d, XK_questiondown); - MAP(0x7b, XK_degree); - MAP(0x7c, XK_ntilde); - MAP(0x7d, XK_ccedilla); - } + case nrc_German: + map_NRCS_German(chr = seven); break; - case 'H': - case '7': /* Swedish */ - switch (chr = seven) { - MAP(0x40, XK_Eacute); - MAP(0x5b, XK_Adiaeresis); - MAP(0x5c, XK_Odiaeresis); - MAP(0x5d, XK_Aring); - MAP(0x5e, XK_Udiaeresis); - MAP(0x60, XK_eacute); - MAP(0x7b, XK_adiaeresis); - MAP(0x7c, XK_odiaeresis); - MAP(0x7d, XK_aring); - MAP(0x7e, XK_udiaeresis); - } + case nrc_Hebrew: + case nrc_Hebrew2: + /* FIXME */ break; - case '=': /* Swiss */ - switch (chr = seven) { - MAP(0x23, XK_ugrave); - MAP(0x40, XK_agrave); - MAP(0x5b, XK_eacute); - MAP(0x5c, XK_ccedilla); - MAP(0x5d, XK_ecircumflex); - MAP(0x5e, XK_icircumflex); - MAP(0x5f, XK_egrave); - MAP(0x60, XK_ocircumflex); - MAP(0x7b, XK_adiaeresis); - MAP(0x7c, XK_odiaeresis); - MAP(0x7d, XK_udiaeresis); - MAP(0x7e, XK_ucircumflex); - } + case nrc_Italian: + map_NRCS_Italian(chr = seven); + break; + + case nrc_Norwegian_Danish: + case nrc_Norwegian_Danish2: + case nrc_Norwegian_Danish3: + map_NRCS_Norwegian_Danish(chr = seven); + break; + + case nrc_Portugese: + map_NRCS_Portuguese(chr = seven); + break; + + case nrc_SCS_NRCS: /* vt5xx - probably Serbo/Croatian */ + /* FIXME */ + break; + + case nrc_Spanish: + map_NRCS_Spanish(chr = seven); + break; + + case nrc_Swedish2: + case nrc_Swedish: + map_NRCS_Swedish(chr = seven); + break; + + case nrc_Swiss: + map_NRCS_Swiss(chr = seven); + break; + + case nrc_Turkish: + case nrc_Turkish2: + /* FIXME */ break; default: /* any character sets we don't recognize */ @@ -479,7 +677,9 @@ xtermCharSetOut(XtermWidget xw, IChar * buf, IChar * ptr, int leftset) } TRACE(("%d\t%s\n", count, - visibleIChar(buf, (unsigned) (ptr - buf)))); + visibleIChars(buf, (unsigned) (ptr - buf)))); return count; #undef MAP +#undef UNI +#undef XXX } diff --git a/app/xterm/configure.in b/app/xterm/configure.in index e439d76c7..e72e077d8 100644 --- a/app/xterm/configure.in +++ b/app/xterm/configure.in @@ -1,4 +1,4 @@ -dnl $XTermId: configure.in,v 1.318 2013/06/23 21:39:24 tom Exp $ +dnl $XTermId: configure.in,v 1.321 2013/11/22 21:42:13 tom Exp $ dnl dnl ----------------------------------------------------------------------------- dnl this file is part of xterm @@ -91,6 +91,7 @@ AC_TYPE_OFF_T AC_CHECK_FUNCS( \ gethostname \ getlogin \ + mkdtemp \ putenv \ unsetenv \ sched_yield \ @@ -259,6 +260,9 @@ CF_X_ATHENA CF_TYPE_FD_MASK CF_TERMIO_C_ISPEED +# If we notice Xcursor, there is a workaround needed. +AC_CHECK_LIB(Xcursor, XcursorGetTheme,[AC_DEFINE(HAVE_LIB_XCURSOR)]) + LIBS="$LIBS $X_EXTRA_LIBS" CF_FUNC_GRANTPT @@ -836,33 +840,11 @@ CF_ARG_DISABLE(vt52, AC_MSG_RESULT($enable_vt52) test "$enable_vt52" = no && AC_DEFINE(OPT_VT52_MODE,0,[Define to 0 to disable VT52 emulation]) -AC_MSG_CHECKING(if you want to use mini-luit/Latin9 built-in support) -CF_ARG_ENABLE(mini-luit, - [ --enable-mini-luit enable mini-luit (built-in Latin9 support)], - [enable_mini_luit=yes], - [enable_mini_luit=no]) -AC_MSG_RESULT($enable_mini_luit) -if test "$enable_mini_luit" = yes ; then - AC_DEFINE(OPT_MINI_LUIT,1,[Define to 1 to enable mini-luit (built-in Latin9 support)]) -fi - -AC_MSG_CHECKING(if you want to use luit) -CF_ARG_ENABLE(luit, - [ --enable-luit enable luit filter (Unicode translation)], - [enable_luit=yes], - [enable_luit=$enable_mini_luit]) -AC_MSG_RESULT($enable_luit) -if test "$enable_luit" = yes ; then - AC_DEFINE(OPT_LUIT_PROG,1,[Define to 1 to enable luit filter (Unicode translation)]) - CF_PATH_PROG(LUIT,xterm-filter,bluit luit) -fi - AC_MSG_CHECKING(if you want wide-character support) -CF_ARG_OPTION(wide-chars, - [ --enable-wide-chars enable wide-character support], - [enable_wchar=yes], - [enable_wchar=$enable_luit], - [$enable_luit]) +CF_ARG_DISABLE(wide-chars, + [ --disable-wide-chars disable wide-character support], + [enable_wchar=no], + [enable_wchar=yes]) AC_MSG_RESULT($enable_wchar) AC_MSG_CHECKING(if you want only 16-bit character support) @@ -878,6 +860,28 @@ if test "$enable_16bit_chars" = yes ; then fi if test "$enable_wchar" = yes ; then + +AC_MSG_CHECKING(if you want to use mini-luit/Latin9 built-in support) +CF_ARG_ENABLE(mini-luit, + [ --enable-mini-luit enable mini-luit (built-in Latin9 support)], + [enable_mini_luit=yes], + [enable_mini_luit=no]) +AC_MSG_RESULT($enable_mini_luit) +if test "$enable_mini_luit" = yes ; then + AC_DEFINE(OPT_MINI_LUIT,1,[Define to 1 to enable mini-luit (built-in Latin9 support)]) +fi + +AC_MSG_CHECKING(if you want to use luit) +CF_ARG_DISABLE(luit, + [ --disable-luit enable luit filter (Unicode translation)], + [enable_luit=no], + [enable_luit=yes]) +AC_MSG_RESULT($enable_luit) +if test "$enable_luit" = yes ; then + AC_DEFINE(OPT_LUIT_PROG,1,[Define to 1 to enable luit filter (Unicode translation)]) + CF_PATH_PROG(LUIT,xterm-filter,bluit luit) +fi + AC_DEFINE(OPT_WIDE_CHARS,1,[Define to 1 to enable wide-character support]) EXTRAHDRS="$EXTRAHDRS charclass.h precompose.h wcwidth.h" EXTRASRCS="$EXTRASRCS charclass.c precompose.c wcwidth.c" diff --git a/app/xterm/ctlseqs.ms b/app/xterm/ctlseqs.ms index c141cbfe9..010cb8b2e 100644 --- a/app/xterm/ctlseqs.ms +++ b/app/xterm/ctlseqs.ms @@ -1,6 +1,6 @@ .\"#! troff -ms $1 -*- Nroff -*- .\" "Xterm Control Sequences" document -.\" $XTermId: ctlseqs.ms,v 1.295 2013/07/05 20:14:27 tom Exp $ +.\" $XTermId: ctlseqs.ms,v 1.303 2013/11/11 00:23:36 tom Exp $ .\" .\" .\" Copyright 1996-2012,2013 by Thomas E. Dickey @@ -69,8 +69,8 @@ .\" .ds XT XTerm .ds xt xterm -.ds LF Patch #294 -.ds RF 2013/07/05 +.ds LF Patch #298 +.ds RF 2013/11/10 .\" .if n .pl 9999v \" no page breaks in nroff .ND @@ -410,8 +410,8 @@ Where the function is specified by DEC or ISO 6429, the code assigned to it is given in parentheses. .LP The escape codes to designate and invoke -character sets are specified by ISO 2022; see that document for a -discussion of character sets. +character sets are specified by ISO 2022 (see that document for a +discussion of character sets). .LP Many of the features are optional; \fI\*(xt\fP can be configured and built without support for them. @@ -505,17 +505,25 @@ Select UTF-8 character set (ISO 2022). Designate G0 Character Set (ISO 2022, VT100). .br Final character \*(Cc for designating 94-character sets. -In this list, \*0, \*A and \*(cB apply to VT100 and up, the remainder to VT220 and up: +In this list, \*0, \*A and \*(cB apply to VT100 and up, the remainder to VT220 and up. +The VT220 character sets, together with the Portuguese character set are activated by +the National Replacement Character controls. The \*A is a special case, since it is +also activated by the VT300-control for British Latin-1 separately from the National +Replacement Character controls. \*(Cc = \*0 \(-> DEC Special Character and Line Drawing Set. + \*(Cc = \*< \(-> DEC Supplementary (VT200). + \*(Cc = \*%\*5 \(-> DEC Supplementary Graphics (VT300). + \*(Cc = \*> \(-> DEC Technical (VT300). \*(Cc = \*A \(-> United Kingdom (UK). \*(Cc = \*(cB \(-> United States (USASCII). \*(Cc = \*4 \(-> Dutch. \*(Cc = \*C or \*5 \(-> Finnish. - \*(Cc = \*R \(-> French. - \*(Cc = \*Q \(-> French Canadian. + \*(Cc = \*R or \*f \(-> French. + \*(Cc = \*Q or \*9 \(-> French Canadian (VT200, VT300). \*(Cc = \*K \(-> German. \*(Cc = \*Y \(-> Italian. - \*(Cc = \*E or \*6 \(-> Norwegian/Danish. + \*(Cc = \*`, \*E or \*6 \(-> Norwegian/Danish. + \*(Cc = \*%\*6 \(-> Portuguese (VT300). \*(Cc = \*Z \(-> Spanish. \*(Cc = \*H or \*7 \(-> Swedish. \*(Cc = \*= \(-> Swiss. @@ -792,7 +800,7 @@ VT220 parameters do, telling the host what features the terminal supports: \*(Ps = \*2 \(-> Printer. \*(Ps = \*6 \(-> Selective erase. \*(Ps = \*8 \(-> User-defined keys. - \*(Ps = \*9 \(-> National replacement character sets. + \*(Ps = \*9 \(-> National Replacement Character sets. \*(Ps = \*1\*5 \(-> Technical characters. \*(Ps = \*1\*8 \(-> User windows. \*(Ps = \*2\*1 \(-> Horizontal scrolling. @@ -856,7 +864,7 @@ and set VT100 mode. \*(Ps = \*7 \(-> Wraparound Mode (DECAWM). \*(Ps = \*8 \(-> Auto-repeat Keys (DECARM). \*(Ps = \*9 \(-> Send Mouse X & Y on button press. -See the section \fBMouse Tracking\fP. +See the section \fBMouse Tracking\fP. This is the X10 xterm mouse protocol. \*(Ps = \*1\*0 \(-> Show toolbar (rxvt). \*(Ps = \*1\*2 \(-> Start Blinking Cursor (att610). \*(Ps = \*1\*8 \(-> Print form feed (DECPFF). @@ -867,7 +875,7 @@ See the section \fBMouse Tracking\fP. \*(Ps = \*3\*8 \(-> Enter Tektronix Mode (DECTEK). \*(Ps = \*4\*0 \(-> Allow 80 \z\(<-\(-> 132 Mode. \*(Ps = \*4\*1 \(-> \fImore\fP(1) fix (see \fBcurses\fP resource). - \*(Ps = \*4\*2 \(-> Enable Nation Replacement Character sets (DECNRCM). + \*(Ps = \*4\*2 \(-> Enable National Replacement Character sets (DECNRCM). \*(Ps = \*4\*4 \(-> Turn On Margin Bell. \*(Ps = \*4\*5 \(-> Reverse-wraparound Mode. \*(Ps = \*4\*6 \(-> Start Logging. @@ -879,7 +887,7 @@ disabled by the \fBtiteInhibit\fP resource). \*(Ps = \*6\*9 \(-> Enable left and right margin mode (DECLRMM), VT420 and up. \*(Ps = \*9\*5 \(-> Do not clear screen when DECCOLM is set/reset (DECNCSM), VT510 and up. \*(Ps = \*1\*0\*0\*0 \(-> Send Mouse X & Y on button press and release. -See the section \fBMouse Tracking\fP. +See the section \fBMouse Tracking\fP. This is the X11 xterm mouse protocol. \*(Ps = \*1\*0\*0\*1 \(-> Use Hilite Mouse Tracking. \*(Ps = \*1\*0\*0\*2 \(-> Use Cell Motion Mouse Tracking. \*(Ps = \*1\*0\*0\*3 \(-> Use All Motion Mouse Tracking. @@ -888,8 +896,8 @@ See the section \fBMouse Tracking\fP. \*(Ps = \*1\*0\*0\*6 \(-> Enable SGR Mouse Mode. \*(Ps = \*1\*0\*0\*7 \(-> Enable Alternate Scroll Mode. \*(Ps = \*1\*0\*1\*0 \(-> Scroll to bottom on tty output (rxvt). - \*(Ps = \*1\*0\*1\*5 \(-> Enable urxvt Mouse Mode. \*(Ps = \*1\*0\*1\*1 \(-> Scroll to bottom on key press (rxvt). + \*(Ps = \*1\*0\*1\*5 \(-> Enable urxvt Mouse Mode. \*(Ps = \*1\*0\*3\*4 \(-> Interpret "meta" key, sets eighth bit. (enables the \fBeightBitInput\fP resource). \*(Ps = \*1\*0\*3\*5 \(-> Enable special modifiers for Alt and NumLock keys. @@ -965,7 +973,7 @@ DEC Private Mode Reset (DECRST). \*(Ps = \*3\*5 \(-> Disable font-shifting functions (rxvt). \*(Ps = \*4\*0 \(-> Disallow 80 \z\(<-\(-> 132 Mode. \*(Ps = \*4\*1 \(-> No \fImore\fP(1) fix (see \fBcurses\fP resource). - \*(Ps = \*4\*2 \(-> Disable Nation Replacement Character sets (DECNRCM). + \*(Ps = \*4\*2 \(-> Disable National Replacement Character sets (DECNRCM). \*(Ps = \*4\*4 \(-> Turn Off Margin Bell. \*(Ps = \*4\*5 \(-> No Reverse-wraparound Mode. \*(Ps = \*4\*6 \(-> Stop Logging. @@ -986,8 +994,8 @@ See the section \fBMouse Tracking\fP. \*(Ps = \*1\*0\*0\*6 \(-> Disable SGR Mouse Mode. \*(Ps = \*1\*0\*0\*7 \(-> Disable Alternate Scroll Mode. \*(Ps = \*1\*0\*1\*0 \(-> Don't scroll to bottom on tty output (rxvt). - \*(Ps = \*1\*0\*1\*5 \(-> Disable urxvt Mouse Mode. \*(Ps = \*1\*0\*1\*1 \(-> Don't scroll to bottom on key press (rxvt). + \*(Ps = \*1\*0\*1\*5 \(-> Disable urxvt Mouse Mode. \*(Ps = \*1\*0\*3\*4 \(-> Don't interpret "meta" key. (This disables the \fBeightBitInput\fP resource). \*(Ps = \*1\*0\*3\*5 \(-> Disable special modifiers for Alt and NumLock keys. @@ -2396,7 +2404,7 @@ additional codes: \fI\*(xt\fP has these additional private Set Mode values: \*(Ps = \*8\*0 \(-> SIXEL scrolling. \*(Ps = \*1\*0\*7\*0 \(-> use private color registers for each graphic. -.IP \\*(Dc\\*(Pa\\*;\\*(Pb\\*;\\*(Ph\\*s\\*q\\*s\\*(Ps..\\*(Ps\fP\\*(ST +.IP \\*(Dc\\*(Pa\\*;\\*(Pb\\*;\\*(Ph\\*s\\*q\\*s\\*(Ps..\\*(Ps\fP\\*s\\*(ST See .ID http://vt100.net/docs/vt3xx-gp/chapter14.html diff --git a/app/xterm/ctlseqs.txt b/app/xterm/ctlseqs.txt index c5058cb0f..b60a4329a 100644 --- a/app/xterm/ctlseqs.txt +++ b/app/xterm/ctlseqs.txt @@ -21,7 +21,7 @@ Thomas Dickey XFree86 Project (1996-2006) invisible-island.net (2006-2013) - updated for XTerm Patch #294 (2013/07/05) + updated for XTerm Patch #298 (2013/11/10) @@ -95,7 +95,7 @@ tions, such as the scrollbar or window size. Where the function is specified by DEC or ISO 6429, the code assigned to it is given in paren- theses. The escape codes to designate and invoke character sets are specified by -ISO 2022; see that document for a discussion of character sets. +ISO 2022 (see that document for a discussion of character sets). Many of the features are optional; xterm can be configured and built without support for them. @@ -133,17 +133,26 @@ ESC % G Select UTF-8 character set (ISO 2022). ESC ( C Designate G0 Character Set (ISO 2022, VT100). Final character C for designating 94-character sets. In this list, 0 , A and B apply to VT100 and up, the remainder to - VT220 and up: + VT220 and up. The VT220 character sets, together with the + Portuguese character set are activated by the National + Replacement Character controls. The A is a special case, + since it is also activated by the VT300-control for British + Latin-1 separately from the National Replacement Character + controls. C = 0 -> DEC Special Character and Line Drawing Set. + C = < -> DEC Supplementary (VT200). + C = % 5 -> DEC Supplementary Graphics (VT300). + C = > -> DEC Technical (VT300). C = A -> United Kingdom (UK). C = B -> United States (USASCII). C = 4 -> Dutch. C = C or 5 -> Finnish. - C = R -> French. - C = Q -> French Canadian. + C = R or f -> French. + C = Q or 9 -> French Canadian (VT200, VT300). C = K -> German. C = Y -> Italian. - C = E or 6 -> Norwegian/Danish. + C = ` , E or 6 -> Norwegian/Danish. + C = % 6 -> Portuguese (VT300). C = Z -> Spanish. C = H or 7 -> Swedish. C = = -> Swiss. @@ -298,7 +307,7 @@ CSI Ps c Send Device Attributes (Primary DA). Ps = 2 -> Printer. Ps = 6 -> Selective erase. Ps = 8 -> User-defined keys. - Ps = 9 -> National replacement character sets. + Ps = 9 -> National Replacement Character sets. Ps = 1 5 -> Technical characters. Ps = 1 8 -> User windows. Ps = 2 1 -> Horizontal scrolling. @@ -352,7 +361,7 @@ CSI ? Pm h Ps = 7 -> Wraparound Mode (DECAWM). Ps = 8 -> Auto-repeat Keys (DECARM). Ps = 9 -> Send Mouse X & Y on button press. See the sec- - tion Mouse Tracking. + tion Mouse Tracking. This is the X10 xterm mouse protocol. Ps = 1 0 -> Show toolbar (rxvt). Ps = 1 2 -> Start Blinking Cursor (att610). Ps = 1 8 -> Print form feed (DECPFF). @@ -363,8 +372,8 @@ CSI ? Pm h Ps = 3 8 -> Enter Tektronix Mode (DECTEK). Ps = 4 0 -> Allow 80 -> 132 Mode. Ps = 4 1 -> more(1) fix (see curses resource). - Ps = 4 2 -> Enable Nation Replacement Character sets (DECN- - RCM). + Ps = 4 2 -> Enable National Replacement Character sets + (DECNRCM). Ps = 4 4 -> Turn On Margin Bell. Ps = 4 5 -> Reverse-wraparound Mode. Ps = 4 6 -> Start Logging. This is normally disabled by a @@ -378,7 +387,8 @@ CSI ? Pm h Ps = 9 5 -> Do not clear screen when DECCOLM is set/reset (DECNCSM), VT510 and up. Ps = 1 0 0 0 -> Send Mouse X & Y on button press and - release. See the section Mouse Tracking. + release. See the section Mouse Tracking. This is the X11 + xterm mouse protocol. Ps = 1 0 0 1 -> Use Hilite Mouse Tracking. Ps = 1 0 0 2 -> Use Cell Motion Mouse Tracking. Ps = 1 0 0 3 -> Use All Motion Mouse Tracking. @@ -387,8 +397,8 @@ CSI ? Pm h Ps = 1 0 0 6 -> Enable SGR Mouse Mode. Ps = 1 0 0 7 -> Enable Alternate Scroll Mode. Ps = 1 0 1 0 -> Scroll to bottom on tty output (rxvt). - Ps = 1 0 1 5 -> Enable urxvt Mouse Mode. Ps = 1 0 1 1 -> Scroll to bottom on key press (rxvt). + Ps = 1 0 1 5 -> Enable urxvt Mouse Mode. Ps = 1 0 3 4 -> Interpret "meta" key, sets eighth bit. (enables the eightBitInput resource). Ps = 1 0 3 5 -> Enable special modifiers for Alt and Num- @@ -460,8 +470,8 @@ CSI ? Pm l Ps = 3 5 -> Disable font-shifting functions (rxvt). Ps = 4 0 -> Disallow 80 -> 132 Mode. Ps = 4 1 -> No more(1) fix (see curses resource). - Ps = 4 2 -> Disable Nation Replacement Character sets (DEC- - NRCM). + Ps = 4 2 -> Disable National Replacement Character sets + (DECNRCM). Ps = 4 4 -> Turn Off Margin Bell. Ps = 4 5 -> No Reverse-wraparound Mode. Ps = 4 6 -> Stop Logging. (This is normally disabled by a @@ -484,8 +494,8 @@ CSI ? Pm l Ps = 1 0 0 7 -> Disable Alternate Scroll Mode. Ps = 1 0 1 0 -> Don't scroll to bottom on tty output (rxvt). - Ps = 1 0 1 5 -> Disable urxvt Mouse Mode. Ps = 1 0 1 1 -> Don't scroll to bottom on key press (rxvt). + Ps = 1 0 1 5 -> Disable urxvt Mouse Mode. Ps = 1 0 3 4 -> Don't interpret "meta" key. (This disables the eightBitInput resource). Ps = 1 0 3 5 -> Disable special modifiers for Alt and Num- @@ -1645,7 +1655,7 @@ CSI ? Pm h Ps = 8 0 -> SIXEL scrolling. Ps = 1 0 7 0 -> use private color registers for each graphic. -DCS Pa; Pb; Ph q Ps..PsST +DCS Pa; Pb; Ph q Ps..Ps ST See http://vt100.net/docs/vt3xx-gp/chapter14.html diff --git a/app/xterm/cursor.c b/app/xterm/cursor.c index ed0140efc..6fdc35de5 100644 --- a/app/xterm/cursor.c +++ b/app/xterm/cursor.c @@ -1,7 +1,7 @@ -/* $XTermId: cursor.c,v 1.67 2012/06/03 19:57:47 tom Exp $ */ +/* $XTermId: cursor.c,v 1.69 2013/08/08 08:16:40 tom Exp $ */ /* - * Copyright 2002-2010,2012 by Thomas E. Dickey + * Copyright 2002-2012,2013 by Thomas E. Dickey * * All Rights Reserved * @@ -271,7 +271,7 @@ CarriageReturn(XtermWidget xw) if (xw->flags & ORIGIN) { col = left; - } else if (screen->cur_col > left) { + } else if (screen->cur_col >= left) { col = left; } else { /* diff --git a/app/xterm/data.c b/app/xterm/data.c index bbccd5a40..1a44d1f87 100644 --- a/app/xterm/data.c +++ b/app/xterm/data.c @@ -1,7 +1,7 @@ -/* $XTermId: data.c,v 1.92 2011/02/13 19:59:23 tom Exp $ */ +/* $XTermId: data.c,v 1.93 2013/11/22 21:48:08 tom Exp $ */ /* - * Copyright 2002-2009,2011 by Thomas E. Dickey + * Copyright 2002-2011,2013 by Thomas E. Dickey * * All Rights Reserved * @@ -106,6 +106,10 @@ char *ttydev; int mapstate = -1; #endif /* HANDLE_STRUCT_NOTIFY */ +#ifdef HAVE_LIB_XCURSOR +char *xterm_cursor_theme; +#endif + #if OPT_SESSION_MGT int ice_fd = -1; #endif diff --git a/app/xterm/data.h b/app/xterm/data.h index 558783e70..a3e093a0c 100644 --- a/app/xterm/data.h +++ b/app/xterm/data.h @@ -1,7 +1,7 @@ -/* $XTermId: data.h,v 1.121 2012/10/14 18:51:30 tom Exp $ */ +/* $XTermId: data.h,v 1.123 2013/11/23 17:00:45 tom Exp $ */ /* - * Copyright 2002-2011,2012 by Thomas E. Dickey + * Copyright 2002-2012,2013 by Thomas E. Dickey * * All Rights Reserved * @@ -141,6 +141,10 @@ extern Atom wm_delete_window; extern int mapstate; #endif /* HANDLE_STRUCT_NOTIFY */ +#ifdef HAVE_LIB_XCURSOR +extern char *xterm_cursor_theme; +#endif + typedef struct XTERM_RESOURCE { char *icon_geometry; char *title; @@ -201,6 +205,9 @@ typedef struct XTERM_RESOURCE { Boolean ptyHandshake; /* use pty-handshaking */ Boolean ptySttySize; /* reset TTY size after pty handshake */ #endif +#if OPT_REPORT_FONTS + Boolean reportFonts; /* show bitmap-font information as loaded */ +#endif #if OPT_SAME_NAME Boolean sameName; /* Don't change the title or icon name if it is * the same. This prevents flicker on the diff --git a/app/xterm/doublechr.c b/app/xterm/doublechr.c index 3c13ef01a..d228e7f39 100644 --- a/app/xterm/doublechr.c +++ b/app/xterm/doublechr.c @@ -1,7 +1,7 @@ -/* $XTermId: doublechr.c,v 1.81 2012/04/15 23:39:53 tom Exp $ */ +/* $XTermId: doublechr.c,v 1.83 2013/08/30 21:35:13 tom Exp $ */ /* - * Copyright 1997-2011,2012 by Thomas E. Dickey + * Copyright 1997-2012,2013 by Thomas E. Dickey * * All Rights Reserved * @@ -66,8 +66,8 @@ repaint_line(XtermWidget xw, unsigned newChrSet) if (oldChrSet != newChrSet) { TRACE(("repaint_line(%2d,%2d) (%s -> %s)\n", currow, screen->cur_col, - visibleChrsetName(oldChrSet), - visibleChrsetName(newChrSet))); + visibleDblChrset(oldChrSet), + visibleDblChrset(newChrSet))); HideCursor(); /* If switching from single-width, keep the cursor in the visible part diff --git a/app/xterm/fontutils.c b/app/xterm/fontutils.c index 690749d11..b46d003ab 100644 --- a/app/xterm/fontutils.c +++ b/app/xterm/fontutils.c @@ -1,7 +1,7 @@ -/* $XTermId: fontutils.c,v 1.387 2013/05/15 00:31:56 tom Exp $ */ +/* $XTermId: fontutils.c,v 1.399 2013/11/26 20:12:00 tom Exp $ */ /* - * Copyright 1998-2011,2012 by Thomas E. Dickey + * Copyright 1998-2012,2013 by Thomas E. Dickey * * All Rights Reserved * @@ -59,22 +59,22 @@ (((cs)->rbearing|(cs)->lbearing| \ (cs)->ascent|(cs)->descent) == 0)) -#define CI_GET_CHAR_INFO_1D(fs,col,def,cs) \ +#define CI_GET_CHAR_INFO_1D(fs,col,cs) \ { \ - cs = def; \ + cs = 0; \ if (col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \ if (fs->per_char == NULL) { \ cs = &fs->min_bounds; \ } else { \ cs = &fs->per_char[(col - fs->min_char_or_byte2)]; \ - if (CI_NONEXISTCHAR(cs)) cs = def; \ } \ + if (CI_NONEXISTCHAR(cs)) cs = 0; \ } \ } -#define CI_GET_CHAR_INFO_2D(fs,row,col,def,cs) \ +#define CI_GET_CHAR_INFO_2D(fs,row,col,cs) \ { \ - cs = def; \ + cs = 0; \ if (row >= fs->min_byte1 && row <= fs->max_byte1 && \ col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \ if (fs->per_char == NULL) { \ @@ -84,8 +84,8 @@ (fs->max_char_or_byte2 - \ fs->min_char_or_byte2 + 1)) + \ (col - fs->min_char_or_byte2)]; \ - if (CI_NONEXISTCHAR(cs)) cs = def; \ } \ + if (CI_NONEXISTCHAR(cs)) cs = 0; \ } \ } @@ -130,7 +130,7 @@ countGlyphs(XFontStruct * fp) if (fp != 0) { if (fp->min_byte1 == 0 && fp->max_byte1 == 0) { - count = fp->max_char_or_byte2 - fp->min_char_or_byte2; + count = fp->max_char_or_byte2 - fp->min_char_or_byte2 + 1; } else if (fp->min_char_or_byte2 < 256 && fp->max_char_or_byte2 < 256) { unsigned first = (fp->min_byte1 << 8) + fp->min_char_or_byte2; @@ -253,7 +253,7 @@ check_fontname(const char *name) * or NULL on error. */ static FontNameProperties * -get_font_name_props(Display * dpy, XFontStruct * fs, char **result) +get_font_name_props(Display *dpy, XFontStruct * fs, char **result) { static FontNameProperties props; static char *last_name; @@ -465,7 +465,7 @@ widebold_font_name(FontNameProperties * props) * fonts we double the pixel-size and Y-resolution */ char * -xtermSpecialFont(TScreen * screen, unsigned atts, unsigned chrset) +xtermSpecialFont(TScreen *screen, unsigned atts, unsigned chrset) { #if OPT_TRACE static char old_spacing[80]; @@ -580,7 +580,7 @@ same_font_name(const char *pattern, const char *match) * offset. */ static int -got_bold_font(Display * dpy, XFontStruct * fs, String requested) +got_bold_font(Display *dpy, XFontStruct * fs, String requested) { char *actual = 0; int got; @@ -661,7 +661,7 @@ is_double_width_font(XFontStruct * fs) #define FULL_WIDTH_CHAR2 0xAC00 /* Korean script syllable 'Ka' */ static Bool -is_double_width_font_xft(Display * dpy, XftFont * font) +is_double_width_font_xft(Display *dpy, XftFont * font) { XGlyphInfo gi1, gi2; FcChar32 c1 = HALF_WIDTH_CHAR1, c2 = HALF_WIDTH_CHAR2; @@ -726,7 +726,7 @@ xtermFontName(const char *normal) } static void -cache_menu_font_name(TScreen * screen, int fontnum, int which, const char *name) +cache_menu_font_name(TScreen *screen, int fontnum, int which, const char *name) { if (name != 0) { char *last = (char *) screen->menu_font_names[fontnum][which]; @@ -860,6 +860,84 @@ xtermFreeFontInfo(XTermFonts * target) target->fs = 0; } +#if OPT_REPORT_FONTS +static void +reportXCharStruct(const char *tag, XCharStruct * cs) +{ + printf("\t\t%s:\n", tag); + printf("\t\t\tlbearing: %d\n", cs->lbearing); + printf("\t\t\trbearing: %d\n", cs->rbearing); + printf("\t\t\twidth: %d\n", cs->width); + printf("\t\t\tascent: %d\n", cs->ascent); + printf("\t\t\tdescent: %d\n", cs->descent); +} + +static void +reportOneVTFont(const char *tag, + XTermFonts * fnt) +{ + if (!IsEmpty(fnt->fn)) { + XFontStruct *fs = fnt->fs; + unsigned missing = 0; + unsigned first_char = 0; + unsigned last_char = 0; + unsigned ch; + + if (fs->max_byte1 == 0) { + first_char = fs->min_char_or_byte2; + last_char = fs->max_char_or_byte2; + } else { + first_char = (fs->min_byte1 * 256) + fs->min_char_or_byte2; + last_char = (fs->max_byte1 * 256) + fs->max_char_or_byte2; + } + + for (ch = first_char; ch <= last_char; ++ch) { + if (xtermMissingChar(ch, fnt)) { + ++missing; + } + } + + printf("\t%s: %s\n", tag, NonNull(fnt->fn)); + printf("\t\tall chars: %s\n", fs->all_chars_exist ? "yes" : "no"); + printf("\t\tdefault char: %d\n", fs->default_char); + printf("\t\tdirection: %d\n", fs->direction); + printf("\t\tascent: %d\n", fs->ascent); + printf("\t\tdescent: %d\n", fs->descent); + printf("\t\tfirst char: %u\n", first_char); + printf("\t\tlast char: %u\n", last_char); + printf("\t\tmaximum-chars: %u\n", countGlyphs(fs)); + printf("\t\tmissing-chars: %u\n", missing); + printf("\t\tpresent-chars: %u\n", countGlyphs(fs) - missing); + printf("\t\tmin_byte1: %d\n", fs->min_byte1); + printf("\t\tmax_byte1: %d\n", fs->max_byte1); + printf("\t\tproperties: %d\n", fs->n_properties); + reportXCharStruct("min_bounds", &(fs->min_bounds)); + reportXCharStruct("max_bounds", &(fs->max_bounds)); + /* TODO: report fs->properties and fs->per_char */ + } +} + +static void +reportVTFontInfo(XtermWidget xw, int fontnum) +{ + if (resource.reportFonts) { + TScreen *screen = TScreenOf(xw); + + if (fontnum) { + printf("Loaded VTFonts(font%d)\n", fontnum); + } else { + printf("Loaded VTFonts(default)\n"); + } + reportOneVTFont("fNorm", &screen->fnts[fNorm]); + reportOneVTFont("fBold", &screen->fnts[fBold]); +#if OPT_WIDE_CHARS + reportOneVTFont("fWide", &screen->fnts[fWide]); + reportOneVTFont("fWBold", &screen->fnts[fWBold]); +#endif + } +} +#endif + int xtermLoadFont(XtermWidget xw, const VTFontNames * fonts, @@ -1202,6 +1280,11 @@ xtermLoadFont(XtermWidget xw, { unsigned ch; + TRACE(("normal font is %scomplete\n", + FontIsIncomplete(&fnts[fNorm]) ? "in" : "")); + TRACE(("bold font is %scomplete\n", + FontIsIncomplete(&fnts[fBold]) ? "in" : "")); + for (ch = 1; ch < 32; ch++) { unsigned n = ch; #if OPT_WIDE_CHARS @@ -1257,6 +1340,9 @@ xtermLoadFont(XtermWidget xw, set_cursor_gcs(xw); xtermUpdateFontInfo(xw, doresize); TRACE(("Success Cgs - xtermLoadFont\n")); +#if OPT_REPORT_FONTS + reportVTFontInfo(xw, fontnum); +#endif return 1; bad: @@ -1530,7 +1616,7 @@ xtermLoadDefaultFonts(XtermWidget xw) void HandleLoadVTFonts(Widget w, XEvent * event GCC_UNUSED, - String * params GCC_UNUSED, + String *params GCC_UNUSED, Cardinal *param_count GCC_UNUSED) { static char empty[] = ""; /* appease strict compilers */ @@ -1580,7 +1666,7 @@ HandleLoadVTFonts(Widget w, * Set the limits for the box that outlines the cursor. */ void -xtermSetCursorBox(TScreen * screen) +xtermSetCursorBox(TScreen *screen) { static XPoint VTbox[NBOX]; XPoint *vp; @@ -1614,7 +1700,6 @@ xtermSetCursorBox(TScreen * screen) #if OPT_RENDERFONT -#if OPT_TRACE > 1 static FcChar32 xtermXftFirstChar(XftFont * xft) { @@ -1627,7 +1712,7 @@ xtermXftFirstChar(XftFont * xft) for (i = 0; i < FC_CHARSET_MAP_SIZE; i++) if (map[i]) { FcChar32 bits = map[i]; - first += i * 32; + first += (FcChar32) i *32; while (!(bits & 0x1)) { bits >>= 1; first++; @@ -1646,11 +1731,11 @@ xtermXftLastChar(XftFont * xft) last = FcCharSetFirstPage(xft->charset, map, &next); while ((this = FcCharSetNextPage(xft->charset, map, &next)) != FC_CHARSET_DONE) last = this; - last &= ~0xff; + last &= (FcChar32) ~ 0xff; for (i = FC_CHARSET_MAP_SIZE - 1; i >= 0; i--) if (map[i]) { FcChar32 bits = map[i]; - last += i * 32 + 31; + last += (FcChar32) i *32 + 31; while (!(bits & 0x80000000)) { last--; bits <<= 1; @@ -1660,6 +1745,7 @@ xtermXftLastChar(XftFont * xft) return (long) last; } +#if OPT_TRACE > 1 static void dumpXft(XtermWidget xw, XTermXftFonts * data) { @@ -1728,6 +1814,43 @@ checkXft(XtermWidget xw, XTermXftFonts * data, XftFont * xft) data->map.mixed = (data->map.max_width >= (data->map.min_width + 1)); } +static void +reportXftFonts(XtermWidget xw, + XftFont * fp, + const char *name, + const char *tag, + XftPattern * match) +{ + if (resource.reportFonts) { + char buffer[1024]; + FcChar32 first_char = xtermXftFirstChar(fp); + FcChar32 last_char = xtermXftLastChar(fp); + FcChar32 ch; + unsigned missing = 0; + + printf("Loaded XftFonts(%s:%s)\n", name, tag); + + for (ch = first_char; ch <= last_char; ++ch) { + if (xtermXftMissing(xw, fp, ch)) { + ++missing; + } + } + printf("\t\tfirst char: %u\n", first_char); + printf("\t\tlast char: %u\n", last_char); + printf("\t\tmissing-chars: %u\n", missing); + printf("\t\tpresent-chars: %u\n", (last_char - first_char) + 1 - missing); + + if (XftNameUnparse(match, buffer, (int) sizeof(buffer))) { + char *target; + char *source = buffer; + while ((target = strtok(source, ":")) != 0) { + printf("\t%s\n", target); + source = 0; + } + } + } +} + static XftFont * xtermOpenXft(XtermWidget xw, const char *name, XftPattern * pat, const char *tag) { @@ -1743,6 +1866,7 @@ xtermOpenXft(XtermWidget xw, const char *name, XftPattern * pat, const char *tag result = XftFontOpenPattern(dpy, match); if (result != 0) { TRACE(("...matched %s font\n", tag)); + reportXftFonts(xw, result, name, tag, match); } else { TRACE(("...could did not open %s font\n", tag)); XftPatternDestroy(match); @@ -1795,7 +1919,7 @@ dimSquareRoot(double value) * rule. */ static void -setRenderFontsize(TScreen * screen, VTwin * win, XftFont * font, const char *tag) +setRenderFontsize(TScreen *screen, VTwin * win, XftFont * font, const char *tag) { if (font != 0) { int width, height, ascent, descent; @@ -1852,7 +1976,7 @@ checkFontInfo(int value, const char *tag) #if OPT_RENDERFONT void -xtermCloseXft(TScreen * screen, XTermXftFonts * pub) +xtermCloseXft(TScreen *screen, XTermXftFonts * pub) { if (pub->font != 0) { XftFontClose(screen->display, pub->font); @@ -2142,7 +2266,7 @@ xtermComputeFontInfo(XtermWidget xw, /* save this information as a side-effect for double-sized characters */ void -xtermSaveFontInfo(TScreen * screen, XFontStruct * font) +xtermSaveFontInfo(TScreen *screen, XFontStruct * font) { screen->fnt_wide = (Dimension) (font->max_bounds.width); screen->fnt_high = (Dimension) (font->ascent + font->descent); @@ -2193,32 +2317,29 @@ xtermMissingChar(unsigned ch, XTermFonts * font) { Bool result = False; XFontStruct *fs = font->fs; - static XCharStruct dft, *tmp = &dft, *pc = 0; + XCharStruct *pc = 0; if (fs->max_byte1 == 0) { #if OPT_WIDE_CHARS - if (ch > 255) { - TRACE(("xtermMissingChar %#04x (row)\n", ch)); - return True; - } + if (ch < 256) #endif - CI_GET_CHAR_INFO_1D(fs, E2A(ch), tmp, pc); + { + CI_GET_CHAR_INFO_1D(fs, E2A(ch), pc); + } } #if OPT_WIDE_CHARS else { - CI_GET_CHAR_INFO_2D(fs, HI_BYTE(ch), LO_BYTE(ch), tmp, pc); + unsigned row = (ch >> 8); + unsigned col = (ch & 0xff); + CI_GET_CHAR_INFO_2D(fs, row, col, pc); } -#else - - if (!pc) - return False; /* Urgh! */ #endif - if (CI_NONEXISTCHAR(pc)) { + if (pc == 0 || CI_NONEXISTCHAR(pc)) { TRACE(("xtermMissingChar %#04x (!exists)\n", ch)); result = True; } - if (ch < 256) { + if (ch < KNOWN_MISSING) { font->known_missing[ch] = (Char) (result ? 2 : 1); } return result; @@ -2963,7 +3084,7 @@ lookupRelativeFontSize(XtermWidget xw, int old, int relative) void HandleLargerFont(Widget w GCC_UNUSED, XEvent * event GCC_UNUSED, - String * params GCC_UNUSED, + String *params GCC_UNUSED, Cardinal *param_count GCC_UNUSED) { XtermWidget xw; @@ -2988,7 +3109,7 @@ HandleLargerFont(Widget w GCC_UNUSED, void HandleSmallerFont(Widget w GCC_UNUSED, XEvent * event GCC_UNUSED, - String * params GCC_UNUSED, + String *params GCC_UNUSED, Cardinal *param_count GCC_UNUSED) { XtermWidget xw; @@ -3058,7 +3179,7 @@ xtermGetFont(const char *param) void HandleSetFont(Widget w GCC_UNUSED, XEvent * event GCC_UNUSED, - String * params, + String *params, Cardinal *param_count) { XtermWidget xw; diff --git a/app/xterm/fontutils.h b/app/xterm/fontutils.h index 9bdf9670b..03567c105 100644 --- a/app/xterm/fontutils.h +++ b/app/xterm/fontutils.h @@ -1,7 +1,7 @@ -/* $XTermId: fontutils.h,v 1.84 2011/09/11 14:59:37 tom Exp $ */ +/* $XTermId: fontutils.h,v 1.88 2013/09/11 21:19:50 tom Exp $ */ /* - * Copyright 1998-2010,2011 by Thomas E. Dickey + * Copyright 1998-2011,2013 by Thomas E. Dickey * * All Rights Reserved * @@ -57,27 +57,33 @@ extern void xtermUpdateFontInfo (XtermWidget /* xw */, Bool /* doresize */); extern char *xtermSpecialFont (TScreen */* screen */, unsigned /* atts */, unsigned /* chrset */); #endif -#if OPT_BOX_CHARS - #define FontIsIncomplete(font) \ ((font)->fs != 0 \ && (font)->fs->per_char != 0 \ && !(font)->fs->all_chars_exist) +#if OPT_BOX_CHARS + #define ForceBoxChars(screen,ch) \ (xtermIsDecGraphic(ch) \ && (screen)->force_box_chars) + /* + * Keep track of (some) characters to make the check for missing + * characters faster. If the character is known to be missing, + * the cache value is '2'. If we have checked the character, the + * cached value is '1'. + */ #if OPT_WIDE_CHARS -#define CharKnownMissing(font, ch) \ - (((ch) < 256) && ((font)->known_missing[(Char)(ch)] > 1)) +#define CheckedKnownMissing(font, ch) \ + (((ch) < KNOWN_MISSING) && ((font)->known_missing[(Char)(ch)] > 0)) #else -#define CharKnownMissing(font, ch) \ - ((font)->known_missing[(Char)(ch)] > 1) +#define CheckedKnownMissing(font, ch) \ + ((font)->known_missing[(Char)(ch)] > 0) #endif #define IsXtermMissingChar(screen, ch, font) \ - (CharKnownMissing(font, ch) \ + (CheckedKnownMissing(font, ch) \ ? ((font)->known_missing[(Char)(ch)] > 1) \ : ((FontIsIncomplete(font) && xtermMissingChar(ch, font)) \ || ForceBoxChars(screen, ch))) diff --git a/app/xterm/graphics.c b/app/xterm/graphics.c index 9bdc50c02..28719d09f 100644 --- a/app/xterm/graphics.c +++ b/app/xterm/graphics.c @@ -1,4 +1,4 @@ -/* $XTermId: graphics.c,v 1.12 2013/07/10 22:35:28 Ross.Combs Exp $ */ +/* $XTermId: graphics.c,v 1.17 2013/11/26 22:15:21 tom Exp $ */ /* * Copyright 2013 by Ross Combs @@ -250,15 +250,15 @@ set_sixel(SixelGraphic *graphic, int sixel) static void set_sixel_color_register(ColorRegister *color_registers, - RegisterNum color, - short r, - short g, - short b) + int color, + int r, + int g, + int b) { ColorRegister *reg = &color_registers[color]; - reg->r = r; - reg->g = g; - reg->b = b; + reg->r = (short) r; + reg->g = (short) g; + reg->b = (short) b; reg->allocated = 0; } @@ -270,7 +270,7 @@ init_color_registers(ColorRegister *color_registers, int terminal_id) unsigned int i; for (i = 0U; i < MAX_COLOR_REGISTERS; i++) { - set_sixel_color_register(color_registers, (RegisterNum) i, 0, 0, 0); + set_sixel_color_register(color_registers, (int) i, 0, 0, 0); } } @@ -550,12 +550,12 @@ dump_sixel(SixelGraphic const *graphic) } static void -set_shared_color_register(RegisterNum color, short r, short g, short b) +set_shared_color_register(int color, int r, int g, int b) { SixelGraphic *graphic; unsigned int ii; - assert(color < MAX_COLOR_REGISTERS); + assert(color < (int) MAX_COLOR_REGISTERS); set_sixel_color_register(shared_color_registers, color, r, g, b); @@ -1112,10 +1112,10 @@ parse_sixel(XtermWidget xw, ANSI *params, char const *string) } if (graphic->private_colors) { set_sixel_color_register(graphic->private_color_registers, - (RegisterNum) Pregister, + Pregister, r, g, b); } else { - set_shared_color_register((RegisterNum) Pregister, r, g, b); + set_shared_color_register(Pregister, r, g, b); } graphic->color_registers_used[Pregister] = 1; } else if (color_params.a_nparam == 1) { @@ -1300,7 +1300,7 @@ refresh_displayed_graphics(TScreen const *screen, ordered_graphics[ii] = &sixel_graphics[ii]; } qsort(ordered_graphics, - MAX_SIXEL_GRAPHICS, + (size_t) MAX_SIXEL_GRAPHICS, sizeof(ordered_graphics[0]), compare_sixel_ids); @@ -1314,17 +1314,17 @@ refresh_displayed_graphics(TScreen const *screen, w = ncols * FontWidth(screen); h = nrows * FontHeight(screen); - xbase = (screen->border + xbase = (OriginX(screen) + graphic->charcol * FontWidth(screen)); - ybase = (screen->border + ybase = (OriginY(screen) + (graphic->charrow - screen->topline) * FontHeight(screen)); - if (xbase + x + w + screen->border > FullWidth(screen)) - w = FullWidth(screen) - (xbase + x + screen->border); - if (ybase + y + h + screen->border > FullHeight(screen)) - h = FullHeight(screen) - (ybase + y + screen->border); - else if (ybase + y < screen->border) { - int diff = screen->border - (ybase + y); + if (xbase + x + w + OriginX(screen) > FullWidth(screen)) + w = FullWidth(screen) - (xbase + x + OriginX(screen)); + if (ybase + y + h + OriginY(screen) > FullHeight(screen)) + h = FullHeight(screen) - (ybase + y + OriginY(screen)); + else if (ybase + y < OriginY(screen)) { + int diff = OriginY(screen) - (ybase + y); y += diff; h -= diff; } @@ -1368,17 +1368,17 @@ refresh_modified_displayed_graphics(TScreen const *screen) w = ncols * FontWidth(screen); h = nrows * FontHeight(screen); - xbase = (screen->border + xbase = (OriginX(screen) + graphic->charcol * FontWidth(screen)); - ybase = (screen->border + ybase = (OriginY(screen) + (graphic->charrow - screen->topline) * FontHeight(screen)); - if (xbase + x + w + screen->border > FullWidth(screen)) - w = FullWidth(screen) - (xbase + x + screen->border); - if (ybase + y + h + screen->border > FullHeight(screen)) - h = FullHeight(screen) - (ybase + y + screen->border); - else if (ybase + y < screen->border) { - int diff = screen->border - (ybase + y); + if (xbase + x + w + OriginX(screen) > FullWidth(screen)) + w = FullWidth(screen) - (xbase + x + OriginX(screen)); + if (ybase + y + h + OriginY(screen) > FullHeight(screen)) + h = FullHeight(screen) - (ybase + y + OriginY(screen)); + else if (ybase + y < OriginY(screen)) { + int diff = OriginY(screen) - (ybase + y); y += diff; h -= diff; } diff --git a/app/xterm/input.c b/app/xterm/input.c index e506a9b6e..fdaae9ee1 100644 --- a/app/xterm/input.c +++ b/app/xterm/input.c @@ -1,7 +1,7 @@ -/* $XTermId: input.c,v 1.345 2013/02/06 09:51:33 tom Exp $ */ +/* $XTermId: input.c,v 1.348 2013/11/26 00:12:10 tom Exp $ */ /* - * Copyright 1999-2011,2012 by Thomas E. Dickey + * Copyright 1999-2012,2013 by Thomas E. Dickey * * All Rights Reserved * @@ -321,8 +321,6 @@ static Bool allowModifierParm(XtermWidget xw, KEY_DATA * kd) { TKeyboard *keyboard = &(xw->keyboard); - TScreen *screen = TScreenOf(xw); - int keypad_mode = ((keyboard->flags & MODE_DECKPAM) != 0); int is_legacy = (keyboard->type == keyboardIsLegacy); Bool result = False; @@ -331,17 +329,14 @@ allowModifierParm(XtermWidget xw, KEY_DATA * kd) is_legacy = True; #endif - (void) screen; #if OPT_VT52_MODE - if (screen->vtXX_level != 0) + if (TScreenOf(xw)->vtXX_level != 0) #endif { if (IsCursorKey(kd->keysym) || IsEditFunctionKey(xw, kd->keysym)) { result = LegacyAllows(2); } else if (IsKeypadKey(kd->keysym)) { - if (keypad_mode) { - result = LegacyAllows(1); - } + result = LegacyAllows(1); } else if (IsFunctionKey(kd->keysym)) { result = LegacyAllows(4); } else if (IsMiscFunctionKey(kd->keysym)) { @@ -664,7 +659,7 @@ ModifyOtherKeys(XtermWidget xw, * for more information. */ static Bool -modifyOtherKey(ANSI * reply, int input_char, unsigned modify_parm, int format_keys) +modifyOtherKey(ANSI *reply, int input_char, unsigned modify_parm, int format_keys) { Bool result = False; @@ -687,7 +682,7 @@ modifyOtherKey(ANSI * reply, int input_char, unsigned modify_parm, int format_ke } static void -modifyCursorKey(ANSI * reply, int modify, unsigned *modify_parm) +modifyCursorKey(ANSI *reply, int modify, unsigned *modify_parm) { if (*modify_parm != 0) { if (modify < 0) { @@ -1347,7 +1342,8 @@ Input(XtermWidget xw, { /* VT220 & up: National Replacement Characters */ if ((xw->flags & NATIONAL) != 0) { - unsigned cmp = xtermCharSetIn(CharOf(kd.strbuf[0]), + unsigned cmp = xtermCharSetIn(screen, + CharOf(kd.strbuf[0]), screen->keyboard_dialect[0]); TRACE(("...input NRC %d, %s %d\n", CharOf(kd.strbuf[0]), @@ -1381,7 +1377,7 @@ Input(XtermWidget xw, } void -StringInput(XtermWidget xw, const Char * string, size_t nbytes) +StringInput(XtermWidget xw, const Char *string, size_t nbytes) { TRACE(("InputString (%s,%lu)\n", visibleChars(string, (unsigned) nbytes), @@ -1464,7 +1460,7 @@ decfuncvalue(KEY_DATA * kd) } static void -hpfuncvalue(ANSI * reply, KEY_DATA * kd) +hpfuncvalue(ANSI *reply, KEY_DATA * kd) { #if OPT_HP_FUNC_KEYS int result; @@ -1521,7 +1517,7 @@ hpfuncvalue(ANSI * reply, KEY_DATA * kd) } static void -scofuncvalue(ANSI * reply, KEY_DATA * kd) +scofuncvalue(ANSI *reply, KEY_DATA * kd) { #if OPT_SCO_FUNC_KEYS int result; @@ -1611,7 +1607,7 @@ scofuncvalue(ANSI * reply, KEY_DATA * kd) } static void -sunfuncvalue(ANSI * reply, KEY_DATA * kd) +sunfuncvalue(ANSI *reply, KEY_DATA * kd) { #if OPT_SUN_FUNC_KEYS ParmType result; @@ -1746,7 +1742,7 @@ keyCanInsert(const char *parse) } else if (ch == '\\') { escape = True; } else if (ch == '"') { - quoted = (Boolean) ! quoted; + quoted = (Boolean) !quoted; } else if (!quoted && isName(ch)) { const char *next = skipName(--parse); size_t need = (size_t) (next - parse); diff --git a/app/xterm/main.c b/app/xterm/main.c index adc3759ec..8124d5b76 100644 --- a/app/xterm/main.c +++ b/app/xterm/main.c @@ -1,4 +1,4 @@ -/* $XTermId: main.c,v 1.727 2013/05/27 22:11:11 tom Exp $ */ +/* $XTermId: main.c,v 1.735 2013/11/27 00:41:23 tom Exp $ */ /* * Copyright 2002-2012,2013 by Thomas E. Dickey @@ -456,7 +456,7 @@ static int pty_search(int * /* pty */ ); static int get_pty(int *pty, char *from); static void resize_termcap(XtermWidget xw); -static void set_owner(char *device, uid_t uid, gid_t gid, mode_t mode); +static void set_owner(char *device, unsigned uid, unsigned gid, unsigned mode); static Bool added_utmp_entry = False; @@ -883,6 +883,9 @@ static XtResource application_resources[] = Bres("ptyHandshake", "PtyHandshake", ptyHandshake, True), Bres("ptySttySize", "PtySttySize", ptySttySize, DEF_PTY_STTY_SIZE), #endif +#if OPT_REPORT_FONTS + Bres("reportFonts", "ReportFonts", reportFonts, False), +#endif #if OPT_SAME_NAME Bres("sameName", "SameName", sameName, True), #endif @@ -1017,6 +1020,9 @@ static XrmOptionDescRec optionDescList[] = { {"+s", "*multiScroll", XrmoptionNoArg, (XPointer) "off"}, {"-sb", "*scrollBar", XrmoptionNoArg, (XPointer) "on"}, {"+sb", "*scrollBar", XrmoptionNoArg, (XPointer) "off"}, +#if OPT_REPORT_FONTS +{"-report-fonts","*reportFonts", XrmoptionNoArg, (XPointer) "on"}, +#endif #ifdef SCROLLBAR_RIGHT {"-leftbar", "*rightScrollBar", XrmoptionNoArg, (XPointer) "off"}, {"-rightbar", "*rightScrollBar", XrmoptionNoArg, (XPointer) "on"}, @@ -1203,6 +1209,9 @@ static OptionHelp xtermOptions[] = { { "-/+rw", "turn on/off reverse wraparound" }, { "-/+s", "turn on/off multiscroll" }, { "-/+sb", "turn on/off scrollbar" }, +#if OPT_REPORT_FONTS +{ "-report-fonts", "report fonts as loaded to stdout" }, +#endif #ifdef SCROLLBAR_RIGHT { "-rightbar", "force scrollbar right (default left)" }, { "-leftbar", "force scrollbar left" }, @@ -1466,7 +1475,7 @@ parseArg(int *num, char **argv, char **valuep) TRACE(("parseArg %s\n", option)); if ((value = argv[(*num) + 1]) != 0) { - have_value = (Boolean) ! isOption(value); + have_value = (Boolean) !isOption(value); } for (inlist = 0; inlist < limit; ++inlist) { XrmOptionDescRec *check = ITEM(inlist); @@ -1503,6 +1512,10 @@ parseArg(int *num, char **argv, char **valuep) if (test > 0 && ITEM(inlist)->argKind >= XrmoptionSkipArg) { atbest = (int) inlist; + if (ITEM(inlist)->argKind == XrmoptionSkipNArgs) { + /* in particular, silence a warning about ambiguity */ + exact = 1; + } break; } if (test > best) { @@ -1632,7 +1645,7 @@ ConvertConsoleSelection(Widget w GCC_UNUSED, static void DeleteWindow(Widget w, XEvent * event GCC_UNUSED, - String * params GCC_UNUSED, + String *params GCC_UNUSED, Cardinal *num_params GCC_UNUSED) { #if OPT_TEK4014 @@ -1652,7 +1665,7 @@ DeleteWindow(Widget w, static void KeyboardMapping(Widget w GCC_UNUSED, XEvent * event, - String * params GCC_UNUSED, + String *params GCC_UNUSED, Cardinal *num_params GCC_UNUSED) { switch (event->type) { @@ -1941,7 +1954,7 @@ main(int argc, char *argv[]ENVP_ARG) Dimension menu_high; TScreen *screen; int mode; - char *my_class = DEFCLASS; + char *my_class = x_strdup(DEFCLASS); Window winToEmbedInto = None; ProgramName = argv[0]; @@ -2024,6 +2037,7 @@ main(int argc, char *argv[]ENVP_ARG) Help(); quit = True; } else if (!strcmp(option_ptr->option, "-class")) { + free(my_class); if ((my_class = x_strdup(option_value)) == 0) { Help(); quit = True; @@ -2177,6 +2191,7 @@ main(int argc, char *argv[]ENVP_ARG) setEffectiveUser(save_ruid); TRACE_IDS; #endif + init_colored_cursor(); toplevel = xtermOpenApplication(&app_con, my_class, @@ -2722,7 +2737,7 @@ get_pty(int *pty, char *from GCC_UNUSED) } static void -set_pty_permissions(uid_t uid, gid_t gid, mode_t mode) +set_pty_permissions(uid_t uid, unsigned gid, unsigned mode) { #ifdef USE_TTY_GROUP struct group *ttygrp; @@ -3043,7 +3058,7 @@ HsSysError(int error) #ifndef VMS static void -set_owner(char *device, uid_t uid, gid_t gid, mode_t mode) +set_owner(char *device, unsigned uid, unsigned gid, unsigned mode) { int why; @@ -3681,8 +3696,7 @@ spawnXTerm(XtermWidget xw) /* we don't need the socket, or the pty master anymore */ close(ConnectionNumber(screen->display)); #ifndef __MVS__ - if (screen->respond >= 0) - close(screen->respond); + close(screen->respond); #endif /* __MVS__ */ /* Now is the time to set up our process group and @@ -4064,6 +4078,11 @@ spawnXTerm(XtermWidget xw) * GTK applications. */ xtermUnsetenv("DESKTOP_STARTUP_ID"); + /* + * We set this temporarily to work around poor design of Xcursor. + * Unset it here to avoid confusion. + */ + xtermUnsetenv("XCURSOR_PATH"); xtermSetenv("TERM", resource.term_name); if (!resource.term_name) @@ -4874,6 +4893,8 @@ Exit(int n) #endif /* USE_SYSV_UTMP */ #endif /* HAVE_UTMP */ + cleanup_colored_cursor(); + /* * Flush pending data before releasing ownership, so nobody else can write * in the middle of the data. diff --git a/app/xterm/minstall.in b/app/xterm/minstall.in index bc9e0323e..86a40bcaf 100644 --- a/app/xterm/minstall.in +++ b/app/xterm/minstall.in @@ -1,9 +1,9 @@ #!/bin/sh -# $XTermId: minstall.in,v 1.19 2013/04/21 18:58:54 Andres.Perera Exp $ +# $XTermId: minstall.in,v 1.20 2013/04/21 18:58:54 tom Exp $ # ----------------------------------------------------------------------------- # this file is part of xterm # -# Copyright 2001-2011,2012 by Thomas E. Dickey +# Copyright 2001-2012,2013 by Thomas E. Dickey # # All Rights Reserved # diff --git a/app/xterm/misc.c b/app/xterm/misc.c index 571818bfb..baea82211 100644 --- a/app/xterm/misc.c +++ b/app/xterm/misc.c @@ -1,4 +1,4 @@ -/* $XTermId: misc.c,v 1.670 2013/06/23 22:11:54 tom Exp $ */ +/* $XTermId: misc.c,v 1.682 2013/12/03 23:24:48 tom Exp $ */ /* * Copyright 1999-2012,2013 by Thomas E. Dickey @@ -692,6 +692,82 @@ make_hidden_cursor(XtermWidget xw) return (c); } +/* + * Xlib uses Xcursor to customize cursor coloring, which interferes with + * xterm's pointerColor resource. Work around this by providing our own + * default theme. Testing seems to show that we only have to provide this + * until the window is initialized. + */ +void +init_colored_cursor(void) +{ +#ifdef HAVE_LIB_XCURSOR + const char *theme = "index.theme"; + const char *pattern = "xtermXXXXXXXX"; + const char *tmp_dir; + char *filename; + size_t needed; + FILE *fp; + + xterm_cursor_theme = 0; + if ((tmp_dir = getenv("TMPDIR")) == 0) + tmp_dir = P_tmpdir; + needed = strlen(tmp_dir) + 4 + strlen(theme) + strlen(pattern); + if ((filename = malloc(needed)) != 0) { + sprintf(filename, "%s/%s", tmp_dir, pattern); + +#ifdef HAVE_MKDTEMP + xterm_cursor_theme = mkdtemp(filename); +#else + if (mktemp(filename) != 0 + && mkdir(filename, 0700) == 0) { + xterm_cursor_theme = filename; + } +#endif + /* + * Actually, Xcursor does what _we_ want just by steering its search + * path away from home. We are setting up the complete theme just in + * case the library ever acquires a maintainer. + */ + if (xterm_cursor_theme != 0) { + char *leaf = xterm_cursor_theme + strlen(xterm_cursor_theme); + strcat(leaf, "/"); + strcat(leaf, theme); + if ((fp = fopen(xterm_cursor_theme, "w")) != 0) { + fprintf(fp, "[Icon Theme]\n"); + fclose(fp); + *leaf = '\0'; + xtermSetenv("XCURSOR_PATH", xterm_cursor_theme); + *leaf = '/'; + } + atexit(cleanup_colored_cursor); + } + } +#endif /* HAVE_LIB_XCURSOR */ +} + +/* + * Once done, discard the file and directory holding it. + */ +void +cleanup_colored_cursor(void) +{ +#ifdef HAVE_LIB_XCURSOR + if (xterm_cursor_theme != 0) { + char *my_path = getenv("XCURSOR_PATH"); + struct stat sb; + if (!IsEmpty(my_path) + && stat(my_path, &sb) == 0 + && (sb.st_mode & S_IFMT) == S_IFDIR) { + unlink(xterm_cursor_theme); + rmdir(my_path); + free(xterm_cursor_theme); + xterm_cursor_theme = 0; + } + } +#endif /* HAVE_LIB_XCURSOR */ +} + Cursor make_colored_cursor(unsigned cursorindex, /* index into font */ unsigned long fg, /* pixel value */ @@ -712,7 +788,7 @@ make_colored_cursor(unsigned cursorindex, /* index into font */ void HandleKeyPressed(Widget w GCC_UNUSED, XEvent * event, - String * params GCC_UNUSED, + String *params GCC_UNUSED, Cardinal *nparams GCC_UNUSED) { TRACE(("Handle insert-seven-bit for %p\n", (void *) w)); @@ -723,7 +799,7 @@ HandleKeyPressed(Widget w GCC_UNUSED, void HandleEightBitKeyPressed(Widget w GCC_UNUSED, XEvent * event, - String * params GCC_UNUSED, + String *params GCC_UNUSED, Cardinal *nparams GCC_UNUSED) { TRACE(("Handle insert-eight-bit for %p\n", (void *) w)); @@ -734,7 +810,7 @@ HandleEightBitKeyPressed(Widget w GCC_UNUSED, void HandleStringEvent(Widget w GCC_UNUSED, XEvent * event GCC_UNUSED, - String * params, + String *params, Cardinal *nparams) { @@ -753,7 +829,7 @@ HandleStringEvent(Widget w GCC_UNUSED, value *= 16; if (c >= '0' && c <= '9') value += (unsigned) (c - '0'); - else if ((xxxxxx = strchr(abcdef, c)) != 0) + else if ((xxxxxx = (strchr) (abcdef, c)) != 0) value += (unsigned) (xxxxxx - abcdef) + 10; else break; @@ -779,7 +855,7 @@ HandleStringEvent(Widget w GCC_UNUSED, void HandleSpawnTerminal(Widget w GCC_UNUSED, XEvent * event GCC_UNUSED, - String * params, + String *params, Cardinal *nparams) { TScreen *screen = TScreenOf(term); @@ -873,7 +949,7 @@ HandleSpawnTerminal(Widget w GCC_UNUSED, void HandleInterpret(Widget w GCC_UNUSED, XEvent * event GCC_UNUSED, - String * params, + String *params, Cardinal *param_count) { if (*param_count == 1) { @@ -897,7 +973,7 @@ void HandleEnterWindow(Widget w GCC_UNUSED, XtPointer eventdata GCC_UNUSED, XEvent * event GCC_UNUSED, - Boolean * cont GCC_UNUSED) + Boolean *cont GCC_UNUSED) { /* NOP since we handled it above */ TRACE(("HandleEnterWindow ignored\n")); @@ -909,7 +985,7 @@ void HandleLeaveWindow(Widget w GCC_UNUSED, XtPointer eventdata GCC_UNUSED, XEvent * event GCC_UNUSED, - Boolean * cont GCC_UNUSED) + Boolean *cont GCC_UNUSED) { /* NOP since we handled it above */ TRACE(("HandleLeaveWindow ignored\n")); @@ -921,7 +997,7 @@ void HandleFocusChange(Widget w GCC_UNUSED, XtPointer eventdata GCC_UNUSED, XEvent * ev, - Boolean * cont GCC_UNUSED) + Boolean *cont GCC_UNUSED) { XFocusChangeEvent *event = (XFocusChangeEvent *) ev; XtermWidget xw = term; @@ -1121,7 +1197,7 @@ Bell(XtermWidget xw, int which, int percent) #define VB_DELAY screen->visualBellDelay static void -flashWindow(TScreen * screen, Window window, GC visualGC, unsigned width, unsigned height) +flashWindow(TScreen *screen, Window window, GC visualGC, unsigned width, unsigned height) { int y = 0; int x = 0; @@ -1172,7 +1248,7 @@ void HandleBellPropertyChange(Widget w GCC_UNUSED, XtPointer data GCC_UNUSED, XEvent * ev, - Boolean * more GCC_UNUSED) + Boolean *more GCC_UNUSED) { TScreen *screen = TScreenOf(term); @@ -1251,7 +1327,7 @@ WMFrameWindow(XtermWidget xw) #define MAXWLEN 1024 /* maximum word length as in tcsh */ static int -dabbrev_prev_char(TScreen * screen, CELL * cell, LineData ** ld) +dabbrev_prev_char(TScreen *screen, CELL *cell, LineData **ld) { int result = -1; int firstLine = -(screen->savedlines); @@ -1275,7 +1351,7 @@ dabbrev_prev_char(TScreen * screen, CELL * cell, LineData ** ld) } static char * -dabbrev_prev_word(TScreen * screen, CELL * cell, LineData ** ld) +dabbrev_prev_word(TScreen *screen, CELL *cell, LineData **ld) { static char ab[MAXWLEN]; @@ -1310,7 +1386,7 @@ dabbrev_prev_word(TScreen * screen, CELL * cell, LineData ** ld) } static int -dabbrev_expand(TScreen * screen) +dabbrev_expand(TScreen *screen) { int pty = screen->respond; /* file descriptor of pty */ @@ -1412,7 +1488,7 @@ dabbrev_expand(TScreen * screen) void HandleDabbrevExpand(Widget w, XEvent * event GCC_UNUSED, - String * params GCC_UNUSED, + String *params GCC_UNUSED, Cardinal *nparams GCC_UNUSED) { XtermWidget xw; @@ -1431,7 +1507,7 @@ HandleDabbrevExpand(Widget w, void HandleDeIconify(Widget w, XEvent * event GCC_UNUSED, - String * params GCC_UNUSED, + String *params GCC_UNUSED, Cardinal *nparams GCC_UNUSED) { XtermWidget xw; @@ -1446,7 +1522,7 @@ HandleDeIconify(Widget w, void HandleIconify(Widget w, XEvent * event GCC_UNUSED, - String * params GCC_UNUSED, + String *params GCC_UNUSED, Cardinal *nparams GCC_UNUSED) { XtermWidget xw; @@ -1613,7 +1689,7 @@ RequestMaximize(XtermWidget xw, int maximize) void HandleMaximize(Widget w, XEvent * event GCC_UNUSED, - String * params GCC_UNUSED, + String *params GCC_UNUSED, Cardinal *nparams GCC_UNUSED) { XtermWidget xw; @@ -1627,7 +1703,7 @@ HandleMaximize(Widget w, void HandleRestoreSize(Widget w, XEvent * event GCC_UNUSED, - String * params GCC_UNUSED, + String *params GCC_UNUSED, Cardinal *nparams GCC_UNUSED) { XtermWidget xw; @@ -1848,7 +1924,7 @@ creat_as(uid_t uid, gid_t gid, Bool append, char *pathname, unsigned mode) #endif /* !VMS */ int -xtermResetIds(TScreen * screen) +xtermResetIds(TScreen *screen) { int result = 0; if (setgid(screen->gid) == -1) { @@ -2096,7 +2172,7 @@ ReportAnsiColorRequest(XtermWidget xw, int colornum, int final) } static void -getColormapInfo(Display * display, unsigned *typep, unsigned *sizep) +getColormapInfo(Display *display, unsigned *typep, unsigned *sizep) { int numFound; XVisualInfo myTemplate, *visInfoPtr; @@ -2706,7 +2782,7 @@ xtermClosestColor(XtermWidget xw, int find_red, int find_green, int find_blue) #if OPT_PASTE64 static void -ManipulateSelectionData(XtermWidget xw, TScreen * screen, char *buf, int final) +ManipulateSelectionData(XtermWidget xw, TScreen *screen, char *buf, int final) { #define PDATA(a,b) { a, #b } static struct { @@ -2774,7 +2850,7 @@ ManipulateSelectionData(XtermWidget xw, TScreen * screen, char *buf, int final) /* terminator will be written in this call */ xtermGetSelection((Widget) xw, - (Time) 0, + XtLastTimestampProcessed(TScreenOf(xw)->display), select_args, n, NULL); } @@ -2800,7 +2876,7 @@ ManipulateSelectionData(XtermWidget xw, TScreen * screen, char *buf, int final) #define IsSetUtf8Title(xw) (IsTitleMode(xw, tmSetUtf8) || (xw->screen.utf8_title)) static Bool -xtermIsPrintable(XtermWidget xw, Char ** bufp, Char * last) +xtermIsPrintable(XtermWidget xw, Char **bufp, Char *last) { TScreen *screen = TScreenOf(xw); Bool result = False; @@ -3125,7 +3201,7 @@ ResetColorsRequest(XtermWidget xw, * the corresponding menu font entry. */ static int -ParseShiftedFont(XtermWidget xw, String source, String * target) +ParseShiftedFont(XtermWidget xw, String source, String *target) { TScreen *screen = TScreenOf(xw); int num = screen->menu_font_number; @@ -3290,7 +3366,7 @@ ChangeFontRequest(XtermWidget xw, String buf) /***====================================================================***/ void -do_osc(XtermWidget xw, Char * oscbuf, size_t len, int final) +do_osc(XtermWidget xw, Char *oscbuf, size_t len, int final) { TScreen *screen = TScreenOf(xw); int mode; @@ -3638,7 +3714,7 @@ parse_decudk(const char *cp) * interspersing with control characters, but have the string already. */ static void -parse_ansi_params(ANSI * params, const char **string) +parse_ansi_params(ANSI *params, const char **string) { const char *cp = *string; ParmType nparam = 0; @@ -3681,7 +3757,7 @@ parse_ansi_params(ANSI * params, const char **string) #define SOFT_HIGH 20 static void -parse_decdld(ANSI * params, const char *string) +parse_decdld(ANSI *params, const char *string) { char DscsName[8]; int len; @@ -3791,7 +3867,7 @@ parse_decdld(ANSI * params, const char *string) #endif void -do_dcs(XtermWidget xw, Char * dcsbuf, size_t dcslen) +do_dcs(XtermWidget xw, Char *dcsbuf, size_t dcslen) { TScreen *screen = TScreenOf(xw); char reply[BUFSIZ]; @@ -5231,7 +5307,7 @@ xtermUnsetenv(const char *var) /*ARGSUSED*/ int -xerror(Display * d, XErrorEvent * ev) +xerror(Display *d, XErrorEvent * ev) { xtermWarning("warning, error event received:\n"); (void) XmuPrintDefaultErrorMessage(d, ev, stderr); @@ -5252,7 +5328,7 @@ ice_error(IceConn iceConn) /*ARGSUSED*/ int -xioerror(Display * dpy) +xioerror(Display *dpy) { int the_error = errno; @@ -5292,7 +5368,7 @@ XStrCmp(char *s1, char *s2) #if OPT_TEK4014 static void -withdraw_window(Display * dpy, Window w, int scr) +withdraw_window(Display *dpy, Window w, int scr) { TRACE(("withdraw_window %#lx\n", (long) w)); (void) XmuUpdateMapHints(dpy, w, NULL); @@ -5649,7 +5725,18 @@ xtermEnvUTF8(void) #ifdef HAVE_LANGINFO_CODESET result = (strcmp(xtermEnvEncoding(), "UTF-8") == 0); #else - result = (strstr(xtermEnvLocale(), "UTF-8") != NULL); + { + char *locale = x_strdup(xtermEnvLocale()); + int n; + for (n = 0; locale[n] != 0; ++n) { + locale[n] = x_toupper(locale[n]); + } + if (strstr(locale, "UTF-8") != 0) + result = True; + else if (strstr(locale, "UTF8") != 0) + result = True; + free(locale); + } #endif TRACE(("xtermEnvUTF8 ->%s\n", BtoS(result))); } @@ -5736,8 +5823,8 @@ xtermOpenApplication(XtAppContext * app_context_return, XrmOptionDescRec * options, Cardinal num_options, int *argc_in_out, - String * argv_in_out, - String * fallback_resources, + String *argv_in_out, + String *fallback_resources, WidgetClass widget_class, ArgList args, Cardinal num_args) @@ -5775,7 +5862,7 @@ xtermOpenApplication(XtAppContext * app_context_return, static int x11_errors; static int -catch_x11_error(Display * display, XErrorEvent * error_event) +catch_x11_error(Display *display, XErrorEvent * error_event) { (void) display; (void) error_event; @@ -5784,7 +5871,7 @@ catch_x11_error(Display * display, XErrorEvent * error_event) } Boolean -xtermGetWinAttrs(Display * dpy, Window win, XWindowAttributes * attrs) +xtermGetWinAttrs(Display *dpy, Window win, XWindowAttributes * attrs) { Boolean result = False; Status code; @@ -5806,7 +5893,7 @@ xtermGetWinAttrs(Display * dpy, Window win, XWindowAttributes * attrs) } Boolean -xtermGetWinProp(Display * display, +xtermGetWinProp(Display *display, Window win, Atom property, long long_offset, diff --git a/app/xterm/package/debian/changelog b/app/xterm/package/debian/changelog index 5fda61a07..828b54c18 100644 --- a/app/xterm/package/debian/changelog +++ b/app/xterm/package/debian/changelog @@ -1,3 +1,27 @@ +xterm-dev (300) unstable; urgency=high + + * fix a regression from #298 changes + + -- Thomas E. Dickey Tue, 03 Dec 2013 18:59:58 -0500 + +xterm-dev (299) unstable; urgency=low + + * fix remaining regression from #297 changes + + -- Thomas E. Dickey Sun, 01 Dec 2013 11:48:42 -0500 + +xterm-dev (298) unstable; urgency=low + + * miscellaneous fixes + + -- Thomas E. Dickey Wed, 11 Sep 2013 17:16:37 -0400 + +xterm-dev (297) unstable; urgency=low + + * miscellaneous fixes for old issues + + -- Thomas E. Dickey Sun, 04 Aug 2013 08:58:31 -0400 + xterm-dev (296) unstable; urgency=low * Build-fix for #295 changes diff --git a/app/xterm/package/debian/copyright b/app/xterm/package/debian/copyright index 8a1304af4..674ea0b52 100644 --- a/app/xterm/package/debian/copyright +++ b/app/xterm/package/debian/copyright @@ -35,7 +35,7 @@ authorization. Files: * */* License: MIT-X11 -Copyright 1996-2011 by Thomas E. Dickey +Copyright 1996-2012,2013 by Thomas E. Dickey (date ranges vary, depending on when the respective files were first changed significantly, and run through the most recent change date). diff --git a/app/xterm/package/freebsd/Makefile b/app/xterm/package/freebsd/Makefile index 91d647bfa..9d0bcb34e 100644 --- a/app/xterm/package/freebsd/Makefile +++ b/app/xterm/package/freebsd/Makefile @@ -5,7 +5,7 @@ # and "make makesum". PORTNAME= xterm -PORTVERSION= 296 +PORTVERSION= 300 CATEGORIES= x11 MASTER_SITES= ftp://invisible-island.net/xterm/ \ CRITICAL diff --git a/app/xterm/package/xterm.spec b/app/xterm/package/xterm.spec index 22ed3b778..092668a64 100644 --- a/app/xterm/package/xterm.spec +++ b/app/xterm/package/xterm.spec @@ -1,11 +1,11 @@ -# $XTermId: xterm.spec,v 1.54 2013/07/10 01:19:30 tom Exp $ +# $XTermId: xterm.spec,v 1.58 2013/12/03 23:59:13 tom Exp $ Summary: X terminal emulator (development version) %global my_middle xterm %global my_suffix -dev %global fullname %{my_middle}%{my_suffix} %global my_class XTermDev Name: %{fullname} -Version: 296 +Version: 300 Release: 1 License: X11 Group: User Interface/X diff --git a/app/xterm/ptyx.h b/app/xterm/ptyx.h index 2a6e4e7f1..99ea119b0 100644 --- a/app/xterm/ptyx.h +++ b/app/xterm/ptyx.h @@ -1,4 +1,4 @@ -/* $XTermId: ptyx.h,v 1.776 2013/06/23 22:00:58 tom Exp $ */ +/* $XTermId: ptyx.h,v 1.789 2013/11/23 17:04:26 tom Exp $ */ /* * Copyright 1999-2012,2013 by Thomas E. Dickey @@ -316,7 +316,7 @@ typedef Char *UString; #define IsEmpty(s) ((s) == 0 || *(s) == '\0') -#define CharOf(n) ((unsigned char)(n)) +#define CharOf(n) ((Char)(n)) typedef struct { int row; @@ -657,6 +657,10 @@ typedef struct { #endif #endif +#ifndef OPT_REPORT_FONTS +#define OPT_REPORT_FONTS 1 /* provide "-report-fonts" option */ +#endif + #ifndef OPT_SAME_NAME #define OPT_SAME_NAME 1 /* suppress redundant updates of title, icon, etc. */ #endif @@ -897,6 +901,54 @@ typedef enum { #include +/* + * For readability... + */ +#define nrc_percent 100 +#define nrc_dquote 200 +#define nrc_ampersand 300 +typedef enum { + nrc_ASCII = 0 + ,nrc_British /* vt100 */ + ,nrc_British_Latin_1 /* vt3xx */ + ,nrc_Cyrillic /* vt5xx */ + ,nrc_DEC_Spec_Graphic /* vt100 */ + ,nrc_DEC_Alt_Chars /* vt100 */ + ,nrc_DEC_Alt_Graphics /* vt100 */ + ,nrc_DEC_Supp /* vt2xx */ + ,nrc_DEC_Supp_Graphic /* vt3xx */ + ,nrc_DEC_Technical /* vt3xx */ + ,nrc_Dutch /* vt2xx */ + ,nrc_Finnish /* vt2xx */ + ,nrc_Finnish2 /* vt2xx */ + ,nrc_French /* vt2xx */ + ,nrc_French2 /* vt2xx */ + ,nrc_French_Canadian /* vt2xx */ + ,nrc_French_Canadian2 /* vt3xx */ + ,nrc_German /* vt2xx */ + ,nrc_Greek /* vt5xx */ + ,nrc_Greek_Supp /* vt5xx */ + ,nrc_Hebrew /* vt5xx */ + ,nrc_Hebrew2 /* vt5xx */ + ,nrc_Hebrew_Supp /* vt5xx */ + ,nrc_Italian /* vt2xx */ + ,nrc_Latin_5_Supp /* vt5xx */ + ,nrc_Latin_Cyrillic /* vt5xx */ + ,nrc_Norwegian_Danish /* vt3xx */ + ,nrc_Norwegian_Danish2 /* vt2xx */ + ,nrc_Norwegian_Danish3 /* vt2xx */ + ,nrc_Portugese /* vt3xx */ + ,nrc_Russian /* vt5xx */ + ,nrc_SCS_NRCS /* vt5xx - probably Serbo/Croatian */ + ,nrc_Spanish /* vt2xx */ + ,nrc_Swedish /* vt2xx */ + ,nrc_Swedish2 /* vt2xx */ + ,nrc_Swiss /* vt2xx */ + ,nrc_Turkish /* vt5xx */ + ,nrc_Turkish2 /* vt5xx */ + ,nrc_Unknown +} DECNRCM_codes; + /* * Use this enumerated type to check consistency among dpmodes(), savemodes() * restoremodes() and do_decrpm(). @@ -1479,13 +1531,15 @@ typedef struct { Dimension max_width; /* maximum cell width */ } FontMap; +#define KNOWN_MISSING 256 + typedef struct { unsigned chrset; unsigned flags; XFontStruct * fs; char * fn; FontMap map; - Char known_missing[256]; + Char known_missing[KNOWN_MISSING]; } XTermFonts; #if OPT_RENDERFONT @@ -1652,7 +1706,7 @@ typedef struct { unsigned flags; /* VTxxx saves graphics rendition */ Char curgl; Char curgr; - Char gsets[4]; + int gsets[4]; #if OPT_ISO_COLORS int cur_foreground; /* current foreground color */ int cur_background; /* current background color */ @@ -1814,6 +1868,7 @@ typedef struct { Boolean normalized_c; /* true to precompose to Form C */ char * utf8_mode_s; /* use UTF-8 decode/encode */ char * utf8_fonts_s; /* use UTF-8 decode/encode */ + int utf8_nrc_mode; /* saved UTF-8 mode for DECNRCM */ int utf8_mode; /* use UTF-8 decode/encode: 0-2 */ int utf8_fonts; /* use UTF-8 decode/encode: 0-2 */ int max_combining; /* maximum # of combining chars */ @@ -1949,6 +2004,7 @@ typedef struct { #if OPT_BOX_CHARS Boolean force_box_chars;/* true if we assume no boxchars */ Boolean force_all_chars;/* true to outline missing chars */ + Boolean assume_all_chars;/* true to allow missing chars */ Boolean allow_packing; /* true to allow packed-fonts */ #endif Dimension fnt_wide; @@ -2076,7 +2132,7 @@ typedef struct { /* Improved VT100 emulation stuff. */ String keyboard_dialect; /* default keyboard dialect */ - Char gsets[4]; /* G0 through G3. */ + int gsets[4]; /* G0 through G3. */ Char curgl; /* Current GL setting. */ Char curgr; /* Current GR setting. */ Char curss; /* Current single shift. */ @@ -2118,7 +2174,7 @@ typedef struct { Char vt52_save_curgl; Char vt52_save_curgr; Char vt52_save_curss; - Char vt52_save_gsets[4]; + int vt52_save_gsets[4]; #endif /* Testing */ #if OPT_XMC_GLITCH diff --git a/app/xterm/screen.c b/app/xterm/screen.c index 6f9ac6064..dbc6c7181 100644 --- a/app/xterm/screen.c +++ b/app/xterm/screen.c @@ -1,4 +1,4 @@ -/* $XTermId: screen.c,v 1.485 2013/07/10 22:52:16 tom Exp $ */ +/* $XTermId: screen.c,v 1.487 2013/08/14 23:22:53 tom Exp $ */ /* * Copyright 1999-2012,2013 by Thomas E. Dickey @@ -974,7 +974,7 @@ ScrnClearLines(XtermWidget xw, ScrnBuf sb, int where, unsigned n, unsigned size) (sb == screen->saveBuf_index) ? "save" : "edit", where, n, size)); - assert(n != 0); + assert((int) n > 0); assert(size != 0); /* save n lines at where */ @@ -1118,7 +1118,7 @@ ScrnInsertLine(XtermWidget xw, ScrnBuf sb, int last, int where, unsigned n) assert(last >= (int) n); assert(last >= where); - assert(n != 0); + assert((int) n > 0); assert(size != 0); /* save n lines at bottom */ @@ -1163,7 +1163,7 @@ ScrnDeleteLine(XtermWidget xw, ScrnBuf sb, int last, int where, unsigned n) assert(where >= 0); assert(last >= where + (int) n - 1); - assert(n != 0); + assert((int) n > 0); assert(size != 0); /* move up lines */ @@ -1256,7 +1256,7 @@ ScrnInsertChar(XtermWidget xw, unsigned n) assert(screen->cur_col >= 0); assert(screen->cur_row >= 0); - assert(n > 0); + assert((int) n >= 0); assert(last >= (int) n); if_OPT_WIDE_CHARS(screen, { @@ -1318,7 +1318,7 @@ ScrnDeleteChar(XtermWidget xw, unsigned n) assert(screen->cur_col >= 0); assert(screen->cur_row >= 0); - assert(n > 0); + assert((int) n >= 0); assert(last > (int) n); if_OPT_WIDE_CHARS(screen, { diff --git a/app/xterm/trace.c b/app/xterm/trace.c index b447da890..423f7fbe3 100644 --- a/app/xterm/trace.c +++ b/app/xterm/trace.c @@ -1,4 +1,4 @@ -/* $XTermId: trace.c,v 1.146 2013/04/21 00:37:00 tom Exp $ */ +/* $XTermId: trace.c,v 1.153 2013/11/26 22:41:44 tom Exp $ */ /* * Copyright 1997-2012,2013 by Thomas E. Dickey @@ -104,6 +104,19 @@ Trace(const char *fmt,...) sprintf(name, "Trace-%s.out", trace_who); #endif trace_fp = fopen(name, "w"); + /* + * Try to put the trace-file in user's home-directory if the current + * directory is not writable. + */ + if (trace_fp == 0) { + char *home = getenv("HOME"); + if (home != 0) { + sprintf(name, "%.*s/Trace-%.8s.out", + (BUFSIZ - 21), home, + trace_who); + trace_fp = fopen(name, "w"); + } + } if (trace_fp != 0) { fprintf(trace_fp, "%s\n", xtermVersion()); TraceIds(NULL, 0); @@ -130,7 +143,6 @@ TraceClose(void) (void) fflush(stderr); (void) visibleChars(NULL, 0); (void) visibleIChars(NULL, 0); - (void) visibleIChar(NULL, 0); trace_fp = 0; } } @@ -184,7 +196,7 @@ formatAscii(char *dst, unsigned value) break; default: if (E2A(value) < 32 || (E2A(value) >= 127 && E2A(value) < 160)) - sprintf(dst, "\\%03o", value); + sprintf(dst, "\\%03o", value & 0xff); else sprintf(dst, "%c", CharOf(value)); break; @@ -194,7 +206,7 @@ formatAscii(char *dst, unsigned value) #if OPT_DEC_CHRSET const char * -visibleChrsetName(unsigned chrset) +visibleDblChrset(unsigned chrset) { const char *result = "?"; switch (chrset) { @@ -215,8 +227,58 @@ visibleChrsetName(unsigned chrset) } #endif +const char * +visibleScsCode(int chrset) +{ +#define MAP(to,from) case from: result = to; break + const char *result = ""; + switch ((DECNRCM_codes) chrset) { + MAP("B", nrc_ASCII); + MAP("A", nrc_British); + MAP("A", nrc_British_Latin_1); + MAP("&4", nrc_Cyrillic); + MAP("0", nrc_DEC_Spec_Graphic); + MAP("1", nrc_DEC_Alt_Chars); + MAP("2", nrc_DEC_Alt_Graphics); + MAP("<", nrc_DEC_Supp); + MAP("%5", nrc_DEC_Supp_Graphic); + MAP(">", nrc_DEC_Technical); + MAP("4", nrc_Dutch); + MAP("5", nrc_Finnish); + MAP("C", nrc_Finnish2); + MAP("R", nrc_French); + MAP("f", nrc_French2); + MAP("Q", nrc_French_Canadian); + MAP("9", nrc_French_Canadian2); + MAP("K", nrc_German); + MAP("\"?", nrc_Greek); + MAP("F", nrc_Greek_Supp); + MAP("\"4", nrc_Hebrew); + MAP("%=", nrc_Hebrew2); + MAP("H", nrc_Hebrew_Supp); + MAP("Y", nrc_Italian); + MAP("M", nrc_Latin_5_Supp); + MAP("L", nrc_Latin_Cyrillic); + MAP("`", nrc_Norwegian_Danish); + MAP("E", nrc_Norwegian_Danish2); + MAP("6", nrc_Norwegian_Danish3); + MAP("%6", nrc_Portugese); + MAP("&5", nrc_Russian); + MAP("%3", nrc_SCS_NRCS); + MAP("Z", nrc_Spanish); + MAP("7", nrc_Swedish); + MAP("H", nrc_Swedish2); + MAP("=", nrc_Swiss); + MAP("%0", nrc_Turkish); + MAP("%2", nrc_Turkish2); + MAP("", nrc_Unknown); + } +#undef MAP + return result; +} + char * -visibleChars(const Char * buf, unsigned len) +visibleChars(const Char *buf, unsigned len) { static char *result; static unsigned used; @@ -247,7 +309,7 @@ visibleChars(const Char * buf, unsigned len) } char * -visibleIChars(IChar * buf, unsigned len) +visibleIChars(IChar *buf, unsigned len) { static char *result; static unsigned used; @@ -283,38 +345,11 @@ visibleIChars(IChar * buf, unsigned len) } char * -visibleIChar(IChar * buf, unsigned len) +visibleUChar(unsigned chr) { - static char *result; - static unsigned used; - - if (buf != 0) { - unsigned limit = ((len + 1) * 8) + 1; - char *dst; - - if (limit > used) { - used = limit; - result = XtRealloc(result, used); - } - if (result != 0) { - dst = result; - while (len--) { - unsigned value = *buf++; -#if OPT_WIDE_CHARS - if (value > 255) - sprintf(dst, "\\u+%04X", value); - else -#endif - formatAscii(dst, value); - dst += strlen(dst); - } - } - } else if (result != 0) { - free(result); - result = 0; - used = 0; - } - return result; + IChar buf[1]; + buf[0] = chr; + return visibleIChars(buf, 1); } #define CASETYPE(name) case name: result = #name; break @@ -408,7 +443,7 @@ visibleNotifyDetail(int code) } const char * -visibleSelectionTarget(Display * d, Atom a) +visibleSelectionTarget(Display *d, Atom a) { const char *result = "?"; @@ -463,7 +498,7 @@ visibleXError(int code) #define isScrnFlag(flag) ((flag) == LINEWRAPPED) static char * -ScrnText(LineData * ld) +ScrnText(LineData *ld) { return visibleIChars(ld->charData, ld->lineSize); } @@ -477,7 +512,7 @@ ScrnText(LineData * ld) ScrnText(ld)) void -LineClrFlag(LineData * ld, int flag) +LineClrFlag(LineData *ld, int flag) { if (ld == 0) { SHOW_BAD_LINE(LineClrFlag, ld); @@ -490,7 +525,7 @@ LineClrFlag(LineData * ld, int flag) } void -LineSetFlag(LineData * ld, int flag) +LineSetFlag(LineData *ld, int flag) { if (ld == 0) { SHOW_BAD_LINE(LineSetFlag, ld); @@ -747,7 +782,7 @@ TraceWMSizeHints(XtermWidget xw) */ /* ARGSUSED */ static int -no_error(Display * dpy GCC_UNUSED, XErrorEvent * event GCC_UNUSED) +no_error(Display *dpy GCC_UNUSED, XErrorEvent * event GCC_UNUSED) { return 1; } @@ -806,8 +841,8 @@ XtGeometryResult TraceResizeRequest(const char *fn, int ln, Widget w, unsigned reqwide, unsigned reqhigh, - Dimension * gotwide, - Dimension * gothigh) + Dimension *gotwide, + Dimension *gothigh) { XtGeometryResult rc; @@ -882,6 +917,9 @@ TraceXtermResources(void) XRES_B(ptyHandshake); XRES_B(ptySttySize); #endif +#if OPT_REPORT_FONTS + XRES_B(reportFonts); +#endif #if OPT_SAME_NAME XRES_B(sameName); #endif diff --git a/app/xterm/trace.h b/app/xterm/trace.h index 4d058e62d..785b29191 100644 --- a/app/xterm/trace.h +++ b/app/xterm/trace.h @@ -1,7 +1,7 @@ -/* $XTermId: trace.h,v 1.68 2013/02/06 09:52:14 tom Exp $ */ +/* $XTermId: trace.h,v 1.72 2013/09/11 21:25:23 tom Exp $ */ /* - * Copyright 1997-2011,2012 by Thomas E. Dickey + * Copyright 1997-2012,2013 by Thomas E. Dickey * * All Rights Reserved * @@ -41,7 +41,7 @@ #if OPT_TRACE -extern void Trace ( const char *, ... ) GCC_PRINTFLIKE(1,2); +extern void Trace ( const char *, ... ) GCC_PRINTFLIKE(1,2); #undef TRACE #define TRACE(p) Trace p @@ -56,12 +56,13 @@ extern void TraceClose (void); #endif extern char * visibleChars (const Char * /* buf */, unsigned /* len */); -extern char * visibleIChar (IChar *, unsigned); extern char * visibleIChars (IChar * /* buf */, unsigned /* len */); -extern const char * visibleChrsetName(unsigned /* chrset */); +extern char * visibleUChar (unsigned); +extern const char * visibleDblChrset(unsigned /* chrset */); extern const char * visibleEventType (int); extern const char * visibleNotifyDetail(int /* code */); extern const char * visibleNotifyMode (int /* code */); +extern const char * visibleScsCode(int /* chrset */); extern const char * visibleSelectionTarget(Display * /* d */, Atom /* a */); extern const char * visibleXError (int /* code */); diff --git a/app/xterm/util.c b/app/xterm/util.c index b36db3730..e0ba50b78 100644 --- a/app/xterm/util.c +++ b/app/xterm/util.c @@ -1,4 +1,4 @@ -/* $XTermId: util.c,v 1.606 2013/07/10 22:52:14 tom Exp $ */ +/* $XTermId: util.c,v 1.619 2013/11/23 13:02:58 tom Exp $ */ /* * Copyright 1999-2012,2013 by Thomas E. Dickey @@ -1031,7 +1031,7 @@ WriteText(XtermWidget xw, IChar *str, Cardinal len) screen->topline, screen->cur_row, screen->cur_col, - len, visibleIChar(str, len))); + len, visibleIChars(str, len))); if (cells + (unsigned) screen->cur_col > (unsigned) MaxCols(screen)) { cells = (unsigned) (MaxCols(screen) - screen->cur_col); @@ -2618,6 +2618,7 @@ recolor_cursor(TScreen *screen, XQueryColors(dpy, DefaultColormap(dpy, DefaultScreen(dpy)), colordefs, 2); XRecolorCursor(dpy, cursor, colordefs, colordefs + 1); + cleanup_colored_cursor(); return; } @@ -2695,6 +2696,69 @@ getXftColor(XtermWidget xw, Pixel pixel) #else #define UseBoldFont(screen) 1 #endif + +#if OPT_RENDERWIDE +static XftFont * +getWideXftFont(XtermWidget xw, + unsigned flags) +{ + TScreen *screen = TScreenOf(xw); + int fontnum = screen->menu_font_number; + XftFont *wfont; + +#if OPT_ISO_COLORS + if ((flags & UNDERLINE) + && !screen->colorULMode + && screen->italicULMode + && XFT_FONT(renderWideItal[fontnum])) { + wfont = XFT_FONT(renderWideItal[fontnum]); + } else +#endif + if ((flags & BOLDATTR(screen)) + && UseBoldFont(screen) + && XFT_FONT(renderWideBold[fontnum])) { + wfont = XFT_FONT(renderWideBold[fontnum]); + } else { + wfont = XFT_FONT(renderWideNorm[fontnum]); + } + return wfont; +} +#endif /* OPT_RENDERWIDE */ + +static XftFont * +getNormXftFont(XtermWidget xw, + unsigned flags, + Bool *did_ul) +{ + TScreen *screen = TScreenOf(xw); + int fontnum = screen->menu_font_number; + XftFont *font; + +#if OPT_ISO_COLORS + if ((flags & UNDERLINE) + && !screen->colorULMode + && screen->italicULMode + && XFT_FONT(renderFontItal[fontnum])) { + font = XFT_FONT(renderFontItal[fontnum]); + *did_ul = True; + } else +#endif + if ((flags & BOLDATTR(screen)) + && UseBoldFont(screen) + && XFT_FONT(renderFontBold[fontnum])) { + font = XFT_FONT(renderFontBold[fontnum]); + } else { + font = XFT_FONT(renderFontNorm[fontnum]); + } + return font; +} + +#if OPT_RENDERWIDE +#define pickXftFont(width, nf, wf) ((width == 2 && wf != 0) ? wf : nf) +#else +#define pickXftFont(width, nf, wf) (nf) +#endif + /* * fontconfig/Xft combination prior to 2.2 has a problem with * CJK truetype 'double-width' (bi-width/monospace) fonts leading @@ -2722,31 +2786,14 @@ xtermXftDrawString(XtermWidget xw, if (len != 0) { #if OPT_RENDERWIDE XftCharSpec *sbuf; - XftFont *wfont; + XftFont *wfont = getWideXftFont(xw, flags); Cardinal src, dst; XftFont *lastFont = 0; XftFont *currFont = 0; Cardinal start = 0; int charWidth; - int fontnum = screen->menu_font_number; int fwidth = FontWidth(screen); -#if OPT_ISO_COLORS - if ((flags & UNDERLINE) - && !screen->colorULMode - && screen->italicULMode - && XFT_FONT(renderWideItal[fontnum])) { - wfont = XFT_FONT(renderWideItal[fontnum]); - } else -#endif - if ((flags & BOLDATTR(screen)) - && UseBoldFont(screen) - && XFT_FONT(renderWideBold[fontnum])) { - wfont = XFT_FONT(renderWideBold[fontnum]); - } else { - wfont = XFT_FONT(renderWideNorm[fontnum]); - } - BumpTypedBuffer(XftCharSpec, len); sbuf = BfBuf(XftCharSpec); @@ -2761,7 +2808,7 @@ xtermXftDrawString(XtermWidget xw, sbuf[dst].x = (short) (x + fwidth * ncells); sbuf[dst].y = (short) (y); - currFont = (charWidth == 2 && wfont != 0) ? wfont : font; + currFont = pickXftFont(charWidth, font, wfont); ncells += charWidth; if (lastFont != currFont) { @@ -2859,6 +2906,7 @@ AsciiEquivs(unsigned ch) * groff stomps on compatibility. Still, if enough people get used to it, * this might someday become a quasi-standard. */ +#if OPT_BOX_CHARS static int ucs_workaround(XtermWidget xw, unsigned ch, @@ -2899,7 +2947,8 @@ ucs_workaround(XtermWidget xw, } return fixed; } -#endif +#endif /* OPT_BOX_CHARS */ +#endif /* OPT_WIDE_CHARS */ /* * Use this when the characters will not fill the cell area properly. Fill the @@ -3139,6 +3188,7 @@ drawXtermText(XtermWidget xw, the X font, and the width of the default font) */ int font_width = ((flags & DOUBLEWFONT) ? 2 : 1) * screen->fnt_wide; Bool did_ul = False; + XTermFonts *curFont; #if OPT_WIDE_CHARS if (text == 0) @@ -3178,7 +3228,7 @@ drawXtermText(XtermWidget xw, rect.width = (unsigned short) ((int) len * font_width); rect.height = (unsigned short) (FontHeight(screen)); - TRACE(("drawing %s\n", visibleChrsetName((unsigned) chrset))); + TRACE(("drawing %s\n", visibleDblChrset((unsigned) chrset))); switch (chrset) { case CSET_DHL_TOP: rect.y = (short) -(fs->ascent / 2); @@ -3261,9 +3311,10 @@ drawXtermText(XtermWidget xw, Display *dpy = screen->display; XftFont *font; XGCValues values; - int fontnum = screen->menu_font_number; int ncells; - +#if OPT_RENDERWIDE + XftFont *wfont; +#endif if (!screen->renderDraw) { int scr; Drawable draw = VDrawable(screen); @@ -3274,22 +3325,10 @@ drawXtermText(XtermWidget xw, screen->renderDraw = XftDrawCreate(dpy, draw, visual, DefaultColormap(dpy, scr)); } -#if OPT_ISO_COLORS - if ((flags & UNDERLINE) - && !screen->colorULMode - && screen->italicULMode - && XFT_FONT(renderFontItal[fontnum])) { - font = XFT_FONT(renderFontItal[fontnum]); - did_ul = True; - } else + font = getNormXftFont(xw, flags, &did_ul); +#if OPT_RENDERWIDE + wfont = getWideXftFont(xw, flags); #endif - if ((flags & BOLDATTR(screen)) - && UseBoldFont(screen) - && XFT_FONT(renderFontBold[fontnum])) { - font = XFT_FONT(renderFontBold[fontnum]); - } else { - font = XFT_FONT(renderFontNorm[fontnum]); - } values.foreground = getCgsFore(xw, currentWin, gc); values.background = getCgsBack(xw, currentWin, gc); @@ -3319,8 +3358,11 @@ drawXtermText(XtermWidget xw, Boolean replace = False; Boolean missing = False; unsigned ch = (unsigned) text[last]; + int filler = 0; int nc; #if OPT_WIDE_CHARS + int needed = my_wcwidth((wchar_t) ch); + XftFont *currFont = pickXftFont(needed, font, wfont); if (xtermIsDecGraphic(ch)) { /* @@ -3331,7 +3373,7 @@ drawXtermText(XtermWidget xw, * position. Failing that, use our own box-characters. */ if (screen->force_box_chars - || xtermXftMissing(xw, font, dec2ucs(ch))) { + || xtermXftMissing(xw, currFont, dec2ucs(ch))) { missing = 1; } else { ch = dec2ucs(ch); @@ -3345,11 +3387,17 @@ drawXtermText(XtermWidget xw, */ if_OPT_WIDE_CHARS(screen, { unsigned part = ucs2dec(ch); - if (xtermIsDecGraphic(part) && - (screen->force_box_chars - || xtermXftMissing(xw, font, ch))) { + if (xtermIsDecGraphic(part)) { + if (screen->force_box_chars + || xtermXftMissing(xw, currFont, ch)) { + ch = part; + missing = True; + } + } else if (xtermXftMissing(xw, currFont, ch) + && (part = AsciiEquivs(ch)) != ch) { + filler = needed - 1; ch = part; - missing = True; + replace = True; } }); } @@ -3408,6 +3456,19 @@ drawXtermText(XtermWidget xw, 1); curX += nc * FontWidth(screen); underline_len += (Cardinal) nc; + if (filler) { + ch2 = ' '; + nc = drawClippedXftString(xw, + flags, + font, + getXftColor(xw, values.foreground), + curX, + y, + &ch2, + 1); + curX += nc * FontWidth(screen); + underline_len += (Cardinal) nc; + } } first = last + 1; } @@ -3452,6 +3513,9 @@ drawXtermText(XtermWidget xw, return x; } #endif /* OPT_RENDERFONT */ + curFont = ((flags & BOLDATTR(screen)) + ? WhichVFontData(screen, fnts[fBold]) + : WhichVFontData(screen, fnts[fNorm])); /* * If we're asked to display a proportional font, do this with a fixed * pitch. Yes, it's ugly. But we cannot distinguish the use of xterm @@ -3460,9 +3524,6 @@ drawXtermText(XtermWidget xw, */ if (!IsIcon(screen) && !(flags & CHARBYCHAR) && screen->fnt_prop) { int adj, width; - XTermFonts *font = ((flags & BOLDATTR(screen)) - ? WhichVFontData(screen, fnts[fBold]) - : WhichVFontData(screen, fnts[fNorm])); while (len--) { int cells = WideCells(*text); @@ -3473,7 +3534,7 @@ drawXtermText(XtermWidget xw, continue; } else #endif - if (IsXtermMissingChar(screen, *text, font)) { + if (IsXtermMissingChar(screen, *text, curFont)) { adj = 0; } else #endif @@ -3482,12 +3543,12 @@ drawXtermText(XtermWidget xw, XChar2b temp[1]; temp[0].byte2 = LO_BYTE(*text); temp[0].byte1 = HI_BYTE(*text); - width = XTextWidth16(font->fs, temp, 1); + width = XTextWidth16(curFont->fs, temp, 1); } , { char temp[1]; temp[0] = (char) LO_BYTE(*text); - width = XTextWidth(font->fs, temp, 1); + width = XTextWidth(curFont->fs, temp, 1); }); adj = (FontWidth(screen) - width) / 2; if (adj < 0) @@ -3503,17 +3564,27 @@ drawXtermText(XtermWidget xw, return x; } #if OPT_BOX_CHARS - /* If the font is incomplete, draw some substitutions */ + /* + * Draw some substitutions, if needed. The font may not include the + * line-drawing set, or it may be incomplete (in which case we'll draw an + * empty space via xtermDrawBoxChar), or we may be told to force our + * line-drawing. + * + * The empty space is a special case which can be overridden with the + * showMissingGlyphs resource to produce an outline. Not all fonts in + * "modern" (sic) X provide an empty space; some use a thick outline or + * something like the replacement character. If you would rather not see + * that, you can set assumeAllChars. + */ if (!IsIcon(screen) && !(flags & NOTRANSLATION) - && (!screen->fnt_boxes || screen->force_box_chars)) { + && (!screen->fnt_boxes + || (FontIsIncomplete(curFont) && !screen->assume_all_chars) + || screen->force_box_chars)) { /* Fill in missing box-characters. Find regions without missing characters, and draw them calling ourselves recursively. Draw missing characters via xtermDrawBoxChar(). */ - XTermFonts *font = ((flags & BOLDATTR(screen)) - ? WhichVFontData(screen, fnts[fBold]) - : WhichVFontData(screen, fnts[fNorm])); int last, first = 0; Bool drewBoxes = False; @@ -3540,9 +3611,9 @@ drawXtermText(XtermWidget xw, ((on_wide || ch_width > 1) && okFont(NormalWFont(screen))) ? WhichVFontData(screen, fnts[fWide]) - : font); + : curFont); #else - isMissing = IsXtermMissingChar(screen, ch, font); + isMissing = IsXtermMissingChar(screen, ch, curFont); ch_width = 1; #endif /* @@ -3554,11 +3625,14 @@ drawXtermText(XtermWidget xw, */ if_OPT_WIDE_CHARS(screen, { if (!isMissing - && ch > 255 - && ucs2dec(ch) < 32 && TScreenOf(xw)->force_box_chars) { - ch = ucs2dec(ch); - isMissing = True; + if (ch > 255 + && ucs2dec(ch) < 32) { + ch = ucs2dec(ch); + isMissing = True; + } else if (ch < 32) { + isMissing = True; + } } }); @@ -3693,7 +3767,7 @@ drawXtermText(XtermWidget xw, * show the actual characters. */ useBoldFont = ((flags & BOLDATTR(screen)) != 0); - if ((flags & BOLDATTR(screen)) != 0) { + if (useBoldFont) { XTermFonts *norm = 0; XTermFonts *bold = 0; Bool noBold, noNorm; @@ -3738,18 +3812,15 @@ drawXtermText(XtermWidget xw, Pixel fg = getCgsFore(xw, currentWin, gc); Pixel bg = getCgsBack(xw, currentWin, gc); - if (needWide && okFont(BoldWFont(screen))) { - if ((flags & BOLDATTR(screen)) != 0 - && okFont(BoldWFont(screen))) { - fntId = fWBold; - cgsId = gcWBold; - } else { - fntId = fWide; - cgsId = gcWide; - } - } else if ((flags & BOLDATTR(screen)) != 0 - && okFont(BoldFont(screen)) - && useBoldFont) { + if (needWide + && useBoldFont + && okFont(BoldWFont(screen))) { + fntId = fWBold; + cgsId = gcWBold; + } else if (needWide) { + fntId = fWide; + cgsId = gcWide; + } else if (useBoldFont) { fntId = fBold; cgsId = gcBold; } else { diff --git a/app/xterm/version.h b/app/xterm/version.h index 88ccf98c2..82e524f32 100644 --- a/app/xterm/version.h +++ b/app/xterm/version.h @@ -1,4 +1,4 @@ -/* $XTermId: version.h,v 1.370 2013/07/10 23:53:57 tom Exp $ */ +/* $XTermId: version.h,v 1.376 2013/12/03 23:53:59 tom Exp $ */ /* * Copyright 1998-2012,2013 by Thomas E. Dickey @@ -38,8 +38,8 @@ * version of X to which this version of xterm has been built. The resulting * number in parentheses is my patch number (Thomas E. Dickey). */ -#define XTERM_PATCH 296 -#define XTERM_DATE 2013-07-10 +#define XTERM_PATCH 300 +#define XTERM_DATE 2013-12-03 #ifndef __vendorversion__ #define __vendorversion__ "XTerm/OpenBSD" diff --git a/app/xterm/xstrings.c b/app/xterm/xstrings.c index 9b0e1a868..0f2f158d8 100644 --- a/app/xterm/xstrings.c +++ b/app/xterm/xstrings.c @@ -1,4 +1,4 @@ -/* $XTermId: xstrings.c,v 1.57 2013/02/03 22:11:25 tom Exp $ */ +/* $XTermId: xstrings.c,v 1.58 2013/11/18 01:40:43 tom Exp $ */ /* * Copyright 2000-2012,2013 by Thomas E. Dickey @@ -216,7 +216,7 @@ x_getlogin(uid_t uid, struct passwd *in_out) * result via the given pointer. On failure, wipes the data to prevent use. */ Boolean -x_getpwnam(const char *name, struct passwd * result) +x_getpwnam(const char *name, struct passwd *result) { struct passwd *ptr = getpwnam(name); Boolean code; @@ -236,7 +236,7 @@ x_getpwnam(const char *name, struct passwd * result) * result via the given pointer. On failure, wipes the data to prevent use. */ Boolean -x_getpwuid(uid_t uid, struct passwd * result) +x_getpwuid(uid_t uid, struct passwd *result) { struct passwd *ptr = getpwuid((uid_t) uid); Boolean code; @@ -431,7 +431,7 @@ x_strindex(char *s1, const char *s2) char *s3; size_t s2len = strlen(s2); - while ((s3 = strchr(s1, *s2)) != NULL) { + while ((s3 = (strchr) (s1, *s2)) != NULL) { if (strncmp(s3, s2, s2len) == 0) return (s3); s1 = ++s3; diff --git a/app/xterm/xterm.h b/app/xterm/xterm.h index 6c8550b1f..4fb0dfac3 100644 --- a/app/xterm/xterm.h +++ b/app/xterm/xterm.h @@ -1,4 +1,4 @@ -/* $XTermId: xterm.h,v 1.720 2013/06/23 08:57:13 Ross.Combs Exp $ */ +/* $XTermId: xterm.h,v 1.724 2013/11/23 00:25:35 tom Exp $ */ /* * Copyright 1999-2012,2013 by Thomas E. Dickey @@ -370,6 +370,7 @@ extern char **environ; #define XtNanswerbackString "answerbackString" #define XtNappcursorDefault "appcursorDefault" #define XtNappkeypadDefault "appkeypadDefault" +#define XtNassumeAllChars "assumeAllChars" #define XtNautoWrap "autoWrap" #define XtNawaitInput "awaitInput" #define XtNbackarrowKey "backarrowKey" @@ -479,7 +480,6 @@ extern char **environ; #define XtNpointerMode "pointerMode" #define XtNpointerShape "pointerShape" #define XtNpopOnBell "popOnBell" -#define XtNprivateColorRegisters "privateColorRegisters" #define XtNprecompose "precompose" #define XtNprintAttributes "printAttributes" #define XtNprinterAutoClose "printerAutoClose" @@ -488,6 +488,7 @@ extern char **environ; #define XtNprinterExtent "printerExtent" #define XtNprinterFormFeed "printerFormFeed" #define XtNprinterNewLine "printerNewLine" +#define XtNprivateColorRegisters "privateColorRegisters" #define XtNquietGrab "quietGrab" #define XtNrenderFont "renderFont" #define XtNresizeGravity "resizeGravity" @@ -557,6 +558,7 @@ extern char **environ; #define XtCAnswerbackString "AnswerbackString" #define XtCAppcursorDefault "AppcursorDefault" #define XtCAppkeypadDefault "AppkeypadDefault" +#define XtCAssumeAllChars "AssumeAllChars" #define XtCAutoWrap "AutoWrap" #define XtCAwaitInput "AwaitInput" #define XtCBackarrowKey "BackarrowKey" @@ -653,7 +655,6 @@ extern char **environ; #define XtCOldXtermFKeys "OldXtermFKeys" #define XtCPointerMode "PointerMode" #define XtCPopOnBell "PopOnBell" -#define XtCPrivateColorRegisters "PrivateColorRegisters" #define XtCPrecompose "Precompose" #define XtCPrintAttributes "PrintAttributes" #define XtCPrinterAutoClose "PrinterAutoClose" @@ -662,6 +663,7 @@ extern char **environ; #define XtCPrinterExtent "PrinterExtent" #define XtCPrinterFormFeed "PrinterFormFeed" #define XtCPrinterNewLine "PrinterNewLine" +#define XtCPrivateColorRegisters "PrivateColorRegisters" #define XtCQuietGrab "QuietGrab" #define XtCRenderFont "RenderFont" #define XtCResizeGravity "ResizeGravity" @@ -893,7 +895,7 @@ extern void noleaks_charproc (void); #endif /* charsets.c */ -extern unsigned xtermCharSetIn (unsigned /* code */, int /* charset */); +extern unsigned xtermCharSetIn (TScreen * /* screen */, unsigned /* code */, int /* charset */); extern int xtermCharSetOut (XtermWidget /* xw */, IChar * /* buf */, IChar * /* ptr */, int /* charset */); /* cursor.c */ @@ -1032,6 +1034,7 @@ extern void Redraw (void); extern void ReverseOldColors (void); extern void SysError (int /* i */) GCC_NORETURN; extern void VisualBell (void); +extern void cleanup_colored_cursor (void); extern void do_dcs (XtermWidget /* xw */, Char * /* buf */, size_t /* len */); extern void do_decrpm (XtermWidget /* xw */, int /* nparam */, int * /* params */); extern void do_osc (XtermWidget /* xw */, Char * /* buf */, size_t /* len */, int /* final */); @@ -1042,6 +1045,7 @@ extern void end_vt_mode (void); extern void hide_tek_window (void); extern void hide_vt_window (void); extern void ice_error (IceConn /* iceConn */); +extern void init_colored_cursor (void); extern void reset_decudk (void); extern void set_tek_visibility (Bool /* on */); extern void set_vt_visibility (Bool /* on */); diff --git a/app/xterm/xterm.log.html b/app/xterm/xterm.log.html index 13954ea18..3fb93b0f8 100644 --- a/app/xterm/xterm.log.html +++ b/app/xterm/xterm.log.html @@ -30,7 +30,7 @@ * sale, use or other dealings in this Software without prior written * * authorization. * ***************************************************************************** - $XTermId: xterm.log.html,v 1.1366 2013/07/10 23:46:32 tom Exp $ + $XTermId: xterm.log.html,v 1.1410 2013/12/04 00:16:42 tom Exp $ --> @@ -69,6 +69,14 @@ CHANGELOG).

+

Patch #300 - + 2013/12/03

+ +
    +
  • amend workaround for Xcursor library from + patch #298; the suggested solution for + Debian #466704 fell afoul of a bug in Xcursor + which treated an empty value for Inherits= as a + valid theme—and resulted in a stack overflow due to + unbounded recursion. Certain environments such as XFCE4 exposed + the bug. A related report in Debian #531679 was closed without + following the recommendation to limit stack recursion in this + library (reported by Sergey V Dyatko, Debian #731269).
  • +
+ +

Patch #299 - + 2013/12/01

+ +
    +
  • fix regression in line-drawing from patch #297 changes for NRCS exposed by change + to assumeAllChars resource in patch #298 (report by Markus Waldeck).
  • +
+ +

Patch #298 - + 2013/11/27

+ +
    +
  • quiet a warning about ambiguity when -h + command-line option is parsed, since -help is used + rather than the options mentioned in the message. This warning + was caused by fixes in patch + #272.
  • + +
  • remove an extra check for keypad-mode which interfered with + the patch #280 + modifyKeyboard feature for the numeric keypad + (report by David Conners).
  • + +
  • change default for assumeAllChars resource + (Debian #725682). There are unresolved issues with Terminus + fonts, e.g., Debian #722017.
  • + +
  • add -report-fonts command-line option and + reportFonts resource to optionally report the + fonts which are loaded, and their metrics such as the number of + missing glyphs.
  • + +
  • work around Xcursor library to make + pointerColor resource work as documented (Debian + #466704, analysis by Vincent Lefèvre).
  • + +
  • amend change from patch #297 for + ASCII-equivalents to ensure that missing characters which + happen to be double-width are padded to the expected number of + columns. Also, correct the choice between normal/wide Xft fonts + used when checking for missing characters (reported by WU Yue, + Debian #728949, Gentoo #491334).
  • + +
  • modify sixel-graphics drawing to account for scrollbar + width (report by Mario Edelmann).
  • + +
  • fix remaining issue with DECNRCM; the British + character set was confused with ISO Latin-1 (report by Hayaki + Saito).
  • + +
  • build-fix for --disable-boxchars configure + option.
  • + +
  • updated configure macros, from ongoing work on lynx and + ncurses.
  • + +
  • update config.guess, config.sub
  • +
+ +

Patch #297 - + 2013/09/10

+ +
    +
  • modify check for missing cells in bitmap font to work + around terminus 10646 encoding, which is mostly missing, add + assumeAllChars resource to provide the older + behavior.
  • + +
  • modify macros used to check for missing cells in bitmap + fonts to pick up a long-overlooked improvement made to xfd in + XFree86.
  • + +
  • improve workaround for groff versus ASCII-equivalents; + patch #185 had overlooked Xft + configuration (reported by anonymous user on Arch Linux + forum).
  • + +
  • review/extend DECNRCM support (prompted by + report by Hayaki Saito asking about the two "A" codes). + +
      +
    • make pasting of DECNRCM data work by translating the + pasted data into the selected encoding.
    • + +
    • limit mode changes to VT220 and up.
    • + +
    • ignore SCS for National Replacement Characters if + DECNRCM is not set.
    • + +
    • add tables and logic to decode SCS controls ending with + "%" and one additional character. This expects the parsing + of SCS to VT320.
    • + +
    • also added parsing for SCS of DEC Supplemental and DEC + Technical, which are for VT2xx and VT3xx respectively.
    • + +
    • implement VT220 Multinational character set "GR" aka + "DEC Supplemental Graphic".
    • + +
    • DEC Technical character set based on vt100.net + description.
    • + +
    • implement Portuguese NRC.
    • + +
    • provide for temporarily switching to/from NRC mode from + UTF-8 mode when DECNRCM is set or reset.
    • +
    +
  • + +
  • minor fix to assert's found while testing examples from + ttdoda's + slrm-test1.txt.
  • + +
  • modify DECLRMM to not update the cursor + position (report by Iwamoto Kouichi forwarded by Hayaki + Saito).
  • + +
  • modify cursor-position report to take origin-mode into + account (report by Hayaki Saito, see also iTerm2 pull + request 129).
  • + +
  • correct off-by-one comparison in when handling + carriage-return at left margin (patch by Iwamoto Kouichi, + forwarded by Hayaki Saito).
  • + +
  • improve handling of faceName resource when a + "size=" property is embedded in it, by using that size to + replace the default faceSize resource. This lets + xterm honor the other faceSize resources (report by Jens + Schweikhardt).
  • + +
  • improve OSC 52 selection-data by setting its timestamp + to correspond to the most-recent event received by xterm, to + ensure that calls to XtOwnSelect succeed even if + the selection is manipulated solely through the keyboard + (prompted by patch by Richard Tollerton).
  • + +
  • change configure-script defaults for "luit" and + "wide-chars" options to match the values used in the imake + configuration, to lessen user surprise if they are accustomed + to building xterm using imake(report by Andries E + Brouwer).
  • + +
  • improve the imake-related configuration's check if xterm is + started in a locale that uses UTF-8 encoding. Before, this + checked the locale settings only for "UTF-8", now it checks + ignoring case for "UTF-8" and "UTF-8" (report by Andries E + Brouwer).
  • +
+

Patch #296 - 2013/07/10

diff --git a/app/xterm/xterm.man b/app/xterm/xterm.man index e91174049..b61853a53 100644 --- a/app/xterm/xterm.man +++ b/app/xterm/xterm.man @@ -1,5 +1,5 @@ '\" t -.\" $XTermId: xterm.man,v 1.569 2013/07/05 20:35:30 tom Exp $ +.\" $XTermId: xterm.man,v 1.572 2013/11/23 17:40:11 tom Exp $ .\" .\" Copyright 1996-2012,2013 by Thomas E. Dickey .\" @@ -815,6 +815,11 @@ Control-G is received. This option indicates that the window should not be raised whenever a Control-G is received. .TP 8 +.B \-report\-fonts +Print a report to the standard output showing information about fonts +which are loaded. +This corresponds to the \fBreportFonts\fP resource. +.TP 8 .B \-rightbar Force scrollbar to the right side of VT100 screen. .TP 8 @@ -1465,6 +1470,11 @@ giving the pseudo-terminal's notion of the screen size. The default is \*(``false\*('' on Linux and OS X systems, \*(``true\*('' otherwise. .TP 8 +.B "reportFonts (\fPclass\fB ReportFonts)" +If true, \fI\*n\fP will print to the standard output a summary of +each font's metrics (size, number of glyphs, etc.), as it loads them. +The default is \*(``false\*(''. +.TP 8 .B "sameName (\fPclass\fB SameName)" If the value of this resource is \*(``true\*('', \fI\*n\fP does not send title and icon name change requests when the request @@ -1895,6 +1905,16 @@ The default is \*(``false\*(''. If \*(``true\*('', the keypad keys are initially in application mode. The default is \*(``false\*(''. .TP 8 +.B "assumeAllChars (\fPclass\fB AssumeAllChars)" +If \*(``true\*('', this enables a special case in bitmap fonts to +allow the font server to choose how to display missing glyphs. +The default is \*(``true\*(''. +.IP +The reason for this resource is to help with +certain quasi-automatically generated fonts +(such as the ISO-10646-1 encoding of Terminus) +which have incorrect font-metrics. +.TP 8 .B "autoWrap (\fPclass\fB AutoWrap)" Specifies whether or not auto-wraparound should be enabled. This is the same as the VT102 DECAWM. @@ -3928,7 +3948,7 @@ according to the effective value of the \fButf8\fP resource. .B "utf8Latin1 (\fPclass\fB Utf8Latin1)" If true, allow an ISO-8859-1 \fInormal\fP -font to be combined with an ISO-10646 font if the latter is given +font to be combined with an ISO-10646-1 font if the latter is given via the \fB\-fw\fP option or its corresponding resource value. The default is \*(``false\*(''. .TP 8 diff --git a/app/xterm/xtermcap.h b/app/xterm/xtermcap.h index 8c4bc41ef..3f2590d55 100644 --- a/app/xterm/xtermcap.h +++ b/app/xterm/xtermcap.h @@ -1,7 +1,7 @@ -/* $XTermId: xtermcap.h,v 1.19 2013/06/23 15:34:37 tom Exp $ */ +/* $XTermId: xtermcap.h,v 1.20 2013/06/23 15:34:37 tom Exp $ */ /* - * Copyright 2007-2010,2011 by Thomas E. Dickey + * Copyright 2007-2011,2013 by Thomas E. Dickey * * All Rights Reserved * diff --git a/app/xterm/xtermcfg.h b/app/xterm/xtermcfg.h index 105208948..4c82bf9f5 100644 --- a/app/xterm/xtermcfg.h +++ b/app/xterm/xtermcfg.h @@ -63,6 +63,8 @@ authorization. #define HAVE_LIB_XAW 1 /* CF_X_ATHENA */ /* #undef HAVE_LIB_XAW3D */ /* CF_X_ATHENA(--with-Xaw3d) */ /* #undef HAVE_LIB_XAWPLUS */ /* CF_X_ATHENA(--with-XawPlus) */ +#define HAVE_LIB_XCURSOR 1 /* AC_CHECK_LIB(Xcursor) */ +#define HAVE_MKDTEMP 1 /* AC_CHECK_FUNCS(mkdtemp) */ /* #undef HAVE_NCURSES_CURSES_H /* AC_CHECK_HEADERS(ncurses/curses.h) */ /* #undef HAVE_NCURSES_TERM_H */ /* AC_CHECK_HEADERS(ncurses/term.h) */ #define HAVE_PATHS_H 1 /* CF_LASTLOG */ diff --git a/app/xterm/xtermcfg.hin b/app/xterm/xtermcfg.hin index 381f2a7fd..e4173a370 100644 --- a/app/xterm/xtermcfg.hin +++ b/app/xterm/xtermcfg.hin @@ -1,4 +1,4 @@ -/* $XTermId: xtermcfg.hin,v 1.200 2013/06/23 19:20:22 tom Exp $ */ +/* $XTermId: xtermcfg.hin,v 1.202 2013/11/22 21:42:40 tom Exp $ */ /* * Copyright 1997-2012,2013 by Thomas E. Dickey @@ -62,6 +62,8 @@ #undef HAVE_LIB_XAW /* CF_X_ATHENA */ #undef HAVE_LIB_XAW3D /* CF_X_ATHENA(--with-Xaw3d) */ #undef HAVE_LIB_XAWPLUS /* CF_X_ATHENA(--with-XawPlus) */ +#undef HAVE_LIB_XCURSOR /* AC_CHECK_LIB(Xcursor) */ +#undef HAVE_MKDTEMP /* AC_CHECK_FUNCS(mkdtemp) */ #undef HAVE_NCURSES_CURSES_H /* AC_CHECK_HEADERS(ncurses/curses.h) */ #undef HAVE_NCURSES_TERM_H /* AC_CHECK_HEADERS(ncurses/term.h) */ #undef HAVE_PATHS_H /* CF_LASTLOG */