diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2010-03-25 22:03:52 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2010-03-25 22:03:52 +0000 |
commit | e16a08ded404b24025fc0707bfb3f6c3c76fd9b8 (patch) | |
tree | f25c0c31ae03d777014c4f64479de8c7f4c7f639 /app/xterm | |
parent | cea3749b11718d3b585f653d4acbb6c5287794cb (diff) |
Update to xterm-255. Tested by stsp@, oga@.
Diffstat (limited to 'app/xterm')
71 files changed, 6245 insertions, 2278 deletions
diff --git a/app/xterm/256colres.pl b/app/xterm/256colres.pl index a6b995e48..cf9673cc3 100644 --- a/app/xterm/256colres.pl +++ b/app/xterm/256colres.pl @@ -1,6 +1,36 @@ #! /usr/bin/perl -# Author: Thomas E. Dickey -# $XFree86: xc/programs/xterm/256colres.pl,v 1.8 2002/10/05 17:57:11 dickey Exp $ +# $XTermId: 256colres.pl,v 1.16 2007/06/08 23:58:37 tom Exp $ +# ----------------------------------------------------------------------------- +# this file is part of xterm +# +# Copyright 1999-2002,2007 by Thomas E. Dickey +# +# All Rights Reserved +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name(s) of the above copyright +# holders shall not be used in advertising or otherwise to promote the +# sale, use or other dealings in this Software without prior written +# authorization. +# ----------------------------------------------------------------------------- # Construct a header file defining default resources for the 256-color model # of xterm. This is modeled after the 256colors2.pl script. @@ -9,11 +39,17 @@ # reproduction of the standard ANSI colors, but possibly more # pleasing shades +use strict; + +our ( $line1, $line2, $line3 ); +our ( $red, $green, $blue, $gray ); +our ( $level, $code, @steps ); + print <<EOF; /* * This header file was generated by $0 */ -/* \$XFree86\$ */ +/* \$XTermId\$ */ #ifndef included_256colres_h #define included_256colres_h diff --git a/app/xterm/88colres.pl b/app/xterm/88colres.pl index 30a1a18fa..59ba41273 100644 --- a/app/xterm/88colres.pl +++ b/app/xterm/88colres.pl @@ -1,7 +1,37 @@ #!/usr/bin/perl -# Author: Steve Wall -# $XTermId: 88colres.pl,v 1.15 2005/09/18 23:48:11 tom Exp $ -# $XFree86: xc/programs/xterm/88colres.pl,v 1.7 2005/09/18 23:48:11 dickey Exp $ +# $XTermId: 88colres.pl,v 1.17 2007/06/08 23:57:23 tom Exp $ +# ----------------------------------------------------------------------------- +# this file is part of xterm +# +# Copyright 1999-2005,2007 by Thomas E. Dickey +# Copyright 1999-2000 by Steve Wall +# +# All Rights Reserved +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name(s) of the above copyright +# holders shall not be used in advertising or otherwise to promote the +# sale, use or other dealings in this Software without prior written +# authorization. +# ----------------------------------------------------------------------------- # Made from 256colres.pl # Construct a header file defining default resources for the @@ -11,11 +41,17 @@ # reproduction of the standard ANSI colors, but possibly more # pleasing shades +use strict; + +our ( $line1, $line2, $line3 ); +our ( $red, $green, $blue, $gray ); +our ( $level, $code, @steps ); + print <<EOF; /* * This header file was generated by $0 */ -/* \$XFree86\$ */ +/* \$XTermId\$ */ #ifndef included_88colres_h #define included_88colres_h diff --git a/app/xterm/KOI8RXTerm.ad b/app/xterm/KOI8RXTerm.ad index aa21f2666..296bf51eb 100644 --- a/app/xterm/KOI8RXTerm.ad +++ b/app/xterm/KOI8RXTerm.ad @@ -1,7 +1,37 @@ -! $XTermId: KOI8RXTerm.ad,v 1.2 2007/12/30 15:49:14 tom Exp $ - +! $XTermId: KOI8RXTerm.ad,v 1.3 2007/12/30 15:49:14 tom Exp $ +! ----------------------------------------------------------------------------- +! this file is part of xterm +! +! Copyright 2007 by Thomas E. Dickey +! +! All Rights Reserved +! +! Permission is hereby granted, free of charge, to any person obtaining a +! copy of this software and associated documentation files (the +! "Software"), to deal in the Software without restriction, including +! without limitation the rights to use, copy, modify, merge, publish, +! distribute, sublicense, and/or sell copies of the Software, and to +! permit persons to whom the Software is furnished to do so, subject to +! the following conditions: +! +! The above copyright notice and this permission notice shall be included +! in all copies or substantial portions of the Software. +! +! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +! OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +! MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +! IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +! CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +! TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +! SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +! +! Except as contained in this notice, the name(s) of the above copyright +! holders shall not be used in advertising or otherwise to promote the +! sale, use or other dealings in this Software without prior written +! authorization. +! ----------------------------------------------------------------------------- ! This is based on the UXTerm app-defaults file. - +! ----------------------------------------------------------------------------- ! Use ! xterm -class KOI8RXTerm ! to set resources for KOI8-R mode with corresponding fonts. diff --git a/app/xterm/MANIFEST b/app/xterm/MANIFEST index 7db856e46..282f20a63 100644 --- a/app/xterm/MANIFEST +++ b/app/xterm/MANIFEST @@ -1,4 +1,4 @@ -MANIFEST for xterm-250, version xterm-250 +MANIFEST for xterm-255, version xterm-255 -------------------------------------------------------------------------------- MANIFEST this file 256colres.h resource-definitions for 256-color mode @@ -48,7 +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 input.c VT100 key-symbol and function-key translation -install.sh configure script: fallback install script +install-sh install-script (needed by configure) keysym2ucs.c lookup-table for UTF-8 to keysyms keysym2ucs.h interface of keysym2ucs.c koi8rxterm KOI-8 wrapper from Debian (originally me) @@ -62,7 +62,6 @@ menu.c popup/pulldown menus for 'xterm' menu.h interface of menu.c minstall.sh script for installing manpages misc.c miscellaneous utility functions for 'xterm' -mkdirs.sh configure script: make directories for install process os2main.c main program for OS/2 EMX port of 'xterm' plink.sh script to prune unneeded libraries from link precompose.c table of precompose sequences diff --git a/app/xterm/Tekparse.def b/app/xterm/Tekparse.def index 9945eed1c..d4a0b8ef0 100644 --- a/app/xterm/Tekparse.def +++ b/app/xterm/Tekparse.def @@ -1,4 +1,37 @@ -# $XTermId: Tekparse.def,v 1.3 2006/02/12 22:43:56 tom Exp $ +# $XTermId: Tekparse.def,v 1.4 2006/02/12 22:43:56 tom Exp $ +# +# vile:confmode rs=lf +# ----------------------------------------------------------------------------- +# this file is part of xterm +# +# Copyright 2002,2006 by Thomas E. Dickey +# +# All Rights Reserved +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name(s) of the above copyright +# holders shall not be used in advertising or otherwise to promote the +# sale, use or other dealings in this Software without prior written +# authorization. +# ----------------------------------------------------------------------------- # # List of symbols that need to be defined for Tekparse.h. If you need to # change any of the CASE_ macros, make the change here and rerun the command diff --git a/app/xterm/Tekproc.c b/app/xterm/Tekproc.c index 5d4cf323a..483484a48 100644 --- a/app/xterm/Tekproc.c +++ b/app/xterm/Tekproc.c @@ -1,4 +1,4 @@ -/* $XTermId: Tekproc.c,v 1.173 2009/10/12 00:31:59 tom Exp $ */ +/* $XTermId: Tekproc.c,v 1.175 2009/12/09 23:25:34 Jochen.Voss Exp $ */ /* * Warning, there be crufty dragons here. @@ -457,7 +457,7 @@ Tekparse(TekWidget tw) TRACE(("case: special return to vt102 mode\n")); Tparsestate = curstate; TekRecord->ptr[-1] = ANSI_NAK; /* remove from recording */ - FlushLog(&(term->screen)); + FlushLog(TScreenOf(term)); return; case CASE_SPT_STATE: @@ -1311,7 +1311,7 @@ TekRun(void) TEK4014_ACTIVE(term) = False; } else { TEK4014_ACTIVE(term) = False; - if (VWindow(&(term->screen)) == 0) { + if (VWindow(TScreenOf(term)) == 0) { Exit(ERROR_TINIT); } } @@ -1358,6 +1358,9 @@ TekInitialize(Widget request GCC_UNUSED, Cardinal *num_args GCC_UNUSED) { Widget tekparent = SHELL_OF(wnew); +#ifndef NO_ACTIVE_ICON + TekScreen *screen = TekScreenOf((TekWidget) wnew); +#endif TRACE(("TekInitialize\n")); @@ -1374,7 +1377,7 @@ TekInitialize(Widget request GCC_UNUSED, HandleBellPropertyChange, (Opaque) 0); #ifndef NO_ACTIVE_ICON - ((TekWidget) wnew)->screen.whichTwin = &((TekWidget) wnew)->screen.fullTwin; + screen->whichTwin = &(screen->fullTwin); #endif /* NO_ACTIVE_ICON */ } @@ -1399,7 +1402,7 @@ TekRealize(Widget gw, unsigned long TEKgcFontMask; TRACE(("TekRealize\n")); - memset(tekscr, 0, sizeof(tekscr)); + memset(tekscr, 0, sizeof(*tekscr)); #ifndef NO_ACTIVE_ICON tekscr->whichTwin = &tekscr->fullTwin; diff --git a/app/xterm/UXTerm.ad b/app/xterm/UXTerm.ad index a8840d7c1..74597ae74 100644 --- a/app/xterm/UXTerm.ad +++ b/app/xterm/UXTerm.ad @@ -1,6 +1,35 @@ -! $XTermId: UXTerm.ad,v 1.11 2006/02/13 01:14:58 tom Exp $ -! $XFree86: xc/programs/xterm/UXTerm.ad,v 1.5 2006/02/13 01:14:58 dickey Exp $ - +! $XTermId: UXTerm.ad,v 1.12 2006/02/13 01:14:58 tom Exp $ +! ----------------------------------------------------------------------------- +! this file is part of xterm +! +! Copyright 2000-2005,2006 by Thomas E. Dickey +! +! All Rights Reserved +! +! Permission is hereby granted, free of charge, to any person obtaining a +! copy of this software and associated documentation files (the +! "Software"), to deal in the Software without restriction, including +! without limitation the rights to use, copy, modify, merge, publish, +! distribute, sublicense, and/or sell copies of the Software, and to +! permit persons to whom the Software is furnished to do so, subject to +! the following conditions: +! +! The above copyright notice and this permission notice shall be included +! in all copies or substantial portions of the Software. +! +! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +! OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +! MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +! IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +! CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +! TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +! SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +! +! Except as contained in this notice, the name(s) of the above copyright +! holders shall not be used in advertising or otherwise to promote the +! sale, use or other dealings in this Software without prior written +! authorization. +! ----------------------------------------------------------------------------- ! Use ! xterm -class UXTerm ! to set resources for UTF-8 mode with corresponding fonts. diff --git a/app/xterm/VTPrsTbl.c b/app/xterm/VTPrsTbl.c index 370ae0e1f..e0057fd00 100644 --- a/app/xterm/VTPrsTbl.c +++ b/app/xterm/VTPrsTbl.c @@ -1,8 +1,8 @@ -/* $XTermId: VTPrsTbl.c,v 1.50 2008/05/26 22:38:23 tom Exp $ */ +/* $XTermId: VTPrsTbl.c,v 1.55 2009/12/29 22:01:11 tom Exp $ */ /* * - * Copyright 1999-2006,2008 by Thomas E. Dickey + * Copyright 1999-2008,2009 by Thomas E. Dickey * * All Rights Reserved * @@ -55,6 +55,11 @@ #include <VTparse.h> +#if !OPT_BLINK_CURS +#undef CASE_CSI_SPACE_STATE +#define CASE_CSI_SPACE_STATE CASE_CSI_IGNORE +#endif + #if !OPT_DEC_LOCATOR #undef CASE_CSI_TICK_STATE #define CASE_CSI_TICK_STATE CASE_CSI_IGNORE @@ -444,7 +449,7 @@ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* SP ! " # */ -CASE_CSI_IGNORE, +CASE_CSI_SPACE_STATE, CASE_CSI_EX_STATE, CASE_CSI_QUOTE_STATE, CASE_CSI_IGNORE, @@ -604,7 +609,7 @@ CASE_OSC, CASE_PM, CASE_APC, /* nobreakspace exclamdown cent sterling */ -CASE_CSI_IGNORE, +CASE_CSI_SPACE_STATE, CASE_CSI_EX_STATE, CASE_CSI_QUOTE_STATE, CASE_CSI_IGNORE, @@ -768,7 +773,7 @@ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* SP ! " # */ -CASE_CSI_IGNORE, +CASE_CSI_SPACE_STATE, CASE_CSI_EX_STATE, CASE_CSI_QUOTE_STATE, CASE_CSI_IGNORE, @@ -928,7 +933,7 @@ CASE_OSC, CASE_PM, CASE_APC, /* nobreakspace exclamdown cent sterling */ -CASE_CSI_IGNORE, +CASE_CSI_SPACE_STATE, CASE_CSI_EX_STATE, CASE_CSI_QUOTE_STATE, CASE_CSI_IGNORE, @@ -1697,6 +1702,332 @@ CASE_GROUND_STATE, CASE_IGNORE, }; +#if OPT_BLINK_CURS +Const PARSE_T csi_sp_table[] = /* CSI ... SP */ +{ +/* 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, +/* NP 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_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* $ % & ' */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* ( ) * + */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* , - . / */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* 0 1 2 3 */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* 4 5 6 7 */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* 8 9 : ; */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* < = > ? */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* @ 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_DECSCUSR, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* t u v w */ +CASE_DECSWBV, +CASE_DECSMBV, +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_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* currency yen brokenbar section */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* notsign hyphen registered macron */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* acute mu paragraph periodcentered */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* cedilla onesuperior masculine guillemotright */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* onequarter onehalf threequarters questiondown */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* 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 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_DECSCUSR, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ocircumflex otilde odiaeresis division */ +CASE_DECSWBV, +CASE_DECSMBV, +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 + #if OPT_DEC_LOCATOR Const PARSE_T csi_tick_table[] = /* CSI ... ' */ { @@ -3105,7 +3436,7 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* T U V W */ -CASE_GROUND_STATE, +CASE_RM_TITLE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -3145,7 +3476,7 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* t u v w */ -CASE_GROUND_STATE, +CASE_SM_TITLE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -3260,7 +3591,7 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Eth Ntilde Ograve Oacute */ -CASE_GROUND_STATE, +CASE_RM_TITLE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, @@ -3296,16 +3627,16 @@ CASE_GROUND_STATE, CASE_GROUND_STATE, /* igrave iacute icircumflex idiaeresis */ CASE_GROUND_STATE, -CASE_GROUND_STATE, -CASE_GROUND_STATE, +CASE_SET_MOD_FKEYS, +CASE_SET_MOD_FKEYS0, CASE_GROUND_STATE, /* eth ntilde ograve oacute */ -CASE_GROUND_STATE, +CASE_HIDE_POINTER, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* ocircumflex otilde odiaeresis division */ -CASE_GROUND_STATE, +CASE_SM_TITLE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, diff --git a/app/xterm/VTparse.def b/app/xterm/VTparse.def index c1438db3b..8a9f08fcc 100644 --- a/app/xterm/VTparse.def +++ b/app/xterm/VTparse.def @@ -1,6 +1,37 @@ -# $XTermId: VTparse.def,v 1.32 2008/05/26 21:30:10 tom Exp $ +# $XTermId: VTparse.def,v 1.37 2009/12/29 22:57:10 tom Exp $ # # vile:confmode rs=lf +# ----------------------------------------------------------------------------- +# this file is part of xterm +# +# Copyright 1996-2008,2009 by Thomas E. Dickey +# +# All Rights Reserved +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name(s) of the above copyright +# holders shall not be used in advertising or otherwise to promote the +# sale, use or other dealings in this Software without prior written +# authorization. +# ----------------------------------------------------------------------------- # # List of symbols that need to be defined for VTparse.h. If you need to # change any of the CASE_ macros, make the change here and rerun the command @@ -144,3 +175,9 @@ CASE_HIDE_POINTER CASE_SCS1A_STATE CASE_SCS2A_STATE CASE_SCS3A_STATE +CASE_CSI_SPACE_STATE +CASE_DECSCUSR +CASE_SM_TITLE +CASE_RM_TITLE +CASE_DECSMBV +CASE_DECSWBV diff --git a/app/xterm/VTparse.h b/app/xterm/VTparse.h index cdc781507..1df063be3 100644 --- a/app/xterm/VTparse.h +++ b/app/xterm/VTparse.h @@ -1,26 +1,34 @@ -/* $XTermId: VTparse.h,v 1.45 2008/05/28 21:11:23 tom Exp $ */ +/* $XTermId: VTparse.h,v 1.50 2009/12/29 22:57:16 tom Exp $ */ /* - * Copyright 2002-2006,2008 by Thomas E. Dickey + * Copyright 2002-2008,2009 by Thomas E. Dickey * * All Rights Reserved * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of the above listed - * copyright holder(s) not be used in advertising or publicity pertaining - * to distribution of the software without specific, written prior - * permission. + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization. * - * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. * @@ -67,6 +75,7 @@ extern Const PARSE_T cigtable[]; extern Const PARSE_T csi2_table[]; extern Const PARSE_T csi_ex_table[]; extern Const PARSE_T csi_quo_table[]; +extern Const PARSE_T csi_sp_table[]; extern Const PARSE_T csi_table[]; extern Const PARSE_T dec2_table[]; extern Const PARSE_T dec3_table[]; @@ -246,5 +255,11 @@ extern Const PARSE_T esc_pct_table[]; #define CASE_SCS1A_STATE 134 #define CASE_SCS2A_STATE 135 #define CASE_SCS3A_STATE 136 +#define CASE_CSI_SPACE_STATE 137 +#define CASE_DECSCUSR 138 +#define CASE_SM_TITLE 139 +#define CASE_RM_TITLE 140 +#define CASE_DECSMBV 141 +#define CASE_DECSWBV 142 #endif /* included_VTparse_h */ diff --git a/app/xterm/XTerm-col.ad b/app/xterm/XTerm-col.ad index 9de5098e7..c157e9ffa 100644 --- a/app/xterm/XTerm-col.ad +++ b/app/xterm/XTerm-col.ad @@ -1,4 +1,35 @@ -! $XTermId: XTerm-col.ad,v 1.21 2009/08/15 15:56:29 tom Exp $ +! $XTermId: XTerm-col.ad,v 1.22 2009/08/15 15:56:29 tom Exp $ +! ----------------------------------------------------------------------------- +! this file is part of xterm +! +! Copyright 2002-2006,2009 by Thomas E. Dickey +! +! All Rights Reserved +! +! Permission is hereby granted, free of charge, to any person obtaining a +! copy of this software and associated documentation files (the +! "Software"), to deal in the Software without restriction, including +! without limitation the rights to use, copy, modify, merge, publish, +! distribute, sublicense, and/or sell copies of the Software, and to +! permit persons to whom the Software is furnished to do so, subject to +! the following conditions: +! +! The above copyright notice and this permission notice shall be included +! in all copies or substantial portions of the Software. +! +! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +! OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +! MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +! IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +! CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +! TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +! SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +! +! Except as contained in this notice, the name(s) of the above copyright +! holders shall not be used in advertising or otherwise to promote the +! sale, use or other dealings in this Software without prior written +! authorization. +! ----------------------------------------------------------------------------- #include "XTerm" diff --git a/app/xterm/XTerm.ad b/app/xterm/XTerm.ad index 91dee7eb0..d573f0880 100644 --- a/app/xterm/XTerm.ad +++ b/app/xterm/XTerm.ad @@ -1,4 +1,35 @@ -! $XTermId: XTerm.ad,v 1.90 2009/09/27 22:02:30 tom Exp $ +! $XTermId: XTerm.ad,v 1.92 2010/01/04 22:16:17 tom Exp $ +! ----------------------------------------------------------------------------- +! this file is part of xterm +! +! Copyright 1996-2009,2010 by Thomas E. Dickey +! +! All Rights Reserved +! +! Permission is hereby granted, free of charge, to any person obtaining a +! copy of this software and associated documentation files (the +! "Software"), to deal in the Software without restriction, including +! without limitation the rights to use, copy, modify, merge, publish, +! distribute, sublicense, and/or sell copies of the Software, and to +! permit persons to whom the Software is furnished to do so, subject to +! the following conditions: +! +! The above copyright notice and this permission notice shall be included +! in all copies or substantial portions of the Software. +! +! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +! OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +! MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +! IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +! CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +! TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +! SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +! +! Except as contained in this notice, the name(s) of the above copyright +! holders shall not be used in advertising or otherwise to promote the +! sale, use or other dealings in this Software without prior written +! authorization. +! ----------------------------------------------------------------------------- *scrollBar: true *saveLines: 1024 @@ -94,8 +125,9 @@ *fontMenu*utf8-mode*Label: UTF-8 *fontMenu*utf8-title*Label: UTF-8 Titles -*fontMenu*allow-tcap-ops*Label: Allow Termcap Ops +*fontMenu*allow-color-ops*Label: Allow Color Ops *fontMenu*allow-font-ops*Label: Allow Font Ops +*fontMenu*allow-tcap-ops*Label: Allow Termcap Ops *fontMenu*allow-title-ops*Label: Allow Title Ops *fontMenu*allow-window-ops*Label: Allow Window Ops diff --git a/app/xterm/button.c b/app/xterm/button.c index 6ccd5d583..0cd6b974c 100644 --- a/app/xterm/button.c +++ b/app/xterm/button.c @@ -1,4 +1,4 @@ -/* $XTermId: button.c,v 1.356 2009/10/10 23:37:27 tom Exp $ */ +/* $XTermId: button.c,v 1.364 2010/01/04 23:13:01 tom Exp $ */ /* * Copyright 1999-2008,2009 by Thomas E. Dickey @@ -62,6 +62,7 @@ button.c Handles button events in the terminal emulator. #include <xterm.h> #include <stdio.h> +#include <assert.h> #include <X11/Xatom.h> #include <X11/Xmu/Atoms.h> @@ -1146,6 +1147,61 @@ UTF8toLatin1(TScreen * screen, Char * s, unsigned len, unsigned long *result) } return buffer; } + +int +xtermUtf8ToTextList(XtermWidget xw, + XTextProperty * text_prop, + char ***text_list, + int *text_list_count) +{ + TScreen *screen = TScreenOf(xw); + Display *dpy = screen->display; + int rc = -1; + + if (text_prop->format == 8 + && (rc = Xutf8TextPropertyToTextList(dpy, text_prop, + text_list, + text_list_count)) >= 0) { + if (*text_list != NULL && *text_list_count != 0) { + int i; + Char *data; + char **new_text_list, *tmp; + unsigned long size, new_size; + + TRACE(("xtermUtf8ToTextList size %d\n", *text_list_count)); + + /* + * XLib StringList actually uses only two pointers, one for the + * list itself, and one for the data. Pointer to the data is the + * first element of the list, the rest (if any) list elements point + * to the same memory block as the first element + */ + new_size = 0; + for (i = 0; i < *text_list_count; ++i) { + data = (Char *) (*text_list)[i]; + size = strlen((*text_list)[i]) + 1; + data = UTF8toLatin1(screen, data, size, &size); + new_size += size + 1; + } + new_text_list = + (char **) XtMalloc(sizeof(char *) * (unsigned) *text_list_count); + new_text_list[0] = tmp = XtMalloc(new_size); + for (i = 0; i < (*text_list_count); ++i) { + data = (Char *) (*text_list)[i]; + size = strlen((*text_list)[i]) + 1; + data = UTF8toLatin1(screen, data, size, &size); + memcpy(tmp, data, size + 1); + new_text_list[i] = tmp; + tmp += size + 1; + } + XFreeStringList((*text_list)); + *text_list = new_text_list; + } else { + rc = -1; + } + } + return rc; +} #endif /* OPT_WIDE_CHARS */ static char * @@ -1196,7 +1252,7 @@ overrideTargets(Widget w, String value, Atom ** resultp) if ((xw = getXtermWidget(w)) != 0) { TScreen *screen = TScreenOf(xw); - if (value != 0 && *value != '\0') { + if (!IsEmpty(value)) { String copied = x_strdup(value); if (copied != 0) { Atom *result = 0; @@ -1823,41 +1879,8 @@ SelectionReceived(Widget w, #if OPT_WIDE_CHARS if (*type == XA_UTF8_STRING(dpy) && !(screen->wide_chars || screen->c1_printable)) { - rc = Xutf8TextPropertyToTextList(dpy, &text_prop, - &text_list, &text_list_count); - if (text_list != NULL && text_list_count != 0) { - int i; - Char *data; - char **new_text_list, *tmp; - unsigned long size, new_size; - /* XLib StringList actually uses only two - * pointers, one for the list itself, and one for - * the data. Pointer to the data is the first - * element of the list, the rest (if any) list - * elements point to the same memory block as the - * first element - */ - new_size = 0; - for (i = 0; i < text_list_count; ++i) { - data = (Char *) text_list[i]; - size = strlen(text_list[i]) + 1; - data = UTF8toLatin1(screen, data, size, &size); - new_size += size + 1; - } - new_text_list = - (char **) XtMalloc(sizeof(char *) * (unsigned) text_list_count); - new_text_list[0] = tmp = XtMalloc(new_size); - for (i = 0; i < text_list_count; ++i) { - data = (Char *) text_list[i]; - size = strlen(text_list[i]) + 1; - data = UTF8toLatin1(screen, data, size, &size); - memcpy(tmp, data, size + 1); - new_text_list[i] = tmp; - tmp += size + 1; - } - XFreeStringList(text_list); - text_list = new_text_list; - } + rc = xtermUtf8ToTextList(xw, &text_prop, + &text_list, &text_list_count); } else #endif if (*type == XA_STRING && screen->brokenSelections) { @@ -1965,7 +1988,7 @@ EvalSelectUnit(XtermWidget xw, int delta; if (button != screen->lastButton) { - delta = xw->screen.multiClickTime + 1; + delta = screen->multiClickTime + 1; } else if (screen->lastButtonUpTime == (Time) 0) { /* first time and once in a blue moon */ delta = screen->multiClickTime + 1; @@ -2601,6 +2624,7 @@ class_of(LineData * ld, CELL * cell) } #endif + assert(temp.col < ld->lineSize); return CharacterClass((int) (ld->charData[temp.col])); } @@ -2629,9 +2653,11 @@ okPosition(TScreen * screen, if (cell->row > screen->max_row) { result = False; } else if (cell->col > (LastTextCol(screen, *ld, cell->row) + 1)) { - cell->col = 0; - *ld = GET_LINEDATA(screen, ++cell->row); - result = False; + if (cell->row < screen->max_row) { + cell->col = 0; + *ld = GET_LINEDATA(screen, ++cell->row); + result = False; + } } return result; } @@ -2733,6 +2759,7 @@ make_indexed_text(TScreen * screen, int row, unsigned length, int *indexed) Char *next = last; unsigned data = ld->charData[col]; + assert(col < ld->lineSize); /* some internal points may not be drawn */ if (data == 0) data = ' '; @@ -2941,6 +2968,9 @@ do_select_regex(TScreen * screen, CELL * startc, CELL * endc) #define PrevRow(name) \ ld.name = GET_LINEDATA(screen, --screen->name.row) +#define MoreRows(name) \ + (screen->name.row < screen->max_row) + #define isPrevWrapped(name) \ (screen->name.row > 0 \ && (ltmp = GET_LINEDATA(screen, screen->name.row - 1)) != 0 \ @@ -2979,7 +3009,7 @@ ComputeSelect(XtermWidget xw, if (first.col > 1 && isWideCell(first.row, first.col - 1) && XTERM_CELL(first.row, first.col - 0) == HIDDEN_CHAR) { - fprintf(stderr, "Adjusting start. Changing downwards from %i.\n", first.col); + TRACE(("Adjusting start. Changing downwards from %i.\n", first.col)); first.col -= 1; if (last.col == (first.col + 1)) last.col--; @@ -3038,6 +3068,8 @@ ComputeSelect(XtermWidget xw, ++screen->endSel.col; if (screen->endSel.col > length && LineTstWrapped(ld.endSel)) { + if (!MoreRows(endSel)) + break; screen->endSel.col = 0; NextRow(endSel); length = LastTextCol(screen, ld.endSel, screen->endSel.row); @@ -3048,7 +3080,8 @@ ComputeSelect(XtermWidget xw, * especially note that it includes the last character in a word. * So we do no --endSel.col and do special eol handling. */ - if (screen->endSel.col > length + 1) { + if (screen->endSel.col > length + 1 + && MoreRows(endSel)) { screen->endSel.col = 0; NextRow(endSel); } @@ -3065,7 +3098,8 @@ ComputeSelect(XtermWidget xw, case Select_LINE: TRACE(("Select_LINE\n")); - while (LineTstWrapped(ld.endSel)) { + while (LineTstWrapped(ld.endSel) + && MoreRows(endSel)) { NextRow(endSel); } if (screen->cutToBeginningOfLine @@ -3101,7 +3135,7 @@ ComputeSelect(XtermWidget xw, } screen->startSel.col = 0; /* scan forward for end of group */ - while (screen->endSel.row < screen->max_row && + while (MoreRows(endSel) && (LastTextCol(screen, ld.endSel, screen->endSel.row + 1) > 0 || LineTstWrapped(ld.endSel))) { @@ -3115,7 +3149,7 @@ ComputeSelect(XtermWidget xw, TRACE(("Select_PAGE\n")); screen->startSel.row = 0; screen->startSel.col = 0; - screen->endSel.row = screen->max_row + 1; + screen->endSel.row = MaxRows(screen); screen->endSel.col = 0; break; @@ -3123,7 +3157,7 @@ ComputeSelect(XtermWidget xw, TRACE(("Select_ALL\n")); screen->startSel.row = -screen->savedlines; screen->startSel.col = 0; - screen->endSel.row = screen->max_row + 1; + screen->endSel.row = MaxRows(screen); screen->endSel.col = 0; break; @@ -3409,7 +3443,7 @@ AppendToSelectionBuffer(TScreen * screen, unsigned c) } void -CompleteSelection(XtermWidget xw, char **args, Cardinal len) +CompleteSelection(XtermWidget xw, String * args, Cardinal len) { TScreen *screen = TScreenOf(xw); @@ -3711,6 +3745,8 @@ _OwnSelection(XtermWidget xw, unsigned long limit = (unsigned long) (4 * XMaxRequestSize(XtDisplay((Widget) xw)) - 32); if (screen->selection_length > limit) { + TRACE(("selection too big (%lu bytes), not storing in CUT_BUFFER%d\n", + screen->selection_length, cutbuffer)); fprintf(stderr, "%s: selection too big (%lu bytes), not storing in CUT_BUFFER%d\n", xterm_name, screen->selection_length, cutbuffer); @@ -3849,6 +3885,7 @@ SaveText(TScreen * screen, #endif *eol = !LineTstWrapped(ld); for (i = scol; i < ecol; i++) { + assert(i < ld->lineSize); c = E2A(ld->charData[i]); #if OPT_WIDE_CHARS /* We want to strip out every occurrence of HIDDEN_CHAR AFTER a diff --git a/app/xterm/cachedGCs.c b/app/xterm/cachedGCs.c index 8c26aa6d5..9a5970ff0 100644 --- a/app/xterm/cachedGCs.c +++ b/app/xterm/cachedGCs.c @@ -1,4 +1,4 @@ -/* $XTermId: cachedGCs.c,v 1.54 2009/08/07 00:06:33 tom Exp $ */ +/* $XTermId: cachedGCs.c,v 1.56 2009/11/28 13:24:07 tom Exp $ */ /************************************************************ @@ -127,10 +127,10 @@ traceVTwin(XtermWidget xw, VTwin * value) const char *result = "?"; if (value == 0) result = "null"; - else if (value == &(xw->screen.fullVwin)) + else if (value == &(TScreenOf(xw)->fullVwin)) result = "fullVwin"; #ifndef NO_ACTIVE_ICON - else if (value == &(xw->screen.iconVwin)) + else if (value == &(TScreenOf(xw)->iconVwin)) result = "iconVwin"; #endif return result; @@ -205,7 +205,7 @@ tracePixel(XtermWidget xw, Pixel value) CASE(TEK_CURSOR), #endif }; - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); String result = 0; int n; @@ -284,11 +284,11 @@ myCache(XtermWidget xw, VTwin * cgsWin, CgsEnum cgsId) (void) xw; (void) cgsWin; #else - if (cgsWin == &(xw->screen.iconVwin)) - result = allocCache(&(xw->screen.icon_cgs_cache)); + if (cgsWin == &(TScreenOf(xw)->iconVwin)) + result = allocCache(&(TScreenOf(xw)->icon_cgs_cache)); else #endif - result = allocCache(&(xw->screen.main_cgs_cache)); + result = allocCache(&(TScreenOf(xw)->main_cgs_cache)); result += cgsId; if (result->data == 0) { @@ -302,7 +302,7 @@ myCache(XtermWidget xw, VTwin * cgsWin, CgsEnum cgsId) static Display * myDisplay(XtermWidget xw) { - return xw->screen.display; + return TScreenOf(xw)->display; } static Drawable @@ -500,11 +500,11 @@ setCgsFont(XtermWidget xw, VTwin * cgsWin, CgsEnum cgsId, XTermFonts * font) if (cgsId != gcNorm) (void) getCgsGC(xw, cgsWin, gcNorm); #ifndef NO_ACTIVE_ICON - if (cgsWin == &(xw->screen.iconVwin)) - font = &(xw->screen.fnt_icon); + if (cgsWin == &(TScreenOf(xw)->iconVwin)) + font = &(TScreenOf(xw)->fnt_icon); else #endif - font = &(xw->screen.fnts[fNorm]); + font = &(TScreenOf(xw)->fnts[fNorm]); } if (HaveFont(font) && okFont(font->fs)) { TRACE2(("...updated next font in %p for %s to %s\n", @@ -629,7 +629,7 @@ getCgsGC(XtermWidget xw, VTwin * cgsWin, CgsEnum cgsId) } } LINK(k); - TRACE(("...getCgsGC least-used(%d) was %d\n", k, THIS(used))); + TRACE2(("...getCgsGC least-used(%d) was %d\n", k, THIS(used))); result = chgCache(xw, cgsId, me, True); } me->next = *(me->data); @@ -769,7 +769,7 @@ void redoCgs(XtermWidget xw, Pixel fg, Pixel bg, CgsEnum cgsId) { int n; - VTwin *cgsWin = WhichVWin(&(xw->screen)); + VTwin *cgsWin = WhichVWin(TScreenOf(xw)); CgsCache *me = myCache(xw, cgsWin, cgsId); if (me != 0) { @@ -844,7 +844,7 @@ freeCgs(XtermWidget xw, VTwin * cgsWin, CgsEnum cgsId) XmuReleaseStippledPixmap(XtScreen((Widget) xw), LIST(j).tile); } #endif - XFreeGC(xw->screen.display, LIST(j).gc); + XFreeGC(TScreenOf(xw)->display, LIST(j).gc); memset(&LIST(j), 0, sizeof(LIST(j))); } LINK(0); @@ -858,8 +858,8 @@ void noleaks_cachedCgs(XtermWidget xw) { #ifndef NO_ACTIVE_ICON - free(xw->screen.icon_cgs_cache); + free(TScreenOf(xw)->icon_cgs_cache); #endif - free(xw->screen.main_cgs_cache); + free(TScreenOf(xw)->main_cgs_cache); } #endif diff --git a/app/xterm/charclass.c b/app/xterm/charclass.c index 8452842f8..675ef1738 100644 --- a/app/xterm/charclass.c +++ b/app/xterm/charclass.c @@ -1,4 +1,4 @@ -/* $XTermId: charclass.c,v 1.21 2008/12/30 17:35:09 tom Exp $ */ +/* $XTermId: charclass.c,v 1.22 2009/11/05 23:46:15 tom Exp $ */ /* * Compact and efficient reimplementation of the @@ -51,7 +51,8 @@ SetCharacterClassRange(int low, int high, int value) /* make sure we have at least one free entry left at table end */ if (classtab[0].last > classtab[0].cclass - 2) { classtab[0].cclass += 5 + classtab[0].cclass / 4; - classtab = TypeRealloc(struct classentry, (unsigned) classtab[0].cclass, classtab); + classtab = TypeRealloc(struct classentry, + (unsigned) classtab[0].cclass, classtab); if (!classtab) abort(); } @@ -77,7 +78,7 @@ init_classtab(void) { const int size = 50; - classtab = TypeMallocN(struct classentry, size); + classtab = TypeMallocN(struct classentry, (unsigned) size); if (!classtab) abort(); classtab[0].cclass = size; diff --git a/app/xterm/charproc.c b/app/xterm/charproc.c index c65f55c51..42b530a4e 100644 --- a/app/xterm/charproc.c +++ b/app/xterm/charproc.c @@ -1,8 +1,8 @@ -/* $XTermId: charproc.c,v 1.980 2009/10/11 23:48:30 tom Exp $ */ +/* $XTermId: charproc.c,v 1.1033 2010/01/20 01:59:19 tom Exp $ */ /* -Copyright 1999-2008,2009 by Thomas E. Dickey +Copyright 1999-2009,2010 by Thomas E. Dickey All Rights Reserved @@ -132,28 +132,44 @@ in this Software without prior written authorization from The Open Group. #include <charclass.h> #include <xstrings.h> +typedef struct { + const char *name; + int code; +} FlagList; + +typedef void (*BitFunc) (unsigned * /* p */ , + unsigned /* mask */ ); + static IChar doinput(void); -static int set_character_class(char *s); +static int set_character_class(char * /*s */ ); static void FromAlternate(XtermWidget /* xw */ ); -static void RequestResize(XtermWidget termw, int rows, int cols, Bool text); -static void SwitchBufs(XtermWidget xw); +static void RequestResize(XtermWidget /* xw */ , + int /* rows */ , + int /* cols */ , + Bool /* text */ ); +static void SwitchBufs(XtermWidget /* xw */ , + int /* toBuf */ ); static void ToAlternate(XtermWidget /* xw */ ); static void ansi_modes(XtermWidget termw, - void (*func) (unsigned *p, unsigned mask)); + 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 void dpmodes(XtermWidget termw, void (*func) (unsigned *p, unsigned mask)); -static void restoremodes(XtermWidget termw); -static void savemodes(XtermWidget termw); -static void window_ops(XtermWidget termw); +static void dpmodes(XtermWidget /* xw */ , + BitFunc /* func */ ); +static void restoremodes(XtermWidget /* xw */ ); +static void savemodes(XtermWidget /* xw */ ); +static void window_ops(XtermWidget /* xw */ ); #define DoStartBlinking(s) ((s)->cursor_blink ^ (s)->cursor_blink_esc) #if OPT_BLINK_CURS || OPT_BLINK_TEXT -static void HandleBlinking(XtPointer closure, XtIntervalId * id); -static void StartBlinking(TScreen * screen); -static void StopBlinking(TScreen * screen); +static void SetCursorBlink(TScreen * /* screen */ , + Bool /* enable */ ); +static void HandleBlinking(XtPointer /* closure */ , + XtIntervalId * /* id */ ); +static void StartBlinking(TScreen * /* screen */ ); +static void StopBlinking(TScreen * /* screen */ ); #else #define StartBlinking(screen) /* nothing */ #define StopBlinking(screen) /* nothing */ @@ -319,6 +335,7 @@ static XtActionsRec actionsList[] = { { "set-logging", HandleLogging }, #endif #if OPT_ALLOW_XXX_OPS + { "allow-color-ops", HandleAllowColorOps }, { "allow-font-ops", HandleAllowFontOps }, { "allow-tcap-ops", HandleAllowTcapOps }, { "allow-title-ops", HandleAllowTitleOps }, @@ -397,6 +414,7 @@ static XtActionsRec actionsList[] = { static XtResource xterm_resources[] = { Bres(XtNallowSendEvents, XtCAllowSendEvents, screen.allowSendEvent0, False), + Bres(XtNallowColorOps, XtCAllowColorOps, screen.allowColorOp0, DEF_ALLOW_COLOR), Bres(XtNallowFontOps, XtCAllowFontOps, screen.allowFontOp0, DEF_ALLOW_FONT), Bres(XtNallowTcapOps, XtCAllowTcapOps, screen.allowTcapOp0, DEF_ALLOW_TCAP), Bres(XtNallowTitleOps, XtCAllowTitleOps, screen.allowTitleOp0, DEF_ALLOW_TITLE), @@ -441,6 +459,7 @@ static XtResource xterm_resources[] = Bres(XtNprinterAutoClose, XtCPrinterAutoClose, screen.printer_autoclose, False), Bres(XtNprinterExtent, XtCPrinterExtent, screen.printer_extent, False), Bres(XtNprinterFormFeed, XtCPrinterFormFeed, screen.printer_formfeed, False), + Bres(XtNprinterNewLine, XtCPrinterNewLine, screen.printer_newline, True), Bres(XtNquietGrab, XtCQuietGrab, screen.quiet_grab, False), Bres(XtNreverseVideo, XtCReverseVideo, misc.re_verse, False), Bres(XtNreverseWrap, XtCReverseWrap, misc.reverseWrap, False), @@ -465,6 +484,7 @@ static XtResource xterm_resources[] = Ires(XtNpointerMode, XtCPointerMode, screen.pointer_mode, DEF_POINTER_MODE), Ires(XtNprinterControlMode, XtCPrinterControlMode, screen.printer_controlmode, 0), + Ires(XtNtitleModes, XtCTitleModes, screen.title_modes, DEF_TITLE_MODES), Ires(XtNvisualBellDelay, XtCVisualBellDelay, screen.visualBellDelay, 100), Ires(XtNsaveLines, XtCSaveLines, screen.savelines, SAVELINES), Ires(XtNscrollBarBorder, XtCScrollBarBorder, screen.scrollBarBorder, 1), @@ -483,6 +503,14 @@ static XtResource xterm_resources[] = Sres(XtNcharClass, XtCCharClass, screen.charClass, NULL), Sres(XtNdecTerminalID, XtCDecTerminalID, screen.term_id, DFT_DECID), Sres(XtNdefaultString, XtCDefaultString, screen.default_string, "#"), + Sres(XtNdisallowedColorOps, XtCDisallowedColorOps, + screen.disallowedColorOps, DEF_DISALLOWED_COLOR), + Sres(XtNdisallowedFontOps, XtCDisallowedFontOps, + screen.disallowedFontOps, DEF_DISALLOWED_FONT), + Sres(XtNdisallowedTcapOps, XtCDisallowedTcapOps, + screen.disallowedTcapOps, DEF_DISALLOWED_TCAP), + Sres(XtNdisallowedWindowOps, XtCDisallowedWindowOps, + screen.disallowedWinOps, DEF_DISALLOWED_WINDOW), Sres(XtNeightBitSelectTypes, XtCEightBitSelectTypes, screen.eightbit_select_types, NULL), Sres(XtNfont, XtCFont, misc.default_font.f_n, DEFFONT), @@ -607,11 +635,6 @@ static XtResource xterm_resources[] = COLOR_RES("UL", screen.Acolors[COLOR_UL], DFT_COLOR(XtDefaultForeground)), COLOR_RES("RV", screen.Acolors[COLOR_RV], DFT_COLOR(XtDefaultForeground)), - CLICK_RES("2", screen.onClick[1], "word"), - CLICK_RES("3", screen.onClick[2], "line"), - CLICK_RES("4", screen.onClick[3], 0), - CLICK_RES("5", screen.onClick[4], 0), - #if !OPT_COLOR_RES2 #if OPT_256_COLORS # include <256colres.h> @@ -622,6 +645,11 @@ static XtResource xterm_resources[] = #endif /* OPT_ISO_COLORS */ + CLICK_RES("2", screen.onClick[1], "word"), + CLICK_RES("3", screen.onClick[2], "line"), + CLICK_RES("4", screen.onClick[3], 0), + CLICK_RES("5", screen.onClick[4], 0), + #if OPT_MOD_FKEYS Ires(XtNmodifyCursorKeys, XtCModifyCursorKeys, keyboard.modify_1st.cursor_keys, 2), @@ -892,7 +920,7 @@ CheckBogusForeground(TScreen * screen, const char *tag) void SGR_Foreground(XtermWidget xw, int color) { - TScreen *screen = &xw->screen; + TScreen *screen = TScreenOf(xw); Pixel fg; if (color >= 0) { @@ -916,7 +944,7 @@ SGR_Foreground(XtermWidget xw, int color) * could happen due to setting the foreground color just before scrolling. * * Those cells look uncolored, but will confuse ShowCursor(), which looks - * for the colors in the current cell, and will see the foreground color. + * for the colors in the current cell, and will see the foreground color. * In that case, remove the foreground color from the blank cells. */ if (color < 0) { @@ -928,7 +956,7 @@ SGR_Foreground(XtermWidget xw, int color) void SGR_Background(XtermWidget xw, int color) { - TScreen *screen = &xw->screen; + TScreen *screen = TScreenOf(xw); Pixel bg; /* @@ -963,14 +991,9 @@ setExtendedFG(XtermWidget xw) { int fg = xw->sgr_foreground; - if (xw->screen.colorAttrMode + if (TScreenOf(xw)->colorAttrMode || (fg < 0)) { - if (xw->screen.colorULMode && (xw->flags & UNDERLINE)) - fg = COLOR_UL; - if (xw->screen.colorBDMode && (xw->flags & BOLD)) - fg = COLOR_BD; - if (xw->screen.colorBLMode && (xw->flags & BLINK)) - fg = COLOR_BL; + fg = MapToColorMode(fg, TScreenOf(xw), xw->flags); } /* This implements the IBM PC-style convention of 8-colors, with one @@ -979,7 +1002,7 @@ setExtendedFG(XtermWidget xw) * compatiblity with ANSI-color applications. */ #if OPT_PC_COLORS /* XXXJTL should be settable at runtime (resource or OSC?) */ - if (xw->screen.boldColors + if (TScreenOf(xw)->boldColors && (!xw->sgr_extended) && (fg >= 0) && (fg < 8) @@ -998,9 +1021,9 @@ setExtendedBG(XtermWidget xw) { int bg = xw->sgr_background; - if (xw->screen.colorAttrMode + if (TScreenOf(xw)->colorAttrMode || (bg < 0)) { - if (xw->screen.colorRVMode && (xw->flags & INVERSE)) + if (TScreenOf(xw)->colorRVMode && (xw->flags & INVERSE)) bg = COLOR_RV; } @@ -1173,6 +1196,9 @@ which_table(Const PARSE_T * table) else WHICH_TABLE (scs96table); else WHICH_TABLE (scstable); else WHICH_TABLE (sos_table); +#if OPT_BLINK_CURS + else WHICH_TABLE (csi_sp_table); +#endif #if OPT_DEC_LOCATOR else WHICH_TABLE (csi_tick_table); #endif @@ -1285,10 +1311,28 @@ select_charset(struct ParseState *sp, int type, int size) } } +static int +zero_if_default(int which) +{ + int result = (nparam > which) ? param[which] : 0; + if (result <= 0) + result = 0; + return result; +} + +static int +one_if_default(int which) +{ + int result = (nparam > which) ? param[which] : 0; + if (result <= 0) + result = 1; + return result; +} + static Boolean doparsing(XtermWidget xw, unsigned c, struct ParseState *sp) { - TScreen *screen = &xw->screen; + TScreen *screen = TScreenOf(xw); int row; int col; int top; @@ -1752,13 +1796,15 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp) case CASE_ESC_DIGIT: /* digit in csi or dec mode */ - if ((row = param[nparam - 1]) == DEFAULT) - row = 0; - param[nparam - 1] = (10 * row) + ((int) c - '0'); - if (param[nparam - 1] > 65535) - param[nparam - 1] = 65535; - if (sp->parsestate == csi_table) - sp->parsestate = csi2_table; + if (nparam > 0) { + if ((row = param[nparam - 1]) == DEFAULT) + row = 0; + param[nparam - 1] = (10 * row) + ((int) c - '0'); + if (param[nparam - 1] > 65535) + param[nparam - 1] = 65535; + if (sp->parsestate == csi_table) + sp->parsestate = csi2_table; + } break; case CASE_ESC_SEMI: @@ -1919,7 +1965,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp) /* Track mouse as long as in window and between * specified rows */ - start.row = param[2] - 1; + start.row = one_if_default(2) - 1; start.col = param[1] - 1; TrackMouse(xw, param[0], @@ -2458,6 +2504,56 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp) sp->parsestate = csi_quo_table; break; +#if OPT_BLINK_CURS + case CASE_CSI_SPACE_STATE: + sp->parsestate = csi_sp_table; + break; + + case CASE_DECSCUSR: + TRACE(("CASE_DECSCUSR\n")); + { + Boolean change = True; + Boolean blinks = screen->cursor_blink; + + HideCursor(); + + switch (param[0]) { + case 0: + case 1: + case DEFAULT: + /* blinking block */ + screen->cursor_underline = False; + blinks = True; + break; + case 2: + /* steady block */ + screen->cursor_underline = False; + blinks = False; + break; + case 3: + /* blinking underline */ + screen->cursor_underline = True; + blinks = True; + break; + case 4: + /* steady underline */ + screen->cursor_underline = True; + blinks = False; + break; + default: + change = False; + break; + } + + if (change) { + xtermSetCursorBox(screen); + SetCursorBlink(screen, blinks); + } + } + sp->parsestate = sp->groundtable; + break; +#endif + #if OPT_VT52_MODE case CASE_VT52_FINISH: TRACE(("CASE_VT52_FINISH terminal_id %d, vtXX_level %d\n", @@ -2505,10 +2601,15 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp) VTReset(xw, False, False); screen->vtXX_level = param[0] - 60; if (param[0] > 61) { - if (param[1] == 1) + switch (zero_if_default(1)) { + case 1: show_8bit_control(False); - else if (param[1] == 0 || param[1] == 2) + break; + case 0: + case 2: show_8bit_control(True); + break; + } } } sp->parsestate = sp->groundtable; @@ -2930,8 +3031,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp) case CASE_XTERM_WINOPS: TRACE(("CASE_XTERM_WINOPS\n")); - if (AllowWindowOps(xw)) - window_ops(xw); + window_ops(xw); sp->parsestate = sp->groundtable; break; #if OPT_WIDE_CHARS @@ -2991,9 +3091,83 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp) } break; + case CASE_SM_TITLE: + TRACE(("CASE_SM_TITLE\n")); + if (nparam >= 1) { + int n; + for (n = 0; n < nparam; ++n) { + if (param[n] != DEFAULT) + screen->title_modes |= (1 << param[n]); + } + } else { + screen->title_modes = DEF_TITLE_MODES; + } + TRACE(("...title_modes %#x\n", screen->title_modes)); + break; + + case CASE_RM_TITLE: + TRACE(("CASE_RM_TITLE\n")); + if (nparam >= 1) { + int n; + for (n = 0; n < nparam; ++n) { + if (param[n] != DEFAULT) + screen->title_modes &= ~(1 << param[n]); + } + } else { + screen->title_modes = DEF_TITLE_MODES; + } + TRACE(("...title_modes %#x\n", screen->title_modes)); + break; + case CASE_CSI_IGNORE: sp->parsestate = cigtable; break; + + case CASE_DECSWBV: + TRACE(("CASE_DECSWBV\n")); + switch ((nparam >= 1) ? param[0] : DEFAULT) { + case 2: + case 3: + case 4: + screen->warningVolume = bvLow; + break; + case 5: + case 6: + case 7: + case 8: + screen->warningVolume = bvHigh; + break; + default: + screen->warningVolume = bvOff; + break; + } + TRACE(("...warningVolume %d\n", screen->warningVolume)); + sp->parsestate = sp->groundtable; + break; + + case CASE_DECSMBV: + TRACE(("CASE_DECSMBV\n")); + switch ((nparam >= 1) ? param[0] : DEFAULT) { + case 2: + case 3: + case 4: + screen->marginVolume = bvLow; + break; + case 0: + case DEFAULT: + case 5: + case 6: + case 7: + case 8: + screen->marginVolume = bvHigh; + break; + default: + screen->marginVolume = bvOff; + break; + } + TRACE(("...marginVolume %d\n", screen->marginVolume)); + sp->parsestate = sp->groundtable; + break; } if (sp->parsestate == sp->groundtable) sp->lastchar = thischar; @@ -3014,7 +3188,7 @@ VTparse(XtermWidget xw) /* We longjmp back to this point in VTReset() */ (void) setjmp(vtjmpbuf); - screen = &xw->screen; + screen = TScreenOf(xw); memset(&myState, 0, sizeof(myState)); myState.scssize = 94; /* number of printable/nonspace ASCII */ myState.lastchar = -1; /* not a legal IChar */ @@ -3041,6 +3215,7 @@ v_write(int f, Char * data, unsigned len) int riten; unsigned c = len; + TRACE2(("v_write(%d:%s)\n", len, visibleChars(data, len))); if (v_bufstr == NULL && len > 0) { v_buffer = (Char *) XtMalloc((Cardinal) len); v_bufstr = v_buffer; @@ -3076,7 +3251,7 @@ v_write(int f, Char * data, unsigned len) if (len > 0) { #if OPT_DABBREV - term->screen.dabbrev_working = False; /* break dabbrev sequence */ + TScreenOf(term)->dabbrev_working = False; /* break dabbrev sequence */ #endif if (v_bufend < v_bufptr + len) { /* we've run out of room */ if (v_bufstr != v_buffer) { @@ -3213,7 +3388,7 @@ in_put(XtermWidget xw) Dimension replyWidth, replyHeight; XtGeometryResult stat; - TScreen *screen = &xw->screen; + TScreen *screen = TScreenOf(xw); char *cp; int i; @@ -3296,7 +3471,7 @@ in_put(XtermWidget xw) static PtySelect select_mask; static PtySelect write_mask; - TScreen *screen = &xw->screen; + TScreen *screen = TScreenOf(xw); int i, time_select; int size; int update = VTbuffer->update; @@ -3486,7 +3661,7 @@ PreeditPosition(TScreen * screen) static void WrapLine(XtermWidget xw) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); LineData *ld = getLineData(screen, screen->cur_row); if (ld != 0) { @@ -3508,7 +3683,7 @@ dotext(XtermWidget xw, IChar * buf, /* start of characters to process */ Cardinal len) /* end */ { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); #if OPT_WIDE_CHARS Cardinal chars_chomped = 1; int next_col = screen->cur_col; @@ -3650,7 +3825,7 @@ visual_width(IChar * str, Cardinal len) #endif #if HANDLE_STRUCT_NOTIFY -/* Flag icon name with "***" on window output when iconified. +/* Flag icon name with "***" on window output when iconified. */ static void HandleStructNotify(Widget w GCC_UNUSED, @@ -3707,8 +3882,8 @@ HandleStructNotify(Widget w GCC_UNUSED, * The notification is for the top-level widget, but we care about * vt100 (ignore the tek4014 window). */ - if (xw->screen.Vshow) { - VTwin *Vwin = WhichVWin(&(xw->screen)); + if (TScreenOf(xw)->Vshow) { + VTwin *Vwin = WhichVWin(TScreenOf(xw)); TbInfo *info = &(Vwin->tb_info); TbInfo save = *info; @@ -3784,8 +3959,7 @@ ToggleCursorBlink(TScreen * screen) * process ANSI modes set, reset */ static void -ansi_modes(XtermWidget xw, - void (*func) (unsigned *p, unsigned mask)) +ansi_modes(XtermWidget xw, BitFunc func) { int i; @@ -3821,8 +3995,8 @@ really_set_mousemode(XtermWidget xw, Bool enabled, XtermMouseModes mode) { - xw->screen.send_mouse_pos = enabled ? mode : MOUSE_OFF; - if (xw->screen.send_mouse_pos != MOUSE_OFF) + TScreenOf(xw)->send_mouse_pos = enabled ? mode : MOUSE_OFF; + if (TScreenOf(xw)->send_mouse_pos != MOUSE_OFF) xtermShowPointer(xw, True); } @@ -3839,10 +4013,9 @@ really_set_mousemode(XtermWidget xw, * process DEC private modes set, reset */ static void -dpmodes(XtermWidget xw, - void (*func) (unsigned *p, unsigned mask)) +dpmodes(XtermWidget xw, BitFunc func) { - TScreen *screen = &xw->screen; + TScreen *screen = TScreenOf(xw); int i, j; unsigned myflags; @@ -3978,7 +4151,7 @@ dpmodes(XtermWidget xw, case 44: /* margin bell */ set_bool_mode(screen->marginbell); if (!screen->marginbell) - screen->bellarmed = -1; + screen->bellArmed = -1; update_marginbell(); break; case 45: /* reverse wraparound */ @@ -4081,7 +4254,7 @@ dpmodes(XtermWidget xw, update_scrollkey(); break; case 1034: - set_bool_mode(xw->screen.input_eight_bits); + set_bool_mode(TScreenOf(xw)->input_eight_bits); update_alt_esc(); break; #if OPT_NUM_LOCK @@ -4186,7 +4359,7 @@ dpmodes(XtermWidget xw, static void savemodes(XtermWidget xw) { - TScreen *screen = &xw->screen; + TScreen *screen = TScreenOf(xw); int i; for (i = 0; i < nparam; i++) { @@ -4309,7 +4482,7 @@ savemodes(XtermWidget xw) static void restoremodes(XtermWidget xw) { - TScreen *screen = &xw->screen; + TScreen *screen = TScreenOf(xw); int i, j; for (i = 0; i < nparam; i++) { @@ -4398,7 +4571,7 @@ restoremodes(XtermWidget xw) break; case 44: /* margin bell */ if ((DoRM(DP_X_MARGIN, screen->marginbell)) == 0) - screen->bellarmed = -1; + screen->bellArmed = -1; update_marginbell(); break; case 45: /* reverse wraparound */ @@ -4472,35 +4645,115 @@ restoremodes(XtermWidget xw) } /* + * Convert an XTextProperty to a string. + * + * This frees the data owned by the XTextProperty, and returns in its place the + * string, which must be freed by the caller. + */ +static char * +property_to_string(XtermWidget xw, XTextProperty * text) +{ + TScreen *screen = TScreenOf(xw); + Display *dpy = screen->display; + char *result = 0; + char **list; + int length = 0; + int rc; + + TRACE(("property_to_string value %p, encoding %s, format %d, nitems %ld\n", + text->value, + XGetAtomName(dpy, text->encoding), + text->format, + text->nitems)); + +#if OPT_WIDE_CHARS + /* + * We will use the XmbTextPropertyToTextList call to extract UTF-8 data. + * The xtermUtf8ToTextList() call is used to convert UTF-8 explicitly to + * ISO-8859-1. + */ + if ((text->format != 8) + || IsTitleMode(xw, tmGetUtf8) + || (rc = xtermUtf8ToTextList(xw, text, &list, &length)) < 0) +#endif + if ((rc = XmbTextPropertyToTextList(dpy, text, &list, &length)) < 0) + rc = XTextPropertyToStringList(text, &list, &length); + + if (rc >= 0) { + int n, c, pass; + size_t need = 0; + + for (pass = 0; pass < 2; ++pass) { + for (n = 0, need = 0; n < length; n++) { + char *s = list[n]; + while ((c = *s++) != '\0') { + if (pass) + result[need] = (char) c; + ++need; + } + } + if (pass) + result[need] = '\0'; + else + result = malloc(need + 1); + if (result == 0) + break; + } + XFreeStringList(list); + } + if (text->value != 0) + XFree(text->value); + + return result; +} + +static char * +get_icon_label(XtermWidget xw) +{ + XTextProperty text; + char *result = 0; + + if (XGetWMIconName(TScreenOf(xw)->display, VShellWindow, &text)) { + result = property_to_string(xw, &text); + } + return result; +} + +static char * +get_window_label(XtermWidget xw) +{ + XTextProperty text; + char *result = 0; + + if (XGetWMName(TScreenOf(xw)->display, VShellWindow, &text)) { + result = property_to_string(xw, &text); + } + return result; +} + +/* * Report window label (icon or title) in dtterm protocol * ESC ] code label ESC backslash */ static void report_win_label(XtermWidget xw, int code, - XTextProperty * text, - Status ok) + char *text) { - char **list; - int length = 0; - reply.a_type = ANSI_ESC; unparseputc(xw, ANSI_ESC); unparseputc(xw, ']'); unparseputc(xw, code); - if (ok) { - if (XTextPropertyToStringList(text, &list, &length)) { - int n, c; - for (n = 0; n < length; n++) { - char *s = list[n]; - while ((c = *s++) != '\0') - unparseputc(xw, c); - } - XFreeStringList(list); + if (text != 0) { + int copy = IsTitleMode(xw, tmGetBase16); + if (copy) { + TRACE(("Encoding hex:%s\n", text)); + text = x_encode_hex(text); } - if (text->value != 0) - XFree(text->value); + unparseputs(xw, text); + if (copy) + free(text); } unparseputc(xw, ANSI_ESC); @@ -4515,10 +4768,9 @@ report_win_label(XtermWidget xw, static void window_ops(XtermWidget xw) { - TScreen *screen = &xw->screen; + TScreen *screen = TScreenOf(xw); XWindowChanges values; XWindowAttributes win_attrs; - XTextProperty text; unsigned value_mask; #if OPT_MAXIMIZE unsigned root_width; @@ -4527,156 +4779,252 @@ window_ops(XtermWidget xw) TRACE(("window_ops %d\n", param[0])); switch (param[0]) { - case 1: /* Restore (de-iconify) window */ - TRACE(("...de-iconify window\n")); - XMapWindow(screen->display, - VShellWindow); + case ewRestoreWin: /* Restore (de-iconify) window */ + if (AllowWindowOps(xw, ewRestoreWin)) { + TRACE(("...de-iconify window\n")); + XMapWindow(screen->display, + VShellWindow); + } break; - case 2: /* Minimize (iconify) window */ - TRACE(("...iconify window\n")); - XIconifyWindow(screen->display, - VShellWindow, - DefaultScreen(screen->display)); + case ewMinimizeWin: /* Minimize (iconify) window */ + if (AllowWindowOps(xw, ewMinimizeWin)) { + TRACE(("...iconify window\n")); + XIconifyWindow(screen->display, + VShellWindow, + DefaultScreen(screen->display)); + } break; - case 3: /* Move the window to the given position */ - TRACE(("...move window to %d,%d\n", param[1], param[2])); - values.x = param[1]; - values.y = param[2]; - value_mask = (CWX | CWY); - XReconfigureWMWindow(screen->display, - VShellWindow, - DefaultScreen(screen->display), - value_mask, - &values); + case ewSetWinPosition: /* Move the window to the given position */ + if (AllowWindowOps(xw, ewSetWinPosition)) { + values.x = zero_if_default(1); + values.y = zero_if_default(2); + TRACE(("...move window to %d,%d\n", values.x, values.y)); + value_mask = (CWX | CWY); + XReconfigureWMWindow(screen->display, + VShellWindow, + DefaultScreen(screen->display), + value_mask, + &values); + } break; - case 4: /* Resize the window to given size in pixels */ - RequestResize(xw, param[1], param[2], False); + case ewSetWinSizePixels: /* Resize the window to given size in pixels */ + if (AllowWindowOps(xw, ewSetWinSizePixels)) { + RequestResize(xw, zero_if_default(1), zero_if_default(2), False); + } break; - case 5: /* Raise the window to the front of the stack */ - TRACE(("...raise window\n")); - XRaiseWindow(screen->display, VShellWindow); + case ewRaiseWin: /* Raise the window to the front of the stack */ + if (AllowWindowOps(xw, ewRaiseWin)) { + TRACE(("...raise window\n")); + XRaiseWindow(screen->display, VShellWindow); + } break; - case 6: /* Lower the window to the bottom of the stack */ - TRACE(("...lower window\n")); - XLowerWindow(screen->display, VShellWindow); + case ewLowerWin: /* Lower the window to the bottom of the stack */ + if (AllowWindowOps(xw, ewLowerWin)) { + TRACE(("...lower window\n")); + XLowerWindow(screen->display, VShellWindow); + } break; - case 7: /* Refresh the window */ - TRACE(("...redraw window\n")); - Redraw(); + case ewRefreshWin: /* Refresh the window */ + if (AllowWindowOps(xw, ewRefreshWin)) { + TRACE(("...redraw window\n")); + Redraw(); + } break; - case 8: /* Resize the text-area, in characters */ - RequestResize(xw, param[1], param[2], True); + case ewSetWinSizeChars: /* Resize the text-area, in characters */ + if (AllowWindowOps(xw, ewSetWinSizeChars)) { + RequestResize(xw, zero_if_default(1), zero_if_default(2), True); + } break; #if OPT_MAXIMIZE - case 9: /* Maximize or restore */ - RequestMaximize(xw, param[1]); + case ewMaximizeWin: /* Maximize or restore */ + if (AllowWindowOps(xw, ewMaximizeWin)) { + RequestMaximize(xw, zero_if_default(1)); + } break; #endif - case 11: /* Report the window's state */ - TRACE(("...get window attributes\n")); - XGetWindowAttributes(screen->display, - VWindow(screen), - &win_attrs); - reply.a_type = ANSI_CSI; - reply.a_pintro = 0; - reply.a_nparam = 1; - reply.a_param[0] = (ParmType) ((win_attrs.map_state == IsViewable) - ? 1 - : 2); - reply.a_inters = 0; - reply.a_final = 't'; - unparseseq(xw, &reply); + case ewGetWinState: /* Report the window's state */ + if (AllowWindowOps(xw, ewGetWinState)) { + TRACE(("...get window attributes\n")); + XGetWindowAttributes(screen->display, + VWindow(screen), + &win_attrs); + reply.a_type = ANSI_CSI; + reply.a_pintro = 0; + reply.a_nparam = 1; + reply.a_param[0] = (ParmType) ((win_attrs.map_state == IsViewable) + ? 1 + : 2); + reply.a_inters = 0; + reply.a_final = 't'; + unparseseq(xw, &reply); + } break; - case 13: /* Report the window's position */ - TRACE(("...get window position\n")); - XGetWindowAttributes(screen->display, - WMFrameWindow(xw), - &win_attrs); - reply.a_type = ANSI_CSI; - reply.a_pintro = 0; - reply.a_nparam = 3; - reply.a_param[0] = 3; - reply.a_param[1] = (ParmType) win_attrs.x; - reply.a_param[2] = (ParmType) win_attrs.y; - reply.a_inters = 0; - reply.a_final = 't'; - unparseseq(xw, &reply); + case ewGetWinPosition: /* Report the window's position */ + if (AllowWindowOps(xw, ewGetWinPosition)) { + TRACE(("...get window position\n")); + XGetWindowAttributes(screen->display, + WMFrameWindow(xw), + &win_attrs); + reply.a_type = ANSI_CSI; + reply.a_pintro = 0; + reply.a_nparam = 3; + reply.a_param[0] = 3; + reply.a_param[1] = (ParmType) win_attrs.x; + reply.a_param[2] = (ParmType) win_attrs.y; + reply.a_inters = 0; + reply.a_final = 't'; + unparseseq(xw, &reply); + } break; - case 14: /* Report the window's size in pixels */ - TRACE(("...get window size in pixels\n")); - XGetWindowAttributes(screen->display, - VWindow(screen), - &win_attrs); - reply.a_type = ANSI_CSI; - reply.a_pintro = 0; - reply.a_nparam = 3; - reply.a_param[0] = 4; - /*FIXME: find if dtterm uses - * win_attrs.height or Height - * win_attrs.width or Width - */ - reply.a_param[1] = (ParmType) Height(screen); - reply.a_param[2] = (ParmType) Width(screen); - reply.a_inters = 0; - reply.a_final = 't'; - unparseseq(xw, &reply); + case ewGetWinSizePixels: /* Report the window's size in pixels */ + if (AllowWindowOps(xw, ewGetWinSizePixels)) { + TRACE(("...get window size in pixels\n")); + XGetWindowAttributes(screen->display, + VWindow(screen), + &win_attrs); + reply.a_type = ANSI_CSI; + reply.a_pintro = 0; + reply.a_nparam = 3; + reply.a_param[0] = 4; + /*FIXME: find if dtterm uses + * win_attrs.height or Height + * win_attrs.width or Width + */ + reply.a_param[1] = (ParmType) Height(screen); + reply.a_param[2] = (ParmType) Width(screen); + reply.a_inters = 0; + reply.a_final = 't'; + unparseseq(xw, &reply); + } break; - case 18: /* Report the text's size in characters */ - TRACE(("...get window size in characters\n")); - reply.a_type = ANSI_CSI; - reply.a_pintro = 0; - reply.a_nparam = 3; - reply.a_param[0] = 8; - reply.a_param[1] = (ParmType) MaxRows(screen); - reply.a_param[2] = (ParmType) MaxCols(screen); - reply.a_inters = 0; - reply.a_final = 't'; - unparseseq(xw, &reply); + case ewGetWinSizeChars: /* Report the text's size in characters */ + if (AllowWindowOps(xw, ewGetWinSizeChars)) { + TRACE(("...get window size in characters\n")); + reply.a_type = ANSI_CSI; + reply.a_pintro = 0; + reply.a_nparam = 3; + reply.a_param[0] = 8; + reply.a_param[1] = (ParmType) MaxRows(screen); + reply.a_param[2] = (ParmType) MaxCols(screen); + reply.a_inters = 0; + reply.a_final = 't'; + unparseseq(xw, &reply); + } break; #if OPT_MAXIMIZE - case 19: /* Report the screen's size, in characters */ - if (!QueryMaximize(xw, &root_height, &root_width)) { - root_height = 0; - root_width = 0; + case ewGetScreenSizeChars: /* Report the screen's size, in characters */ + if (AllowWindowOps(xw, ewGetScreenSizeChars)) { + TRACE(("...get screen size in characters\n")); + if (!QueryMaximize(xw, &root_height, &root_width)) { + root_height = 0; + root_width = 0; + } + reply.a_type = ANSI_CSI; + reply.a_pintro = 0; + reply.a_nparam = 3; + reply.a_param[0] = 9; + reply.a_param[1] = (ParmType) (root_height / FontHeight(screen)); + reply.a_param[2] = (ParmType) (root_width / FontWidth(screen)); + reply.a_inters = 0; + reply.a_final = 't'; + unparseseq(xw, &reply); } - reply.a_type = ANSI_CSI; - reply.a_pintro = 0; - reply.a_nparam = 3; - reply.a_param[0] = 9; - reply.a_param[1] = (ParmType) (root_height / FontHeight(screen)); - reply.a_param[2] = (ParmType) (root_width / FontWidth(screen)); - reply.a_inters = 0; - reply.a_final = 't'; - unparseseq(xw, &reply); break; #endif - case 20: /* Report the icon's label */ - report_win_label(xw, 'L', &text, - XGetWMIconName(screen->display, VShellWindow, &text)); + case ewGetIconTitle: /* Report the icon's label */ + if (AllowWindowOps(xw, ewGetIconTitle)) { + TRACE(("...get icon's label\n")); + report_win_label(xw, 'L', get_icon_label(xw)); + } break; - case 21: /* Report the window's title */ - report_win_label(xw, 'l', &text, - XGetWMName(screen->display, VShellWindow, &text)); + case ewGetWinTitle: /* Report the window's title */ + if (AllowWindowOps(xw, ewGetWinTitle)) { + TRACE(("...get window's label\n")); + report_win_label(xw, 'l', get_window_label(xw)); + } + break; + + case ewPushTitle: /* save the window's title(s) on stack */ + if (AllowWindowOps(xw, ewPushTitle)) { + SaveTitle *last = screen->save_title; + SaveTitle *item = TypeCalloc(SaveTitle); + + TRACE(("...push title onto stack\n")); + if (item != 0) { + switch (zero_if_default(1)) { + case 0: + item->iconName = get_icon_label(xw); + item->windowName = get_window_label(xw); + break; + case 1: + item->iconName = get_icon_label(xw); + break; + case 2: + item->windowName = get_window_label(xw); + break; + } + item->next = last; + if (item->iconName == 0) { + item->iconName = ((last == 0) + ? get_icon_label(xw) + : x_strdup(last->iconName)); + } + if (item->windowName == 0) { + item->windowName = ((last == 0) + ? get_window_label(xw) + : x_strdup(last->windowName)); + } + screen->save_title = item; + } + } + break; + + case ewPopTitle: /* restore the window's title(s) from stack */ + if (AllowWindowOps(xw, ewPopTitle)) { + SaveTitle *item = screen->save_title; + + TRACE(("...pop title off stack\n")); + if (item != 0) { + switch (zero_if_default(1)) { + case 0: + ChangeIconName(xw, item->iconName); + ChangeTitle(xw, item->windowName); + break; + case 1: + ChangeIconName(xw, item->iconName); + break; + case 2: + ChangeTitle(xw, item->windowName); + break; + } + screen->save_title = item->next; + free(item->iconName); + free(item->windowName); + free(item); + } + } break; default: /* DECSLPP (24, 25, 36, 48, 72, 144) */ - if (param[0] >= 24) - RequestResize(xw, param[0], -1, True); + if (AllowWindowOps(xw, ewSetWinLines)) { + if (param[0] >= 24) + RequestResize(xw, param[0], -1, True); + } break; } } @@ -4713,7 +5061,7 @@ void unparseputc1(XtermWidget xw, int c) { if (c >= 0x80 && c <= 0x9F) { - if (!xw->screen.control_eight_bits) { + if (!TScreenOf(xw)->control_eight_bits) { unparseputc(xw, A2E(ANSI_ESC)); c = A2E(c - 0x40); } @@ -4769,20 +5117,22 @@ unparseputn(XtermWidget xw, unsigned int n) void unparseputs(XtermWidget xw, const char *s) { - while (*s) - unparseputc(xw, *s++); + if (s != 0) { + while (*s) + unparseputc(xw, *s++); + } } void unparseputc(XtermWidget xw, int c) { - IChar *buf = xw->screen.unparse_bfr; + IChar *buf = TScreenOf(xw)->unparse_bfr; unsigned len; - if ((xw->screen.unparse_len + 2) >= sizeof(xw->screen.unparse_bfr)) + if ((TScreenOf(xw)->unparse_len + 2) >= sizeof(TScreenOf(xw)->unparse_bfr)) unparse_end(xw); - len = xw->screen.unparse_len; + len = TScreenOf(xw)->unparse_len; #if OPT_TCAP_QUERY /* @@ -4791,7 +5141,7 @@ unparseputc(XtermWidget xw, int c) * printable ASCII (counting tab, carriage return, etc). For now, * just use hexadecimal for the whole thing. */ - if (xw->screen.tc_query_code >= 0) { + if (TScreenOf(xw)->tc_query_code >= 0) { char tmp[3]; sprintf(tmp, "%02X", c & 0xFF); buf[len++] = CharOf(tmp[0]); @@ -4802,7 +5152,7 @@ unparseputc(XtermWidget xw, int c) buf[len++] = '\n'; } - xw->screen.unparse_len = len; + TScreenOf(xw)->unparse_len = len; /* If send/receive mode is reset, we echo characters locally */ if ((xw->keyboard.flags & MODE_SRM) == 0) { @@ -4813,20 +5163,22 @@ unparseputc(XtermWidget xw, int c) void unparse_end(XtermWidget xw) { - if (xw->screen.unparse_len) { + TScreen *screen = TScreenOf(xw); + + if (screen->unparse_len) { #ifdef VMS - tt_write(xw->screen.unparse_bfr, xw->screen.unparse_len); + tt_write(screen->unparse_bfr, screen->unparse_len); #else /* VMS */ - writePtyData(xw->screen.respond, xw->screen.unparse_bfr, xw->screen.unparse_len); + writePtyData(screen->respond, screen->unparse_bfr, screen->unparse_len); #endif /* VMS */ - xw->screen.unparse_len = 0; + screen->unparse_len = 0; } } void ToggleAlternate(XtermWidget xw) { - if (xw->screen.whichBuf) + if (TScreenOf(xw)->whichBuf) FromAlternate(xw); else ToAlternate(xw); @@ -4835,7 +5187,7 @@ ToggleAlternate(XtermWidget xw) static void ToAlternate(XtermWidget xw) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); if (screen->whichBuf == 0) { TRACE(("ToAlternate\n")); @@ -4844,7 +5196,7 @@ ToAlternate(XtermWidget xw) (unsigned) MaxRows(screen), (unsigned) MaxCols(screen), &screen->editBuf_data[1]); - SwitchBufs(xw); + SwitchBufs(xw, 1); screen->whichBuf = 1; #if OPT_SAVE_LINES screen->visbuf = screen->editBuf_index[screen->whichBuf]; @@ -4856,14 +5208,14 @@ ToAlternate(XtermWidget xw) static void FromAlternate(XtermWidget xw) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); if (screen->whichBuf != 0) { TRACE(("FromAlternate\n")); if (screen->scroll_amt) FlushScroll(xw); screen->whichBuf = 0; - SwitchBufs(xw); + SwitchBufs(xw, 0); #if OPT_SAVE_LINES screen->visbuf = screen->editBuf_index[screen->whichBuf]; #endif @@ -4872,20 +5224,21 @@ FromAlternate(XtermWidget xw) } static void -SwitchBufs(XtermWidget xw) +SwitchBufs(XtermWidget xw, int toBuf) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); int rows, top; if (screen->cursor_state) HideCursor(); rows = MaxRows(screen); - SwitchBufPtrs(screen); + SwitchBufPtrs(screen, toBuf); if ((top = INX2ROW(screen, 0)) < rows) { - if (screen->scroll_amt) + if (screen->scroll_amt) { FlushScroll(xw); + } XClearArea(screen->display, VWindow(screen), (int) OriginX(screen), @@ -4911,11 +5264,11 @@ CheckBufPtrs(TScreen * screen) * Swap buffer line pointers between alternate and regular screens. */ void -SwitchBufPtrs(TScreen * screen) +SwitchBufPtrs(TScreen * screen, int toBuf GCC_UNUSED) { if (CheckBufPtrs(screen)) { #if OPT_SAVE_LINES - screen->visbuf = screen->editBuf_index[screen->whichBuf]; + screen->visbuf = screen->editBuf_index[toBuf]; #else size_t len = ScrnPointers(screen, (unsigned) MaxRows(screen)); @@ -5032,7 +5385,7 @@ VTResize(Widget w) static void RequestResize(XtermWidget xw, int rows, int cols, Bool text) { - TScreen *screen = &xw->screen; + TScreen *screen = TScreenOf(xw); unsigned long value; Dimension replyWidth, replyHeight; Dimension askedWidth, askedHeight; @@ -5041,8 +5394,8 @@ RequestResize(XtermWidget xw, int rows, int cols, Bool text) TRACE(("RequestResize(rows=%d, cols=%d, text=%d)\n", rows, cols, text)); - if ((askedWidth = (Dimension) cols) < cols - || (askedHeight = (Dimension) rows) < rows) + if ((int) (askedWidth = (Dimension) cols) < cols + || (int) (askedHeight = (Dimension) rows) < rows) return; if (askedHeight == 0 @@ -5087,11 +5440,11 @@ RequestResize(XtermWidget xw, int rows, int cols, Bool text) if (xw->misc.limit_resize > 0) { Dimension high = (Dimension) (xw->misc.limit_resize * attrs.height); Dimension wide = (Dimension) (xw->misc.limit_resize * attrs.width); - if (high < attrs.height) + if ((int) high < attrs.height) high = (Dimension) attrs.height; if (askedHeight > high) askedHeight = high; - if (wide < attrs.width) + if ((int) wide < attrs.width) wide = (Dimension) attrs.width; if (askedWidth > wide) askedWidth = wide; @@ -5215,122 +5568,123 @@ fill_Tres(XtermWidget target, XtermWidget source, int offset) char *name; ScrnColors temp; - target->screen.Tcolors[offset] = source->screen.Tcolors[offset]; - target->screen.Tcolors[offset].mode = False; + TScreenOf(target)->Tcolors[offset] = TScreenOf(source)->Tcolors[offset]; + TScreenOf(target)->Tcolors[offset].mode = False; - if ((name = x_strtrim(target->screen.Tcolors[offset].resource)) != 0) - target->screen.Tcolors[offset].resource = name; + if ((name = x_strtrim(TScreenOf(target)->Tcolors[offset].resource)) != 0) + TScreenOf(target)->Tcolors[offset].resource = name; if (name == 0) { - target->screen.Tcolors[offset].value = target->dft_foreground; + TScreenOf(target)->Tcolors[offset].value = target->dft_foreground; } else if (isDefaultForeground(name)) { - target->screen.Tcolors[offset].value = + TScreenOf(target)->Tcolors[offset].value = ((offset == TEXT_FG || offset == TEXT_BG) ? target->dft_foreground - : target->screen.Tcolors[TEXT_FG].value); + : TScreenOf(target)->Tcolors[TEXT_FG].value); } else if (isDefaultBackground(name)) { - target->screen.Tcolors[offset].value = + TScreenOf(target)->Tcolors[offset].value = ((offset == TEXT_FG || offset == TEXT_BG) ? target->dft_background - : target->screen.Tcolors[TEXT_BG].value); + : TScreenOf(target)->Tcolors[TEXT_BG].value); } else { memset(&temp, 0, sizeof(temp)); if (AllocateTermColor(target, &temp, offset, name)) { if (COLOR_DEFINED(&(temp), offset)) free(temp.names[offset]); - target->screen.Tcolors[offset].value = temp.colors[offset]; + TScreenOf(target)->Tcolors[offset].value = temp.colors[offset]; } } - return target->screen.Tcolors[offset].value; + return TScreenOf(target)->Tcolors[offset].value; } #else #define fill_Tres(target, source, offset) \ - target->screen.Tcolors[offset] = source->screen.Tcolors[offset] + TScreenOf(target)->Tcolors[offset] = TScreenOf(source)->Tcolors[offset] #endif #if OPT_WIDE_CHARS static void -VTInitialize_locale(XtermWidget request) +VTInitialize_locale(XtermWidget xw) { + TScreen *screen = TScreenOf(xw); Bool is_utf8 = xtermEnvUTF8(); TRACE(("VTInitialize_locale\n")); - TRACE(("... request screen.utf8_mode = %d\n", request->screen.utf8_mode)); + TRACE(("... request screen.utf8_mode = %d\n", screen->utf8_mode)); - if (request->screen.utf8_mode < 0) - request->screen.utf8_mode = uFalse; + if (screen->utf8_mode < 0) + screen->utf8_mode = uFalse; - if (request->screen.utf8_mode > 3) - request->screen.utf8_mode = uDefault; + if (screen->utf8_mode > 3) + screen->utf8_mode = uDefault; - request->screen.latin9_mode = 0; - request->screen.unicode_font = 0; + screen->latin9_mode = 0; + screen->unicode_font = 0; #if OPT_LUIT_PROG - request->misc.callfilter = 0; - request->misc.use_encoding = 0; + xw->misc.callfilter = 0; + xw->misc.use_encoding = 0; TRACE(("... setup for luit:\n")); - TRACE(("... request misc.locale_str = \"%s\"\n", request->misc.locale_str)); + TRACE(("... request misc.locale_str = \"%s\"\n", xw->misc.locale_str)); - if (request->screen.utf8_mode == uFalse) { + if (screen->utf8_mode == uFalse) { TRACE(("... command-line +u8 overrides\n")); } else #if OPT_MINI_LUIT - if (x_strcasecmp(request->misc.locale_str, "CHECKFONT") == 0) { - int fl = (request->misc.default_font.f_n - ? (int) strlen(request->misc.default_font.f_n) + if (x_strcasecmp(xw->misc.locale_str, "CHECKFONT") == 0) { + int fl = (xw->misc.default_font.f_n + ? (int) strlen(xw->misc.default_font.f_n) : 0); if (fl > 11 - && x_strcasecmp(request->misc.default_font.f_n + fl - 11, + && x_strcasecmp(xw->misc.default_font.f_n + fl - 11, "-ISO10646-1") == 0) { - request->screen.unicode_font = 1; + screen->unicode_font = 1; /* unicode font, use True */ #ifdef HAVE_LANGINFO_CODESET if (!strcmp(xtermEnvEncoding(), "ANSI_X3.4-1968") || !strcmp(xtermEnvEncoding(), "ISO-8859-1")) { - if (request->screen.utf8_mode == uDefault) - request->screen.utf8_mode = uFalse; + if (screen->utf8_mode == uDefault) + screen->utf8_mode = uFalse; } else if (!strcmp(xtermEnvEncoding(), "ISO-8859-15")) { - if (request->screen.utf8_mode == uDefault) - request->screen.utf8_mode = uFalse; - request->screen.latin9_mode = 1; + if (screen->utf8_mode == uDefault) + screen->utf8_mode = uFalse; + screen->latin9_mode = 1; } else { - request->misc.callfilter = (Boolean) (is_utf8 ? 0 : 1); - request->screen.utf8_mode = uAlways; + xw->misc.callfilter = (Boolean) (is_utf8 ? 0 : 1); + screen->utf8_mode = uAlways; } #else - request->misc.callfilter = is_utf8 ? 0 : 1; - request->screen.utf8_mode = uAlways; + xw->misc.callfilter = is_utf8 ? 0 : 1; + screen->utf8_mode = uAlways; #endif } else { /* other encoding, use False */ - if (request->screen.utf8_mode == uDefault) { - request->screen.utf8_mode = is_utf8 ? uAlways : uFalse; + if (screen->utf8_mode == uDefault) { + screen->utf8_mode = is_utf8 ? uAlways : uFalse; } } } else #endif /* OPT_MINI_LUIT */ - if (x_strcasecmp(request->misc.locale_str, "TRUE") == 0 || - x_strcasecmp(request->misc.locale_str, "ON") == 0 || - x_strcasecmp(request->misc.locale_str, "YES") == 0 || - x_strcasecmp(request->misc.locale_str, "AUTO") == 0 || - strcmp(request->misc.locale_str, "1") == 0) { + if (x_strcasecmp(xw->misc.locale_str, "TRUE") == 0 || + x_strcasecmp(xw->misc.locale_str, "ON") == 0 || + x_strcasecmp(xw->misc.locale_str, "YES") == 0 || + x_strcasecmp(xw->misc.locale_str, "AUTO") == 0 || + strcmp(xw->misc.locale_str, "1") == 0) { /* when true ... fully obeying LC_CTYPE locale */ - request->misc.callfilter = (Boolean) (is_utf8 ? 0 : 1); - request->screen.utf8_mode = uAlways; - } else if (x_strcasecmp(request->misc.locale_str, "FALSE") == 0 || - x_strcasecmp(request->misc.locale_str, "OFF") == 0 || - x_strcasecmp(request->misc.locale_str, "NO") == 0 || - strcmp(request->misc.locale_str, "0") == 0) { + xw->misc.callfilter = (Boolean) (is_utf8 ? 0 : 1); + screen->utf8_mode = uAlways; + } else if (x_strcasecmp(xw->misc.locale_str, "FALSE") == 0 || + x_strcasecmp(xw->misc.locale_str, "OFF") == 0 || + x_strcasecmp(xw->misc.locale_str, "NO") == 0 || + strcmp(xw->misc.locale_str, "0") == 0) { /* when false ... original value of utf8_mode is effective */ - if (request->screen.utf8_mode == uDefault) { - request->screen.utf8_mode = is_utf8 ? uAlways : uFalse; + if (screen->utf8_mode == uDefault) { + screen->utf8_mode = is_utf8 ? uAlways : uFalse; } - } else if (x_strcasecmp(request->misc.locale_str, "MEDIUM") == 0 || - x_strcasecmp(request->misc.locale_str, "SEMIAUTO") == 0) { + } else if (x_strcasecmp(xw->misc.locale_str, "MEDIUM") == 0 || + x_strcasecmp(xw->misc.locale_str, "SEMIAUTO") == 0) { /* when medium ... obeying locale only for UTF-8 and Asian */ if (is_utf8) { - request->screen.utf8_mode = uAlways; + screen->utf8_mode = uAlways; } else if ( #ifdef MB_CUR_MAX MB_CUR_MAX > 1 || @@ -5341,32 +5695,32 @@ VTInitialize_locale(XtermWidget request) #endif !strncmp(xtermEnvLocale(), "th", 2) || !strncmp(xtermEnvLocale(), "vi", 2)) { - request->misc.callfilter = 1; - request->screen.utf8_mode = uAlways; + xw->misc.callfilter = 1; + screen->utf8_mode = uAlways; } else { - request->screen.utf8_mode = uFalse; + screen->utf8_mode = uFalse; } - } else if (x_strcasecmp(request->misc.locale_str, "UTF-8") == 0 || - x_strcasecmp(request->misc.locale_str, "UTF8") == 0) { + } else if (x_strcasecmp(xw->misc.locale_str, "UTF-8") == 0 || + x_strcasecmp(xw->misc.locale_str, "UTF8") == 0) { /* when UTF-8 ... UTF-8 mode */ - request->screen.utf8_mode = uAlways; + screen->utf8_mode = uAlways; } else { /* other words are regarded as encoding name passed to luit */ - request->misc.callfilter = 1; - request->screen.utf8_mode = uAlways; - request->misc.use_encoding = 1; + xw->misc.callfilter = 1; + screen->utf8_mode = uAlways; + xw->misc.use_encoding = 1; } - TRACE(("... updated misc.callfilter = %s\n", BtoS(request->misc.callfilter))); - TRACE(("... updated misc.use_encoding = %s\n", BtoS(request->misc.use_encoding))); + TRACE(("... updated misc.callfilter = %s\n", BtoS(xw->misc.callfilter))); + TRACE(("... updated misc.use_encoding = %s\n", BtoS(xw->misc.use_encoding))); #else - if (request->screen.utf8_mode == uDefault) { - request->screen.utf8_mode = is_utf8 ? uAlways : uFalse; + if (screen->utf8_mode == uDefault) { + screen->utf8_mode = is_utf8 ? uAlways : uFalse; } #endif /* OPT_LUIT_PROG */ - request->screen.utf8_inparse = (Boolean) (request->screen.utf8_mode != uFalse); + screen->utf8_inparse = (Boolean) (screen->utf8_mode != uFalse); - TRACE(("... updated screen.utf8_mode = %d\n", request->screen.utf8_mode)); + TRACE(("... updated screen.utf8_mode = %d\n", screen->utf8_mode)); TRACE(("...VTInitialize_locale done\n")); } #endif @@ -5391,18 +5745,18 @@ ParseOnClicks(XtermWidget wnew, XtermWidget wreq, Cardinal item) }; /* *INDENT-ON* */ - String res = wreq->screen.onClick[item]; + String res = TScreenOf(wreq)->onClick[item]; String next = x_skip_nonblanks(res); Cardinal n; - wnew->screen.selectMap[item] = NSELECTUNITS; + TScreenOf(wnew)->selectMap[item] = NSELECTUNITS; for (n = 0; n < XtNumber(table); ++n) { if (!x_strncasecmp(table[n].name, res, (unsigned) (next - res))) { - wnew->screen.selectMap[item] = table[n].code; + TScreenOf(wnew)->selectMap[item] = table[n].code; #if OPT_SELECT_REGEX if (table[n].code == Select_REGEX) { - wnew->screen.selectExpr[item] = x_strtrim(next); - TRACE(("Parsed regex \"%s\"\n", wnew->screen.selectExpr[item])); + TScreenOf(wnew)->selectExpr[item] = x_strtrim(next); + TRACE(("Parsed regex \"%s\"\n", TScreenOf(wnew)->selectExpr[item])); } #endif break; @@ -5410,6 +5764,90 @@ ParseOnClicks(XtermWidget wnew, XtermWidget wreq, Cardinal item) } } +/* + * Parse a comma-separated list, returning a string which the caller must + * free, and updating the source pointer. + */ +static char * +ParseList(const char **source) +{ + const char *base = *source; + const char *next; + unsigned size; + char *value = 0; + char *result; + + /* ignore empty values */ + while (*base == ',') + ++base; + if (*base != '\0') { + next = base; + while (*next != '\0' && *next != ',') + ++next; + size = (unsigned) (1 + next - base); + value = malloc(size); + if (value != 0) { + memcpy(value, base, size); + value[size - 1] = '\0'; + } + *source = next; + } else { + *source = base; + } + result = x_strtrim(value); + free(value); + return result; +} + +static void +set_flags_from_list(char *target, + const char *source, + FlagList * list, + Cardinal limit) +{ + Cardinal n; + int value; + + while (*source != '\0') { + char *next = ParseList(&source); + Boolean found = False; + + if (next == 0) + break; + if (isdigit(CharOf(*next))) { + char *temp; + + value = (int) strtol(next, &temp, 0); + if (!IsEmpty(temp)) { + fprintf(stderr, "Expected a number: %s\n", next); + } else { + for (n = 0; n < limit; ++n) { + if (list[n].code == value) { + target[value] = 1; + found = True; + break; + } + } + } + } else { + for (n = 0; n < limit; ++n) { + if (!x_strcasecmp(next, list[n].name)) { + value = list[n].code; + target[value] = 1; + found = True; + break; + } + } + } + if (!found) { + fprintf(stderr, "Unrecognized keyword: %s\n", next); + } else { + TRACE(("...found %s (%d)\n", next, value)); + } + free(next); + } +} + /* ARGSUSED */ static void VTInitialize(Widget wrequest, @@ -5417,12 +5855,69 @@ VTInitialize(Widget wrequest, ArgList args GCC_UNUSED, Cardinal *num_args GCC_UNUSED) { -#define Kolor(name) wnew->screen.name.resource +#define Kolor(name) TScreenOf(wnew)->name.resource #define TxtFg(name) !x_strcasecmp(Kolor(Tcolors[TEXT_FG]), Kolor(name)) #define TxtBg(name) !x_strcasecmp(Kolor(Tcolors[TEXT_BG]), Kolor(name)) #define DftFg(name) isDefaultForeground(Kolor(name)) #define DftBg(name) isDefaultBackground(Kolor(name)) +#define DATA(name) { #name, ec##name } + static FlagList tblColorOps[] = + { + DATA(SetColor) + ,DATA(GetColor) + ,DATA(GetAnsiColor) + }; +#undef DATA + +#define DATA(name) { #name, ef##name } + static FlagList tblFontOps[] = + { + DATA(SetFont) + ,DATA(GetFont) + }; +#undef DATA + +#define DATA(name) { #name, et##name } + static FlagList tblTcapOps[] = + { + DATA(SetTcap) + ,DATA(GetTcap) + }; +#undef DATA + +#define DATA(name) { #name, ew##name } + static FlagList tblWindowOps[] = + { + DATA(RestoreWin) + ,DATA(MinimizeWin) + ,DATA(SetWinPosition) + ,DATA(SetWinSizePixels) + ,DATA(RaiseWin) + ,DATA(LowerWin) + ,DATA(RefreshWin) + ,DATA(SetWinSizeChars) +#if OPT_MAXIMIZE + ,DATA(MaximizeWin) +#endif + ,DATA(GetWinState) + ,DATA(GetWinPosition) + ,DATA(GetWinSizePixels) + ,DATA(GetWinSizeChars) +#if OPT_MAXIMIZE + ,DATA(GetScreenSizeChars) +#endif + ,DATA(GetIconTitle) + ,DATA(GetWinTitle) + ,DATA(PushTitle) + ,DATA(PopTitle) + ,DATA(SetWinLines) + ,DATA(SetXprop) + ,DATA(GetSelection) + ,DATA(SetSelection) + }; +#undef DATA + XtermWidget request = (XtermWidget) wrequest; XtermWidget wnew = (XtermWidget) new_arg; Widget my_parent = SHELL_OF(wnew); @@ -5444,14 +5939,15 @@ VTInitialize(Widget wrequest, }; #endif /* OPT_COLOR_RES2 */ - TRACE(("VTInitialize %d / %d\n", XtNumber(xterm_resources), MAXRESOURCES)); + TRACE(("VTInitialize wnew %p, %d / %d resources\n", + (void *) wnew, XtNumber(xterm_resources), MAXRESOURCES)); assert(XtNumber(xterm_resources) < MAXRESOURCES); /* Zero out the entire "screen" component of "wnew" widget, then do * field-by-field assignment of "screen" fields that are named in the * resource list. */ - memset(&wnew->screen, 0, sizeof(wnew->screen)); + memset(TScreenOf(wnew), 0, sizeof(wnew->screen)); /* DESCO Sys#67660 * Zero out the entire "keyboard" component of "wnew" widget. @@ -5470,7 +5966,7 @@ VTInitialize(Widget wrequest, * XtDefaultForeground and XtDefaultBackground. So, we no longer * need to do anything special. */ - wnew->screen.display = wnew->core.screen->display; + TScreenOf(wnew)->display = wnew->core.screen->display; /* * We use the default foreground/background colors to compare/check if a @@ -5480,11 +5976,11 @@ VTInitialize(Widget wrequest, #define MyWhitePixel(dpy) WhitePixel(dpy,DefaultScreen(dpy)) if (request->misc.re_verse) { - wnew->dft_foreground = MyWhitePixel(wnew->screen.display); - wnew->dft_background = MyBlackPixel(wnew->screen.display); + wnew->dft_foreground = MyWhitePixel(TScreenOf(wnew)->display); + wnew->dft_background = MyBlackPixel(TScreenOf(wnew)->display); } else { - wnew->dft_foreground = MyBlackPixel(wnew->screen.display); - wnew->dft_background = MyWhitePixel(wnew->screen.display); + wnew->dft_foreground = MyBlackPixel(TScreenOf(wnew)->display); + wnew->dft_background = MyWhitePixel(TScreenOf(wnew)->display); } init_Tres(TEXT_FG); init_Tres(TEXT_BG); @@ -5492,12 +5988,12 @@ VTInitialize(Widget wrequest, TRACE(("Color resource initialization:\n")); TRACE((" Default foreground %#lx\n", wnew->dft_foreground)); TRACE((" Default background %#lx\n", wnew->dft_background)); - TRACE((" Screen foreground %#lx\n", T_COLOR(&(wnew->screen), TEXT_FG))); - TRACE((" Screen background %#lx\n", T_COLOR(&(wnew->screen), TEXT_BG))); + TRACE((" Screen foreground %#lx\n", T_COLOR(TScreenOf(wnew), TEXT_FG))); + TRACE((" Screen background %#lx\n", T_COLOR(TScreenOf(wnew), TEXT_BG))); - wnew->screen.mouse_button = -1; - wnew->screen.mouse_row = -1; - wnew->screen.mouse_col = -1; + TScreenOf(wnew)->mouse_button = -1; + TScreenOf(wnew)->mouse_row = -1; + TScreenOf(wnew)->mouse_col = -1; #if OPT_BOX_CHARS init_Bres(screen.force_box_chars); @@ -5519,7 +6015,7 @@ VTInitialize(Widget wrequest, init_Bres(screen.cursor_blink); init_Ires(screen.blink_on); init_Ires(screen.blink_off); - wnew->screen.cursor_blink_res = wnew->screen.cursor_blink; + TScreenOf(wnew)->cursor_blink_res = TScreenOf(wnew)->cursor_blink; #endif init_Bres(screen.cursor_underline); #if OPT_BLINK_TEXT @@ -5530,7 +6026,7 @@ VTInitialize(Widget wrequest, init_Bres(screen.fastscroll); init_Bres(screen.old_fkeys); init_Bres(screen.delete_is_del); - wnew->keyboard.type = wnew->screen.old_fkeys + wnew->keyboard.type = TScreenOf(wnew)->old_fkeys ? keyboardIsLegacy : keyboardIsDefault; #ifdef ALLOWLOGGING @@ -5548,24 +6044,27 @@ VTInitialize(Widget wrequest, init_Bres(screen.scrollkey); init_Sres(screen.term_id); - for (s = request->screen.term_id; *s; s++) { + for (s = TScreenOf(request)->term_id; *s; s++) { if (!isalpha(CharOf(*s))) break; } - wnew->screen.terminal_id = atoi(s); - if (wnew->screen.terminal_id < MIN_DECID) - wnew->screen.terminal_id = MIN_DECID; - if (wnew->screen.terminal_id > MAX_DECID) - wnew->screen.terminal_id = MAX_DECID; + TScreenOf(wnew)->terminal_id = atoi(s); + if (TScreenOf(wnew)->terminal_id < MIN_DECID) + TScreenOf(wnew)->terminal_id = MIN_DECID; + if (TScreenOf(wnew)->terminal_id > MAX_DECID) + TScreenOf(wnew)->terminal_id = MAX_DECID; TRACE(("term_id '%s' -> terminal_id %d\n", - wnew->screen.term_id, - wnew->screen.terminal_id)); + TScreenOf(wnew)->term_id, + TScreenOf(wnew)->terminal_id)); - wnew->screen.vtXX_level = (wnew->screen.terminal_id / 100); + TScreenOf(wnew)->vtXX_level = (TScreenOf(wnew)->terminal_id / 100); + + init_Ires(screen.title_modes); init_Bres(screen.visualbell); init_Ires(screen.visualBellDelay); init_Bres(screen.poponbell); init_Ires(misc.limit_resize); + #if OPT_NUM_LOCK init_Bres(misc.real_NumLock); init_Bres(misc.alwaysUseMods); @@ -5574,6 +6073,7 @@ VTInitialize(Widget wrequest, wnew->misc.meta_mods = 0; wnew->misc.other_mods = 0; #endif + #if OPT_SHIFT_FONTS init_Bres(misc.shift_fonts); #endif @@ -5587,7 +6087,7 @@ VTInitialize(Widget wrequest, init_Bres(misc.TekEmu); #endif #if OPT_TCAP_QUERY - wnew->screen.tc_query_code = -1; + TScreenOf(wnew)->tc_query_code = -1; #endif wnew->misc.re_verse0 = request->misc.re_verse; init_Bres(misc.re_verse); @@ -5605,7 +6105,7 @@ VTInitialize(Widget wrequest, init_Bres(screen.selectToClipboard); init_Bres(screen.trim_selection); - wnew->screen.pointer_cursor = request->screen.pointer_cursor; + TScreenOf(wnew)->pointer_cursor = TScreenOf(request)->pointer_cursor; init_Ires(screen.pointer_mode); init_Sres(screen.answer_back); @@ -5614,6 +6114,7 @@ VTInitialize(Widget wrequest, init_Bres(screen.printer_autoclose); init_Bres(screen.printer_extent); init_Bres(screen.printer_formfeed); + init_Bres(screen.printer_newline); init_Ires(screen.printer_controlmode); #if OPT_PRINT_COLORS init_Ires(screen.print_attributes); @@ -5630,11 +6131,40 @@ VTInitialize(Widget wrequest, init_Bres(screen.meta_sends_esc); init_Bres(screen.allowSendEvent0); + init_Bres(screen.allowColorOp0); init_Bres(screen.allowFontOp0); init_Bres(screen.allowTcapOp0); init_Bres(screen.allowTitleOp0); init_Bres(screen.allowWindowOp0); + init_Sres(screen.disallowedColorOps); + + set_flags_from_list(TScreenOf(wnew)->disallow_color_ops, + TScreenOf(wnew)->disallowedColorOps, + tblColorOps, + ecLAST); + + init_Sres(screen.disallowedFontOps); + + set_flags_from_list(TScreenOf(wnew)->disallow_font_ops, + TScreenOf(wnew)->disallowedFontOps, + tblFontOps, + efLAST); + + init_Sres(screen.disallowedTcapOps); + + set_flags_from_list(TScreenOf(wnew)->disallow_tcap_ops, + TScreenOf(wnew)->disallowedTcapOps, + tblTcapOps, + etLAST); + + init_Sres(screen.disallowedWinOps); + + set_flags_from_list(TScreenOf(wnew)->disallow_win_ops, + TScreenOf(wnew)->disallowedWinOps, + tblWindowOps, + ewLAST); + init_Sres(screen.default_string); init_Sres(screen.eightbit_select_types); #if OPT_WIDE_CHARS @@ -5642,16 +6172,17 @@ VTInitialize(Widget wrequest, #endif /* make a copy so that editres cannot change the resource after startup */ - wnew->screen.allowSendEvents = wnew->screen.allowSendEvent0; - wnew->screen.allowFontOps = wnew->screen.allowFontOp0; - wnew->screen.allowTcapOps = wnew->screen.allowTcapOp0; - wnew->screen.allowTitleOps = wnew->screen.allowTitleOp0; - wnew->screen.allowWindowOps = wnew->screen.allowWindowOp0; + TScreenOf(wnew)->allowSendEvents = TScreenOf(wnew)->allowSendEvent0; + TScreenOf(wnew)->allowColorOps = TScreenOf(wnew)->allowColorOp0; + TScreenOf(wnew)->allowFontOps = TScreenOf(wnew)->allowFontOp0; + TScreenOf(wnew)->allowTcapOps = TScreenOf(wnew)->allowTcapOp0; + TScreenOf(wnew)->allowTitleOps = TScreenOf(wnew)->allowTitleOp0; + TScreenOf(wnew)->allowWindowOps = TScreenOf(wnew)->allowWindowOp0; init_Bres(screen.quiet_grab); #ifndef NO_ACTIVE_ICON - wnew->screen.fnt_icon.fs = request->screen.fnt_icon.fs; + TScreenOf(wnew)->fnt_icon.fs = TScreenOf(request)->fnt_icon.fs; init_Bres(misc.active_icon); init_Ires(misc.icon_border_width); wnew->misc.icon_border_pixel = request->misc.icon_border_pixel; @@ -5663,22 +6194,22 @@ VTInitialize(Widget wrequest, init_Sres2(screen.MenuFontName, i); } init_Ires(misc.fontWarnings); -#define DefaultFontNames wnew->screen.menu_font_names[fontMenu_default] +#define DefaultFontNames TScreenOf(wnew)->menu_font_names[fontMenu_default] DefaultFontNames[fNorm] = wnew->misc.default_font.f_n; DefaultFontNames[fBold] = wnew->misc.default_font.f_b; #if OPT_WIDE_CHARS DefaultFontNames[fWide] = wnew->misc.default_font.f_w; DefaultFontNames[fWBold] = wnew->misc.default_font.f_wb; #endif - wnew->screen.MenuFontName(fontMenu_fontescape) = NULL; - wnew->screen.MenuFontName(fontMenu_fontsel) = NULL; + TScreenOf(wnew)->MenuFontName(fontMenu_fontescape) = NULL; + TScreenOf(wnew)->MenuFontName(fontMenu_fontsel) = NULL; - wnew->screen.menu_font_number = fontMenu_default; + TScreenOf(wnew)->menu_font_number = fontMenu_default; init_Sres(screen.initial_font); - if (wnew->screen.initial_font != 0) { - int result = xtermGetFont(wnew->screen.initial_font); + if (TScreenOf(wnew)->initial_font != 0) { + int result = xtermGetFont(TScreenOf(wnew)->initial_font); if (result >= 0) - wnew->screen.menu_font_number = result; + TScreenOf(wnew)->menu_font_number = result; } #if OPT_BROKEN_OSC init_Bres(screen.brokenLinuxOSC); @@ -5699,13 +6230,13 @@ VTInitialize(Widget wrequest, #if OPT_DEC_CHRSET init_Bres(screen.font_doublesize); init_Ires(screen.cache_doublesize); - if (wnew->screen.cache_doublesize > NUM_CHRSET) - wnew->screen.cache_doublesize = NUM_CHRSET; - if (wnew->screen.cache_doublesize == 0) - wnew->screen.font_doublesize = False; + if (TScreenOf(wnew)->cache_doublesize > NUM_CHRSET) + TScreenOf(wnew)->cache_doublesize = NUM_CHRSET; + if (TScreenOf(wnew)->cache_doublesize == 0) + TScreenOf(wnew)->font_doublesize = False; TRACE(("Doublesize%s enabled, up to %d fonts\n", - wnew->screen.font_doublesize ? "" : " not", - wnew->screen.cache_doublesize)); + TScreenOf(wnew)->font_doublesize ? "" : " not", + TScreenOf(wnew)->cache_doublesize)); #endif #if OPT_ISO_COLORS @@ -5737,31 +6268,31 @@ VTInitialize(Widget wrequest, * can be overridden to make these true resources. */ if (i >= MIN_ANSI_COLORS && i < NUM_ANSI_COLORS) { - wnew->screen.Acolors[i].resource + TScreenOf(wnew)->Acolors[i].resource = ((char *) fake_resources[i - MIN_ANSI_COLORS].default_addr); - if (wnew->screen.Acolors[i].resource == 0) - wnew->screen.Acolors[i].resource = XtDefaultForeground; + if (TScreenOf(wnew)->Acolors[i].resource == 0) + TScreenOf(wnew)->Acolors[i].resource = XtDefaultForeground; } else #endif /* OPT_COLOR_RES2 */ - wnew->screen.Acolors[i] = request->screen.Acolors[i]; + TScreenOf(wnew)->Acolors[i] = TScreenOf(request)->Acolors[i]; #if OPT_COLOR_RES - TRACE(("Acolors[%d] = %s\n", i, wnew->screen.Acolors[i].resource)); - wnew->screen.Acolors[i].mode = False; + TRACE(("Acolors[%d] = %s\n", i, TScreenOf(wnew)->Acolors[i].resource)); + TScreenOf(wnew)->Acolors[i].mode = False; if (DftFg(Acolors[i])) { - wnew->screen.Acolors[i].value = T_COLOR(&(wnew->screen), TEXT_FG); - wnew->screen.Acolors[i].mode = True; + TScreenOf(wnew)->Acolors[i].value = T_COLOR(TScreenOf(wnew), TEXT_FG); + TScreenOf(wnew)->Acolors[i].mode = True; } else if (DftBg(Acolors[i])) { - wnew->screen.Acolors[i].value = T_COLOR(&(wnew->screen), TEXT_BG); - wnew->screen.Acolors[i].mode = True; + TScreenOf(wnew)->Acolors[i].value = T_COLOR(TScreenOf(wnew), TEXT_BG); + TScreenOf(wnew)->Acolors[i].mode = True; } else { color_ok = True; } #else - TRACE(("Acolors[%d] = %#lx\n", i, request->screen.Acolors[i])); - if (wnew->screen.Acolors[i] != wnew->dft_foreground && - wnew->screen.Acolors[i] != T_COLOR(&(wnew->screen), TEXT_FG) && - wnew->screen.Acolors[i] != T_COLOR(&(wnew->screen), TEXT_BG)) + TRACE(("Acolors[%d] = %#lx\n", i, TScreenOf(request)->Acolors[i])); + if (TScreenOf(wnew)->Acolors[i] != wnew->dft_foreground && + TScreenOf(wnew)->Acolors[i] != T_COLOR(TScreenOf(wnew), TEXT_FG) && + TScreenOf(wnew)->Acolors[i] != T_COLOR(TScreenOf(wnew), TEXT_BG)) color_ok = True; #endif } @@ -5773,7 +6304,7 @@ VTInitialize(Widget wrequest, * specific. */ if (color_ok) { - Display *display = wnew->screen.display; + Display *display = TScreenOf(wnew)->display; XVisualInfo myTemplate, *visInfoPtr; int numFound; @@ -5797,7 +6328,7 @@ VTInitialize(Widget wrequest, * the resource lookup failed versus the user having misconfigured this). */ if (!color_ok) { - wnew->screen.colorMode = False; + TScreenOf(wnew)->colorMode = False; TRACE(("All colors are foreground or background: disable colorMode\n")); } wnew->sgr_foreground = -1; @@ -5812,22 +6343,22 @@ VTInitialize(Widget wrequest, */ for (i = 0; i < NSELECTUNITS; ++i) { int ck = (i + 1); - wnew->screen.maxClicks = ck; + TScreenOf(wnew)->maxClicks = ck; if (i == Select_CHAR) - wnew->screen.selectMap[i] = Select_CHAR; - else if (request->screen.onClick[i] != 0) + TScreenOf(wnew)->selectMap[i] = Select_CHAR; + else if (TScreenOf(request)->onClick[i] != 0) ParseOnClicks(wnew, request, (unsigned) i); else if (i <= Select_LINE) - wnew->screen.selectMap[i] = (SelectUnit) i; + TScreenOf(wnew)->selectMap[i] = (SelectUnit) i; else break; TRACE(("on%dClicks %s=%d\n", ck, - NonNull(request->screen.onClick[i]), - wnew->screen.selectMap[i])); - if (wnew->screen.selectMap[i] == NSELECTUNITS) + NonNull(TScreenOf(request)->onClick[i]), + TScreenOf(wnew)->selectMap[i])); + if (TScreenOf(wnew)->selectMap[i] == NSELECTUNITS) break; } - TRACE(("maxClicks %d\n", wnew->screen.maxClicks)); + TRACE(("maxClicks %d\n", TScreenOf(wnew)->maxClicks)); init_Tres(MOUSE_FG); init_Tres(MOUSE_BG); @@ -5837,8 +6368,8 @@ VTInitialize(Widget wrequest, init_Tres(HIGHLIGHT_FG); init_Bres(screen.hilite_reverse); init_Bres(screen.hilite_color); - if (wnew->screen.hilite_color == Maybe) { - wnew->screen.hilite_color = False; + if (TScreenOf(wnew)->hilite_color == Maybe) { + TScreenOf(wnew)->hilite_color = False; #if OPT_COLOR_RES /* * If the highlight text/background are both set, and if they are @@ -5852,7 +6383,7 @@ VTInitialize(Widget wrequest, && !TxtBg(Tcolors[HIGHLIGHT_BG]) && !TxtFg(Tcolors[HIGHLIGHT_FG])) { TRACE(("...setting hilite_color automatically\n")); - wnew->screen.hilite_color = True; + TScreenOf(wnew)->hilite_color = True; } #endif } @@ -5866,9 +6397,9 @@ VTInitialize(Widget wrequest, * set its dynamic colors and get consistent behavior whether or not the * window is displayed. */ - T_COLOR(&(wnew->screen), TEK_BG) = T_COLOR(&(wnew->screen), TEXT_BG); - T_COLOR(&(wnew->screen), TEK_FG) = T_COLOR(&(wnew->screen), TEXT_FG); - T_COLOR(&(wnew->screen), TEK_CURSOR) = T_COLOR(&(wnew->screen), TEXT_CURSOR); + TScreenOf(wnew)->Tcolors[TEK_BG] = TScreenOf(wnew)->Tcolors[TEXT_BG]; + TScreenOf(wnew)->Tcolors[TEK_FG] = TScreenOf(wnew)->Tcolors[TEXT_FG]; + TScreenOf(wnew)->Tcolors[TEK_CURSOR] = TScreenOf(wnew)->Tcolors[TEXT_CURSOR]; #endif #if OPT_WIDE_CHARS @@ -5892,7 +6423,7 @@ VTInitialize(Widget wrequest, init_Bres(misc.render_font); /* minor tweak to make debug traces consistent: */ if (wnew->misc.render_font) { - if (wnew->misc.face_name == 0) { + if (IsEmpty(wnew->misc.face_name)) { wnew->misc.render_font = False; TRACE(("reset render_font since there is no face_name\n")); } @@ -5903,11 +6434,11 @@ VTInitialize(Widget wrequest, init_Ires(screen.utf8_mode); init_Ires(screen.max_combining); - if (wnew->screen.max_combining < 0) { - wnew->screen.max_combining = 0; + if (TScreenOf(wnew)->max_combining < 0) { + TScreenOf(wnew)->max_combining = 0; } - if (wnew->screen.max_combining > 5) { - wnew->screen.max_combining = 5; + if (TScreenOf(wnew)->max_combining > 5) { + TScreenOf(wnew)->max_combining = 5; } init_Bres(screen.vt100_graphics); @@ -5928,24 +6459,24 @@ VTInitialize(Widget wrequest, if (wnew->misc.mk_samplepass < 0) wnew->misc.mk_samplepass = 0; - if (request->screen.utf8_mode) { + if (TScreenOf(request)->utf8_mode) { TRACE(("setting wide_chars on\n")); - wnew->screen.wide_chars = True; + TScreenOf(wnew)->wide_chars = True; } else { TRACE(("setting utf8_mode to 0\n")); - wnew->screen.utf8_mode = uFalse; + TScreenOf(wnew)->utf8_mode = uFalse; } - TRACE(("initialized UTF-8 mode to %d\n", wnew->screen.utf8_mode)); + TRACE(("initialized UTF-8 mode to %d\n", TScreenOf(wnew)->utf8_mode)); #if OPT_MINI_LUIT - if (request->screen.latin9_mode) { - wnew->screen.latin9_mode = True; + if (TScreenOf(request)->latin9_mode) { + TScreenOf(wnew)->latin9_mode = True; } - if (request->screen.unicode_font) { - wnew->screen.unicode_font = True; + if (TScreenOf(request)->unicode_font) { + TScreenOf(wnew)->unicode_font = True; } - TRACE(("initialized Latin9 mode to %d\n", wnew->screen.latin9_mode)); - TRACE(("initialized unicode_font to %d\n", wnew->screen.unicode_font)); + TRACE(("initialized Latin9 mode to %d\n", TScreenOf(wnew)->latin9_mode)); + TRACE(("initialized unicode_font to %d\n", TScreenOf(wnew)->unicode_font)); #endif decode_wcwidth((wnew->misc.cjk_width ? 2 : 0) @@ -5963,7 +6494,7 @@ VTInitialize(Widget wrequest, wnew->cur_background = 0; wnew->keyboard.flags = MODE_SRM; - if (wnew->screen.backarrow_key) + if (TScreenOf(wnew)->backarrow_key) wnew->keyboard.flags |= MODE_DECBKM; TRACE(("initialized DECBKM %s\n", BtoS(wnew->keyboard.flags & MODE_DECBKM))); @@ -5971,6 +6502,7 @@ VTInitialize(Widget wrequest, /* look for focus related events on the shell, because we need * to care about the shell's border being part of our focus. */ + TRACE(("adding event handlers for my_parent %p\n", (void *) my_parent)); XtAddEventHandler(my_parent, EnterWindowMask, False, HandleEnterWindow, (Opaque) NULL); XtAddEventHandler(my_parent, LeaveWindowMask, False, @@ -5996,9 +6528,9 @@ VTInitialize(Widget wrequest, HandleStructNotify, (Opaque) 0); #endif /* HANDLE_STRUCT_NOTIFY */ - wnew->screen.bellInProgress = False; + TScreenOf(wnew)->bellInProgress = False; - set_character_class(wnew->screen.charClass); + set_character_class(TScreenOf(wnew)->charClass); /* create it, but don't realize it */ ScrollBarOn(wnew, True); @@ -6007,10 +6539,11 @@ VTInitialize(Widget wrequest, if (!GravityIsNorthWest(wnew) && !GravityIsSouthWest(wnew)) { char value[80]; - char *temp[2]; + String temp[2]; Cardinal nparams = 1; - sprintf(temp[0] = value, "%d", wnew->misc.resizeGravity); + sprintf(value, "%d", wnew->misc.resizeGravity); + temp[0] = value; temp[1] = 0; XtAppWarningMsg(app_con, "rangeError", "resizeGravity", "XTermError", "unsupported resizeGravity resource value (%s)", @@ -6018,16 +6551,16 @@ VTInitialize(Widget wrequest, wnew->misc.resizeGravity = SouthWestGravity; } #ifndef NO_ACTIVE_ICON - wnew->screen.whichVwin = &wnew->screen.fullVwin; + TScreenOf(wnew)->whichVwin = &TScreenOf(wnew)->fullVwin; #endif /* NO_ACTIVE_ICON */ - if (wnew->screen.savelines < 0) - wnew->screen.savelines = 0; + if (TScreenOf(wnew)->savelines < 0) + TScreenOf(wnew)->savelines = 0; init_Bres(screen.awaitInput); wnew->flags = 0; - if (!wnew->screen.jumpscroll) + if (!TScreenOf(wnew)->jumpscroll) wnew->flags |= SMOOTHSCROLL; if (wnew->misc.reverseWrap) wnew->flags |= REVERSEWRAP; @@ -6035,7 +6568,7 @@ VTInitialize(Widget wrequest, wnew->flags |= WRAPAROUND; if (wnew->misc.re_verse != wnew->misc.re_verse0) wnew->flags |= REVERSE_VIDEO; - if (wnew->screen.c132) + if (TScreenOf(wnew)->c132) wnew->flags |= IN132COLUMNS; wnew->initflags = wnew->flags; @@ -6065,7 +6598,7 @@ VTInitialize(Widget wrequest, void releaseCursorGCs(XtermWidget xw) { - TScreen *screen = &xw->screen; + TScreen *screen = TScreenOf(xw); VTwin *win = WhichVWin(screen); int n; @@ -6097,19 +6630,6 @@ releaseWindowGCs(XtermWidget xw, VTwin * win) name = 0; \ } -#ifdef NO_LEAKS -#if OPT_RENDERFONT -static void -xtermCloseXft(TScreen * screen, XTermXftFonts * pub) -{ - if (pub->font != 0) { - XftFontClose(screen->display, pub->font); - pub->font = 0; - } -} -#endif -#endif - #if OPT_INPUT_METHOD static void cleanupInputMethod(TScreen * screen) @@ -6127,7 +6647,7 @@ VTDestroy(Widget w GCC_UNUSED) { #ifdef NO_LEAKS XtermWidget xw = (XtermWidget) w; - TScreen *screen = &xw->screen; + TScreen *screen = TScreenOf(xw); Cardinal n; StopBlinking(screen); @@ -6141,6 +6661,13 @@ VTDestroy(Widget w GCC_UNUSED) deleteScrollback(screen, 0); } #endif + while (screen->save_title != 0) { + SaveTitle *last = screen->save_title; + screen->save_title = last->next; + free(last->iconName); + free(last->windowName); + free(last); + } TRACE_FREE_LEAK(screen->save_ptr); TRACE_FREE_LEAK(screen->saveBuf_data); TRACE_FREE_LEAK(screen->saveBuf_index); @@ -6200,12 +6727,6 @@ VTDestroy(Widget w GCC_UNUSED) } #endif -#if OPT_COLOR_RES - /* free local copies of resource strings */ - for (n = 0; n < NCOLORS; ++n) { - FREE_LEAK(screen->Tcolors[n].resource); - } -#endif #if OPT_SELECT_REGEX for (n = 0; n < NSELECTUNITS; ++n) { FREE_LEAK(screen->selectExpr[n]); @@ -6247,7 +6768,7 @@ VTRealize(Widget w, XSetWindowAttributes * values) { XtermWidget xw = (XtermWidget) w; - TScreen *screen = &xw->screen; + TScreen *screen = TScreenOf(xw); const VTFontNames *myfont; unsigned width, height; @@ -6290,7 +6811,7 @@ VTRealize(Widget w, Exit(1); } #if OPT_WIDE_CHARS - if (xw->screen.utf8_mode) { + if (TScreenOf(xw)->utf8_mode) { TRACE(("check if this is a wide font, if not try again\n")); if (xtermLoadWideFonts(xw, False)) SetVTFont(xw, screen->menu_font_number, True, NULL); @@ -6422,7 +6943,7 @@ VTRealize(Widget w, values->bit_gravity = (GravityIsNorthWest(xw) ? NorthWestGravity : ForgetGravity); - xw->screen.fullVwin.window = XtWindow(xw) = + TScreenOf(xw)->fullVwin.window = XtWindow(xw) = XCreateWindow(XtDisplay(xw), XtWindow(XtParent(xw)), xw->core.x, xw->core.y, xw->core.width, xw->core.height, BorderWidth(xw), @@ -6492,7 +7013,7 @@ VTRealize(Widget w, #if OPT_I18N_SUPPORT && OPT_INPUT_METHOD VTInitI18N(xw); #else - xw->screen.xic = NULL; + TScreenOf(xw)->xic = NULL; #endif #if OPT_NUM_LOCK VTInitModifiers(xw); @@ -6575,7 +7096,7 @@ xim_destroy_cb(XIM im GCC_UNUSED, XPointer client_data GCC_UNUSED, XPointer call_data GCC_UNUSED) { - term->screen.xic = NULL; + TScreenOf(term)->xic = NULL; XRegisterIMInstantiateCallback(XtDisplay(term), NULL, NULL, NULL, xim_instantiate_cb, NULL); @@ -6812,7 +7333,7 @@ VTInitI18N(XtermWidget xw) xim_real_init(xw); #if defined(USE_XIM_INSTANTIATE_CB) - if (xw->screen.xic == NULL + if (TScreenOf(xw)->xic == NULL && !xw->misc.cannot_im && xw->misc.retry_im-- > 0) { sleep(3); @@ -6836,27 +7357,27 @@ VTSetValues(Widget cur, Boolean refresh_needed = False; Boolean fonts_redone = False; - if ((T_COLOR(&(curvt->screen), TEXT_BG) != - T_COLOR(&(newvt->screen), TEXT_BG)) || - (T_COLOR(&(curvt->screen), TEXT_FG) != - T_COLOR(&(newvt->screen), TEXT_FG)) || - (curvt->screen.MenuFontName(curvt->screen.menu_font_number) != - newvt->screen.MenuFontName(newvt->screen.menu_font_number)) || + if ((T_COLOR(TScreenOf(curvt), TEXT_BG) != + T_COLOR(TScreenOf(newvt), TEXT_BG)) || + (T_COLOR(TScreenOf(curvt), TEXT_FG) != + T_COLOR(TScreenOf(newvt), TEXT_FG)) || + (TScreenOf(curvt)->MenuFontName(TScreenOf(curvt)->menu_font_number) != + TScreenOf(newvt)->MenuFontName(TScreenOf(newvt)->menu_font_number)) || (curvt->misc.default_font.f_n != newvt->misc.default_font.f_n)) { if (curvt->misc.default_font.f_n != newvt->misc.default_font.f_n) - newvt->screen.MenuFontName(fontMenu_default) = newvt->misc.default_font.f_n; + TScreenOf(newvt)->MenuFontName(fontMenu_default) = newvt->misc.default_font.f_n; if (xtermLoadFont(newvt, - xtermFontName(newvt->screen.MenuFontName(curvt->screen.menu_font_number)), - True, newvt->screen.menu_font_number)) { + xtermFontName(TScreenOf(newvt)->MenuFontName(TScreenOf(curvt)->menu_font_number)), + True, TScreenOf(newvt)->menu_font_number)) { /* resizing does the redisplay, so don't ask for it here */ refresh_needed = True; fonts_redone = True; } else if (curvt->misc.default_font.f_n != newvt->misc.default_font.f_n) - newvt->screen.MenuFontName(fontMenu_default) = curvt->misc.default_font.f_n; + TScreenOf(newvt)->MenuFontName(fontMenu_default) = curvt->misc.default_font.f_n; } if (!fonts_redone - && (T_COLOR(&(curvt->screen), TEXT_CURSOR) != - T_COLOR(&(newvt->screen), TEXT_CURSOR))) { + && (T_COLOR(TScreenOf(curvt), TEXT_CURSOR) != + T_COLOR(TScreenOf(newvt), TEXT_CURSOR))) { set_cursor_gcs(newvt); refresh_needed = True; } @@ -6867,14 +7388,14 @@ VTSetValues(Widget cur, newvt->misc.re_verse = (Boolean) (!newvt->misc.re_verse); refresh_needed = True; } - if ((T_COLOR(&(curvt->screen), MOUSE_FG) != - T_COLOR(&(newvt->screen), MOUSE_FG)) || - (T_COLOR(&(curvt->screen), MOUSE_BG) != - T_COLOR(&(newvt->screen), MOUSE_BG))) { - recolor_cursor(&(newvt->screen), - newvt->screen.pointer_cursor, - T_COLOR(&(newvt->screen), MOUSE_FG), - T_COLOR(&(newvt->screen), MOUSE_BG)); + if ((T_COLOR(TScreenOf(curvt), MOUSE_FG) != + T_COLOR(TScreenOf(newvt), MOUSE_FG)) || + (T_COLOR(TScreenOf(curvt), MOUSE_BG) != + T_COLOR(TScreenOf(newvt), MOUSE_BG))) { + recolor_cursor(TScreenOf(newvt), + TScreenOf(newvt)->pointer_cursor, + T_COLOR(TScreenOf(newvt), MOUSE_FG), + T_COLOR(TScreenOf(newvt), MOUSE_BG)); refresh_needed = True; } if (curvt->misc.scrollbar != newvt->misc.scrollbar) { @@ -6901,12 +7422,13 @@ void ShowCursor(void) { XtermWidget xw = term; - TScreen *screen = &xw->screen; + TScreen *screen = TScreenOf(xw); int x, y; IChar base; unsigned flags; CellColor fg_bg = 0; GC currentGC; + GC outlineGC; CgsEnum currentCgs = gcMAX; VTwin *currentWin = WhichVWin(screen); int set_at; @@ -7008,6 +7530,7 @@ ShowCursor(void) if_OPT_ISO_COLORS(screen, { fg_bg = ld->color[cursor_col]; }); + fg_pix = getXtermForeground(xw, flags, extract_fg(xw, fg_bg, flags)); bg_pix = getXtermBackground(xw, flags, extract_bg(xw, fg_bg, flags)); @@ -7111,43 +7634,81 @@ ShowCursor(void) && (screen->cursor_state != ON || screen->cursor_GC != set_at)) { screen->cursor_GC = set_at; - TRACE(("ShowCursor calling drawXtermText cur(%d,%d) %s, set_at %d\n", + TRACE(("ShowCursor calling drawXtermText cur(%d,%d) %s-%s, set_at %d\n", screen->cur_row, screen->cur_col, - (filled ? "filled" : "outline"), set_at)); + (filled ? "filled" : "outline"), + (screen->cursor_underline ? "underline" : "box"), + set_at)); currentGC = getCgsGC(xw, currentWin, currentCgs); - drawXtermText(xw, flags & DRAWX_MASK, currentGC, - x = LineCursorX(screen, ld, cursor_col), - y = CursorY(screen, screen->cur_row), - LineCharSet(screen, ld), - &base, 1, 0); + x = LineCursorX(screen, ld, cursor_col); + y = CursorY(screen, screen->cur_row); -#if OPT_WIDE_CHARS - if_OPT_WIDE_CHARS(screen, { - for_each_combData(off, ld) { - if (!(ld->combData[off][my_col])) - break; - drawXtermText(xw, (flags & DRAWX_MASK) | NOBACKGROUND, - currentGC, x, y, - LineCharSet(screen, ld), - ld->combData[off] + my_col, - 1, isWide((int) base)); + if (screen->cursor_underline) { + + /* + * Overriding the combination of filled, reversed, in_selection + * is too complicated since the underline and the text-cell use + * different rules. Just redraw the text-cell, and draw the + * underline on top of it. + */ + HideCursor(); + + /* + * Our current-GC is likely to have been modified in HideCursor(). + * Setup a new request. + */ + if (filled) { + if (T_COLOR(screen, TEXT_CURSOR) == xw->dft_foreground) { + setCgsBack(xw, currentWin, currentCgs, fg_pix); + } + setCgsFore(xw, currentWin, currentCgs, bg_pix); + } else { + setCgsFore(xw, currentWin, currentCgs, fg_pix); + setCgsBack(xw, currentWin, currentCgs, bg_pix); } - }); -#endif - if (!filled) { - GC outlineGC = getCgsGC(xw, currentWin, gcVTcursOutline); + outlineGC = getCgsGC(xw, currentWin, gcVTcursOutline); if (outlineGC == 0) outlineGC = currentGC; + /* + * Finally, draw the underline. + */ screen->box->x = (short) x; - if (!screen->cursor_underline) - screen->box->y = (short) y; - else - screen->box->y = (short) (y + FontHeight(screen) - 2); + screen->box->y = (short) (y + FontHeight(screen) - 2); XDrawLines(screen->display, VWindow(screen), outlineGC, screen->box, NBOX, CoordModePrevious); + } else { + outlineGC = getCgsGC(xw, currentWin, gcVTcursOutline); + if (outlineGC == 0) + outlineGC = currentGC; + + drawXtermText(xw, flags & DRAWX_MASK, + currentGC, x, y, + LineCharSet(screen, ld), + &base, 1, 0); + +#if OPT_WIDE_CHARS + if_OPT_WIDE_CHARS(screen, { + for_each_combData(off, ld) { + if (!(ld->combData[off][my_col])) + break; + drawXtermText(xw, (flags & DRAWX_MASK) | NOBACKGROUND, + currentGC, x, y, + LineCharSet(screen, ld), + ld->combData[off] + my_col, + 1, isWide((int) base)); + } + }); +#endif + + if (!filled) { + screen->box->x = (short) x; + screen->box->y = (short) y; + XDrawLines(screen->display, VWindow(screen), outlineGC, + screen->box, NBOX, CoordModePrevious); + } } } screen->cursor_state = ON; @@ -7162,7 +7723,7 @@ void HideCursor(void) { XtermWidget xw = term; - TScreen *screen = &xw->screen; + TScreen *screen = TScreenOf(xw); GC currentGC; int x, y; IChar base; @@ -7176,7 +7737,7 @@ HideCursor(void) int cursor_col; LineData *ld = 0; - if (screen->cursor_state == OFF) /* FIXME */ + if (screen->cursor_state == OFF) return; if (INX2ROW(screen, screen->cursorp.row) > screen->max_row) return; @@ -7446,7 +8007,9 @@ RestartBlinking(TScreen * screen GCC_UNUSED) void VTReset(XtermWidget xw, Bool full, Bool saved) { - TScreen *screen = &xw->screen; + static char empty[1]; + + TScreen *screen = TScreenOf(xw); if (!XtIsRealized((Widget) xw) || (CURRENT_EMU() != (Widget) xw)) { Bell(XkbBI_MinorError, 0); @@ -7468,6 +8031,8 @@ VTReset(XtermWidget xw, Bool full, Bool saved) if_OPT_ISO_COLORS(screen, { reset_SGR_Colors(xw); + if (ResetAnsiColorRequest(xw, empty, 0)) + xtermRepaint(xw); }); /* Reset character-sets to initial state */ @@ -7501,7 +8066,7 @@ VTReset(XtermWidget xw, Bool full, Bool saved) xw->keyboard.flags |= MODE_DECBKM; else if (xw->keyboard.reset_DECBKM == 2) #endif - if (xw->screen.backarrow_key) + if (TScreenOf(xw)->backarrow_key) xw->keyboard.flags |= MODE_DECBKM; TRACE(("full reset DECBKM %s\n", BtoS(xw->keyboard.flags & MODE_DECBKM))); @@ -7590,7 +8155,7 @@ set_character_class(char *s) int base; /* 8, 10, 16 (octal, decimal, hex) */ int numbers; /* count of numbers per range */ int digits; /* count of digits in a number */ - static char *errfmt = "%s: %s in range string \"%s\" (position %d)\n"; + static const char *errfmt = "%s: %s in range string \"%s\" (position %d)\n"; if (!s || !s[0]) return -1; @@ -7760,7 +8325,7 @@ HandleIgnore(Widget w, { XtermWidget xw; - TRACE(("Handle ignore for %p\n", w)); + TRACE(("Handle ignore for %p\n", (void *) w)); if ((xw = getXtermWidget(w)) != 0) { /* do nothing, but check for funny escape sequences */ (void) SendMousePosition(xw, event); @@ -7783,8 +8348,8 @@ DoSetSelectedFont(Widget w, Bell(XkbBI_MinorError, 0); } else { Boolean failed = False; - int oldFont = xw->screen.menu_font_number; - char *save = xw->screen.MenuFontName(fontMenu_fontsel); + int oldFont = TScreenOf(xw)->menu_font_number; + String save = TScreenOf(xw)->MenuFontName(fontMenu_fontsel); char *val; char *test = 0; char *used = 0; @@ -7813,21 +8378,21 @@ DoSetSelectedFont(Widget w, if (len < 1000 && !strchr(val, '\n') && (test = x_strdup(val)) != 0) { - xw->screen.MenuFontName(fontMenu_fontsel) = test; + TScreenOf(xw)->MenuFontName(fontMenu_fontsel) = test; if (!xtermLoadFont(term, xtermFontName(val), True, fontMenu_fontsel)) { failed = True; free(test); - xw->screen.MenuFontName(fontMenu_fontsel) = save; + TScreenOf(xw)->MenuFontName(fontMenu_fontsel) = save; } } else { failed = True; } if (failed) { (void) xtermLoadFont(term, - xtermFontName(xw->screen.MenuFontName(oldFont)), + xtermFontName(TScreenOf(xw)->MenuFontName(oldFont)), True, oldFont); Bell(XkbBI_MinorError, 0); @@ -7842,7 +8407,7 @@ DoSetSelectedFont(Widget w, void FindFontSelection(XtermWidget xw, const char *atom_name, Bool justprobe) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); static AtomPtr *atoms; unsigned int atomCount = 0; AtomPtr *pAtom; @@ -7882,7 +8447,7 @@ FindFontSelection(XtermWidget xw, const char *atom_name, Bool justprobe) void set_cursor_gcs(XtermWidget xw) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); VTwin *win = WhichVWin(screen); Pixel cc = T_COLOR(screen, TEXT_CURSOR); diff --git a/app/xterm/configure.in b/app/xterm/configure.in index 3fe3c6455..63f7c753a 100644 --- a/app/xterm/configure.in +++ b/app/xterm/configure.in @@ -1,28 +1,35 @@ -dnl $XTermId: configure.in,v 1.253 2009/08/30 21:46:21 tom Exp $ +dnl $XTermId: configure.in,v 1.256 2010/01/04 21:41:10 tom Exp $ dnl -dnl --------------------------------------------------------------------------- -dnl -dnl Copyright 1997-2007,2008 by Thomas E. Dickey +dnl ----------------------------------------------------------------------------- +dnl this file is part of xterm dnl +dnl Copyright 1997-2009,2010 by Thomas E. Dickey +dnl dnl All Rights Reserved -dnl -dnl Permission to use, copy, modify, and distribute this software and its -dnl documentation for any purpose and without fee is hereby granted, -dnl provided that the above copyright notice appear in all copies and that -dnl both that copyright notice and this permission notice appear in -dnl supporting documentation, and that the name of the above listed -dnl copyright holder(s) not be used in advertising or publicity pertaining -dnl to distribution of the software without specific, written prior -dnl permission. -dnl -dnl THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD -dnl TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -dnl AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE -dnl LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -dnl ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -dnl OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -dnl +dnl +dnl Permission is hereby granted, free of charge, to any person obtaining a +dnl copy of this software and associated documentation files (the +dnl "Software"), to deal in the Software without restriction, including +dnl without limitation the rights to use, copy, modify, merge, publish, +dnl distribute, sublicense, and/or sell copies of the Software, and to +dnl permit persons to whom the Software is furnished to do so, subject to +dnl the following conditions: +dnl +dnl The above copyright notice and this permission notice shall be included +dnl in all copies or substantial portions of the Software. +dnl +dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +dnl IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +dnl CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +dnl TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +dnl SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +dnl +dnl Except as contained in this notice, the name(s) of the above copyright +dnl holders shall not be used in advertising or otherwise to promote the +dnl sale, use or other dealings in this Software without prior written +dnl authorization. dnl --------------------------------------------------------------------------- dnl Process this file with autoconf to produce a configure script. dnl @@ -324,32 +331,41 @@ AC_ARG_WITH(terminal-type, AC_MSG_RESULT($default_TERM) AC_DEFINE_UNQUOTED(DFT_TERMTYPE,"$default_TERM") -AC_MSG_CHECKING(for private terminfo-directory) -AC_ARG_WITH(own-terminfo, - [ --with-own-terminfo=P set default $TERMINFO (default: from environment)], - [TERMINFO_DIR=$withval], - [TERMINFO_DIR=${TERMINFO-none}]) -AC_MSG_RESULT($TERMINFO_DIR) -if test "$TERMINFO_DIR" = yes ; then - AC_MSG_WARN(no value given) -elif test "$TERMINFO_DIR" != none ; then - if test -d $TERMINFO_DIR ; then - AC_DEFINE_UNQUOTED(OWN_TERMINFO_DIR,"$TERMINFO_DIR") +AC_CHECK_PROG(cf_tic_prog,tic,yes,no) +if test "$cf_tic_prog" = yes ; then + AC_MSG_CHECKING(for private terminfo-directory) + AC_ARG_WITH(own-terminfo, + [ --with-own-terminfo=P set default $TERMINFO (default: from environment)], + [TERMINFO_DIR=$withval], + [TERMINFO_DIR=${TERMINFO-none}]) + AC_MSG_RESULT($TERMINFO_DIR) + if test "$TERMINFO_DIR" = yes ; then + AC_MSG_WARN(no value given) + elif test "$TERMINFO_DIR" != none ; then + if test -d $TERMINFO_DIR ; then + AC_DEFINE_UNQUOTED(OWN_TERMINFO_DIR,"$TERMINFO_DIR") + else + AC_MSG_WARN(not a directory) + fi + elif test "$prefix" != NONE ; then + TERMINFO_DIR='${prefix}/lib/terminfo' + elif test -d /usr/lib/terminfo ; then + TERMINFO_DIR=/usr/lib/terminfo else - AC_MSG_WARN(not a directory) + TERMINFO_DIR= fi -elif test "$prefix" != NONE ; then - TERMINFO_DIR='${prefix}/lib/terminfo' -elif test -d /usr/lib/terminfo ; then - TERMINFO_DIR=/usr/lib/terminfo + SET_TERMINFO= + if test -n "$TERMINFO_DIR" ; then + TERMINFO_DIR='$(DESTDIR)'$TERMINFO_DIR + SET_TERMINFO='TERMINFO=$(TERMINFO_DIR)' + fi + no_ticprog= else + no_ticprog="#" TERMINFO_DIR= + SET_TERMINFO= fi -SET_TERMINFO= -if test -n "$TERMINFO_DIR" ; then - TERMINFO_DIR='$(DESTDIR)'$TERMINFO_DIR - SET_TERMINFO='TERMINFO=$(TERMINFO_DIR)' -fi +AC_SUBST(no_ticprog) AC_SUBST(TERMINFO_DIR) AC_SUBST(SET_TERMINFO) @@ -698,7 +714,7 @@ if test "$enable_regex" = yes ; then CF_WITH_PCRE if test "$with_pcre" = no ; then CF_REGEX - if test "X$cf_cv_regex" != "Xregex.h" ; then + if test "X$cf_cv_regex_hdrs" != "Xregex.h" ; then AC_MSG_ERROR(Only POSIX or PCRE regular expressions are supported) fi fi diff --git a/app/xterm/ctlseqs.ms b/app/xterm/ctlseqs.ms index 6fdd467a9..0ba3a2548 100644 --- a/app/xterm/ctlseqs.ms +++ b/app/xterm/ctlseqs.ms @@ -1,9 +1,9 @@ .\"#! troff -ms $1 -*- Nroff -*- .\" "Xterm Control Sequences" document -.\" $XTermId: ctlseqs.ms,v 1.191 2009/08/03 21:16:54 tom Exp $ +.\" $XTermId: ctlseqs.ms,v 1.211 2010/01/04 09:12:55 tom Exp $ .\" .\" -.\" Copyright 1996-2007,2008 by Thomas E. Dickey +.\" Copyright 1996-2009,2010 by Thomas E. Dickey .\" .\" All Rights Reserved .\" @@ -288,7 +288,7 @@ X Consortium (1994) Thomas Dickey .AI XFree86 Project (1996-2006) -invisible-island.net (2006-2008) +invisible-island.net (2006-2010) .AU . .am BT \" add page numbers after first page @@ -586,6 +586,13 @@ or \*(Dc\*0\*$\*r\*(Pt\*s\*(ST for invalid requests. . +.IP \\*(Dc\\*+\\*p\\*(Pt\\*s\\*(ST +Set Termcap/Terminfo Data (xterm, experimental). +The string following the "p" is a name to use for retrieving data from +the terminal database. The data will be used for the "tcap" keyboard +configuration's function- and special-keys, as well as by the +Request Termcap/Terminfo String control. + .IP \\*(Dc\\*+\\*q\\*(Pt\\*s\\*(ST Request Termcap/Terminfo String (xterm, experimental). The string following the "q" is a list of names @@ -593,6 +600,11 @@ encoded in hexadecimal (2 digits per character) separated by \*; which correspond to termcap or terminfo key names. .br +Two special features are also recognized, which are not key names: +\fICo\fP for termcap colors (or \fIcolors\fP for terminfo colors), +and +\fITN\fP for termcap name (or \fIname\fP for terminfo name). +.br \fIxterm\fP responds with \*(Dc\*1\*+\*r\*(Pt\*s\*(ST for valid requests, adding to \*(Pt an \*=, @@ -682,6 +694,17 @@ Initiate highlight mouse tracking. Parameters are [func;startx;starty;firstrow;lastrow]. See the section \fBMouse Tracking\fP. . +.IP \\*(Cs\\*>\\*(Ps\\*;\\*(Ps\\*s\\*T +Reset one or more features of the title modes to the default value. +Normally, "reset" disables the feature. +It is possible to disable the ability to reset features +by compiling a different default for the title modes into \fIxterm\fP. + \*(Ps = \*0 \(-> Do not set window/icon labels using hexadecimal + \*(Ps = \*1 \(-> Do not query window/icon labels using hexadecimal + \*(Ps = \*2 \(-> Do not set window/icon labels using UTF-8 + \*(Ps = \*3 \(-> Do not query window/icon labels using UTF-8 +(See discussion of "Title Modes") +. .IP \\*(Cs\\*(Ps\\*s\\*(XX Erase \*(Ps Character(s) (default = 1) (ECH) . @@ -1062,6 +1085,14 @@ Valid values for the second parameter: \*(Ps = \*1 \(-> 7-bit controls (always set for VT100) \*(Ps = \*2 \(-> 8-bit controls . +.IP \\*(Cs\\*(Ps\\*s\\*(Sp\\*q +Set cursor style (DECSCUSR, VT520) + \*(Ps = \*0 \(-> blinking block + \*(Ps = \*1 \(-> blinking block (default) + \*(Ps = \*2 \(-> steady block + \*(Ps = \*3 \(-> blinking underline + \*(Ps = \*4 \(-> steady underline +. .IP \\*(Cs\\*(Ps\\*s\\*(c"\\*q Select character protection attribute (DECSCA). Valid values for the parameter: @@ -1093,19 +1124,19 @@ These controls may be disabled using the \fIallowWindowOps\fP resource. Valid values for the first (and any additional parameters) are: \*(Ps = \*1 \(-> De-iconify window. \*(Ps = \*2 \(-> Iconify window. - \*(Ps = \*3 ; \fIx ; y\fP \(-> Move window to [x, y]. - \*(Ps = \*4 ; \fIheight ; width\fP \(-> Resize the \fIxterm\fP window to height and width in pixels. + \*(Ps = \*3\*s\*;\*s\fIx\*s\*;\*sy\fP \(-> Move window to [x, y]. + \*(Ps = \*4\*s\*;\*s\fIheight\*s\*;\*swidth\fP \(-> Resize the \fIxterm\fP window to height and width in pixels. \*(Ps = \*5 \(-> Raise the \fIxterm\fP window to the front of the stacking order. \*(Ps = \*6 \(-> Lower the \fIxterm\fP window to the bottom of the stacking order. \*(Ps = \*7 \(-> Refresh the \fIxterm\fP window. - \*(Ps = \*8 ; \fIheight ; width\fP \(-> Resize the text area to [height;width] in characters. - \*(Ps = \*9 ; \*0 \(-> Restore maximized window. - \*(Ps = \*9 ; \*1 \(-> Maximize window (i.e., resize to screen size). + \*(Ps = \*8\*s\*;\*s\fIheight\*s\*;\*swidth\fP \(-> Resize the text area to [height;width] in characters. + \*(Ps = \*9\*s\*;\*s\*0 \(-> Restore maximized window. + \*(Ps = \*9\*s\*;\*s\*1 \(-> Maximize window (i.e., resize to screen size). \*(Ps = \*1\*1 \(-> Report \fIxterm\fP window state. If the \fIxterm\fP window is open (non-iconified), it returns \*(Cs\*1\*t. If the \fIxterm\fP window is iconified, it returns \*(Cs\*2\*t. \*(Ps = \*1\*3 \(-> Report \fIxterm\fP window position as -\*(Cs\*3\*;\*(Ix\*;\*(Iy\*t +\*(Cs\*3\*;\*(Ix\*s\*;\*(Iy\*s\*t \*(Ps = \*1\*4 \(-> Report \fIxterm\fP window in pixels as \*(Cs\*s\*4\*s\*;\*s\fIheight\fP\*s\*;\*s\fIwidth\fP\*s\*t \*(Ps = \*1\*8 \(-> Report the size of the text area in characters as @@ -1115,7 +1146,13 @@ If the \fIxterm\fP window is iconified, it returns \*(Cs\*2\*t. \*(Ps = \*2\*0 \(-> Report \fIxterm\fP window's icon label as \*(Os\*s\*L\*s\fIlabel\fP\*s\*(ST \*(Ps = \*2\*1 \(-> Report \fIxterm\fP window's title as -\*(Os\*s\*l\*s\fItitle\fP\*s\*(ST +\*(Os\*s\*L\*s\fIlabel\fP\*s\*(ST + \*(Ps = \*2\*2\*s\*;\*s\*0 \(-> Save \fIxterm\fP icon and window title on stack. + \*(Ps = \*2\*2\*s\*;\*s\*1 \(-> Save \fIxterm\fP icon title on stack. + \*(Ps = \*2\*2\*s\*;\*s\*2 \(-> Save \fIxterm\fP window title on stack. + \*(Ps = \*2\*3\*s\*;\*s\*0 \(-> Restore \fIxterm\fP icon and window title from stack. + \*(Ps = \*2\*3\*s\*;\*s\*1 \(-> Restore \fIxterm\fP icon title from stack. + \*(Ps = \*2\*3\*s\*;\*s\*2 \(-> Restore \fIxterm\fP window title from stack. \*(Ps >= \*2\*4 \(-> Resize to \*(Ps lines (DECSLPP) . .IP \\*(Cs\\*(Pt\\*;\\*(Pl\\*;\\*(Pb\\*;\\*(Pr\\*;\\*(Ps\\*$\\*t @@ -1123,9 +1160,30 @@ Reverse Attributes in Rectangular Area (DECRARA). \*(Pt\*;\*(Pl\*;\*(Pb\*;\*(Pr denotes the rectangle. \*(Ps denotes the attributes to reverse. 1, 4, 5, 7 . +.IP \\*(Cs\\*>\\*(Ps\\*;\\*(Ps\\*s\\*t +Set one or more features of the title modes. +Each parameter enables a single feature. + \*(Ps = \*0 \(-> Set window/icon labels using hexadecimal + \*(Ps = \*1 \(-> Query window/icon labels using hexadecimal + \*(Ps = \*2 \(-> Set window/icon labels using UTF-8 + \*(Ps = \*3 \(-> Query window/icon labels using UTF-8 +(See discussion of "Title Modes") +. +.IP \\*(Cs\\*(Ps\\*s\\*(Sp\\*t +Set warning-bell volume (DECSWBV, VT520) + \*(Ps = \*0 or \*1 \(-> off + \*(Ps = \*2, \*3 or \*4 \(-> low + \*(Ps = \*5, \*6, \*7, or \*8 \(-> high +. .IP \\*(Cs\\*u Restore cursor (ANSI.SYS) . +.IP \\*(Cs\\*(Ps\\*s\\*(Sp\\*u +Set margin-bell volume (DECSMBV, VT520) + \*(Ps = \*1 \(-> off + \*(Ps = \*2, \*3 or \*4 \(-> low + \*(Ps = \*0, \*5, \*6, \*7, or \*8 \(-> high +. .IP \\*(Cs\\*(Pt\\*;\\*(Pl\\*;\\*(Pb\\*;\\*(Pr\\*;\\*(Pp\\*;\\*(Pt\\*;\\*(Pl\\*;\\*(Pp\\*$\\*v Copy Rectangular Area (DECCRA) \*(Pt\*;\*(Pl\*;\*(Pb\*;\*(Pr denotes the rectangle. @@ -1280,12 +1338,26 @@ to set the corresponding color. Because more than one pair of color number and specification can be given in one control sequence, \fBxterm\fR can make more than one reply. .sp -The 8 colors which may be set using \*1\*0 through \*1\*7 are + \*(Ps = \*5 ; \fIc ; spec\fP \(-> Change Special Color Number \fIc\fP to +the color specified by \fIspec\fP, +i.e., a name or RGB specification as per \fIXParseColor\fP. +Any number of \fIc name\fP pairs may be given. +The special colors can also be set by adding the maximum number of colors +to these codes in an \*(Os\*4 control: +.sp + \*(Pc = 0 \(-> resource \fBcolorBD\fP (BOLD) + \*(Pc = 1 \(-> resource \fBcolorUL\fP (UNDERLINE) + \*(Pc = 2 \(-> resource \fBcolorBL\fP (BLINK) + \*(Pc = 3 \(-> resource \fBcolorRV\fP (REVERSE) +.sp +The 8 colors (below) which may be set or queried +using \*1\*0 through \*1\*7 are denoted \fIdynamic colors\fR, since the corresponding control sequences were the first means for setting \fBxterm\fR's colors dynamically, i.e., after it was started. They are not the same as the ANSI colors. -One or more parameters is expected for \*(Pt. +These controls may be disabled using the \fIallowColorOps\fP resource. +At least one parameter is expected for \*(Pt. Each successive parameter changes the next color in the list. The value of \*(Ps tells the starting point in the list. The colors are specified by name or RGB specification as per \fIXParseColor\fP. @@ -1310,10 +1382,20 @@ be given in one control sequence, \fBxterm\fR can make more than one reply. compile-time option) .sp \*(Ps = \*5\*0 \(-> Set Font to \*(Pt +These controls may be disabled using the \fIallowFontOps\fP resource. If \*(Pt begins with a "#", index in the font menu, relative (if the next character is a plus or minus sign) or absolute. A number is expected but not required after the sign (the default is the current entry for relative, zero for absolute indexing). +.br +The same rule (plus or minus sign, optional number) is used when +querying the font. The remainder of \*(Pt is ignored. +.br +A font can be specified after a "#" index expression, +by adding a space and then the font specifier. +.br +If the "TrueType Fonts" menu entry is set (the \fBrenderFont\fP resource), +then this control sets/queries the \fBfaceName\fP resource. .sp \*(Ps = \*5\*1 (reserved for Emacs shell) .sp @@ -1343,6 +1425,32 @@ If the second parameter is a \*?, \fIxterm\fP replies to the host with the selection data encoded using the same protocol. .Ed +.sp + \*(Ps = \*1\*0\*4 ; \fIc\fP \(-> Reset Color Number \fIc\fP to +the color specified by the corresponding X resource. +Any number of \fIc\fP parameters may be given. +These parameters correspond to the ANSI colors 0-7, +their bright versions 8-15, +and if supported, the remainder of the 88-color or 256-color table. +If no parameters are given, the entire table will be reset. +.sp + \*(Ps = \*1\*0\*5 ; \fIc\fP \(-> Reset Special Color Number \fIc\fP to +the color specified by the corresponding X resource. +Any number of \fIc\fP parameters may be given. +These parameters correspond to the special colors which can be set +using an \*(Os\*5 control (or by adding the maximum number of colors +using an \*(Os\*4 control). +.sp +The \fIdynamic colors\fR can also be reset to their default (resource) values: + \*(Ps = \*1\*1\*0 \(-> Reset VT100 text foreground color. + \*(Ps = \*1\*1\*1 \(-> Reset VT100 text background color. + \*(Ps = \*1\*1\*2 \(-> Reset text cursor color. + \*(Ps = \*1\*1\*3 \(-> Reset mouse foreground color. + \*(Ps = \*1\*1\*4 \(-> Reset mouse background color. + \*(Ps = \*1\*1\*5 \(-> Reset Tektronix foreground color. + \*(Ps = \*1\*1\*6 \(-> Reset Tektronix background color. + \*(Ps = \*1\*1\*7 \(-> Reset highlight color. + \*(Ps = \*1\*1\*8 \(-> Reset Tektronix cursor color. . .St .LP @@ -1735,6 +1843,7 @@ and alternate screen buffers simply disable the switching. They add other features such as clearing the display for the same reason: to make the details of switching independent of the application that requests the switch. +. .SH Bracketed Paste Mode .ds RH Bracketed Paste Mode @@ -1745,6 +1854,44 @@ so that the program can differentiate pasted text from typed-in text. When bracketed paste mode is set, the program will receive: ESC [ 200 ~, followed by the pasted text, followed by ESC [ 201 ~. +. +.SH +Title Modes +.ds RH Title Modes +.LP +The window- and icon-labels can be set or queried using control sequences. +As a VT220-emulator, \fIxterm\fP "should" limit the character encoding for +the corresponding strings to ISO-8859-1. +Indeed, it used to be the case (and was documented) that +window titles had to be ISO-8859-1. +This is no longer the case. +However, there are many applications which still assume that titles are +set using ISO-8859-1. +So that is the default behavior. +.LP +If \fIxterm\fP is running with UTF-8 encoding, +it is possible to use window- and icon-labels encoded using UTF-8. +That is because the underlying X libraries (and many, but not all) +window managers support this feature. +.LP +The \fButf8Title\fP X resource setting tells \fIxterm\fP to disable +a reconversion of the title string back to ISO-8859-1, +allowing the title strings to be interpreted as UTF-8. +The same feature can be enabled using the title mode control sequence +described in this summary. +.LP +Separate from the ability to set the titles, +\fIxterm\fP provides the ability to query the titles, +returning them either in ISO-8859-1 or UTF-8. +This choice is available only while \fIxterm\fP is using UTF-8 encoding. +.LP +Finally, the characters sent to, or returned by a title control +are less constrained than the rest of the control sequences. +To make them more manageable (and constrained), for use in shell scripts, +\fIxterm\fP has an optional feature which decodes the string from hexadecimal +(for setting titles) or for encoding the title into hexadecimal when querying +the value. +. .SH Mouse Tracking .ds RH Mouse Tracking diff --git a/app/xterm/ctlseqs.txt b/app/xterm/ctlseqs.txt index 5644dc8af..d6595be45 100644 --- a/app/xterm/ctlseqs.txt +++ b/app/xterm/ctlseqs.txt @@ -9,6 +9,7 @@ Xterm Control Sequences + Edward Moy University of California, Berkeley @@ -19,7 +20,7 @@ Thomas Dickey XFree86 Project (1996-2006) - invisible-island.net (2006-2008) + invisible-island.net (2006-2010) @@ -192,11 +193,21 @@ DCS $ q Pt ST xterm responds with DCS 1 $ r Pt ST for valid requests, replacing the Pt with the corresponding CSI string, or DCS 0 $ r Pt ST for invalid requests. +DCS + p Pt ST + Set Termcap/Terminfo Data (xterm, experimental). The string + following the "p" is a name to use for retrieving data from + the terminal database. The data will be used for the "tcap" + keyboard configuration's function- and special-keys, as well + as by the Request Termcap/Terminfo String control. + DCS + q Pt ST Request Termcap/Terminfo String (xterm, experimental). The - string following the "q" is a list of names encoded in hex- - adecimal (2 digits per character) separated by ; which corre- + string following the "q" is a list of names encoded in hexa- + decimal (2 digits per character) separated by ; which corre- spond to termcap or terminfo key names. + Two special features are also recognized, which are not key + names: Co for termcap colors (or colors for terminfo colors), + and TN for termcap name (or name for terminfo name). xterm responds with DCS 1 + r Pt ST for valid requests, adding to Pt an = , and the value of the corresponding string that xterm would send, or DCS 0 + r Pt ST for invalid requests. @@ -243,6 +254,16 @@ CSI Ps ; Ps ; Ps ; Ps ; Ps T Initiate highlight mouse tracking. Parameters are [func;startx;starty;firstrow;lastrow]. See the section Mouse Tracking. +CSI > Ps; Ps T + Reset one or more features of the title modes to the default + value. Normally, "reset" disables the feature. It is possi- + ble to disable the ability to reset features by compiling a + different default for the title modes into xterm. + Ps = 0 -> Do not set window/icon labels using hexadecimal + Ps = 1 -> Do not query window/icon labels using hexadecimal + Ps = 2 -> Do not set window/icon labels using UTF-8 + Ps = 3 -> Do not query window/icon labels using UTF-8 (See + discussion of "Title Modes") CSI Ps X Erase Ps Character(s) (default = 1) (ECH) CSI Ps Z Cursor Backward Tabulation Ps tab stops (default = 1) (CBT) CSI Pm ` Character Position Absolute [column] (default = [row,1]) @@ -578,6 +599,13 @@ CSI Ps ; Ps " p Ps = 0 -> 8-bit controls Ps = 1 -> 7-bit controls (always set for VT100) Ps = 2 -> 8-bit controls +CSI Ps SP q + Set cursor style (DECSCUSR, VT520) + Ps = 0 -> blinking block + Ps = 1 -> blinking block (default) + Ps = 2 -> steady block + Ps = 3 -> blinking underline + Ps = 4 -> steady underline CSI Ps " q Select character protection attribute (DECSCA). Valid values for the parameter: @@ -605,23 +633,23 @@ CSI Ps ; Ps ; Ps t parameters) are: Ps = 1 -> De-iconify window. Ps = 2 -> Iconify window. - Ps = 3 ; x ; y -> Move window to [x, y]. - Ps = 4 ; height ; width -> Resize the xterm window to + Ps = 3 ; x ; y -> Move window to [x, y]. + Ps = 4 ; height ; width -> Resize the xterm window to height and width in pixels. Ps = 5 -> Raise the xterm window to the front of the stack- ing order. Ps = 6 -> Lower the xterm window to the bottom of the stacking order. Ps = 7 -> Refresh the xterm window. - Ps = 8 ; height ; width -> Resize the text area to + Ps = 8 ; height ; width -> Resize the text area to [height;width] in characters. - Ps = 9 ; 0 -> Restore maximized window. - Ps = 9 ; 1 -> Maximize window (i.e., resize to screen + Ps = 9 ; 0 -> Restore maximized window. + Ps = 9 ; 1 -> Maximize window (i.e., resize to screen size). Ps = 1 1 -> Report xterm window state. If the xterm window is open (non-iconified), it returns CSI 1 t . If the xterm window is iconified, it returns CSI 2 t . - Ps = 1 3 -> Report xterm window position as CSI 3 ; x; yt + Ps = 1 3 -> Report xterm window position as CSI 3 ; x ; y t Ps = 1 4 -> Report xterm window in pixels as CSI 4 ; height ; width t Ps = 1 8 -> Report the size of the text area in characters @@ -630,13 +658,39 @@ CSI Ps ; Ps ; Ps t CSI 9 ; height ; width t Ps = 2 0 -> Report xterm window's icon label as OSC L label ST - Ps = 2 1 -> Report xterm window's title as OSC l title ST + Ps = 2 1 -> Report xterm window's title as OSC L label ST + Ps = 2 2 ; 0 -> Save xterm icon and window title on + stack. + Ps = 2 2 ; 1 -> Save xterm icon title on stack. + Ps = 2 2 ; 2 -> Save xterm window title on stack. + Ps = 2 3 ; 0 -> Restore xterm icon and window title from + stack. + Ps = 2 3 ; 1 -> Restore xterm icon title from stack. + Ps = 2 3 ; 2 -> Restore xterm window title from stack. Ps >= 2 4 -> Resize to Ps lines (DECSLPP) CSI Pt; Pl; Pb; Pr; Ps$ t Reverse Attributes in Rectangular Area (DECRARA). Pt; Pl; Pb; Pr denotes the rectangle. Ps denotes the attributes to reverse. 1, 4, 5, 7 +CSI > Ps; Ps t + Set one or more features of the title modes. Each parameter + enables a single feature. + Ps = 0 -> Set window/icon labels using hexadecimal + Ps = 1 -> Query window/icon labels using hexadecimal + Ps = 2 -> Set window/icon labels using UTF-8 + Ps = 3 -> Query window/icon labels using UTF-8 (See discus- + sion of "Title Modes") +CSI Ps SP t + Set warning-bell volume (DECSWBV, VT520) + Ps = 0 or 1 -> off + Ps = 2 , 3 or 4 -> low + Ps = 5 , 6 , 7 , or 8 -> high CSI u Restore cursor (ANSI.SYS) +CSI Ps SP u + Set margin-bell volume (DECSMBV, VT520) + Ps = 1 -> off + Ps = 2 , 3 or 4 -> low + Ps = 0 , 5 , 6 , 7 , or 8 -> high CSI Pt; Pl; Pb; Pr; Pp; Pt; Pl; Pp$ v Copy Rectangular Area (DECCRA) Pt; Pl; Pb; Pr denotes the rectangle. @@ -769,15 +823,27 @@ OSC Ps ; Pt BEL one pair of color number and specification can be given in one control sequence, xterm can make more than one reply. - The 8 colors which may be set using 1 0 through 1 7 are - denoted dynamic colors, since the corresponding control - sequences were the first means for setting xterm's colors - dynamically, i.e., after it was started. They are not the - same as the ANSI colors. One or more parameters is expected - for Pt. Each successive parameter changes the next color in - the list. The value of Ps tells the starting point in the - list. The colors are specified by name or RGB specification - as per XParseColor. + Ps = 5 ; c ; spec -> Change Special Color Number c to the + color specified by spec, i.e., a name or RGB specification as + per XParseColor. Any number of c name pairs may be given. + The special colors can also be set by adding the maximum num- + ber of colors to these codes in an OSC 4 control: + + Pc = 0 -> resource colorBD (BOLD) + Pc = 1 -> resource colorUL (UNDERLINE) + Pc = 2 -> resource colorBL (BLINK) + Pc = 3 -> resource colorRV (REVERSE) + + The 8 colors (below) which may be set or queried using 1 0 + through 1 7 are denoted dynamic colors, since the correspond- + ing control sequences were the first means for setting xterm's + colors dynamically, i.e., after it was started. They are not + the same as the ANSI colors. These controls may be disabled + using the allowColorOps resource. At least one parameter is + expected for Pt. Each successive parameter changes the next + color in the list. The value of Ps tells the starting point + in the list. The colors are specified by name or RGB specifi- + cation as per XParseColor. If a "?" is given rather than a name or RGB specification, xterm replies with a control sequence of the same form which @@ -799,11 +865,19 @@ OSC Ps ; Pt BEL Ps = 4 6 -> Change Log File to Pt (normally disabled by a compile-time option) - Ps = 5 0 -> Set Font to Pt If Pt begins with a "#", index - in the font menu, relative (if the next character is a plus or - minus sign) or absolute. A number is expected but not + Ps = 5 0 -> Set Font to Pt These controls may be disabled + using the allowFontOps resource. If Pt begins with a "#", + index in the font menu, relative (if the next character is a + plus or minus sign) or absolute. A number is expected but not required after the sign (the default is the current entry for relative, zero for absolute indexing). + The same rule (plus or minus sign, optional number) is used + when querying the font. The remainder of Pt is ignored. + A font can be specified after a "#" index expression, by + adding a space and then the font specifier. + If the "TrueType Fonts" menu entry is set (the renderFont + resource), then this control sets/queries the faceName + resource. Ps = 5 1 (reserved for Emacs shell) @@ -824,6 +898,31 @@ OSC Ps ; Pt BEL If the second parameter is a ? , xterm replies to the host with the selection data encoded using the same protocol. + Ps = 1 0 4 ; c -> Reset Color Number c to the color speci- + fied by the corresponding X resource. Any number of c parame- + ters may be given. These parameters correspond to the ANSI + colors 0-7, their bright versions 8-15, and if supported, the + remainder of the 88-color or 256-color table. If no parame- + ters are given, the entire table will be reset. + + Ps = 1 0 5 ; c -> Reset Special Color Number c to the color + specified by the corresponding X resource. Any number of c + parameters may be given. These parameters correspond to the + special colors which can be set using an OSC 5 control (or by + adding the maximum number of colors using an OSC 4 control). + + The dynamic colors can also be reset to their default + (resource) values: + Ps = 1 1 0 -> Reset VT100 text foreground color. + Ps = 1 1 1 -> Reset VT100 text background color. + Ps = 1 1 2 -> Reset text cursor color. + Ps = 1 1 3 -> Reset mouse foreground color. + Ps = 1 1 4 -> Reset mouse background color. + Ps = 1 1 5 -> Reset Tektronix foreground color. + Ps = 1 1 6 -> Reset Tektronix background color. + Ps = 1 1 7 -> Reset highlight color. + Ps = 1 1 8 -> Reset Tektronix cursor color. + Privacy Message PM Pt ST xterm implements no PM functions; Pt is ignored. Pt need not be printable characters. @@ -1145,6 +1244,31 @@ sequences so that the program can differentiate pasted text from typed- in text. When bracketed paste mode is set, the program will receive: ESC [ 200 ~, followed by the pasted text, followed by ESC [ 201 ~. +Title Modes +The window- and icon-labels can be set or queried using control +sequences. As a VT220-emulator, xterm "should" limit the character +encoding for the corresponding strings to ISO-8859-1. Indeed, it used +to be the case (and was documented) that window titles had to be +ISO-8859-1. This is no longer the case. However, there are many appli- +cations which still assume that titles are set using ISO-8859-1. So +that is the default behavior. +If xterm is running with UTF-8 encoding, it is possible to use window- +and icon-labels encoded using UTF-8. That is because the underlying X +libraries (and many, but not all) window managers support this feature. +The utf8Title X resource setting tells xterm to disable a reconversion +of the title string back to ISO-8859-1, allowing the title strings to be +interpreted as UTF-8. The same feature can be enabled using the title +mode control sequence described in this summary. +Separate from the ability to set the titles, xterm provides the ability +to query the titles, returning them either in ISO-8859-1 or UTF-8. This +choice is available only while xterm is using UTF-8 encoding. +Finally, the characters sent to, or returned by a title control are less +constrained than the rest of the control sequences. To make them more +manageable (and constrained), for use in shell scripts, xterm has an +optional feature which decodes the string from hexadecimal (for setting +titles) or for encoding the title into hexadecimal when querying the +value. + Mouse Tracking The VT widget can be set to send the mouse position and other informa- tion on button presses. These modes are typically used by editors and diff --git a/app/xterm/cursor.c b/app/xterm/cursor.c index 86817eca9..2c5b1892c 100644 --- a/app/xterm/cursor.c +++ b/app/xterm/cursor.c @@ -1,4 +1,4 @@ -/* $XTermId: cursor.c,v 1.53 2009/08/09 17:23:25 tom Exp $ */ +/* $XTermId: cursor.c,v 1.54 2009/11/28 13:26:13 tom Exp $ */ /* * Copyright 2002-2008,2009 by Thomas E. Dickey @@ -96,7 +96,7 @@ CursorSet(TScreen * screen, int row, int col, unsigned flags) void CursorBack(XtermWidget xw, int n) { - TScreen *screen = &xw->screen; + TScreen *screen = TScreenOf(xw); int i, j, k, rev; if ((rev = (xw->flags & (REVERSEWRAP | WRAPAROUND)) == @@ -189,7 +189,7 @@ CursorUp(TScreen * screen, int n) void xtermIndex(XtermWidget xw, int amount) { - TScreen *screen = &xw->screen; + TScreen *screen = TScreenOf(xw); int j; /* @@ -213,7 +213,7 @@ xtermIndex(XtermWidget xw, int amount) void RevIndex(XtermWidget xw, int amount) { - TScreen *screen = &xw->screen; + TScreen *screen = TScreenOf(xw); /* * reverse indexing when above scrolling region is cursor up. @@ -249,7 +249,7 @@ CarriageReturn(TScreen * screen) void AdjustSavedCursor(XtermWidget xw, int adjust) { - TScreen *screen = &xw->screen; + TScreen *screen = TScreenOf(xw); if (screen->whichBuf) { SavedCursor *sc = &screen->sc[0]; @@ -267,7 +267,7 @@ AdjustSavedCursor(XtermWidget xw, int adjust) void CursorSave(XtermWidget xw) { - TScreen *screen = &xw->screen; + TScreen *screen = TScreenOf(xw); SavedCursor *sc = &screen->sc[screen->whichBuf]; sc->saved = True; @@ -296,7 +296,7 @@ CursorSave(XtermWidget xw) void CursorRestore(XtermWidget xw) { - TScreen *screen = &xw->screen; + TScreen *screen = TScreenOf(xw); SavedCursor *sc = &screen->sc[screen->whichBuf]; /* Restore the character sets, unless we never did a save-cursor op. diff --git a/app/xterm/doublechr.c b/app/xterm/doublechr.c index 26cd4e3c6..bcfcddae3 100644 --- a/app/xterm/doublechr.c +++ b/app/xterm/doublechr.c @@ -1,4 +1,4 @@ -/* $XTermId: doublechr.c,v 1.72 2009/08/07 00:25:02 tom Exp $ */ +/* $XTermId: doublechr.c,v 1.73 2009/11/28 13:28:03 tom Exp $ */ /************************************************************ @@ -50,7 +50,7 @@ authorization. static void repaint_line(XtermWidget xw, unsigned newChrSet) { - TScreen *screen = &xw->screen; + TScreen *screen = TScreenOf(xw); LineData *ld; int curcol = screen->cur_col; int currow = screen->cur_row; @@ -140,7 +140,7 @@ xterm_DECDWL(XtermWidget xw GCC_UNUSED) static void discard_font(XtermWidget xw, int n) { - TScreen *screen = &xw->screen; + TScreen *screen = TScreenOf(xw); XTermFonts *data = &(screen->double_fonts[n]); TRACE(("discard_font chrset=%d %s\n", data->chrset, @@ -165,7 +165,7 @@ discard_font(XtermWidget xw, int n) static XTermFonts * pushback_font(XtermWidget xw, XTermFonts * source) { - TScreen *screen = &xw->screen; + TScreen *screen = TScreenOf(xw); XTermFonts *data = screen->double_fonts; int n; @@ -190,7 +190,7 @@ xterm_Double_index(XtermWidget xw, unsigned chrset, unsigned flags) { int n; int result = -1; - TScreen *screen = &xw->screen; + TScreen *screen = TScreenOf(xw); XTermFonts *data = screen->double_fonts; flags &= BOLD; @@ -228,7 +228,7 @@ xterm_DoubleGC(XtermWidget xw, GC old_gc, int *inxp) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); VTwin *cgsWin = WhichVWin(screen); int n; char *name; diff --git a/app/xterm/fontutils.c b/app/xterm/fontutils.c index ed1cf71c9..8e964f452 100644 --- a/app/xterm/fontutils.c +++ b/app/xterm/fontutils.c @@ -1,8 +1,8 @@ -/* $XTermId: fontutils.c,v 1.319 2009/10/12 22:29:42 tom Exp $ */ +/* $XTermId: fontutils.c,v 1.336 2010/01/01 15:02:26 tom Exp $ */ /************************************************************ -Copyright 1998-2008,2009 by Thomas E. Dickey +Copyright 1998-2009,2010 by Thomas E. Dickey All Rights Reserved @@ -42,6 +42,7 @@ authorization. #include <fontutils.h> #include <X11/Xmu/Drawing.h> +#include <X11/Xmu/CharSet.h> #include <main.h> #include <data.h> @@ -748,7 +749,7 @@ xtermOpenFont(XtermWidget xw, } else { result->fn = x_strdup(name); } - } else if (strcmp(name, DEFFONT)) { + } else if (XmuCompareISOLatin1(name, DEFFONT) != 0) { if (warn <= xw->misc.fontWarnings #if OPT_RENDERFONT && !UsingRenderFont(xw) @@ -756,6 +757,17 @@ xtermOpenFont(XtermWidget xw, ) { TRACE(("OOPS: cannot load font %s\n", name)); fprintf(stderr, "%s: cannot load font %s\n", ProgramName, name); +#if OPT_RENDERFONT + /* + * Do a sanity check in case someone's mixed up xterm with + * one of those programs that read their resource data from + * xterm's namespace. + */ + if (strchr(name, ':') != 0 || strchr(name, '=') != 0) { + fprintf(stderr, + "Use the \"-fa\" option for the Xft fonts\n"); + } +#endif } else { TRACE(("xtermOpenFont: cannot load font %s\n", name)); } @@ -1706,11 +1718,66 @@ static void checkFontInfo(int value, const char *tag) { if (value == 0) { - fprintf(stderr, "Selected font has no non-zero %s for ISO-8859-1 encoding\n", tag); + fprintf(stderr, + "Selected font has no non-zero %s for ISO-8859-1 encoding\n", tag); exit(1); } } +#if OPT_RENDERFONT +void +xtermCloseXft(TScreen * screen, XTermXftFonts * pub) +{ + if (pub->font != 0) { + XftFontClose(screen->display, pub->font); + pub->font = 0; + } +} + +/* + * Get the faceName/faceDoublesize resource setting. Strip off "xft:", which + * is not recognized by XftParseName(). + */ +char * +getFaceName(XtermWidget xw, Bool wideName GCC_UNUSED) +{ +#if OPT_RENDERWIDE + char *result = (wideName + ? xw->misc.face_wide_name + : xw->misc.face_name); +#else + char *result = xw->misc.face_name; +#endif + if (!IsEmpty(result) && !strncmp(result, "xft:", 4)) + result += 4; + return x_nonempty(result); +} + +/* + * If we change the faceName, we'll have to re-acquire all of the fonts that + * are derived from it. + */ +void +setFaceName(XtermWidget xw, const char *value) +{ + TScreen *screen = TScreenOf(xw); + int n; + + xw->misc.face_name = x_strdup(value); + for (n = 0; n < NMENUFONTS; ++n) { + xw->misc.face_size[n] = -1.0; + xtermCloseXft(screen, &(screen->renderFontNorm[n])); + xtermCloseXft(screen, &(screen->renderFontBold[n])); + xtermCloseXft(screen, &(screen->renderFontBold[n])); +#if OPT_RENDERWIDE + xtermCloseXft(screen, &(screen->renderWideNorm[n])); + xtermCloseXft(screen, &(screen->renderWideBold[n])); + xtermCloseXft(screen, &(screen->renderWideItal[n])); +#endif + } +} +#endif + /* * Compute useful values for the font/window sizes */ @@ -1733,6 +1800,7 @@ xtermComputeFontInfo(XtermWidget xw, * overrides it. */ if (xw->misc.render_font && !IsIconWin(screen, win)) { + char *face_name = getFaceName(xw, False); int fontnum = screen->menu_font_number; XftFont *norm = screen->renderFontNorm[fontnum].font; XftFont *bold = screen->renderFontBold[fontnum].font; @@ -1743,12 +1811,12 @@ xtermComputeFontInfo(XtermWidget xw, XftFont *wital = screen->renderWideItal[fontnum].font; #endif - if (norm == 0 && xw->misc.face_name) { + if (norm == 0 && face_name) { XftPattern *pat; double face_size = xw->misc.face_size[fontnum]; TRACE(("xtermComputeFontInfo norm(face %s, size %f)\n", - xw->misc.face_name, + face_name, xw->misc.face_size[fontnum])); if (face_size <= 0.0) { @@ -1824,8 +1892,8 @@ xtermComputeFontInfo(XtermWidget xw, XFT_SLANT, XftTypeInteger, XFT_SLANT_ITALIC, \ XFT_CHAR_WIDTH, XftTypeInteger, norm->max_advance_width - if ((pat = XftNameParse(xw->misc.face_name)) != 0) { -#define OPEN_XFT(tag) xtermOpenXft(xw, xw->misc.face_name, pat, tag) + if ((pat = XftNameParse(face_name)) != 0) { +#define OPEN_XFT(tag) xtermOpenXft(xw, face_name, pat, tag) XftPatternBuild(pat, NormXftPattern, (void *) 0); @@ -1839,7 +1907,7 @@ xtermComputeFontInfo(XtermWidget xw, #if OPT_ISO_COLORS if (screen->italicULMode - && (pat = XftNameParse(xw->misc.face_name)) != 0) { + && (pat = XftNameParse(face_name)) != 0) { XftPatternBuild(pat, NormXftPattern, ItalXftPattern(norm), @@ -1872,9 +1940,6 @@ xtermComputeFontInfo(XtermWidget xw, */ #if OPT_RENDERWIDE if (norm != 0 && screen->wide_chars) { - char *face_name = (xw->misc.face_wide_name - ? xw->misc.face_wide_name - : xw->misc.face_name); int char_width = norm->max_advance_width * 2; #ifdef FC_ASPECT double aspect = ((xw->misc.face_wide_name @@ -1883,8 +1948,9 @@ xtermComputeFontInfo(XtermWidget xw, : 2.0); #endif + face_name = getFaceName(xw, True); TRACE(("xtermComputeFontInfo wide(face %s, char_width %d)\n", - face_name, + NonNull(face_name), char_width)); #define WideXftPattern \ @@ -1892,7 +1958,7 @@ xtermComputeFontInfo(XtermWidget xw, XFT_SIZE, XftTypeDouble, face_size, \ XFT_SPACING, XftTypeInteger, XFT_MONO - if ((pat = XftNameParse(face_name)) != 0) { + if (face_name && (pat = XftNameParse(face_name)) != 0) { #define OPEN_XFT(tag) xtermOpenXft(xw, face_name, pat, tag) XftPatternBuild(pat, WideXftPattern, @@ -2583,9 +2649,9 @@ lookupOneFontSize(XtermWidget xw, int fontnum) memset(&fnt, 0, sizeof(fnt)); screen->menu_font_sizes[fontnum] = -1; if (xtermOpenFont(xw, screen->MenuFontName(fontnum), &fnt, fwAlways, True)) { - screen->menu_font_sizes[fontnum] = FontSize(fnt.fs); - TRACE(("menu_font_sizes[%d] = %ld\n", fontnum, - screen->menu_font_sizes[fontnum])); + if (fontnum <= fontMenu_lastBuiltin + || strcmp(fnt.fn, DEFFONT)) + screen->menu_font_sizes[fontnum] = FontSize(fnt.fs); xtermCloseFont(xw, &fnt); } } @@ -2757,7 +2823,7 @@ HandleLargerFont(Widget w GCC_UNUSED, { XtermWidget xw; - TRACE(("Handle larger-vt-font for %p\n", w)); + TRACE(("Handle larger-vt-font for %p\n", (void *) w)); if ((xw = getXtermWidget(w)) != 0) { if (xw->misc.shift_fonts) { TScreen *screen = TScreenOf(xw); @@ -2782,7 +2848,7 @@ HandleSmallerFont(Widget w GCC_UNUSED, { XtermWidget xw; - TRACE(("Handle smaller-vt-font for %p\n", w)); + TRACE(("Handle smaller-vt-font for %p\n", (void *) w)); if ((xw = getXtermWidget(w)) != 0) { if (xw->misc.shift_fonts) { TScreen *screen = TScreenOf(xw); @@ -2938,7 +3004,6 @@ SetVTFont(XtermWidget xw, if (which == fontMenu_fontsel) { /* go get the selection */ FindFontSelection(xw, myfonts.f_n, False); - return; } else { int oldFont = screen->menu_font_number; @@ -2950,6 +3015,16 @@ SetVTFont(XtermWidget xw, } else { \ TRACE(("set myfonts." #field " reused\n")); \ } +#define SAVE_FNAME(field, name) \ + if (myfonts.field != 0) { \ + if (screen->menu_font_names[which][name] == 0 \ + || strcmp(screen->menu_font_names[which][name], myfonts.field)) { \ + TRACE(("updating menu_font_names[%d][" #name "] to %s\n", \ + which, myfonts.field)); \ + screen->menu_font_names[which][name] = x_strdup(myfonts.field); \ + } \ + } + USE_CACHED(f_n, fNorm); USE_CACHED(f_b, fBold); #if OPT_WIDE_CHARS @@ -2959,15 +3034,25 @@ SetVTFont(XtermWidget xw, if (xtermLoadFont(xw, &myfonts, doresize, which)) { - return; + /* + * If successful, save the data so that a subsequent query via + * OSC-50 will return the expected values. + */ + SAVE_FNAME(f_n, fNorm); + SAVE_FNAME(f_b, fBold); +#if OPT_WIDE_CHARS + SAVE_FNAME(f_w, fWide); + SAVE_FNAME(f_wb, fWBold); +#endif } else { xtermLoadFont(xw, xtermFontName(screen->MenuFontName(oldFont)), doresize, oldFont); + Bell(XkbBI_MinorError, 0); } } + } else { + Bell(XkbBI_MinorError, 0); } - - Bell(XkbBI_MinorError, 0); return; } diff --git a/app/xterm/fontutils.h b/app/xterm/fontutils.h index 2022707a3..9d8927cfe 100644 --- a/app/xterm/fontutils.h +++ b/app/xterm/fontutils.h @@ -1,4 +1,4 @@ -/* $XTermId: fontutils.h,v 1.76 2009/09/09 23:31:55 tom Exp $ */ +/* $XTermId: fontutils.h,v 1.79 2009/12/31 13:31:52 tom Exp $ */ /************************************************************ @@ -101,11 +101,14 @@ extern Bool xtermLoadWideFonts (XtermWidget /* w */, Bool /* nullOk */); #if OPT_RENDERFONT extern Bool xtermXftMissing (XtermWidget /* xw */, XftFont * /* font */, unsigned /* wc */); +extern void xtermCloseXft(TScreen * /* screen */, XTermXftFonts * /* pub */); #endif #if OPT_SHIFT_FONTS -extern void HandleSmallerFont PROTO_XT_ACTIONS_ARGS; +extern char *getFaceName(XtermWidget /* xw */, Bool /* wideName */); extern void HandleLargerFont PROTO_XT_ACTIONS_ARGS; +extern void HandleSmallerFont PROTO_XT_ACTIONS_ARGS; +extern void setFaceName(XtermWidget /* xw */, const char * /*value */); #endif #if OPT_WIDE_CHARS diff --git a/app/xterm/gen-pc-fkeys.pl b/app/xterm/gen-pc-fkeys.pl index c7ba80268..1cc5b4790 100644 --- a/app/xterm/gen-pc-fkeys.pl +++ b/app/xterm/gen-pc-fkeys.pl @@ -1,98 +1,364 @@ #! /usr/bin/perl -w -# Author: Thomas E. Dickey -# $XTermId: gen-pc-fkeys.pl,v 1.5 2005/04/03 16:58:29 tom Exp $ -# $XFree86: xc/programs/xterm/gen-pc-fkeys.pl,v 1.2 2005/03/29 04:00:32 tsi Exp $ +# $XTermId: gen-pc-fkeys.pl,v 1.22 2007/11/30 23:03:55 tom Exp $ +# ----------------------------------------------------------------------------- +# this file is part of xterm +# +# Copyright 2004-2005,2007 by Thomas E. Dickey +# +# All Rights Reserved +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name(s) of the above copyright +# holders shall not be used in advertising or otherwise to promote the +# sale, use or other dealings in this Software without prior written +# authorization. +# ----------------------------------------------------------------------------- # # Construct a list of function-key definitions corresponding to xterm's -# Sun/PC keyboard. This uses infocmp to obtain the strings to modify (and -# verify). +# Sun/PC keyboard. This uses ncurses' infocmp to obtain the strings (including +# extensions) to modify (and verify). use strict; -my(@old_keys); -my($min_fkeys,$max_fkeys,$max_modifier,$modify_opt,$terminfo); +my($max_modifier, $terminfo); +my(@old_fkeys, $opt_fkeys, $min_fkeys, $max_fkeys); +my(%old_ckeys, $opt_ckeys, $min_ckeys, $max_ckeys); +my(%old_ekeys, $opt_ekeys, $min_ekeys, $max_ekeys); + +my(@ckey_names); +@ckey_names = ( + 'kcud1', 'kcub1', 'kcuf1', 'kcuu1', # 1 = no modifiers + 'kDN', 'kLFT', 'kRIT', 'kUP', # 2 = shift + # make_ckey_names() repeats this row, appending the modifier code + ); +my %ckey_names; +my(@ckey_known); +@ckey_known = ( + 'kind', 'kLFT', 'kRIT', 'kri', # 2 = shift (standard) + ); + +my(@ekey_names); +@ekey_names = ( + 'khome', 'kend', 'knp', 'kpp', 'kdch1', 'kich1', # 1 = no modifiers + 'kHOM', 'kEND', 'kNXT', 'kPRV', 'kDC', 'kIC', # 2 = shift + # make_ekey_names() repeats this row, appending the modifier code +); +my %ekey_names; $min_fkeys=12; # the number of "real" function keys on your keyboard $max_fkeys=64; # the number of function-keys terminfo can support $max_modifier=8; # modifier 1 + (1=shift, 2=alt, 4=control 8=meta) -$modify_opt=2; # xterm's modifyCursorKeys resource -$terminfo="xterm-new"; # the terminfo entry to use -my($cur_modifier, $cur_fkey); +$min_ckeys=4; # the number of "real" cursor keys on your keyboard +$max_ckeys=($min_ckeys * ($max_modifier - 1)); + +$min_ekeys=6; # the number of "real" editing keys on your keyboard +$max_ekeys=($min_ekeys * ($max_modifier - 1)); + +$opt_ckeys=2; # xterm's modifyCursorKeys resource +$opt_ekeys=2; # xterm's modifyCursorKeys resource +$opt_fkeys=2; # xterm's modifyFunctionKeys resource +$terminfo="xterm-new"; # the terminfo entry to use # apply the given modifier to the terminfo string, return the result -sub modify_it { +sub modify_fkey($$$) { my $code = $_[0]; my $text = $_[1]; - if ($code != 1) { + my $opts = $_[2]; + if (not defined($text)) { + $text = ""; + } elsif ($code != 1) { + $text =~ s/\\EO/\\E\[/ if ($opts >= 1); + my $piece = substr $text, 0, length ($text) - 1; my $final = substr $text, length ($text) - 1; my $check = substr $piece, length ($piece) - 1; if ($check =~ /[0-9]/) { $code = ";" . $code; + } elsif ( $check =~ /\[/ and $opts >= 2) { + $code = "1;" . $code; + } + if ( $opts >= 3 ) { + $code = ">" . $code; } $text = $piece . $code . $final; + $text =~ s/([\d;]+)>/>$1/; } return $text; } -# compute the next modifier value +# compute the next modifier value - +# Cycling through the modifiers is not just like counting. Users prefer +# pressing one modifier (even if using Emacs). So first we cycle through +# the individual modifiers, then for completeness two, three, etc. sub next_modifier { my $code = $_[0]; my $mask = $code - 1; if ($mask == 0) { - $mask = 1; + $mask = 1; # shift } elsif ($mask == 1) { - $mask = 4; + $mask = 4; # control } elsif ($mask == 2) { - $mask = 3; # FIXME + $mask = 3; # shift+alt } elsif ($mask == 4) { - $mask = 5; + $mask = 5; # shift+control } elsif ($mask == 5) { - $mask = 2; + $mask = 2; # alt } # printf ("# next_modifier(%d) = %d\n", $code, $mask + 1); return $mask + 1; } -# Read the terminfo entry's list of function keys $old_keys[]. -# We could handle $old_keys[0], but choose to start numbering from 1. -sub readterm() { - my($key,$n,$str); - my(@list) = `infocmp -1 $terminfo`; +sub make_ckey_names() { + my ($j, $k); + my $min = $min_ckeys * 2; + my $max = $max_ckeys - 1; + + # printf "# make_ckey_names\n"; + for $j ($min..$max) { + $k = 1 + substr($j / $min_ckeys, 0, 1); + $ckey_names[$j] = $ckey_names[$min_ckeys + ($j % $min_ckeys)] . $k; + # printf "# make %d:%s\n", $j, $ckey_names[$j]; + } + for $j (0..$#ckey_names) { + # printf "# %d:%s\n", $j, $ckey_names[$j]; + $ckey_names{$ckey_names[$j]} = $j; + } +} + +sub make_ekey_names() { + my ($j, $k); + my $min = $min_ekeys * 2; + my $max = $max_ekeys - 1; + + # printf "# make_ekey_names\n"; + for $j ($min..$max) { + $k = 1 + substr($j / $min_ekeys, 0, 1); + $ekey_names[$j] = $ekey_names[$min_ekeys + ($j % $min_ekeys)] . $k; + # printf "# make %d:%s\n", $j, $ekey_names[$j]; + } + for $j (0..$#ekey_names) { + # printf "# %d:%s\n", $j, $ekey_names[$j]; + $ekey_names{$ekey_names[$j]} = $j; + } +} + +# Read the terminfo entry's list of function keys $old_fkeys[]. +# We could handle $old_fkeys[0], but choose to start numbering from 1. +sub readterm($) { + my $term = $_[0]; + my($key, $n, $str); + my(@list) = `infocmp -x -1 $term`; + for $n (0..$#list) { chop $list[$n]; $list[$n] =~ s/^[[:space:]]//; + + $key = $list[$n]; + $key =~ s/=.*//; + + $str = $list[$n]; + $str =~ s/^[^=]+=//; + $str =~ s/,$//; + if ( $list[$n] =~ /^kf[[:digit:]]+=/ ) { - $key = $list[$n]; $key =~ s/^kf//; - $key =~ s/=.*//; - $str = $list[$n]; - $str =~ s/^kf[[:digit:]]+=//; - $str =~ s/,[[:space:]]*$//; - # printf "$n:%s(%d)(%s)\n", $list[$n], $key, $str; - $old_keys[$key] = $str; + # printf "# $n:%s(%d)(%s)\n", $list[$n], $key, $str; + $old_fkeys[$key] = $str; + } elsif ( $key =~ /^kc[[:alpha:]]+1/ + or $key =~ /^k(LFT|RIT|UP|DN)\d?/) { + # printf "# $n:%s(%d)(%s)\n", $list[$n], $key, $str; + $old_ckeys{$key} = $str; + } elsif ( defined $ekey_names{$key} ) { + # printf "# $n:%s(%s)(%s)\n", $list[$n], $key, $str; + $old_ekeys{$key} = $str; } } - # printf ("last index:%d\n", $#old_keys); + # printf ("last index:%d\n", $#old_fkeys); } -readterm(); +# read the whole terminfo to ensure we get the non-modified stuff, then read +# the part that contains modifiers. +sub read_part($) { + my $part = $_[0]; -# Cycling through the modifiers is not just like counting. Users prefer -# pressing one modifier (even if using Emacs). So first we cycle through -# the individual modifiers, then for completeness two, three, etc. -printf "xterm+pcfkeys|fragment for PC-style keys, \n"; -for ($cur_fkey = 1, $cur_modifier = 1; $cur_fkey < $max_fkeys; ++$cur_fkey) { - my $index = (($cur_fkey - 1) % $min_fkeys); - if ($index == 0 && $cur_fkey != 1) { - $cur_modifier = next_modifier($cur_modifier); + %old_ckeys = (); + @old_fkeys = (); + readterm($terminfo); + readterm($part); +} + +sub nameof_ckeys($) { + my $opts = $_[0]; + my $optname = "xterm+pcc" . ($opts >= 0 ? $opts : "n"); + return $optname; +} + +sub generate_ckeys($) { + my $opts = $_[0]; + my($modifier, $cur_ckey, $index); + + printf "%s|fragment with modifyCursorKeys:%s,\n", + nameof_ckeys($opts), $opts; + + # show the standard cursor definitions + $modifier = 1; + for ($index = 0; $index < $min_ckeys; ++$index) { + $cur_ckey = $index + ($modifier * $min_ckeys); + my $name = $ckey_known[$index]; + my $input = $old_ckeys{$ckey_names[$index]}; + my $result = modify_fkey($modifier + 1, $input, $opts); + printf "\t%s=%s,\n", $name, $result; + if (defined $old_ckeys{$name}) { + if ($old_ckeys{$name} ne $result) { + printf "# found %s=%s\n", $name, $old_ckeys{$name}; + } + } } - my $input = $old_keys[$index + 1]; - my $result = modify_it($cur_modifier,$input); - printf "\tkf%d=%s, \n", $cur_fkey, $result; - if (defined $old_keys[$cur_fkey]) { - if ($old_keys[$cur_fkey] ne $result) { - printf "# diff %s\n", $old_keys[$cur_fkey]; + + # show the extended cursor definitions + for ($index = 0; $index < $min_ckeys; ++$index) { + for ($modifier = 1; $modifier < $max_modifier; ++$modifier) { + $cur_ckey = $index + ($modifier * $min_ckeys); + if (defined $ckey_names[$cur_ckey] and + $ckey_names[$cur_ckey] ne "kLFT" and + $ckey_names[$cur_ckey] ne "kRIT" ) { + my $name = $ckey_names[$cur_ckey]; + my $input = $old_ckeys{$ckey_names[$index]}; + my $result = modify_fkey($modifier + 1, $input, $opts); + printf "\t%s=%s,\n", $name, $result; + if (defined $old_ckeys{$name}) { + if ($old_ckeys{$name} ne $result) { + printf "# found %s=%s\n", $name, $old_ckeys{$name}; + } + } + } + } + } +} + +sub nameof_ekeys($) { + my $opts = $_[0]; + my $optname = "xterm+pce" . ($opts >= 0 ? $opts : "n"); + return $optname; +} + +sub generate_ekeys($) { + my $opts = $_[0]; + my($modifier, $cur_ekey, $index); + + printf "%s|fragment with modifyCursorKeys:%s,\n", + nameof_ekeys($opts), $opts; + + for ($index = 0; $index < $min_ekeys; ++$index) { + for ($modifier = 1; $modifier < $max_modifier; ++$modifier) { + $cur_ekey = $index + ($modifier * $min_ekeys); + if (defined $ekey_names[$cur_ekey] ) { + my $name = $ekey_names[$cur_ekey]; + my $input = $old_ekeys{$ekey_names[$index]}; + my $result = modify_fkey($modifier + 1, $input, $opts); + printf "\t%s=%s,\n", $name, $result; + if (defined $old_ekeys{$name}) { + if ($old_ekeys{$name} ne $result) { + printf "# found %s=%s\n", $name, $old_ekeys{$name}; + } + } + } + } + } +} + +sub nameof_fkeys($) { + my $opts = $_[0]; + my $optname = "xterm+pcf" . ($opts >= 0 ? $opts : "n"); + return $optname; +} + +sub generate_fkeys($) { + my $opts = $_[0]; + my($modifier, $cur_fkey); + + printf "%s|fragment with modifyFunctionKeys:%s and ctrlFKeys:10,\n", + nameof_fkeys($opts), $opts; + + for ($cur_fkey = 1, $modifier = 1; $cur_fkey < $max_fkeys; ++$cur_fkey) { + my $index = (($cur_fkey - 1) % $min_fkeys); + if ($index == 0 && $cur_fkey != 1) { + $modifier = next_modifier($modifier); + } + if (defined $old_fkeys[$index + 1]) { + my $input = $old_fkeys[$index + 1]; + my $result = modify_fkey($modifier, $input, $opts); + printf "\tkf%d=%s,\n", $cur_fkey, $result; + if (defined $old_fkeys[$cur_fkey]) { + if ($old_fkeys[$cur_fkey] ne $result) { + printf "# found kf%d=%s\n", $cur_fkey, $old_fkeys[$cur_fkey]; + } + } } } } + +sub show_default() { + readterm($terminfo); + + printf "xterm+pcfkeys|fragment for PC-style keys,\n"; + printf "\tuse=%s,\n", nameof_ckeys($opt_ckeys); + printf "\tuse=%s,\n", nameof_ekeys($opt_ekeys); + printf "\tuse=%s,\n", nameof_fkeys($opt_fkeys); + + generate_ckeys($opt_ckeys); + generate_ekeys($opt_ekeys); + generate_fkeys($opt_fkeys); +} + +sub show_nondefault() +{ + my $opts; + + for ($opts = 0; $opts <= 3; ++$opts) { + if ($opts != $opt_ckeys) { + read_part(nameof_ckeys($opts)); + generate_ckeys($opts); + } + } + + for ($opts = 0; $opts <= 3; ++$opts) { + if ($opts != $opt_ekeys) { + read_part(nameof_ekeys($opts)); + generate_ekeys($opts); + } + } + + for ($opts = 0; $opts <= 3; ++$opts) { + if ($opts != $opt_fkeys) { + read_part(nameof_fkeys($opts)); + generate_fkeys($opts); + } + } +} + +make_ckey_names(); +make_ekey_names(); + +printf "# gen-pc-fkeys.pl\n"; +printf "# %s:timode\n", "vile"; +show_default(); +show_nondefault(); diff --git a/app/xterm/input.c b/app/xterm/input.c index 9ee1fc5ee..ea8d825c1 100644 --- a/app/xterm/input.c +++ b/app/xterm/input.c @@ -1,4 +1,4 @@ -/* $XTermId: input.c,v 1.310 2009/10/12 00:12:34 tom Exp $ */ +/* $XTermId: input.c,v 1.312 2009/12/29 23:45:29 tom Exp $ */ /* * Copyright 1999-2008,2009 by Thomas E. Dickey @@ -115,7 +115,7 @@ #define KEYSYM_FMT "0x%04lX" /* simplify matching <X11/keysymdef.h> */ -#define TEK4014_GIN(tw) (tw != 0 && tw->screen.TekGIN) +#define TEK4014_GIN(tw) (tw != 0 && TekScreenOf(tw)->TekGIN) typedef struct { KeySym keysym; @@ -178,23 +178,24 @@ ModifierName(unsigned modifier) static void AdjustAfterInput(XtermWidget xw) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); if (screen->scrollkey && screen->topline != 0) WindowScroll(xw, 0); if (screen->marginbell) { int col = screen->max_col - screen->nmarginbell; - if (screen->bellarmed >= 0) { - if (screen->bellarmed == screen->cur_row) { + if (screen->bellArmed >= 0) { + if (screen->bellArmed == screen->cur_row) { if (screen->cur_col >= col) { Bell(XkbBI_MarginBell, 0); - screen->bellarmed = -1; + screen->bellArmed = -1; } - } else - screen->bellarmed = + } else { + screen->bellArmed = screen->cur_col < col ? screen->cur_row : -1; + } } else if (screen->cur_col < col) - screen->bellarmed = screen->cur_row; + screen->bellArmed = screen->cur_row; } } @@ -304,7 +305,7 @@ static Bool allowModifierParm(XtermWidget xw, KEY_DATA * kd) { TKeyboard *keyboard = &(xw->keyboard); - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); int keypad_mode = ((keyboard->flags & MODE_DECKPAM) != 0); Bool result = False; @@ -500,11 +501,11 @@ allowedCharModifiers(XtermWidget xw, unsigned state, KEY_DATA * kd) #if OPT_NUM_LOCK result = filterAltMeta(result, xw->misc.meta_mods, - xw->screen.meta_sends_esc, kd); - if (xw->screen.alt_is_not_meta) { + TScreenOf(xw)->meta_sends_esc, kd); + if (TScreenOf(xw)->alt_is_not_meta) { result = filterAltMeta(result, xw->misc.alt_mods, - xw->screen.alt_sends_esc, kd); + TScreenOf(xw)->alt_sends_esc, kd); } #endif } @@ -776,14 +777,14 @@ xtermDeleteIsDEL(XtermWidget xw) if (xw->keyboard.type == keyboardIsDefault || xw->keyboard.type == keyboardIsVT220) - result = (xw->screen.delete_is_del == True); + result = (TScreenOf(xw)->delete_is_del == True); if (xw->keyboard.type == keyboardIsLegacy) - result = (xw->screen.delete_is_del != False); + result = (TScreenOf(xw)->delete_is_del != False); TRACE(("xtermDeleteIsDEL(%d/%d) = %d\n", xw->keyboard.type, - xw->screen.delete_is_del, + TScreenOf(xw)->delete_is_del, result)); return result; @@ -797,7 +798,7 @@ Input(XtermWidget xw, Char *string; TKeyboard *keyboard = &(xw->keyboard); - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); int j; int key = False; diff --git a/app/xterm/install.sh b/app/xterm/install-sh index 462fa9c3d..462fa9c3d 100644 --- a/app/xterm/install.sh +++ b/app/xterm/install-sh diff --git a/app/xterm/koi8rxterm b/app/xterm/koi8rxterm index ee9a242b9..98f85ca9c 100644 --- a/app/xterm/koi8rxterm +++ b/app/xterm/koi8rxterm @@ -1,7 +1,38 @@ #!/bin/sh -# $XTermId: koi8rxterm,v 1.3 2007/12/30 16:33:06 tom Exp $ +# $XTermId: koi8rxterm,v 1.5 2007/12/30 16:33:06 tom Exp $ +# ----------------------------------------------------------------------------- +# this file is part of xterm +# +# Copyright 2007 by Thomas E. Dickey +# +# All Rights Reserved +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name(s) of the above copyright +# holders shall not be used in advertising or otherwise to promote the +# sale, use or other dealings in this Software without prior written +# authorization. +# ----------------------------------------------------------------------------- # This is a wrapper script to set up xterm with a KOI8-R locale; based on -# uxterm. +# uxterm by Branden Robinson. whoami=koi8rxterm diff --git a/app/xterm/linedata.c b/app/xterm/linedata.c index e097b40a8..b86b0606c 100644 --- a/app/xterm/linedata.c +++ b/app/xterm/linedata.c @@ -1,4 +1,4 @@ -/* $XTermId: linedata.c,v 1.72 2009/09/28 23:58:59 tom Exp $ */ +/* $XTermId: linedata.c,v 1.73 2009/11/28 13:36:02 tom Exp $ */ /************************************************************ @@ -158,7 +158,7 @@ copyLineData(LineData * dst, LineData * src) void initLineData(XtermWidget xw) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); initLineExtra(screen); @@ -194,7 +194,7 @@ CellData * newCellData(XtermWidget xw, Cardinal count) { CellData *result; - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); initLineExtra(screen); result = (CellData *) calloc((size_t) count, (size_t) CellDataSize(screen)); diff --git a/app/xterm/main.c b/app/xterm/main.c index 0e0214df6..204e4b470 100644 --- a/app/xterm/main.c +++ b/app/xterm/main.c @@ -1,4 +1,4 @@ -/* $XTermId: main.c,v 1.597 2009/10/12 21:58:27 tom Exp $ */ +/* $XTermId: main.c,v 1.602 2010/01/20 22:07:23 tom Exp $ */ /* * W A R N I N G @@ -15,7 +15,7 @@ /*********************************************************** -Copyright 2002-2008,2009 by Thomas E. Dickey +Copyright 2002-2009,2010 by Thomas E. Dickey All Rights Reserved @@ -457,7 +457,7 @@ static int pty_search(int * /* pty */ ); #endif /* ! VMS */ static int get_pty(int *pty, char *from); -static void resize_termcap(XtermWidget xw, char *newtc); +static void resize_termcap(XtermWidget xw); static void set_owner(char *device, uid_t uid, gid_t gid, mode_t mode); static Bool added_utmp_entry = False; @@ -893,7 +893,7 @@ static XtResource application_resources[] = #endif }; -static char *fallback_resources[] = +static String fallback_resources[] = { "*SimpleMenu*menuLabel.vertSpace: 100", "*SimpleMenu*HorizontalMargins: 16", @@ -912,198 +912,198 @@ static char *fallback_resources[] = pass over the remaining options after XrmParseCommand is let loose. */ /* *INDENT-OFF* */ static XrmOptionDescRec optionDescList[] = { -{"-geometry", "*vt100.geometry",XrmoptionSepArg, (caddr_t) NULL}, -{"-132", "*c132", XrmoptionNoArg, (caddr_t) "on"}, -{"+132", "*c132", XrmoptionNoArg, (caddr_t) "off"}, -{"-ah", "*alwaysHighlight", XrmoptionNoArg, (caddr_t) "on"}, -{"+ah", "*alwaysHighlight", XrmoptionNoArg, (caddr_t) "off"}, -{"-aw", "*autoWrap", XrmoptionNoArg, (caddr_t) "on"}, -{"+aw", "*autoWrap", XrmoptionNoArg, (caddr_t) "off"}, +{"-geometry", "*vt100.geometry",XrmoptionSepArg, (XPointer) NULL}, +{"-132", "*c132", XrmoptionNoArg, (XPointer) "on"}, +{"+132", "*c132", XrmoptionNoArg, (XPointer) "off"}, +{"-ah", "*alwaysHighlight", XrmoptionNoArg, (XPointer) "on"}, +{"+ah", "*alwaysHighlight", XrmoptionNoArg, (XPointer) "off"}, +{"-aw", "*autoWrap", XrmoptionNoArg, (XPointer) "on"}, +{"+aw", "*autoWrap", XrmoptionNoArg, (XPointer) "off"}, #ifndef NO_ACTIVE_ICON -{"-ai", "*activeIcon", XrmoptionNoArg, (caddr_t) "off"}, -{"+ai", "*activeIcon", XrmoptionNoArg, (caddr_t) "on"}, +{"-ai", "*activeIcon", XrmoptionNoArg, (XPointer) "off"}, +{"+ai", "*activeIcon", XrmoptionNoArg, (XPointer) "on"}, #endif /* NO_ACTIVE_ICON */ -{"-b", "*internalBorder",XrmoptionSepArg, (caddr_t) NULL}, -{"-bc", "*cursorBlink", XrmoptionNoArg, (caddr_t) "on"}, -{"+bc", "*cursorBlink", XrmoptionNoArg, (caddr_t) "off"}, -{"-bcf", "*cursorOffTime",XrmoptionSepArg, (caddr_t) NULL}, -{"-bcn", "*cursorOnTime",XrmoptionSepArg, (caddr_t) NULL}, -{"-bdc", "*colorBDMode", XrmoptionNoArg, (caddr_t) "off"}, -{"+bdc", "*colorBDMode", XrmoptionNoArg, (caddr_t) "on"}, -{"-cb", "*cutToBeginningOfLine", XrmoptionNoArg, (caddr_t) "off"}, -{"+cb", "*cutToBeginningOfLine", XrmoptionNoArg, (caddr_t) "on"}, -{"-cc", "*charClass", XrmoptionSepArg, (caddr_t) NULL}, -{"-cm", "*colorMode", XrmoptionNoArg, (caddr_t) "off"}, -{"+cm", "*colorMode", XrmoptionNoArg, (caddr_t) "on"}, -{"-cn", "*cutNewline", XrmoptionNoArg, (caddr_t) "off"}, -{"+cn", "*cutNewline", XrmoptionNoArg, (caddr_t) "on"}, -{"-cr", "*cursorColor", XrmoptionSepArg, (caddr_t) NULL}, -{"-cu", "*curses", XrmoptionNoArg, (caddr_t) "on"}, -{"+cu", "*curses", XrmoptionNoArg, (caddr_t) "off"}, -{"-dc", "*dynamicColors",XrmoptionNoArg, (caddr_t) "off"}, -{"+dc", "*dynamicColors",XrmoptionNoArg, (caddr_t) "on"}, -{"-fb", "*boldFont", XrmoptionSepArg, (caddr_t) NULL}, -{"-fbb", "*freeBoldBox", XrmoptionNoArg, (caddr_t)"off"}, -{"+fbb", "*freeBoldBox", XrmoptionNoArg, (caddr_t)"on"}, -{"-fbx", "*forceBoxChars", XrmoptionNoArg, (caddr_t)"off"}, -{"+fbx", "*forceBoxChars", XrmoptionNoArg, (caddr_t)"on"}, +{"-b", "*internalBorder",XrmoptionSepArg, (XPointer) NULL}, +{"-bc", "*cursorBlink", XrmoptionNoArg, (XPointer) "on"}, +{"+bc", "*cursorBlink", XrmoptionNoArg, (XPointer) "off"}, +{"-bcf", "*cursorOffTime",XrmoptionSepArg, (XPointer) NULL}, +{"-bcn", "*cursorOnTime",XrmoptionSepArg, (XPointer) NULL}, +{"-bdc", "*colorBDMode", XrmoptionNoArg, (XPointer) "off"}, +{"+bdc", "*colorBDMode", XrmoptionNoArg, (XPointer) "on"}, +{"-cb", "*cutToBeginningOfLine", XrmoptionNoArg, (XPointer) "off"}, +{"+cb", "*cutToBeginningOfLine", XrmoptionNoArg, (XPointer) "on"}, +{"-cc", "*charClass", XrmoptionSepArg, (XPointer) NULL}, +{"-cm", "*colorMode", XrmoptionNoArg, (XPointer) "off"}, +{"+cm", "*colorMode", XrmoptionNoArg, (XPointer) "on"}, +{"-cn", "*cutNewline", XrmoptionNoArg, (XPointer) "off"}, +{"+cn", "*cutNewline", XrmoptionNoArg, (XPointer) "on"}, +{"-cr", "*cursorColor", XrmoptionSepArg, (XPointer) NULL}, +{"-cu", "*curses", XrmoptionNoArg, (XPointer) "on"}, +{"+cu", "*curses", XrmoptionNoArg, (XPointer) "off"}, +{"-dc", "*dynamicColors",XrmoptionNoArg, (XPointer) "off"}, +{"+dc", "*dynamicColors",XrmoptionNoArg, (XPointer) "on"}, +{"-fb", "*boldFont", XrmoptionSepArg, (XPointer) NULL}, +{"-fbb", "*freeBoldBox", XrmoptionNoArg, (XPointer)"off"}, +{"+fbb", "*freeBoldBox", XrmoptionNoArg, (XPointer)"on"}, +{"-fbx", "*forceBoxChars", XrmoptionNoArg, (XPointer)"off"}, +{"+fbx", "*forceBoxChars", XrmoptionNoArg, (XPointer)"on"}, #ifndef NO_ACTIVE_ICON -{"-fi", "*iconFont", XrmoptionSepArg, (caddr_t) NULL}, +{"-fi", "*iconFont", XrmoptionSepArg, (XPointer) NULL}, #endif /* NO_ACTIVE_ICON */ #if OPT_RENDERFONT -{"-fa", "*faceName", XrmoptionSepArg, (caddr_t) NULL}, -{"-fd", "*faceNameDoublesize", XrmoptionSepArg, (caddr_t) NULL}, -{"-fs", "*faceSize", XrmoptionSepArg, (caddr_t) NULL}, +{"-fa", "*faceName", XrmoptionSepArg, (XPointer) NULL}, +{"-fd", "*faceNameDoublesize", XrmoptionSepArg, (XPointer) NULL}, +{"-fs", "*faceSize", XrmoptionSepArg, (XPointer) NULL}, #endif #if OPT_WIDE_CHARS -{"-fw", "*wideFont", XrmoptionSepArg, (caddr_t) NULL}, -{"-fwb", "*wideBoldFont", XrmoptionSepArg, (caddr_t) NULL}, +{"-fw", "*wideFont", XrmoptionSepArg, (XPointer) NULL}, +{"-fwb", "*wideBoldFont", XrmoptionSepArg, (XPointer) NULL}, #endif #if OPT_INPUT_METHOD -{"-fx", "*ximFont", XrmoptionSepArg, (caddr_t) NULL}, +{"-fx", "*ximFont", XrmoptionSepArg, (XPointer) NULL}, #endif #if OPT_HIGHLIGHT_COLOR -{"-hc", "*highlightColor", XrmoptionSepArg, (caddr_t) NULL}, -{"-hm", "*highlightColorMode", XrmoptionNoArg, (caddr_t) "on"}, -{"+hm", "*highlightColorMode", XrmoptionNoArg, (caddr_t) "off"}, -{"-selfg", "*highlightTextColor", XrmoptionSepArg, (caddr_t) NULL}, -{"-selbg", "*highlightColor", XrmoptionSepArg, (caddr_t) NULL}, +{"-hc", "*highlightColor", XrmoptionSepArg, (XPointer) NULL}, +{"-hm", "*highlightColorMode", XrmoptionNoArg, (XPointer) "on"}, +{"+hm", "*highlightColorMode", XrmoptionNoArg, (XPointer) "off"}, +{"-selfg", "*highlightTextColor", XrmoptionSepArg, (XPointer) NULL}, +{"-selbg", "*highlightColor", XrmoptionSepArg, (XPointer) NULL}, #endif #if OPT_HP_FUNC_KEYS -{"-hf", "*hpFunctionKeys",XrmoptionNoArg, (caddr_t) "on"}, -{"+hf", "*hpFunctionKeys",XrmoptionNoArg, (caddr_t) "off"}, +{"-hf", "*hpFunctionKeys",XrmoptionNoArg, (XPointer) "on"}, +{"+hf", "*hpFunctionKeys",XrmoptionNoArg, (XPointer) "off"}, #endif -{"-hold", "*hold", XrmoptionNoArg, (caddr_t) "on"}, -{"+hold", "*hold", XrmoptionNoArg, (caddr_t) "off"}, +{"-hold", "*hold", XrmoptionNoArg, (XPointer) "on"}, +{"+hold", "*hold", XrmoptionNoArg, (XPointer) "off"}, #if OPT_INITIAL_ERASE -{"-ie", "*ptyInitialErase", XrmoptionNoArg, (caddr_t) "on"}, -{"+ie", "*ptyInitialErase", XrmoptionNoArg, (caddr_t) "off"}, +{"-ie", "*ptyInitialErase", XrmoptionNoArg, (XPointer) "on"}, +{"+ie", "*ptyInitialErase", XrmoptionNoArg, (XPointer) "off"}, #endif -{"-j", "*jumpScroll", XrmoptionNoArg, (caddr_t) "on"}, -{"+j", "*jumpScroll", XrmoptionNoArg, (caddr_t) "off"}, +{"-j", "*jumpScroll", XrmoptionNoArg, (XPointer) "on"}, +{"+j", "*jumpScroll", XrmoptionNoArg, (XPointer) "off"}, #if OPT_C1_PRINT -{"-k8", "*allowC1Printable", XrmoptionNoArg, (caddr_t) "on"}, -{"+k8", "*allowC1Printable", XrmoptionNoArg, (caddr_t) "off"}, +{"-k8", "*allowC1Printable", XrmoptionNoArg, (XPointer) "on"}, +{"+k8", "*allowC1Printable", XrmoptionNoArg, (XPointer) "off"}, #endif -{"-kt", "*keyboardType", XrmoptionSepArg, (caddr_t) NULL}, -{"+kt", "*keyboardType", XrmoptionSepArg, (caddr_t) NULL}, +{"-kt", "*keyboardType", XrmoptionSepArg, (XPointer) NULL}, +{"+kt", "*keyboardType", XrmoptionSepArg, (XPointer) NULL}, /* parse logging options anyway for compatibility */ -{"-l", "*logging", XrmoptionNoArg, (caddr_t) "on"}, -{"+l", "*logging", XrmoptionNoArg, (caddr_t) "off"}, -{"-lf", "*logFile", XrmoptionSepArg, (caddr_t) NULL}, -{"-ls", "*loginShell", XrmoptionNoArg, (caddr_t) "on"}, -{"+ls", "*loginShell", XrmoptionNoArg, (caddr_t) "off"}, -{"-mb", "*marginBell", XrmoptionNoArg, (caddr_t) "on"}, -{"+mb", "*marginBell", XrmoptionNoArg, (caddr_t) "off"}, -{"-mc", "*multiClickTime", XrmoptionSepArg, (caddr_t) NULL}, -{"-mesg", "*messages", XrmoptionNoArg, (caddr_t) "off"}, -{"+mesg", "*messages", XrmoptionNoArg, (caddr_t) "on"}, -{"-ms", "*pointerColor",XrmoptionSepArg, (caddr_t) NULL}, -{"-nb", "*nMarginBell", XrmoptionSepArg, (caddr_t) NULL}, -{"-nul", "*underLine", XrmoptionNoArg, (caddr_t) "off"}, -{"+nul", "*underLine", XrmoptionNoArg, (caddr_t) "on"}, -{"-pc", "*boldColors", XrmoptionNoArg, (caddr_t) "on"}, -{"+pc", "*boldColors", XrmoptionNoArg, (caddr_t) "off"}, -{"-rw", "*reverseWrap", XrmoptionNoArg, (caddr_t) "on"}, -{"+rw", "*reverseWrap", XrmoptionNoArg, (caddr_t) "off"}, -{"-s", "*multiScroll", XrmoptionNoArg, (caddr_t) "on"}, -{"+s", "*multiScroll", XrmoptionNoArg, (caddr_t) "off"}, -{"-sb", "*scrollBar", XrmoptionNoArg, (caddr_t) "on"}, -{"+sb", "*scrollBar", XrmoptionNoArg, (caddr_t) "off"}, +{"-l", "*logging", XrmoptionNoArg, (XPointer) "on"}, +{"+l", "*logging", XrmoptionNoArg, (XPointer) "off"}, +{"-lf", "*logFile", XrmoptionSepArg, (XPointer) NULL}, +{"-ls", "*loginShell", XrmoptionNoArg, (XPointer) "on"}, +{"+ls", "*loginShell", XrmoptionNoArg, (XPointer) "off"}, +{"-mb", "*marginBell", XrmoptionNoArg, (XPointer) "on"}, +{"+mb", "*marginBell", XrmoptionNoArg, (XPointer) "off"}, +{"-mc", "*multiClickTime", XrmoptionSepArg, (XPointer) NULL}, +{"-mesg", "*messages", XrmoptionNoArg, (XPointer) "off"}, +{"+mesg", "*messages", XrmoptionNoArg, (XPointer) "on"}, +{"-ms", "*pointerColor",XrmoptionSepArg, (XPointer) NULL}, +{"-nb", "*nMarginBell", XrmoptionSepArg, (XPointer) NULL}, +{"-nul", "*underLine", XrmoptionNoArg, (XPointer) "off"}, +{"+nul", "*underLine", XrmoptionNoArg, (XPointer) "on"}, +{"-pc", "*boldColors", XrmoptionNoArg, (XPointer) "on"}, +{"+pc", "*boldColors", XrmoptionNoArg, (XPointer) "off"}, +{"-rw", "*reverseWrap", XrmoptionNoArg, (XPointer) "on"}, +{"+rw", "*reverseWrap", XrmoptionNoArg, (XPointer) "off"}, +{"-s", "*multiScroll", XrmoptionNoArg, (XPointer) "on"}, +{"+s", "*multiScroll", XrmoptionNoArg, (XPointer) "off"}, +{"-sb", "*scrollBar", XrmoptionNoArg, (XPointer) "on"}, +{"+sb", "*scrollBar", XrmoptionNoArg, (XPointer) "off"}, #ifdef SCROLLBAR_RIGHT -{"-leftbar", "*rightScrollBar", XrmoptionNoArg, (caddr_t) "off"}, -{"-rightbar", "*rightScrollBar", XrmoptionNoArg, (caddr_t) "on"}, -#endif -{"-rvc", "*colorRVMode", XrmoptionNoArg, (caddr_t) "off"}, -{"+rvc", "*colorRVMode", XrmoptionNoArg, (caddr_t) "on"}, -{"-sf", "*sunFunctionKeys", XrmoptionNoArg, (caddr_t) "on"}, -{"+sf", "*sunFunctionKeys", XrmoptionNoArg, (caddr_t) "off"}, -{"-si", "*scrollTtyOutput", XrmoptionNoArg, (caddr_t) "off"}, -{"+si", "*scrollTtyOutput", XrmoptionNoArg, (caddr_t) "on"}, -{"-sk", "*scrollKey", XrmoptionNoArg, (caddr_t) "on"}, -{"+sk", "*scrollKey", XrmoptionNoArg, (caddr_t) "off"}, -{"-sl", "*saveLines", XrmoptionSepArg, (caddr_t) NULL}, +{"-leftbar", "*rightScrollBar", XrmoptionNoArg, (XPointer) "off"}, +{"-rightbar", "*rightScrollBar", XrmoptionNoArg, (XPointer) "on"}, +#endif +{"-rvc", "*colorRVMode", XrmoptionNoArg, (XPointer) "off"}, +{"+rvc", "*colorRVMode", XrmoptionNoArg, (XPointer) "on"}, +{"-sf", "*sunFunctionKeys", XrmoptionNoArg, (XPointer) "on"}, +{"+sf", "*sunFunctionKeys", XrmoptionNoArg, (XPointer) "off"}, +{"-si", "*scrollTtyOutput", XrmoptionNoArg, (XPointer) "off"}, +{"+si", "*scrollTtyOutput", XrmoptionNoArg, (XPointer) "on"}, +{"-sk", "*scrollKey", XrmoptionNoArg, (XPointer) "on"}, +{"+sk", "*scrollKey", XrmoptionNoArg, (XPointer) "off"}, +{"-sl", "*saveLines", XrmoptionSepArg, (XPointer) NULL}, #if OPT_SUNPC_KBD -{"-sp", "*sunKeyboard", XrmoptionNoArg, (caddr_t) "on"}, -{"+sp", "*sunKeyboard", XrmoptionNoArg, (caddr_t) "off"}, +{"-sp", "*sunKeyboard", XrmoptionNoArg, (XPointer) "on"}, +{"+sp", "*sunKeyboard", XrmoptionNoArg, (XPointer) "off"}, #endif #if OPT_TEK4014 -{"-t", "*tekStartup", XrmoptionNoArg, (caddr_t) "on"}, -{"+t", "*tekStartup", XrmoptionNoArg, (caddr_t) "off"}, +{"-t", "*tekStartup", XrmoptionNoArg, (XPointer) "on"}, +{"+t", "*tekStartup", XrmoptionNoArg, (XPointer) "off"}, #endif -{"-ti", "*decTerminalID",XrmoptionSepArg, (caddr_t) NULL}, -{"-tm", "*ttyModes", XrmoptionSepArg, (caddr_t) NULL}, -{"-tn", "*termName", XrmoptionSepArg, (caddr_t) NULL}, +{"-ti", "*decTerminalID",XrmoptionSepArg, (XPointer) NULL}, +{"-tm", "*ttyModes", XrmoptionSepArg, (XPointer) NULL}, +{"-tn", "*termName", XrmoptionSepArg, (XPointer) NULL}, #if OPT_WIDE_CHARS -{"-u8", "*utf8", XrmoptionNoArg, (caddr_t) "2"}, -{"+u8", "*utf8", XrmoptionNoArg, (caddr_t) "0"}, +{"-u8", "*utf8", XrmoptionNoArg, (XPointer) "2"}, +{"+u8", "*utf8", XrmoptionNoArg, (XPointer) "0"}, #endif #if OPT_LUIT_PROG -{"-lc", "*locale", XrmoptionNoArg, (caddr_t) "on"}, -{"+lc", "*locale", XrmoptionNoArg, (caddr_t) "off"}, -{"-lcc", "*localeFilter",XrmoptionSepArg, (caddr_t) NULL}, -{"-en", "*locale", XrmoptionSepArg, (caddr_t) NULL}, -#endif -{"-uc", "*cursorUnderLine", XrmoptionNoArg, (caddr_t) "on"}, -{"+uc", "*cursorUnderLine", XrmoptionNoArg, (caddr_t) "off"}, -{"-ulc", "*colorULMode", XrmoptionNoArg, (caddr_t) "off"}, -{"+ulc", "*colorULMode", XrmoptionNoArg, (caddr_t) "on"}, -{"-ulit", "*italicULMode", XrmoptionNoArg, (caddr_t) "off"}, -{"+ulit", "*italicULMode", XrmoptionNoArg, (caddr_t) "on"}, -{"-ut", "*utmpInhibit", XrmoptionNoArg, (caddr_t) "on"}, -{"+ut", "*utmpInhibit", XrmoptionNoArg, (caddr_t) "off"}, -{"-im", "*useInsertMode", XrmoptionNoArg, (caddr_t) "on"}, -{"+im", "*useInsertMode", XrmoptionNoArg, (caddr_t) "off"}, -{"-vb", "*visualBell", XrmoptionNoArg, (caddr_t) "on"}, -{"+vb", "*visualBell", XrmoptionNoArg, (caddr_t) "off"}, -{"-pob", "*popOnBell", XrmoptionNoArg, (caddr_t) "on"}, -{"+pob", "*popOnBell", XrmoptionNoArg, (caddr_t) "off"}, +{"-lc", "*locale", XrmoptionNoArg, (XPointer) "on"}, +{"+lc", "*locale", XrmoptionNoArg, (XPointer) "off"}, +{"-lcc", "*localeFilter",XrmoptionSepArg, (XPointer) NULL}, +{"-en", "*locale", XrmoptionSepArg, (XPointer) NULL}, +#endif +{"-uc", "*cursorUnderLine", XrmoptionNoArg, (XPointer) "on"}, +{"+uc", "*cursorUnderLine", XrmoptionNoArg, (XPointer) "off"}, +{"-ulc", "*colorULMode", XrmoptionNoArg, (XPointer) "off"}, +{"+ulc", "*colorULMode", XrmoptionNoArg, (XPointer) "on"}, +{"-ulit", "*italicULMode", XrmoptionNoArg, (XPointer) "off"}, +{"+ulit", "*italicULMode", XrmoptionNoArg, (XPointer) "on"}, +{"-ut", "*utmpInhibit", XrmoptionNoArg, (XPointer) "on"}, +{"+ut", "*utmpInhibit", XrmoptionNoArg, (XPointer) "off"}, +{"-im", "*useInsertMode", XrmoptionNoArg, (XPointer) "on"}, +{"+im", "*useInsertMode", XrmoptionNoArg, (XPointer) "off"}, +{"-vb", "*visualBell", XrmoptionNoArg, (XPointer) "on"}, +{"+vb", "*visualBell", XrmoptionNoArg, (XPointer) "off"}, +{"-pob", "*popOnBell", XrmoptionNoArg, (XPointer) "on"}, +{"+pob", "*popOnBell", XrmoptionNoArg, (XPointer) "off"}, #if OPT_WIDE_CHARS -{"-wc", "*wideChars", XrmoptionNoArg, (caddr_t) "on"}, -{"+wc", "*wideChars", XrmoptionNoArg, (caddr_t) "off"}, -{"-mk_width", "*mkWidth", XrmoptionNoArg, (caddr_t) "on"}, -{"+mk_width", "*mkWidth", XrmoptionNoArg, (caddr_t) "off"}, -{"-cjk_width", "*cjkWidth", XrmoptionNoArg, (caddr_t) "on"}, -{"+cjk_width", "*cjkWidth", XrmoptionNoArg, (caddr_t) "off"}, -#endif -{"-wf", "*waitForMap", XrmoptionNoArg, (caddr_t) "on"}, -{"+wf", "*waitForMap", XrmoptionNoArg, (caddr_t) "off"}, +{"-wc", "*wideChars", XrmoptionNoArg, (XPointer) "on"}, +{"+wc", "*wideChars", XrmoptionNoArg, (XPointer) "off"}, +{"-mk_width", "*mkWidth", XrmoptionNoArg, (XPointer) "on"}, +{"+mk_width", "*mkWidth", XrmoptionNoArg, (XPointer) "off"}, +{"-cjk_width", "*cjkWidth", XrmoptionNoArg, (XPointer) "on"}, +{"+cjk_width", "*cjkWidth", XrmoptionNoArg, (XPointer) "off"}, +#endif +{"-wf", "*waitForMap", XrmoptionNoArg, (XPointer) "on"}, +{"+wf", "*waitForMap", XrmoptionNoArg, (XPointer) "off"}, #if OPT_ZICONBEEP -{"-ziconbeep", "*zIconBeep", XrmoptionSepArg, (caddr_t) NULL}, +{"-ziconbeep", "*zIconBeep", XrmoptionSepArg, (XPointer) NULL}, #endif #if OPT_SAME_NAME -{"-samename", "*sameName", XrmoptionNoArg, (caddr_t) "on"}, -{"+samename", "*sameName", XrmoptionNoArg, (caddr_t) "off"}, +{"-samename", "*sameName", XrmoptionNoArg, (XPointer) "on"}, +{"+samename", "*sameName", XrmoptionNoArg, (XPointer) "off"}, #endif #if OPT_SESSION_MGT -{"-sm", "*sessionMgt", XrmoptionNoArg, (caddr_t) "on"}, -{"+sm", "*sessionMgt", XrmoptionNoArg, (caddr_t) "off"}, +{"-sm", "*sessionMgt", XrmoptionNoArg, (XPointer) "on"}, +{"+sm", "*sessionMgt", XrmoptionNoArg, (XPointer) "off"}, #endif #if OPT_TOOLBAR -{"-tb", "*"XtNtoolBar, XrmoptionNoArg, (caddr_t) "on"}, -{"+tb", "*"XtNtoolBar, XrmoptionNoArg, (caddr_t) "off"}, +{"-tb", "*"XtNtoolBar, XrmoptionNoArg, (XPointer) "on"}, +{"+tb", "*"XtNtoolBar, XrmoptionNoArg, (XPointer) "off"}, #endif #if OPT_MAXIMIZE -{"-maximized", "*maximized", XrmoptionNoArg, (caddr_t) "on"}, -{"+maximized", "*maximized", XrmoptionNoArg, (caddr_t) "off"}, +{"-maximized", "*maximized", XrmoptionNoArg, (XPointer) "on"}, +{"+maximized", "*maximized", XrmoptionNoArg, (XPointer) "off"}, #endif /* options that we process ourselves */ -{"-help", NULL, XrmoptionSkipNArgs, (caddr_t) NULL}, -{"-version", NULL, XrmoptionSkipNArgs, (caddr_t) NULL}, -{"-class", NULL, XrmoptionSkipArg, (caddr_t) NULL}, -{"-e", NULL, XrmoptionSkipLine, (caddr_t) NULL}, -{"-into", NULL, XrmoptionSkipArg, (caddr_t) NULL}, +{"-help", NULL, XrmoptionSkipNArgs, (XPointer) NULL}, +{"-version", NULL, XrmoptionSkipNArgs, (XPointer) NULL}, +{"-class", NULL, XrmoptionSkipArg, (XPointer) NULL}, +{"-e", NULL, XrmoptionSkipLine, (XPointer) NULL}, +{"-into", NULL, XrmoptionSkipArg, (XPointer) NULL}, /* bogus old compatibility stuff for which there are standard XtOpenApplication options now */ -{"%", "*tekGeometry", XrmoptionStickyArg, (caddr_t) NULL}, -{"#", ".iconGeometry",XrmoptionStickyArg, (caddr_t) NULL}, -{"-T", ".title", XrmoptionSepArg, (caddr_t) NULL}, -{"-n", "*iconName", XrmoptionSepArg, (caddr_t) NULL}, -{"-r", "*reverseVideo",XrmoptionNoArg, (caddr_t) "on"}, -{"+r", "*reverseVideo",XrmoptionNoArg, (caddr_t) "off"}, -{"-rv", "*reverseVideo",XrmoptionNoArg, (caddr_t) "on"}, -{"+rv", "*reverseVideo",XrmoptionNoArg, (caddr_t) "off"}, -{"-w", ".borderWidth", XrmoptionSepArg, (caddr_t) NULL}, +{"%", "*tekGeometry", XrmoptionStickyArg, (XPointer) NULL}, +{"#", ".iconGeometry",XrmoptionStickyArg, (XPointer) NULL}, +{"-T", ".title", XrmoptionSepArg, (XPointer) NULL}, +{"-n", "*iconName", XrmoptionSepArg, (XPointer) NULL}, +{"-r", "*reverseVideo",XrmoptionNoArg, (XPointer) "on"}, +{"+r", "*reverseVideo",XrmoptionNoArg, (XPointer) "off"}, +{"-rv", "*reverseVideo",XrmoptionNoArg, (XPointer) "on"}, +{"+rv", "*reverseVideo",XrmoptionNoArg, (XPointer) "off"}, +{"-w", ".borderWidth", XrmoptionSepArg, (XPointer) NULL}, }; static OptionHelp xtermOptions[] = { @@ -1265,7 +1265,7 @@ static OptionHelp xtermOptions[] = { { NULL, NULL }}; /* *INDENT-ON* */ -static char *message[] = +static const char *message[] = { "Fonts should be fixed width and, if both normal and bold are specified, should", "have the same size. If only a normal font is specified, it will be used for", @@ -1285,7 +1285,7 @@ decode_keyvalue(char **ptr, int termcap) char *string = *ptr; int value = -1; - TRACE(("...decode '%s'\n", string)); + TRACE(("decode_keyvalue '%s'\n", string)); if (*string == '^') { switch (*++string) { case '?': @@ -1330,6 +1330,7 @@ decode_keyvalue(char **ptr, int termcap) ++string; } *ptr = string; + TRACE(("...decode_keyvalue %#x\n", value)); return value; } @@ -1379,7 +1380,7 @@ Help(void) { OptionHelp *opt; OptionHelp *list = sortedOpts(xtermOptions, optionDescList, XtNumber(optionDescList)); - char **cpp; + const char **cpp; printf("%s usage:\n %s [-options ...] [-e command args]\n\n", xtermVersion(), ProgramName); @@ -1463,7 +1464,7 @@ DeleteWindow(Widget w, hide_vt_window(); else do_hangup(w, (XtPointer) 0, (XtPointer) 0); - } else if (term->screen.Vshow) + } else if (TScreenOf(term)->Vshow) hide_tek_window(); else #endif @@ -2394,14 +2395,14 @@ main(int argc, char *argv[]ENVP_ARG) #if OPT_COLOR_RES TRACE(("checking resource values rv %s fg %s, bg %s\n", BtoS(term->misc.re_verse0), - NonNull(term->screen.Tcolors[TEXT_FG].resource), - NonNull(term->screen.Tcolors[TEXT_BG].resource))); + NonNull(TScreenOf(term)->Tcolors[TEXT_FG].resource), + NonNull(TScreenOf(term)->Tcolors[TEXT_BG].resource))); if ((reversed && term->misc.re_verse0) - && ((term->screen.Tcolors[TEXT_FG].resource - && !isDefaultForeground(term->screen.Tcolors[TEXT_FG].resource)) - || (term->screen.Tcolors[TEXT_BG].resource - && !isDefaultBackground(term->screen.Tcolors[TEXT_BG].resource)) + && ((TScreenOf(term)->Tcolors[TEXT_FG].resource + && !isDefaultForeground(TScreenOf(term)->Tcolors[TEXT_FG].resource)) + || (TScreenOf(term)->Tcolors[TEXT_BG].resource + && !isDefaultBackground(TScreenOf(term)->Tcolors[TEXT_BG].resource)) )) ReverseVideo(term); #endif /* OPT_COLOR_RES */ @@ -3268,12 +3269,10 @@ spawnXTerm(XtermWidget xw) #if OPT_TEK4014 if (TEK4014_ACTIVE(xw)) { envnew = tekterm; - newtc = TekScreenOf(tekWidget)->tcapbuf; } else #endif { envnew = vtterm; - newtc = screen->tcapbuf; } /* @@ -3283,7 +3282,7 @@ spawnXTerm(XtermWidget xw) * entry is not found. */ ok_termcap = True; - if (!get_termcap(TermName = resource.term_name, newtc)) { + if (!get_termcap(xw, TermName = resource.term_name)) { const char *last = NULL; char *next; @@ -3292,7 +3291,7 @@ spawnXTerm(XtermWidget xw) while (*envnew != NULL) { if (last == NULL || strcmp(last, *envnew)) { next = x_strdup(*envnew); - if (get_termcap(next, newtc)) { + if (get_termcap(xw, next)) { free(TermName); TermName = next; ok_termcap = True; @@ -3306,7 +3305,7 @@ spawnXTerm(XtermWidget xw) } } if (ok_termcap) { - resize_termcap(xw, newtc); + resize_termcap(xw); } /* @@ -3323,13 +3322,13 @@ spawnXTerm(XtermWidget xw) } else if (resource.ptyInitialErase) { ; } else if (ok_termcap) { - static char name[] = TERMCAP_ERASE; - char temp[1024], *p = temp; - char *s = tgetstr(name, &p); + char *s = get_tcap_erase(xw); TRACE(("...extracting initial_erase value from termcap\n")); if (s != 0) { + char *save = s; initial_erase = decode_keyvalue(&s, True); setInitialErase = True; + free(save); } } TRACE(("...initial_erase:%d\n", initial_erase)); @@ -3357,8 +3356,8 @@ spawnXTerm(XtermWidget xw) TTYSIZE_ROWS(ts) = 38; TTYSIZE_COLS(ts) = 81; #if defined(USE_STRUCT_WINSIZE) - ts.ws_xpixel = TFullWidth(&(tekWidget->screen)); - ts.ws_ypixel = TFullHeight(&(tekWidget->screen)); + ts.ws_xpixel = TFullWidth(TekScreenOf(tekWidget)); + ts.ws_ypixel = TFullHeight(TekScreenOf(tekWidget)); #endif } else #endif @@ -3459,8 +3458,8 @@ spawnXTerm(XtermWidget xw) TTYSIZE_ROWS(ts) = 24; TTYSIZE_COLS(ts) = 80; #ifdef USE_STRUCT_WINSIZE - ts.ws_xpixel = TFullWidth(&(tekWidget->screen)); - ts.ws_ypixel = TFullHeight(&(tekWidget->screen)); + ts.ws_xpixel = TFullWidth(TekScreenOf(tekWidget)); + ts.ws_ypixel = TFullHeight(TekScreenOf(tekWidget)); #endif } else #endif /* OPT_TEK4014 */ @@ -3893,7 +3892,7 @@ spawnXTerm(XtermWidget xw) xtermSetenv("TERM", TermName); if (!TermName) - *newtc = 0; + *get_tcap_buffer(xw) = 0; sprintf(buf, "%lu", ((unsigned long) XtWindow(SHELL_OF(CURRENT_EMU())))); @@ -4287,34 +4286,36 @@ spawnXTerm(XtermWidget xw) xtermSetenv("TERMINFO", OWN_TERMINFO_DIR); #endif #else /* USE_SYSV_ENVVARS */ - resize_termcap(xw, newtc); - if (xw->misc.titeInhibit && !xw->misc.tiXtraScroll) { - remove_termcap_entry(newtc, "ti="); - remove_termcap_entry(newtc, "te="); - } - /* - * work around broken termcap entries */ - if (resource.useInsertMode) { - remove_termcap_entry(newtc, "ic="); - /* don't get duplicates */ - remove_termcap_entry(newtc, "im="); - remove_termcap_entry(newtc, "ei="); - remove_termcap_entry(newtc, "mi"); - if (*newtc) - strcat(newtc, ":im=\\E[4h:ei=\\E[4l:mi:"); - } - if (*newtc) { + if (*(newtc = get_tcap_buffer(xw)) != '\0') { + resize_termcap(xw); + if (xw->misc.titeInhibit && !xw->misc.tiXtraScroll) { + remove_termcap_entry(newtc, "ti="); + remove_termcap_entry(newtc, "te="); + } + /* + * work around broken termcap entries */ + if (resource.useInsertMode) { + remove_termcap_entry(newtc, "ic="); + /* don't get duplicates */ + remove_termcap_entry(newtc, "im="); + remove_termcap_entry(newtc, "ei="); + remove_termcap_entry(newtc, "mi"); + if (*newtc) + strcat(newtc, ":im=\\E[4h:ei=\\E[4l:mi:"); + } + if (*newtc) { #if OPT_INITIAL_ERASE - unsigned len; - remove_termcap_entry(newtc, TERMCAP_ERASE "="); - len = strlen(newtc); - if (len != 0 && newtc[len - 1] == ':') - len--; - sprintf(newtc + len, ":%s=\\%03o:", - TERMCAP_ERASE, - CharOf(initial_erase)); -#endif - xtermSetenv("TERMCAP", newtc); + unsigned len; + remove_termcap_entry(newtc, TERMCAP_ERASE "="); + len = strlen(newtc); + if (len != 0 && newtc[len - 1] == ':') + len--; + sprintf(newtc + len, ":%s=\\%03o:", + TERMCAP_ERASE, + CharOf(initial_erase)); +#endif + xtermSetenv("TERMCAP", newtc); + } } #endif /* USE_SYSV_ENVVARS */ @@ -4716,7 +4717,7 @@ Exit(int n) if (n == 0) { TRACE(("Freeing memory leaks\n")); if (term != 0) { - Display *dpy = term->screen.display; + Display *dpy = TScreenOf(term)->display; if (toplevel) { XtDestroyWidget(toplevel); @@ -4746,8 +4747,10 @@ Exit(int n) /* ARGSUSED */ static void -resize_termcap(XtermWidget xw, char *newtc) +resize_termcap(XtermWidget xw) { + char *newtc = get_tcap_buffer(xw); + #ifndef USE_SYSV_ENVVARS if (!TEK4014_ACTIVE(xw) && *newtc) { TScreen *screen = TScreenOf(xw); @@ -4844,7 +4847,7 @@ reapchild(int n GCC_UNUSED) #endif do { - if (pid == term->screen.pid) { + if (pid == TScreenOf(term)->pid) { #ifdef DEBUG if (debug) fputs("Exiting\n", stderr); @@ -4954,12 +4957,12 @@ GetBytesAvailable(int fd) return (int) arg; #elif defined(__CYGWIN__) fd_set set; - struct timeval timeout = + struct timeval select_timeout = {0, 0}; FD_ZERO(&set); FD_SET(fd, &set); - if (Select(fd + 1, &set, NULL, NULL, &timeout) > 0) + if (Select(fd + 1, &set, NULL, NULL, &select_timeout) > 0) return 1; else return 0; diff --git a/app/xterm/main.h b/app/xterm/main.h index 3e7920de0..fa5688ea9 100644 --- a/app/xterm/main.h +++ b/app/xterm/main.h @@ -1,7 +1,7 @@ -/* $XTermId: main.h,v 1.44 2009/10/10 09:38:25 tom Exp $ */ +/* $XTermId: main.h,v 1.51 2010/01/01 19:53:42 tom Exp $ */ /* - * Copyright 2000-2008,2009 by Thomas E. Dickey + * Copyright 2000-2009,2010 by Thomas E. Dickey * * All Rights Reserved * @@ -91,6 +91,10 @@ #define DEFFACESIZE "14.0" #endif +#ifndef DEF_ALLOW_COLOR +#define DEF_ALLOW_COLOR True +#endif + #ifndef DEF_ALLOW_FONT #define DEF_ALLOW_FONT True #endif @@ -107,6 +111,22 @@ #define DEF_ALLOW_WINDOW False #endif +#ifndef DEF_DISALLOWED_COLOR +#define DEF_DISALLOWED_COLOR "SetColor,GetColor,GetAnsiColor" +#endif + +#ifndef DEF_DISALLOWED_FONT +#define DEF_DISALLOWED_FONT "SetFont,GetFont" +#endif + +#ifndef DEF_DISALLOWED_TCAP +#define DEF_DISALLOWED_TCAP "SetTcap,GetTcap" +#endif + +#ifndef DEF_DISALLOWED_WINDOW +#define DEF_DISALLOWED_WINDOW "20,21,SetXprop,SetSelection" +#endif + #if OPT_BLINK_TEXT #define DEFBLINKASBOLD False #else @@ -145,6 +165,10 @@ #endif #endif +#ifndef DEF_TITLE_MODES +#define DEF_TITLE_MODES 0 +#endif + #ifndef PROJECTROOT #define PROJECTROOT "/usr/X11R6" #endif diff --git a/app/xterm/menu.c b/app/xterm/menu.c index a40d2eadf..e4fb665d0 100644 --- a/app/xterm/menu.c +++ b/app/xterm/menu.c @@ -1,51 +1,58 @@ -/* $XTermId: menu.c,v 1.254 2009/10/11 22:46:44 tom Exp $ */ +/* $XTermId: menu.c,v 1.261 2010/01/04 22:16:06 tom Exp $ */ /* - -Copyright 1999-2008,2009 by Thomas E. Dickey - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of the above listed -copyright holder(s) not be used in advertising or publicity pertaining -to distribution of the software without specific, written prior -permission. - -THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD -TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE -LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -Copyright 1989 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ + * + * Copyright 1999-2009,2010 by Thomas E. Dickey + * + * All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization. + * + * Copyright 1989 The Open Group + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation. + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of The Open Group shall not be + * used in advertising or otherwise to promote the sale, use or other dealings + * in this Software without prior written authorization from The Open Group. + * + */ #include <xterm.h> #include <data.h> @@ -136,7 +143,6 @@ static void do_kill PROTO_XT_CALLBACK_ARGS; static void do_old_fkeys PROTO_XT_CALLBACK_ARGS; static void do_poponbell PROTO_XT_CALLBACK_ARGS; static void do_print PROTO_XT_CALLBACK_ARGS; -static void do_print_everything PROTO_XT_CALLBACK_ARGS; static void do_print_redir PROTO_XT_CALLBACK_ARGS; static void do_quit PROTO_XT_CALLBACK_ARGS; static void do_redraw PROTO_XT_CALLBACK_ARGS; @@ -165,8 +171,9 @@ static void do_activeicon PROTO_XT_CALLBACK_ARGS; #if OPT_ALLOW_XXX_OPS static void enable_allow_xxx_ops (Bool); -static void do_allowTcapOps PROTO_XT_CALLBACK_ARGS; +static void do_allowColorOps PROTO_XT_CALLBACK_ARGS; static void do_allowFontOps PROTO_XT_CALLBACK_ARGS; +static void do_allowTcapOps PROTO_XT_CALLBACK_ARGS; static void do_allowTitleOps PROTO_XT_CALLBACK_ARGS; static void do_allowWindowOps PROTO_XT_CALLBACK_ARGS; #endif @@ -375,8 +382,9 @@ MenuEntry fontMenuEntries[] = { #if OPT_ALLOW_XXX_OPS { "line3", NULL, NULL }, - { "allow-tcap-ops", do_allowTcapOps,NULL }, + { "allow-color-ops",do_allowColorOps,NULL }, { "allow-font-ops", do_allowFontOps,NULL }, + { "allow-tcap-ops", do_allowTcapOps,NULL }, { "allow-title-ops",do_allowTitleOps,NULL }, { "allow-window-ops",do_allowWindowOps,NULL }, #endif @@ -496,7 +504,7 @@ create_menu(Widget w, XtermWidget xtw, MenuIndex num) static Arg arg = {XtNcallback, (XtArgVal) cb}; - TScreen *screen = &xtw->screen; + TScreen *screen = TScreenOf(xtw); MenuHeader *data = &menu_names[num]; MenuList *list = select_menu(w, num); struct _MenuEntry *entries = data->entry_list; @@ -728,26 +736,22 @@ domenu(Widget w, #endif #if OPT_DEC_CHRSET update_font_doublesize(); - if (term->screen.cache_doublesize == 0) + if (TScreenOf(term)->cache_doublesize == 0) SetItemSensitivity( fontMenuEntries[fontMenu_font_doublesize].widget, False); #endif #if OPT_RENDERFONT update_font_renderfont(); - if (term->misc.face_name == 0) { - SetItemSensitivity( - fontMenuEntries[fontMenu_render_font].widget, - False); - } #endif #if OPT_WIDE_CHARS update_font_utf8_mode(); update_font_utf8_title(); #endif #if OPT_ALLOW_XXX_OPS - update_menu_allowTcapOps(); + update_menu_allowColorOps(); update_menu_allowFontOps(); + update_menu_allowTcapOps(); update_menu_allowTitleOps(); update_menu_allowWindowOps(); enable_allow_xxx_ops(!(screen->allowSendEvents)); @@ -763,7 +767,7 @@ domenu(Widget w, #if OPT_TEK4014 case tekMenu: if (created && tekWidget) { - set_tekfont_menu_item(tekWidget->screen.cur.fontsize, True); + set_tekfont_menu_item(TekScreenOf(tekWidget)->cur.fontsize, True); update_vtshow(); } break; @@ -942,15 +946,7 @@ do_print(Widget gw GCC_UNUSED, XtPointer closure GCC_UNUSED, XtPointer data GCC_UNUSED) { - xtermPrintScreen(term, True); -} - -static void -do_print_everything(Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) -{ - xtermPrintEverything(term); + xtermPrintScreen(term, True, getPrinterFlags(term, NULL, 0)); } static void @@ -958,7 +954,7 @@ do_print_redir(Widget gw GCC_UNUSED, XtPointer closure GCC_UNUSED, XtPointer data GCC_UNUSED) { - setPrinterControlMode(term, term->screen.printer_controlmode ? 0 : 2); + setPrinterControlMode(term, TScreenOf(term)->printer_controlmode ? 0 : 2); } static void @@ -972,8 +968,8 @@ do_redraw(Widget gw GCC_UNUSED, void show_8bit_control(Bool value) { - if (term->screen.control_eight_bits != value) { - term->screen.control_eight_bits = (Boolean) value; + if (TScreenOf(term)->control_eight_bits != value) { + TScreenOf(term)->control_eight_bits = (Boolean) value; update_8bit_control(); } } @@ -983,7 +979,7 @@ do_8bit_control(Widget gw GCC_UNUSED, XtPointer closure GCC_UNUSED, XtPointer data GCC_UNUSED) { - show_8bit_control(!term->screen.control_eight_bits); + show_8bit_control(!TScreenOf(term)->control_eight_bits); } static void @@ -1010,7 +1006,7 @@ do_alt_esc(Widget gw GCC_UNUSED, XtPointer closure GCC_UNUSED, XtPointer data GCC_UNUSED) { - ToggleFlag(term->screen.alt_sends_esc); + ToggleFlag(TScreenOf(term)->alt_sends_esc); update_alt_esc(); } @@ -1019,7 +1015,7 @@ do_meta_esc(Widget gw GCC_UNUSED, XtPointer closure GCC_UNUSED, XtPointer data GCC_UNUSED) { - ToggleFlag(term->screen.meta_sends_esc); + ToggleFlag(TScreenOf(term)->meta_sends_esc); update_meta_esc(); } #endif @@ -1030,9 +1026,9 @@ do_delete_del(Widget gw GCC_UNUSED, XtPointer data GCC_UNUSED) { if (xtermDeleteIsDEL(term)) - term->screen.delete_is_del = False; + TScreenOf(term)->delete_is_del = False; else - term->screen.delete_is_del = True; + TScreenOf(term)->delete_is_del = True; update_delete_del(); } @@ -1325,7 +1321,7 @@ do_marginbell(Widget gw GCC_UNUSED, TScreen *screen = TScreenOf(term); if (!(ToggleFlag(screen->marginbell))) - screen->bellarmed = -1; + screen->bellArmed = -1; update_marginbell(); } @@ -1485,8 +1481,8 @@ do_font_doublesize(Widget gw GCC_UNUSED, XtPointer closure GCC_UNUSED, XtPointer data GCC_UNUSED) { - if (term->screen.cache_doublesize != 0) - ToggleFlag(term->screen.font_doublesize); + if (TScreenOf(term)->cache_doublesize != 0) + ToggleFlag(TScreenOf(term)->font_doublesize); update_font_doublesize(); Redraw(); } @@ -1498,7 +1494,7 @@ do_font_boxchars(Widget gw GCC_UNUSED, XtPointer closure GCC_UNUSED, XtPointer data GCC_UNUSED) { - ToggleFlag(term->screen.force_box_chars); + ToggleFlag(TScreenOf(term)->force_box_chars); update_font_boxchars(); Redraw(); } @@ -1508,9 +1504,9 @@ do_font_packed(Widget gw GCC_UNUSED, XtPointer closure GCC_UNUSED, XtPointer data GCC_UNUSED) { - ToggleFlag(term->screen.force_packed); + ToggleFlag(TScreenOf(term)->force_packed); update_font_packed(); - SetVTFont(term, term->screen.menu_font_number, True, NULL); + SetVTFont(term, TScreenOf(term)->menu_font_number, True, NULL); } #endif @@ -1533,7 +1529,7 @@ do_font_renderfont(Widget gw GCC_UNUSED, { TScreen *screen = TScreenOf(term); int fontnum = screen->menu_font_number; - String name = term->screen.MenuFontName(fontnum); + String name = TScreenOf(term)->MenuFontName(fontnum); ToggleFlag(term->misc.render_font); update_font_renderfont(); @@ -1755,6 +1751,9 @@ handle_toggle(void (*proc) PROTO_XT_CALLBACK_ARGS, #define handle_vt_toggle(proc, var, params, nparams, w) \ handle_toggle(proc, (int) (var), params, nparams, w, (XtPointer)0, (XtPointer)0) +#define HANDLE_VT_TOGGLE(name) \ + handle_vt_toggle(do_##name, TScreenOf(term)->name, params, *param_count, w) + #define handle_tek_toggle(proc, var, params, nparams, w) \ handle_toggle(proc, (int) (var), params, nparams, w, (XtPointer)0, (XtPointer)0) @@ -1764,7 +1763,7 @@ HandleAllowSends(Widget w, String * params, Cardinal *param_count) { - handle_vt_toggle(do_allowsends, term->screen.allowSendEvents, + handle_vt_toggle(do_allowsends, TScreenOf(term)->allowSendEvents, params, *param_count, w); } @@ -1774,8 +1773,7 @@ HandleSetVisualBell(Widget w, String * params, Cardinal *param_count) { - handle_vt_toggle(do_visualbell, term->screen.visualbell, - params, *param_count, w); + HANDLE_VT_TOGGLE(visualbell); } void @@ -1784,8 +1782,7 @@ HandleSetPopOnBell(Widget w, String * params, Cardinal *param_count) { - handle_vt_toggle(do_poponbell, term->screen.poponbell, - params, *param_count, w); + HANDLE_VT_TOGGLE(poponbell); } #ifdef ALLOWLOGGING @@ -1795,29 +1792,28 @@ HandleLogging(Widget w, String * params, Cardinal *param_count) { - handle_vt_toggle(do_logging, term->screen.logging, - params, *param_count, w); + HANDLE_VT_TOGGLE(logging); } #endif /* ARGSUSED */ void -HandlePrintScreen(Widget w, +HandlePrintScreen(Widget w GCC_UNUSED, XEvent * event GCC_UNUSED, String * params GCC_UNUSED, Cardinal *param_count GCC_UNUSED) { - do_print(w, (XtPointer) 0, (XtPointer) 0); + xtermPrintScreen(term, True, getPrinterFlags(term, params, param_count)); } /* ARGSUSED */ void -HandlePrintEverything(Widget w, +HandlePrintEverything(Widget w GCC_UNUSED, XEvent * event GCC_UNUSED, - String * params GCC_UNUSED, - Cardinal *param_count GCC_UNUSED) + String * params, + Cardinal *param_count) { - do_print_everything(w, (XtPointer) 0, (XtPointer) 0); + xtermPrintEverything(term, getPrinterFlags(term, params, param_count)); } /* ARGSUSED */ @@ -1901,7 +1897,7 @@ Handle8BitControl(Widget w, String * params, Cardinal *param_count) { - handle_vt_toggle(do_8bit_control, term->screen.control_eight_bits, + handle_vt_toggle(do_8bit_control, TScreenOf(term)->control_eight_bits, params, *param_count, w); } @@ -1944,7 +1940,7 @@ HandleAltEsc(Widget w, String * params, Cardinal *param_count) { - handle_vt_toggle(do_alt_esc, !term->screen.input_eight_bits, + handle_vt_toggle(do_alt_esc, !TScreenOf(term)->input_eight_bits, params, *param_count, w); } @@ -1954,7 +1950,7 @@ HandleMetaEsc(Widget w, String * params, Cardinal *param_count) { - handle_vt_toggle(do_meta_esc, term->screen.meta_sends_esc, + handle_vt_toggle(do_meta_esc, TScreenOf(term)->meta_sends_esc, params, *param_count, w); } #endif @@ -1965,7 +1961,7 @@ HandleDeleteIsDEL(Widget w, String * params, Cardinal *param_count) { - handle_vt_toggle(do_delete_del, term->screen.delete_is_del, + handle_vt_toggle(do_delete_del, TScreenOf(term)->delete_is_del, params, *param_count, w); } @@ -2021,10 +2017,10 @@ HandleScrollbar(Widget w, String * params, Cardinal *param_count) { - if (IsIcon(&(term->screen))) { + if (IsIcon(TScreenOf(term))) { Bell(XkbBI_MinorError, 0); } else { - handle_vt_toggle(do_scrollbar, term->screen.fullVwin.sb_info.width, + handle_vt_toggle(do_scrollbar, TScreenOf(term)->fullVwin.sb_info.width, params, *param_count, w); } } @@ -2035,8 +2031,7 @@ HandleJumpscroll(Widget w, String * params, Cardinal *param_count) { - handle_vt_toggle(do_jumpscroll, term->screen.jumpscroll, - params, *param_count, w); + HANDLE_VT_TOGGLE(jumpscroll); } void @@ -2045,8 +2040,7 @@ HandleKeepSelection(Widget w, String * params, Cardinal *param_count) { - handle_vt_toggle(do_keepSelection, term->screen.keepSelection, - params, *param_count, w); + HANDLE_VT_TOGGLE(keepSelection); } void @@ -2055,7 +2049,7 @@ HandleSetSelect(Widget w, String * params, Cardinal *param_count) { - handle_vt_toggle(do_selectClipboard, term->screen.selectToClipboard, + handle_vt_toggle(do_selectClipboard, TScreenOf(term)->selectToClipboard, params, *param_count, w); } @@ -2125,8 +2119,7 @@ HandleScrollKey(Widget w, String * params, Cardinal *param_count) { - handle_vt_toggle(do_scrollkey, term->screen.scrollkey, - params, *param_count, w); + HANDLE_VT_TOGGLE(scrollkey); } void @@ -2135,8 +2128,7 @@ HandleScrollTtyOutput(Widget w, String * params, Cardinal *param_count) { - handle_vt_toggle(do_scrollttyoutput, term->screen.scrollttyoutput, - params, *param_count, w); + HANDLE_VT_TOGGLE(scrollttyoutput); } void @@ -2145,7 +2137,7 @@ HandleAllow132(Widget w, String * params, Cardinal *param_count) { - handle_vt_toggle(do_allow132, term->screen.c132, + handle_vt_toggle(do_allow132, TScreenOf(term)->c132, params, *param_count, w); } @@ -2155,7 +2147,7 @@ HandleCursesEmul(Widget w, String * params, Cardinal *param_count) { - handle_vt_toggle(do_cursesemul, term->screen.curses, + handle_vt_toggle(do_cursesemul, TScreenOf(term)->curses, params, *param_count, w); } @@ -2165,8 +2157,7 @@ HandleBellIsUrgent(Widget w, String * params, Cardinal *param_count) { - handle_vt_toggle(do_bellIsUrgent, term->screen.bellIsUrgent, - params, *param_count, w); + HANDLE_VT_TOGGLE(bellIsUrgent); } void @@ -2175,8 +2166,7 @@ HandleMarginBell(Widget w, String * params, Cardinal *param_count) { - handle_vt_toggle(do_marginbell, term->screen.marginbell, - params, *param_count, w); + HANDLE_VT_TOGGLE(marginbell); } #if OPT_BLINK_CURS @@ -2187,7 +2177,7 @@ HandleCursorBlink(Widget w, Cardinal *param_count) { /* eventually want to see if sensitive or not */ - handle_vt_toggle(do_cursorblink, term->screen.cursor_blink, + handle_vt_toggle(do_cursorblink, TScreenOf(term)->cursor_blink, params, *param_count, w); } #endif @@ -2199,7 +2189,7 @@ HandleAltScreen(Widget w, Cardinal *param_count) { /* eventually want to see if sensitive or not */ - handle_vt_toggle(do_altscreen, term->screen.whichBuf, + handle_vt_toggle(do_altscreen, TScreenOf(term)->whichBuf, params, *param_count, w); } @@ -2251,8 +2241,7 @@ HandleFontDoublesize(Widget w, String * params, Cardinal *param_count) { - handle_vt_toggle(do_font_doublesize, term->screen.font_doublesize, - params, *param_count, w); + HANDLE_VT_TOGGLE(font_doublesize); } #endif @@ -2263,7 +2252,7 @@ HandleFontBoxChars(Widget w, String * params, Cardinal *param_count) { - handle_vt_toggle(do_font_boxchars, term->screen.force_box_chars, + handle_vt_toggle(do_font_boxchars, TScreenOf(term)->force_box_chars, params, *param_count, w); } @@ -2273,7 +2262,7 @@ HandleFontPacked(Widget w, String * params, Cardinal *param_count) { - handle_vt_toggle(do_font_packed, term->screen.force_packed, + handle_vt_toggle(do_font_packed, TScreenOf(term)->force_packed, params, *param_count, w); } #endif @@ -2309,7 +2298,7 @@ HandleUTF8Mode(Widget w, String * params, Cardinal *param_count) { - handle_vt_toggle(do_font_utf8_mode, term->screen.utf8_mode, + handle_vt_toggle(do_font_utf8_mode, TScreenOf(term)->utf8_mode, params, *param_count, w); } @@ -2319,7 +2308,7 @@ HandleUTF8Title(Widget w, String * params, Cardinal *param_count) { - handle_vt_toggle(do_font_utf8_title, term->screen.utf8_title, + handle_vt_toggle(do_font_utf8_title, TScreenOf(term)->utf8_title, params, *param_count, w); } #endif @@ -2361,7 +2350,7 @@ HandleVisibility(Widget w, switch (params[0][0]) { case 'v': case 'V': - handle_tek_toggle(do_vtonoff, (int) term->screen.Vshow, + handle_tek_toggle(do_vtonoff, (int) TScreenOf(term)->Vshow, params + 1, (*param_count) - 1, w); break; case 't': @@ -2459,7 +2448,7 @@ UpdateMenuItem( if (mi) { menuArgs.value = (XtArgVal) ((val) - ? term->screen.menu_item_bitmap + ? TScreenOf(term)->menu_item_bitmap : None); XtSetValues(mi, &menuArgs, (Cardinal) 1); } @@ -2659,7 +2648,7 @@ InitWidgetMenu(Widget shell) { Bool result = False; - TRACE(("InitWidgetMenu(%p)\n", shell)); + TRACE(("InitWidgetMenu(%p)\n", (void *) shell)); if (term != 0) { if (shell == toplevel) { /* vt100 */ if (!term->init_menu) { @@ -2697,7 +2686,7 @@ toolbar_info(Widget w) #else (void) w; #endif - return &(WhichVWin(&(term->screen))->tb_info); + return &(WhichVWin(TScreenOf(term))->tb_info); } static void @@ -2757,7 +2746,7 @@ ShowToolbar(Bool enable) { TRACE(("ShowToolbar(%d)\n", enable)); - if (IsIcon(&(term->screen))) { + if (IsIcon(TScreenOf(term))) { Bell(XkbBI_MinorError, 0); } else { if (enable) { @@ -2784,7 +2773,7 @@ HandleToolbar(Widget w, String * params GCC_UNUSED, Cardinal *param_count GCC_UNUSED) { - if (IsIcon(&(term->screen))) { + if (IsIcon(TScreenOf(term))) { Bell(XkbBI_MinorError, 0); } else { handle_vt_toggle(do_toolbar, resource.toolBar, @@ -2803,7 +2792,7 @@ do_toolbar(Widget gw GCC_UNUSED, * menu which contains the checkbox indicating whether the toolbar is * active. */ - if (IsIcon(&(term->screen))) { + if (IsIcon(TScreenOf(term))) { Bell(XkbBI_MinorError, 0); } else { ShowToolbar(ToggleFlag(resource.toolBar)); @@ -2826,7 +2815,7 @@ update_securekbd(void) UpdateCheckbox("update_securekbd", mainMenuEntries, mainMenu_securekbd, - term->screen.grabbedKbd); + TScreenOf(term)->grabbedKbd); } void @@ -2835,7 +2824,7 @@ update_allowsends(void) UpdateCheckbox("update_allowsends", mainMenuEntries, mainMenu_allowsends, - term->screen.allowSendEvents); + TScreenOf(term)->allowSendEvents); } #ifdef ALLOWLOGGING @@ -2845,7 +2834,7 @@ update_logging(void) UpdateCheckbox("update_logging", mainMenuEntries, mainMenu_logging, - term->screen.logging); + TScreenOf(term)->logging); } #endif @@ -2855,7 +2844,7 @@ update_print_redir(void) UpdateCheckbox("update_print_redir", mainMenuEntries, mainMenu_print_redir, - term->screen.printer_controlmode); + TScreenOf(term)->printer_controlmode); } void @@ -2864,7 +2853,7 @@ update_8bit_control(void) UpdateCheckbox("update_8bit_control", mainMenuEntries, mainMenu_8bit_ctrl, - term->screen.control_eight_bits); + TScreenOf(term)->control_eight_bits); } void @@ -2892,7 +2881,7 @@ update_alt_esc(void) UpdateCheckbox("update_alt_esc", mainMenuEntries, mainMenu_alt_esc, - term->screen.alt_sends_esc); + TScreenOf(term)->alt_sends_esc); } void @@ -2901,7 +2890,7 @@ update_meta_esc(void) UpdateCheckbox("update_meta_esc", mainMenuEntries, mainMenu_meta_esc, - term->screen.meta_sends_esc); + TScreenOf(term)->meta_sends_esc); } #endif @@ -2993,7 +2982,7 @@ update_jumpscroll(void) UpdateCheckbox("update_jumpscroll", vtMenuEntries, vtMenu_jumpscroll, - term->screen.jumpscroll); + TScreenOf(term)->jumpscroll); } void @@ -3056,7 +3045,7 @@ update_scrollkey(void) UpdateCheckbox("update_scrollkey", vtMenuEntries, vtMenu_scrollkey, - term->screen.scrollkey); + TScreenOf(term)->scrollkey); } void @@ -3065,7 +3054,7 @@ update_scrollttyoutput(void) UpdateCheckbox("update_scrollttyoutput", vtMenuEntries, vtMenu_scrollttyoutput, - term->screen.scrollttyoutput); + TScreenOf(term)->scrollttyoutput); } void @@ -3074,7 +3063,7 @@ update_keepSelection(void) UpdateCheckbox("update_keepSelection", vtMenuEntries, vtMenu_keepSelection, - term->screen.keepSelection); + TScreenOf(term)->keepSelection); } void @@ -3083,7 +3072,7 @@ update_selectToClipboard(void) UpdateCheckbox("update_selectToClipboard", vtMenuEntries, vtMenu_selectToClipboard, - term->screen.selectToClipboard); + TScreenOf(term)->selectToClipboard); } void @@ -3092,7 +3081,7 @@ update_allow132(void) UpdateCheckbox("update_allow132", vtMenuEntries, vtMenu_allow132, - term->screen.c132); + TScreenOf(term)->c132); } void @@ -3100,7 +3089,7 @@ update_cursesemul(void) { #if 0 /* 2006-2-12: no longer menu entry */ UpdateMenuItem("update_cursesemul", vtMenuEntries, vtMenu_cursesemul, - term->screen.curses); + TScreenOf(term)->curses); #endif } @@ -3110,7 +3099,7 @@ update_visualbell(void) UpdateCheckbox("update_visualbell", vtMenuEntries, vtMenu_visualbell, - term->screen.visualbell); + TScreenOf(term)->visualbell); } void @@ -3119,7 +3108,7 @@ update_bellIsUrgent(void) UpdateCheckbox("update_bellIsUrgent", vtMenuEntries, vtMenu_bellIsUrgent, - term->screen.bellIsUrgent); + TScreenOf(term)->bellIsUrgent); } void @@ -3128,7 +3117,7 @@ update_poponbell(void) UpdateCheckbox("update_poponbell", vtMenuEntries, vtMenu_poponbell, - term->screen.poponbell); + TScreenOf(term)->poponbell); } #ifndef update_marginbell /* 2007-3-7: no longer menu entry */ @@ -3138,7 +3127,7 @@ update_marginbell(void) UpdateCheckbox("update_marginbell", vtMenuEntries, vtMenu_marginbell, - term->screen.marginbell); + TScreenOf(term)->marginbell); } #endif @@ -3149,7 +3138,7 @@ update_cursorblink(void) UpdateCheckbox("update_cursorblink", vtMenuEntries, vtMenu_cursorblink, - term->screen.cursor_blink); + TScreenOf(term)->cursor_blink); } #endif @@ -3159,7 +3148,7 @@ update_altscreen(void) UpdateCheckbox("update_altscreen", vtMenuEntries, vtMenu_altscreen, - term->screen.whichBuf); + TScreenOf(term)->whichBuf); } void @@ -3189,7 +3178,7 @@ update_font_doublesize(void) UpdateCheckbox("update_font_doublesize", fontMenuEntries, fontMenu_font_doublesize, - term->screen.font_doublesize); + TScreenOf(term)->font_doublesize); } #endif @@ -3200,7 +3189,7 @@ update_font_boxchars(void) UpdateCheckbox("update_font_boxchars", fontMenuEntries, fontMenu_font_boxchars, - term->screen.force_box_chars); + TScreenOf(term)->force_box_chars); } void @@ -3209,7 +3198,7 @@ update_font_packed(void) UpdateCheckbox("update_font_packed", fontMenuEntries, fontMenu_font_packedfont, - term->screen.force_packed); + TScreenOf(term)->force_packed); } #endif @@ -3232,6 +3221,8 @@ update_font_renderfont(void) fontMenuEntries, fontMenu_render_font, term->misc.render_font); + SetItemSensitivity(fontMenuEntries[fontMenu_render_font].widget, + !IsEmpty(term->misc.face_name)); } #endif @@ -3239,8 +3230,8 @@ update_font_renderfont(void) void update_font_utf8_mode(void) { - Bool active = (term->screen.utf8_mode != uAlways); - Bool enable = (term->screen.utf8_mode != uFalse); + Bool active = (TScreenOf(term)->utf8_mode != uAlways); + Bool enable = (TScreenOf(term)->utf8_mode != uFalse); TRACE(("update_font_utf8_mode active %d, enable %d\n", active, enable)); SetItemSensitivity(fontMenuEntries[fontMenu_wide_chars].widget, active); @@ -3253,8 +3244,8 @@ update_font_utf8_mode(void) void update_font_utf8_title(void) { - Bool active = (term->screen.utf8_mode != uFalse); - Bool enable = (term->screen.utf8_title); + Bool active = (TScreenOf(term)->utf8_mode != uFalse); + Bool enable = (TScreenOf(term)->utf8_title); TRACE(("update_font_utf8_title active %d, enable %d\n", active, enable)); SetItemSensitivity(fontMenuEntries[fontMenu_wide_title].widget, active); @@ -3276,13 +3267,25 @@ enable_allow_xxx_ops(Bool enable) } static void +do_allowColorOps(Widget w, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) +{ + XtermWidget xw = getXtermWidget(w); + if (xw != 0) { + ToggleFlag(TScreenOf(xw)->allowColorOps); + update_menu_allowColorOps(); + } +} + +static void do_allowFontOps(Widget w, XtPointer closure GCC_UNUSED, XtPointer data GCC_UNUSED) { XtermWidget xw = getXtermWidget(w); if (xw != 0) { - ToggleFlag(xw->screen.allowFontOps); + ToggleFlag(TScreenOf(xw)->allowFontOps); update_menu_allowFontOps(); } } @@ -3294,7 +3297,7 @@ do_allowTcapOps(Widget w, { XtermWidget xw = getXtermWidget(w); if (xw != 0) { - ToggleFlag(xw->screen.allowTcapOps); + ToggleFlag(TScreenOf(xw)->allowTcapOps); update_menu_allowTcapOps(); } } @@ -3306,7 +3309,7 @@ do_allowTitleOps(Widget w, { XtermWidget xw = getXtermWidget(w); if (xw != 0) { - ToggleFlag(xw->screen.allowTitleOps); + ToggleFlag(TScreenOf(xw)->allowTitleOps); update_menu_allowTitleOps(); } } @@ -3318,19 +3321,27 @@ do_allowWindowOps(Widget w, { XtermWidget xw = getXtermWidget(w); if (xw != 0) { - ToggleFlag(xw->screen.allowWindowOps); + ToggleFlag(TScreenOf(xw)->allowWindowOps); update_menu_allowWindowOps(); } } void +HandleAllowColorOps(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal *param_count) +{ + HANDLE_VT_TOGGLE(allowColorOps); +} + +void HandleAllowFontOps(Widget w, XEvent * event GCC_UNUSED, String * params, Cardinal *param_count) { - handle_vt_toggle(do_allowFontOps, term->screen.allowFontOps, - params, *param_count, w); + HANDLE_VT_TOGGLE(allowFontOps); } void @@ -3339,8 +3350,7 @@ HandleAllowTcapOps(Widget w, String * params, Cardinal *param_count) { - handle_vt_toggle(do_allowTcapOps, term->screen.allowTcapOps, - params, *param_count, w); + HANDLE_VT_TOGGLE(allowTcapOps); } void @@ -3349,8 +3359,7 @@ HandleAllowTitleOps(Widget w, String * params, Cardinal *param_count) { - handle_vt_toggle(do_allowTitleOps, term->screen.allowTitleOps, - params, *param_count, w); + HANDLE_VT_TOGGLE(allowTitleOps); } void @@ -3359,17 +3368,16 @@ HandleAllowWindowOps(Widget w, String * params, Cardinal *param_count) { - handle_vt_toggle(do_allowWindowOps, term->screen.allowWindowOps, - params, *param_count, w); + HANDLE_VT_TOGGLE(allowWindowOps); } void -update_menu_allowTcapOps(void) +update_menu_allowColorOps(void) { - UpdateCheckbox("update_menu_allowTcapOps", + UpdateCheckbox("update_menu_allowColorOps", fontMenuEntries, - fontMenu_allowTcapOps, - term->screen.allowTcapOps); + fontMenu_allowColorOps, + TScreenOf(term)->allowColorOps); } void @@ -3378,7 +3386,16 @@ update_menu_allowFontOps(void) UpdateCheckbox("update_menu_allowFontOps", fontMenuEntries, fontMenu_allowFontOps, - term->screen.allowFontOps); + TScreenOf(term)->allowFontOps); +} + +void +update_menu_allowTcapOps(void) +{ + UpdateCheckbox("update_menu_allowTcapOps", + fontMenuEntries, + fontMenu_allowTcapOps, + TScreenOf(term)->allowTcapOps); } void @@ -3387,7 +3404,7 @@ update_menu_allowTitleOps(void) UpdateCheckbox("update_menu_allowTitleOps", fontMenuEntries, fontMenu_allowTitleOps, - term->screen.allowTitleOps); + TScreenOf(term)->allowTitleOps); } void @@ -3396,7 +3413,7 @@ update_menu_allowWindowOps(void) UpdateCheckbox("update_menu_allowWindowOps", fontMenuEntries, fontMenu_allowWindowOps, - term->screen.allowWindowOps); + TScreenOf(term)->allowWindowOps); } #endif @@ -3404,7 +3421,7 @@ update_menu_allowWindowOps(void) void update_tekshow(void) { - if (!(term->screen.inhibit & I_TEK)) { + if (!(TScreenOf(term)->inhibit & I_TEK)) { UpdateCheckbox("update_tekshow", vtMenuEntries, vtMenu_tekshow, @@ -3415,7 +3432,7 @@ update_tekshow(void) void update_vttekmode(void) { - if (!(term->screen.inhibit & I_TEK)) { + if (!(TScreenOf(term)->inhibit & I_TEK)) { UpdateCheckbox("update_vtmode", vtMenuEntries, vtMenu_tekmode, @@ -3430,18 +3447,18 @@ update_vttekmode(void) void update_vtshow(void) { - if (!(term->screen.inhibit & I_TEK)) { + if (!(TScreenOf(term)->inhibit & I_TEK)) { UpdateCheckbox("update_vtshow", tekMenuEntries, tekMenu_vtshow, - term->screen.Vshow); + TScreenOf(term)->Vshow); } } void set_vthide_sensitivity(void) { - if (!(term->screen.inhibit & I_TEK)) { + if (!(TScreenOf(term)->inhibit & I_TEK)) { SetItemSensitivity( vtMenuEntries[vtMenu_vthide].widget, TEK4014_SHOWN(term)); @@ -3451,17 +3468,17 @@ set_vthide_sensitivity(void) void set_tekhide_sensitivity(void) { - if (!(term->screen.inhibit & I_TEK)) { + if (!(TScreenOf(term)->inhibit & I_TEK)) { SetItemSensitivity( tekMenuEntries[tekMenu_tekhide].widget, - term->screen.Vshow); + TScreenOf(term)->Vshow); } } void set_tekfont_menu_item(int n, int val) { - if (!(term->screen.inhibit & I_TEK)) { + if (!(TScreenOf(term)->inhibit & I_TEK)) { UpdateCheckbox("set_tekfont_menu_item", tekMenuEntries, FS2MI(n), (val)); } @@ -3473,6 +3490,6 @@ set_menu_font(int val) { UpdateCheckbox("set_menu_font", fontMenuEntries, - term->screen.menu_font_number, + TScreenOf(term)->menu_font_number, (val)); } diff --git a/app/xterm/menu.h b/app/xterm/menu.h index 4cf4890a2..bde9a4979 100644 --- a/app/xterm/menu.h +++ b/app/xterm/menu.h @@ -1,54 +1,60 @@ -/* $XTermId: menu.h,v 1.117 2009/10/11 22:45:22 tom Exp $ */ +/* $XTermId: menu.h,v 1.119 2010/01/04 22:16:06 tom Exp $ */ /* - -Copyright 1999-2007,2009 by Thomas E. Dickey - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of the above listed -copyright holder(s) not be used in advertising or publicity pertaining -to distribution of the software without specific, written prior -permission. - -THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD -TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE -LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - - -Copyright 1989 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ + * + * Copyright 1999-2009,2010 by Thomas E. Dickey + * + * All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization. + * + * Copyright 1989 The Open Group + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation. + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of The Open Group shall + * not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization + * from The Open Group. + * + */ #ifndef included_menu_h #define included_menu_h @@ -69,6 +75,7 @@ extern MenuEntry tekMenuEntries[]; extern void Handle8BitControl PROTO_XT_ACTIONS_ARGS; extern void HandleAllow132 PROTO_XT_ACTIONS_ARGS; +extern void HandleAllowColorOps PROTO_XT_ACTIONS_ARGS; extern void HandleAllowFontOps PROTO_XT_ACTIONS_ARGS; extern void HandleAllowSends PROTO_XT_ACTIONS_ARGS; extern void HandleAllowTcapOps PROTO_XT_ACTIONS_ARGS; @@ -280,8 +287,9 @@ typedef enum { #endif #if OPT_ALLOW_XXX_OPS fontMenu_line3, - fontMenu_allowTcapOps, + fontMenu_allowColorOps, fontMenu_allowFontOps, + fontMenu_allowTcapOps, fontMenu_allowTitleOps, fontMenu_allowWindowOps, #endif @@ -402,8 +410,9 @@ extern void update_poponbell(void); #define update_marginbell() /* nothing */ #if OPT_ALLOW_XXX_OPS -extern void update_menu_allowTcapOps(void); +extern void update_menu_allowColorOps(void); extern void update_menu_allowFontOps(void); +extern void update_menu_allowTcapOps(void); extern void update_menu_allowTitleOps(void); extern void update_menu_allowWindowOps(void); #endif diff --git a/app/xterm/minstall.sh b/app/xterm/minstall.sh index 918030cb8..61bf77856 100644 --- a/app/xterm/minstall.sh +++ b/app/xterm/minstall.sh @@ -1,5 +1,36 @@ #!/bin/sh -# $XTermId: minstall.sh,v 1.14 2009/03/15 23:06:08 tom Exp $ +# $XTermId: minstall.sh,v 1.19 2010/01/20 10:55:42 tom Exp $ +# ----------------------------------------------------------------------------- +# this file is part of xterm +# +# Copyright 2001-2009,2010 by Thomas E. Dickey +# +# All Rights Reserved +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name(s) of the above copyright +# holders shall not be used in advertising or otherwise to promote the +# sale, use or other dealings in this Software without prior written +# authorization. +# ----------------------------------------------------------------------------- # # Install manpages, substituting a reasonable section value since XFree86 4.x # and derived imakes do not use constants... @@ -39,6 +70,40 @@ NEW_FILE=temp$$ MY_MANSECT=$suffix +# utmp and wtmp have different pathnames on different systems, but there +# are only a few common choices. Note that they may not necessarily appear +# in the same directories. Prefer utmpx/wtmpx to utmp/wtmp, since that's +# the way the configure script is designed. +UTMP_NAME=utmp22 +UTMP_PATH=/etc +for name in /etc /var/adm /var/log +do + if test -f $name/utmpx ; then + UTMP_NAME=utmpx + UTMP_PATH=$name + break + elif test -f $name/utmp ; then + UTMP_PATH=$name + break + fi +done +UTMP_PATH=$UTMP_PATH/$UTMP_NAME + +WTMP_NAME=wtmp +WTMP_PATH=/etc +for name in /etc /var/adm /var/log +do + if test -f $name/wtmpx ; then + WTMP_NAME=wtmpx + WTMP_PATH=$name + break + elif test -f $name/wtmp ; then + WTMP_PATH=$name + break + fi +done +WTMP_PATH=$WTMP_PATH/$WTMP_NAME + # "X" is usually in the miscellaneous section, along with "undocumented". # Use that to guess an appropriate section. X_MANSECT=`man X 2>&1 | tr '\012' '\020' | sed -e 's/^[^0123456789]*\([^) ][^) ]*\).*/\1/'` @@ -48,6 +113,10 @@ sed -e 's%__vendorversion__%"X Window System"%' \ -e s%__apploaddir__%$APPS_DIR% \ -e s%__mansuffix__%$MY_MANSECT%g \ -e s%__miscmansuffix__%$X_MANSECT%g \ + -e s%fIutmp'\\%fI'$UTMP_NAME'\\%g' \ + -e s%/etc/utmp%$UTMP_PATH%g \ + -e s%fIwtmp'\\%fI'$WTMP_NAME'\\%g' \ + -e s%/etc/wtmp%$WTMP_PATH%g \ $OLD_FILE >$NEW_FILE echo "$MINSTALL $OLD_FILE $END_FILE" diff --git a/app/xterm/misc.c b/app/xterm/misc.c index d378f9026..20a66e424 100644 --- a/app/xterm/misc.c +++ b/app/xterm/misc.c @@ -1,8 +1,8 @@ -/* $XTermId: misc.c,v 1.428 2009/10/12 00:44:44 tom Exp $ */ +/* $XTermId: misc.c,v 1.482 2010/01/21 09:34:58 tom Exp $ */ /* * - * Copyright 1999-2008,2009 by Thomas E. Dickey + * Copyright 1999-2009,2010 by Thomas E. Dickey * * All Rights Reserved * @@ -225,13 +225,11 @@ DoSpecialEnterNotify(XtermWidget xw, XEnterWindowEvent * ev) TScreen *screen = TScreenOf(xw); TRACE(("DoSpecialEnterNotify(%d)\n", screen->select)); -#ifdef ACTIVEWINDOWINPUTONLY - if (ev->window == XtWindow(XtParent(CURRENT_EMU()))) -#endif - if (((ev->detail) != NotifyInferior) && - ev->focus && - !(screen->select & FOCUS)) - selectwindow(screen, INWINDOW); + TRACE_FOCUS(xw, ev); + if (((ev->detail) != NotifyInferior) && + ev->focus && + !(screen->select & FOCUS)) + selectwindow(screen, INWINDOW); } static void @@ -240,13 +238,11 @@ DoSpecialLeaveNotify(XtermWidget xw, XEnterWindowEvent * ev) TScreen *screen = TScreenOf(xw); TRACE(("DoSpecialLeaveNotify(%d)\n", screen->select)); -#ifdef ACTIVEWINDOWINPUTONLY - if (ev->window == XtWindow(XtParent(CURRENT_EMU()))) -#endif - if (((ev->detail) != NotifyInferior) && - ev->focus && - !(screen->select & FOCUS)) - unselectwindow(screen, INWINDOW); + TRACE_FOCUS(xw, ev); + if (((ev->detail) != NotifyInferior) && + ev->focus && + !(screen->select & FOCUS)) + unselectwindow(screen, INWINDOW); } #ifndef XUrgencyHint @@ -517,10 +513,7 @@ HandleKeyPressed(Widget w GCC_UNUSED, Cardinal *nparams GCC_UNUSED) { TRACE(("Handle insert-seven-bit for %p\n", (void *) w)); -#ifdef ACTIVEWINDOWINPUTONLY - if (w == CURRENT_EMU()) -#endif - Input(term, &event->xkey, False); + Input(term, &event->xkey, False); } /* ARGSUSED */ @@ -531,10 +524,7 @@ HandleEightBitKeyPressed(Widget w GCC_UNUSED, Cardinal *nparams GCC_UNUSED) { TRACE(("Handle insert-eight-bit for %p\n", (void *) w)); -#ifdef ACTIVEWINDOWINPUTONLY - if (w == CURRENT_EMU()) -#endif - Input(term, &event->xkey, True); + Input(term, &event->xkey, True); } /* ARGSUSED */ @@ -544,10 +534,6 @@ HandleStringEvent(Widget w GCC_UNUSED, String * params, Cardinal *nparams) { -#ifdef ACTIVEWINDOWINPUTONLY - if (w != CURRENT_EMU()) - return; -#endif if (*nparams != 1) return; @@ -555,10 +541,11 @@ HandleStringEvent(Widget w GCC_UNUSED, if ((*params)[0] == '0' && (*params)[1] == 'x' && (*params)[2] != '\0') { const char *abcdef = "ABCDEF"; const char *xxxxxx; - Char c, *p; + Char c; + UString p; unsigned value = 0; - for (p = (Char *) (*params + 2); (c = CharOf(x_toupper(*p))) != + for (p = (UString) (*params + 2); (c = CharOf(x_toupper(*p))) != '\0'; p++) { value *= 16; if (c >= '0' && c <= '9') @@ -592,7 +579,7 @@ HandleSpawnTerminal(Widget w GCC_UNUSED, String * params, Cardinal *nparams) { - TScreen *screen = &term->screen; + TScreen *screen = TScreenOf(term); char *child_cwd = NULL; char *child_exe; pid_t pid; @@ -712,6 +699,7 @@ HandleEnterWindow(Widget w GCC_UNUSED, { /* NOP since we handled it above */ TRACE(("HandleEnterWindow ignored\n")); + TRACE_FOCUS(w, event); } /*ARGSUSED*/ @@ -723,6 +711,7 @@ HandleLeaveWindow(Widget w GCC_UNUSED, { /* NOP since we handled it above */ TRACE(("HandleLeaveWindow ignored\n")); + TRACE_FOCUS(w, event); } /*ARGSUSED*/ @@ -740,6 +729,7 @@ HandleFocusChange(Widget w GCC_UNUSED, visibleEventType(event->type), event->mode, event->detail)); + TRACE_FOCUS(xw, event); if (screen->quiet_grab && (event->mode == NotifyGrab || event->mode == NotifyUngrab)) { @@ -824,6 +814,41 @@ xtermBell(XtermWidget xw, int which, int percent) TScreen *screen = TScreenOf(xw); #if defined(HAVE_XKB_BELL_EXT) Atom tony = AtomBell(xw, which); +#endif + + switch (which) { + case XkbBI_Info: + case XkbBI_MinorError: + case XkbBI_MajorError: + case XkbBI_TerminalBell: + switch (screen->warningVolume) { + case bvOff: + percent = -100; + break; + case bvLow: + break; + case bvHigh: + percent = 100; + break; + } + break; + case XkbBI_MarginBell: + switch (screen->marginVolume) { + case bvOff: + percent = -100; + break; + case bvLow: + break; + case bvHigh: + percent = 100; + break; + } + break; + default: + break; + } + +#if defined(HAVE_XKB_BELL_EXT) if (tony != None) { XkbBell(screen->display, VShellWindow, percent, tony); } else @@ -832,7 +857,7 @@ xtermBell(XtermWidget xw, int which, int percent) } void -Bell(int which GCC_UNUSED, int percent) +Bell(int which, int percent) { XtermWidget xw = term; TScreen *screen = TScreenOf(xw); @@ -912,7 +937,7 @@ VisualBell(void) visualGC = XtGetGC((Widget) term, GCFunction + GCForeground, &gcval); #if OPT_TEK4014 if (TEK4014_ACTIVE(term)) { - TekScreen *tekscr = &(tekWidget->screen); + TekScreen *tekscr = TekScreenOf(tekWidget); flashWindow(screen, TWindow(tekscr), visualGC, TFullWidth(tekscr), TFullHeight(tekscr)); @@ -954,7 +979,7 @@ WMFrameWindow(XtermWidget termw) do { if (win_parent) win_current = win_parent; - XQueryTree((&termw->screen)->display, + XQueryTree(TScreenOf(termw)->display, win_current, &win_root, &win_parent, @@ -1141,7 +1166,7 @@ HandleDabbrevExpand(Widget w, TRACE(("Handle dabbrev-expand for %p\n", (void *) w)); if ((xw = getXtermWidget(w)) != 0) { - TScreen *screen = &xw->screen; + TScreen *screen = TScreenOf(xw); if (!dabbrev_expand(screen)) Bell(XkbBI_TerminalBell, 0); } @@ -1184,7 +1209,7 @@ HandleIconify(Widget w, int QueryMaximize(XtermWidget termw, unsigned *width, unsigned *height) { - TScreen *screen = &termw->screen; + TScreen *screen = TScreenOf(termw); XSizeHints hints; long supp = 0; Window root_win; @@ -1236,10 +1261,12 @@ QueryMaximize(XtermWidget termw, unsigned *width, unsigned *height) void RequestMaximize(XtermWidget termw, int maximize) { - TScreen *screen = &termw->screen; + TScreen *screen = TScreenOf(termw); XWindowAttributes wm_attrs, vshell_attrs; unsigned root_width, root_height; + TRACE(("RequestMaximize %s\n", maximize ? "maximize" : "restore")); + if (maximize) { if (QueryMaximize(termw, &root_width, &root_height)) { @@ -1359,7 +1386,7 @@ Redraw(void) } #if OPT_TEK4014 if (TEK4014_SHOWN(term)) { - TekScreen *tekscr = &(tekWidget->screen); + TekScreen *tekscr = TekScreenOf(tekWidget); event.window = TWindow(tekscr); event.width = tekWidget->core.width; event.height = tekWidget->core.height; @@ -1528,7 +1555,7 @@ creat_as(uid_t uid, gid_t gid, Bool append, char *pathname, int mode) If we can check for this possibility without hanging, do so. */ do - if (waited == term->screen.pid) + if (waited == TScreenOf(term)->pid) Cleanup(0); while ((waited = nonblocking_wait()) > 0) ; #endif /* HAVE_WAITPID */ @@ -1748,22 +1775,24 @@ FlushLog(TScreen * screen) static void ReportAnsiColorRequest(XtermWidget xw, int colornum, int final) { - XColor color; - Colormap cmap = xw->core.colormap; - char buffer[80]; - - TRACE(("ReportAnsiColorRequest %d\n", colornum)); - color.pixel = GET_COLOR_RES(xw->screen.Acolors[colornum]); - XQueryColor(xw->screen.display, cmap, &color); - sprintf(buffer, "4;%d;rgb:%04x/%04x/%04x", - colornum, - color.red, - color.green, - color.blue); - unparseputc1(xw, ANSI_OSC); - unparseputs(xw, buffer); - unparseputc1(xw, final); - unparse_end(xw); + if (AllowColorOps(xw, ecGetAnsiColor)) { + XColor color; + Colormap cmap = xw->core.colormap; + char buffer[80]; + + TRACE(("ReportAnsiColorRequest %d\n", colornum)); + color.pixel = GET_COLOR_RES(xw, TScreenOf(xw)->Acolors[colornum]); + XQueryColor(TScreenOf(xw)->display, cmap, &color); + sprintf(buffer, "4;%d;rgb:%04x/%04x/%04x", + colornum, + color.red, + color.green, + color.blue); + unparseputc1(xw, ANSI_OSC); + unparseputs(xw, buffer); + unparseputc1(xw, final); + unparse_end(xw); + } } static unsigned @@ -1896,7 +1925,7 @@ AllocateAnsiColor(XtermWidget xw, { int result; XColor def; - TScreen *screen = &xw->screen; + TScreen *screen = TScreenOf(xw); Colormap cmap = xw->core.colormap; if (XParseColor(screen->display, cmap, spec, &def) @@ -1928,7 +1957,7 @@ AllocateAnsiColor(XtermWidget xw, #if OPT_COLOR_RES Pixel -xtermGetColorRes(ColorRes * res) +xtermGetColorRes(XtermWidget xw, ColorRes * res) { Pixel result = 0; @@ -1936,13 +1965,13 @@ xtermGetColorRes(ColorRes * res) result = res->value; } else { TRACE(("xtermGetColorRes for Acolors[%d]\n", - res - term->screen.Acolors)); + res - TScreenOf(xw)->Acolors)); - if (res >= term->screen.Acolors) { - assert(res - term->screen.Acolors < MAXCOLORS); + if (res >= TScreenOf(xw)->Acolors) { + assert(res - TScreenOf(xw)->Acolors < MAXCOLORS); - if (AllocateAnsiColor(term, res, res->resource) < 0) { - res->value = term->screen.Tcolors[TEXT_FG].value; + if (AllocateAnsiColor(xw, res, res->resource) < 0) { + res->value = TScreenOf(xw)->Tcolors[TEXT_FG].value; res->mode = -True; fprintf(stderr, "%s: Cannot allocate color %s\n", @@ -1958,15 +1987,45 @@ xtermGetColorRes(ColorRes * res) } #endif +static int +ChangeOneAnsiColor(XtermWidget xw, int color, char *name) +{ + int code; + + if (color < 0 || color >= MAXCOLORS) { + code = -1; + } else { + ColorRes *res = &(TScreenOf(xw)->Acolors[color]); + + TRACE(("ChangeAnsiColor for Acolors[%d]\n", color)); + code = AllocateAnsiColor(xw, res, name); + } + return code; +} + +/* + * Set or query entries in the Acolors[] array by parsing pairs of color/name + * values from the given buffer. + * + * The color can be any legal index into Acolors[], which consists of the + * 16/88/256 "ANSI" colors, followed by special color values for the various + * colorXX resources. The indices for the special color values are not + * simple to work with, so an alternative is to use the calls which pass in + * 'first' set to the beginning of those indices. + * + * If the name is "?", report to the host the current value for the color. + */ static Bool ChangeAnsiColorRequest(XtermWidget xw, char *buf, + int first, int final) { char *name; int color; int repaint = False; int code; + int last = (MAXCOLORS - first); TRACE(("ChangeAnsiColorRequest string='%s'\n", buf)); @@ -1977,18 +2036,17 @@ ChangeAnsiColorRequest(XtermWidget xw, *name = '\0'; name++; color = atoi(buf); - if (color < 0 || color >= NUM_ANSI_COLORS) - break; + if (color < 0 || color >= last) + break; /* quit on any error */ buf = strchr(name, ';'); if (buf) { *buf = '\0'; buf++; } - if (!strcmp(name, "?")) - ReportAnsiColorRequest(xw, color, final); - else { - TRACE(("ChangeAnsiColor for Acolors[%d]\n", color)); - code = AllocateAnsiColor(xw, &(xw->screen.Acolors[color]), name); + if (!strcmp(name, "?")) { + ReportAnsiColorRequest(xw, color + first, final); + } else { + code = ChangeOneAnsiColor(xw, color + first, name); if (code < 0) { /* stop on any error */ break; @@ -2000,11 +2058,66 @@ ChangeAnsiColorRequest(XtermWidget xw, */ } } - if (repaint) - xtermRepaint(xw); return (repaint); } + +static Bool +ResetOneAnsiColor(XtermWidget xw, int color, int start) +{ + Bool repaint = False; + int last = MAXCOLORS - start; + + if (color >= 0 && color < last) { + ColorRes *res = &(TScreenOf(xw)->Acolors[color + start]); + + if (res->mode) { + /* a color has been allocated for this slot - test further... */ + if (ChangeOneAnsiColor(xw, color + start, res->resource) > 0) { + repaint = True; + } + } + } + return repaint; +} + +int +ResetAnsiColorRequest(XtermWidget xw, char *buf, int start) +{ + int repaint = 0; + int color; + + TRACE(("ResetAnsiColorRequest(%s)\n", buf)); + if (*buf != '\0') { + /* reset specific colors */ + while (!IsEmpty(buf)) { + char *next; + + color = strtol(buf, &next, 10); + if (next == buf) + break; /* no number at all */ + if (next != 0) { + if (strchr(";", *next) == 0) + break; /* unexpected delimiter */ + ++next; + } + + if (ResetOneAnsiColor(xw, color, start)) { + ++repaint; + } + buf = next; + } + } else { + TRACE(("...resetting all %d colors\n", MAXCOLORS)); + for (color = 0; color < MAXCOLORS; ++color) { + if (ResetOneAnsiColor(xw, color, start)) { + ++repaint; + } + } + } + TRACE(("...ResetAnsiColorRequest ->%d\n", repaint)); + return repaint; +} #else #define find_closest_color(display, cmap, def) 0 #endif /* OPT_ISO_COLORS */ @@ -2016,7 +2129,7 @@ ManipulateSelectionData(XtermWidget xw, TScreen * screen, char *buf, int final) #define PDATA(a,b) { a, #b } static struct { char given; - char *result; + String result; } table[] = { PDATA('s', SELECT), PDATA('p', PRIMARY), @@ -2034,7 +2147,7 @@ ManipulateSelectionData(XtermWidget xw, TScreen * screen, char *buf, int final) const char *base = buf; char *used = x_strdup(base); Cardinal j, n = 0; - char **select_args = 0; + String *select_args = 0; TRACE(("Manipulate selection data\n")); @@ -2063,26 +2176,30 @@ ManipulateSelectionData(XtermWidget xw, TScreen * screen, char *buf, int final) used[n] = 0; if (!strcmp(buf, "?")) { - TRACE(("Getting selection\n")); - unparseputc1(xw, ANSI_OSC); - unparseputs(xw, "52"); - unparseputc(xw, ';'); + if (AllowWindowOps(xw, ewGetSelection)) { + TRACE(("Getting selection\n")); + unparseputc1(xw, ANSI_OSC); + unparseputs(xw, "52"); + unparseputc(xw, ';'); - unparseputs(xw, used); - unparseputc(xw, ';'); + unparseputs(xw, used); + unparseputc(xw, ';'); - /* Tell xtermGetSelection data is base64 encoded */ - screen->base64_paste = n; - screen->base64_final = final; + /* Tell xtermGetSelection data is base64 encoded */ + screen->base64_paste = n; + screen->base64_final = final; - /* terminator will be written in this call */ - xtermGetSelection((Widget) xw, 0, select_args, n, NULL); + /* terminator will be written in this call */ + xtermGetSelection((Widget) xw, 0, select_args, n, NULL); + } } else { - TRACE(("Setting selection with %s\n", buf)); - ClearSelectionBuffer(screen); - while (*buf != '\0') - AppendToSelectionBuffer(screen, CharOf(*buf++)); - CompleteSelection(xw, select_args, n); + if (AllowWindowOps(xw, ewSetSelection)) { + TRACE(("Setting selection with %s\n", buf)); + ClearSelectionBuffer(screen); + while (*buf != '\0') + AppendToSelectionBuffer(screen, CharOf(*buf++)); + CompleteSelection(xw, select_args, n); + } } } } @@ -2090,9 +2207,12 @@ ManipulateSelectionData(XtermWidget xw, TScreen * screen, char *buf, int final) /***====================================================================***/ +#define IsSetUtf8Title(xw) (IsTitleMode(xw, tmSetUtf8) || (xw->screen.utf8_title)) + static Bool -xtermIsPrintable(TScreen * screen, Char ** bufp, Char * last) +xtermIsPrintable(XtermWidget xw, Char ** bufp, Char * last) { + TScreen *screen = TScreenOf(xw); Bool result = False; Char *cp = *bufp; Char *next = cp; @@ -2101,7 +2221,7 @@ xtermIsPrintable(TScreen * screen, Char ** bufp, Char * last) (void) last; #if OPT_WIDE_CHARS - if (xtermEnvUTF8() && screen->utf8_title) { + if (xtermEnvUTF8() && IsSetUtf8Title(xw)) { PtyData data; if (decodeUtf8(fakePtyData(&data, cp, last))) { @@ -2135,7 +2255,7 @@ xtermIsPrintable(TScreen * screen, Char ** bufp, Char * last) /* * Enum corresponding to the actual OSC codes rather than the internal - * array indices. + * array indices. Compare with TermColors. */ typedef enum { OSC_TEXT_FG = 10 @@ -2159,6 +2279,12 @@ typedef enum { ,OSC_NCOLORS } OscTextColors; +/* + * Map codes to OSC controls that can reset colors. + */ +#define OSC_RESET 100 +#define OSC_Reset(code) (code) + OSC_RESET + static ScrnColors *pOldColors = NULL; static Bool @@ -2222,29 +2348,32 @@ oppositeColor(int n) static void ReportColorRequest(XtermWidget xw, int ndx, int final) { - XColor color; - Colormap cmap = xw->core.colormap; - char buffer[80]; + if (AllowColorOps(xw, ecGetColor)) { + XColor color; + Colormap cmap = xw->core.colormap; + char buffer[80]; - /* - * ChangeColorsRequest() has "always" chosen the opposite color when - * reverse-video is set. Report this as the original color index, but - * reporting the opposite color which would be used. - */ - int i = (xw->misc.re_verse) ? oppositeColor(ndx) : ndx; - - GetOldColors(xw); - color.pixel = pOldColors->colors[ndx]; - XQueryColor(xw->screen.display, cmap, &color); - sprintf(buffer, "%d;rgb:%04x/%04x/%04x", i + 10, - color.red, - color.green, - color.blue); - TRACE(("ReportColors %d: %#lx as %s\n", ndx, pOldColors->colors[ndx], buffer)); - unparseputc1(xw, ANSI_OSC); - unparseputs(xw, buffer); - unparseputc1(xw, final); - unparse_end(xw); + /* + * ChangeColorsRequest() has "always" chosen the opposite color when + * reverse-video is set. Report this as the original color index, but + * reporting the opposite color which would be used. + */ + int i = (xw->misc.re_verse) ? oppositeColor(ndx) : ndx; + + GetOldColors(xw); + color.pixel = pOldColors->colors[ndx]; + XQueryColor(TScreenOf(xw)->display, cmap, &color); + sprintf(buffer, "%d;rgb:%04x/%04x/%04x", i + 10, + color.red, + color.green, + color.blue); + TRACE(("ReportColors %d: %#lx as %s\n", + ndx, pOldColors->colors[ndx], buffer)); + unparseputc1(xw, ANSI_OSC); + unparseputs(xw, buffer); + unparseputc1(xw, final); + unparse_end(xw); + } } static Bool @@ -2330,7 +2459,7 @@ ChangeColorsRequest(XtermWidget xw, if (xw->misc.re_verse) ndx = oppositeColor(ndx); - if ((names == NULL) || (names[0] == '\0')) { + if (IsEmpty(names)) { newColors.names[ndx] = NULL; } else { if (names[0] == ';') @@ -2360,16 +2489,227 @@ ChangeColorsRequest(XtermWidget xw, return result; } +static Bool +ResetColorsRequest(XtermWidget xw, + int code) +{ + Bool result = False; + char *thisName; + ScrnColors newColors; + int ndx; + + TRACE(("ResetColorsRequest code=%d\n", code)); + +#if OPT_COLOR_RES + if (GetOldColors(xw)) { + ndx = OscToColorIndex((OscTextColors) (code - OSC_RESET)); + if (xw->misc.re_verse) + ndx = oppositeColor(ndx); + + thisName = xw->screen.Tcolors[ndx].resource; + + newColors.which = 0; + newColors.names[ndx] = NULL; + + if (thisName != 0 + && pOldColors->names[ndx] != 0 + && strcmp(thisName, pOldColors->names[ndx])) { + AllocateTermColor(xw, &newColors, ndx, thisName); + + if (newColors.which != 0) { + ChangeColors(xw, &newColors); + UpdateOldColors(xw, &newColors); + } + } + result = True; + } +#endif + return result; +} + +#if OPT_SHIFT_FONTS +/* + * Initially, 'source' points to '#' or '?'. + * + * Look for an optional sign and optional number. If those are found, lookup + * the corresponding menu font entry. + */ +static int +ParseShiftedFont(XtermWidget xw, char *source, char **target) +{ + TScreen *screen = TScreenOf(xw); + int num = screen->menu_font_number; + int rel = 0; + + if (*++source == '+') { + rel = 1; + source++; + } else if (*source == '-') { + rel = -1; + source++; + } + + if (isdigit(CharOf(*source))) { + int val = atoi(source); + if (rel > 0) + rel = val; + else if (rel < 0) + rel = -val; + else + num = val; + } + + if (rel != 0) { + num = lookupRelativeFontSize(xw, + screen->menu_font_number, rel); + + } + TRACE(("ParseShiftedFont(%s) ->%d (%s)\n", *target, num, source)); + *target = source; + return num; +} + +static void +QueryFontRequest(XtermWidget xw, char *buf, int final) +{ + if (AllowFontOps(xw, efGetFont)) { + TScreen *screen = TScreenOf(xw); + Bool success = True; + int num; + char *base = buf + 1; + char *name = 0; + char temp[10]; + + num = ParseShiftedFont(xw, buf, &buf); + if (num < 0 + || num > fontMenu_lastBuiltin) { + Bell(XkbBI_MinorError, 0); + success = False; + } else { +#if OPT_RENDERFONT + if (UsingRenderFont(xw)) { + name = getFaceName(xw, False); + } else +#endif + if ((name = screen->MenuFontName(num)) == 0) { + success = False; + } + } + + unparseputc1(xw, ANSI_OSC); + unparseputs(xw, "50"); + + if (success) { + unparseputc(xw, ';'); + if (buf >= base) { + /* identify the font-entry, unless it is the current one */ + if (*buf != '\0') { + unparseputc(xw, '#'); + sprintf(temp, "%d", num); + unparseputs(xw, temp); + if (*name != '\0') + unparseputc(xw, ' '); + } + } + unparseputs(xw, name); + } + + unparseputc1(xw, final); + unparse_end(xw); + } +} + +static void +ChangeFontRequest(XtermWidget xw, char *buf) +{ + if (AllowFontOps(xw, efSetFont)) { + TScreen *screen = TScreenOf(xw); + Bool success = True; + int num; + VTFontNames fonts; + char *name; + + /* + * If the font specification is a "#", followed by an optional sign and + * optional number, lookup the corresponding menu font entry. + * + * Further, if the "#", etc., is followed by a font name, use that + * to load the font entry. + */ + if (*buf == '#') { + num = ParseShiftedFont(xw, buf, &buf); + + if (num < 0 + || num > fontMenu_lastBuiltin) { + Bell(XkbBI_MinorError, 0); + success = False; + } else { + /* + * Skip past the optional number, and any whitespace to look + * for a font specification within the control. + */ + while (isdigit(CharOf(*buf))) { + ++buf; + } + while (isspace(CharOf(*buf))) { + ++buf; + } +#if OPT_RENDERFONT + if (UsingRenderFont(xw)) { + ; /* there is only one font entry to load */ + } else +#endif + { + /* + * Normally there is no font specified in the control. + * But if there is, simply overwrite the font entry. + */ + if (*buf == '\0') { + if ((buf = screen->MenuFontName(num)) == 0) { + success = False; + } + } + } + } + } else { + num = screen->menu_font_number; + } + name = x_strtrim(buf); + if (success && !IsEmpty(name)) { +#if OPT_RENDERFONT + if (UsingRenderFont(xw)) { + setFaceName(xw, name); + xtermUpdateFontInfo(xw, True); + } else +#endif + { + memset(&fonts, 0, sizeof(fonts)); + fonts.f_n = name; + SetVTFont(xw, num, True, &fonts); + } + } else { + Bell(XkbBI_MinorError, 0); + } + free(name); + } +} +#endif /* OPT_SHIFT_FONTS */ + /***====================================================================***/ void do_osc(XtermWidget xw, Char * oscbuf, unsigned len GCC_UNUSED, int final) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); int mode; Char *cp; int state = 0; char *buf = 0; + char temp[2]; +#if OPT_ISO_COLORS + int ansi_colors = 0; +#endif + Bool need_data = True; TRACE(("do_osc %s\n", oscbuf)); @@ -2405,7 +2745,7 @@ do_osc(XtermWidget xw, Char * oscbuf, unsigned len GCC_UNUSED, int final) state = 3; /* FALLTHRU */ default: - if (!xtermIsPrintable(screen, &cp, oscbuf + len)) { + if (!xtermIsPrintable(xw, &cp, oscbuf + len)) { switch (mode) { case 0: case 1: @@ -2420,8 +2760,49 @@ do_osc(XtermWidget xw, Char * oscbuf, unsigned len GCC_UNUSED, int final) } } } - if (buf == 0) { - TRACE(("do_osc found no data\n")); + + /* + * Most OSC controls other than resets require data. Handle the others as + * a special case. + */ + switch (mode) { +#if OPT_ISO_COLORS + case OSC_Reset(4): + case OSC_Reset(5): + case OSC_Reset(OSC_TEXT_FG): + case OSC_Reset(OSC_TEXT_BG): + case OSC_Reset(OSC_TEXT_CURSOR): + case OSC_Reset(OSC_MOUSE_FG): + case OSC_Reset(OSC_MOUSE_BG): +#if OPT_HIGHLIGHT_COLOR + case OSC_Reset(OSC_HIGHLIGHT_BG): + case OSC_Reset(OSC_HIGHLIGHT_FG): +#endif +#if OPT_TEK4014 + case OSC_Reset(OSC_TEK_FG): + case OSC_Reset(OSC_TEK_BG): + case OSC_Reset(OSC_TEK_CURSOR): +#endif + need_data = False; + break; +#endif + default: + break; + } + + /* + * Check if we have data when we want, and not when we do not want it. + * Either way, that is a malformed control sequence, and will be ignored. + */ + if (IsEmpty(buf)) { + if (need_data) { + TRACE(("do_osc found no data\n")); + return; + } + temp[0] = '\0'; + buf = temp; + } else if (!need_data) { + TRACE(("do_osc found found unwanted data\n")); return; } @@ -2440,12 +2821,23 @@ do_osc(XtermWidget xw, Char * oscbuf, unsigned len GCC_UNUSED, int final) break; case 3: /* change X property */ - if (AllowWindowOps(xw)) + if (AllowWindowOps(xw, ewSetXprop)) ChangeXprop(buf); break; #if OPT_ISO_COLORS + case 5: + ansi_colors = NUM_ANSI_COLORS; + /* FALLTHRU */ case 4: - ChangeAnsiColorRequest(xw, buf, final); + if (ChangeAnsiColorRequest(xw, buf, ansi_colors, final)) + xtermRepaint(xw); + break; + case OSC_Reset(5): + ansi_colors = NUM_ANSI_COLORS; + /* FALLTHRU */ + case OSC_Reset(4): + if (ResetAnsiColorRequest(xw, buf, ansi_colors)) + xtermRepaint(xw); break; #endif case OSC_TEXT_FG: @@ -2455,14 +2847,34 @@ do_osc(XtermWidget xw, Char * oscbuf, unsigned len GCC_UNUSED, int final) case OSC_MOUSE_BG: #if OPT_HIGHLIGHT_COLOR case OSC_HIGHLIGHT_BG: + case OSC_HIGHLIGHT_FG: #endif #if OPT_TEK4014 case OSC_TEK_FG: case OSC_TEK_BG: case OSC_TEK_CURSOR: #endif - if (xw->misc.dynamicColors) + if (xw->misc.dynamicColors) { ChangeColorsRequest(xw, mode, buf, final); + } + break; + case OSC_Reset(OSC_TEXT_FG): + case OSC_Reset(OSC_TEXT_BG): + case OSC_Reset(OSC_TEXT_CURSOR): + case OSC_Reset(OSC_MOUSE_FG): + case OSC_Reset(OSC_MOUSE_BG): +#if OPT_HIGHLIGHT_COLOR + case OSC_Reset(OSC_HIGHLIGHT_BG): + case OSC_Reset(OSC_HIGHLIGHT_FG): +#endif +#if OPT_TEK4014 + case OSC_Reset(OSC_TEK_FG): + case OSC_Reset(OSC_TEK_BG): + case OSC_Reset(OSC_TEK_CURSOR): +#endif + if (xw->misc.dynamicColors) { + ResetColorsRequest(xw, mode); + } break; case 30: @@ -2477,8 +2889,7 @@ do_osc(XtermWidget xw, Char * oscbuf, unsigned len GCC_UNUSED, int final) * Warning, enabling this feature allows people to overwrite * arbitrary files accessible to the person running xterm. */ - if (buf != 0 - && strcmp(buf, "?") + if (strcmp(buf, "?") && (cp = CastMallocN(char, strlen(buf)) != NULL)) { strcpy(cp, buf); if (screen->logfile) @@ -2494,70 +2905,10 @@ do_osc(XtermWidget xw, Char * oscbuf, unsigned len GCC_UNUSED, int final) case 50: #if OPT_SHIFT_FONTS - if (!AllowFontOps(xw) && xw->misc.shift_fonts) { - ; /* disabled via resource or control-sequence */ - } else if (buf != 0 && !strcmp(buf, "?")) { - int num = screen->menu_font_number; - - unparseputc1(xw, ANSI_OSC); - unparseputs(xw, "50"); - - if ((buf = screen->MenuFontName(num)) != 0) { - unparseputc(xw, ';'); - unparseputs(xw, buf); - } - unparseputc1(xw, final); - unparse_end(xw); - } else if (buf != 0) { - int num = screen->menu_font_number; - VTFontNames fonts; - - memset(&fonts, 0, sizeof(fonts)); - - /* - * If the font specification is a "#", followed by an - * optional sign and optional number, lookup the - * corresponding menu font entry. - */ - if (*buf == '#') { - int rel = 0; - - if (*++buf == '+') { - rel = 1; - buf++; - } else if (*buf == '-') { - rel = -1; - buf++; - } - - if (isdigit(CharOf(*buf))) { - int val = atoi(buf); - if (rel > 0) - rel = val; - else if (rel < 0) - rel = -val; - else - num = val; - } else if (rel == 0) { - num = 0; - } - - if (rel != 0) { - num = lookupRelativeFontSize(xw, - screen->menu_font_number, rel); - - } - if (num < 0 - || num > fontMenu_lastBuiltin - || (buf = screen->MenuFontName(num)) == 0) { - Bell(XkbBI_MinorError, 0); - break; - } - } else { - num = fontMenu_fontescape; - } - fonts.f_n = buf; - SetVTFont(xw, num, True, &fonts); + if (*buf == '?') { + QueryFontRequest(xw, buf, final); + } else if (xw->misc.shift_fonts) { + ChangeFontRequest(xw, buf); } #endif /* OPT_SHIFT_FONTS */ break; @@ -2567,14 +2918,16 @@ do_osc(XtermWidget xw, Char * oscbuf, unsigned len GCC_UNUSED, int final) #if OPT_PASTE64 case 52: - if (AllowWindowOps(xw)) - ManipulateSelectionData(xw, screen, buf, final); + ManipulateSelectionData(xw, screen, buf, final); break; #endif /* * One could write code to send back the display and host names, * but that could potentially open a fairly nasty security hole. */ + default: + TRACE(("do_osc - unrecognized code\n")); + break; } unparse_end(xw); } @@ -2596,22 +2949,21 @@ static struct { * "real" terminals accept commas in the string definitions). */ static int -udk_value(char **cp) +udk_value(const char **cp) { + int result = -1; int c; for (;;) { if ((c = **cp) != '\0') *cp = *cp + 1; if (c == ';' || c == '\0') - return -1; - if (c >= '0' && c <= '9') - return c - '0'; - if (c >= 'A' && c <= 'F') - return c - 'A' + 10; - if (c >= 'a' && c <= 'f') - return c - 'a' + 10; + break; + if ((result = x_hex2int(c)) >= 0) + break; } + + return result; } void @@ -2631,10 +2983,10 @@ reset_decudk(void) * Parse the data for DECUDK (user-defined keys). */ static void -parse_decudk(char *cp) +parse_decudk(const char *cp) { while (*cp) { - char *base = cp; + const char *base = cp; char *str = CastMallocN(char, strlen(cp) + 1); unsigned key = 0; int lo, hi; @@ -2669,7 +3021,7 @@ parse_decudk(char *cp) #define SOFT_HIGH 20 static void -parse_decdld(ANSI * params, char *string) +parse_decdld(ANSI * params, const char *string) { char DscsName[8]; int len; @@ -2783,9 +3135,9 @@ parse_decdld(ANSI * params, char *string) * interspersing with control characters, but have the string already. */ static void -parse_ansi_params(ANSI * params, char **string) +parse_ansi_params(ANSI * params, const char **string) { - char *cp = *string; + const char *cp = *string; ParmType nparam = 0; memset(params, 0, sizeof(*params)); @@ -2815,9 +3167,9 @@ parse_ansi_params(ANSI * params, char **string) void do_dcs(XtermWidget xw, Char * dcsbuf, size_t dcslen) { - TScreen *screen = &xw->screen; + TScreen *screen = TScreenOf(xw); char reply[BUFSIZ]; - char *cp = (char *) dcsbuf; + const char *cp = (const char *) dcsbuf; Bool okay; ANSI params; @@ -2930,58 +3282,69 @@ do_dcs(XtermWidget xw, Char * dcsbuf, size_t dcslen) #if OPT_TCAP_QUERY case '+': cp++; - if ((*cp == 'q') && AllowTcapOps(xw)) { - Bool fkey; - unsigned state; - int code; - char *tmp; - char *parsed = ++cp; + switch (*cp) { + case 'p': + if (AllowTcapOps(xw, etSetTcap)) { + set_termcap(xw, cp + 1); + } + break; + case 'q': + if (AllowTcapOps(xw, etGetTcap)) { + Bool fkey; + unsigned state; + int code; + const char *tmp; + const char *parsed = ++cp; - code = xtermcapKeycode(xw, &parsed, &state, &fkey); + code = xtermcapKeycode(xw, &parsed, &state, &fkey); - unparseputc1(xw, ANSI_DCS); + unparseputc1(xw, ANSI_DCS); - unparseputc(xw, code >= 0 ? '1' : '0'); + unparseputc(xw, code >= 0 ? '1' : '0'); - unparseputc(xw, '+'); - unparseputc(xw, 'r'); + unparseputc(xw, '+'); + unparseputc(xw, 'r'); - while (*cp != 0 && (code >= -1)) { - if (cp == parsed) - break; /* no data found, error */ + while (*cp != 0 && (code >= -1)) { + if (cp == parsed) + break; /* no data found, error */ - for (tmp = cp; tmp != parsed; ++tmp) - unparseputc(xw, *tmp); + for (tmp = cp; tmp != parsed; ++tmp) + unparseputc(xw, *tmp); - if (code >= 0) { - unparseputc(xw, '='); - screen->tc_query_code = code; - screen->tc_query_fkey = fkey; + if (code >= 0) { + unparseputc(xw, '='); + screen->tc_query_code = code; + screen->tc_query_fkey = fkey; #if OPT_ISO_COLORS - /* XK_COLORS is a fake code for the "Co" entry (maximum - * number of colors) */ - if (code == XK_COLORS) { - unparseputn(xw, NUM_ANSI_COLORS); - } else -#endif - { - XKeyEvent event; - event.state = state; - Input(xw, &event, False); + /* XK_COLORS is a fake code for the "Co" entry (maximum + * number of colors) */ + if (code == XK_COLORS) { + unparseputn(xw, NUM_ANSI_COLORS); + } else +#endif + if (code == XK_TCAPNAME) { + unparseputs(xw, xterm_name); + } else { + XKeyEvent event; + event.state = state; + Input(xw, &event, False); + } + screen->tc_query_code = -1; + } else { + break; /* no match found, error */ } - screen->tc_query_code = -1; - } else { - break; /* no match found, error */ - } - cp = parsed; - if (*parsed == ';') { - unparseputc(xw, *parsed++); cp = parsed; - code = xtermcapKeycode(xw, &parsed, &state, &fkey); + if (*parsed == ';') { + unparseputc(xw, *parsed++); + cp = parsed; + code = xtermcapKeycode(xw, &parsed, &state, &fkey); + } } + unparseputc1(xw, ANSI_ST); } - unparseputc1(xw, ANSI_ST); + break; } break; #endif @@ -3023,107 +3386,141 @@ ChangeGroup(XtermWidget xw, const char *attribute, char *value) static char empty[1]; Arg args[1]; - char *my_attr = x_strdup(attribute); - char *original = (value != 0) ? value : empty; - char *name = original; - TScreen *screen = TScreenOf(xw); + Boolean changed = True; Widget w = CURRENT_EMU(); Widget top = SHELL_OF(w); - unsigned limit = strlen(name); - Char *c1 = (Char *) original; - Char *cp; - TRACE(("ChangeGroup(attribute=%s, value=%s)\n", my_attr, name)); + char *my_attr; + char *name; + unsigned limit; + Char *c1; + Char *cp; if (!AllowTitleOps(xw)) return; + if (value == 0) + value = empty; + if (IsTitleMode(xw, tmSetBase16)) { + const char *temp; + char *test; + + value = x_decode_hex(value, &temp); + if (*temp != '\0') + return; + for (test = value; *test != '\0'; ++test) { + if (CharOf(*test) < 32) { + *test = '\0'; + break; + } + } + } + + c1 = (Char *) value; + name = value; + limit = strlen(name); + my_attr = x_strdup(attribute); + + TRACE(("ChangeGroup(attribute=%s, value=%s)\n", my_attr, name)); + /* * Ignore titles that are too long to be plausible requests. */ - if (limit >= 1024) - return; + if (limit > 0 && limit < 1024) { - for (cp = c1; *cp != 0; ++cp) { - Char *c2 = cp; - if (!xtermIsPrintable(screen, &cp, c1 + limit)) { - memset(c2, '?', (size_t) (cp + 1 - c2)); + /* + * After all decoding, overwrite nonprintable characters with '?'. + */ + for (cp = c1; *cp != 0; ++cp) { + Char *c2 = cp; + if (!xtermIsPrintable(xw, &cp, c1 + limit)) { + memset(c2, '?', (size_t) (cp + 1 - c2)); + } } - } #if OPT_WIDE_CHARS - /* - * Title strings are limited to ISO-8859-1, which is consistent with the - * printable data in sos_table. However, if we're running in UTF-8 mode, - * it is likely that non-ASCII text in the string will be rejected because - * it is not printable in the current locale. So we convert it to UTF-8, - * allowing the X library to convert it back. - */ - if (xtermEnvUTF8() && !screen->utf8_title) { - int n; - - for (n = 0; name[n] != '\0'; ++n) { - if (CharOf(name[n]) > 127) { - if (converted != 0) - free(converted); - if ((converted = TypeMallocN(Char, 1 + (5 * limit))) != 0) { - Char *temp = converted; - while (*name != 0) { - temp = convertToUTF8(temp, CharOf(*name)); - ++name; + /* + * If we're running in UTF-8 mode, and have not been told that the + * title string is in UTF-8, it is likely that non-ASCII text in the + * string will be rejected because it is not printable in the current + * locale. So we convert it to UTF-8, allowing the X library to + * convert it back. + */ + if (xtermEnvUTF8() && !IsSetUtf8Title(xw)) { + int n; + + for (n = 0; name[n] != '\0'; ++n) { + if (CharOf(name[n]) > 127) { + if (converted != 0) + free(converted); + if ((converted = TypeMallocN(Char, 1 + (6 * limit))) != 0) { + Char *temp = converted; + while (*name != 0) { + temp = convertToUTF8(temp, CharOf(*name)); + ++name; + } + *temp = 0; + name = (char *) converted; + TRACE(("...converted{%s}\n", name)); } - *temp = 0; - name = (char *) converted; - TRACE(("...converted{%s}\n", name)); + break; } - break; } } - } #endif #if OPT_SAME_NAME - /* If the attribute isn't going to change, then don't bother... */ - - if (resource.sameName) { - char *buf; - XtSetArg(args[0], my_attr, &buf); - XtGetValues(top, args, 1); - TRACE(("...comparing{%s}\n", buf)); - if (strcmp(name, buf) == 0) - return; - } + /* If the attribute isn't going to change, then don't bother... */ + + if (resource.sameName) { + char *buf; + XtSetArg(args[0], my_attr, &buf); + XtGetValues(top, args, 1); + TRACE(("...comparing{%s}\n", buf)); + if (strcmp(name, buf) == 0) + changed = False; + } #endif /* OPT_SAME_NAME */ - TRACE(("...updating %s\n", my_attr)); - TRACE(("...value is %s\n", name)); - XtSetArg(args[0], my_attr, name); - XtSetValues(top, args, 1); + if (changed) { + TRACE(("...updating %s\n", my_attr)); + TRACE(("...value is %s\n", name)); + XtSetArg(args[0], my_attr, name); + XtSetValues(top, args, 1); #if OPT_WIDE_CHARS - if (xtermEnvUTF8()) { - Display *dpy = XtDisplay(xw); - Atom my_atom; - - const char *propname = (!strcmp(my_attr, XtNtitle) - ? "_NET_WM_NAME" - : "_NET_WM_ICON_NAME"); - if ((my_atom = XInternAtom(dpy, propname, False)) != None) { - if (screen->utf8_title) { /* FIXME - redundant? */ - TRACE(("...updating %s\n", propname)); - TRACE(("...value is %s\n", original)); - XChangeProperty(dpy, VShellWindow, - my_atom, XA_UTF8_STRING(dpy), 8, - PropModeReplace, - (Char *) original, (int) strlen(original)); - } else { - TRACE(("...deleting %s\n", propname)); - XDeleteProperty(dpy, VShellWindow, my_atom); + if (xtermEnvUTF8()) { + Display *dpy = XtDisplay(xw); + Atom my_atom; + + const char *propname = (!strcmp(my_attr, XtNtitle) + ? "_NET_WM_NAME" + : "_NET_WM_ICON_NAME"); + if ((my_atom = XInternAtom(dpy, propname, False)) != None) { + if (IsSetUtf8Title(xw)) { + TRACE(("...updating %s\n", propname)); + TRACE(("...value is %s\n", value)); + XChangeProperty(dpy, VShellWindow, my_atom, + XA_UTF8_STRING(dpy), 8, + PropModeReplace, + (Char *) value, + (int) strlen(value)); + } else { + TRACE(("...deleting %s\n", propname)); + XDeleteProperty(dpy, VShellWindow, my_atom); + } + } } +#endif } + + free(my_attr); + + if (IsTitleMode(xw, tmSetBase16)) + free(value); + } -#endif - free(my_attr); + return; } void @@ -3134,7 +3531,7 @@ ChangeIconName(XtermWidget xw, char *name) name = dummy; } #if OPT_ZICONBEEP /* If warning should be given then give it */ - if (resource.zIconBeep && xw->screen.zIconBeep_flagged) { + if (resource.zIconBeep && TScreenOf(xw)->zIconBeep_flagged) { char *newname = CastMallocN(char, strlen(name) + 4); if (!newname) { fprintf(stderr, "malloc failed in ChangeIconName\n"); @@ -3229,24 +3626,29 @@ AllocateTermColor(XtermWidget xw, int ndx, const char *name) { - XColor def; - TScreen *screen = &xw->screen; - Colormap cmap = xw->core.colormap; - char *newName; + Bool result = False; - if (XParseColor(screen->display, cmap, name, &def) - && (XAllocColor(screen->display, cmap, &def) - || find_closest_color(screen->display, cmap, &def)) - && (newName = x_strdup(name)) != 0) { - if (COLOR_DEFINED(pNew, ndx)) - free(pNew->names[ndx]); - SET_COLOR_VALUE(pNew, ndx, def.pixel); - SET_COLOR_NAME(pNew, ndx, newName); - TRACE(("AllocateTermColor #%d: %s (pixel %#lx)\n", ndx, newName, def.pixel)); - return (True); - } - TRACE(("AllocateTermColor #%d: %s (failed)\n", ndx, name)); - return (False); + if (AllowColorOps(xw, ecSetColor)) { + XColor def; + TScreen *screen = TScreenOf(xw); + Colormap cmap = xw->core.colormap; + char *newName; + + if (XParseColor(screen->display, cmap, name, &def) + && (XAllocColor(screen->display, cmap, &def) + || find_closest_color(screen->display, cmap, &def)) + && (newName = x_strdup(name)) != 0) { + if (COLOR_DEFINED(pNew, ndx)) + free(pNew->names[ndx]); + SET_COLOR_VALUE(pNew, ndx, def.pixel); + SET_COLOR_NAME(pNew, ndx, newName); + TRACE(("AllocateTermColor #%d: %s (pixel %#lx)\n", ndx, newName, def.pixel)); + result = True; + } else { + TRACE(("AllocateTermColor #%d: %s (failed)\n", ndx, name)); + } + } + return result; } /***====================================================================***/ @@ -3665,7 +4067,7 @@ void end_tek_mode(void) { if (TEK4014_ACTIVE(term)) { - FlushLog(&(term->screen)); + FlushLog(TScreenOf(term)); longjmp(Tekend, 1); } return; @@ -3675,7 +4077,7 @@ void end_vt_mode(void) { if (!TEK4014_ACTIVE(term)) { - FlushLog(&(term->screen)); + FlushLog(TScreenOf(term)); TEK4014_ACTIVE(term) = True; longjmp(VTend, 1); } diff --git a/app/xterm/mkdirs.sh b/app/xterm/mkdirs.sh deleted file mode 100644 index ffe7494c4..000000000 --- a/app/xterm/mkdirs.sh +++ /dev/null @@ -1,38 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman <friedman@prep.ai.mit.edu> -# Created: 1993-05-16 -# Last modified: 1994-03-25 -# Public domain -# - -errstatus=0 -umask 022 - -for file in ${1+"$@"} ; do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift - - pathcomp= - for d in ${1+"$@"} ; do - pathcomp="$pathcomp$d" - case "$pathcomp" in - -* ) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" 1>&2 - case "$pathcomp" in - [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]: ) - ;; # DOSISH systems - * ) mkdir "$pathcomp" || errstatus=$? ;; - esac - fi - - pathcomp="$pathcomp/" - done -done - -exit $errstatus - -# mkinstalldirs ends here diff --git a/app/xterm/os2main.c b/app/xterm/os2main.c index 8d31e426d..5cb117ee2 100644 --- a/app/xterm/os2main.c +++ b/app/xterm/os2main.c @@ -1,4 +1,4 @@ -/* $XTermId: os2main.c,v 1.258 2009/05/31 17:53:05 tom Exp $ */ +/* $XTermId: os2main.c,v 1.263 2010/01/01 22:26:10 tom Exp $ */ /* removed all foreign stuff to get the code more clear (hv) * and did some rewrite for the obscure OS/2 environment @@ -125,7 +125,7 @@ ttyname(int fd) static SIGNAL_T reapchild(int n); static int spawnXTerm(XtermWidget /* xw */ ); -static void resize_termcap(XtermWidget xw, char *newtc); +static void resize_termcap(XtermWidget xw); static void set_owner(char *device, uid_t uid, gid_t gid, mode_t mode); static Bool added_utmp_entry = False; @@ -201,7 +201,7 @@ static struct termio d_tio; static Boolean override_tty_modes = False; /* *INDENT-OFF* */ static struct _xttymodes { - char *name; + const char *name; size_t len; int set; int value; @@ -318,7 +318,7 @@ static XtResource application_resources[] = #endif }; -static char *fallback_resources[] = +static String fallback_resources[] = { "*SimpleMenu*menuLabel.vertSpace: 100", "*SimpleMenu*HorizontalMargins: 16", @@ -337,198 +337,198 @@ static char *fallback_resources[] = pass over the remaining options after XrmParseCommand is let loose. */ /* *INDENT-OFF* */ static XrmOptionDescRec optionDescList[] = { -{"-geometry", "*vt100.geometry",XrmoptionSepArg, (caddr_t) NULL}, -{"-132", "*c132", XrmoptionNoArg, (caddr_t) "on"}, -{"+132", "*c132", XrmoptionNoArg, (caddr_t) "off"}, -{"-ah", "*alwaysHighlight", XrmoptionNoArg, (caddr_t) "on"}, -{"+ah", "*alwaysHighlight", XrmoptionNoArg, (caddr_t) "off"}, -{"-aw", "*autoWrap", XrmoptionNoArg, (caddr_t) "on"}, -{"+aw", "*autoWrap", XrmoptionNoArg, (caddr_t) "off"}, +{"-geometry", "*vt100.geometry",XrmoptionSepArg, (XPointer) NULL}, +{"-132", "*c132", XrmoptionNoArg, (XPointer) "on"}, +{"+132", "*c132", XrmoptionNoArg, (XPointer) "off"}, +{"-ah", "*alwaysHighlight", XrmoptionNoArg, (XPointer) "on"}, +{"+ah", "*alwaysHighlight", XrmoptionNoArg, (XPointer) "off"}, +{"-aw", "*autoWrap", XrmoptionNoArg, (XPointer) "on"}, +{"+aw", "*autoWrap", XrmoptionNoArg, (XPointer) "off"}, #ifndef NO_ACTIVE_ICON -{"-ai", "*activeIcon", XrmoptionNoArg, (caddr_t) "off"}, -{"+ai", "*activeIcon", XrmoptionNoArg, (caddr_t) "on"}, +{"-ai", "*activeIcon", XrmoptionNoArg, (XPointer) "off"}, +{"+ai", "*activeIcon", XrmoptionNoArg, (XPointer) "on"}, #endif /* NO_ACTIVE_ICON */ -{"-b", "*internalBorder",XrmoptionSepArg, (caddr_t) NULL}, -{"-bc", "*cursorBlink", XrmoptionNoArg, (caddr_t) "on"}, -{"+bc", "*cursorBlink", XrmoptionNoArg, (caddr_t) "off"}, -{"-bcf", "*cursorOffTime",XrmoptionSepArg, (caddr_t) NULL}, -{"-bcn", "*cursorOnTime",XrmoptionSepArg, (caddr_t) NULL}, -{"-bdc", "*colorBDMode", XrmoptionNoArg, (caddr_t) "off"}, -{"+bdc", "*colorBDMode", XrmoptionNoArg, (caddr_t) "on"}, -{"-cb", "*cutToBeginningOfLine", XrmoptionNoArg, (caddr_t) "off"}, -{"+cb", "*cutToBeginningOfLine", XrmoptionNoArg, (caddr_t) "on"}, -{"-cc", "*charClass", XrmoptionSepArg, (caddr_t) NULL}, -{"-cm", "*colorMode", XrmoptionNoArg, (caddr_t) "off"}, -{"+cm", "*colorMode", XrmoptionNoArg, (caddr_t) "on"}, -{"-cn", "*cutNewline", XrmoptionNoArg, (caddr_t) "off"}, -{"+cn", "*cutNewline", XrmoptionNoArg, (caddr_t) "on"}, -{"-cr", "*cursorColor", XrmoptionSepArg, (caddr_t) NULL}, -{"-cu", "*curses", XrmoptionNoArg, (caddr_t) "on"}, -{"+cu", "*curses", XrmoptionNoArg, (caddr_t) "off"}, -{"-dc", "*dynamicColors",XrmoptionNoArg, (caddr_t) "off"}, -{"+dc", "*dynamicColors",XrmoptionNoArg, (caddr_t) "on"}, -{"-fb", "*boldFont", XrmoptionSepArg, (caddr_t) NULL}, -{"-fbb", "*freeBoldBox", XrmoptionNoArg, (caddr_t)"off"}, -{"+fbb", "*freeBoldBox", XrmoptionNoArg, (caddr_t)"on"}, -{"-fbx", "*forceBoxChars", XrmoptionNoArg, (caddr_t)"off"}, -{"+fbx", "*forceBoxChars", XrmoptionNoArg, (caddr_t)"on"}, +{"-b", "*internalBorder",XrmoptionSepArg, (XPointer) NULL}, +{"-bc", "*cursorBlink", XrmoptionNoArg, (XPointer) "on"}, +{"+bc", "*cursorBlink", XrmoptionNoArg, (XPointer) "off"}, +{"-bcf", "*cursorOffTime",XrmoptionSepArg, (XPointer) NULL}, +{"-bcn", "*cursorOnTime",XrmoptionSepArg, (XPointer) NULL}, +{"-bdc", "*colorBDMode", XrmoptionNoArg, (XPointer) "off"}, +{"+bdc", "*colorBDMode", XrmoptionNoArg, (XPointer) "on"}, +{"-cb", "*cutToBeginningOfLine", XrmoptionNoArg, (XPointer) "off"}, +{"+cb", "*cutToBeginningOfLine", XrmoptionNoArg, (XPointer) "on"}, +{"-cc", "*charClass", XrmoptionSepArg, (XPointer) NULL}, +{"-cm", "*colorMode", XrmoptionNoArg, (XPointer) "off"}, +{"+cm", "*colorMode", XrmoptionNoArg, (XPointer) "on"}, +{"-cn", "*cutNewline", XrmoptionNoArg, (XPointer) "off"}, +{"+cn", "*cutNewline", XrmoptionNoArg, (XPointer) "on"}, +{"-cr", "*cursorColor", XrmoptionSepArg, (XPointer) NULL}, +{"-cu", "*curses", XrmoptionNoArg, (XPointer) "on"}, +{"+cu", "*curses", XrmoptionNoArg, (XPointer) "off"}, +{"-dc", "*dynamicColors",XrmoptionNoArg, (XPointer) "off"}, +{"+dc", "*dynamicColors",XrmoptionNoArg, (XPointer) "on"}, +{"-fb", "*boldFont", XrmoptionSepArg, (XPointer) NULL}, +{"-fbb", "*freeBoldBox", XrmoptionNoArg, (XPointer)"off"}, +{"+fbb", "*freeBoldBox", XrmoptionNoArg, (XPointer)"on"}, +{"-fbx", "*forceBoxChars", XrmoptionNoArg, (XPointer)"off"}, +{"+fbx", "*forceBoxChars", XrmoptionNoArg, (XPointer)"on"}, #ifndef NO_ACTIVE_ICON -{"-fi", "*iconFont", XrmoptionSepArg, (caddr_t) NULL}, +{"-fi", "*iconFont", XrmoptionSepArg, (XPointer) NULL}, #endif /* NO_ACTIVE_ICON */ #if OPT_RENDERFONT -{"-fa", "*faceName", XrmoptionSepArg, (caddr_t) NULL}, -{"-fd", "*faceNameDoublesize", XrmoptionSepArg, (caddr_t) NULL}, -{"-fs", "*faceSize", XrmoptionSepArg, (caddr_t) NULL}, +{"-fa", "*faceName", XrmoptionSepArg, (XPointer) NULL}, +{"-fd", "*faceNameDoublesize", XrmoptionSepArg, (XPointer) NULL}, +{"-fs", "*faceSize", XrmoptionSepArg, (XPointer) NULL}, #endif #if OPT_WIDE_CHARS -{"-fw", "*wideFont", XrmoptionSepArg, (caddr_t) NULL}, -{"-fwb", "*wideBoldFont", XrmoptionSepArg, (caddr_t) NULL}, +{"-fw", "*wideFont", XrmoptionSepArg, (XPointer) NULL}, +{"-fwb", "*wideBoldFont", XrmoptionSepArg, (XPointer) NULL}, #endif #if OPT_INPUT_METHOD -{"-fx", "*ximFont", XrmoptionSepArg, (caddr_t) NULL}, +{"-fx", "*ximFont", XrmoptionSepArg, (XPointer) NULL}, #endif #if OPT_HIGHLIGHT_COLOR -{"-hc", "*highlightColor", XrmoptionSepArg, (caddr_t) NULL}, -{"-hm", "*highlightColorMode", XrmoptionNoArg, (caddr_t) "on"}, -{"+hm", "*highlightColorMode", XrmoptionNoArg, (caddr_t) "off"}, -{"-selfg", "*highlightTextColor", XrmoptionSepArg, (caddr_t) NULL}, -{"-selbg", "*highlightColor", XrmoptionSepArg, (caddr_t) NULL}, +{"-hc", "*highlightColor", XrmoptionSepArg, (XPointer) NULL}, +{"-hm", "*highlightColorMode", XrmoptionNoArg, (XPointer) "on"}, +{"+hm", "*highlightColorMode", XrmoptionNoArg, (XPointer) "off"}, +{"-selfg", "*highlightTextColor", XrmoptionSepArg, (XPointer) NULL}, +{"-selbg", "*highlightColor", XrmoptionSepArg, (XPointer) NULL}, #endif #if OPT_HP_FUNC_KEYS -{"-hf", "*hpFunctionKeys",XrmoptionNoArg, (caddr_t) "on"}, -{"+hf", "*hpFunctionKeys",XrmoptionNoArg, (caddr_t) "off"}, +{"-hf", "*hpFunctionKeys",XrmoptionNoArg, (XPointer) "on"}, +{"+hf", "*hpFunctionKeys",XrmoptionNoArg, (XPointer) "off"}, #endif -{"-hold", "*hold", XrmoptionNoArg, (caddr_t) "on"}, -{"+hold", "*hold", XrmoptionNoArg, (caddr_t) "off"}, +{"-hold", "*hold", XrmoptionNoArg, (XPointer) "on"}, +{"+hold", "*hold", XrmoptionNoArg, (XPointer) "off"}, #if OPT_INITIAL_ERASE -{"-ie", "*ptyInitialErase", XrmoptionNoArg, (caddr_t) "on"}, -{"+ie", "*ptyInitialErase", XrmoptionNoArg, (caddr_t) "off"}, +{"-ie", "*ptyInitialErase", XrmoptionNoArg, (XPointer) "on"}, +{"+ie", "*ptyInitialErase", XrmoptionNoArg, (XPointer) "off"}, #endif -{"-j", "*jumpScroll", XrmoptionNoArg, (caddr_t) "on"}, -{"+j", "*jumpScroll", XrmoptionNoArg, (caddr_t) "off"}, +{"-j", "*jumpScroll", XrmoptionNoArg, (XPointer) "on"}, +{"+j", "*jumpScroll", XrmoptionNoArg, (XPointer) "off"}, #if OPT_C1_PRINT -{"-k8", "*allowC1Printable", XrmoptionNoArg, (caddr_t) "on"}, -{"+k8", "*allowC1Printable", XrmoptionNoArg, (caddr_t) "off"}, +{"-k8", "*allowC1Printable", XrmoptionNoArg, (XPointer) "on"}, +{"+k8", "*allowC1Printable", XrmoptionNoArg, (XPointer) "off"}, #endif -{"-kt", "*keyboardType", XrmoptionSepArg, (caddr_t) NULL}, -{"+kt", "*keyboardType", XrmoptionSepArg, (caddr_t) NULL}, +{"-kt", "*keyboardType", XrmoptionSepArg, (XPointer) NULL}, +{"+kt", "*keyboardType", XrmoptionSepArg, (XPointer) NULL}, /* parse logging options anyway for compatibility */ -{"-l", "*logging", XrmoptionNoArg, (caddr_t) "on"}, -{"+l", "*logging", XrmoptionNoArg, (caddr_t) "off"}, -{"-lf", "*logFile", XrmoptionSepArg, (caddr_t) NULL}, -{"-ls", "*loginShell", XrmoptionNoArg, (caddr_t) "on"}, -{"+ls", "*loginShell", XrmoptionNoArg, (caddr_t) "off"}, -{"-mb", "*marginBell", XrmoptionNoArg, (caddr_t) "on"}, -{"+mb", "*marginBell", XrmoptionNoArg, (caddr_t) "off"}, -{"-mc", "*multiClickTime", XrmoptionSepArg, (caddr_t) NULL}, -{"-mesg", "*messages", XrmoptionNoArg, (caddr_t) "off"}, -{"+mesg", "*messages", XrmoptionNoArg, (caddr_t) "on"}, -{"-ms", "*pointerColor",XrmoptionSepArg, (caddr_t) NULL}, -{"-nb", "*nMarginBell", XrmoptionSepArg, (caddr_t) NULL}, -{"-nul", "*underLine", XrmoptionNoArg, (caddr_t) "off"}, -{"+nul", "*underLine", XrmoptionNoArg, (caddr_t) "on"}, -{"-pc", "*boldColors", XrmoptionNoArg, (caddr_t) "on"}, -{"+pc", "*boldColors", XrmoptionNoArg, (caddr_t) "off"}, -{"-rw", "*reverseWrap", XrmoptionNoArg, (caddr_t) "on"}, -{"+rw", "*reverseWrap", XrmoptionNoArg, (caddr_t) "off"}, -{"-s", "*multiScroll", XrmoptionNoArg, (caddr_t) "on"}, -{"+s", "*multiScroll", XrmoptionNoArg, (caddr_t) "off"}, -{"-sb", "*scrollBar", XrmoptionNoArg, (caddr_t) "on"}, -{"+sb", "*scrollBar", XrmoptionNoArg, (caddr_t) "off"}, +{"-l", "*logging", XrmoptionNoArg, (XPointer) "on"}, +{"+l", "*logging", XrmoptionNoArg, (XPointer) "off"}, +{"-lf", "*logFile", XrmoptionSepArg, (XPointer) NULL}, +{"-ls", "*loginShell", XrmoptionNoArg, (XPointer) "on"}, +{"+ls", "*loginShell", XrmoptionNoArg, (XPointer) "off"}, +{"-mb", "*marginBell", XrmoptionNoArg, (XPointer) "on"}, +{"+mb", "*marginBell", XrmoptionNoArg, (XPointer) "off"}, +{"-mc", "*multiClickTime", XrmoptionSepArg, (XPointer) NULL}, +{"-mesg", "*messages", XrmoptionNoArg, (XPointer) "off"}, +{"+mesg", "*messages", XrmoptionNoArg, (XPointer) "on"}, +{"-ms", "*pointerColor",XrmoptionSepArg, (XPointer) NULL}, +{"-nb", "*nMarginBell", XrmoptionSepArg, (XPointer) NULL}, +{"-nul", "*underLine", XrmoptionNoArg, (XPointer) "off"}, +{"+nul", "*underLine", XrmoptionNoArg, (XPointer) "on"}, +{"-pc", "*boldColors", XrmoptionNoArg, (XPointer) "on"}, +{"+pc", "*boldColors", XrmoptionNoArg, (XPointer) "off"}, +{"-rw", "*reverseWrap", XrmoptionNoArg, (XPointer) "on"}, +{"+rw", "*reverseWrap", XrmoptionNoArg, (XPointer) "off"}, +{"-s", "*multiScroll", XrmoptionNoArg, (XPointer) "on"}, +{"+s", "*multiScroll", XrmoptionNoArg, (XPointer) "off"}, +{"-sb", "*scrollBar", XrmoptionNoArg, (XPointer) "on"}, +{"+sb", "*scrollBar", XrmoptionNoArg, (XPointer) "off"}, #ifdef SCROLLBAR_RIGHT -{"-leftbar", "*rightScrollBar", XrmoptionNoArg, (caddr_t) "off"}, -{"-rightbar", "*rightScrollBar", XrmoptionNoArg, (caddr_t) "on"}, -#endif -{"-rvc", "*colorRVMode", XrmoptionNoArg, (caddr_t) "off"}, -{"+rvc", "*colorRVMode", XrmoptionNoArg, (caddr_t) "on"}, -{"-sf", "*sunFunctionKeys", XrmoptionNoArg, (caddr_t) "on"}, -{"+sf", "*sunFunctionKeys", XrmoptionNoArg, (caddr_t) "off"}, -{"-si", "*scrollTtyOutput", XrmoptionNoArg, (caddr_t) "off"}, -{"+si", "*scrollTtyOutput", XrmoptionNoArg, (caddr_t) "on"}, -{"-sk", "*scrollKey", XrmoptionNoArg, (caddr_t) "on"}, -{"+sk", "*scrollKey", XrmoptionNoArg, (caddr_t) "off"}, -{"-sl", "*saveLines", XrmoptionSepArg, (caddr_t) NULL}, +{"-leftbar", "*rightScrollBar", XrmoptionNoArg, (XPointer) "off"}, +{"-rightbar", "*rightScrollBar", XrmoptionNoArg, (XPointer) "on"}, +#endif +{"-rvc", "*colorRVMode", XrmoptionNoArg, (XPointer) "off"}, +{"+rvc", "*colorRVMode", XrmoptionNoArg, (XPointer) "on"}, +{"-sf", "*sunFunctionKeys", XrmoptionNoArg, (XPointer) "on"}, +{"+sf", "*sunFunctionKeys", XrmoptionNoArg, (XPointer) "off"}, +{"-si", "*scrollTtyOutput", XrmoptionNoArg, (XPointer) "off"}, +{"+si", "*scrollTtyOutput", XrmoptionNoArg, (XPointer) "on"}, +{"-sk", "*scrollKey", XrmoptionNoArg, (XPointer) "on"}, +{"+sk", "*scrollKey", XrmoptionNoArg, (XPointer) "off"}, +{"-sl", "*saveLines", XrmoptionSepArg, (XPointer) NULL}, #if OPT_SUNPC_KBD -{"-sp", "*sunKeyboard", XrmoptionNoArg, (caddr_t) "on"}, -{"+sp", "*sunKeyboard", XrmoptionNoArg, (caddr_t) "off"}, +{"-sp", "*sunKeyboard", XrmoptionNoArg, (XPointer) "on"}, +{"+sp", "*sunKeyboard", XrmoptionNoArg, (XPointer) "off"}, #endif #if OPT_TEK4014 -{"-t", "*tekStartup", XrmoptionNoArg, (caddr_t) "on"}, -{"+t", "*tekStartup", XrmoptionNoArg, (caddr_t) "off"}, +{"-t", "*tekStartup", XrmoptionNoArg, (XPointer) "on"}, +{"+t", "*tekStartup", XrmoptionNoArg, (XPointer) "off"}, #endif -{"-ti", "*decTerminalID",XrmoptionSepArg, (caddr_t) NULL}, -{"-tm", "*ttyModes", XrmoptionSepArg, (caddr_t) NULL}, -{"-tn", "*termName", XrmoptionSepArg, (caddr_t) NULL}, +{"-ti", "*decTerminalID",XrmoptionSepArg, (XPointer) NULL}, +{"-tm", "*ttyModes", XrmoptionSepArg, (XPointer) NULL}, +{"-tn", "*termName", XrmoptionSepArg, (XPointer) NULL}, #if OPT_WIDE_CHARS -{"-u8", "*utf8", XrmoptionNoArg, (caddr_t) "2"}, -{"+u8", "*utf8", XrmoptionNoArg, (caddr_t) "0"}, +{"-u8", "*utf8", XrmoptionNoArg, (XPointer) "2"}, +{"+u8", "*utf8", XrmoptionNoArg, (XPointer) "0"}, #endif #if OPT_LUIT_PROG -{"-lc", "*locale", XrmoptionNoArg, (caddr_t) "on"}, -{"+lc", "*locale", XrmoptionNoArg, (caddr_t) "off"}, -{"-lcc", "*localeFilter",XrmoptionSepArg, (caddr_t) NULL}, -{"-en", "*locale", XrmoptionSepArg, (caddr_t) NULL}, -#endif -{"-uc", "*cursorUnderLine", XrmoptionNoArg, (caddr_t) "on"}, -{"+uc", "*cursorUnderLine", XrmoptionNoArg, (caddr_t) "off"}, -{"-ulc", "*colorULMode", XrmoptionNoArg, (caddr_t) "off"}, -{"+ulc", "*colorULMode", XrmoptionNoArg, (caddr_t) "on"}, -{"-ulit", "*italicULMode", XrmoptionNoArg, (caddr_t) "off"}, -{"+ulit", "*italicULMode", XrmoptionNoArg, (caddr_t) "on"}, -{"-ut", "*utmpInhibit", XrmoptionNoArg, (caddr_t) "on"}, -{"+ut", "*utmpInhibit", XrmoptionNoArg, (caddr_t) "off"}, -{"-im", "*useInsertMode", XrmoptionNoArg, (caddr_t) "on"}, -{"+im", "*useInsertMode", XrmoptionNoArg, (caddr_t) "off"}, -{"-vb", "*visualBell", XrmoptionNoArg, (caddr_t) "on"}, -{"+vb", "*visualBell", XrmoptionNoArg, (caddr_t) "off"}, -{"-pob", "*popOnBell", XrmoptionNoArg, (caddr_t) "on"}, -{"+pob", "*popOnBell", XrmoptionNoArg, (caddr_t) "off"}, +{"-lc", "*locale", XrmoptionNoArg, (XPointer) "on"}, +{"+lc", "*locale", XrmoptionNoArg, (XPointer) "off"}, +{"-lcc", "*localeFilter",XrmoptionSepArg, (XPointer) NULL}, +{"-en", "*locale", XrmoptionSepArg, (XPointer) NULL}, +#endif +{"-uc", "*cursorUnderLine", XrmoptionNoArg, (XPointer) "on"}, +{"+uc", "*cursorUnderLine", XrmoptionNoArg, (XPointer) "off"}, +{"-ulc", "*colorULMode", XrmoptionNoArg, (XPointer) "off"}, +{"+ulc", "*colorULMode", XrmoptionNoArg, (XPointer) "on"}, +{"-ulit", "*italicULMode", XrmoptionNoArg, (XPointer) "off"}, +{"+ulit", "*italicULMode", XrmoptionNoArg, (XPointer) "on"}, +{"-ut", "*utmpInhibit", XrmoptionNoArg, (XPointer) "on"}, +{"+ut", "*utmpInhibit", XrmoptionNoArg, (XPointer) "off"}, +{"-im", "*useInsertMode", XrmoptionNoArg, (XPointer) "on"}, +{"+im", "*useInsertMode", XrmoptionNoArg, (XPointer) "off"}, +{"-vb", "*visualBell", XrmoptionNoArg, (XPointer) "on"}, +{"+vb", "*visualBell", XrmoptionNoArg, (XPointer) "off"}, +{"-pob", "*popOnBell", XrmoptionNoArg, (XPointer) "on"}, +{"+pob", "*popOnBell", XrmoptionNoArg, (XPointer) "off"}, #if OPT_WIDE_CHARS -{"-wc", "*wideChars", XrmoptionNoArg, (caddr_t) "on"}, -{"+wc", "*wideChars", XrmoptionNoArg, (caddr_t) "off"}, -{"-mk_width", "*mkWidth", XrmoptionNoArg, (caddr_t) "on"}, -{"+mk_width", "*mkWidth", XrmoptionNoArg, (caddr_t) "off"}, -{"-cjk_width", "*cjkWidth", XrmoptionNoArg, (caddr_t) "on"}, -{"+cjk_width", "*cjkWidth", XrmoptionNoArg, (caddr_t) "off"}, -#endif -{"-wf", "*waitForMap", XrmoptionNoArg, (caddr_t) "on"}, -{"+wf", "*waitForMap", XrmoptionNoArg, (caddr_t) "off"}, +{"-wc", "*wideChars", XrmoptionNoArg, (XPointer) "on"}, +{"+wc", "*wideChars", XrmoptionNoArg, (XPointer) "off"}, +{"-mk_width", "*mkWidth", XrmoptionNoArg, (XPointer) "on"}, +{"+mk_width", "*mkWidth", XrmoptionNoArg, (XPointer) "off"}, +{"-cjk_width", "*cjkWidth", XrmoptionNoArg, (XPointer) "on"}, +{"+cjk_width", "*cjkWidth", XrmoptionNoArg, (XPointer) "off"}, +#endif +{"-wf", "*waitForMap", XrmoptionNoArg, (XPointer) "on"}, +{"+wf", "*waitForMap", XrmoptionNoArg, (XPointer) "off"}, #if OPT_ZICONBEEP -{"-ziconbeep", "*zIconBeep", XrmoptionSepArg, (caddr_t) NULL}, +{"-ziconbeep", "*zIconBeep", XrmoptionSepArg, (XPointer) NULL}, #endif #if OPT_SAME_NAME -{"-samename", "*sameName", XrmoptionNoArg, (caddr_t) "on"}, -{"+samename", "*sameName", XrmoptionNoArg, (caddr_t) "off"}, +{"-samename", "*sameName", XrmoptionNoArg, (XPointer) "on"}, +{"+samename", "*sameName", XrmoptionNoArg, (XPointer) "off"}, #endif #if OPT_SESSION_MGT -{"-sm", "*sessionMgt", XrmoptionNoArg, (caddr_t) "on"}, -{"+sm", "*sessionMgt", XrmoptionNoArg, (caddr_t) "off"}, +{"-sm", "*sessionMgt", XrmoptionNoArg, (XPointer) "on"}, +{"+sm", "*sessionMgt", XrmoptionNoArg, (XPointer) "off"}, #endif #if OPT_TOOLBAR -{"-tb", "*"XtNtoolBar, XrmoptionNoArg, (caddr_t) "on"}, -{"+tb", "*"XtNtoolBar, XrmoptionNoArg, (caddr_t) "off"}, +{"-tb", "*"XtNtoolBar, XrmoptionNoArg, (XPointer) "on"}, +{"+tb", "*"XtNtoolBar, XrmoptionNoArg, (XPointer) "off"}, #endif #if OPT_MAXIMIZE -{"-maximized", "*maximized", XrmoptionNoArg, (caddr_t) "on"}, -{"+maximized", "*maximized", XrmoptionNoArg, (caddr_t) "off"}, +{"-maximized", "*maximized", XrmoptionNoArg, (XPointer) "on"}, +{"+maximized", "*maximized", XrmoptionNoArg, (XPointer) "off"}, #endif /* options that we process ourselves */ -{"-help", NULL, XrmoptionSkipNArgs, (caddr_t) NULL}, -{"-version", NULL, XrmoptionSkipNArgs, (caddr_t) NULL}, -{"-class", NULL, XrmoptionSkipArg, (caddr_t) NULL}, -{"-e", NULL, XrmoptionSkipLine, (caddr_t) NULL}, -{"-into", NULL, XrmoptionSkipArg, (caddr_t) NULL}, +{"-help", NULL, XrmoptionSkipNArgs, (XPointer) NULL}, +{"-version", NULL, XrmoptionSkipNArgs, (XPointer) NULL}, +{"-class", NULL, XrmoptionSkipArg, (XPointer) NULL}, +{"-e", NULL, XrmoptionSkipLine, (XPointer) NULL}, +{"-into", NULL, XrmoptionSkipArg, (XPointer) NULL}, /* bogus old compatibility stuff for which there are standard XtOpenApplication options now */ -{"%", "*tekGeometry", XrmoptionStickyArg, (caddr_t) NULL}, -{"#", ".iconGeometry",XrmoptionStickyArg, (caddr_t) NULL}, -{"-T", ".title", XrmoptionSepArg, (caddr_t) NULL}, -{"-n", "*iconName", XrmoptionSepArg, (caddr_t) NULL}, -{"-r", "*reverseVideo",XrmoptionNoArg, (caddr_t) "on"}, -{"+r", "*reverseVideo",XrmoptionNoArg, (caddr_t) "off"}, -{"-rv", "*reverseVideo",XrmoptionNoArg, (caddr_t) "on"}, -{"+rv", "*reverseVideo",XrmoptionNoArg, (caddr_t) "off"}, -{"-w", ".borderWidth", XrmoptionSepArg, (caddr_t) NULL}, +{"%", "*tekGeometry", XrmoptionStickyArg, (XPointer) NULL}, +{"#", ".iconGeometry",XrmoptionStickyArg, (XPointer) NULL}, +{"-T", ".title", XrmoptionSepArg, (XPointer) NULL}, +{"-n", "*iconName", XrmoptionSepArg, (XPointer) NULL}, +{"-r", "*reverseVideo",XrmoptionNoArg, (XPointer) "on"}, +{"+r", "*reverseVideo",XrmoptionNoArg, (XPointer) "off"}, +{"-rv", "*reverseVideo",XrmoptionNoArg, (XPointer) "on"}, +{"+rv", "*reverseVideo",XrmoptionNoArg, (XPointer) "off"}, +{"-w", ".borderWidth", XrmoptionSepArg, (XPointer) NULL}, }; static OptionHelp xtermOptions[] = { @@ -708,7 +708,7 @@ opencons(void) #define closecons() /* nothing */ #endif -static char *message[] = +static const char *message[] = { "Fonts should be fixed width and, if both normal and bold are specified, should", "have the same size. If only a normal font is specified, it will be used for", @@ -777,7 +777,7 @@ decode_keyvalue(char **ptr, int termcap) } static int -abbrev(char *tst, char *cmp, size_t need) +abbrev(const char *tst, const char *cmp, size_t need) { size_t len = strlen(tst); return ((len >= need) && (!strncmp(tst, cmp, len))); @@ -794,9 +794,9 @@ Syntax(char *badOption) ProgramName, badOption); fprintf(stderr, "usage: %s", ProgramName); - col = 8 + strlen(ProgramName); + col = 8 + (int) strlen(ProgramName); for (opt = list; opt->opt; opt++) { - int len = 3 + strlen(opt->opt); /* space [ string ] */ + int len = 3 + (int) strlen(opt->opt); /* space [ string ] */ if (col + len > 79) { fprintf(stderr, "\r\n "); /* 3 spaces */ col = 3; @@ -822,7 +822,7 @@ Help(void) { OptionHelp *opt; OptionHelp *list = sortedOpts(xtermOptions, optionDescList, XtNumber(optionDescList)); - char **cpp; + const char **cpp; printf("%s usage:\n %s [-options ...] [-e command args]\n\n", xtermVersion(), ProgramName); @@ -904,7 +904,7 @@ DeleteWindow(Widget w, hide_vt_window(); else do_hangup(w, (XtPointer) 0, (XtPointer) 0); - } else if (term->screen.Vshow) + } else if (TScreenOf(term)->Vshow) hide_tek_window(); else #endif @@ -1318,7 +1318,7 @@ main(int argc, char **argv ENVP_ARG) buf[0] = '\0'; sprintf(buf, "%lx\n", XtWindow(SHELL_OF(CURRENT_EMU()))); - write(screen->respond, buf, strlen(buf)); + IGNORE_RC(write(screen->respond, buf, strlen(buf))); } if (0 > (mode = fcntl(screen->respond, F_GETFL, 0))) @@ -1367,14 +1367,14 @@ main(int argc, char **argv ENVP_ARG) #if OPT_COLOR_RES TRACE(("checking resource values rv %s fg %s, bg %s\n", BtoS(term->misc.re_verse0), - NonNull(term->screen.Tcolors[TEXT_FG].resource), - NonNull(term->screen.Tcolors[TEXT_BG].resource))); + NonNull(TScreenOf(term)->Tcolors[TEXT_FG].resource), + NonNull(TScreenOf(term)->Tcolors[TEXT_BG].resource))); if ((reversed && term->misc.re_verse0) - && ((term->screen.Tcolors[TEXT_FG].resource - && !isDefaultForeground(term->screen.Tcolors[TEXT_FG].resource)) - || (term->screen.Tcolors[TEXT_BG].resource - && !isDefaultBackground(term->screen.Tcolors[TEXT_BG].resource)) + && ((TScreenOf(term)->Tcolors[TEXT_FG].resource + && !isDefaultForeground(TScreenOf(term)->Tcolors[TEXT_FG].resource)) + || (TScreenOf(term)->Tcolors[TEXT_BG].resource + && !isDefaultBackground(TScreenOf(term)->Tcolors[TEXT_BG].resource)) )) ReverseVideo(term); #endif /* OPT_COLOR_RES */ @@ -1575,7 +1575,6 @@ spawnXTerm(XtermWidget xw) TERMIO_STRUCT tio; int status; Bool ok_termcap; - char *newtc; char *TermName = NULL; char *ptr, *shname, buf[64]; @@ -1676,12 +1675,10 @@ spawnXTerm(XtermWidget xw) #if OPT_TEK4014 if (TEK4014_ACTIVE(xw)) { envnew = tekterm; - newtc = TekScreenOf(tekWidget)->tcapbuf; } else #endif { envnew = vtterm; - newtc = screen->tcapbuf; } /* @@ -1691,13 +1688,13 @@ spawnXTerm(XtermWidget xw) * entry is not found. */ ok_termcap = True; - if (!get_termcap(TermName = resource.term_name, newtc)) { + if (!get_termcap(TermName = resource.term_name)) { char *last = NULL; TermName = *envnew; ok_termcap = False; while (*envnew != NULL) { if ((last == NULL || strcmp(last, *envnew)) - && get_termcap(*envnew, newtc)) { + && get_termcap(*envnew)) { TermName = *envnew; ok_termcap = True; break; @@ -1707,7 +1704,7 @@ spawnXTerm(XtermWidget xw) } } if (ok_termcap) { - resize_termcap(xw, newtc); + resize_termcap(xw); } /* tell tty how big window is */ @@ -1715,8 +1712,8 @@ spawnXTerm(XtermWidget xw) if (TEK4014_ACTIVE(xw)) { TTYSIZE_ROWS(ts) = 38; TTYSIZE_COLS(ts) = 81; - ts.ws_xpixel = TFullWidth(&(tekWidget->screen)); - ts.ws_ypixel = TFullHeight(&(tekWidget->screen)); + ts.ws_xpixel = TFullWidth(TekScreenOf(tekWidget)); + ts.ws_ypixel = TFullHeight(TekScreenOf(tekWidget)); } else #endif { @@ -1820,7 +1817,7 @@ spawnXTerm(XtermWidget xw) xtermSetenv("TERM", TermName); if (!TermName) - *newtc = 0; + *get_tcap_buffer(xw) = 0; sprintf(buf, "%lu", ((unsigned long) XtWindow(SHELL_OF(CURRENT_EMU())))); @@ -1840,7 +1837,7 @@ spawnXTerm(XtermWidget xw) for (i = 0; i <= 2; i++) if (i != ttyfd) { (void) close(i); - (void) dup(ttyfd); + IGNORE_RC(dup(ttyfd)); } /* and close the tty */ @@ -1979,7 +1976,7 @@ SIGNAL_T Exit(int n) { TScreen *screen = TScreenOf(term); - int pty = term->screen.respond; /* file descriptor of pty */ + int pty = TScreenOf(term)->respond; close(pty); /* close explicitly to avoid race with slave side */ #ifdef ALLOWLOGGING if (screen->logging) @@ -2005,7 +2002,7 @@ Exit(int n) if (n == 0) { TRACE(("Freeing memory leaks\n")); if (term != 0) { - Display *dpy = term->screen.display; + Display *dpy = TScreenOf(term)->display; if (toplevel) { XtDestroyWidget(toplevel); @@ -2035,7 +2032,7 @@ Exit(int n) /* ARGSUSED */ static void -resize_termcap(XtermWidget xw, char *newtc) +resize_termcap(XtermWidget xw) { } @@ -2068,7 +2065,7 @@ reapchild(int n GCC_UNUSED) (void) signal(SIGCHLD, reapchild); do { - if (pid == term->screen.pid) { + if (pid == TScreenOf(term)->pid) { #ifdef DEBUG if (debug) fputs("Exiting\n", stderr); diff --git a/app/xterm/plink.sh b/app/xterm/plink.sh index 244f1b517..b6984c2d8 100644 --- a/app/xterm/plink.sh +++ b/app/xterm/plink.sh @@ -1,6 +1,36 @@ #!/bin/sh -# $XTermId: plink.sh,v 1.4 2005/05/03 00:38:24 tom Exp $ -# $XFree86: xc/programs/xterm/plink.sh,v 3.2 2005/05/03 00:38:24 dickey Exp $ +# $XTermId: plink.sh,v 1.5 2005/05/03 00:38:24 tom Exp $ +# ----------------------------------------------------------------------------- +# this file is part of xterm +# +# Copyright 2001,2005 by Thomas E. Dickey +# +# All Rights Reserved +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name(s) of the above copyright +# holders shall not be used in advertising or otherwise to promote the +# sale, use or other dealings in this Software without prior written +# authorization. +# ----------------------------------------------------------------------------- # # Reduce the number of dynamic libraries used to link an executable. LINKIT= diff --git a/app/xterm/print.c b/app/xterm/print.c index e600e6218..08f883d75 100644 --- a/app/xterm/print.c +++ b/app/xterm/print.c @@ -1,4 +1,4 @@ -/* $XTermId: print.c,v 1.110 2009/10/12 00:04:19 tom Exp $ */ +/* $XTermId: print.c,v 1.115 2009/12/10 09:44:39 tom Exp $ */ /************************************************************ @@ -36,6 +36,7 @@ authorization. #include <data.h> #include <menu.h> #include <error.h> +#include <xstrings.h> #include <stdio.h> @@ -61,7 +62,8 @@ static void charToPrinter(XtermWidget /* xw */ , unsigned /* chr */ ); static void printLine(XtermWidget /* xw */ , int /* row */ , - unsigned /* chr */ ); + unsigned /* chr */ , + PrinterFlags * /* p */ ); static void send_CharSet(XtermWidget /* xw */ , LineData * /* ld */ ); static void send_SGR(XtermWidget /* xw */ , @@ -112,7 +114,7 @@ printCursorLine(XtermWidget xw) TScreen *screen = TScreenOf(xw); TRACE(("printCursorLine\n")); - printLine(xw, screen->cur_row, '\n'); + printLine(xw, screen->cur_row, '\n', getPrinterFlags(xw, NULL, 0)); } #define NO_COLOR ((unsigned)-1) @@ -123,7 +125,7 @@ printCursorLine(XtermWidget xw) * characters that xterm would allow as a selection (which may include blanks). */ static void -printLine(XtermWidget xw, int row, unsigned chr) +printLine(XtermWidget xw, int row, unsigned chr, PrinterFlags * p) { TScreen *screen = TScreenOf(xw); int inx = ROW2INX(screen, row); @@ -142,6 +144,9 @@ printLine(XtermWidget xw, int row, unsigned chr) int last_cs = CSET_IN; ld = getLineData(screen, inx); + if (ld == 0) + return; + TRACE(("printLine(row=%d/%d, top=%d:%d, chr=%d):%s\n", row, ROW2INX(screen, row), screen->topline, screen->max_row, chr, visibleIChars(ld->charData, (unsigned) last))); @@ -156,7 +161,7 @@ printLine(XtermWidget xw, int row, unsigned chr) break; } if (last) { - if (screen->print_attributes) { + if (p->print_attributes) { send_CharSet(xw, ld); send_SGR(xw, 0, NO_COLOR, NO_COLOR); } @@ -164,7 +169,7 @@ printLine(XtermWidget xw, int row, unsigned chr) ch = ld->charData[col]; #if OPT_PRINT_COLORS if (screen->colorMode) { - if (screen->print_attributes > 1) { + if (p->print_attributes > 1) { fg = (ld->attribs[col] & FG_COLOR) ? extract_fg(xw, ColorOf(ld, col), ld->attribs[col]) : NO_COLOR; @@ -183,7 +188,7 @@ printLine(XtermWidget xw, int row, unsigned chr) attr = CharOf(ld->attribs[col] & SGR_MASK); last_fg = fg; last_bg = bg; - if (screen->print_attributes) + if (p->print_attributes) send_SGR(xw, attr, fg, bg); } @@ -197,7 +202,7 @@ printLine(XtermWidget xw, int row, unsigned chr) #endif cs = (ch >= ' ' && ch != ANSI_DEL) ? CSET_IN : CSET_OUT; if (last_cs != cs) { - if (screen->print_attributes) { + if (p->print_attributes) { charToPrinter(xw, (unsigned) ((cs == CSET_OUT) ? SHIFT_OUT @@ -225,34 +230,47 @@ printLine(XtermWidget xw, int row, unsigned chr) } }); } - if (screen->print_attributes) { + if (p->print_attributes) { send_SGR(xw, 0, NO_COLOR, NO_COLOR); if (cs != CSET_IN) charToPrinter(xw, SHIFT_IN); } } - if (screen->print_attributes) + + /* finish line (protocol for attributes needs a CR */ + if (p->print_attributes) charToPrinter(xw, '\r'); - charToPrinter(xw, chr); + + if (chr && !(p->printer_newline)) { + if (LineTstWrapped(ld)) + chr = '\0'; + } + + if (chr) + charToPrinter(xw, chr); return; } +#define PrintNewLine() (unsigned) (((top < bot) || p->printer_newline) ? '\n' : '\0') + void -xtermPrintScreen(XtermWidget xw, Bool use_DECPEX) +xtermPrintScreen(XtermWidget xw, Bool use_DECPEX, PrinterFlags * p) { if (XtIsRealized((Widget) xw)) { TScreen *screen = TScreenOf(xw); - Bool extent = (use_DECPEX && screen->printer_extent); + Bool extent = (use_DECPEX && p->printer_extent); int top = extent ? 0 : screen->top_marg; int bot = extent ? screen->max_row : screen->bot_marg; int was_open = initialized; TRACE(("xtermPrintScreen, rows %d..%d\n", top, bot)); - while (top <= bot) - printLine(xw, top++, '\n'); - if (screen->printer_formfeed) + while (top <= bot) { + printLine(xw, top, PrintNewLine(), p); + ++top; + } + if (p->printer_formfeed) charToPrinter(xw, '\f'); if (!was_open || screen->printer_autoclose) { @@ -269,7 +287,7 @@ xtermPrintScreen(XtermWidget xw, Bool use_DECPEX) * because the normal screen's buffer is part of the overall scrollback buffer. */ void -xtermPrintEverything(XtermWidget xw) +xtermPrintEverything(XtermWidget xw, PrinterFlags * p) { TScreen *screen = TScreenOf(xw); int top = 0; @@ -282,9 +300,11 @@ xtermPrintEverything(XtermWidget xw) } TRACE(("xtermPrintEverything, rows %d..%d\n", top, bot)); - while (top <= bot) - printLine(xw, top++, '\n'); - if (screen->printer_formfeed) + while (top <= bot) { + printLine(xw, top, PrintNewLine(), p); + ++top; + } + if (p->printer_formfeed) charToPrinter(xw, '\f'); if (!was_open || screen->printer_autoclose) { @@ -339,7 +359,7 @@ send_SGR(XtermWidget xw, unsigned attr, unsigned fg, unsigned bg) } if (fg != NO_COLOR) { #if OPT_PC_COLORS - if (xw->screen.boldColors + if (TScreenOf(xw)->boldColors && fg > 8 && (attr & BOLD) != 0) fg -= 8; @@ -463,17 +483,17 @@ xtermMediaControl(XtermWidget xw, int param, int private_seq) setPrinterControlMode(xw, 1); break; case 10: /* VT320 */ - xtermPrintScreen(xw, False); + xtermPrintScreen(xw, False, getPrinterFlags(xw, NULL, 0)); break; case 11: /* VT320 */ - xtermPrintEverything(xw); + xtermPrintEverything(xw, getPrinterFlags(xw, NULL, 0)); break; } } else { switch (param) { case -1: case 0: - xtermPrintScreen(xw, True); + xtermPrintScreen(xw, True, getPrinterFlags(xw, NULL, 0)); break; case 4: setPrinterControlMode(xw, 0); @@ -498,7 +518,7 @@ xtermAutoPrint(XtermWidget xw, unsigned chr) if (screen->printer_controlmode == 1) { TRACE(("AutoPrint %d\n", chr)); - printLine(xw, screen->cursorp.row, chr); + printLine(xw, screen->cursorp.row, chr, getPrinterFlags(xw, NULL, 0)); if (Printer != 0) fflush(Printer); } @@ -601,16 +621,69 @@ xtermHasPrinter(XtermWidget xw) void setPrinterControlMode(XtermWidget xw, int mode) { + TScreen *screen = TScreenOf(xw); + if (xtermHasPrinter(xw) - && xw->screen.printer_controlmode != mode) { + && screen->printer_controlmode != mode) { TRACE(("%s %s mode\n", (mode ? "set" : "reset"), (mode ? showPrinterControlMode(mode) - : showPrinterControlMode(xw->screen.printer_controlmode)))); - xw->screen.printer_controlmode = mode; + : showPrinterControlMode(screen->printer_controlmode)))); + screen->printer_controlmode = mode; update_print_redir(); } } + +PrinterFlags * +getPrinterFlags(XtermWidget xw, String * params, Cardinal *param_count) +{ + /* *INDENT-OFF* */ + static const struct { + const char *name; + unsigned offset; + int value; + } table[] = { + { "noFormFeed", XtOffsetOf(PrinterFlags, printer_formfeed), 0 }, + { "FormFeed", XtOffsetOf(PrinterFlags, printer_formfeed), 1 }, + { "noNewLine", XtOffsetOf(PrinterFlags, printer_newline), 0 }, + { "NewLine", XtOffsetOf(PrinterFlags, printer_newline), 1 }, + { "noAttrs", XtOffsetOf(PrinterFlags, print_attributes), 0 }, + { "monoAttrs", XtOffsetOf(PrinterFlags, print_attributes), 1 }, + { "colorAttrs", XtOffsetOf(PrinterFlags, print_attributes), 2 }, + }; + /* *INDENT-ON* */ + + TScreen *screen = TScreenOf(xw); + PrinterFlags *result = &(screen->printer_flags); + + TRACE(("getPrinterFlags %d params\n", param_count ? *param_count : 0)); + + result->printer_extent = screen->printer_extent; + result->printer_formfeed = screen->printer_formfeed; + result->printer_newline = screen->printer_newline; + result->print_attributes = screen->print_attributes; + + if (param_count != 0 && *param_count != 0) { + Cardinal j; + unsigned k; + for (j = 0; j < *param_count; ++j) { + TRACE(("param%d:%s\n", j, params[j])); + for (k = 0; k < XtNumber(table); ++k) { + if (!x_strcasecmp(params[j], table[k].name)) { + int *ptr = (int *) ((char *) result + table[k].offset); + TRACE(("...PrinterFlags(%s) %d->%d\n", + table[k].name, + *ptr, + table[k].value)); + *ptr = table[k].value; + break; + } + } + } + } + + return result; +} diff --git a/app/xterm/proto.h b/app/xterm/proto.h index 262c308dc..d2463ceeb 100644 --- a/app/xterm/proto.h +++ b/app/xterm/proto.h @@ -1,4 +1,37 @@ -/* $XFree86: xc/programs/xterm/proto.h,v 3.4 2003/10/27 01:07:57 dickey Exp $ */ +/* + * $XTermId: proto.h,v 1.10 2003/10/27 01:07:57 tom Exp $ + * ---------------------------------------------------------------------------- + * this file is part of xterm + * + * Copyright 1996-2008,2003 by Thomas E. Dickey + * + * All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization. + * ---------------------------------------------------------------------------- + */ #ifndef included_proto_h #define included_proto_h diff --git a/app/xterm/ptydata.c b/app/xterm/ptydata.c index 194419ca2..d5ff28653 100644 --- a/app/xterm/ptydata.c +++ b/app/xterm/ptydata.c @@ -1,8 +1,8 @@ -/* $XTermId: ptydata.c,v 1.90 2009/08/09 17:22:05 tom Exp $ */ +/* $XTermId: ptydata.c,v 1.94 2010/01/21 02:08:28 tom Exp $ */ /************************************************************ -Copyright 1999-2008,2009 by Thomas E. Dickey +Copyright 1999-2009,2010 by Thomas E. Dickey All Rights Reserved @@ -240,7 +240,7 @@ readPtyData(TScreen * screen, PtySelect * select_mask, PtyData * data) #endif data->last += size; #ifdef ALLOWLOGGING - term->screen.logstart = VTbuffer->next; + TScreenOf(term)->logstart = VTbuffer->next; #endif } @@ -331,7 +331,7 @@ initPtyData(PtyData ** result) } /* - * Initialize a buffer for the caller, using its data in 'source'. + * Initialize a buffer for the caller, using its data in 'next'. */ #if OPT_WIDE_CHARS PtyData * @@ -400,21 +400,44 @@ fillPtyData(TScreen * screen, PtyData * data, char *value, int length) Char * convertToUTF8(Char * lp, unsigned c) { - if (c < 0x80) { /* 0******* */ - *lp++ = (Char) (c); - } else if (c < 0x800) { /* 110***** 10****** */ - *lp++ = (Char) (0xc0 | (c >> 6)); - *lp++ = (Char) (0x80 | (c & 0x3f)); - } else { /* 1110**** 10****** 10****** */ - *lp++ = (Char) (0xe0 | (c >> 12)); - *lp++ = (Char) (0x80 | ((c >> 6) & 0x3f)); - *lp++ = (Char) (0x80 | (c & 0x3f)); +#define CH(n) (Char)((c) >> ((n) * 8)) + if (c < 0x80) { + /* 0******* */ + *lp++ = (Char) CH(0); + } else if (c < 0x800) { + /* 110***** 10****** */ + *lp++ = (Char) (0xc0 | (CH(0) >> 6) | ((CH(1) & 0x07) << 2)); + *lp++ = (Char) (0x80 | (CH(0) & 0x3f)); + } else if (c < 0x00010000) { + /* 1110**** 10****** 10****** */ + *lp++ = (Char) (0xe0 | ((int) (CH(1) & 0xf0) >> 4)); + *lp++ = (Char) (0x80 | (CH(0) >> 6) | ((CH(1) & 0x0f) << 2)); + *lp++ = (Char) (0x80 | (CH(0) & 0x3f)); + } else if (c < 0x00200000) { + *lp++ = (Char) (0xf0 | ((int) (CH(2) & 0x1f) >> 2)); + *lp++ = (Char) (0x80 | + ((int) (CH(1) & 0xf0) >> 4) | + ((int) (CH(2) & 0x03) << 4)); + *lp++ = (Char) (0x80 | (CH(0) >> 6) | ((CH(1) & 0x0f) << 2)); + *lp++ = (Char) (0x80 | (CH(0) & 0x3f)); + } else if (c < 0x04000000) { + *lp++ = (Char) (0xf8 | (CH(3) & 0x03)); + *lp++ = (Char) (0x80 | (CH(2) >> 2)); + *lp++ = (Char) (0x80 | + ((int) (CH(1) & 0xf0) >> 4) | + ((int) (CH(2) & 0x03) << 4)); + *lp++ = (Char) (0x80 | (CH(0) >> 6) | ((CH(1) & 0x0f) << 2)); + *lp++ = (Char) (0x80 | (CH(0) & 0x3f)); + } else { + *lp++ = (Char) (0xfc | ((int) (CH(3) & 0x40) >> 6)); + *lp++ = (Char) (0x80 | (CH(3) & 0x3f)); + *lp++ = (Char) (0x80 | (CH(2) >> 2)); + *lp++ = (Char) (0x80 | (CH(1) >> 4) | ((CH(2) & 0x03) << 4)); + *lp++ = (Char) (0x80 | (CH(0) >> 6) | ((CH(1) & 0x0f) << 2)); + *lp++ = (Char) (0x80 | (CH(0) & 0x3f)); } - /* - * UTF-8 is defined for words of up to 31 bits, but we need only 16 - * bits here, since that's all that X11R6 supports. - */ return lp; +#undef CH } /* @@ -454,3 +477,34 @@ noleaks_ptydata(void) } } #endif + +#if 0 +void +test_ptydata(void) +{ + PtyData *data; + unsigned code; + + initPtyData(&data); + TRACE(("test_ptydata\n")); + for (code = 0; code <= 0x7fffffff; ++code) { + int use_size; + + memset(data, 0, sizeof(*data)); + data->next = data->buffer; + data->last = convertToUTF8(data->buffer, code); + + use_size = (data->last - data->next); + + if (decodeUtf8(data)) { + if (code != data->utf_data) { + TRACE(("code %#x ->%#x\n", code, data->utf_data)); + } else if (use_size != data->utf_size) { + TRACE(("size %#x %d->%d\n", code, use_size, data->utf_size)); + } + } else { + TRACE(("fail %#x\n", code)); + } + } +} +#endif diff --git a/app/xterm/ptyx.h b/app/xterm/ptyx.h index 482fe8590..83fc52c7c 100644 --- a/app/xterm/ptyx.h +++ b/app/xterm/ptyx.h @@ -1,7 +1,7 @@ -/* $XTermId: ptyx.h,v 1.632 2009/10/10 13:02:16 tom Exp $ */ +/* $XTermId: ptyx.h,v 1.656 2010/01/04 09:09:29 tom Exp $ */ /* - * Copyright 1999-2008,2009 by Thomas E. Dickey + * Copyright 1999-2009,2010 by Thomas E. Dickey * * All Rights Reserved * @@ -301,6 +301,17 @@ typedef unsigned char Char; /* to support 8 bit chars */ typedef Char *ScrnPtr; typedef ScrnPtr *ScrnBuf; +/* + * Declare an X String, but for unsigned chars. + */ +#ifdef _CONST_X_STRING +typedef const Char *UString; +#else +typedef Char *UString; +#endif + +#define IsEmpty(s) ((s) == 0 || *(s) == '\0') + #define CharOf(n) ((unsigned char)(n)) typedef struct { @@ -358,8 +369,8 @@ typedef struct { #define NPARAM 30 /* Max. parameters */ typedef struct { - char *opt; - char *desc; + String opt; + String desc; } OptionHelp; typedef short ParmType; @@ -797,7 +808,10 @@ typedef enum { #define for_each_curs_gc(n) for (n = gcVTcursNormal; n <= gcVTcursOutline; ++n) #define for_each_gc(n) for (n = gcNorm; n < gcMAX; ++n) -/* indices for the normal terminal colors in screen.Tcolors[] */ +/* + * Indices for the normal terminal colors in screen.Tcolors[]. + * See also OscTextColors, which has corresponding values. + */ typedef enum { TEXT_FG = 0 /* text foreground */ , TEXT_BG /* text background */ @@ -816,6 +830,20 @@ typedef enum { , NCOLORS /* total number of colors */ } TermColors; +/* + * Constants for titleModes resource + */ +typedef enum { + tmSetBase16 = 1 /* set title using hex-string */ + , tmGetBase16 = 2 /* get title using hex-string */ +#if OPT_WIDE_CHARS + , tmSetUtf8 = 4 /* like utf8Title, but controllable */ + , tmGetUtf8 = 8 /* retrieve title encoded as UTF-8 */ +#endif +} TitleModes; + +#define IsTitleMode(xw,mode) (((xw)->screen.title_modes & mode) != 0) + /* indices for mapping multiple clicks to selection types */ typedef enum { Select_CHAR=0 @@ -830,6 +858,58 @@ typedef enum { ,NSELECTUNITS } SelectUnit; +typedef enum { + ecSetColor = 1 + , ecGetColor + , ecGetAnsiColor + , ecLAST +} ColorOps; + +typedef enum { + efSetFont = 1 + , efGetFont + , efLAST +} FontOps; + +typedef enum { + etSetTcap = 1 + , etGetTcap + , etLAST +} TcapOps; + +typedef enum { + /* 1-21 are chosen to be the same as the control-sequence coding */ + ewRestoreWin = 1 + , ewMinimizeWin = 2 + , ewSetWinPosition = 3 + , ewSetWinSizePixels = 4 + , ewRaiseWin = 5 + , ewLowerWin = 6 + , ewRefreshWin = 7 + , ewSetWinSizeChars = 8 +#if OPT_MAXIMIZE + , ewMaximizeWin = 9 +#endif + , ewGetWinState = 11 + , ewGetWinPosition = 13 + , ewGetWinSizePixels = 14 + , ewGetWinSizeChars = 18 +#if OPT_MAXIMIZE + , ewGetScreenSizeChars = 19 +#endif + , ewGetIconTitle = 20 + , ewGetWinTitle = 21 + , ewPushTitle = 22 + , ewPopTitle = 23 + /* these do not fit into that scheme, which is why we use an array */ + , ewSetWinLines + , ewSetXprop + , ewGetSelection + , ewSetSelection + /* get the size of the array... */ + , ewLAST +} WindowOps; + #define COLOR_DEFINED(s,w) ((s)->which & (1<<(w))) #define COLOR_VALUE(s,w) ((s)->colors[w]) #define SET_COLOR_VALUE(s,w,v) (((s)->colors[w] = (v)), ((s)->which |= (1<<(w)))) @@ -896,6 +976,8 @@ typedef enum { # define XK_COLORS 0x0003 #endif +# define XK_TCAPNAME 0x0004 + #else /* !OPT_ISO_COLORS */ #define TERM_COLOR_FLAGS(xw) 0 @@ -952,7 +1034,7 @@ typedef enum { /* Use remaining bits for encoding the other character-sets */ #define CSET_NORMAL(code) ((code) == CSET_SWL) #define CSET_DOUBLE(code) (!CSET_NORMAL(code) && !CSET_EXTEND(code)) -#define CSET_EXTEND(code) ((code) > CSET_DWL) +#define CSET_EXTEND(code) ((int)(code) > CSET_DWL) #define DBLCS_BITS 4 #define DBLCS_MASK BITS2MASK(DBLCS_BITS) @@ -1299,18 +1381,32 @@ typedef enum { #endif } MenuIndex; +typedef enum { + bvOff = -1, + bvLow = 0, + bvHigh +} BellVolume; + #define NUM_POPUP_MENUS 4 #if OPT_COLOR_RES typedef struct { String resource; Pixel value; - int mode; + int mode; /* -1=invalid, 0=unset, 1=set */ } ColorRes; #else #define ColorRes Pixel #endif +/* these are set in getPrinterFlags */ +typedef struct { + int printer_extent; /* print complete page */ + int printer_formfeed; /* print formfeed per function */ + int printer_newline; /* print newline per function */ + int print_attributes; /* 0=off, 1=normal, 2=color */ +} PrinterFlags; + typedef struct { unsigned which; /* must have NCOLORS bits */ Pixel colors[NCOLORS]; @@ -1334,6 +1430,12 @@ typedef struct { #endif } SavedCursor; +typedef struct _SaveTitle { + struct _SaveTitle *next; + char *iconName; + char *windowName; +} SaveTitle; + #define SAVED_CURSORS 2 typedef struct { @@ -1496,18 +1598,32 @@ typedef struct { Boolean visualbell; /* visual bell mode */ Boolean poponbell; /* pop on bell mode */ + Boolean allowColorOps; /* ColorOps mode */ Boolean allowFontOps; /* FontOps mode */ Boolean allowSendEvents;/* SendEvent mode */ Boolean allowTcapOps; /* TcapOps mode */ Boolean allowTitleOps; /* TitleOps mode */ Boolean allowWindowOps; /* WindowOps mode */ + Boolean allowColorOp0; /* initial ColorOps mode */ Boolean allowFontOp0; /* initial FontOps mode */ Boolean allowSendEvent0;/* initial SendEvent mode */ Boolean allowTcapOp0; /* initial TcapOps mode */ Boolean allowTitleOp0; /* initial TitleOps mode */ Boolean allowWindowOp0; /* initial WindowOps mode */ + String disallowedColorOps; + char disallow_color_ops[ecLAST]; + + String disallowedFontOps; + char disallow_font_ops[efLAST]; + + String disallowedTcapOps; + char disallow_tcap_ops[etLAST]; + + String disallowedWinOps; + char disallow_win_ops[ewLAST]; + Boolean awaitInput; /* select-timeout mode */ Boolean grabbedKbd; /* keyboard is grabbed */ #ifdef ALLOWLOGGING @@ -1536,9 +1652,12 @@ typedef struct { Boolean printer_autoclose; /* close printer when offline */ Boolean printer_extent; /* print complete page */ Boolean printer_formfeed; /* print formfeed per function */ + Boolean printer_newline; /* print newline per function */ int printer_controlmode; /* 0=off, 1=auto, 2=controller */ int print_attributes; /* 0=off, 1=normal, 2=color */ + PrinterFlags printer_flags; /* working copy of printer flags */ + Boolean fnt_prop; /* true if proportional fonts */ Boolean fnt_boxes; /* true if font has box-chars */ Boolean force_packed; /* true to override proportional */ @@ -1647,13 +1766,18 @@ typedef struct { Boolean hp_ll_bc; /* kludge HP-style ll for xdb */ Boolean marginbell; /* true if margin bell on */ int nmarginbell; /* columns from right margin */ - int bellarmed; /* cursor below bell margin */ + int bellArmed; /* cursor below bell margin */ + BellVolume marginVolume; /* margin-bell volume */ + BellVolume warningVolume; /* warning-bell volume */ Boolean multiscroll; /* true if multi-scroll */ int scrolls; /* outstanding scroll count, used only with multiscroll */ SavedCursor sc[SAVED_CURSORS]; /* data for restore cursor */ unsigned save_modes[DP_LAST]; /* save dec/xterm private modes */ + int title_modes; /* control set/get of titles */ + SaveTitle *save_title; + /* Improved VT100 emulation stuff. */ String keyboard_dialect; /* default keyboard dialect */ Char gsets[4]; /* G0 through G3. */ @@ -2284,7 +2408,7 @@ typedef struct _TekWidgetRec { /* * Macro to check if we are iconified; do not use render for that case. */ -#define UsingRenderFont(xw) ((xw)->misc.render_font && !IsIcon(&((xw)->screen))) +#define UsingRenderFont(xw) ((xw)->misc.render_font && !IsIcon(TScreenOf(xw))) /* * These definitions do not depend on whether xterm supports active-icon. @@ -2325,11 +2449,21 @@ typedef struct _TekWidgetRec { #define BorderWidth(w) ((w)->core.border_width) #define BorderPixel(w) ((w)->core.border_pixel) -#define AllowXtermOps(w,name) ((w)->screen.name && !(w)->screen.allowSendEvents) -#define AllowFontOps(w) AllowXtermOps(w, allowFontOps) -#define AllowTcapOps(w) AllowXtermOps(w, allowTcapOps) +#define AllowXtermOps(w,name) (TScreenOf(w)->name && !TScreenOf(w)->allowSendEvents) + +#define AllowColorOps(w,name) (AllowXtermOps(w, allowColorOps) || \ + !TScreenOf(w)->disallow_color_ops[name]) + +#define AllowFontOps(w,name) (AllowXtermOps(w, allowFontOps) || \ + !TScreenOf(w)->disallow_font_ops[name]) + +#define AllowTcapOps(w,name) (AllowXtermOps(w, allowTcapOps) || \ + !TScreenOf(w)->disallow_tcap_ops[name]) + #define AllowTitleOps(w) AllowXtermOps(w, allowTitleOps) -#define AllowWindowOps(w) AllowXtermOps(w, allowWindowOps) + +#define AllowWindowOps(w,name) (AllowXtermOps(w, allowWindowOps) || \ + !TScreenOf(w)->disallow_win_ops[name]) #if OPT_TOOLBAR #define ToolbarHeight(w) ((resource.toolBar) \ @@ -2392,6 +2526,10 @@ typedef struct Tek_Link #define TRACE_CHILD /*nothing*/ #endif +#ifndef TRACE_FOCUS +#define TRACE_FOCUS(w,e) /*nothing*/ +#endif + #ifndef TRACE_HINTS #define TRACE_HINTS(hints) /*nothing*/ #endif diff --git a/app/xterm/run-tic.sh b/app/xterm/run-tic.sh index aeaa3ff9a..1a224d52d 100644 --- a/app/xterm/run-tic.sh +++ b/app/xterm/run-tic.sh @@ -1,5 +1,36 @@ #!/bin/sh -# $XTermId: run-tic.sh,v 1.1 2006/08/10 21:42:07 tom Exp $ +# $XTermId: run-tic.sh,v 1.4 2007/06/17 15:30:03 tom Exp $ +# ----------------------------------------------------------------------------- +# this file is part of xterm +# +# Copyright 2006,2007 by Thomas E. Dickey +# +# All Rights Reserved +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name(s) of the above copyright +# holders shall not be used in advertising or otherwise to promote the +# sale, use or other dealings in this Software without prior written +# authorization. +# ----------------------------------------------------------------------------- # # Run tic, either using ncurses' extension feature or filtering out harmless # messages for the extensions which are otherwise ignored by other versions of @@ -19,7 +50,9 @@ echo "** tic $OPT" "$@" tic $OPT "$@" 2>$TMP RET=$? -fgrep -v 'Unknown Capability' $TMP >&2 +fgrep -v 'Unknown Capability' $TMP | \ +fgrep -v 'Capability is not recognized:' | \ +fgrep -v 'tic: Warning near line ' >&2 rm -f $TMP exit $RET diff --git a/app/xterm/screen.c b/app/xterm/screen.c index 20ef3b03c..e24d20ff7 100644 --- a/app/xterm/screen.c +++ b/app/xterm/screen.c @@ -1,7 +1,7 @@ -/* $XTermId: screen.c,v 1.403 2009/10/01 00:30:19 tom Exp $ */ +/* $XTermId: screen.c,v 1.410 2010/01/20 01:38:46 tom Exp $ */ /* - * Copyright 1999-2008,2009 by Thomas E. Dickey + * Copyright 1999-2009,2010 by Thomas E. Dickey * * All Rights Reserved * @@ -270,7 +270,7 @@ allocScrnHead(TScreen * screen, unsigned nrow) SysError(ERROR_SCALLOC); TRACE(("allocScrnHead %d -> %d -> %p..%p\n", nrow, nrow * size, - result, + (void *) result, (char *) result + (nrow * size) - 1)); return result; } @@ -351,7 +351,7 @@ allocScrnBuf(XtermWidget xw, unsigned nrow, unsigned ncol, Char ** addr) setupLineData(screen, base, *addr, nrow, ncol); } - TRACE(("allocScrnBuf %dx%d ->%p\n", nrow, ncol, base)); + TRACE(("allocScrnBuf %dx%d ->%p\n", nrow, ncol, (void *) base)); return (base); } @@ -453,7 +453,7 @@ Reallocate(XtermWidget xw, if (nrow < oldrow) { /* Remove lines off the top of the buffer if necessary. */ move_up = (int) (oldrow - nrow) - - (xw->screen.max_row - xw->screen.cur_row); + - (TScreenOf(xw)->max_row - TScreenOf(xw)->cur_row); if (move_up < 0) move_up = 0; /* Overlapping move here! */ @@ -486,7 +486,7 @@ Reallocate(XtermWidget xw, if (GravityIsSouthWest(xw)) { if (nrow > oldrow) { /* move data down to bottom of expanded screen */ - move_down = Min((int) (nrow - oldrow), xw->screen.savedlines); + move_down = Min((int) (nrow - oldrow), TScreenOf(xw)->savedlines); } } @@ -503,7 +503,7 @@ Reallocate(XtermWidget xw, /* Now free the old data */ free(oldBufData); - TRACE(("...Reallocate %dx%d ->%p\n", nrow, ncol, newBufHead)); + TRACE(("...Reallocate %dx%d ->%p\n", nrow, ncol, (void *) newBufHead)); return move_down ? move_down : -move_up; /* convert to rows */ } @@ -589,7 +589,7 @@ ReallocateBufOffsets(XtermWidget xw, void ChangeToWide(XtermWidget xw) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); int savelines = screen->scrollWidget ? screen->savelines : 0; if (screen->wide_chars) @@ -597,6 +597,8 @@ ChangeToWide(XtermWidget xw) TRACE(("ChangeToWide\n")); if (xtermLoadWideFonts(xw, True)) { + int whichBuf = screen->whichBuf; + if (savelines < 0) savelines = 0; @@ -606,7 +608,7 @@ ChangeToWide(XtermWidget xw) * data in the alternate buffer. */ if (screen->whichBuf) - SwitchBufPtrs(screen); + SwitchBufPtrs(screen, 0); #if OPT_SAVE_LINES #if !OPT_FIFO_LINES @@ -644,8 +646,8 @@ ChangeToWide(XtermWidget xw) /* * Switch the pointers back before we start painting on the screen. */ - if (screen->whichBuf) - SwitchBufPtrs(screen); + if (whichBuf) + SwitchBufPtrs(screen, whichBuf); update_font_utf8_mode(); SetVTFont(xw, screen->menu_font_number, True, NULL); @@ -661,7 +663,7 @@ void ClearCells(XtermWidget xw, int flags, unsigned len, int row, int col) { if (len != 0) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); LineData *ld; unsigned n; @@ -683,7 +685,7 @@ ClearCells(XtermWidget xw, int flags, unsigned len, int row, int col) if_OPT_WIDE_CHARS(screen, { size_t off; for_each_combData(off, ld) { - memset(ld->combData[off] + col, 0, len * sizeof(IChar)); + memset(ld->combData[off] + col, 0, len * sizeof(CharData)); } }); } @@ -697,7 +699,7 @@ void ScrnClearCells(XtermWidget xw, int row, int col, unsigned len) { #if OPT_WIDE_CHARS - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); #endif int flags = 0; @@ -720,8 +722,8 @@ ScrnClearCells(XtermWidget xw, int row, int col, unsigned len) void ScrnDisownSelection(XtermWidget xw) { - if (ScrnHaveSelection(&(xw->screen))) { - if (xw->screen.keepSelection) { + if (ScrnHaveSelection(TScreenOf(xw))) { + if (TScreenOf(xw)->keepSelection) { UnhiliteSelection(xw); } else { DisownSelection(xw); @@ -740,7 +742,7 @@ ScrnWriteText(XtermWidget xw, CellColor cur_fg_bg, unsigned length) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); LineData *ld; #if OPT_ISO_COLORS CellColor *fb = 0; @@ -846,7 +848,7 @@ ScrnWriteText(XtermWidget xw, for_each_combData(off, ld) { memset(ld->combData[off] + screen->cur_col, 0, - real_width * sizeof(IChar)); + real_width * sizeof(CharData)); } }); if_OPT_ISO_COLORS(screen, { @@ -873,7 +875,7 @@ ScrnWriteText(XtermWidget xw, static void ScrnClearLines(XtermWidget xw, ScrnBuf sb, int where, unsigned n, unsigned size) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); ScrnPtr *base; unsigned jump = scrnHeadSize(screen, 1); unsigned i; @@ -902,7 +904,7 @@ ScrnClearLines(XtermWidget xw, ScrnBuf sb, int where, unsigned n, unsigned size) SetLineDblCS(work, 0); #endif - memset(work->charData, 0, size * sizeof(IChar)); + memset(work->charData, 0, size * sizeof(CharData)); if (TERM_COLOR_FLAGS(xw)) { memset(work->attribs, (int) flags, size); #if OPT_ISO_COLORS @@ -924,7 +926,7 @@ ScrnClearLines(XtermWidget xw, ScrnBuf sb, int where, unsigned n, unsigned size) size_t off; for (off = 0; off < work->combSize; ++off) { - memset(work->combData[off], 0, size * sizeof(IChar)); + memset(work->combData[off], 0, size * sizeof(CharData)); } } #endif @@ -1010,7 +1012,7 @@ ScrnPointers(TScreen * screen, size_t len) void ScrnInsertLine(XtermWidget xw, ScrnBuf sb, int last, int where, unsigned n) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); unsigned size = (unsigned) MaxCols(screen); TRACE(("ScrnInsertLine(last %d, where %d, n %d, size %d)\n", @@ -1055,7 +1057,7 @@ ScrnInsertLine(XtermWidget xw, ScrnBuf sb, int last, int where, unsigned n) void ScrnDeleteLine(XtermWidget xw, ScrnBuf sb, int last, int where, unsigned n) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); unsigned size = (unsigned) MaxCols(screen); TRACE(("ScrnDeleteLine(%s:last %d, where %d, n %d, size %d)\n", @@ -1141,7 +1143,7 @@ ScrnInsertChar(XtermWidget xw, unsigned n) for (j = last - 1; j >= (col + (int) n); --j) \ data[j] = data[j - (int) n] - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); int last = MaxCols(screen); int row = screen->cur_row; int col = screen->cur_col; @@ -1202,7 +1204,7 @@ ScrnDeleteChar(XtermWidget xw, unsigned n) for (j = col; j < last - (int) n; ++j) \ data[j] = data[j + (int) n] - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); int last = MaxCols(screen); int row = screen->cur_row; int col = screen->cur_col; @@ -1265,7 +1267,7 @@ ScrnRefresh(XtermWidget xw, int ncols, Bool force) /* ... leading/trailing spaces */ { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); LineData *ld; int y = toprow * FontHeight(screen) + screen->border; int row; @@ -1329,7 +1331,7 @@ ScrnRefresh(XtermWidget xw, if ((ld = getLineData(screen, ROW2INX(screen, lastind))) == 0) break; - if (maxcol >= ld->lineSize) { + if (maxcol >= (int) ld->lineSize) { maxcol = ld->lineSize - 1; hi_col = maxcol; } @@ -1627,7 +1629,7 @@ ScrnUpdate(XtermWidget xw, int ncols, Bool force) /* ... leading/trailing spaces */ { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); if (ScrnHaveSelection(screen) && (toprow <= screen->endH.row) @@ -1646,7 +1648,7 @@ ClearBufRows(XtermWidget xw, int first, int last) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); unsigned len = (unsigned) MaxCols(screen); int row; @@ -1686,7 +1688,7 @@ ScreenResize(XtermWidget xw, int height, unsigned *flags) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); int code, rows, cols; int border = 2 * screen->border; int move_down_by = 0; @@ -1705,13 +1707,13 @@ ScreenResize(XtermWidget xw, if (screen->is_running) { /* clear the right and bottom internal border because of NorthWest gravity might have left junk on the right and bottom edges */ - if (width >= FullWidth(screen)) { + if (width >= (int) FullWidth(screen)) { XClearArea(screen->display, tw, FullWidth(screen), 0, /* right edge */ 0, (unsigned) height, /* from top to bottom */ False); } - if (height >= FullHeight(screen)) { + if (height >= (int) FullHeight(screen)) { XClearArea(screen->display, tw, 0, FullHeight(screen), /* bottom */ (unsigned) width, 0, /* all across the bottom */ @@ -1732,6 +1734,7 @@ ScreenResize(XtermWidget xw, /* update buffers if the screen has changed size */ if (MaxRows(screen) != rows || MaxCols(screen) != cols) { + int whichBuf = 0; int delta_rows = rows - MaxRows(screen); #if OPT_TRACE int delta_cols = cols - MaxCols(screen); @@ -1958,9 +1961,13 @@ ScreenResize(XtermWidget xw, } #else /* !OPT_SAVE_LINES */ if (screen->whichBuf - && GravityIsSouthWest(xw)) + && GravityIsSouthWest(xw)) { /* swap buffer pointers back to make this work */ - SwitchBufPtrs(screen); + whichBuf = screen->whichBuf; + SwitchBufPtrs(screen, 0); + } else { + whichBuf = 0; + } if (screen->editBuf_index[1]) (void) Reallocate(xw, &screen->editBuf_index[1], @@ -1997,8 +2004,8 @@ ScreenResize(XtermWidget xw, screen->cursorp.row += move_down_by; ScrollSelection(screen, move_down_by, True); - if (screen->whichBuf) - SwitchBufPtrs(screen); /* put the pointers back */ + if (whichBuf) + SwitchBufPtrs(screen, whichBuf); /* put the pointers back */ } } @@ -2144,7 +2151,7 @@ limitedParseCol(XtermWidget xw, TScreen * screen, int col) void xtermParseRect(XtermWidget xw, int nparams, int *params, XTermRect * target) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); memset(target, 0, sizeof(*target)); target->top = LimitedParse(0, limitedParseRow, minRectRow(screen)); @@ -2161,7 +2168,7 @@ xtermParseRect(XtermWidget xw, int nparams, int *params, XTermRect * target) static Bool validRect(XtermWidget xw, XTermRect * target) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); TRACE(("comparing against screensize %dx%d\n", maxRectRow(screen), @@ -2186,7 +2193,7 @@ ScrnFillRectangle(XtermWidget xw, unsigned flags, Bool keepColors) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); TRACE(("filling rectangle with '%c' flags %#x\n", value, flags)); if (validRect(xw, target)) { @@ -2233,7 +2240,7 @@ ScrnFillRectangle(XtermWidget xw, if_OPT_WIDE_CHARS(screen, { size_t off; for_each_combData(off, ld) { - memset(ld->combData[off] + left, 0, size * sizeof(IChar)); + memset(ld->combData[off] + left, 0, size * sizeof(CharData)); } }) } @@ -2260,7 +2267,7 @@ ScrnFillRectangle(XtermWidget xw, void ScrnCopyRectangle(XtermWidget xw, XTermRect * source, int nparam, int *params) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); TRACE(("copying rectangle\n")); @@ -2345,7 +2352,7 @@ ScrnMarkRectangle(XtermWidget xw, int nparam, int *params) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); Bool exact = (screen->cur_decsace == 2); TRACE(("%s %s\n", @@ -2463,7 +2470,7 @@ void ScrnWipeRectangle(XtermWidget xw, XTermRect * target) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); TRACE(("wiping rectangle\n")); diff --git a/app/xterm/sinstall.sh b/app/xterm/sinstall.sh index c88a22658..50a031236 100644 --- a/app/xterm/sinstall.sh +++ b/app/xterm/sinstall.sh @@ -1,5 +1,36 @@ #!/bin/sh -# $XTermId: sinstall.sh,v 1.16 2008/03/02 23:35:02 tom Exp $ +# $XTermId: sinstall.sh,v 1.17 2008/03/02 23:35:02 tom Exp $ +# ----------------------------------------------------------------------------- +# this file is part of xterm +# +# Copyright 1999-2006,2008 by Thomas E. Dickey +# +# All Rights Reserved +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name(s) of the above copyright +# holders shall not be used in advertising or otherwise to promote the +# sale, use or other dealings in this Software without prior written +# authorization. +# ----------------------------------------------------------------------------- # # Install program setuid if the installer is running as root, and if xterm is # already installed on the system with setuid privilege. This is a safeguard diff --git a/app/xterm/tabs.c b/app/xterm/tabs.c index 98732faa4..52cec209d 100644 --- a/app/xterm/tabs.c +++ b/app/xterm/tabs.c @@ -1,4 +1,4 @@ -/* $XTermId: tabs.c,v 1.36 2009/06/21 14:34:17 tom Exp $ */ +/* $XTermId: tabs.c,v 1.37 2009/11/28 14:11:06 tom Exp $ */ /* * Copyright 2000-2008,2009 by Thomas E. Dickey @@ -107,7 +107,7 @@ TabClear(Tabs tabs, int col) static int TabNext(XtermWidget xw, Tabs tabs, int col) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); if (screen->curses && screen->do_wrap && (xw->flags & WRAPAROUND)) { xtermIndex(xw, 1); @@ -143,7 +143,7 @@ TabPrev(Tabs tabs, int col) Bool TabToNextStop(XtermWidget xw) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); int saved_column = screen->cur_col; int next = TabNext(xw, xw->tabs, screen->cur_col); int max = LineMaxCol(screen, getLineData(screen, screen->cur_row)); @@ -161,7 +161,7 @@ TabToNextStop(XtermWidget xw) Bool TabToPrevStop(XtermWidget xw) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); int saved_column = screen->cur_col; set_cur_col(screen, TabPrev(xw->tabs, screen->cur_col)); diff --git a/app/xterm/termcap b/app/xterm/termcap index 228704896..91111ae50 100644 --- a/app/xterm/termcap +++ b/app/xterm/termcap @@ -1,4 +1,4 @@ -# $XTermId: termcap,v 1.76 2009/07/19 15:54:13 tom Exp $ +# $XTermId: termcap,v 1.78 2009/11/09 00:24:26 tom Exp $ # # These are termcap entries that correspond to xterm's terminfo file. # The file is formatted using ncurses' "tic -CNx", but is not mechanically @@ -69,7 +69,7 @@ xb|xterm-basic|modern xterm common:\ :me=\E[m:ml=\El:mr=\E[7m:mu=\Em:nd=\E[C:op=\E[39;49m:\ :rc=\E8:rs=\E[!p\E[?3;4l\E[4l\E>:sc=\E7:se=\E[27m:sf=^J:\ :so=\E[7m:sr=\EM:st=\EH:te=\E[?1049l:ti=\E[?1049h:\ - :ue=\E[24m:up=\E[A:us=\E[4m:ve=\E[?25h:vi=\E[?25l: + :ue=\E[24m:up=\E[A:us=\E[4m:ve=\E[?12l\E[?25h:vi=\E[?25l:vs=\E[?12;25h: # The xterm-new description has all of the features, but is not completely # compatible with vt220. If you are using a Sun or PC keyboard, set the @@ -85,17 +85,17 @@ vt|xterm-vt220|xterm emulating vt220:\ :tc=xterm-basic: v1|xterm-24|xterms|vs100|24x80 xterm:\ - :li#24:tc=xterm: + :li#24:tc=xterm-old: v2|xterm-65|65x80 xterm:\ - :li#65:tc=xterm: + :li#65:tc=xterm-old: vb|xterm-bold|xterm with bold for underline:\ - :so=\E[7m:us=\E[1m:tc=xterm: + :so=\E[7m:us=\E[1m:tc=xterm-old: vB|xterm-boldso|xterm with bold for standout:\ - :se=\E[m:so=\E[1m:tc=xterm: + :se=\E[m:so=\E[1m:tc=xterm-old: vm|xterm-mono|monochrome xterm:\ :ut@:\ :Co@:NC@:kn#20:pa@:\ - :AB@:AF@:Sb@:Sf@:op@:st@:tc=xterm: + :AB@:AF@:Sb@:Sf@:op@:st@:tc=xterm-old: # # Alternate terminal description that "works" for interactive shells such as # tcsh and bash. @@ -151,8 +151,8 @@ x8|xterm-8bit|xterm terminal emulator 8-bit controls (X Window System):\ :ku=\217A:le=^H:mb=\2335m:md=\2331m:me=\233m:mr=\2337m:\ :nd=\233C:rc=\E8:sc=\E7:se=\23327m:sf=^J:so=\2337m:sr=\215:\ :st=\210:ta=^I:te=\233?1049l:ti=\233?1049h:ue=\23324m:\ - :up=\233A:us=\2334m:vb=\233?5h\233?5l:ve=\233?25h:\ - :vi=\233?25l: + :up=\233A:us=\2334m:vb=\233?5h\233?5l:ve=\233?25l\233?25h:\ + :vs=\233?12;25h:vi=\233?25l: # hp|xterm-hp|xterm with hpterm function keys:\ :@7=\EF:k1=\Ep:k2=\Eq:k3=\Er:k4=\Es:k5=\Et:k6=\Eu:k7=\Ev:\ diff --git a/app/xterm/testxmc.c b/app/xterm/testxmc.c index e179749a9..dacada25d 100644 --- a/app/xterm/testxmc.c +++ b/app/xterm/testxmc.c @@ -1,4 +1,4 @@ -/* $XTermId: testxmc.c,v 1.45 2009/09/10 09:05:20 tom Exp $ */ +/* $XTermId: testxmc.c,v 1.46 2009/11/28 14:15:24 tom Exp $ */ /************************************************************ @@ -96,7 +96,7 @@ Mark_XMC(XtermWidget xw, int param) { static IChar *glitch; - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); Bool found = False; Char my_attrs = CharOf(screen->xmc_attributes & XMC_FLAGS); Char whichone = 0; @@ -159,7 +159,7 @@ Mark_XMC(XtermWidget xw, int param) void Jump_XMC(XtermWidget xw) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); if (!screen->move_sgr_ok && screen->cur_col <= LineMaxCol(screen, getLineData(screen, screen->cur_row))) { @@ -174,7 +174,7 @@ Jump_XMC(XtermWidget xw) void Resolve_XMC(XtermWidget xw) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); LineData *ld; Bool changed = False; Char start; diff --git a/app/xterm/trace.c b/app/xterm/trace.c index fa8602afc..d01667c68 100644 --- a/app/xterm/trace.c +++ b/app/xterm/trace.c @@ -1,29 +1,36 @@ -/* $XTermId: trace.c,v 1.104 2009/10/12 00:08:00 tom Exp $ */ +/* $XTermId: trace.c,v 1.110 2009/12/10 09:36:28 tom Exp $ */ -/************************************************************ - -Copyright 1997-2008,2009 by Thomas E. Dickey - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of the above listed -copyright holder(s) not be used in advertising or publicity pertaining -to distribution of the software without specific, written prior -permission. - -THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD -TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE -LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -********************************************************/ +/* + * + * Copyright 1997-2008,2009 by Thomas E. Dickey + * + * All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization. + * + */ /* * debugging support via TRACE macro. @@ -342,6 +349,23 @@ visibleEventType(int type) } const char * +visibleNotifyDetail(int code) +{ + const char *result = "?"; + switch (code) { + CASETYPE(NotifyAncestor); + CASETYPE(NotifyVirtual); + CASETYPE(NotifyInferior); + CASETYPE(NotifyNonlinear); + CASETYPE(NotifyNonlinearVirtual); + CASETYPE(NotifyPointer); + CASETYPE(NotifyPointerRoot); + CASETYPE(NotifyDetailNone); + } + return result; +} + +const char * visibleSelectionTarget(Display * d, Atom a) { const char *result = "?"; @@ -454,6 +478,39 @@ LineTstFlag(LineData ld, int flag) #endif /* OPT_TRACE_FLAGS */ void +TraceFocus(Widget w, XEvent * ev) +{ + TRACE(("trace_focus event type %d:%s\n", + ev->type, visibleEventType(ev->type))); + switch (ev->type) { + case FocusIn: + case FocusOut: + { + XFocusChangeEvent *event = (XFocusChangeEvent *) ev; + TRACE(("\tdetail: %s\n", visibleNotifyDetail(event->detail))); + TRACE(("\tmode: %d\n", event->mode)); + TRACE(("\twindow: %#lx\n", event->window)); + } + break; + case EnterNotify: + case LeaveNotify: + { + XCrossingEvent *event = (XCrossingEvent *) ev; + TRACE(("\tdetail: %s\n", visibleNotifyDetail(event->detail))); + TRACE(("\tmode: %d\n", event->mode)); + TRACE(("\twindow: %#lx\n", event->window)); + TRACE(("\troot: %#lx\n", event->root)); + TRACE(("\tsubwindow: %#lx\n", event->subwindow)); + } + break; + } + while (w != 0) { + TRACE(("w %p -> %#lx\n", (void *) w, XtWindow(w))); + w = XtParent(w); + } +} + +void TraceSizeHints(XSizeHints * hints) { TRACE(("size hints:\n")); @@ -520,9 +577,9 @@ TraceTranslations(const char *name, Widget w) TRACE(("... xlations %#08lx\n", (long) xlations)); TRACE(("... xcelerat %#08lx\n", (long) xcelerat)); result = _XtPrintXlations(w, xlations, xcelerat, True); - TRACE(("%s\n", result != 0 ? result : "(null)")); + TRACE(("%s\n", NonNull(result))); if (result) - XFree(result); + XFree((char *) result); } else { TRACE(("none (widget is null)\n")); } @@ -612,7 +669,7 @@ TraceArgv(const char *tag, char **argv) } static char * -parse_option(char *dst, char *src, int first) +parse_option(char *dst, String src, int first) { char *s; @@ -641,7 +698,7 @@ same_option(OptionHelp * opt, XrmOptionDescRec * res) } static Bool -standard_option(char *opt) +standard_option(String opt) { static const char *table[] = { diff --git a/app/xterm/trace.h b/app/xterm/trace.h index 9907bd36b..40ffdd520 100644 --- a/app/xterm/trace.h +++ b/app/xterm/trace.h @@ -1,29 +1,36 @@ -/* $XTermId: trace.h,v 1.48 2009/10/12 00:08:18 tom Exp $ */ +/* $XTermId: trace.h,v 1.51 2009/11/27 18:31:16 tom Exp $ */ -/************************************************************ - -Copyright 1997-2008,2009 by Thomas E. Dickey - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of the above listed -copyright holder(s) not be used in advertising or publicity pertaining -to distribution of the software without specific, written prior -permission. - -THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD -TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE -LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -********************************************************/ +/* + * + * Copyright 1997-2008,2009 by Thomas E. Dickey + * + * All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization. + * + */ /* * Common/useful definitions for XTERM application @@ -50,10 +57,11 @@ extern void Trace ( const char *, ... ) extern char * visibleChars (Char * /* buf */, unsigned /* len */); extern char * visibleIChar (IChar *, unsigned); extern char * visibleIChars (IChar * /* buf */, unsigned /* len */); +extern const char * visibleChrsetName(unsigned /* chrset */); extern const char * visibleEventType (int); +extern const char * visibleNotifyDetail(int /* code */); extern const char * visibleSelectionTarget(Display * /* d */, Atom /* a */); extern const char * visibleXError (int /* code */); -extern const char * visibleChrsetName(unsigned /* chrset */); extern void TraceArgv(const char * /* tag */, char ** /* argv */); #undef TRACE_ARGV @@ -63,6 +71,10 @@ extern const char *trace_who; #undef TRACE_CHILD #define TRACE_CHILD int tracing_child = (trace_who = "child") != 0; (void) tracing_child; +extern void TraceFocus(Widget, XEvent *); +#undef TRACE_FOCUS +#define TRACE_FOCUS(w,e) TraceFocus((Widget)w, (XEvent *)e) + extern void TraceSizeHints(XSizeHints *); #undef TRACE_HINTS #define TRACE_HINTS(hints) TraceSizeHints(hints) diff --git a/app/xterm/util.c b/app/xterm/util.c index af57be569..2a05264f4 100644 --- a/app/xterm/util.c +++ b/app/xterm/util.c @@ -1,7 +1,7 @@ -/* $XTermId: util.c,v 1.504 2009/10/11 20:23:19 tom Exp $ */ +/* $XTermId: util.c,v 1.523 2010/01/03 23:56:24 tom Exp $ */ /* - * Copyright 1999-2008,2009 by Thomas E. Dickey + * Copyright 1999-2009,2010 by Thomas E. Dickey * * All Rights Reserved * @@ -104,33 +104,53 @@ int DamagedCells(TScreen * screen, unsigned n, int *klp, int *krp, int row, int col) { LineData *ld = getLineData(screen, row); - int kl = col; - int kr = col + (int) n; + int result = False; - if (ld->charData[kl] == HIDDEN_CHAR) { - while (kl > 0) { - if (ld->charData[--kl] != HIDDEN_CHAR) { - break; - } + assert(ld); + if (col < (int) ld->lineSize) { + int nn = (int) n; + int kl = col; + int kr = col + nn; + + if (kr >= ld->lineSize) { + nn = (ld->lineSize - col - 1); + kr = col + nn; } - } else { - kl = col + 1; - } - if (ld->charData[kr] == HIDDEN_CHAR) { - while (kr < screen->max_col) { - if (ld->charData[++kr] != HIDDEN_CHAR) { - --kr; - break; + + if (nn > 0) { + assert(kl < ld->lineSize); + if (ld->charData[kl] == HIDDEN_CHAR) { + while (kl > 0) { + if (ld->charData[--kl] != HIDDEN_CHAR) { + break; + } + } + } else { + kl = col + 1; } + + assert(kr < (int) ld->lineSize); + if (ld->charData[kr] == HIDDEN_CHAR) { + while (kr < screen->max_col) { + assert((kr + 1) < (int) ld->lineSize); + if (ld->charData[++kr] != HIDDEN_CHAR) { + --kr; + break; + } + } + } else { + kr = col - 1; + } + + if (klp) + *klp = kl; + if (krp) + *krp = kr; + result = (kr >= kl); } - } else { - kr = col - 1; } - if (klp) - *klp = kl; - if (krp) - *krp = kr; - return (kr >= kl); + + return result; } int @@ -146,7 +166,7 @@ DamagedCurCells(TScreen * screen, unsigned n, int *klp, int *krp) void FlushScroll(XtermWidget xw) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); int i; int shift = INX2ROW(screen, 0); int bot = screen->max_row - shift; @@ -232,7 +252,7 @@ FlushScroll(XtermWidget xw) int AddToRefresh(XtermWidget xw) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); int amount = screen->refresh_amt; int row = screen->cur_row; int result; @@ -278,7 +298,7 @@ AddToRefresh(XtermWidget xw) static Bool AddToVisible(XtermWidget xw) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); Bool result = False; if (INX2ROW(screen, screen->cur_row) <= screen->max_row) { @@ -297,7 +317,7 @@ AddToVisible(XtermWidget xw) static void adjustHiliteOnFwdScroll(XtermWidget xw, int amount, Bool all_lines) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); int lo_row = (all_lines ? (screen->bot_marg - screen->savelines) : screen->top_marg); @@ -357,7 +377,7 @@ adjustHiliteOnFwdScroll(XtermWidget xw, int amount, Bool all_lines) static void adjustHiliteOnBakScroll(XtermWidget xw, int amount) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); int lo_row = screen->top_marg; int hi_row = screen->bot_marg; @@ -416,7 +436,7 @@ adjustHiliteOnBakScroll(XtermWidget xw, int amount) void xtermScroll(XtermWidget xw, int amount) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); int i = screen->bot_marg - screen->top_marg + 1; int shift; int bot; @@ -552,7 +572,7 @@ xtermScroll(XtermWidget xw, int amount) void RevScroll(XtermWidget xw, int amount) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); int i = screen->bot_marg - screen->top_marg + 1; int shift; int bot; @@ -636,8 +656,9 @@ RevScroll(XtermWidget xw, int amount) void WriteText(XtermWidget xw, IChar * str, Cardinal len) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); LineData *ld = 0; + int fg; unsigned test; unsigned flags = xw->flags; CellColor fg_bg = makeColorPair(xw->cur_foreground, xw->cur_background); @@ -691,7 +712,12 @@ WriteText(XtermWidget xw, IChar * str, Cardinal len) screen->cur_row)); test = flags; - checkVeryBoldColors(test, xw->cur_foreground); + if (screen->colorAttrMode) { + fg = MapToColorMode(xw->cur_foreground, screen, flags); + } else { + fg = xw->cur_foreground; + } + checkVeryBoldColors(test, fg); /* make sure that the correct GC is current */ currentGC = updatedXtermGC(xw, flags, fg_bg, False); @@ -724,7 +750,7 @@ WriteText(XtermWidget xw, IChar * str, Cardinal len) screen->zIconBeep_flagged = True; ChangeIconName(xw, icon_name); } - xtermBell(xw, resource.zIconBeep, XkbBI_Info); + xtermBell(xw, XkbBI_Info, 0); } mapstate = -1; #endif /* OPT_ZICONBEEP */ @@ -739,7 +765,7 @@ WriteText(XtermWidget xw, IChar * str, Cardinal len) void InsertLine(XtermWidget xw, int n) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); int i; int shift; int bot; @@ -817,7 +843,7 @@ InsertLine(XtermWidget xw, int n) void DeleteLine(XtermWidget xw, int n) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); int i; int shift; int bot; @@ -929,7 +955,7 @@ DeleteLine(XtermWidget xw, int n) void InsertChar(XtermWidget xw, unsigned n) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); LineData *ld; unsigned limit; int row = INX2ROW(screen, screen->cur_row); @@ -1007,7 +1033,7 @@ InsertChar(XtermWidget xw, unsigned n) void DeleteChar(XtermWidget xw, unsigned n) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); LineData *ld; unsigned limit; int row = INX2ROW(screen, screen->cur_row); @@ -1073,7 +1099,7 @@ DeleteChar(XtermWidget xw, unsigned n) static void ClearAbove(XtermWidget xw) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); if (screen->protected_mode != OFF_PROTECT) { int row; @@ -1112,7 +1138,7 @@ ClearAbove(XtermWidget xw) static void ClearBelow(XtermWidget xw) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); ClearRight(xw, -1); @@ -1149,7 +1175,7 @@ ClearBelow(XtermWidget xw) static int ClearInLine2(XtermWidget xw, int flags, int row, int col, unsigned len) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); LineData *ld; int rc = 1; @@ -1204,8 +1230,9 @@ ClearInLine2(XtermWidget xw, int flags, int row, int col, unsigned len) } while (!done); screen->protected_mode = saved_mode; - if (len <= 0) + if (len <= 0) { return 0; + } } /* fall through to the final non-protected segment */ @@ -1233,7 +1260,7 @@ ClearInLine2(XtermWidget xw, int flags, int row, int col, unsigned len) int ClearInLine(XtermWidget xw, int row, int col, unsigned len) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); int flags = 0; /* @@ -1255,7 +1282,7 @@ ClearInLine(XtermWidget xw, int row, int col, unsigned len) void ClearRight(XtermWidget xw, int n) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); LineData *ld; unsigned len = (unsigned) (MaxCols(screen) - screen->cur_col); @@ -1305,10 +1332,10 @@ ClearRight(XtermWidget xw, int n) static void ClearLeft(XtermWidget xw) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); unsigned len = (unsigned) screen->cur_col + 1; - assert(screen->cur_col >= 0); + assert(screen->cur_col >= 0); if (AddToVisible(xw)) { if_OPT_WIDE_CHARS(screen, { int row = screen->cur_row; @@ -1330,7 +1357,7 @@ ClearLeft(XtermWidget xw) static void ClearLine(XtermWidget xw) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); unsigned len = (unsigned) MaxCols(screen); assert(screen->max_col >= 0); @@ -1340,7 +1367,7 @@ ClearLine(XtermWidget xw) void ClearScreen(XtermWidget xw) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); int top; if (screen->cursor_state) @@ -1369,7 +1396,7 @@ ClearScreen(XtermWidget xw) void do_erase_line(XtermWidget xw, int param, int mode) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); int saved_mode = screen->protected_mode; if (saved_mode == DEC_PROTECT @@ -1401,7 +1428,7 @@ do_erase_line(XtermWidget xw, int param, int mode) void do_erase_display(XtermWidget xw, int param, int mode) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); int saved_mode = screen->protected_mode; if (saved_mode == DEC_PROTECT @@ -1464,7 +1491,7 @@ do_erase_display(XtermWidget xw, int param, int mode) static void CopyWait(XtermWidget xw) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); XEvent reply; XEvent *rep = &reply; @@ -1512,7 +1539,7 @@ copy_area(XtermWidget xw, int dest_x, int dest_y) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); if (width != 0 && height != 0) { /* wait for previous CopyArea to complete unless @@ -1545,7 +1572,7 @@ horizontal_copy_area(XtermWidget xw, int nchars, int amount) /* number of characters to move right */ { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); LineData *ld; if ((ld = getLineData(screen, screen->cur_row)) != 0) { @@ -1568,7 +1595,7 @@ vertical_copy_area(XtermWidget xw, int nlines, int amount) /* number of lines to move up (neg=down) */ { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); if (nlines > 0) { int src_x = OriginX(screen); @@ -1603,7 +1630,7 @@ scrolling_copy_area(XtermWidget xw, int HandleExposure(XtermWidget xw, XEvent * event) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); XExposeEvent *reply = (XExposeEvent *) event; #ifndef NO_ACTIVE_ICON @@ -1659,7 +1686,7 @@ HandleExposure(XtermWidget xw, XEvent * event) static void set_background(XtermWidget xw, int color GCC_UNUSED) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); Pixel c = getXtermBackground(xw, xw->flags, color); TRACE(("set_background(%d) %#lx\n", color, c)); @@ -1679,7 +1706,7 @@ handle_translated_exposure(XtermWidget xw, int rect_width, int rect_height) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); int toprow, leftcol, nrows, ncols; int x0, x1; int y0, y1; @@ -1745,7 +1772,7 @@ handle_translated_exposure(XtermWidget xw, void GetColors(XtermWidget xw, ScrnColors * pColors) { - TScreen *screen = &xw->screen; + TScreen *screen = TScreenOf(xw); int n; pColors->which = 0; @@ -1758,7 +1785,7 @@ void ChangeColors(XtermWidget xw, ScrnColors * pNew) { Bool repaint = False; - TScreen *screen = &xw->screen; + TScreen *screen = TScreenOf(xw); VTwin *win = WhichVWin(screen); TRACE(("ChangeColors\n")); @@ -1833,7 +1860,7 @@ ChangeColors(XtermWidget xw, ScrnColors * pNew) } #if OPT_TEK4014 if (TEK4014_SHOWN(xw)) { - TekScreen *tekscr = &(tekWidget->screen); + TekScreen *tekscr = TekScreenOf(tekWidget); Window tekwin = TWindow(tekscr); if (tekwin) { recolor_cursor(screen, @@ -1870,7 +1897,7 @@ ChangeColors(XtermWidget xw, ScrnColors * pNew) void xtermClear(XtermWidget xw) { - TScreen *screen = &xw->screen; + TScreen *screen = TScreenOf(xw); TRACE(("xtermClear\n")); XClearWindow(screen->display, VWindow(screen)); @@ -1879,7 +1906,7 @@ xtermClear(XtermWidget xw) void xtermRepaint(XtermWidget xw) { - TScreen *screen = &xw->screen; + TScreen *screen = TScreenOf(xw); TRACE(("xtermRepaint\n")); xtermClear(xw); @@ -2008,7 +2035,7 @@ swapVTwinGCs(XtermWidget xw, VTwin * win) void ReverseVideo(XtermWidget xw) { - TScreen *screen = &xw->screen; + TScreen *screen = TScreenOf(xw); ToSwap listToSwap[5]; int numToSwap = 0; @@ -2051,7 +2078,7 @@ ReverseVideo(XtermWidget xw) } #if OPT_TEK4014 if (TEK4014_SHOWN(xw)) { - TekScreen *tekscr = &(tekWidget->screen); + TekScreen *tekscr = TekScreenOf(tekWidget); Window tekwin = TWindow(tekscr); recolor_cursor(screen, tekscr->arrow, @@ -2131,7 +2158,7 @@ getXftColor(XtermWidget xw, Pixel pixel) } i = oldest; color.pixel = pixel; - XQueryColor(xw->screen.display, xw->core.colormap, &color); + XQueryColor(TScreenOf(xw)->display, xw->core.colormap, &color); cache[i].color.color.red = color.red; cache[i].color.color.green = color.green; cache[i].color.color.blue = color.blue; @@ -2154,7 +2181,7 @@ getXftColor(XtermWidget xw, Pixel pixel) ? 0 \ : (((ch) < 256) \ ? (((ch) >= 128 && (ch) < 160) \ - ? ((xw)->screen.c1_printable ? 1 : 0) \ + ? (TScreenOf(xw)->c1_printable ? 1 : 0) \ : 1) \ : my_wcwidth(ch))) #else @@ -2191,7 +2218,7 @@ xtermXftDrawString(XtermWidget xw, Cardinal len, Bool really) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); int ncells = 0; if (len != 0) { @@ -2208,12 +2235,14 @@ xtermXftDrawString(XtermWidget xw, #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)) + && !screen->colorBDMode && XFT_FONT(renderWideBold[fontnum])) { wfont = XFT_FONT(renderWideBold[fontnum]); } else { @@ -2342,7 +2371,7 @@ ucs_workaround(XtermWidget xw, int chrset, int on_wide) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); int fixed = False; if (screen->wide_chars && screen->utf8_mode && ch > 256) { @@ -2391,7 +2420,7 @@ xtermFillCells(XtermWidget xw, int y, Cardinal len) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); VTwin *currentWin = WhichVWin(screen); if (!(flags & NOBACKGROUND)) { @@ -2478,7 +2507,7 @@ xtermSetClipRectangles(Display * dpy, int order) { #if 0 - TScreen *screen = &(term->screen); + TScreen *screen = TScreenOf(term); Drawable draw = VWindow(screen); XSetClipMask(dpy, gc, None); @@ -2563,7 +2592,7 @@ drawClippedXftString(XtermWidget xw, font, x, y, text, len); - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); beginXftClipping(screen, x, y, ncells); xtermXftDrawString(xw, flags, @@ -2601,7 +2630,7 @@ drawXtermText(XtermWidget xw, Cardinal len, int on_wide) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); Cardinal real_length = len; Cardinal underline_len = 0; /* Intended width of the font to draw (as opposed to the actual width of @@ -2745,6 +2774,7 @@ drawXtermText(XtermWidget xw, } #if OPT_ISO_COLORS if ((flags & UNDERLINE) + && !screen->colorULMode && screen->italicULMode && XFT_FONT(renderFontItal[fontnum])) { font = XFT_FONT(renderFontItal[fontnum]); @@ -2752,6 +2782,9 @@ drawXtermText(XtermWidget xw, } else #endif if ((flags & BOLDATTR(screen)) +#if OPT_ISO_COLORS + && !screen->colorBDMode +#endif && XFT_FONT(renderFontBold[fontnum])) { font = XFT_FONT(renderFontBold[fontnum]); } else { @@ -3019,7 +3052,7 @@ drawXtermText(XtermWidget xw, if (!isMissing && ch > 255 && ucs2dec(ch) < 32 - && xw->screen.force_box_chars) { + && TScreenOf(xw)->force_box_chars) { ch = ucs2dec(ch); isMissing = True; } @@ -3288,7 +3321,7 @@ allocXtermChars(ScrnPtr * buffer, Cardinal length) void xtermSizeHints(XtermWidget xw, int scrollbarWidth) { - TScreen *screen = &xw->screen; + TScreen *screen = TScreenOf(xw); TRACE(("xtermSizeHints\n")); TRACE((" border %d\n", xw->core.border_width)); @@ -3321,7 +3354,7 @@ xtermSizeHints(XtermWidget xw, int scrollbarWidth) void getXtermSizeHints(XtermWidget xw) { - TScreen *screen = &xw->screen; + TScreen *screen = TScreenOf(xw); long supp; if (!XGetWMNormalHints(screen->display, XtWindow(SHELL_OF(xw)), @@ -3338,7 +3371,7 @@ getXtermSizeHints(XtermWidget xw) GC updatedXtermGC(XtermWidget xw, unsigned flags, CellColor fg_bg, Bool hilite) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); VTwin *win = WhichVWin(screen); CgsEnum cgsId = gcMAX; unsigned my_fg = extract_fg(xw, fg_bg, flags); @@ -3360,6 +3393,9 @@ updatedXtermGC(XtermWidget xw, unsigned flags, CellColor fg_bg, Bool hilite) (void) my_bg; (void) my_fg; + /* + * Discard video attributes overridden by colorXXXMode's. + */ checkVeryBoldColors(flags, my_fg); if (ReverseOrHilite(screen, flags, hilite)) { @@ -3434,7 +3470,7 @@ updatedXtermGC(XtermWidget xw, unsigned flags, CellColor fg_bg, Bool hilite) void resetXtermGC(XtermWidget xw, unsigned flags, Bool hilite) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); VTwin *win = WhichVWin(screen); CgsEnum cgsId = gcMAX; Pixel fg_pix = getXtermForeground(xw, flags, xw->cur_foreground); @@ -3474,14 +3510,9 @@ extract_fg(XtermWidget xw, CellColor color, unsigned flags) { unsigned fg = ExtractForeground(color); - if (xw->screen.colorAttrMode + if (TScreenOf(xw)->colorAttrMode || (fg == ExtractBackground(color))) { - if (xw->screen.colorULMode && (flags & UNDERLINE)) - fg = COLOR_UL; - if (xw->screen.colorBDMode && (flags & BOLD)) - fg = COLOR_BD; - if (xw->screen.colorBLMode && (flags & BLINK)) - fg = COLOR_BL; + fg = MapToColorMode(fg, TScreenOf(xw), flags); } return fg; } @@ -3495,9 +3526,9 @@ extract_bg(XtermWidget xw, CellColor color, unsigned flags) { unsigned bg = ExtractBackground(color); - if (xw->screen.colorAttrMode + if (TScreenOf(xw)->colorAttrMode || (bg == ExtractForeground(color))) { - if (xw->screen.colorRVMode && (flags & INVERSE)) + if (TScreenOf(xw)->colorRVMode && (flags & INVERSE)) bg = COLOR_RV; } return bg; @@ -3531,7 +3562,7 @@ ClearCurBackground(XtermWidget xw, unsigned height, unsigned width) { - TScreen *screen = &(xw->screen); + TScreen *screen = TScreenOf(xw); TRACE(("ClearCurBackground(%d,%d,%d,%d) %d\n", top, left, height, width, xw->cur_background)); @@ -3555,7 +3586,10 @@ getXtermCell(TScreen * screen, int row, int col) { LineData *ld = getLineData(screen, row); - return ld->charData[col]; + assert(ld && (col < (int) ld->lineSize)); + return ((ld && (col < (int) ld->lineSize)) + ? ld->charData[col] + : (unsigned) ' '); } /* @@ -3566,13 +3600,16 @@ putXtermCell(TScreen * screen, int row, int col, int ch) { LineData *ld = getLineData(screen, row); - ld->charData[col] = (CharData) ch; - if_OPT_WIDE_CHARS(screen, { - size_t off; - for_each_combData(off, ld) { - ld->combData[off][col] = 0; - } - }); + assert(ld && (col < (int) ld->lineSize)); + if (ld && (col < (int) ld->lineSize)) { + ld->charData[col] = (CharData) ch; + if_OPT_WIDE_CHARS(screen, { + size_t off; + for_each_combData(off, ld) { + ld->combData[off][col] = 0; + } + }); + } } #if OPT_WIDE_CHARS diff --git a/app/xterm/uxterm b/app/xterm/uxterm index 1e0ea97c8..94b085aab 100644 --- a/app/xterm/uxterm +++ b/app/xterm/uxterm @@ -1,5 +1,36 @@ #!/bin/sh -# $XTermId: uxterm,v 1.25 2007/12/30 16:33:36 tom Exp $ +# $XTermId: uxterm,v 1.26 2007/12/30 16:33:36 tom Exp $ +# ----------------------------------------------------------------------------- +# this file is part of xterm +# +# Copyright 2001-2006,2007 by Thomas E. Dickey +# +# All Rights Reserved +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name(s) of the above copyright +# holders shall not be used in advertising or otherwise to promote the +# sale, use or other dealings in this Software without prior written +# authorization. +# ----------------------------------------------------------------------------- # # wrapper script to setup xterm with UTF-8 locale diff --git a/app/xterm/uxterm.desktop b/app/xterm/uxterm.desktop index 0a46d690c..ddb1f1b92 100644 --- a/app/xterm/uxterm.desktop +++ b/app/xterm/uxterm.desktop @@ -1,4 +1,35 @@ -# $XTermId: uxterm.desktop,v 1.5 2007/06/17 00:54:49 tom Exp $ +# $XTermId: uxterm.desktop,v 1.7 2007/12/30 15:09:12 tom Exp $ +# ----------------------------------------------------------------------------- +# this file is part of xterm +# +# Copyright 2006,2007 by Thomas E. Dickey +# +# All Rights Reserved +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name(s) of the above copyright +# holders shall not be used in advertising or otherwise to promote the +# sale, use or other dealings in this Software without prior written +# authorization. +# ----------------------------------------------------------------------------- [Desktop Entry] Name=UXTerm Comment=standard terminal emulator for the X window system @@ -6,5 +37,5 @@ Exec=uxterm Terminal=false Type=Application Encoding=UTF-8 -Icon=xterm-color_48x48.xpm +Icon=xterm-color_48x48 Categories=System; diff --git a/app/xterm/version.h b/app/xterm/version.h index 9f8fd1ec3..61ec78cdf 100644 --- a/app/xterm/version.h +++ b/app/xterm/version.h @@ -1,4 +1,37 @@ -/* $XTermId: version.h,v 1.306 2009/10/10 13:03:04 tom Exp $ */ +/* + * $XTermId: version.h,v 1.313 2010/01/20 01:39:08 tom Exp $ + * ---------------------------------------------------------------------------- + * this file is part of xterm + * + * Copyright 1998-2009,2010 by Thomas E. Dickey + * + * All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization. + * ---------------------------------------------------------------------------- + */ /* * These definitions are used to build the string that's printed in response to @@ -6,7 +39,7 @@ * version of X to which this version of xterm has been built. The number in * parentheses is my patch number (Thomas E. Dickey). */ -#define XTERM_PATCH 250 +#define XTERM_PATCH 255 #ifndef __vendorversion__ #define __vendorversion__ "XTerm/OpenBSD" diff --git a/app/xterm/vms.c b/app/xterm/vms.c index 155cdb41b..4c4631b81 100644 --- a/app/xterm/vms.c +++ b/app/xterm/vms.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/xterm/vms.c,v 1.2 2003/10/27 01:07:58 dickey Exp $ */ +/* $XTermId: vms.c,v 1.11 2009/11/28 14:58:09 tom Exp $ */ /* vms.c * @@ -77,14 +77,14 @@ struct mem_region TT_BUF_STRUCT *end; } ret_addr; -int read_stopped = FALSE; -int write_stopped = FALSE; +int read_stopped = False; +int write_stopped = False; int tt_width; int tt_length; int tt_changed; -int tt_pasting=FALSE; /* drm */ -int tt_new_output=FALSE; /* Cleared by flushlog(), set whenever something new +int tt_pasting=False; /* drm */ +int tt_new_output=False; /* Cleared by flushlog(), set whenever something new goes to the screen through tt_write */ int trnlnm(char *in,int id,char *out); @@ -148,7 +148,7 @@ void spawn (void) int status; static $DESCRIPTOR (dtime, "0 00:00:00.01"); static int delta[2]; - register TScreen *screen = &term->screen; + register TScreen *screen = TScreenOf(term); static struct IOSB iosb; static unsigned int flags; static unsigned int uic; @@ -483,7 +483,7 @@ void tt_start_read(void) } else { - read_stopped = TRUE; + read_stopped = True; } return; } @@ -511,7 +511,7 @@ int tt_read(char *buffer) len = read_buff->length; memmove(buffer,&read_buff->data,len); freeBuff(read_buff); - tt_new_output=TRUE; /* DRM something will be written */ + tt_new_output=True; /* DRM something will be written */ } else CloseDown(status); @@ -526,7 +526,7 @@ int tt_read(char *buffer) static void send_xon(void) { - write_stopped = FALSE; + write_stopped = False; } @@ -535,7 +535,7 @@ static void send_xon(void) */ static void send_xoff(void) { - write_stopped = TRUE; + write_stopped = True; } @@ -567,18 +567,18 @@ static void char_change(void) * Dont do anything if in Tek mode */ - if(!(term->screen.TekEmu)) + if(!(TScreenOf(term)->TekEmu)) { status = sys$qiow(0,tt_chan,IO$_SENSEMODE,0,0,0,&tt_mode,8,0,0,0,0); if(!(status & SS$_NORMAL)) CloseDown(status); - if((term->screen.max_row != tt_mode.length) || - (term->screen.max_col != tt_mode.page_width)) + if((TScreenOf(term)->max_row != tt_mode.length) || + (TScreenOf(term)->max_col != tt_mode.page_width)) { tt_length = tt_mode.length; tt_width = tt_mode.page_width; - tt_changed = TRUE; + tt_changed = True; } } @@ -606,7 +606,7 @@ static void freeBuff (TT_BUF_STRUCT *buff_addr) &buff_addr->status, VMS_TERM_BUFFER_SIZE); if (status & SS$_NORMAL) { - read_stopped = FALSE; + read_stopped = False; } else { diff --git a/app/xterm/vttests/256colors.pl b/app/xterm/vttests/256colors.pl index b053b94fc..57976f7cf 100644 --- a/app/xterm/vttests/256colors.pl +++ b/app/xterm/vttests/256colors.pl @@ -1,12 +1,46 @@ #!/usr/bin/perl -# $XFree86: xc/programs/xterm/vttests/256colors.pl,v 1.1 1999/07/11 08:49:54 dawes Exp $ +# $XTermId: 256colors.pl,v 1.4 2006/09/29 21:49:03 tom Exp $ +# ----------------------------------------------------------------------------- +# this file is part of xterm +# +# Copyright 1999,2006 by Thomas E. Dickey +# +# All Rights Reserved +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name(s) of the above copyright +# holders shall not be used in advertising or otherwise to promote the +# sale, use or other dealings in this Software without prior written +# authorization. +# ----------------------------------------------------------------------------- +# +# This uses 33 print-lines on an 80-column display. Printing the numbers in +# hexadecimal would make it compact enough for 24x80, but less readable. for ($bg = 0; $bg < 256; $bg++) { - print "\x1b[9;1H\x1b[2J"; + # print "\x1b[9;1H\x1b[2J"; for ($fg = 0; $fg < 256; $fg++) { print "\x1b[48;5;${bg}m\x1b[38;5;${fg}m"; printf "%03.3d/%03.3d ", $fg, $bg; } - sleep 1; print "\n"; + sleep 1; } diff --git a/app/xterm/vttests/256colors2.pl b/app/xterm/vttests/256colors2.pl index 0aecc551d..2a880bdc8 100644 --- a/app/xterm/vttests/256colors2.pl +++ b/app/xterm/vttests/256colors2.pl @@ -1,7 +1,38 @@ #!/usr/bin/perl -# $XTermId: 256colors2.pl,v 1.9 2009/10/10 14:45:26 tom Exp $ -# Authors: Todd Larason <jtl@molehill.org> -# Thomas E Dickey +# $XTermId: 256colors2.pl,v 1.10 2009/10/10 14:45:26 tom Exp $ +# ----------------------------------------------------------------------------- +# this file is part of xterm +# +# Copyright 1999-2007,2009 by Thomas E. Dickey +# Copyright 2002 by Steve Wall +# Copyright 1999 by Todd Larason +# +# All Rights Reserved +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name(s) of the above copyright +# holders shall not be used in advertising or otherwise to promote the +# sale, use or other dealings in this Software without prior written +# authorization. +# ----------------------------------------------------------------------------- # # use the resources for colors 0-15 - usually more-or-less a # reproduction of the standard ANSI colors, but possibly more diff --git a/app/xterm/vttests/88colors.pl b/app/xterm/vttests/88colors.pl index a645fc3d4..3db178c3f 100644 --- a/app/xterm/vttests/88colors.pl +++ b/app/xterm/vttests/88colors.pl @@ -1,5 +1,36 @@ #!/usr/bin/perl -# $XFree86: xc/programs/xterm/vttests/88colors.pl,v 1.1 1999/09/25 14:38:51 dawes Exp $ +# $XTermId: 88colors.pl,v 1.3 1999/09/27 20:12:18 tom Exp $ +# ----------------------------------------------------------------------------- +# this file is part of xterm +# +# Copyright 1999 by Thomas E. Dickey +# +# All Rights Reserved +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name(s) of the above copyright +# holders shall not be used in advertising or otherwise to promote the +# sale, use or other dealings in this Software without prior written +# authorization. +# ----------------------------------------------------------------------------- # Made from 256colors.pl for ($bg = 0; $bg < 88; $bg++) { diff --git a/app/xterm/vttests/88colors2.pl b/app/xterm/vttests/88colors2.pl index 63d3f3a87..9c63b8cac 100644 --- a/app/xterm/vttests/88colors2.pl +++ b/app/xterm/vttests/88colors2.pl @@ -1,7 +1,37 @@ #!/usr/bin/perl -# $XTermId: 88colors2.pl,v 1.6 2009/10/10 14:57:12 tom Exp $ -# Authors: Steve Wall <swall@redcom.com> -# Thomas E Dickey +# $XTermId: 88colors2.pl,v 1.7 2009/10/10 14:57:12 tom Exp $ +# ----------------------------------------------------------------------------- +# this file is part of xterm +# +# Copyright 1999-2007,2009 by Thomas E. Dickey +# Copyright 1999 by Steve Wall +# +# All Rights Reserved +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name(s) of the above copyright +# holders shall not be used in advertising or otherwise to promote the +# sale, use or other dealings in this Software without prior written +# authorization. +# ----------------------------------------------------------------------------- # # Adapted from 256colors2.pl diff --git a/app/xterm/vttests/paste64.pl b/app/xterm/vttests/paste64.pl index 301c31b17..619a2225c 100644 --- a/app/xterm/vttests/paste64.pl +++ b/app/xterm/vttests/paste64.pl @@ -1,8 +1,36 @@ #!/usr/bin/perl -w -# $XTermId: paste64.pl,v 1.9 2006/03/13 01:28:02 tom Exp $ -# $XFree86: xc/programs/xterm/vttests/paste64.pl,v 1.1 2006/03/13 01:28:02 dickey Exp $ +# $XTermId: paste64.pl,v 1.10 2006/03/13 01:28:02 tom Exp $ +# ----------------------------------------------------------------------------- +# this file is part of xterm # -# -- Thomas Dickey (2006/3/7) +# Copyright 2006 by Thomas E. Dickey +# +# All Rights Reserved +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name(s) of the above copyright +# holders shall not be used in advertising or otherwise to promote the +# sale, use or other dealings in this Software without prior written +# authorization. +# ----------------------------------------------------------------------------- # Test the paste64 option of xterm. use strict; diff --git a/app/xterm/vttests/resize.pl b/app/xterm/vttests/resize.pl index 21a18beea..29d0d9b8e 100644 --- a/app/xterm/vttests/resize.pl +++ b/app/xterm/vttests/resize.pl @@ -1,7 +1,36 @@ #!/usr/bin/perl -# $XFree86: xc/programs/xterm/vttests/resize.pl,v 1.1 2004/03/04 02:21:58 dickey Exp $ +# $XTermId: resize.pl,v 1.3 2004/03/04 02:21:58 tom Exp $ +# ----------------------------------------------------------------------------- +# this file is part of xterm # -# -- Thomas Dickey (2004/3/3) +# Copyright 2004 by Thomas E. Dickey +# +# All Rights Reserved +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name(s) of the above copyright +# holders shall not be used in advertising or otherwise to promote the +# sale, use or other dealings in this Software without prior written +# authorization. +# ----------------------------------------------------------------------------- # resize.sh rewritten into Perl for comparison. # See also Term::ReadKey. diff --git a/app/xterm/vttests/tcapquery.pl b/app/xterm/vttests/tcapquery.pl index 54de5d08d..068cb2219 100644 --- a/app/xterm/vttests/tcapquery.pl +++ b/app/xterm/vttests/tcapquery.pl @@ -1,7 +1,36 @@ #!/usr/bin/perl -w -# $XTermId: tcapquery.pl,v 1.13 2008/10/05 16:20:14 tom Exp $ +# $XTermId: tcapquery.pl,v 1.18 2010/01/04 09:43:46 tom Exp $ +# ----------------------------------------------------------------------------- +# this file is part of xterm # -# -- Thomas Dickey (2004/3/3) +# Copyright 2004-2008,2010 by Thomas E. Dickey +# +# All Rights Reserved +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name(s) of the above copyright +# holders shall not be used in advertising or otherwise to promote the +# sale, use or other dealings in this Software without prior written +# authorization. +# ----------------------------------------------------------------------------- # Test the tcap-query option of xterm. use strict; @@ -9,18 +38,20 @@ use strict; use Getopt::Std; use IO::Handle; -our ($opt_a, $opt_b, $opt_c, $opt_e, $opt_f, $opt_i, $opt_k, $opt_m, $opt_x); -&getopts('abcefikmx:') || die("Usage: $0 [options]\n +our ($opt_a, $opt_b, $opt_c, $opt_e, $opt_f, $opt_i, $opt_k, $opt_m, $opt_t, $opt_x, $opt_X); +&getopts('abcefikmt:x:X') || die("Usage: $0 [options]\n Options:\n - -a (same as -c -e -f -k -m) - -b use both terminfo and termcap (default is termcap) - -c cursor-keys - -e editing keypad-keys - -f function-keys - -i use terminfo rather than termcap names - -k numeric keypad-keys - -m miscellaneous (none of -c, -e, -f, -k) - -x KEY extended cursor/editing key (terminfo only) + -a (same as -c -e -f -k -m) + -b use both terminfo and termcap (default is termcap) + -c cursor-keys + -e editing keypad-keys + -f function-keys + -i use terminfo rather than termcap names + -k numeric keypad-keys + -m miscellaneous (none of -c, -e, -f, -k) + -t NAME use given NAME for \$TERM, set that in xterm's tcap keyboard + -x KEY extended cursor/editing key (terminfo only) + -X test all extended cursor- and/or editing-keys (terminfo) "); if ( not ( defined($opt_c) @@ -32,6 +63,17 @@ if ( not ( defined($opt_c) $opt_a=1; } +sub no_reply($) { + open TTY, "+</dev/tty" or die("Cannot open /dev/tty\n"); + autoflush TTY 1; + my $old=`stty -g`; + system "stty raw -echo min 0 time 5"; + + print TTY @_; + close TTY; + system "stty $old"; +} + sub get_reply($) { open TTY, "+</dev/tty" or die("Cannot open /dev/tty\n"); autoflush TTY 1; @@ -59,6 +101,12 @@ sub hexified($) { return $result; } +sub modify_tcap($) { + my $name = $_[0]; + my $param = hexified($name); + no_reply("\x1bP+p" . $param . "\x1b\\"); +} + sub query_tcap($$) { my $tcap = $_[0]; my $tinfo = $_[1]; @@ -114,6 +162,7 @@ sub query_tcap($$) { } } +# extended-keys are a feature of ncurses 5.0 and later sub query_extended($) { my $name = $_[0]; my $n; @@ -127,18 +176,23 @@ sub query_extended($) { } } +query_tcap( "TN", "name"); +if ( defined($opt_t) ) { + printf "Setting TERM=%s\n", $opt_t; + modify_tcap($opt_t); +} + # See xtermcapKeycode() if ( defined($opt_a) || defined($opt_c) ) { -query_tcap( "kl", "kcub1"); -query_tcap( "kd", "kcud1"); query_tcap( "ku", "kcuu1"); +query_tcap( "kd", "kcud1"); query_tcap( "kr", "kcuf1"); +query_tcap( "kl", "kcub1"); -query_tcap( "#4", "kLFT"); -query_tcap( "%c", "kNXT"); -query_tcap( "%e", "kPRV"); +query_tcap( "kF", "kind"); +query_tcap( "kR", "kri"); query_tcap( "%i", "kRIT"); - +query_tcap( "#4", "kLFT"); } if ( defined($opt_a) || defined($opt_e) ) { @@ -157,6 +211,9 @@ query_tcap( "*0", "kFND"); query_tcap( "kN", "knp"); query_tcap( "kP", "kpp"); + +query_tcap( "%c", "kNXT"); +query_tcap( "%e", "kPRV"); } if ( defined($opt_a) || defined($opt_f) ) { @@ -248,3 +305,20 @@ query_tcap( "Co", "colors"); if ( defined ($opt_x) ) { query_extended($opt_x); } + +if ( defined ($opt_X) ) { + if ( defined($opt_c) ) { + query_extended("DN"); + query_extended("UP"); + query_extended("LFT"); + query_extended("RIT"); + } + if ( defined($opt_e) ) { + query_extended("DC"); + query_extended("END"); + query_extended("HOM"); + query_extended("IC"); + query_extended("NXT"); + query_extended("PRV"); + } +} diff --git a/app/xterm/xstrings.c b/app/xterm/xstrings.c index de14ded35..fe035fd2a 100644 --- a/app/xterm/xstrings.c +++ b/app/xterm/xstrings.c @@ -1,4 +1,4 @@ -/* $XTermId: xstrings.c,v 1.30 2009/10/12 22:25:54 tom Exp $ */ +/* $XTermId: xstrings.c,v 1.36 2009/12/07 09:16:23 tom Exp $ */ /************************************************************ @@ -35,6 +35,7 @@ authorization. #include <xterm.h> #include <sys/types.h> +#include <stdio.h> #include <string.h> #include <ctype.h> @@ -53,18 +54,87 @@ x_basename(char *name) return (cp ? cp + 1 : name); } +/* + * Decode a hexadecimal string, returning the decoded string. + * On return, 'next' points to the first character not part of the input. + * The caller must free the result. + */ +char * +x_decode_hex(const char *source, const char **next) +{ + char *result = 0; + int pass; + size_t j, k; + + for (pass = 0; pass < 2; ++pass) { + for (j = k = 0; isxdigit(CharOf(source[j])); ++j) { + if ((pass != 0) && (j & 1) != 0) { + result[k++] = (char) ((x_hex2int(source[j - 1]) << 4) + | x_hex2int(source[j])); + } + } + *next = (source + j); + if ((j & 1) == 0) { + if (pass) { + result[k] = '\0'; + } else { + result = malloc(++j); + if (result == 0) + break; /* not enough memory */ + } + } else { + break; /* must have an even number of digits */ + } + } + return result; +} + +/* + * Encode a string into hexadecimal, returning the encoded string. + * The caller must free the result. + */ +char * +x_encode_hex(const char *source) +{ + size_t need = (strlen(source) * 2) + 1; + char *result = malloc(need); + + if (result != 0) { + unsigned j, k; + for (j = k = 0; source[j] != '\0'; ++j) { + sprintf(result + k, "%02X", CharOf(source[j])); + k += 2; + } + } + return result; +} + char * x_getenv(const char *name) { - return x_nonempty(getenv(name)); + return x_strdup(x_nonempty(getenv(name))); +} + +/* + * Decode a single hex "nibble", returning the nibble as 0-15, or -1 on error. + */ int +x_hex2int(int c) +{ + if (c >= '0' && c <= '9') + return c - '0'; + if (c >= 'a' && c <= 'f') + return c - 'a' + 10; + if (c >= 'A' && c <= 'F') + return c - 'A' + 10; + return -1; } /* * Check if the given string is nonnull/nonempty. If so, return a pointer * to the beginning of its content, otherwise return null. */ -char * -x_nonempty(char *s) +String +x_nonempty(String s) { if (s != 0) { if (*s == '\0') { @@ -78,16 +148,16 @@ x_nonempty(char *s) return s; } -char * -x_skip_blanks(char *s) +String +x_skip_blanks(String s) { while (isspace(CharOf(*s))) ++s; return s; } -char * -x_skip_nonblanks(char *s) +String +x_skip_nonblanks(String s) { while (*s != '\0' && !isspace(CharOf(*s))) ++s; @@ -161,16 +231,18 @@ x_strindex(char *s1, const char *s2) * Trims leading/trailing spaces from a copy of the string. */ char * -x_strtrim(char *s) +x_strtrim(const char *source) { - char *base = s; + char *result; + char *s; char *d; - if (s != 0 && *s != '\0') { - char *t = x_strdup(base); + if (source != 0 && *source != '\0') { + char *t = x_strdup(source); s = t; d = s; - s = x_skip_blanks(s); + while (isspace(CharOf(*s))) + ++s; while ((*d++ = *s++) != '\0') { ; } @@ -180,9 +252,11 @@ x_strtrim(char *s) *--s = '\0'; } } - base = t; + result = t; + } else { + result = x_strdup(""); } - return base; + return result; } /* diff --git a/app/xterm/xstrings.h b/app/xterm/xstrings.h index ebb7668ce..569f71012 100644 --- a/app/xterm/xstrings.h +++ b/app/xterm/xstrings.h @@ -1,4 +1,4 @@ -/* $XTermId: xstrings.h,v 1.15 2009/10/11 23:00:59 tom Exp $ */ +/* $XTermId: xstrings.h,v 1.19 2009/12/06 15:50:18 tom Exp $ */ /************************************************************ @@ -35,15 +35,20 @@ authorization. #ifndef included_xstrings_h #define included_xstrings_h 1 +#include <X11/Intrinsic.h> + +extern String x_nonempty(String /* s */); +extern String x_skip_blanks(String /* s */); +extern String x_skip_nonblanks(String /* s */); extern char *x_basename(char * /* name */); +extern char *x_decode_hex(const char * /* source */, const char ** /* next */); +extern char *x_encode_hex(const char * /* source */); extern char *x_getenv(const char * /* name */); -extern char *x_nonempty(char * /* s */); -extern char *x_skip_blanks(char * /* s */); -extern char *x_skip_nonblanks(char * /* s */); extern char *x_strdup(const char * /* s */); extern char *x_strindex(char * /* s1 */, const char * /* s2 */); -extern char *x_strtrim(char * /* s */); +extern char *x_strtrim(const char * /* s */); extern char x_toupper(int /* ch */); +extern int x_hex2int(int /* ch */); extern int x_strcasecmp(const char * /* s1 */, const char * /* s2 */); extern int x_strncasecmp(const char * /* s1 */, const char * /* s2 */, unsigned /* n */); diff --git a/app/xterm/xterm.desktop b/app/xterm/xterm.desktop index e2e05b3fc..a32fc8548 100644 --- a/app/xterm/xterm.desktop +++ b/app/xterm/xterm.desktop @@ -1,4 +1,35 @@ -# $XTermId: xterm.desktop,v 1.6 2007/06/17 00:55:01 tom Exp $ +# $XTermId: xterm.desktop,v 1.8 2007/12/30 15:09:12 tom Exp $ +# ----------------------------------------------------------------------------- +# this file is part of xterm +# +# Copyright 2006,2007 by Thomas E. Dickey +# +# All Rights Reserved +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name(s) of the above copyright +# holders shall not be used in advertising or otherwise to promote the +# sale, use or other dealings in this Software without prior written +# authorization. +# ----------------------------------------------------------------------------- [Desktop Entry] Name=XTerm Comment=standard terminal emulator for the X window system @@ -6,5 +37,5 @@ Exec=xterm Terminal=false Type=Application Encoding=UTF-8 -Icon=xterm-color_48x48.xpm +Icon=xterm-color_48x48 Categories=System; diff --git a/app/xterm/xterm.h b/app/xterm/xterm.h index bf66dbb75..4ae4d82d3 100644 --- a/app/xterm/xterm.h +++ b/app/xterm/xterm.h @@ -1,8 +1,8 @@ -/* $XTermId: xterm.h,v 1.589 2009/10/12 00:34:48 tom Exp $ */ +/* $XTermId: xterm.h,v 1.608 2010/01/20 01:36:37 tom Exp $ */ /************************************************************ -Copyright 1999-2008,2009 by Thomas E. Dickey +Copyright 1999-2009,2010 by Thomas E. Dickey All Rights Reserved @@ -342,6 +342,7 @@ extern char **environ; /***====================================================================***/ #define XtNallowC1Printable "allowC1Printable" +#define XtNallowColorOps "allowColorOps" #define XtNallowFontOps "allowFontOps" #define XtNallowSendEvents "allowSendEvents" #define XtNallowTcapOps "allowTcapOps" @@ -390,6 +391,10 @@ extern char **environ; #define XtNdecTerminalID "decTerminalID" #define XtNdefaultString "defaultString" #define XtNdeleteIsDEL "deleteIsDEL" +#define XtNdisallowedColorOps "disallowedColorOps" +#define XtNdisallowedFontOps "disallowedFontOps" +#define XtNdisallowedTcapOps "disallowedTcapOps" +#define XtNdisallowedWindowOps "disallowedWindowOps" #define XtNdynamicColors "dynamicColors" #define XtNeightBitControl "eightBitControl" #define XtNeightBitInput "eightBitInput" @@ -461,6 +466,7 @@ extern char **environ; #define XtNprinterControlMode "printerControlMode" #define XtNprinterExtent "printerExtent" #define XtNprinterFormFeed "printerFormFeed" +#define XtNprinterNewLine "printerNewLine" #define XtNquietGrab "quietGrab" #define XtNrenderFont "renderFont" #define XtNresizeGravity "resizeGravity" @@ -485,6 +491,7 @@ extern char **environ; #define XtNtekStartup "tekStartup" #define XtNtiXtraScroll "tiXtraScroll" #define XtNtiteInhibit "titeInhibit" +#define XtNtitleModes "titleModes" #define XtNtoolBar "toolBar" #define XtNtrimSelection "trimSelection" #define XtNunderLine "underLine" @@ -507,6 +514,7 @@ extern char **environ; #define XtNxmcMoveSGR "xmcMoveSGR" #define XtCAllowC1Printable "AllowC1Printable" +#define XtCAllowColorOps "AllowColorOps" #define XtCAllowFontOps "AllowFontOps" #define XtCAllowSendEvents "AllowSendEvents" #define XtCAllowTcapOps "AllowTcapOps" @@ -550,6 +558,10 @@ extern char **environ; #define XtCDecTerminalID "DecTerminalID" #define XtCDefaultString "DefaultString" #define XtCDeleteIsDEL "DeleteIsDEL" +#define XtCDisallowedColorOps "DisallowedColorOps" +#define XtCDisallowedFontOps "DisallowedFontOps" +#define XtCDisallowedTcapOps "DisallowedTcapOps" +#define XtCDisallowedWindowOps "DisallowedWindowOps" #define XtCDynamicColors "DynamicColors" #define XtCEightBitControl "EightBitControl" #define XtCEightBitInput "EightBitInput" @@ -613,6 +625,7 @@ extern char **environ; #define XtCPrinterControlMode "PrinterControlMode" #define XtCPrinterExtent "PrinterExtent" #define XtCPrinterFormFeed "PrinterFormFeed" +#define XtCPrinterNewLine "PrinterNewLine" #define XtCQuietGrab "QuietGrab" #define XtCRenderFont "RenderFont" #define XtCResizeGravity "ResizeGravity" @@ -635,6 +648,7 @@ extern char **environ; #define XtCTekStartup "TekStartup" #define XtCTiXtraScroll "TiXtraScroll" #define XtCTiteInhibit "TiteInhibit" +#define XtCTitleModes "TitleModes" #define XtCToolBar "ToolBar" #define XtCTrimSelection "TrimSelection" #define XtCUnderLine "UnderLine" @@ -729,9 +743,11 @@ extern void HandleSelectStart PROTO_XT_ACTIONS_ARGS; extern void HandleStartExtend PROTO_XT_ACTIONS_ARGS; extern void ResizeSelection (TScreen * /* screen */, int /* rows */, int /* cols */); extern void ScrollSelection (TScreen * /* screen */, int /* amount */, Bool /* always */); -extern void TrackMouse (XtermWidget /* xw */, int /* func */, CELL * /* start */, int /* firstrow */, int /* lastrow */); +extern void TrackMouse (XtermWidget /* xw */, int /* func */, CELL * /* start */, int /* firstrow */, int /* lastrow */); extern void ViButton PROTO_XT_ACTIONS_ARGS; +extern int xtermUtf8ToTextList(XtermWidget /* xw */, XTextProperty * /* text_prop */, char *** /* text_list */, int * /* text_list_count */); + #if OPT_DEC_LOCATOR extern void GetLocatorPosition (XtermWidget /* w */); extern void InitLocatorFilter (XtermWidget /* w */); @@ -746,7 +762,7 @@ extern void SendFocusButton(XtermWidget /* xw */, XFocusChangeEvent * /* event * #if OPT_PASTE64 extern void AppendToSelectionBuffer (TScreen * /* screen */, unsigned /* c */); extern void ClearSelectionBuffer (TScreen * /* screen */); -extern void CompleteSelection (XtermWidget /* xw */, char ** /* args */, Cardinal /* len */); +extern void CompleteSelection (XtermWidget /* xw */, String * /* args */, Cardinal /* len */); extern void xtermGetSelection (Widget /* w */, Time /* ev_time */, String * /* params */, Cardinal /* num_params */, Atom * /* targets */); #endif @@ -791,7 +807,7 @@ extern void FindFontSelection (XtermWidget /* xw */, const char * /* atom_name * extern void HideCursor (void); extern void RestartBlinking(TScreen * /* screen */); extern void ShowCursor (void); -extern void SwitchBufPtrs (TScreen * /* screen */); +extern void SwitchBufPtrs (TScreen * /* screen */, int /* toBuf */); extern void ToggleAlternate (XtermWidget /* xw */); extern void VTReset (XtermWidget /* xw */, int /* full */, int /* saved */); extern void VTRun (XtermWidget /* xw */); @@ -929,6 +945,7 @@ extern char *xtermFindShell(char * /* leaf */, Bool /* warning */); extern char *xtermVersion(void); extern const char *SysErrorMsg (int /* n */); extern const char *SysReasonMsg (int /* n */); +extern int ResetAnsiColorRequest(XtermWidget, char *, int); extern int XStrCmp (char * /* s1 */, char * /* s2 */); extern int creat_as (uid_t /* uid */, gid_t /* gid */, Bool /* append */, char * /* pathname */, int /* mode */); extern int open_userfile (uid_t /* uid */, gid_t /* gid */, char * /* path */, Bool /* append */); @@ -1003,12 +1020,13 @@ extern void FlushLog (TScreen * /* screen */); /* print.c */ extern Bool xtermHasPrinter (XtermWidget /* xw */); +extern PrinterFlags *getPrinterFlags(XtermWidget /* xw */, String * /* params */, Cardinal * /* param_count */); extern int xtermPrinterControl (XtermWidget /* xw */, int /* chr */); extern void setPrinterControlMode (XtermWidget /* xw */, int /* mode */); extern void xtermAutoPrint (XtermWidget /* xw */, unsigned /* chr */); extern void xtermMediaControl (XtermWidget /* xw */, int /* param */, int /* private_seq */); -extern void xtermPrintScreen (XtermWidget /* xw */, Bool /* use_DECPEX */); -extern void xtermPrintEverything (XtermWidget /* xw */); +extern void xtermPrintScreen (XtermWidget /* xw */, Bool /* use_DECPEX */, PrinterFlags * /* p */); +extern void xtermPrintEverything (XtermWidget /* xw */, PrinterFlags * /* p */); /* ptydata.c */ #ifdef VMS @@ -1201,22 +1219,22 @@ extern void ClearCurBackground (XtermWidget /* xw */, int /* top */, int /* le #define getXtermForeground(xw, flags, color) \ (((flags) & FG_COLOR) && ((int)(color) >= 0 && (color) < MAXCOLORS) \ - ? GET_COLOR_RES(xw->screen.Acolors[color]) \ - : T_COLOR(&(xw->screen), TEXT_FG)) + ? GET_COLOR_RES(xw, TScreenOf(xw)->Acolors[color]) \ + : T_COLOR(TScreenOf(xw), TEXT_FG)) #define getXtermBackground(xw, flags, color) \ (((flags) & BG_COLOR) && ((int)(color) >= 0 && (color) < MAXCOLORS) \ - ? GET_COLOR_RES(xw->screen.Acolors[color]) \ - : T_COLOR(&(xw->screen), TEXT_BG)) + ? GET_COLOR_RES(xw, TScreenOf(xw)->Acolors[color]) \ + : T_COLOR(TScreenOf(xw), TEXT_BG)) #if OPT_COLOR_RES -#define GET_COLOR_RES(res) xtermGetColorRes(&(res)) +#define GET_COLOR_RES(xw, res) xtermGetColorRes(xw, &(res)) #define SET_COLOR_RES(res,color) (res)->value = color #define EQL_COLOR_RES(res,color) (res)->value == color #define T_COLOR(v,n) (v)->Tcolors[n].value -extern Pixel xtermGetColorRes(ColorRes *res); +extern Pixel xtermGetColorRes(XtermWidget /* xw */, ColorRes * /* res */); #else -#define GET_COLOR_RES(res) res +#define GET_COLOR_RES(xw, res) res #define SET_COLOR_RES(res,color) *res = color #define EQL_COLOR_RES(res,color) *res == color #define T_COLOR(v,n) (v)->Tcolors[n] @@ -1225,6 +1243,15 @@ extern Pixel xtermGetColorRes(ColorRes *res); #define ExtractForeground(color) (unsigned) GetCellColorFG(color) #define ExtractBackground(color) (unsigned) GetCellColorBG(color) +#define MapToColorMode(fg, screen, flags) \ + (((screen)->colorBLMode && ((flags) & BLINK)) \ + ? COLOR_BL \ + : (((screen)->colorULMode && ((flags) & UNDERLINE)) \ + ? COLOR_UL \ + : (((screen)->colorBDMode && ((flags) & BOLD)) \ + ? COLOR_BD \ + : fg))) + #define checkVeryBoldAttr(flags, fg, code, attr) \ if ((flags & FG_COLOR) != 0 \ && (screen->veryBoldColors & attr) == 0 \ @@ -1240,11 +1267,13 @@ extern Pixel xtermGetColorRes(ColorRes *res); #else /* !OPT_ISO_COLORS */ +#define MapToColorMode(fg, screen, flags) fg + #define ClearDFtBackground(xw, top, left, height, width) \ ClearCurBackground(xw, top, left, height, width) #define ClearCurBackground(xw, top, left, height, width) \ - XClearArea (xw->screen.display, VWindow(&(xw->screen)), \ + XClearArea (TScreenOf(xw)->display, VWindow(TScreenOf(xw)), \ left, top, width, height, False) #define extract_fg(xw, color, flags) (xw)->cur_foreground @@ -1252,8 +1281,8 @@ extern Pixel xtermGetColorRes(ColorRes *res); /* FIXME: Reverse-Video? */ #define T_COLOR(v,n) (v)->Tcolors[n] -#define getXtermBackground(xw, flags, color) T_COLOR(&(xw->screen), TEXT_BG) -#define getXtermForeground(xw, flags, color) T_COLOR(&(xw->screen), TEXT_FG) +#define getXtermBackground(xw, flags, color) T_COLOR(TScreenOf(xw), TEXT_BG) +#define getXtermForeground(xw, flags, color) T_COLOR(TScreenOf(xw), TEXT_FG) #define makeColorPair(fg, bg) 0 #define xtermColorPair(xw) 0 @@ -1268,12 +1297,12 @@ extern void putXtermCell (TScreen * /* screen */, int /* row */, int /* col */ #if OPT_HIGHLIGHT_COLOR #define isNotForeground(xw, fg, bg, sel) \ - (Boolean) ((sel) != T_COLOR(&((xw)->screen), TEXT_FG) \ + (Boolean) ((sel) != T_COLOR(TScreenOf(xw), TEXT_FG) \ && (sel) != (fg) \ && (sel) != (bg) \ && (sel) != (xw)->dft_foreground) #define isNotBackground(xw, fg, bg, sel) \ - (Boolean) ((sel) != T_COLOR(&((xw)->screen), TEXT_BG) \ + (Boolean) ((sel) != T_COLOR(TScreenOf(xw), TEXT_BG) \ && (sel) != (fg) \ && (sel) != (bg) \ && (sel) != (xw)->dft_background) diff --git a/app/xterm/xterm.log.html b/app/xterm/xterm.log.html index a0bd29140..055cce411 100644 --- a/app/xterm/xterm.log.html +++ b/app/xterm/xterm.log.html @@ -1,26 +1,37 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!-- ***************************************************************************** - * Copyright 1996-2008,2009 by Thomas E. Dickey * - * All Rights Reserved. * + * this file is part of xterm * * * - * Permission to use, copy, modify, and distribute this software and its * - * documentation for any purpose and without fee is hereby granted, provided * - * that the above copyright notice appear in all copies and that both that * - * copyright notice and this permission notice appear in supporting * - * documentation, and that the name of the above listed copyright holder(s) * - * not be used in advertising or publicity pertaining to distribution of the * - * software without specific, written prior permission. * + * Copyright 1997-2009,2010 by Thomas E. Dickey * * * - * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD * - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND * - * FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE * - * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * + * All Rights Reserved * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, sublicense, and/or sell copies of the Software, and to * + * permit persons to whom the Software is furnished to do so, subject to * + * the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * ***************************************************************************** - $XTermId: xterm.log.html,v 1.846 2009/10/13 09:28:07 tom Exp $ + $XTermId: xterm.log.html,v 1.906 2010/01/22 01:00:37 tom Exp $ --> <HTML> <HEAD> @@ -45,6 +56,11 @@ Most of these are summarized in the XFree86 CHANGELOG is the latest version of this file. <UL> +<LI><A HREF="#xterm_255">Patch #255 - 2010/1/21</A> +<LI><A HREF="#xterm_254">Patch #254 - 2010/1/6</A> +<LI><A HREF="#xterm_253">Patch #253 - 2009/12/10</A> +<LI><A HREF="#xterm_252">Patch #252 - 2009/12/7</A> +<LI><A HREF="#xterm_251">Patch #251 - 2009/11/11</A> <LI><A HREF="#xterm_250">Patch #250 - 2009/10/13</A> <LI><A HREF="#xterm_249">Patch #249 - 2009/10/1</A> <LI><A HREF="#xterm_248">Patch #248 - 2009/9/11</A> @@ -298,6 +314,204 @@ is the latest version of this file. <LI><A HREF="#xterm_01">Patch #1 - 1996/1/6</A> </UL> +<H1><A NAME="xterm_255">Patch #255 - 2010/1/21</A></H1> +<ul> + <li>rename <code>install.sh</code> to <code>install-sh</code> in case + suffix-rules might interfere. + + <li>extend range for <code>convertToUTF8</code> function to full + 31-bits, to use with printing, etc. + + <li>improve manpage by checking for actual locations of + utmp/wtmp files (Debian #562640). + + <li>modify configure macro CF_XOPEN_SOURCE to remove -D's before + adding the same name rather than relying on -U's, to reduce + redefinition warnings for some platforms that have conflicting + definitions in headers. + + <li>correct logic used to switch to alternate screen using FIFO-lines + configuration (Debian #565772). + + <li>update config.guess, config.sub +</ul> + +<H1><A NAME="xterm_254">Patch #254 - 2010/1/6</A></H1> +<ul> + <li>add a configure-check to eliminate <code>install-ti</code> + rule from Makefile when the system has no tic (terminfo compiler) + program. This lets one use the <code>install-full</code> + rule more consistently. + + <li>amend change to WriteText() function in + <a href="#xterm_252">patch #252</a> to take into account the + <code>colorAttrMode</code> resource + (report by Krzysztof Kotlenga). + + <li>document <code>titleModes</code> resource in manpage, added in + <a href="#xterm_252">patch #252</a>. + + <li>modify tcap-query table entries for shifted up/down cursor keys + to match ncurses convention. + + <li>improve lookup of termcap-query data, allowing for duplicate + keycodes versus missing entries. + + <li>add control sequence which can be used to modify the terminal + data used for the termcap-keyboard. + + <li>improve portability of tcap-query feature, using terminfo functions + in preference to termcap on systems having terminfo. + + <li>improve font-setting/querying control (<code>OSC 50</code>): + <ul> + <li>when TrueType font is selected, the TrueType + <code>faceName</code> will be set, rather than the bitmap font. + <li>when TrueType font is selected, querying returns the name of + the TrueType font. + <li>querying a font recognizes the relative-font convention that + setting a font could use. + </ul> + + <li>add menu-entry for allowColorOps. + + <li>add new resources for fine-tuning menu entries: + <code>allowColorOps</code>, + <code>disallowedColorOps</code>, + <code>disallowedFontOps</code> and + <code>disallowedTcapOps</code>. + + <li>correct logic for disabling the "TrueType Fonts" menu item; it was + not ensuring that the <code>faceName</code> resource value was + non-empty. + + <li>implement VT520-style controls <code>DECSMBV</code> and + <code>DECSWBV</code> for setting the margin- and warning-bell + volume. + + <li>fix a minor error from <a href="#xterm_243">patch #243</a> which + made the zIconBeep feature use a minor-error tone rather than an + informational tone. + + <li>add a null-pointer check for the case where <code>renderFont</code> + resource is true, but <code>faceName</code> resource is unset, + used in logic to strip "xft:" prefix from + <a href="#xterm_251">patch #251</a> changes + (patch by Michael Riepe). + + <li>add special case to configure CF_XOPEN_SOURCE macro to use extensions + on Darwin (patch by Dennis Preiser). + + <li>improve configure checks for regular expressions header and + library + + <li>update config.guess, config.sub +</ul> + +<H1><A NAME="xterm_253">Patch #253 - 2009/12/10</A></H1> +<ul> + <li>add a null-pointer check in <code>getPrinterFlags()</code> + per changes in <a href="#xterm_252">patch #252</a>. + + <li>add a null-pointer check, needed in UTF-8 mode for Xft fonts after + changes in <a href="#xterm_252">patch #252</a> (patch by Alan + Coopersmith). + + <li>correct size when clearing struct for tek4014 (patch by Jochen + Voss). + + <li>parenthesize expression in <code>MoreRows</code> macro, fixing + a limit check added in <a href="#xterm_251">patch #251</a> + (Debian #560039). +</ul> + +<H1><A NAME="xterm_252">Patch #252 - 2009/12/7</A></H1> +<ul> + <li>modify title-querying logic to support retrieval of titles encoded + using UTF-8. + + <li>add new "title-modes" control sequence for controlling whether + window/icon titles can be set or queried using UTF-8, optionally + encoded in a hexadecimal string. + + <li>use <code>mkdir -p</code> rather than <code>mkdirs.sh</code> + (prompted by discussion of mawk by Aleksey Cheusov). + + <li>add appropriate copyright/license notices to the bulk of files + lacking same, and modify to use identical terms in others which + used different wording. The main exceptions are the files + contributed by Markus Kuhn, who appears to prefer public domain + distribution, noting that I have modified/improved several of these + without changing the terms of distribution (request by Jari Aalto). + + <li>add control sequences for resetting the "dynamic" colors to + their default values. + + <li>add control sequences for resetting the "special" colors to + their default values. + + <li>add control sequences for setting the "special" colors such as + <code>colorBD</code> (bold). + + <li>add overlooked case for setting highlight foreground color with + the dynamic-colors control. + + <li>add <code>OSC 104</code>, for resetting ANSI/16/88/256 colors to + default. + + <li>reset ANSI/16/88/256 colors to default in soft/hard reset functions. + + <li>strip "xft:" prefix from <code>faceName</code> and + <code>faceNameDoublesize</code> resource values, + + <li>add <code>DECSCUSR</code> (discussion with Andy Koppe). + + <li>add check/warning on failure to load font, to see if the name looks + like an Xft pattern rather than XLFD. This can happen if someone + happens to modify their X resource settings for programs that read + data from xterm's namespace. + + <li>modify handling of <code>print</code> and + <code>print-everything</code> + actions to allow the various printer flags to be overridden by + supplying parameters. + + <li>add resource <code>printerNewLine</code> (request by Ovidiu + Gheorghioiu). + + <li>minor cleanup, finish using <code>TScreenOf()</code> and + <code>TekScreenOf()</code> macros introduced in + <a href="#xterm_224">patch #224</a>. + + <li>improve checks in ShowCursor/HideCursor to get the background + color, particularly when <code>highlightReverse</code> resource + is used (reports by Jan Engelhardt, Christian Weisgerber). + + <li>correct <code>checkVeryBoldAttr</code> to omit comparison of + foreground color to special color values used for + <code>color<XX></code> resources (report by Jan Engelhardt). + + <li>make <code>colorBDMode</code> and <code>colorULMode</code> + resources work with TrueType configuration (report by Jan + Engelhardt). +</ul> + +<H1><A NAME="xterm_251">Patch #251 - 2009/11/11</A></H1> +<ul> + <li>add window-ops controls to push/pop icon and/or window labels on + a stack. + + <li>minor fixes to align termcap file with terminfo. + + <li>add resource <code>disallowedWindowOps</code>, to allow fine-tuning + of features to suppress with the <code>allowWindowOps</code> + resource (prompted by discussion with Bram Moolenaar). + + <li>add makefile rules for resize-manpage to pdf, etc. + + <li>further improve limit-checks in select/paste (Mandriva #54531). +</ul> + <H1><A NAME="xterm_250">Patch #250 - 2009/10/13</A></H1> <ul> <li>add check and error-message for fonts that have no printable @@ -1007,7 +1221,7 @@ is the latest version of this file. single-height characters). <li>restore reset of doublesize for a line when it is cleared, - broken in <a href="#xterm-228">patch #228</a>. + broken in <a href="#xterm_228">patch #228</a>. </ul> <li>modify logic for <code>forceBoxChars</code> resource when using diff --git a/app/xterm/xterm.man b/app/xterm/xterm.man index e5d6cbe6e..26638a4ca 100644 --- a/app/xterm/xterm.man +++ b/app/xterm/xterm.man @@ -1,7 +1,7 @@ '\" t -.\" $XTermId: xterm.man,v 1.437 2009/10/10 12:15:41 tom Exp $ +.\" $XTermId: xterm.man,v 1.451 2010/01/20 10:55:58 tom Exp $ .\" -.\" Copyright 1996-2008,2009 by Thomas E. Dickey +.\" Copyright 1996-2009,2010 by Thomas E. Dickey .\" .\" All Rights Reserved .\" @@ -1283,8 +1283,8 @@ You cannot set this to a value less than 64. .TP 8 .B "ptyHandshake (\fPclass\fB PtyHandshake) If \*(``true\*('', \fIxterm\fP will perform handshaking during initialization -to ensure that the parent and child processes update the \fButmp\fP -and \fBstty\fP state. +to ensure that the parent and child processes update the \fIutmp\fP +and \fIstty\fP state. See also \fBwaitForMap\fP which waits for the pseudo-terminal's notion of the screen size, and \fBptySttySize\fP which resets the screen size after other terminal @@ -1492,6 +1492,11 @@ Although this corresponds to no particular standard, some users insist it is a VT100. The default is \*(``false.\*('' .TP +.B "allowColorOps (\fPclass\fB AllowColorOps)" +Specifies whether control sequences that set/query the dynamic colors should be allowed. +ANSI colors are unaffected by this resource setting. +The default is \*(``true.\*('' +.TP .B "allowFontOps (\fPclass\fB AllowFontOps)" Specifies whether control sequences that set/query the font should be allowed. The default is \*(``true.\*('' @@ -1542,6 +1547,7 @@ position, as well as reporting these values and the title or icon name. Each of these can be abused in a script; curiously enough most terminal emulators that implement these restrict only a small part of the repertoire. +For fine-tuning, see \fBdisallowedWindowOps\fP. The default is \*(``false.\*('' .TP 8 .B "altIsNotMeta (\fPclass\fB AltIsNotMeta\fP)" @@ -1997,6 +2003,148 @@ Specifies whether the Delete key on the editing keypad should send DEL (127) or the VT220-style Remove escape sequence. The default is \*(``false,\*('' for the latter. .TP 8 +.B "disallowedColorOps (\fPclass\fB DisallowedColorOps)" +Specify which features will be disabled if \fBallowColorOps\fP is false. +This is a comma-separated list of names. +The default value is +.RS +SetColor,GetColor,GetAnsiColor +.RE +.IP +The names are listed below. \fIxterm\fP ignores capitalization, but +they are shown in mixed-case for clarity. +.RS +.TP 5 +SetColor +Set a specific dynamic color. +.TP 5 +GetColor +Report the current setting of a given dynamic color. +.TP 5 +GetAnsiColor +Report the current setting of a given ANSI color (actually any of the colors +set via ANSI-style controls). +.RE +.TP 8 +.B "disallowedFontOps (\fPclass\fB DisallowedFontOps)" +Specify which features will be disabled if \fBallowFontOps\fP is false. +This is a comma-separated list of names. +The default value is +.RS +SetFont,GetFont +.RE +.IP +The names are listed below. \fIxterm\fP ignores capitalization, but +they are shown in mixed-case for clarity. +.RS +.TP 5 +SetFont +Set the specified font. +.TP 5 +GetFont +Report the specified font. +.RE +.TP 8 +.B "disallowedTcapOps (\fPclass\fB DisallowedTcapOps)" +Specify which features will be disabled if \fBallowTcapOps\fP is false. +This is a comma-separated list of names. +The default value is +.RS +SetTcap,GetTcap +.RE +.IP +The names are listed below. \fIxterm\fP ignores capitalization, but +they are shown in mixed-case for clarity. +.RS +.TP 5 +SetTcap +(not implemented) +.TP 5 +GetTcap +Report specified function- and other special keys. +.RE +.TP 8 +.B "disallowedWindowOps (\fPclass\fB DisallowedWindowOps)" +Specify which features will be disabled if \fBallowWindowOps\fP is false. +This is a comma-separated list of names, or (for the controls adapted +from \fIdtterm\fP the operation number). +The default value is +.RS +20,21,SetXprop,SetSelection +.RE +.IP +The names are listed below. \fIxterm\fP ignores capitalization, but +they are shown in mixed-case for clarity. Where a number can be used +as an alternative, it is given in parentheses after the name. +.RS +.TP 5 +GetIconTitle (20) +Report xterm window's icon label as a string. +.TP 5 +GetScreenSizeChars (19) +Report the size of the screen in characters as numbers. +.TP 5 +GetSelection +Report selection data as a base64 string. +.TP 5 +GetWinPosition (13) +Report xterm window position as numbers. +.TP 5 +GetWinSizeChars (18) +Report the size of the text area in characters as numbers. +.TP 5 +GetWinSizePixels (14) +Report xterm window in pixels as numbers. +.TP 5 +GetWinState (11) +Report xterm window state as a number. +.TP 5 +GetWinTitle (21) +Report xterm window's title as a string. +.TP 5 +LowerWin (6) +Lower the xterm window to the bottom of the stacking order. +.TP 5 +MaximizeWin (9) +Maximize window (i.e., resize to screen size). +.TP 5 +MinimizeWin (2) +Iconify window. +.TP 5 +PopTitle (23) +Pop title from internal stack. +.TP 5 +PushTitle (22) +Push title to internal stack. +.TP 5 +RaiseWin (5) +Raise the xterm window to the front of the stacking order. +.TP 5 +RefreshWin (7) +Refresh the xterm window. +.TP 5 +RestoreWin (1) +De-iconify window. +.TP 5 +SetSelection +Set selection data. +.TP 5 +SetWinLines +Resize to a given number of lines, at least 24. +.TP 5 +SetWinPosition (3) +Move window to given coordinates. +.TP 5 +SetWinSizeChars (8) +Resize the text area to given size in characters. +.TP 5 +SetWinSizePixels (4) +Resize the xterm window to given size in pixels. +.TP 5 +SetXprop +Set X property on top-level window. +.RE +.TP 8 .B "dynamicColors (\fPclass\fB DynamicColors)" Specifies whether or not escape sequences to change colors assigned to different attributes are recognized. @@ -2669,7 +2817,8 @@ Select a line (counting wrapping). .TP group Select a group of adjacent lines (counting wrapping). -The selection stops on a blank line. +The selection stops on a blank line, +and does not extend outside the current page. .TP page Select all visible lines, i.e., the page. @@ -2782,6 +2931,11 @@ Controls whether a form feed is sent to the printer at the end of a print page function. The default is \*(``false.\*('' .TP 8 +.B "printerNewLine (\fPclass\fB PrinterNewLine)" +Controls whether a newline is sent to the printer at the end of a print +page function. +The default is \*(``true.\*('' +.TP 8 .B "quietGrab (\fPclass\fB QuietGrab)" Controls whether the cursor is repainted when \fINotifyGrab\fP and \fINotifyUngrab\fP @@ -2944,6 +3098,30 @@ sequences (also known as private modes) 1047, 1048 and 1049 which have the same effect as the original 47 control sequence. The default for this resource is \*(``false.\*('' .TP 8 +.B "titleModes (\fPclass\fB TitleModes)" +Tells \fIxterm\fP whether to accept or return +window- and icon-labels in ISO-8859-1 +(the default) or UTF-8. +Either can be encoded in hexadecimal. +The default for this resource is \*(``0.\*('' +.IP +Each bit (bit "0" is 1, bit "1" is 2, etc) corresponds to one of the +parameters set by the title modes control sequence: +.RS +.TP 5 +0 +Set window/icon labels using hexadecimal +.TP 5 +1 +Query window/icon labels using hexadecimal +.TP 5 +2 +Set window/icon labels using UTF-8 (overrides \fButf8Titles\fP resource). +.TP 5 +3 +Query window/icon labels using UTF-8 +.RE +.TP 8 .B "translations (\fPclass\fB Translations)" Specifies the key and button bindings for menus, selections, \*(``programmed strings,\*('' etc. @@ -3039,6 +3217,13 @@ Set this resource to \*(``true\*('' to allow UTF-8 encoded title strings. That cancels the translation to UTF-8, allowing UTF-8 strings to be displayed as is. .IP +This feature is available as a menu entry, since it is related to +the particular applications you are running within \fIxterm\fP. +You can also use a control sequence (see the discussion of "Title Modes" +in the control sequences document), to set an equivalent flag. +The \fBtitleModes\fP resource sets the same value, +which overrides this resource. +.IP The default is \*(``false.\*('' .TP 8 .B "veryBoldColors (\fPclass\fB VeryBoldColors)" @@ -4114,6 +4299,10 @@ which can be controlled by writing escape sequences to the terminal. These are disabled if the SendEvents feature is enabled: .RS .TP +Allow Color Ops (allow-font-ops) +This corresponds to the \fBallowColorOps\fP resource. +Enable or disable control sequences that set/query the colors. +.TP Allow Font Ops (allow-font-ops) This corresponds to the \fBallowFontOps\fP resource. Enable or disable control sequences that set/query the font. @@ -4357,6 +4546,10 @@ The following actions are provided for use within the \fIvt100\fP or \fItek4014\fP \fBtranslations\fP resources: .TP 8 +.B "allow-color-ops(\fIon/off/toggle\fP)" +This action set or toggles the \fBallowColorOps\fP resource and is also +invoked by the \fBallow-color-ops\fP entry in \fIfontMenu\fP. +.TP 8 .B "allow-font-ops(\fIon/off/toggle\fP)" This action set or toggles the \fBallowFontOps\fP resource and is also invoked by the \fBallow-font-ops\fP entry in \fIfontMenu\fP. @@ -4518,13 +4711,50 @@ Valid names (case is significant) include: \fImainMenu\fP, \fIvtMenu\fP, \fIfontMenu\fP, and \fItekMenu\fP. .TP 8 -.B "print()" +.B "print(\fIprinter-flags\fP)" This action prints the window and is also invoked by the \fIprint\fP entry in \fImainMenu\fP. +.IP +The action accepts optional parameters, which temporarily override +resource settings. +The parameter values are matched ignoring case: +.RS +.TP 5 +noFormFeed +no form feed will be sent at the end of the last line printed +(i.e., \fBprinterFormFeed\fP is ``false''). +.TP 5 +FormFeed +a form feed will be sent at the end of the last line printed +(i.e., \fBprinterFormFeed\fP is ``true''). +.TP 5 +noNewLine +no newline will be sent at the end of the last line printed, +and wrapped lines will be combined into long lines +(i.e., \fBprinterNewLine\fP is ``false''). +.TP 5 +NewLine +a newline will be sent at the end of the last line printed, +and each line will be limited (by adding a newline) to the screen width +(i.e., \fBprinterNewLine\fP is ``true''). +.TP 5 +noAttrs +the page is printed without attributes +(i.e., \fBprintAttributes\fP is ``0''). +.TP 5 +monoAttrs +the page is printed with monochrome (vt220) attributes +(i.e., \fBprintAttributes\fP is ``1''). +.TP 5 +colorAttrs +the page is printed with ANSI color attributes +(i.e., \fBprintAttributes\fP is ``2''). +.RE .TP 8 -.B "print-everything()" +.B "print-everything(\fIprinter-flags\fP)" This action sends the entire text history, in addition to the text currently visible, to the program given in the \fBprinterCommand\fP resource. +It allows the same optional parameters as the \fBprint\fP action. With a suitable printer command, the action can be used to load the text history in an editor. .TP 8 @@ -5045,7 +5275,7 @@ Some shell initialization scripts may set a different locale. .TP 5 XTERM_SHELL is set to the pathname of the program which is invoked. -Usually that is a shell program, e.g., \fB/bin/sh\fP. +Usually that is a shell program, e.g., \fI/bin/sh\fP. Since it is not necessarily a shell program however, it is distinct from \*(``SHELL\*(''. .TP 5 diff --git a/app/xterm/xtermcap.c b/app/xterm/xtermcap.c index 95dbc0450..c3139bc7f 100644 --- a/app/xterm/xtermcap.c +++ b/app/xterm/xtermcap.c @@ -1,7 +1,7 @@ -/* $XTermId: xtermcap.c,v 1.23 2009/10/12 21:17:24 tom Exp $ */ +/* $XTermId: xtermcap.c,v 1.41 2010/01/05 00:46:56 tom Exp $ */ /* - * Copyright 2007-2008,2009 by Thomas E. Dickey + * Copyright 2007-2009,2010 by Thomas E. Dickey * * All Rights Reserved * @@ -31,8 +31,10 @@ */ #include <xtermcap.h> +#include <data.h> #include <X11/keysym.h> +#include <ctype.h> #ifdef VMS #include <X11/keysymdef.h> @@ -40,26 +42,24 @@ #include <xstrings.h> -#ifndef HAVE_TIGETSTR -#undef USE_TERMINFO -#endif - -#ifndef USE_TERMINFO -#define USE_TERMINFO 0 -#endif - #if USE_TERMINFO && defined(NCURSES_VERSION) && defined(HAVE_USE_EXTENDED_NAMES) #define USE_EXTENDED_NAMES 1 #else #define USE_EXTENDED_NAMES 0 #endif +#if USE_TERMINFO +#define TcapInit(buffer, name) (setupterm(name, fileno(stdout), &ignored) == OK) +#else +#define TcapInit(buffer, name) (tgetent(buffer, name) == 1) +#endif + +#define NO_STRING (char *)(-1) + #if OPT_TCAP_QUERY || OPT_TCAP_FKEYS #define SHIFT (MOD_NONE + MOD_SHIFT) -#define NO_STRING (char *)(-1) - typedef struct { const char *tc; const char *ti; @@ -89,8 +89,8 @@ static TCAPINFO table[] = { DATA( "#4", "kLFT", XK_Left, SHIFT ), DATA( "%i", "kRIT", XK_Right, SHIFT ), - DATA( "%e", "kPRV", XK_Up, SHIFT ), - DATA( "%c", "kNXT", XK_Down, SHIFT ), + DATA( "kF", "kind", XK_Up, SHIFT ), + DATA( "kR", "kri", XK_Down, SHIFT ), DATA( "k1", "kf1", XK_Fn(1), 0 ), DATA( "k2", "kf2", XK_Fn(2), 0 ), @@ -169,14 +169,19 @@ static TCAPINFO table[] = { DATA( "kC", "kclr", XK_Clear, 0 ), DATA( "kD", "kdch1", XK_Delete, 0 ), DATA( "kI", "kich1", XK_Insert, 0 ), + DATA( "kN", "knp", XK_Next, 0 ), DATA( "kP", "kpp", XK_Prior, 0 ), + DATA( "%c", "kNXT", XK_Next, SHIFT ), + DATA( "%e", "kPRV", XK_Prior, SHIFT ), + DATA( "&8", "kund", XK_Undo, 0 ), DATA( "kb", "kbs", XK_BackSpace, 0 ), # if OPT_TCAP_QUERY && OPT_ISO_COLORS /* XK_COLORS is a fake code. */ DATA( "Co", "colors", XK_COLORS, 0 ), # endif + DATA( "TN", "name", XK_TCAPNAME, 0 ), #if USE_EXTENDED_NAMES #define DEXT(name, parm, code) DATA("", name, code, parm) #define D1ST(name, parm, code) DEXT("k" #name, parm, code) @@ -191,6 +196,11 @@ static TCAPINFO table[] = { DMOD(name, 7, code), \ DMOD(name, 8, code) + /* the terminfo codes here are ncurses extensions */ + /* ignore the termcap names, which are empty */ + DATA( "", "kUP", XK_Up, SHIFT ), + DATA( "", "kDN", XK_Up, SHIFT ), + DGRP(DN, XK_Down), DGRP(LFT, XK_Left), DGRP(RIT, XK_Right), @@ -215,14 +225,14 @@ loadTermcapStrings(TScreen * screen) Cardinal want = XtNumber(table); Cardinal have; char *fkey; - -#if !(USE_TERMINFO && defined(HAVE_TIGETSTR)) +#ifdef USE_TERMCAP char *area = screen->tcap_area; #endif + TRACE(("loadTermcapStrings\n")); if ((screen->tcap_fkeys = TypeCallocN(char *, want)) != 0) { for (have = 0; have < want; ++have) { -#if USE_TERMINFO && defined(HAVE_TIGETSTR) +#ifndef USE_TERMCAP fkey = tigetstr(strcpy(name, table[have].ti)); #else fkey = tgetstr(strcpy(name, table[have].tc), &area); @@ -239,18 +249,6 @@ loadTermcapStrings(TScreen * screen) #endif #if OPT_TCAP_QUERY -static int -hex2int(int c) -{ - if (c >= '0' && c <= '9') - return c - '0'; - if (c >= 'a' && c <= 'f') - return c - 'a' + 10; - if (c >= 'A' && c <= 'F') - return c - 'A' + 10; - return -1; -} - static Boolean keyIsDistinct(XtermWidget xw, int which) { @@ -313,7 +311,7 @@ lookupTcapByName(const char *name) int result = -2; Cardinal j; - if (name != 0 && *name != '\0') { + if (!IsEmpty(name)) { for (j = 0; j < XtNumber(table); j++) { if (!strcmp(table[j].ti, name) || !strcmp(table[j].tc, name)) { result = (int) j; @@ -345,31 +343,24 @@ lookupTcapByName(const char *name) * and bypass the lookup of keysym altogether. */ int -xtermcapKeycode(XtermWidget xw, char **params, unsigned *state, Bool * fkey) +xtermcapKeycode(XtermWidget xw, const char **params, unsigned *state, Bool * fkey) { TCAPINFO *data; - unsigned len = 0; int which; int code = -1; -#define MAX_TNAME_LEN 6 - char name[MAX_TNAME_LEN + 1]; - char *p; + char *name; + const char *p; TRACE(("xtermcapKeycode(%s)\n", *params)); /* Convert hex encoded name to ascii */ - for (p = *params; hex2int(p[0]) >= 0 && hex2int(p[1]) >= 0; p += 2) { - if (len >= MAX_TNAME_LEN) - break; - name[len++] = (char) ((hex2int(p[0]) << 4) + hex2int(p[1])); - } - name[len] = 0; + name = x_decode_hex(*params, &p); *params = p; *state = 0; *fkey = False; - if (len && (*p == 0 || *p == ';')) { + if (!IsEmpty(name) && (*p == 0 || *p == ';')) { if ((which = lookupTcapByName(name)) >= 0) { if (keyIsDistinct(xw, which)) { data = table + which; @@ -419,47 +410,56 @@ xtermcapKeycode(XtermWidget xw, char **params, unsigned *state, Bool * fkey) TRACE(("... xtermcapKeycode(%s, %u, %d) -> %#06x\n", name, *state, *fkey, code)); + free(name); return code; } #endif /* OPT_TCAP_QUERY */ #if OPT_TCAP_FKEYS -static TCAPINFO * -lookupTcapByCode(int code, unsigned param) +static int +nextTcapByCode(int code, unsigned param, int last) { - TCAPINFO *result = 0; - Cardinal n; + int result = -1; + int n; TRACE(("lookupTcapByCode %#x:%#x\n", code, param)); - for (n = 0; n < XtNumber(table); n++) { + for (n = last + 1; n < (int) XtNumber(table); n++) { if (table[n].code == code && table[n].param == param) { TRACE(("->lookupTcapByCode %d:%s\n", n, table[n].ti)); - result = table + n; + result = n; break; } } return result; } +static int +firstTcapByCode(int code, unsigned param) +{ + return nextTcapByCode(code, param, -1); +} + int xtermcapString(XtermWidget xw, int keycode, unsigned mask) { int result = 0; - TCAPINFO *data; unsigned param = xtermStateToParam(xw, mask); + int which; - if ((data = lookupTcapByCode(keycode, param)) != 0) { + if ((which = firstTcapByCode(keycode, param)) >= 0) { TScreen *screen = TScreenOf(xw); - Cardinal which = (Cardinal) (data - table); char *fkey; loadTermcapStrings(screen); if (screen->tcap_fkeys != 0) { - if ((fkey = screen->tcap_fkeys[which]) != NO_STRING) { - StringInput(xw, (Char *) fkey, strlen(fkey)); - result = 1; - } + do { + if ((fkey = screen->tcap_fkeys[which]) != NO_STRING) { + StringInput(xw, (Char *) fkey, strlen(fkey)); + result = 1; + break; + } + } while ((which = nextTcapByCode(keycode, param, which)) >= 0); } } @@ -471,20 +471,26 @@ xtermcapString(XtermWidget xw, int keycode, unsigned mask) #endif /* OPT_TCAP_FKEYS */ #endif /* OPT_TCAP_QUERY || OPT_TCAP_FKEYS */ + /* * If we're linked to terminfo, tgetent() will return an empty buffer. We * cannot use that to adjust the $TERMCAP variable. */ Bool -get_termcap(char *name, char *buffer) +get_termcap(XtermWidget xw, char *name) { +#if USE_TERMINFO + int ignored = 0; +#endif + char *buffer = get_tcap_buffer(xw); + *buffer = 0; /* initialize, in case we're using terminfo's tgetent */ #if USE_EXTENDED_NAMES use_extended_names(TRUE); #endif - if (name != 0) { - if (tgetent(buffer, name) == 1) { + if (!IsEmpty(name)) { + if (TcapInit(buffer, name)) { TRACE(("get_termcap(%s) succeeded (%s)\n", name, (*buffer ? "ok:termcap, we can update $TERMCAP" @@ -496,3 +502,133 @@ get_termcap(char *name, char *buffer) } return False; } + +/* + * Retrieve the termcap-buffer. + */ +char * +get_tcap_buffer(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + char *buffer; + +#if OPT_TEK4014 + if (TEK4014_ACTIVE(xw)) { + buffer = TekScreenOf(tekWidget)->tcapbuf; + } else +#endif + { + buffer = screen->tcapbuf; + } + return buffer; +} + +/* + * Retrieve the erase-key, for initialization in main program. + */ +char * +get_tcap_erase(XtermWidget xw GCC_UNUSED) +{ +#ifdef USE_TERMCAP + char *area = TScreenOf(xw)->tcap_area; +#endif + char *fkey; + +#ifndef USE_TERMCAP + fkey = tigetstr("kbs"); +#else + fkey = tgetstr("kb", &area); +#endif + + if (fkey == NO_STRING) + fkey = 0; + if (fkey != 0) + fkey = x_strdup(fkey); + return fkey; +} + +/* + * A legal termcap (or terminfo) name consists solely of graphic characters, + * excluding the punctuation used to delimit fields of the source description. + */ +static Bool +isLegalTcapName(const char *name) +{ + Bool result = False; + + if (*name != '\0') { + result = True; + while (*name != '\0') { + if (isgraph(CharOf(*name))) { + if (strchr("\\|,:'\"", *name) != 0) { + result = False; + break; + } + } else { + result = False; + break; + } + ++name; + } + } + + return result; +} + +void +set_termcap(XtermWidget xw, const char *name) +{ + Boolean success = False; +#if USE_TERMINFO + int ignored = 0; +#else + TScreen *screen = TScreenOf(xw); + char buffer[sizeof(screen->tcapbuf)]; +#endif + + TRACE(("set_termcap(%s)\n", NonNull(name))); + if (IsEmpty(name)) { + Bell(XkbBI_MinorError, 0); + } else { + const char *temp; + char *value; + + if ((value = x_decode_hex(name, &temp)) != 0) { + if (*temp == '\0' && isLegalTcapName(value)) { + if (TcapInit(buffer, value)) { +#if !USE_TERMINFO + memcpy(screen->tcapbuf, buffer, sizeof(buffer)); +#endif + free_termcap(xw); + success = True; + } + } + free(value); + } + } + if (!success) + Bell(XkbBI_MinorError, 0); +} + +void +free_termcap(XtermWidget xw) +{ +#if OPT_TCAP_FKEYS + TScreen *screen = TScreenOf(xw); + + if (screen->tcap_fkeys != 0) { + Cardinal want = XtNumber(table); + Cardinal have; + char *fkey; + + for (have = 0; have < want; ++have) { + fkey = screen->tcap_fkeys[have]; + if (fkey != 0 && fkey != NO_STRING) { + free(fkey); + } + } + free(screen->tcap_fkeys); + screen->tcap_fkeys = 0; + } +#endif +} diff --git a/app/xterm/xtermcap.h b/app/xterm/xtermcap.h index b7829083c..c50ad769e 100644 --- a/app/xterm/xtermcap.h +++ b/app/xterm/xtermcap.h @@ -1,8 +1,8 @@ -/* $XTermId: xtermcap.h,v 1.7 2009/03/15 18:18:11 tom Exp $ */ +/* $XTermId: xtermcap.h,v 1.16 2010/01/06 21:20:40 tom Exp $ */ /************************************************************ -Copyright 2007,2009 by Thomas E. Dickey +Copyright 2007-2009,2010 by Thomas E. Dickey All Rights Reserved @@ -42,25 +42,41 @@ authorization. #include <ptyx.h> -#ifdef HAVE_TERMCAP_H -#include <termcap.h> -#if defined(NCURSES_VERSION) - /* The tgetent emulation function in SVr4-style curses implementations - * (e.g., ncurses) ignores the buffer, so TERMCAP can't be set from it. - * Instead, just use terminfo. - */ -#undef USE_TERMCAP -#include <curses.h> +#ifndef HAVE_TIGETSTR +#undef USE_TERMINFO #endif -#else + +#ifndef USE_TERMINFO +#define USE_TERMINFO 0 +#endif + +#if !USE_TERMINFO +#undef HAVE_TIGETSTR +#ifndef USE_TERMCAP +#define USE_TERMCAP 1 +#endif +#endif + #undef ERR /* workaround for glibc 2.1.3 */ + #include <curses.h> + +#ifndef NCURSES_VERSION +#ifdef HAVE_TERMCAP_H +#include <termcap.h> +#endif +#endif + #ifdef HAVE_NCURSES_TERM_H #include <ncurses/term.h> #elif defined(HAVE_TERM_H) #include <term.h> /* tgetent() */ -#endif /*CYGWIN */ -#endif /* HAVE_TERMCAP_H */ +#endif + +/* + * Get rid of conflicting symbols from term.h + */ +#undef bell /***====================================================================***/ @@ -78,14 +94,19 @@ extern "C" { (((parm > MOD_NONE) && ((parm - MOD_NONE) & name)) ? " "#name : "") /* xtermcap.c */ -extern Bool get_termcap(char * /* name */, char * /* buffer */); +extern Bool get_termcap(XtermWidget /* xw */, char * /* name */); +extern void set_termcap(XtermWidget /* xw */, const char * /* name */); +extern void free_termcap(XtermWidget /* xw */); + +extern char *get_tcap_buffer(XtermWidget /* xw */); +extern char *get_tcap_erase(XtermWidget /* xw */); #if OPT_TCAP_FKEYS extern int xtermcapString(XtermWidget /* xw */, int /* keycode */, unsigned /* mask */); #endif #if OPT_TCAP_QUERY -extern int xtermcapKeycode(XtermWidget /* xw */, char ** /* params */, unsigned * /* state */, Bool * /* fkey */); +extern int xtermcapKeycode(XtermWidget /* xw */, const char ** /* params */, unsigned * /* state */, Bool * /* fkey */); #endif #ifdef __cplusplus diff --git a/app/xterm/xtermcfg.h b/app/xterm/xtermcfg.h index 85afdb7d5..2b91e9374 100644 --- a/app/xterm/xtermcfg.h +++ b/app/xterm/xtermcfg.h @@ -1,4 +1,3 @@ -/* xtermcfg.h. Generated automatically by configure. */ /* $XTermId: xtermcfg.hin,v 1.178 2009/08/09 17:23:19 tom Exp $ */ /************************************************************ @@ -29,7 +28,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #ifndef included_xtermcfg_h #define included_xtermcfg_h 1 -/* This is a template for <xtermcfg.h> */ +/* This is derived for OpenBSD from template for <xtermcfg.h> */ /* #undef ALLOWLOGFILEEXEC */ /* CF_ARG_ENABLE(enable-logfile-exec) */ /* #undef ALLOWLOGGING */ /* CF_ARG_ENABLE(enable-logging) */ diff --git a/app/xterm/xutf8.c b/app/xterm/xutf8.c index 446ec9606..8dabf1527 100644 --- a/app/xterm/xutf8.c +++ b/app/xterm/xutf8.c @@ -1,6 +1,5 @@ -/* $XTermId: xutf8.c,v 1.8 2005/01/14 01:50:03 tom Exp $ */ +/* $XTermId: xutf8.c,v 1.9 2009/11/05 23:30:05 tom Exp $ */ -/* $XFree86: xc/programs/xterm/xutf8.c,v 1.4 2005/01/14 01:50:03 dickey Exp $ */ /* Copyright (c) 2001 by Juliusz Chroboczek @@ -189,9 +188,10 @@ Xutf8TextPropertyToTextList(Display * dpy, int nelements; char *cp; char *start; - int i, j; - int datalen = (int) tp->nitems; - int len; + size_t i; + int j; + size_t datalen = tp->nitems; + size_t len; if (tp->format != 8) return XConverterNotFound; @@ -210,12 +210,12 @@ Xutf8TextPropertyToTextList(Display * dpy, } nelements = 1; - for (cp = (char *) tp->value, i = datalen; i > 0; cp++, i--) { + for (cp = (char *) tp->value, i = datalen; i != 0; cp++, i--) { if (*cp == '\0') nelements++; } - list = TypeMallocN(char *, nelements); + list = TypeMallocN(char *, (unsigned) nelements); if (!list) return XNoMemory; @@ -236,7 +236,7 @@ Xutf8TextPropertyToTextList(Display * dpy, l1utf8copy(start, (char *) tp->value, datalen); start[len] = '\0'; - for (cp = start, i = len + 1, j = 0; i > 0; cp++, i--) { + for (cp = start, i = len + 1, j = 0; i != 0; cp++, i--) { if (*cp == '\0') { list[j] = start; start = (cp + 1); |