summaryrefslogtreecommitdiff
path: root/app/xterm
diff options
context:
space:
mode:
Diffstat (limited to 'app/xterm')
-rw-r--r--app/xterm/INSTALL6
-rw-r--r--app/xterm/Imakefile13
-rw-r--r--app/xterm/MANIFEST6
-rw-r--r--app/xterm/Makefile23
-rw-r--r--app/xterm/Makefile.in430
-rw-r--r--app/xterm/THANKS6
-rw-r--r--app/xterm/Tekproc.c38
-rw-r--r--app/xterm/VTPrsTbl.c38
-rw-r--r--app/xterm/VTparse.def5
-rw-r--r--app/xterm/VTparse.h5
-rw-r--r--app/xterm/button.c120
-rw-r--r--app/xterm/charproc.c417
-rw-r--r--app/xterm/configure.in31
-rw-r--r--app/xterm/ctlseqs.ms74
-rw-r--r--app/xterm/ctlseqs.txt92
-rw-r--r--app/xterm/data.h7
-rw-r--r--app/xterm/doublechr.c6
-rw-r--r--app/xterm/fontutils.c97
-rw-r--r--app/xterm/graphics.c1491
-rw-r--r--app/xterm/graphics.h78
-rw-r--r--app/xterm/input.c6
-rw-r--r--app/xterm/main.c149
-rw-r--r--app/xterm/menu.c353
-rw-r--r--app/xterm/menu.h12
-rw-r--r--app/xterm/minstall.in10
-rw-r--r--app/xterm/misc.c360
-rw-r--r--app/xterm/package/debian/changelog18
-rw-r--r--app/xterm/package/debian/control2
-rw-r--r--app/xterm/package/debian/rules2
-rw-r--r--app/xterm/package/freebsd/Makefile2
-rw-r--r--app/xterm/package/xterm.spec39
-rw-r--r--app/xterm/ptyx.h67
-rw-r--r--app/xterm/resize.c8
-rw-r--r--app/xterm/screen.c20
-rw-r--r--app/xterm/trace.c10
-rw-r--r--app/xterm/util.c28
-rw-r--r--app/xterm/version.h6
-rw-r--r--app/xterm/vttests/256colors.pl13
-rw-r--r--app/xterm/vttests/256colors2.pl13
-rw-r--r--app/xterm/vttests/88colors.pl11
-rw-r--r--app/xterm/vttests/88colors2.pl13
-rw-r--r--app/xterm/vttests/dynamic.pl7
-rw-r--r--app/xterm/vttests/paste64.pl8
-rw-r--r--app/xterm/vttests/query-color.pl7
-rw-r--r--app/xterm/vttests/query-fonts.pl7
-rw-r--r--app/xterm/vttests/resize.pl28
-rw-r--r--app/xterm/vttests/tcapquery.pl7
-rw-r--r--app/xterm/xstrings.c18
-rw-r--r--app/xterm/xterm.h44
-rw-r--r--app/xterm/xterm.log.html148
-rw-r--r--app/xterm/xterm.man130
-rw-r--r--app/xterm/xtermcap.c22
-rw-r--r--app/xterm/xtermcfg.h6
-rw-r--r--app/xterm/xtermcfg.hin4
54 files changed, 2765 insertions, 1796 deletions
diff --git a/app/xterm/INSTALL b/app/xterm/INSTALL
index 2554ca29f..2eab61507 100644
--- a/app/xterm/INSTALL
+++ b/app/xterm/INSTALL
@@ -1,4 +1,4 @@
--- $XTermId: INSTALL,v 1.149 2013/08/04 19:33:14 tom Exp $
+-- $XTermId: INSTALL,v 1.150 2014/04/11 19:36:41 Ross.Combs Exp $
-------------------------------------------------------------------------------
-- Copyright 1997-2012,2013 by Thomas E. Dickey
--
@@ -482,6 +482,10 @@ The options (in alphabetic order):
Compile-in code to support SCO-style function keys.
+ --enable-regis-graphics enable support for ReGIS graphics
+
+ Compile-in code to support experimental ReGIS graphics
+
--enable-sixel-graphics enable support for sixel-graphics
Compile-in code to support experimental sixel-graphics
diff --git a/app/xterm/Imakefile b/app/xterm/Imakefile
index 81b6ce86d..0c2b20e98 100644
--- a/app/xterm/Imakefile
+++ b/app/xterm/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XTermId: Imakefile,v 1.109 2013/06/23 22:32:37 tom Exp $
+XCOMM $XTermId: Imakefile,v 1.110 2014/04/11 19:36:41 Ross.Combs Exp $
XCOMM
XCOMM Attention xterm porters
XCOMM
@@ -165,6 +165,9 @@ TERMCAPDEFINES=-DUSE_TERMINFO -DHAVE_TIGETSTR
#if !HasPutenv
PUTENVDEF = -DNOPUTENV
#endif
+#ifdef RegisXTerm
+ SIXELDEF = -DOPT_REGIS_GRAPHICS=1
+#endif
#ifdef SixelXTerm
SIXELDEF = -DOPT_SIXEL_GRAPHICS=1
#endif
@@ -182,9 +185,13 @@ TERMCAPDEFINES=-DUSE_TERMINFO -DHAVE_TIGETSTR
MAINSRC = main.c
MAINOBJ = main.o
+#ifdef RegisXTerm
+ SIXELSRC = graphics_regis.c
+ SIXELOBJ = graphics_regis.o
+#endif
#ifdef SixelXTerm
- SIXELSRC = graphics.c
- SIXELOBJ = graphics.o
+ SIXELSRC = graphics_sixel.c
+ SIXELOBJ = graphics_sixel.o
#endif
#ifdef TraceXTerm
TRACESRC = trace.c
diff --git a/app/xterm/MANIFEST b/app/xterm/MANIFEST
index 95ab9daa1..c140bbac5 100644
--- a/app/xterm/MANIFEST
+++ b/app/xterm/MANIFEST
@@ -1,4 +1,4 @@
-MANIFEST for xterm-301, version xterm-301
+MANIFEST for xterm-304, version xterm-304
--------------------------------------------------------------------------------
MANIFEST this file
256colres.h resource-definitions for 256-color mode
@@ -49,6 +49,10 @@ fontutils.h interface of fontutils.c
gen-pc-fkeys.pl script to generate extended function-key terminfo
graphics.c graphics support functions for 'xterm'
graphics.h interface of graphics.c
+graphics_regis.c support for ReGIS
+graphics_regis.h interface of graphics_regis.c
+graphics_sixel.c support for Sixels
+graphics_sixel.h interface of graphics_sixel.c
input.c VT100 key-symbol and function-key translation
install-sh install-script (needed by configure)
keysym2ucs.c lookup-table for UTF-8 to keysyms
diff --git a/app/xterm/Makefile b/app/xterm/Makefile
index 858503f82..288e74063 100644
--- a/app/xterm/Makefile
+++ b/app/xterm/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.23 2014/04/11 22:58:12 miod Exp $
+# $OpenBSD: Makefile,v 1.24 2014/05/09 19:56:40 matthieu Exp $
.include <bsd.xconf.mk>
SUBDIR= icons resize
@@ -9,7 +9,7 @@ MAN= xterm.1 uxterm.1 koi8rxterm.1
BINGRP= utmp
BINMODE= 2755
-CPPFLAGS+= -I${.CURDIR} -I${X11BASE}/include \
+CPPFLAGS+= -I. -I${.CURDIR} -I${X11BASE}/include \
-I${X11BASE}/include/freetype2 \
-DHAVE_CONFIG_H -DCSRG_BASED \
-DFUNCPROTO=15 -DNARROWPROTO -DXFREE86_FT2 -DUTMP \
@@ -36,6 +36,22 @@ screen.o: screen.c
${CC} -O1 -fno-stack-protector -c ${CPPFLAGS} ${.CURDIR}/screen.c
.endif
+misc.o: builtin_icons.h
+
+# do this to quiet gcc -Wcast-qual warnings
+builtin_icons.h :
+ @echo "#if OPT_BUILTIN_XPMS" >$@
+ @echo "#include <icons/mini.xterm.xpms>" >>$@
+ @echo "#include <icons/filled-xterm.xpms>" >>$@
+ @echo "#include <icons/xterm.xpms>" >>$@
+ @echo "#include <icons/xterm-color.xpms>" >>$@
+ @echo "#else" >>$@
+ @sed -e 's/static char \* /static const char * /' $(.CURDIR)/icons/mini.xterm_48x48.xpm >>$@
+ @echo "#endif" >>$@
+ @echo "made $@"
+
+beforedepend: builtin_icons.h
+
.SUFFIXES: .man .1
.man.1:
@@ -45,7 +61,7 @@ screen.o: screen.c
-e 's#__apploaddir__#${X11ETC}/app-defaults#g' \
< $< > $@
-CLEANFILES+= ${MAN}
+CLEANFILES+= ${MAN} builtin_icons.h
afterinstall:
${INSTALL} ${INSTALL_COPY} -m 755 ${.CURDIR}/uxterm \
@@ -61,6 +77,7 @@ afterinstall:
${INSTALL_DATA} ${.CURDIR}/KOI8RXTerm.ad \
${DESTDIR}${XETC}/app-defaults/KOI8RXTerm
+
obj: _xenocara_obj
.include <bsd.prog.mk>
diff --git a/app/xterm/Makefile.in b/app/xterm/Makefile.in
index cc0ac83ca..1dc71ef0c 100644
--- a/app/xterm/Makefile.in
+++ b/app/xterm/Makefile.in
@@ -1,25 +1,35 @@
-## $XTermId: Makefile.in,v 1.155 2008/01/05 14:26:52 tom Exp $
-##
-## Copyright 2002-2006,2007 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.
+## $XTermId: Makefile.in,v 1.225 2014/03/01 15:15:26 tom Exp $
+# -----------------------------------------------------------------------------
+# this file is part of xterm
+#
+# Copyright 1997-2013,2014 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.
+# -----------------------------------------------------------------------------
SHELL = /bin/sh
@@ -36,6 +46,9 @@ CPP = @CPP@
AWK = @AWK@
LINK = $(CC) $(CFLAGS)
+CTAGS = @CTAGS@
+ETAGS = @ETAGS@
+
LN_S = @LN_S@
RM = rm -f
LINT = @LINT@
@@ -50,93 +63,110 @@ EXTRA_CFLAGS = @EXTRA_CFLAGS@
EXTRA_CPPFLAGS = @EXTRA_CPPFLAGS@
EXTRA_LOADFLAGS = @IMAKE_LOADFLAGS@
-CPPFLAGS = -I. -I$(srcdir) -DHAVE_CONFIG_H @CPPFLAGS@ $(EXTRA_CPPFLAGS)
+CPPFLAGS = -I. -I$(srcdir) -DHAVE_CONFIG_H @CPPFLAGS@ -DDEFCLASS=\"@APP_CLASS@\" $(EXTRA_CPPFLAGS)
CFLAGS = @CFLAGS@ $(EXTRA_CFLAGS)
-LDFLAGS = @LDFLAGS@
+LDFLAGS = @LDFLAGS@ @EXTRA_LDFLAGS@
LIBS = @LIBS@
prefix = @prefix@
exec_prefix = @exec_prefix@
+datarootdir = @datarootdir@
+datadir = @datadir@
manext = 1
bindir = @bindir@
libdir = @libdir@
mandir = @mandir@/man$(manext)
-appsdir = @appsdir@
-icondir = @icondir@
+appsdir = @APPSDIR@
+icondir = @ICONDIR@
+pixmapdir = @PIXMAPDIR@
#### End of system configuration section. ####
-DESTDIR ?=
+ICON_NAME = @ICON_NAME@
+ICON_SYMLINK = @ICON_SYMLINK@
+
+DESTDIR =
BINDIR = $(DESTDIR)$(bindir)
LIBDIR = $(DESTDIR)$(libdir)
MANDIR = $(DESTDIR)$(mandir)
APPSDIR = $(DESTDIR)$(appsdir)
-ICONDIR = $(DESTDIR)$(icondir)
-INSTALL_DIRS = $(BINDIR) $(APPSDIR) $(ICONDIR) $(MANDIR)
+@no_icondir@ICONDIR = $(DESTDIR)$(icondir)
+@no_pixmapdir@PIXMAPDIR = $(DESTDIR)$(pixmapdir)
-CLASS = XTerm
+INSTALL_DIRS = $(BINDIR) $(APPSDIR) $(ICONDIR) $(PIXMAPDIR) $(MANDIR)
+
+CLASS = @APP_CLASS@
EXTRAHDR = @EXTRAHDRS@
EXTRASRC = @EXTRASRCS@
EXTRAOBJ = @EXTRAOBJS@
SRCS1 = button.c cachedGCs.c charproc.c charsets.c cursor.c \
data.c doublechr.c fontutils.c input.c \
- $(MAINSRC) menu.c misc.c print.c ptydata.c \
- screen.c scrollbar.c tabs.c util.c xstrings.c xtermcap.c \
- VTPrsTbl.c $(EXTRASRC)
+ linedata.c main.c menu.c misc.c \
+ print.c ptydata.c scrollback.c \
+ screen.c scrollbar.c tabs.c util.c version.c xstrings.c \
+ xtermcap.c VTPrsTbl.c $(EXTRASRC)
OBJS1 = button$o cachedGCs$o charproc$o charsets$o cursor$o \
data$o doublechr$o fontutils$o input$o \
- main$o menu$o misc$o print$o ptydata$o \
- screen$o scrollbar$o tabs$o util$o xstrings$o xtermcap$o \
- VTPrsTbl$o $(EXTRAOBJ)
- SRCS2 = resize.c xstrings.c
- OBJS2 = resize$o xstrings$o
+ linedata$o main$o menu$o misc$o \
+ print$o ptydata$o scrollback$o \
+ screen$o scrollbar$o tabs$o util$o version$o xstrings$o \
+ xtermcap$o VTPrsTbl$o $(EXTRAOBJ)
+ SRCS2 = resize.c version.c xstrings.c
+ OBJS2 = resize$o version$o xstrings$o
SRCS = $(SRCS1) $(SRCS2)
OBJS = $(OBJS1) $(OBJS2)
- HDRS = VTparse.h data.h error.h main.h menu.h proto.h \
+ HDRS = VTparse.h data.h error.h main.h menu.h \
ptyx.h version.h xstrings.h xterm.h xtermcap.h $(EXTRAHDR)
PROGRAMS = xterm$x resize$x
all : $(PROGRAMS)
################################################################################
-.SUFFIXES : .i .def .hin .html .$(manext) .ms .man .ps .pdf .txt
+.SUFFIXES : .i .def .hin .$(manext) .ms .man .txt @GROFF_NOTE@ .html .ps .pdf
.c$o :
-@RULE_CC@
+ @RULE_CC@
@ECHO_CC@$(CC) $(CPPFLAGS) $(CFLAGS) -c $(srcdir)/$*.c
.c.i :
-@RULE_CC@
+ @RULE_CC@
@ECHO_CC@$(CPP) -C $(CPPFLAGS) $*.c >$@
.def.hin :
grep '^CASE_' $< | $(AWK) '{printf "#define %s %d\n", $$1, n++}' >$@
.man.$(manext) :
- $(SHELL) $(srcdir)/minstall.sh "$(INSTALL_DATA)" $(srcdir)/xterm.man $@ $(appsdir)
-
-.$(manext).html :
- GROFF_NO_SGR=stupid $(SHELL) -c "tbl $*.$(manext) | groff -Thtml -man" >$@
-
-.$(manext).ps :
- $(SHELL) -c "tbl $*.$(manext) | groff -man" >$@
-
-.$(manext).txt :
- GROFF_NO_SGR=stupid $(SHELL) -c "tbl $*.$(manext) | nroff -Tascii -man | col -bx" >$@
-
-.ms.html :
- GROFF_NO_SGR=stupid $(SHELL) -c "tbl $*.ms | groff -Thtml -ms" >$@
-
-.ms.ps :
- $(SHELL) -c "tbl $*.ms | groff -ms" >$@
-
-.ms.txt :
- GROFF_NO_SGR=stupid $(SHELL) -c "tbl $*.ms | nroff -Tascii -ms | col -bx" >$@
-
-.ps.pdf :
- ps2pdf $*.ps
+ $(SHELL) ./minstall "$(INSTALL_DATA)" $< $@ $(appsdir) $(CLASS) $* $* $(pixmapdir)
+
+@NROFF_NOTE@.$(manext).txt :
+@NROFF_NOTE@ $(SHELL) -c "tbl $*.$(manext) | nroff -man | col -bx" >$@
+@NROFF_NOTE@
+@NROFF_NOTE@.ms.txt :
+@NROFF_NOTE@ $(SHELL) -c "tbl $*.$(manext) | nroff -ms | col -bx" >$@
+@NROFF_NOTE@
+
+@GROFF_NOTE@.$(manext).html :
+@GROFF_NOTE@ GROFF_NO_SGR=stupid $(SHELL) -c "tbl $*.$(manext) | groff -P -o0 -I$*_ -Thtml -man" >$@
+@GROFF_NOTE@
+@GROFF_NOTE@.$(manext).ps :
+@GROFF_NOTE@ $(SHELL) -c "tbl $*.$(manext) | groff -man" >$@
+@GROFF_NOTE@
+@GROFF_NOTE@.$(manext).txt :
+@GROFF_NOTE@ GROFF_NO_SGR=stupid $(SHELL) -c "tbl $*.$(manext) | groff -Tascii -man | col -bx" >$@
+@GROFF_NOTE@
+@GROFF_NOTE@.ms.html :
+@GROFF_NOTE@ GROFF_NO_SGR=stupid $(SHELL) -c "tbl $< | groff -P -o0 -I$*_ -Thtml -ms" >$@
+@GROFF_NOTE@
+@GROFF_NOTE@.ms.ps :
+@GROFF_NOTE@ $(SHELL) -c "tbl $< | groff -ms" >$@
+@GROFF_NOTE@
+@GROFF_NOTE@.ms.txt :
+@GROFF_NOTE@ GROFF_NO_SGR=stupid $(SHELL) -c "tbl $< | groff -Tascii -ms | col -bx" >$@
+@GROFF_NOTE@
+@GROFF_NOTE@.ps.pdf :
+@GROFF_NOTE@ ps2pdf $*.ps
################################################################################
main$o : main.h
misc$o : version.h
@@ -145,7 +175,7 @@ $(OBJS1) : xterm.h ptyx.h xtermcfg.h
main$o resize$o screen$o : xterm_io.h
xterm$x : $(OBJS1)
- @ECHO_LD@$(LINK) $(LDFLAGS) -o $@ $(OBJS1) $(LIBS) $(EXTRA_LOADFLAGS)
+ @ECHO_LD@$(SHELL) $(srcdir)/plink.sh $(LINK) $(LDFLAGS) -o $@ $(OBJS1) $(LIBS) $(EXTRA_LOADFLAGS)
resize$x : $(OBJS2)
@ECHO_LD@$(SHELL) $(srcdir)/plink.sh $(LINK) $(LDFLAGS) -o $@ $(OBJS2) $(LIBS)
@@ -159,6 +189,21 @@ resize$x : $(OBJS2)
perl $(srcdir)/88colres.pl > $@
charproc$o : main.h @CHARPROC_DEPS@
+
+misc$o : builtin_icons.h
+
+# do this to quiet gcc -Wcast-qual warnings
+builtin_icons.h :
+ @echo "#if OPT_BUILTIN_XPMS" >$@
+ @echo "#include <icons/mini.xterm.xpms>" >>$@
+ @echo "#include <icons/filled-xterm.xpms>" >>$@
+ @echo "#include <icons/xterm.xpms>" >>$@
+ @echo "#include <icons/xterm-color.xpms>" >>$@
+ @echo "#else" >>$@
+ @sed -e 's/static char \* /static const char * /' $(srcdir)/icons/mini.xterm_48x48.xpm >>$@
+ @echo "#endif" >>$@
+ @echo "made $@"
+
################################################################################
actual_xterm = `echo xterm| sed '$(transform)'`
actual_resize = `echo resize| sed '$(transform)'`
@@ -176,66 +221,123 @@ install-full :: xterm$x resize$x $(BINDIR)
@MAY_SETUID@ $(SHELL) $(srcdir)/sinstall.sh @SINSTALL_OPTS@ "$(INSTALL_PROGRAM)" xterm$x @XTERM_PATH@ $(BINDIR)/$(binary_xterm)
@NOT_SETUID@ $(INSTALL_PROGRAM) xterm$x $(BINDIR)/$(binary_xterm)
$(INSTALL_PROGRAM) -m 755 resize$x $(BINDIR)/$(binary_resize)
- @$(SHELL) -c 'echo "... installing $(BINDIR)/$(binary_uxterm)"; \
- if test "$(binary_xterm)" != "xterm"; then \
- name="$(binary_xterm)"; \
- sed -e "s,=xterm,=$$name," $(srcdir)/uxterm >uxterm.tmp; \
- $(INSTALL_SCRIPT) -m 755 uxterm.tmp $(BINDIR)/$(binary_uxterm); \
- rm -f uxterm.tmp; \
- else \
- $(INSTALL_SCRIPT) -m 755 $(srcdir)/uxterm $(BINDIR)/$(binary_uxterm); \
- fi'
- @$(SHELL) -c 'echo "... installing $(BINDIR)/$(binary_k8term)"; \
- if test "$(binary_xterm)" != "xterm"; then \
- name="$(binary_xterm)"; \
- sed -e "s,=xterm,=$$name," $(srcdir)/koi8rxterm >k8term.tmp; \
- $(INSTALL_SCRIPT) -m 755 k8term.tmp $(BINDIR)/$(binary_k8term); \
- rm -f k8term.tmp; \
- else \
- $(INSTALL_SCRIPT) -m 755 $(srcdir)/koi8rxterm $(BINDIR)/$(binary_k8term); \
- fi'
- @-$(SHELL) -c "if test @XTERM_SYMLINK@ != NONE ; then cd $(BINDIR) && rm -f @XTERM_SYMLINK@ ; fi"
- @-$(SHELL) -c "if test @XTERM_SYMLINK@ != NONE ; then cd $(BINDIR) && $(LN_S) $(binary_xterm) @XTERM_SYMLINK@ ; fi"
- @-$(SHELL) -c "if test @XTERM_SYMLINK@ != NONE ; then cd $(BINDIR) && echo '... created symbolic link:' && ls -l $(binary_xterm) @XTERM_SYMLINK@ ; fi"
+
+EDIT_SCRIPT = sed -e s,=xterm,=\$$name, -e s,XTerm,$(CLASS),
+
+install \
+install-bin \
+install-scripts \
+install-full ::
+ @$(SHELL) -c "name=\"$(binary_xterm)\"; \
+ dest=\"$(binary_uxterm)\"; \
+ echo \"... installing $(BINDIR)/\$$dest\"; \
+ $(EDIT_SCRIPT) $(srcdir)/uxterm >uxterm.tmp; \
+ $(INSTALL_SCRIPT) -m 755 uxterm.tmp $(BINDIR)/\$$dest; \
+ rm -f uxterm.tmp"
+ @$(SHELL) -c "name=\"$(binary_xterm)\"; \
+ dest=\"$(binary_k8term)\"; \
+ echo \"... installing $(BINDIR)/\$$dest\"; \
+ $(EDIT_SCRIPT) $(srcdir)/koi8rxterm >k8term.tmp; \
+ $(INSTALL_SCRIPT) -m 755 k8term.tmp $(BINDIR)/\$$dest; \
+ rm -f k8term.tmp"
+ @-$(SHELL) -c "name=\"$(binary_xterm)\"; \
+ if test @XTERM_SYMLINK@ != NONE ; then \
+ cd $(BINDIR) && ( \
+ rm -f @XTERM_SYMLINK@ ; \
+ $(LN_S) \$$name @XTERM_SYMLINK@ ; \
+ echo \"... created symbolic link:\" ; \
+ ls -l \$$name @XTERM_SYMLINK@ ) ; \
+ fi"
install \
install-man \
install-full :: $(MANDIR)
- $(SHELL) $(srcdir)/minstall.sh "$(INSTALL_DATA)" $(srcdir)/xterm.man $(MANDIR)/$(actual_xterm).$(manext) $(appsdir)
- $(SHELL) $(srcdir)/minstall.sh "$(INSTALL_DATA)" $(srcdir)/resize.man $(MANDIR)/$(actual_resize).$(manext) $(appsdir)
- $(SHELL) $(srcdir)/minstall.sh "$(INSTALL_DATA)" $(srcdir)/uxterm.man $(MANDIR)/$(actual_uxterm).$(manext) $(appsdir)
- $(SHELL) $(srcdir)/minstall.sh "$(INSTALL_DATA)" $(srcdir)/koi8rxterm.man $(MANDIR)/$(actual_k8term).$(manext) $(appsdir)
+ @-$(SHELL) -c "for app in xterm resize uxterm koi8rxterm ; \
+ do \
+ actual=\`echo \"\$$app\" | sed '@program_transform_name@'\`; \
+ $(SHELL) ./minstall \"$(INSTALL_DATA)\" $(srcdir)/\$$app.man $(MANDIR)/\$$actual.$(manext) $(appsdir) $(CLASS) \$$app \$$actual $(pixmapdir); \
+ done"
@-$(SHELL) -c "if test @XTERM_SYMLINK@ != NONE ; then cd $(MANDIR) && rm -f @XTERM_SYMLINK@.$(manext) ; fi"
@-$(SHELL) -c "if test @XTERM_SYMLINK@ != NONE ; then cd $(MANDIR) && $(LN_S) $(actual_xterm).$(manext) @XTERM_SYMLINK@.$(manext) ; fi"
@-$(SHELL) -c "if test @XTERM_SYMLINK@ != NONE ; then cd $(MANDIR) && echo '... created symbolic link:' && ls -l $(actual_xterm).$(manext) @XTERM_SYMLINK@.$(manext) ; fi"
+APP_NAMES = XTerm UXTerm KOI8RXTerm
+
@no_appsdir@install \
@no_appsdir@install-app \
@no_appsdir@install-full :: $(APPSDIR)
-@no_appsdir@ @echo installing $(APPSDIR)/$(CLASS)
-@no_appsdir@ @sed -e s/XTerm/$(CLASS)/ $(srcdir)/XTerm.ad >XTerm.tmp
-@no_appsdir@ @$(INSTALL_DATA) XTerm.tmp $(APPSDIR)/$(CLASS)
-@no_appsdir@ @echo installing $(APPSDIR)/$(CLASS)-color
-@no_appsdir@ @sed -e s/XTerm/$(CLASS)/ $(srcdir)/XTerm-col.ad >XTerm.tmp
-@no_appsdir@ @$(INSTALL_DATA) XTerm.tmp $(APPSDIR)/$(CLASS)-color
-@no_appsdir@ @echo installing $(APPSDIR)/UXTerm
-@no_appsdir@ @sed -e s/XTerm/$(CLASS)/ $(srcdir)/UXTerm.ad >XTerm.tmp
-@no_appsdir@ @$(INSTALL_DATA) XTerm.tmp $(APPSDIR)/UXTerm
-@no_appsdir@ @echo installing $(APPSDIR)/KOI8RXTerm
-@no_appsdir@ @sed -e s/XTerm/$(CLASS)/ $(srcdir)/KOI8RXTerm.ad >XTerm.tmp
-@no_appsdir@ @$(INSTALL_DATA) XTerm.tmp $(APPSDIR)/KOI8RXTerm
+@no_appsdir@ @-$(SHELL) -c 'for s in $(APP_NAMES); \
+@no_appsdir@ do \
+@no_appsdir@ echo "** $$s"; \
+@no_appsdir@ d=`echo $$s | sed -e s/XTerm/$(CLASS)/`; \
+@no_appsdir@ echo installing $(APPSDIR)/$$d; \
+@no_appsdir@ sed -e s/XTerm/$(CLASS)/ $(srcdir)/$$s.ad >XTerm.tmp; \
+@no_appsdir@ $(INSTALL_DATA) XTerm.tmp $(APPSDIR)/$$d; \
+@no_appsdir@ echo installing $(APPSDIR)/$$d-color; \
+@no_appsdir@ sed -e s/XTerm/$$d/ $(srcdir)/XTerm-col.ad >XTerm.tmp; \
+@no_appsdir@ $(INSTALL_DATA) XTerm.tmp $(APPSDIR)/$$d-color; \
+@no_appsdir@ done'
@no_appsdir@ @rm -f XTerm.tmp
@no_icondir@ @echo "... installed app-defaults"
+@no_icondir@ICON_LIST = @ICON_LIST@
+@no_icondir@ICON_THEME = @ICON_THEME@
@no_icondir@install \
@no_icondir@install-icon \
@no_icondir@install-full :: $(ICONDIR)
-@no_icondir@ @$(INSTALL_DATA) $(srcdir)/icons/xterm-color_32x32.xpm $(ICONDIR)
-@no_icondir@ @$(INSTALL_DATA) $(srcdir)/icons/xterm-color_48x48.xpm $(ICONDIR)
-@no_icondir@ @$(INSTALL_DATA) $(srcdir)/icons/xterm_32x32.xpm $(ICONDIR)
-@no_icondir@ @$(INSTALL_DATA) $(srcdir)/icons/xterm_48x48.xpm $(ICONDIR)
+@no_icondir@ ACTUAL_XTERM=$(actual_xterm) \
+@no_icondir@ $(SHELL) -c '\
+@no_icondir@ h=$(ICONDIR)/$(ICON_THEME); \
+@no_icondir@ for n in $(ICON_LIST); \
+@no_icondir@ do \
+@no_icondir@ x=$$ACTUAL_XTERM; \
+@no_icondir@ l=`echo "$$n" | cut -f1 -d:`; \
+@no_icondir@ r=`echo "$$n" | cut -f2 -d: |sed -e s,$(ICON_NAME),$$x-color,`; \
+@no_icondir@ test -z "$$r" && continue; \
+@no_icondir@ d=$$h/`echo "$$r" | sed -e "s,/[^/]*$$,,"`; \
+@no_icondir@ test -d "$$d" || mkdir -p "$$d"; \
+@no_icondir@ echo "installing icon $$h/$$r"; \
+@no_icondir@ $(INSTALL_DATA) $$l $$h/$$r; \
+@no_icondir@ s=`echo "$$r" | sed -e '"'s,^.*\.,.,'"'`; \
+@no_icondir@ t=$(ICON_SYMLINK)$$s; \
+@no_icondir@ b=`basename $$n $$s | sed -e "s,_[1-9][0-9]*x.*,,"`; \
+@no_icondir@ if test "$(ICON_SYMLINK)" != NONE ; then \
+@no_icondir@ if test "$$r" != "$$t" ; then \
+@no_icondir@ if test "x$$b" = "x$(ICON_NAME)" ; then \
+@no_icondir@ echo "linking $$r -> $$t"; \
+@no_icondir@ ( cd $$h; rm -f $$t; $(LN_S) $$r $$t; ) \
+@no_icondir@ fi \
+@no_icondir@ fi \
+@no_icondir@ fi \
+@no_icondir@ done'
@no_icondir@ @echo "... installed icons"
+@no_pixmapdir@install \
+@no_pixmapdir@install-icon \
+@no_pixmapdir@install-full :: $(PIXMAPDIR)
+@no_pixmapdir@ ACTUAL_XTERM=$(actual_xterm) \
+@no_pixmapdir@ $(SHELL) -c '\
+@no_pixmapdir@ h=$(PIXMAPDIR); \
+@no_pixmapdir@ for n in $(srcdir)/icons/*xterm*_32x32.xpm $(srcdir)/icons/*xterm*_48x48.xpm; \
+@no_pixmapdir@ do \
+@no_pixmapdir@ l=`basename $$n`; \
+@no_pixmapdir@ r=`echo "$$l" | sed -e "s,xterm,$$ACTUAL_XTERM,"`; \
+@no_pixmapdir@ echo "installing pixmap $$h/$$r"; \
+@no_pixmapdir@ $(INSTALL_DATA) $(srcdir)/icons/$$l $$h/$$r; \
+@no_pixmapdir@ s=`echo "$$r" | sed -e '"'s,^.*\.,.,'"'`; \
+@no_pixmapdir@ t=$(ICON_SYMLINK)$$s; \
+@no_pixmapdir@ b=`basename $$n $$s | sed -e "s,_[1-9][0-9]*x.*,,"`; \
+@no_pixmapdir@ if test "$(ICON_SYMLINK)" != NONE ; then \
+@no_pixmapdir@ if test "x$$r" != "$$t" ; then \
+@no_pixmapdir@ if test "x$$b" = "x$(ICON_NAME)" ; then \
+@no_pixmapdir@ echo "linking $$r -> $$t"; \
+@no_pixmapdir@ ( cd $$h; rm -f $$t; $(LN_S) $$r $$t; ) \
+@no_pixmapdir@ fi \
+@no_pixmapdir@ fi \
+@no_pixmapdir@ fi \
+@no_pixmapdir@ done'
+@no_pixmapdir@ @echo "... installed icons"
+
install ::
@echo 'Completed installation of executables and documentation.'
@echo 'Use "make install-ti" to install terminfo description.'
@@ -243,10 +345,10 @@ install ::
TERMINFO_DIR = @TERMINFO_DIR@
SET_TERMINFO = @SET_TERMINFO@
-install-full \
-install-ti :: $(TERMINFO_DIR)
- @$(SHELL) -c "$(SET_TERMINFO) $(srcdir)/run-tic.sh $(srcdir)/terminfo"
- @echo 'Completed installation of terminfo description.'
+@no_ticprog@install-full \
+@no_ticprog@install-ti :: $(TERMINFO_DIR)
+@no_ticprog@ @$(SHELL) -c "$(SET_TERMINFO) $(srcdir)/run-tic.sh $(srcdir)/terminfo"
+@no_ticprog@ @echo 'Completed installation of terminfo description.'
install-full \
install-tc ::
@@ -259,9 +361,14 @@ uninstall-bin \
uninstall-full ::
-$(RM) $(BINDIR)/$(binary_xterm)
-$(RM) $(BINDIR)/$(binary_resize)
+ @-$(SHELL) -c "if test @XTERM_SYMLINK@ != NONE ; then cd $(BINDIR) && rm -f @XTERM_SYMLINK@; fi"
+
+uninstall \
+uninstall-bin \
+uninstall-scripts \
+uninstall-full ::
-$(RM) $(BINDIR)/$(binary_uxterm)
-$(RM) $(BINDIR)/$(binary_k8term)
- @-$(SHELL) -c "if test @XTERM_SYMLINK@ != NONE ; then cd $(BINDIR) && rm -f @XTERM_SYMLINK@; fi"
uninstall \
uninstall-man \
@@ -275,35 +382,70 @@ uninstall-full ::
@no_appsdir@uninstall \
@no_appsdir@uninstall-app \
@no_appsdir@uninstall-full ::
-@no_appsdir@ -$(RM) $(APPSDIR)/$(CLASS)
-@no_appsdir@ -$(RM) $(APPSDIR)/$(CLASS)-color
-@no_appsdir@ -$(RM) $(APPSDIR)/UXTerm
+@no_appsdir@ @-$(SHELL) -c 'for s in $(APP_NAMES); \
+@no_appsdir@ do \
+@no_appsdir@ echo "** $$s"; \
+@no_appsdir@ d=`echo $$s | sed -e s/XTerm/$(CLASS)/`; \
+@no_appsdir@ echo uninstalling $(APPSDIR)/$$d; \
+@no_appsdir@ $(RM) $(APPSDIR)/$$d; \
+@no_appsdir@ echo uninstalling $(APPSDIR)/$$d-color; \
+@no_appsdir@ $(RM) $(APPSDIR)/$$d-color; \
+@no_appsdir@ done'
@no_icondir@uninstall \
@no_icondir@uninstall-icon \
@no_icondir@uninstall-full ::
-@no_icondir@ -$(RM) $(ICONDIR)/xterm-color_32x32.xpm
-@no_icondir@ -$(RM) $(ICONDIR)/xterm_32x32.xpm
-@no_icondir@ -$(RM) $(ICONDIR)/xterm-color_48x48.xpm
-@no_icondir@ -$(RM) $(ICONDIR)/xterm_48x48.xpm
+@no_icondir@ -@$(SHELL) -c 'for n in $(ICON_LIST); \
+@no_icondir@ do \
+@no_icondir@ x=$(actual_xterm); \
+@no_icondir@ r=`echo "$$n" | sed -e s,\^.\*:,, -e s,xterm,$$x,`; \
+@no_icondir@ test -z "$$r" && continue; \
+@no_icondir@ h=$(ICONDIR)/$(ICON_THEME); \
+@no_icondir@ echo removing $$h/$$r; \
+@no_icondir@ $(RM) $$h/$$r; \
+@no_icondir@ done'
+@no_icondir@ @echo "... removed icons"
+
+@no_pixmapdir@uninstall \
+@no_pixmapdir@uninstall-icon \
+@no_pixmapdir@uninstall-full ::
+@no_pixmapdir@ ACTUAL_XTERM=$(actual_xterm) \
+@no_pixmapdir@ $(SHELL) -c 'for n in $(srcdir)/icons/*xterm*_32x32.xpm $(srcdir)/icons/*xterm*_48x48.xpm; \
+@no_pixmapdir@ do \
+@no_pixmapdir@ l=`basename $$n`; \
+@no_pixmapdir@ r=`echo "$$l" | sed -e "s,xterm,$$ACTUAL_XTERM,"`; \
+@no_pixmapdir@ echo removing $(PIXMAPDIR)/$$r; \
+@no_pixmapdir@ $(RM) $(PIXMAPDIR)/$$r; \
+@no_pixmapdir@ done'
+@no_pixmapdir@ @echo "... removed icons"
################################################################################
# Desktop-utils does not provide an uninstall, and is not uniformly available.
+@desktop_utils@DESKTOP_FILES = $(srcdir)/xterm.desktop $(srcdir)/uxterm.desktop
@desktop_utils@DESKTOP_FLAGS = @DESKTOP_FLAGS@
@desktop_utils@install-desktop \
@desktop_utils@install-full ::
-@desktop_utils@ desktop-file-install $(DESKTOP_FLAGS) xterm.desktop
-@desktop_utils@ desktop-file-install $(DESKTOP_FLAGS) uxterm.desktop
+@desktop_utils@ ACTUAL_XTERM=$(actual_xterm) \
+@desktop_utils@ $(SHELL) -c 'for n in $(DESKTOP_FILES); \
+@desktop_utils@ do $(SHELL) df-install $$ACTUAL_XTERM $(DESKTOP_FLAGS) $$n; \
+@desktop_utils@ done'
################################################################################
mostlyclean :
-$(RM) *$o *.[is] XtermLog.* .pure core *~ *.bak *.BAK *.out *.tmp
clean : mostlyclean
- -$(RM) $(PROGRAMS)
+ -$(RM) $(PROGRAMS) builtin_icons.h
-distclean : clean
+distclean :: clean
-$(RM) Makefile config.status config.cache config.log xtermcfg.h
+ -$(RM) df-install minstall
+
+distclean \
+docs-clean ::
-$(RM) *.ps *.pdf *.png
- -$(RM) xterm.html xterm.$(manext) xterm.txt
+ -$(SHELL) -c 'for p in xterm resize uxterm koi8rxterm; \
+ do \
+ $(RM) $$p.html $$p.$(manext) $$p.txt; \
+ done'
-$(RM) ctlseqs.html ctlseqs.$(manext)
realclean : distclean
@@ -315,28 +457,58 @@ maintainer-clean : realclean
terminfo.out : terminfo ; tic -a -I -1 terminfo >$@
termcap.out : termcap ; tic -a -C -U termcap >$@
################################################################################
-ctlseqs.html : ctlseqs.ms
+docs-ctlseqs \
+docs :: \
+ $(srcdir)/ctlseqs.txt \
+@GROFF_NOTE@ ctlseqs.html \
+@GROFF_NOTE@ ctlseqs.pdf \
+@GROFF_NOTE@ ctlseqs.ps
+
+ctlseqs.html : $(srcdir)/ctlseqs.ms
ctlseqs.pdf : ctlseqs.ps
-ctlseqs.ps : ctlseqs.ms
-ctlseqs.txt : ctlseqs.ms
+ctlseqs.ps : $(srcdir)/ctlseqs.ms
+ctlseqs.txt : $(srcdir)/ctlseqs.ms
################################################################################
+docs-resize \
+docs :: resize.txt @GROFF_NOTE@ resize.html resize.pdf resize.ps
+resize.html : resize.$(manext)
+resize.pdf : resize.ps
+resize.ps : resize.$(manext)
+resize.txt : resize.$(manext)
+################################################################################
+docs-xterm \
+docs :: xterm.txt @GROFF_NOTE@ xterm.html xterm.pdf xterm.ps
xterm.html : xterm.$(manext)
xterm.pdf : xterm.ps
xterm.ps : xterm.$(manext)
xterm.txt : xterm.$(manext)
################################################################################
+docs-uxterm \
+docs :: uxterm.txt @GROFF_NOTE@ uxterm.html uxterm.pdf uxterm.ps
+uxterm.html : uxterm.$(manext)
+uxterm.pdf : uxterm.ps
+uxterm.ps : uxterm.$(manext)
+uxterm.txt : uxterm.$(manext)
+################################################################################
+docs-koi8rxterm \
+docs :: koi8rxterm.txt @GROFF_NOTE@ koi8rxterm.html koi8rxterm.pdf koi8rxterm.ps
+koi8rxterm.html : koi8rxterm.$(manext)
+koi8rxterm.pdf : koi8rxterm.ps
+koi8rxterm.ps : koi8rxterm.$(manext)
+koi8rxterm.txt : koi8rxterm.$(manext)
+################################################################################
lint :
$(LINT) $(CPPFLAGS) $(SRCS1)
$(LINT) $(CPPFLAGS) $(SRCS2)
tags :
- ctags $(SRCS) $(HDRS)
+ $(CTAGS) $(SRCS) $(HDRS)
TAGS :
- etags $(SRCS) $(HDRS)
+ $(ETAGS) $(SRCS) $(HDRS)
$(TERMINFO_DIR) $(INSTALL_DIRS) :
- $(SHELL) ${srcdir}/mkdirs.sh $@
+ mkdir -p $@
ALWAYS :
diff --git a/app/xterm/THANKS b/app/xterm/THANKS
index a38ebf9a1..1b8374046 100644
--- a/app/xterm/THANKS
+++ b/app/xterm/THANKS
@@ -1,4 +1,4 @@
--- $XTermId: THANKS,v 1.11 2013/08/08 08:24:07 tom Exp $
+-- $XTermId: THANKS,v 1.12 2014/03/03 19:31:41 tom Exp $
-- vile:txtmode fk=8bit
There's no AUTHORS file in this distribution; it would be redundant since
I (Thomas E. Dickey) have done more than 80% of the work on xterm since 1996.
@@ -13,6 +13,7 @@ Here's a list from xterm.log.html of people who have contributed changes.
Adam M Costello
Adam Sulmicki
Ailin Nemui
+Al Poole
Alan Coopersmith
Alex Hornung
Alexander Pohoyda
@@ -23,6 +24,7 @@ Andreas Schwab
Andres Perera
Andrew Sumner
Andrew Tipton
+Andrey Panov
Andries E Brouwer
Anton Kovalenko
Balazs Kezes
@@ -155,6 +157,7 @@ Rob Braun
Robert Brady
Robert Earl
Robin Cutshaw
+Romain Francois
Ross Combs
Ross Paterson
Ryan Johnson
@@ -184,6 +187,7 @@ Tomohiro Kubota
Tor Lillqvist
Torrey Lyons
Victor Stinner
+Vincent Lefevre
Werner Lemberg
Will Day
Zdenek Sekera
diff --git a/app/xterm/Tekproc.c b/app/xterm/Tekproc.c
index 74521eb3a..065ef23e0 100644
--- a/app/xterm/Tekproc.c
+++ b/app/xterm/Tekproc.c
@@ -1,7 +1,7 @@
-/* $XTermId: Tekproc.c,v 1.194 2012/09/07 09:08:44 tom Exp $ */
+/* $XTermId: Tekproc.c,v 1.196 2014/04/12 00:55:22 tom Exp $ */
/*
- * Copyright 2001-2011,2012 by Thomas E. Dickey
+ * Copyright 2001-2012,2014 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -144,7 +144,7 @@
#define input() Tinput(tw)
#define unput(c) *Tpushback++ = (Char) c
/* *INDENT-OFF* */
-static struct Tek_Char {
+static const struct Tek_Char {
int hsize; /* in Tek units */
int vsize; /* in Tek units */
int charsperline;
@@ -187,8 +187,8 @@ static char defaultTranslations[] = "\
~Meta<Btn3Down>: gin-press(r)";
/* *INDENT-OFF* */
static XtActionsRec actionsList[] = {
- { "string", HandleStringEvent },
- { "insert", HandleKeyPressed }, /* alias for insert-seven-bit */
+ { "string", HandleStringEvent },
+ { "insert", HandleKeyPressed }, /* alias for insert-seven-bit */
{ "insert-seven-bit", HandleKeyPressed },
{ "insert-eight-bit", HandleEightBitKeyPressed },
{ "gin-press", HandleGINInput },
@@ -1082,7 +1082,7 @@ static void
TCursorBack(TekWidget tw)
{
TekScreen *tekscr = TekScreenOf(tw);
- struct Tek_Char *t;
+ const struct Tek_Char *t;
int x, l;
x = (tekscr->cur_X -=
@@ -1105,7 +1105,7 @@ static void
TCursorForward(TekWidget tw)
{
TekScreen *tekscr = TekScreenOf(tw);
- struct Tek_Char *t;
+ const struct Tek_Char *t;
int l;
if ((tekscr->cur_X +=
@@ -1125,7 +1125,7 @@ static void
TCursorUp(TekWidget tw)
{
TekScreen *tekscr = TekScreenOf(tw);
- struct Tek_Char *t;
+ const struct Tek_Char *t;
int l;
t = &TekChar[tekscr->cur.fontsize];
@@ -1145,7 +1145,7 @@ static void
TCursorDown(TekWidget tw)
{
TekScreen *tekscr = TekScreenOf(tw);
- struct Tek_Char *t;
+ const struct Tek_Char *t;
int l;
t = &TekChar[tekscr->cur.fontsize];
@@ -1336,7 +1336,7 @@ TekRun(void)
#define SHORT_DASHED_LENGTH 2
#define LONG_DASHED_LENGTH 2
-static int dash_length[TEKNUMLINES] =
+static const int dash_length[TEKNUMLINES] =
{
DOTTED_LENGTH,
DOT_DASHED_LENGTH,
@@ -1344,16 +1344,16 @@ static int dash_length[TEKNUMLINES] =
LONG_DASHED_LENGTH,
};
-static unsigned char dotted[DOTTED_LENGTH] =
+static _Xconst char dotted[DOTTED_LENGTH] =
{3, 1};
-static unsigned char dot_dashed[DOT_DASHED_LENGTH] =
+static _Xconst char dot_dashed[DOT_DASHED_LENGTH] =
{3, 4, 3, 1};
-static unsigned char short_dashed[SHORT_DASHED_LENGTH] =
+static _Xconst char short_dashed[SHORT_DASHED_LENGTH] =
{4, 4};
-static unsigned char long_dashed[LONG_DASHED_LENGTH] =
+static _Xconst char long_dashed[LONG_DASHED_LENGTH] =
{4, 7};
-static unsigned char *dashes[TEKNUMLINES] =
+static _Xconst char *dashes[TEKNUMLINES] =
{
dotted,
dot_dashed,
@@ -1610,7 +1610,7 @@ TekRealize(Widget gw,
tekscr->linepat[i] = XCreateGC(XtDisplay(tw), TWindow(tekscr),
(GCForeground | GCLineStyle), &gcv);
XSetDashes(XtDisplay(tw), tekscr->linepat[i], 0,
- (char *) dashes[i], dash_length[i]);
+ dashes[i], dash_length[i]);
}
TekBackground(tw, screen);
@@ -1730,7 +1730,7 @@ TekSetFontSize(TekWidget tw, Bool fromMenu, int newitem)
}
void
-ChangeTekColors(TekWidget tw, TScreen * screen, ScrnColors * pNew)
+ChangeTekColors(TekWidget tw, TScreen *screen, ScrnColors * pNew)
{
TekScreen *tekscr = TekScreenOf(tw);
int i;
@@ -1819,7 +1819,7 @@ TekReverseVideo(TekWidget tw)
}
static void
-TekBackground(TekWidget tw, TScreen * screen)
+TekBackground(TekWidget tw, TScreen *screen)
{
TekScreen *tekscr = TekScreenOf(tw);
@@ -1939,7 +1939,7 @@ TekCopy(TekWidget tw)
void
HandleGINInput(Widget w,
XEvent * event GCC_UNUSED,
- String * param_list,
+ String *param_list,
Cardinal *nparamsp)
{
XtermWidget xw = term;
diff --git a/app/xterm/VTPrsTbl.c b/app/xterm/VTPrsTbl.c
index 9f67957c8..41e79015b 100644
--- a/app/xterm/VTPrsTbl.c
+++ b/app/xterm/VTPrsTbl.c
@@ -1,7 +1,7 @@
-/* $XTermId: VTPrsTbl.c,v 1.73 2013/08/21 23:50:44 tom Exp $ */
+/* $XTermId: VTPrsTbl.c,v 1.79 2014/05/02 23:32:27 tom Exp $ */
/*
- * Copyright 1999-2012,2013 by Thomas E. Dickey
+ * Copyright 1999-2013,2014 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -1946,8 +1946,8 @@ CASE_CSI_IGNORE,
CASE_CSI_IGNORE,
CASE_CSI_IGNORE,
/* Agrave Aacute Acircumflex Atilde */
-CASE_GROUND_STATE,
-CASE_GROUND_STATE,
+CASE_SL,
+CASE_SR,
CASE_GROUND_STATE,
CASE_GROUND_STATE,
/* Adiaeresis Aring AE Ccedilla */
@@ -3110,7 +3110,7 @@ CASE_GROUND_STATE,
CASE_GROUND_STATE,
CASE_GROUND_STATE,
CASE_GROUND_STATE,
-CASE_GROUND_STATE,
+CASE_GRAPHICS_ATTRIBUTES,
/* T U V W */
CASE_GROUND_STATE,
CASE_GROUND_STATE,
@@ -3270,7 +3270,7 @@ CASE_GROUND_STATE,
CASE_GROUND_STATE,
CASE_GROUND_STATE,
CASE_GROUND_STATE,
-CASE_GROUND_STATE,
+CASE_GRAPHICS_ATTRIBUTES,
/* Ocircumflex Otilde Odiaeresis multiply */
CASE_GROUND_STATE,
CASE_GROUND_STATE,
@@ -3917,12 +3917,12 @@ CASE_GROUND_STATE,
CASE_GROUND_STATE,
CASE_GROUND_STATE,
/* Eth Ntilde Ograve Oacute */
-CASE_RM_TITLE,
CASE_GROUND_STATE,
CASE_GROUND_STATE,
CASE_GROUND_STATE,
-/* Ocircumflex Otilde Odiaeresis multiply */
CASE_GROUND_STATE,
+/* Ocircumflex Otilde Odiaeresis multiply */
+CASE_RM_TITLE,
CASE_GROUND_STATE,
CASE_GROUND_STATE,
CASE_GROUND_STATE,
@@ -7446,14 +7446,14 @@ CASE_ESC_IGNORE,
CASE_ESC_IGNORE,
CASE_ESC_IGNORE,
/* degree plusminus twosuperior threesuperior */
+CASE_GSETS_PERCENT,
CASE_GROUND_STATE,
-CASE_GROUND_STATE,
-CASE_GROUND_STATE,
-CASE_GROUND_STATE,
+CASE_GSETS_PERCENT,
+CASE_GSETS_PERCENT,
/* acute mu paragraph periodcentered */
CASE_GROUND_STATE,
-CASE_GROUND_STATE,
-CASE_GROUND_STATE,
+CASE_GSETS_PERCENT,
+CASE_GSETS_PERCENT,
CASE_GROUND_STATE,
/* cedilla onesuperior masculine guillemotright */
CASE_GROUND_STATE,
@@ -7462,18 +7462,18 @@ CASE_GROUND_STATE,
CASE_GROUND_STATE,
/* onequarter onehalf threequarters questiondown */
CASE_GROUND_STATE,
-CASE_GROUND_STATE,
+CASE_GSETS_PERCENT,
CASE_GROUND_STATE,
CASE_GROUND_STATE,
/* Agrave Aacute Acircumflex Atilde */
-CASE_GSETS_PERCENT,
CASE_GROUND_STATE,
-CASE_GSETS_PERCENT,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
CASE_GROUND_STATE,
/* Adiaeresis Aring AE Ccedilla */
CASE_GROUND_STATE,
-CASE_GSETS_PERCENT,
-CASE_GSETS_PERCENT,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
CASE_GROUND_STATE,
/* Egrave Eacute Ecircumflex Ediaeresis */
CASE_GROUND_STATE,
@@ -7482,7 +7482,7 @@ CASE_GROUND_STATE,
CASE_GROUND_STATE,
/* Igrave Iacute Icircumflex Idiaeresis */
CASE_GROUND_STATE,
-CASE_GSETS_PERCENT,
+CASE_GROUND_STATE,
CASE_GROUND_STATE,
CASE_GROUND_STATE,
/* Eth Ntilde Ograve Oacute */
diff --git a/app/xterm/VTparse.def b/app/xterm/VTparse.def
index 820c6b408..b52a2f4c7 100644
--- a/app/xterm/VTparse.def
+++ b/app/xterm/VTparse.def
@@ -1,10 +1,10 @@
-# $XTermId: VTparse.def,v 1.47 2013/08/19 00:39:14 tom Exp $
+# $XTermId: VTparse.def,v 1.49 2014/04/25 21:36:12 tom Exp $
#
# vile:confmode rs=lf
# -----------------------------------------------------------------------------
# this file is part of xterm
#
-# Copyright 1996-2012,2013 by Thomas E. Dickey
+# Copyright 1996-2013,2014 by Thomas E. Dickey
#
# All Rights Reserved
#
@@ -199,3 +199,4 @@ CASE_ANSI_RC
CASE_ESC_COLON
CASE_SCS_PERCENT
CASE_GSETS_PERCENT
+CASE_GRAPHICS_ATTRIBUTES
diff --git a/app/xterm/VTparse.h b/app/xterm/VTparse.h
index 5ee7a8e54..f49a80556 100644
--- a/app/xterm/VTparse.h
+++ b/app/xterm/VTparse.h
@@ -1,7 +1,7 @@
-/* $XTermId: VTparse.h,v 1.62 2013/08/19 00:39:54 tom Exp $ */
+/* $XTermId: VTparse.h,v 1.64 2014/04/25 21:37:35 tom Exp $ */
/*
- * Copyright 2002-2012,2013 by Thomas E. Dickey
+ * Copyright 2002-2013,2014 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -281,5 +281,6 @@ extern Const PARSE_T scs_pct_table[];
#define CASE_ESC_COLON 158
#define CASE_SCS_PERCENT 159
#define CASE_GSETS_PERCENT 160
+#define CASE_GRAPHICS_ATTRIBUTES 161
#endif /* included_VTparse_h */
diff --git a/app/xterm/button.c b/app/xterm/button.c
index 8b39e3b09..7dc6e86ba 100644
--- a/app/xterm/button.c
+++ b/app/xterm/button.c
@@ -1,7 +1,7 @@
-/* $XTermId: button.c,v 1.465 2013/11/27 00:43:43 tom Exp $ */
+/* $XTermId: button.c,v 1.467 2014/04/22 00:50:10 tom Exp $ */
/*
- * Copyright 1999-2012,2013 by Thomas E. Dickey
+ * Copyright 1999-2013,2014 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -134,8 +134,8 @@ static const CELL zeroCELL =
{0, 0};
#if OPT_DEC_LOCATOR
-static Bool SendLocatorPosition(XtermWidget xw, XButtonEvent * event);
-static void CheckLocatorPosition(XtermWidget xw, XButtonEvent * event);
+static Bool SendLocatorPosition(XtermWidget xw, XButtonEvent *event);
+static void CheckLocatorPosition(XtermWidget xw, XButtonEvent *event);
#endif /* OPT_DEC_LOCATOR */
/* Multi-click handling */
@@ -151,20 +151,20 @@ static Char *SaveText(TScreen *screen, int row, int scol, int ecol,
Char *lp, int *eol);
static int Length(TScreen *screen, int row, int scol, int ecol);
static void ComputeSelect(XtermWidget xw, CELL *startc, CELL *endc, Bool extend);
-static void EditorButton(XtermWidget xw, XButtonEvent * event);
-static void EndExtend(XtermWidget w, XEvent * event, String *params, Cardinal
+static void EditorButton(XtermWidget xw, XButtonEvent *event);
+static void EndExtend(XtermWidget w, XEvent *event, String *params, Cardinal
num_params, Bool use_cursor_loc);
static void ExtendExtend(XtermWidget xw, const CELL *cell);
static void PointToCELL(TScreen *screen, int y, int x, CELL *cell);
static void ReHiliteText(XtermWidget xw, CELL *first, CELL *last);
static void SaltTextAway(XtermWidget xw, CELL *cellc, CELL *cell);
-static void SelectSet(XtermWidget xw, XEvent * event, String *params, Cardinal num_params);
+static void SelectSet(XtermWidget xw, XEvent *event, String *params, Cardinal num_params);
static void SelectionReceived PROTO_XT_SEL_CB_ARGS;
static void StartSelect(XtermWidget xw, const CELL *cell);
-static void TrackDown(XtermWidget xw, XButtonEvent * event);
+static void TrackDown(XtermWidget xw, XButtonEvent *event);
static void TrackText(XtermWidget xw, const CELL *first, const CELL *last);
static void _OwnSelection(XtermWidget xw, String *selections, Cardinal count);
-static void do_select_end(XtermWidget xw, XEvent * event, String *params,
+static void do_select_end(XtermWidget xw, XEvent *event, String *params,
Cardinal *num_params, Bool use_cursor_loc);
#define MOUSE_LIMIT (255 - 32)
@@ -249,7 +249,7 @@ EmitMousePositionSeparator(TScreen *screen, Char line[], unsigned count)
}
Bool
-SendMousePosition(XtermWidget xw, XEvent * event)
+SendMousePosition(XtermWidget xw, XEvent *event)
{
TScreen *screen = TScreenOf(xw);
XButtonEvent *my_event = (XButtonEvent *) event;
@@ -352,7 +352,7 @@ SendMousePosition(XtermWidget xw, XEvent * event)
}
static Bool
-SendLocatorPosition(XtermWidget xw, XButtonEvent * event)
+SendLocatorPosition(XtermWidget xw, XButtonEvent *event)
{
ANSI reply;
TScreen *screen = TScreenOf(xw);
@@ -673,7 +673,7 @@ InitLocatorFilter(XtermWidget xw)
}
static void
-CheckLocatorPosition(XtermWidget xw, XButtonEvent * event)
+CheckLocatorPosition(XtermWidget xw, XButtonEvent *event)
{
ANSI reply;
TScreen *screen = TScreenOf(xw);
@@ -726,7 +726,7 @@ CheckLocatorPosition(XtermWidget xw, XButtonEvent * event)
#if OPT_READLINE
static int
-isClick1_clean(TScreen *screen, XButtonEvent * event)
+isClick1_clean(TScreen *screen, XButtonEvent *event)
{
int delta;
@@ -755,7 +755,7 @@ isClick1_clean(TScreen *screen, XButtonEvent * event)
}
static int
-isDoubleClick3(TScreen *screen, XButtonEvent * event)
+isDoubleClick3(TScreen *screen, XButtonEvent *event)
{
int delta;
@@ -794,7 +794,7 @@ isDoubleClick3(TScreen *screen, XButtonEvent * event)
}
static int
-CheckSecondPress3(TScreen *screen, XEvent * event)
+CheckSecondPress3(TScreen *screen, XEvent *event)
{
int delta;
@@ -863,13 +863,13 @@ rowOnCurrentLine(TScreen *screen,
}
static int
-eventRow(TScreen *screen, XEvent * event) /* must be XButtonEvent */
+eventRow(TScreen *screen, XEvent *event) /* must be XButtonEvent */
{
return (event->xbutton.y - screen->border) / FontHeight(screen);
}
static int
-eventColBetween(TScreen *screen, XEvent * event) /* must be XButtonEvent */
+eventColBetween(TScreen *screen, XEvent *event) /* must be XButtonEvent */
{
/* Correct by half a width - we are acting on a boundary, not on a cell. */
return ((event->xbutton.x - OriginX(screen) + (FontWidth(screen) - 1) / 2)
@@ -913,7 +913,7 @@ ReadLineDelete(TScreen *screen, CELL *cell1, CELL *cell2)
}
static void
-readlineExtend(TScreen *screen, XEvent * event)
+readlineExtend(TScreen *screen, XEvent *event)
{
int ldelta1, ldelta2;
@@ -939,7 +939,7 @@ readlineExtend(TScreen *screen, XEvent * event)
/* ^XM-G<line+' '><col+' '> */
void
DiredButton(Widget w,
- XEvent * event, /* must be XButtonEvent */
+ XEvent *event, /* must be XButtonEvent */
String *params GCC_UNUSED, /* selections */
Cardinal *num_params GCC_UNUSED)
{
@@ -970,7 +970,7 @@ DiredButton(Widget w,
#if OPT_READLINE
void
ReadLineButton(Widget w,
- XEvent * event, /* must be XButtonEvent */
+ XEvent *event, /* must be XButtonEvent */
String *params GCC_UNUSED, /* selections */
Cardinal *num_params GCC_UNUSED)
{
@@ -1027,7 +1027,7 @@ ReadLineButton(Widget w,
/* repeats <ESC>n or <ESC>p */
void
ViButton(Widget w,
- XEvent * event, /* must be XButtonEvent */
+ XEvent *event, /* must be XButtonEvent */
String *params GCC_UNUSED, /* selections */
Cardinal *num_params GCC_UNUSED)
{
@@ -1066,7 +1066,7 @@ ViButton(Widget w,
/*ARGSUSED*/
void
HandleSelectExtend(Widget w,
- XEvent * event, /* must be XMotionEvent */
+ XEvent *event, /* must be XMotionEvent */
String *params GCC_UNUSED,
Cardinal *num_params GCC_UNUSED)
{
@@ -1102,7 +1102,7 @@ HandleSelectExtend(Widget w,
void
HandleKeyboardSelectExtend(Widget w,
- XEvent * event GCC_UNUSED, /* must be XButtonEvent */
+ XEvent *event GCC_UNUSED, /* must be XButtonEvent */
String *params GCC_UNUSED,
Cardinal *num_params GCC_UNUSED)
{
@@ -1118,7 +1118,7 @@ HandleKeyboardSelectExtend(Widget w,
static void
do_select_end(XtermWidget xw,
- XEvent * event, /* must be XButtonEvent */
+ XEvent *event, /* must be XButtonEvent */
String *params, /* selections */
Cardinal *num_params,
Bool use_cursor_loc)
@@ -1143,7 +1143,7 @@ do_select_end(XtermWidget xw,
void
HandleSelectEnd(Widget w,
- XEvent * event, /* must be XButtonEvent */
+ XEvent *event, /* must be XButtonEvent */
String *params, /* selections */
Cardinal *num_params)
{
@@ -1157,7 +1157,7 @@ HandleSelectEnd(Widget w,
void
HandleKeyboardSelectEnd(Widget w,
- XEvent * event, /* must be XButtonEvent */
+ XEvent *event, /* must be XButtonEvent */
String *params, /* selections */
Cardinal *num_params)
{
@@ -1174,7 +1174,7 @@ HandleKeyboardSelectEnd(Widget w,
*/
void
HandleCopySelection(Widget w,
- XEvent * event,
+ XEvent *event,
String *params, /* list of targets */
Cardinal *num_params)
{
@@ -1375,7 +1375,7 @@ sameItem(const char *actual, const char *wanted)
* Handle the eightBitSelectTypes or utf8SelectTypes resource values.
*/
static Bool
-overrideTargets(Widget w, String value, Atom ** resultp)
+overrideTargets(Widget w, String value, Atom **resultp)
{
Bool override = False;
XtermWidget xw;
@@ -1679,7 +1679,7 @@ xtermGetSelection(Widget w,
Time ev_time,
String *params, /* selections in precedence order */
Cardinal num_params,
- Atom * targets)
+ Atom *targets)
{
Atom selection;
int cutbuffer;
@@ -2077,8 +2077,8 @@ removeControls(XtermWidget xw, char *value)
static void
SelectionReceived(Widget w,
XtPointer client_data,
- Atom * selection GCC_UNUSED,
- Atom * type,
+ Atom *selection GCC_UNUSED,
+ Atom *type,
XtPointer value,
unsigned long *length,
int *format)
@@ -2228,7 +2228,7 @@ SelectionReceived(Widget w,
void
HandleInsertSelection(Widget w,
- XEvent * event, /* assumed to be XButtonEvent* */
+ XEvent *event, /* assumed to be XButtonEvent* */
String *params, /* selections in precedence order */
Cardinal *num_params)
{
@@ -2290,7 +2290,7 @@ EvalSelectUnit(XtermWidget xw,
static void
do_select_start(XtermWidget xw,
- XEvent * event, /* must be XButtonEvent* */
+ XEvent *event, /* must be XButtonEvent* */
CELL *cell)
{
TScreen *screen = TScreenOf(xw);
@@ -2313,7 +2313,7 @@ do_select_start(XtermWidget xw,
/* ARGSUSED */
void
HandleSelectStart(Widget w,
- XEvent * event, /* must be XButtonEvent* */
+ XEvent *event, /* must be XButtonEvent* */
String *params GCC_UNUSED,
Cardinal *num_params GCC_UNUSED)
{
@@ -2339,7 +2339,7 @@ HandleSelectStart(Widget w,
/* ARGSUSED */
void
HandleKeyboardSelectStart(Widget w,
- XEvent * event, /* must be XButtonEvent* */
+ XEvent *event, /* must be XButtonEvent* */
String *params GCC_UNUSED,
Cardinal *num_params GCC_UNUSED)
{
@@ -2354,7 +2354,7 @@ HandleKeyboardSelectStart(Widget w,
}
static void
-TrackDown(XtermWidget xw, XButtonEvent * event)
+TrackDown(XtermWidget xw, XButtonEvent *event)
{
TScreen *screen = TScreenOf(xw);
CELL cell;
@@ -2431,7 +2431,7 @@ StartSelect(XtermWidget xw, const CELL *cell)
static void
EndExtend(XtermWidget xw,
- XEvent * event, /* must be XButtonEvent */
+ XEvent *event, /* must be XButtonEvent */
String *params, /* selections */
Cardinal num_params,
Bool use_cursor_loc)
@@ -2524,7 +2524,7 @@ EndExtend(XtermWidget xw,
void
HandleSelectSet(Widget w,
- XEvent * event,
+ XEvent *event,
String *params,
Cardinal *num_params)
{
@@ -2539,7 +2539,7 @@ HandleSelectSet(Widget w,
/* ARGSUSED */
static void
SelectSet(XtermWidget xw,
- XEvent * event GCC_UNUSED,
+ XEvent *event GCC_UNUSED,
String *params,
Cardinal num_params)
{
@@ -2560,7 +2560,7 @@ SelectSet(XtermWidget xw,
/* ARGSUSED */
static void
do_start_extend(XtermWidget xw,
- XEvent * event, /* must be XButtonEvent* */
+ XEvent *event, /* must be XButtonEvent* */
String *params GCC_UNUSED,
Cardinal *num_params GCC_UNUSED,
Bool use_cursor_loc)
@@ -2661,7 +2661,7 @@ ExtendExtend(XtermWidget xw, const CELL *cell)
void
HandleStartExtend(Widget w,
- XEvent * event, /* must be XButtonEvent* */
+ XEvent *event, /* must be XButtonEvent* */
String *params, /* unused */
Cardinal *num_params) /* unused */
{
@@ -2675,7 +2675,7 @@ HandleStartExtend(Widget w,
void
HandleKeyboardStartExtend(Widget w,
- XEvent * event, /* must be XButtonEvent* */
+ XEvent *event, /* must be XButtonEvent* */
String *params, /* unused */
Cardinal *num_params) /* unused */
{
@@ -3784,7 +3784,7 @@ CompleteSelection(XtermWidget xw, String *args, Cardinal len)
static Bool
_ConvertSelectionHelper(Widget w,
- Atom * type,
+ Atom *type,
XtPointer *value,
unsigned long *length,
int *format,
@@ -3842,9 +3842,9 @@ SaveConvertedLength(XtPointer *target, unsigned long source)
static Boolean
ConvertSelection(Widget w,
- Atom * selection,
- Atom * target,
- Atom * type,
+ Atom *selection,
+ Atom *target,
+ Atom *type,
XtPointer *value,
unsigned long *length,
int *format)
@@ -4002,7 +4002,7 @@ ConvertSelection(Widget w,
}
static void
-LoseSelection(Widget w, Atom * selection)
+LoseSelection(Widget w, Atom *selection)
{
TScreen *screen;
Atom *atomP;
@@ -4043,8 +4043,8 @@ LoseSelection(Widget w, Atom * selection)
/* ARGSUSED */
static void
SelectionDone(Widget w GCC_UNUSED,
- Atom * selection GCC_UNUSED,
- Atom * target GCC_UNUSED)
+ Atom *selection GCC_UNUSED,
+ Atom *target GCC_UNUSED)
{
/* empty proc so Intrinsics know we want to keep storage */
}
@@ -4294,7 +4294,7 @@ SaveText(TScreen *screen,
/* Position: 32 - 255. */
static int
-BtnCode(XButtonEvent * event, int button)
+BtnCode(XButtonEvent *event, int button)
{
int result = (int) (32 + (KeyState(event->state) << 2));
@@ -4320,7 +4320,7 @@ static unsigned
EmitButtonCode(TScreen *screen,
Char *line,
unsigned count,
- XButtonEvent * event,
+ XButtonEvent *event,
int button)
{
int value;
@@ -4372,7 +4372,7 @@ FirstBitN(int bits)
#define EMIT_BUTTON(button) EmitButtonCode(screen, line, count, event, button)
static void
-EditorButton(XtermWidget xw, XButtonEvent * event)
+EditorButton(XtermWidget xw, XButtonEvent *event)
{
TScreen *screen = TScreenOf(xw);
int pty = screen->respond;
@@ -4512,7 +4512,7 @@ EditorButton(XtermWidget xw, XButtonEvent * event)
#if OPT_FOCUS_EVENT
void
-SendFocusButton(XtermWidget xw, XFocusChangeEvent * event)
+SendFocusButton(XtermWidget xw, XFocusChangeEvent *event)
{
TScreen *screen = TScreenOf(xw);
@@ -4539,7 +4539,7 @@ SendFocusButton(XtermWidget xw, XFocusChangeEvent * event)
* Get the event-time, needed to process selections.
*/
static Time
-getEventTime(XEvent * event)
+getEventTime(XEvent *event)
{
Time result;
@@ -4558,7 +4558,7 @@ getEventTime(XEvent * event)
static char *
getSelectionString(XtermWidget xw,
Widget w,
- XEvent * event,
+ XEvent *event,
String *params,
Cardinal *num_params,
CELL *start, CELL *finish)
@@ -4972,7 +4972,7 @@ freeArgv(char *blob, char **argv)
void
HandleExecFormatted(Widget w,
- XEvent * event GCC_UNUSED,
+ XEvent *event GCC_UNUSED,
String *params, /* selections */
Cardinal *num_params)
{
@@ -5004,7 +5004,7 @@ HandleExecFormatted(Widget w,
void
HandleExecSelectable(Widget w,
- XEvent * event GCC_UNUSED,
+ XEvent *event GCC_UNUSED,
String *params, /* selections */
Cardinal *num_params)
{
@@ -5030,8 +5030,8 @@ HandleExecSelectable(Widget w,
}
executeCommand(argv);
freeArgv(blob, argv);
- free(data);
}
+ free(data);
}
}
}
@@ -5039,7 +5039,7 @@ HandleExecSelectable(Widget w,
void
HandleInsertFormatted(Widget w,
- XEvent * event GCC_UNUSED,
+ XEvent *event GCC_UNUSED,
String *params, /* selections */
Cardinal *num_params)
{
@@ -5068,7 +5068,7 @@ HandleInsertFormatted(Widget w,
void
HandleInsertSelectable(Widget w,
- XEvent * event GCC_UNUSED,
+ XEvent *event GCC_UNUSED,
String *params, /* selections */
Cardinal *num_params)
{
diff --git a/app/xterm/charproc.c b/app/xterm/charproc.c
index 4991f68ed..b6ab503d0 100644
--- a/app/xterm/charproc.c
+++ b/app/xterm/charproc.c
@@ -1,7 +1,7 @@
-/* $XTermId: charproc.c,v 1.1319 2013/11/26 20:38:11 tom Exp $ */
+/* $XTermId: charproc.c,v 1.1332 2014/05/02 21:48:33 tom Exp $ */
/*
- * Copyright 1999-2012,2013 by Thomas E. Dickey
+ * Copyright 1999-2013,2014 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -367,9 +367,11 @@ static XtActionsRec actionsList[] = {
{ "smaller-vt-font", HandleSmallerFont },
#endif
#if OPT_SIXEL_GRAPHICS
- { "set-private-colors", HandleSetPrivateColorRegisters },
{ "set-sixel-scrolling", HandleSixelScrolling },
#endif
+#if OPT_GRAPHICS
+ { "set-private-colors", HandleSetPrivateColorRegisters },
+#endif
#if OPT_SUN_FUNC_KEYS
{ "set-sun-function-keys", HandleSunFunctionKeys },
#endif
@@ -675,9 +677,16 @@ static XtResource xterm_resources[] =
#endif
#if OPT_SIXEL_GRAPHICS
+ Bres(XtNsixelScrolling, XtCSixelScrolling, screen.sixel_scrolling, True),
+ Bres(XtNsixelScrollsRight, XtCSixelScrollsRight,
+ screen.sixel_scrolls_right, False),
+#endif
+
+#if OPT_GRAPHICS
+ Ires(XtNnumColorRegisters, XtCNumColorRegisters,
+ screen.numcolorregisters, 0),
Bres(XtNprivateColorRegisters, XtCPrivateColorRegisters,
screen.privatecolorregisters, True),
- Bres(XtNsixelScrolling, XtCSixelScrolling, screen.sixel_scrolling, False),
#endif
#if OPT_SUNPC_KBD
@@ -756,7 +765,7 @@ static Boolean VTSetValues(Widget cur, Widget request, Widget new_arg,
ArgList args, Cardinal *num_args);
static void VTClassInit(void);
static void VTDestroy(Widget w);
-static void VTExpose(Widget w, XEvent * event, Region region);
+static void VTExpose(Widget w, XEvent *event, Region region);
static void VTInitialize(Widget wrequest, Widget new_arg, ArgList args,
Cardinal *num_args);
static void VTRealize(Widget w, XtValueMask * valuemask,
@@ -1237,52 +1246,91 @@ set_mod_fkeys(XtermWidget xw, int which, int what, Bool enabled)
#endif /* OPT_MOD_FKEYS */
#if OPT_TRACE
-#define WHICH_TABLE(name) if (table == name) result = #name
-static const char *
-which_table(Const PARSE_T * table)
-{
- const char *result = "?";
- /* *INDENT-OFF* */
- WHICH_TABLE (ansi_table);
- else WHICH_TABLE (cigtable);
- else WHICH_TABLE (csi2_table);
- else WHICH_TABLE (csi_ex_table);
- else WHICH_TABLE (csi_quo_table);
- else WHICH_TABLE (csi_table);
- else WHICH_TABLE (dec2_table);
- else WHICH_TABLE (dec3_table);
- else WHICH_TABLE (dec_table);
- else WHICH_TABLE (eigtable);
- else WHICH_TABLE (esc_sp_table);
- else WHICH_TABLE (esc_table);
- else WHICH_TABLE (scrtable);
- else WHICH_TABLE (scs96table);
- else WHICH_TABLE (scstable);
- else WHICH_TABLE (sos_table);
+#define DATA(name) { name, #name }
+static const struct {
+ Const PARSE_T *table;
+ const char *name;
+} all_tables[] = {
+
+ DATA(ansi_table)
+ ,DATA(cigtable)
+ ,DATA(csi2_table)
+ ,DATA(csi_ex_table)
+ ,DATA(csi_quo_table)
+ ,DATA(csi_table)
+ ,DATA(dec2_table)
+ ,DATA(dec3_table)
+ ,DATA(dec_table)
+ ,DATA(eigtable)
+ ,DATA(esc_sp_table)
+ ,DATA(esc_table)
+ ,DATA(scrtable)
+ ,DATA(scs96table)
+ ,DATA(scstable)
+ ,DATA(sos_table)
#if OPT_BLINK_CURS
- else WHICH_TABLE (csi_sp_table);
+ ,DATA(csi_sp_table)
#endif
#if OPT_DEC_LOCATOR
- else WHICH_TABLE (csi_tick_table);
+ ,DATA(csi_tick_table)
#endif
#if OPT_DEC_RECTOPS
- else WHICH_TABLE (csi_dollar_table);
- else WHICH_TABLE (csi_star_table);
- else WHICH_TABLE (csi_dec_dollar_table);
+ ,DATA(csi_dollar_table)
+ ,DATA(csi_star_table)
+ ,DATA(csi_dec_dollar_table)
#endif
#if OPT_WIDE_CHARS
- else WHICH_TABLE (esc_pct_table);
- else WHICH_TABLE (scs_pct_table);
+ ,DATA(esc_pct_table)
+ ,DATA(scs_pct_table)
#endif
#if OPT_VT52_MODE
- else WHICH_TABLE (vt52_table);
- else WHICH_TABLE (vt52_esc_table);
- else WHICH_TABLE (vt52_ignore_table);
+ ,DATA(vt52_table)
+ ,DATA(vt52_esc_table)
+ ,DATA(vt52_ignore_table)
#endif
- /* *INDENT-ON* */
+#undef DATA
+};
+
+#define WHICH_TABLE(name) if (table == name) result = #name
+static const char *
+which_table(Const PARSE_T * table)
+{
+ const char *result = "?";
+ Cardinal n;
+ for (n = 0; n < XtNumber(all_tables); ++n) {
+ if (table == all_tables[n].table) {
+ result = all_tables[n].name;
+ break;
+ }
+ }
return result;
}
+
+static void
+check_tables(void)
+{
+ Cardinal n;
+ int ch;
+
+ TRACE(("** check_tables\n"));
+ for (n = 0; n < XtNumber(all_tables); ++n) {
+ Const PARSE_T *table = all_tables[n].table;
+ TRACE(("*** %s\n", all_tables[n].name));
+ for (ch = 32; ch < 127; ++ch) {
+ PARSE_T st_l = table[ch];
+ PARSE_T st_r = table[ch + 128];
+ if (st_l != st_r) {
+ if (st_r == CASE_IGNORE &&
+ !strncmp(all_tables[n].name, "vt52", 4)) {
+ ;
+ } else {
+ TRACE((" %3d: %d vs %d\n", ch, st_l, st_r));
+ }
+ }
+ }
+ }
+}
#endif
#if OPT_TRACE > 0
@@ -1514,6 +1562,27 @@ subparam_index(int p, int s)
}
/*
+ * Check if the given item in the parameter array has subparameters.
+ * If so, return the number of subparameters to use as a loop limit, etc.
+ */
+static int
+param_has_subparams(int item)
+{
+ int result = 0;
+ if (parms.has_subparams) {
+ int n = subparam_index(item, 0);
+ if (n >= 0 && parms.is_sub[n]) {
+ while (n++ < nparam && parms.is_sub[n - 1] < parms.is_sub[n]) {
+ result++;
+ }
+ }
+ }
+ TRACE(("...param_has_subparams(%d) ->%d\n", item, result));
+ return result;
+}
+
+#if OPT_256_COLORS || OPT_88_COLORS || OPT_ISO_COLORS
+/*
* Given an index into the parameter array, return the corresponding parameter
* number (starting from zero).
*/
@@ -1550,27 +1619,6 @@ get_subparam(int p, int s)
}
/*
- * Check if the given item in the parameter array has subparameters.
- * If so, return the number of subparameters to use as a loop limit, etc.
- */
-static int
-param_has_subparams(int item)
-{
- int result = 0;
- if (parms.has_subparams) {
- int n = subparam_index(item, 0);
- if (n >= 0 && parms.is_sub[n]) {
- while (n++ < nparam && parms.is_sub[n - 1] < parms.is_sub[n]) {
- result++;
- }
- }
- }
- TRACE(("...param_has_subparams(%d) ->%d\n", item, result));
- return result;
-}
-
-#if OPT_256_COLORS || OPT_88_COLORS || OPT_ISO_COLORS
-/*
* Some background -
*
* Todd Larason provided the initial changes to support 256-colors in July 1999.
@@ -2083,6 +2131,9 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
c = '?';
}
#endif
+ if (sp->string_area != new_string) {
+ free(sp->string_area);
+ }
sp->string_area = new_string;
sp->string_size = new_length;
sp->string_area[(sp->string_used)++] = CharOf(c);
@@ -2561,7 +2612,11 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
switch (screen->terminal_id) {
case 125:
reply.a_param[count++] = 12; /* VT125 */
+#if OPT_REGIS_GRAPHICS
+ reply.a_param[count++] = 0 | 2 | 1; /* no STP, AVO, GPO (ReGIS) */
+#else
reply.a_param[count++] = 0 | 2 | 0; /* no STP, AVO, no GPO (ReGIS) */
+#endif
reply.a_param[count++] = 0; /* no printer */
reply.a_param[count++] = XTERM_PATCH; /* ROM version */
break;
@@ -2583,12 +2638,21 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
/ 100);
reply.a_param[count++] = 1; /* 132-columns */
reply.a_param[count++] = 2; /* printer */
-#if OPT_SIXEL_GRAPHICS
+#if OPT_REGIS_GRAPHICS
if (screen->terminal_id == 240 ||
screen->terminal_id == 241 ||
screen->terminal_id == 330 ||
screen->terminal_id == 340) {
reply.a_param[count++] = 3; /* ReGIS graphics */
+ }
+#endif
+ reply.a_param[count++] = 6; /* selective-erase */
+#if OPT_SIXEL_GRAPHICS
+ if (screen->terminal_id == 240 ||
+ screen->terminal_id == 241 ||
+ screen->terminal_id == 330 ||
+ screen->terminal_id == 340 ||
+ screen->terminal_id == 382) {
reply.a_param[count++] = 4; /* sixel graphics */
}
#endif
@@ -3392,6 +3456,69 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
ResetState(sp);
break;
+ case CASE_GRAPHICS_ATTRIBUTES:
+#if OPT_GRAPHICS
+ TRACE(("CASE_GRAPHICS_ATTRIBUTES\n"));
+ {
+ /* request: item, action, value */
+ /* reply: item, status, value */
+ if (nparam != 3) {
+ TRACE(("DATA_ERROR: malformed CASE_GRAPHICS_ATTRIBUTES request with %d parameters\n", nparam));
+ } else {
+ int status = 3;
+ int result = 0;
+
+ TRACE(("CASE_GRAPHICS_ATTRIBUTES request: %d, %d, %d\n",
+ GetParam(0), GetParam(1), GetParam(2)));
+ switch (GetParam(0)) {
+ case 1: /* color register count */
+ switch (GetParam(1)) {
+ case 1: /* read */
+ status = 0;
+ result = (int) get_color_register_count(screen);
+ break;
+ case 2: /* reset */
+ screen->numcolorregisters = 0;
+ status = 0;
+ result = (int) get_color_register_count(screen);
+ break;
+ case 3: /* set */
+ if (GetParam(2) > 1 &&
+ (unsigned) GetParam(2) <= MAX_COLOR_REGISTERS) {
+ screen->numcolorregisters = GetParam(2);
+ status = 0;
+ result = (int) get_color_register_count(screen);
+ }
+ break;
+ default:
+ TRACE(("DATA_ERROR: CASE_GRAPHICS_ATTRIBUTES color register count request with unknown action parameter: %d\n",
+ GetParam(1)));
+ status = 2;
+ break;
+ }
+ break;
+ default:
+ TRACE(("DATA_ERROR: CASE_GRAPHICS_ATTRIBUTES request with unknown item parameter: %d\n",
+ GetParam(0)));
+ status = 1;
+ break;
+ }
+
+ init_reply(ANSI_CSI);
+ reply.a_pintro = '?';
+ reply.a_nparam = 3;
+ reply.a_param[0] = (ParmType) GetParam(0);
+ reply.a_param[1] = (ParmType) status;
+ reply.a_param[2] = (ParmType) result;
+ reply.a_inters = 0;
+ reply.a_final = 'S';
+ unparseseq(xw, &reply);
+ }
+ }
+#endif
+ ResetState(sp);
+ break;
+
case CASE_ST:
TRACE(("CASE_ST: End of String (%lu bytes) (mode=%d)\n",
(unsigned long) sp->string_used,
@@ -3924,12 +4051,16 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
* command-line, allow it to be enabled/disabled by
* control sequence.
*/
+ TRACE(("CASE_UTF8 wide:%d, utf8:%d, req:%s\n",
+ screen->wide_chars,
+ screen->utf8_mode,
+ BtoS(c == 'G')));
+ if ((!screen->wide_chars) && (c == 'G')) {
+ WriteNow();
+ ChangeToWide(xw);
+ }
if (screen->wide_chars
- && screen->utf8_mode != uAlways) {
- if (!screen->wide_chars) {
- WriteNow();
- ChangeToWide(xw);
- }
+ && !screen->utf8_always) {
switchPtyData(screen, c == 'G');
TRACE(("UTF8 mode %s\n",
BtoS(screen->utf8_mode)));
@@ -4797,7 +4928,7 @@ visual_width(IChar *str, Cardinal len)
static void
HandleStructNotify(Widget w GCC_UNUSED,
XtPointer closure GCC_UNUSED,
- XEvent * event,
+ XEvent *event,
Boolean *cont GCC_UNUSED)
{
XtermWidget xw = term;
@@ -5190,10 +5321,11 @@ dpmodes(XtermWidget xw, BitFunc func)
break;
#if OPT_SIXEL_GRAPHICS
case srm_DECSDM: /* sixel scrolling */
- if (screen->terminal_id == 240 ||
+ if (screen->terminal_id == 240 || /* FIXME: VT24x did not scroll sixel graphics */
screen->terminal_id == 241 ||
screen->terminal_id == 330 ||
- screen->terminal_id == 340) {
+ screen->terminal_id == 340 ||
+ screen->terminal_id == 382) {
(*func) (&xw->keyboard.flags, MODE_DECSDM);
TRACE(("DECSET/DECRST DECSDM %s (resource default is %d)\n",
BtoS(xw->keyboard.flags & MODE_DECSDM),
@@ -5356,14 +5488,29 @@ dpmodes(XtermWidget xw, BitFunc func)
set_mouseflag(paste_literal_nl);
break;
#endif /* OPT_READLINE */
-#if OPT_SIXEL_GRAPHICS
+#if OPT_GRAPHICS
case srm_PRIVATE_COLOR_REGISTERS: /* private color registers for each graphic */
- TRACE(("DECSET/DECRST PRIVATE_COLOR_REGISTERS %s\n",
- BtoS(screen->privatecolorregisters)));
+ TRACE(("DECSET/DECRST PRIVATE_COLOR_REGISTERS to %s (resource default is %s)\n",
+ BtoS(screen->privatecolorregisters),
+ BtoS(TScreenOf(xw)->privatecolorregisters)));
set_bool_mode(screen->privatecolorregisters);
update_privatecolorregisters();
break;
#endif
+#if OPT_SIXEL_GRAPHICS
+ case srm_SIXEL_SCROLLS_RIGHT: /* sixel scrolling moves cursor to right */
+ if (screen->terminal_id == 240 || /* FIXME: VT24x did not scroll sixel graphics */
+ screen->terminal_id == 241 ||
+ screen->terminal_id == 330 ||
+ screen->terminal_id == 340 ||
+ screen->terminal_id == 382) {
+ set_bool_mode(screen->sixel_scrolls_right);
+ TRACE(("DECSET/DECRST SIXEL_SCROLLS_RIGHT to %s (resource default is %s)\n",
+ BtoS(screen->sixel_scrolls_right),
+ BtoS(TScreenOf(xw)->sixel_scrolls_right)));
+ }
+ break;
+#endif
default:
TRACE(("DATA_ERROR: unknown private code %d\n", code));
break;
@@ -5600,7 +5747,7 @@ savemodes(XtermWidget xw)
SCREEN_FLAG_save(screen, paste_literal_nl);
break;
#endif /* OPT_READLINE */
-#if OPT_SIXEL_GRAPHICS
+#if OPT_GRAPHICS
case srm_PRIVATE_COLOR_REGISTERS: /* private color registers for each graphic */
TRACE(("save PRIVATE_COLOR_REGISTERS %s\n",
BtoS(screen->privatecolorregisters)));
@@ -5608,6 +5755,13 @@ savemodes(XtermWidget xw)
update_privatecolorregisters();
break;
#endif
+#if OPT_SIXEL_GRAPHICS
+ case srm_SIXEL_SCROLLS_RIGHT:
+ TRACE(("save SIXEL_SCROLLS_RIGHT %s\n",
+ BtoS(screen->sixel_scrolls_right)));
+ DoSM(DP_SIXEL_SCROLLS_RIGHT, screen->sixel_scrolls_right);
+ break;
+#endif
}
}
}
@@ -5920,14 +6074,25 @@ restoremodes(XtermWidget xw)
SCREEN_FLAG_restore(screen, paste_literal_nl);
break;
#endif /* OPT_READLINE */
-#if OPT_SIXEL_GRAPHICS
+#if OPT_GRAPHICS
case srm_PRIVATE_COLOR_REGISTERS: /* private color registers for each graphic */
- TRACE(("restore PRIVATE_COLOR_REGISTERS %s\n",
+ TRACE(("restore PRIVATE_COLOR_REGISTERS before: %s\n",
BtoS(screen->privatecolorregisters)));
DoRM(DP_X_PRIVATE_COLOR_REGISTERS, screen->privatecolorregisters);
+ TRACE(("restore PRIVATE_COLOR_REGISTERS after: %s\n",
+ BtoS(screen->privatecolorregisters)));
update_privatecolorregisters();
break;
#endif
+#if OPT_SIXEL_GRAPHICS
+ case srm_SIXEL_SCROLLS_RIGHT:
+ TRACE(("restore SIXEL_SCROLLS_RIGHT before: %s\n",
+ BtoS(screen->sixel_scrolls_right)));
+ DoRM(DP_SIXEL_SCROLLS_RIGHT, screen->sixel_scrolls_right);
+ TRACE(("restore SIXEL_SCROLLS_RIGHT after: %s\n",
+ BtoS(screen->sixel_scrolls_right)));
+ break;
+#endif
}
}
}
@@ -6657,7 +6822,7 @@ VTRun(XtermWidget xw)
/*ARGSUSED*/
static void
VTExpose(Widget w GCC_UNUSED,
- XEvent * event,
+ XEvent *event,
Region region GCC_UNUSED)
{
DEBUG_MSG("Expose\n");
@@ -6666,7 +6831,7 @@ VTExpose(Widget w GCC_UNUSED,
}
static void
-VTGraphicsOrNoExpose(XEvent * event)
+VTGraphicsOrNoExpose(XEvent *event)
{
TScreen *screen = TScreenOf(term);
if (screen->incopy <= 0) {
@@ -6692,7 +6857,7 @@ VTGraphicsOrNoExpose(XEvent * event)
static void
VTNonMaskableEvent(Widget w GCC_UNUSED,
XtPointer closure GCC_UNUSED,
- XEvent * event,
+ XEvent *event,
Boolean *cont GCC_UNUSED)
{
switch (event->type) {
@@ -6937,6 +7102,7 @@ VTInitialize_locale(XtermWidget xw)
TRACE(("... request screen.utf8_mode = %d\n", screen->utf8_mode));
TRACE(("... request screen.utf8_fonts = %d\n", screen->utf8_fonts));
+ screen->utf8_always = (screen->utf8_mode == uAlways);
if (screen->utf8_mode < 0)
screen->utf8_mode = uFalse;
@@ -7151,7 +7317,7 @@ ParseList(const char **source)
static void
set_flags_from_list(char *target,
const char *source,
- FlagList * list,
+ const FlagList * list,
Cardinal limit)
{
Cardinal n;
@@ -7249,7 +7415,7 @@ VTInitialize(Widget wrequest,
#define DftBg(name) isDefaultBackground(Kolor(name))
#define DATA(name) { #name, ec##name }
- static FlagList tblColorOps[] =
+ static const FlagList tblColorOps[] =
{
DATA(SetColor)
,DATA(GetColor)
@@ -7258,7 +7424,7 @@ VTInitialize(Widget wrequest,
#undef DATA
#define DATA(name) { #name, ef##name }
- static FlagList tblFontOps[] =
+ static const FlagList tblFontOps[] =
{
DATA(SetFont)
,DATA(GetFont)
@@ -7266,7 +7432,7 @@ VTInitialize(Widget wrequest,
#undef DATA
#define DATA(name) { #name, et##name }
- static FlagList tblTcapOps[] =
+ static const FlagList tblTcapOps[] =
{
DATA(SetTcap)
,DATA(GetTcap)
@@ -7274,7 +7440,7 @@ VTInitialize(Widget wrequest,
#undef DATA
#define DATA(name) { #name, ew##name }
- static FlagList tblWindowOps[] =
+ static const FlagList tblWindowOps[] =
{
DATA(RestoreWin)
,DATA(MinimizeWin)
@@ -7308,7 +7474,7 @@ VTInitialize(Widget wrequest,
#if OPT_RENDERFONT
#define DATA(name) { #name, er##name }
- static FlagList tblRenderFont[] =
+ static const FlagList tblRenderFont[] =
{
DATA(Default)
};
@@ -7317,7 +7483,7 @@ VTInitialize(Widget wrequest,
#if OPT_WIDE_CHARS
#define DATA(name) { #name, u##name }
- static FlagList tblUtf8Mode[] =
+ static const FlagList tblUtf8Mode[] =
{
DATA(Always)
,DATA(Default)
@@ -7327,7 +7493,7 @@ VTInitialize(Widget wrequest,
#ifndef NO_ACTIVE_ICON
#define DATA(name) { #name, ei##name }
- static FlagList tblAIconOps[] =
+ static const FlagList tblAIconOps[] =
{
DATA(Default)
};
@@ -7335,7 +7501,7 @@ VTInitialize(Widget wrequest,
#endif
#define DATA(name) { #name, eb##name }
- static FlagList tbl8BitMeta[] =
+ static const FlagList tbl8BitMeta[] =
{
DATA(Never)
,DATA(Locale)
@@ -7363,6 +7529,10 @@ VTInitialize(Widget wrequest,
};
#endif /* OPT_COLOR_RES2 */
+#if OPT_TRACE
+ check_tables();
+#endif
+
TRACE(("VTInitialize wnew %p, %d / %d resources\n",
(void *) wnew, XtNumber(xterm_resources), MAXRESOURCES));
assert(XtNumber(xterm_resources) < MAXRESOURCES);
@@ -7397,6 +7567,11 @@ VTInitialize(Widget wrequest,
*/
TScreenOf(wnew)->display = wnew->core.screen->display;
+ /* prep getVisualInfo() */
+ wnew->visInfo = 0;
+ wnew->numVisuals = 0;
+ (void) getVisualInfo(wnew);
+
/*
* We use the default foreground/background colors to compare/check if a
* color-resource has been set.
@@ -8015,6 +8190,7 @@ VTInitialize(Widget wrequest,
wnew->cur_background = 0;
wnew->keyboard.flags = MODE_SRM;
+
if (TScreenOf(wnew)->backarrow_key)
wnew->keyboard.flags |= MODE_DECBKM;
TRACE(("initialized DECBKM %s\n",
@@ -8022,17 +8198,28 @@ VTInitialize(Widget wrequest,
#if OPT_SIXEL_GRAPHICS
init_Bres(screen.sixel_scrolling);
- if (TScreenOf(wnew)->sixel_scrolling) /* FIXME: should this be off unconditionally here? */
+ if (TScreenOf(wnew)->sixel_scrolling)
wnew->keyboard.flags |= MODE_DECSDM;
- TRACE(("initialized DECSDM %s (resource default is %d)\n",
- BtoS(wnew->keyboard.flags & MODE_DECSDM),
- TScreenOf(wnew)->sixel_scrolling));
+ TRACE(("initialized DECSDM %s\n",
+ BtoS(wnew->keyboard.flags & MODE_DECSDM)));
+#endif
+
+#if OPT_GRAPHICS
+ init_Ires(screen.numcolorregisters);
+ TRACE(("initialized NUM_COLOR_REGISTERS to resource default: %d\n",
+ TScreenOf(wnew)->numcolorregisters));
init_Bres(screen.privatecolorregisters); /* FIXME: should this be off unconditionally here? */
- TRACE(("initialized PRIVATE_COLOR_REGISTERS to resource default %s\n",
+ TRACE(("initialized PRIVATE_COLOR_REGISTERS to resource default: %s\n",
BtoS(TScreenOf(wnew)->privatecolorregisters)));
#endif
+#if OPT_SIXEL_GRAPHICS
+ init_Bres(screen.sixel_scrolls_right);
+ TRACE(("initialized SIXEL_SCROLLS_RIGHT to resource default: %s\n",
+ BtoS(TScreenOf(wnew)->sixel_scrolls_right)));
+#endif
+
/* look for focus related events on the shell, because we need
* to care about the shell's border being part of our focus.
*/
@@ -8143,7 +8330,7 @@ releaseCursorGCs(XtermWidget xw)
}
void
-releaseWindowGCs(XtermWidget xw, VTwin * win)
+releaseWindowGCs(XtermWidget xw, VTwin *win)
{
int n;
@@ -8334,15 +8521,17 @@ VTDestroy(Widget w GCC_UNUSED)
#endif
if (screen->selection_atoms)
- XtFree((char *) (screen->selection_atoms));
+ XtFree((void *) (screen->selection_atoms));
- XtFree((char *) (screen->selection_data));
+ XtFree((void *) (screen->selection_data));
TRACE_FREE_LEAK(xtermClassRec.core_class.tm_table);
TRACE_FREE_LEAK(xw->keyboard.extra_translations);
TRACE_FREE_LEAK(xw->keyboard.shell_translations);
TRACE_FREE_LEAK(xw->keyboard.xterm_translations);
+ XtFree((void *) (xw->visInfo));
+
#if OPT_WIDE_CHARS
FreeTypedBuffer(XChar2b);
FreeTypedBuffer(char);
@@ -8362,6 +8551,7 @@ VTDestroy(Widget w GCC_UNUSED)
#endif /* defined(NO_LEAKS) */
}
+#ifndef NO_ACTIVE_ICON
static void *
getProperty(Display *dpy,
Window w,
@@ -8476,6 +8666,7 @@ getWindowManagerName(XtermWidget xw)
TRACE(("... window manager name is %s\n", result));
return result;
}
+#endif
/*ARGSUSED*/
static void
@@ -9963,7 +10154,9 @@ RestartBlinking(TScreen *screen GCC_UNUSED)
static void
ReallyReset(XtermWidget xw, Bool full, Bool saved)
{
+#if OPT_ISO_COLORS
static char empty[1];
+#endif
TScreen *screen = TScreenOf(xw);
@@ -10029,19 +10222,35 @@ ReallyReset(XtermWidget xw, Bool full, Bool saved)
xw->keyboard.flags |= MODE_DECBKM;
TRACE(("full reset DECBKM %s\n",
BtoS(xw->keyboard.flags & MODE_DECBKM)));
+
#if OPT_SIXEL_GRAPHICS
- if (TScreenOf(xw)->sixel_scrolling) /* FIXME: should this be off unconditionally here? */
+ if (TScreenOf(xw)->sixel_scrolling)
xw->keyboard.flags |= MODE_DECSDM;
- TRACE(("full reset DECSDM %s (resource default is %d)\n",
+ TRACE(("full reset DECSDM to %s (resource default is %s)\n",
BtoS(xw->keyboard.flags & MODE_DECSDM),
- TScreenOf(xw)->sixel_scrolling));
+ BtoS(TScreenOf(xw)->sixel_scrolling)));
+#endif
+
+#if OPT_GRAPHICS
+ screen->privatecolorregisters = TScreenOf(xw)->privatecolorregisters;
+ TRACE(("full reset PRIVATE_COLOR_REGISTERS to %s (resource default is %s)\n",
+ BtoS(screen->privatecolorregisters),
+ BtoS(TScreenOf(xw)->privatecolorregisters)));
#endif
+
+#if OPT_SIXEL_GRAPHICS
+ screen->sixel_scrolls_right = TScreenOf(xw)->sixel_scrolls_right;
+ TRACE(("full reset SIXEL_SCROLLS_RIGHT to %s (resource default is %s)\n",
+ BtoS(screen->sixel_scrolls_right),
+ BtoS(TScreenOf(xw)->sixel_scrolls_right)));
+#endif
+
update_appcursor();
update_appkeypad();
update_decbkm();
update_decsdm();
show_8bit_control(False);
- reset_decudk();
+ reset_decudk(xw);
FromAlternate(xw);
ClearScreen(xw);
@@ -10218,7 +10427,7 @@ set_character_class(char *s)
/* ARGSUSED */
static void
HandleKeymapChange(Widget w,
- XEvent * event GCC_UNUSED,
+ XEvent *event GCC_UNUSED,
String *params,
Cardinal *param_count)
{
@@ -10271,7 +10480,7 @@ HandleKeymapChange(Widget w,
/* ARGSUSED */
static void
HandleBell(Widget w GCC_UNUSED,
- XEvent * event GCC_UNUSED,
+ XEvent *event GCC_UNUSED,
String *params, /* [0] = volume */
Cardinal *param_count) /* 0 or 1 */
{
@@ -10283,7 +10492,7 @@ HandleBell(Widget w GCC_UNUSED,
/* ARGSUSED */
static void
HandleVisualBell(Widget w GCC_UNUSED,
- XEvent * event GCC_UNUSED,
+ XEvent *event GCC_UNUSED,
String *params GCC_UNUSED,
Cardinal *param_count GCC_UNUSED)
{
@@ -10293,7 +10502,7 @@ HandleVisualBell(Widget w GCC_UNUSED,
/* ARGSUSED */
static void
HandleIgnore(Widget w,
- XEvent * event,
+ XEvent *event,
String *params GCC_UNUSED,
Cardinal *param_count GCC_UNUSED)
{
@@ -10311,8 +10520,8 @@ HandleIgnore(Widget w,
static void
DoSetSelectedFont(Widget w,
XtPointer client_data GCC_UNUSED,
- Atom * selection GCC_UNUSED,
- Atom * type,
+ Atom *selection GCC_UNUSED,
+ Atom *type,
XtPointer value,
unsigned long *length,
int *format)
diff --git a/app/xterm/configure.in b/app/xterm/configure.in
index 9fac4f7d3..43839b4ab 100644
--- a/app/xterm/configure.in
+++ b/app/xterm/configure.in
@@ -1,4 +1,4 @@
-dnl $XTermId: configure.in,v 1.322 2014/01/16 01:44:05 tom Exp $
+dnl $XTermId: configure.in,v 1.324 2014/04/14 19:17:15 tom Exp $
dnl
dnl -----------------------------------------------------------------------------
dnl this file is part of xterm
@@ -33,8 +33,9 @@ dnl authorization.
dnl ---------------------------------------------------------------------------
dnl Process this file with autoconf to produce a configure script.
dnl
-AC_PREREQ(2.52.20030208)
-AC_INIT(charproc.c)
+AC_PREREQ(2.52.20121002)
+AC_INIT
+AC_CONFIG_SRCDIR([charproc.c])
AC_CONFIG_HEADER(xtermcfg.h:xtermcfg.hin)
CF_CHECK_CACHE
@@ -909,6 +910,20 @@ if test "$enable_dec_locator" = yes ; then
AC_DEFINE(OPT_DEC_LOCATOR,1,[Define to 1 to enable DECterm Locator support])
fi
+AC_MSG_CHECKING(if you want ReGIS graphics support)
+CF_ARG_ENABLE(regis-graphics,
+ [ --enable-regis-graphics enable ReGIS graphics support],
+ [enable_regis_graphics=yes],
+ [enable_regis_graphics=no])
+AC_MSG_RESULT($enable_regis_graphics)
+if test "$enable_regis_graphics" = yes ; then
+ AC_DEFINE(OPT_REGIS_GRAPHICS,1,[Define to 1 to enable ReGIS graphics support])
+ EXTRAHDRS="$EXTRAHDRS graphics_regis.h"
+ EXTRASRCS="$EXTRASRCS graphics_regis.c"
+ EXTRAOBJS="$EXTRAOBJS graphics_regis.o"
+ CF_MATH_LIB
+fi
+
AC_MSG_CHECKING(if you want sixel graphics support)
CF_ARG_ENABLE(sixel-graphics,
[ --enable-sixel-graphics enable sixel graphics support],
@@ -917,6 +932,13 @@ CF_ARG_ENABLE(sixel-graphics,
AC_MSG_RESULT($enable_sixel_graphics)
if test "$enable_sixel_graphics" = yes ; then
AC_DEFINE(OPT_SIXEL_GRAPHICS,1,[Define to 1 to enable sixel graphics support])
+ EXTRAHDRS="$EXTRAHDRS graphics_sixel.h"
+ EXTRASRCS="$EXTRASRCS graphics_sixel.c"
+ EXTRAOBJS="$EXTRAOBJS graphics_sixel.o"
+fi
+
+if test "$enable_regis_graphics" = yes || test "$enable_sixel_graphics" = yes ; then
+ AC_DEFINE(OPT_GRAPHICS,1,[Defined to 1 to if any graphics mode is enabled])
EXTRAHDRS="$EXTRAHDRS graphics.h"
EXTRASRCS="$EXTRASRCS graphics.c"
EXTRAOBJS="$EXTRAOBJS graphics.o"
@@ -1042,4 +1064,5 @@ then
fi
### output xtermcfg.h, etc
-AC_OUTPUT(Makefile df-install minstall:minstall.in)
+AC_CONFIG_FILES([Makefile df-install minstall:minstall.in])
+AC_OUTPUT
diff --git a/app/xterm/ctlseqs.ms b/app/xterm/ctlseqs.ms
index 3ecd453cb..8585ad5fa 100644
--- a/app/xterm/ctlseqs.ms
+++ b/app/xterm/ctlseqs.ms
@@ -1,6 +1,6 @@
.\"#! troff -ms $1 -*- Nroff -*-
.\" "Xterm Control Sequences" document
-.\" $XTermId: ctlseqs.ms,v 1.305 2014/01/13 23:02:06 tom Exp $
+.\" $XTermId: ctlseqs.ms,v 1.310 2014/05/03 00:27:29 tom Exp $
.\"
.\"
.\" Copyright 1996-2013,2014 by Thomas E. Dickey
@@ -69,8 +69,8 @@
.\"
.ds XT XTerm
.ds xt xterm
-.ds LF Patch #301
-.ds RF 2014/01/13
+.ds LF Patch #304
+.ds RF 2014/05/02
.\"
.if n .pl 9999v \" no page breaks in nroff
.ND
@@ -751,6 +751,24 @@ Delete \*(Ps Character(s) (default = 1) (DCH).
.IP \\*(Cs\\*(Ps\\*s\\*S
Scroll up \*(Ps lines (default = 1) (SU).
.
+.IP \\*(Cs\\*?\\*(Pi\\*;\\*(Pa\\*;\\*(Pv\\*s\\*S
+If configured to support either \fBSixel Graphics\fP or \fBReGIS Graphics\fP,
+\fIxterm\fP accepts a three-parameter control sequence, where \*(Pi,
+\*(Pa and \*(Pv are the \fIitem\fP, \fIaction\fP and \fIvalue\fP.
+ \*(Pi = \*1 \(-> item (color registers)
+ \*(Pa = \*1 \(-> read the number of color registers
+ \*(Pa = \*2 \(-> reset the number of color registers
+ \*(Pa = \*3 \(-> set the number of color registers to the value \*(Pv
+.br
+The control sequence returns a response using the same form:
+.ID
+\*(Cs\*?\*(Pi\*;\*(Ps\*;\*(Pv\*s\*S
+.DE
+.br
+where \*(Ps is the status:
+ \*(Ps = \*0 \(-> success
+ \*(Ps = \*3 \(-> failure
+.
.IP \\*(Cs\\*(Ps\\*s\\*T
Scroll down \*(Ps lines (default = 1) (SD).
.
@@ -1673,6 +1691,7 @@ The \fIdynamic colors\fR can also be reset to their default (resource) values:
\*(Ps = \*1\*1\*6 \(-> Reset Tektronix background color.
\*(Ps = \*1\*1\*7 \(-> Reset highlight color.
\*(Ps = \*1\*1\*8 \(-> Reset Tektronix cursor color.
+ \*(Ps = \*1\*1\*9 \(-> Reset highlight foreground color.
.
.St
.Ss Privacy Message
@@ -1902,7 +1921,7 @@ c | l .
13 Meta + Ctrl
14 Meta + Ctrl + Shift
15 Meta + Ctrl + Alt
-16 Meta + Ctrl +Alt + Shift
+16 Meta + Ctrl + Alt + Shift
_
.TE
For example, shift-F5 would be sent as
@@ -2367,7 +2386,7 @@ and \*m for button release.
.RS
.bP
The encoded button value in this case does not add 32 since
-that was useful only in the X10 scheme for ensuring that the
+that was useful only in the X10 scheme for ensuring that the
byte containing the button value is a printable code.
.bP
The modifiers are encoded in the same way.
@@ -2398,20 +2417,22 @@ it is not an improvement over 1005.
If \fI\*(xt\fP is configured as
VT240,
VT241,
-VT330 or
-VT340
+VT330,
+VT340 or
+VT382
using the \fBdecTerminalID\fP resource,
-it supports Sixel Graphics controls, a subset of ReGIS graphics.
+it supports Sixel Graphics controls, a palleted bitmap graphics system
+using sets of six vertical pixels as the basic element.
.St
.IP \\*(Cs\\*(Ps\\*s\\*c
\fI\*(xt\fP responds to Send Device Attributes (Primary DA) with these
additional codes:
- \*(Ps = \*3 \(-> ReGIS graphics.
- \*(Ps = \*4 \(-> SIXEL graphics.
+ \*(Ps = \*4 \(-> Sixel graphics.
.IP \\*(Cs\\*?\\*(Pm\\*s\\*h
\fI\*(xt\fP has these additional private Set Mode values:
- \*(Ps = \*8\*0 \(-> SIXEL scrolling.
+ \*(Ps = \*8\*0 \(-> Sixel scrolling.
\*(Ps = \*1\*0\*7\*0 \(-> use private color registers for each graphic.
+ \*(Ps = \*8\*4\*5\*2 \(-> Sixel scrolling leaves cursor to right of graphic.
.IP \\*(Dc\\*(Pa\\*;\\*(Pb\\*;\\*(Ph\\*s\\*q\\*s\\*(Ps..\\*(Ps\fP\\*s\\*(ST
See
.ID
@@ -2425,6 +2446,37 @@ following the \*q with sixel data.
\*(Ps \(-> sixel data
.Ed
.
+.Sh "ReGIS Graphics"
+.LP
+If \fI\*(xt\fP is configured as
+VT125,
+VT240,
+VT241,
+VT330 or
+VT340
+using the \fBdecTerminalID\fP resource,
+it supports Remote Graphic Instruction Set, a graphics description language.
+.St
+.IP \\*(Cs\\*(Ps\\*s\\*c
+\fI\*(xt\fP responds to Send Device Attributes (Primary DA) with these
+additional codes:
+ \*(Ps = \*3 \(-> ReGIS graphics.
+.IP \\*(Cs\\*?\\*(Pm\\*s\\*h
+\fI\*(xt\fP has these additional private Set Mode values:
+ \*(Ps = \*1\*0\*7\*0 \(-> use private color registers for each graphic.
+.IP \\*(Dc\\*(Pm\\*s\\*p\\*(Pr..\\*(Pr\fP\\*s\\*(ST
+See
+.ID
+http://vt100.net/docs/vt3xx-gp/chapter1.html
+.DE
+The ReGIS data device control string has one positional parameter
+with four possible values:
+ \*(Pm = 0 \(-> resume command, use fullscreen mode
+ \*(Pm = 1 \(-> start new command, use fullscreen mode
+ \*(Pm = 2 \(-> resume command, use command display mode
+ \*(Pm = 3 \(-> start new command, use command display mode
+.Ed
+.
.Sh "Tektronix 4014 Mode"
.LP
Most of these sequences are standard Tektronix 4014 control sequences.
diff --git a/app/xterm/ctlseqs.txt b/app/xterm/ctlseqs.txt
index 763a44ca7..ef0984d17 100644
--- a/app/xterm/ctlseqs.txt
+++ b/app/xterm/ctlseqs.txt
@@ -21,7 +21,7 @@
Thomas Dickey
XFree86 Project (1996-2006)
invisible-island.net (2006-2013)
- updated for XTerm Patch #301 (2014/01/13)
+ updated for XTerm Patch #304 (2014/05/02)
@@ -270,6 +270,21 @@ CSI Ps L Insert Ps Line(s) (default = 1) (IL).
CSI Ps M Delete Ps Line(s) (default = 1) (DL).
CSI Ps P Delete Ps Character(s) (default = 1) (DCH).
CSI Ps S Scroll up Ps lines (default = 1) (SU).
+CSI ? Pi; Pa; Pv S
+ If configured to support either Sixel Graphics or ReGIS Graph-
+ ics, xterm accepts a three-parameter control sequence, where
+ Pi, Pa and Pv are the item, action and value.
+ Pi = 1 -> item (color registers)
+ Pa = 1 -> read the number of color registers
+ Pa = 2 -> reset the number of color registers
+ Pa = 3 -> set the number of color registers to the value Pv
+ The control sequence returns a response using the same form:
+
+ CSI ? Pi; Ps; Pv S
+
+ where Ps is the status:
+ Ps = 0 -> success
+ Ps = 3 -> failure
CSI Ps T Scroll down Ps lines (default = 1) (SD).
CSI Ps ; Ps ; Ps ; Ps ; Ps T
Initiate highlight mouse tracking. Parameters are
@@ -1091,6 +1106,7 @@ OSC Ps ; Pt BEL
Ps = 1 1 6 -> Reset Tektronix background color.
Ps = 1 1 7 -> Reset highlight color.
Ps = 1 1 8 -> Reset Tektronix cursor color.
+ Ps = 1 1 9 -> Reset highlight foreground color.
Privacy Message
PM Pt ST xterm implements no PM functions; Pt is ignored. Pt need not
@@ -1251,24 +1267,24 @@ In normal mode, i.e., a Sun/PC keyboard when the sunKeyboard resource is
false, xterm recognizes function key modifiers which are parameters
appended before the final character of the control sequence.
- Code Modifiers
- ---------+--------------------------
- 2 | Shift
- 3 | Alt
- 4 | Shift + Alt
- 5 | Control
- 6 | Shift + Control
- 7 | Alt + Control
- 8 | Shift + Alt + Control
- 9 | Meta
- 10 | Meta + Shift
- 11 | Meta + Alt
- 12 | Meta + Alt + Shift
- 13 | Meta + Ctrl
- 14 | Meta + Ctrl + Shift
- 15 | Meta + Ctrl + Alt
- 16 | Meta + Ctrl +Alt + Shift
- ---------+--------------------------
+ Code Modifiers
+ ---------+---------------------------
+ 2 | Shift
+ 3 | Alt
+ 4 | Shift + Alt
+ 5 | Control
+ 6 | Shift + Control
+ 7 | Alt + Control
+ 8 | Shift + Alt + Control
+ 9 | Meta
+ 10 | Meta + Shift
+ 11 | Meta + Alt
+ 12 | Meta + Alt + Shift
+ 13 | Meta + Ctrl
+ 14 | Meta + Ctrl + Shift
+ 15 | Meta + Ctrl + Alt
+ 16 | Meta + Ctrl + Alt + Shift
+ ---------+---------------------------
For example, shift-F5 would be sent as CSI 1 5 ; 2 ~
@@ -1646,19 +1662,21 @@ URXVT (1015)
improvement over 1005.
Sixel Graphics
-If xterm is configured as VT240, VT241, VT330 or VT340 using the decTer-
-minalID resource, it supports Sixel Graphics controls, a subset of ReGIS
-graphics.
+If xterm is configured as VT240, VT241, VT330, VT340 or VT382 using the
+decTerminalID resource, it supports Sixel Graphics controls, a palleted
+bitmap graphics system using sets of six vertical pixels as the basic
+element.
CSI Ps c xterm responds to Send Device Attributes (Primary DA) with
these additional codes:
- Ps = 3 -> ReGIS graphics.
- Ps = 4 -> SIXEL graphics.
+ Ps = 4 -> Sixel graphics.
CSI ? Pm h
xterm has these additional private Set Mode values:
- Ps = 8 0 -> SIXEL scrolling.
+ Ps = 8 0 -> Sixel scrolling.
Ps = 1 0 7 0 -> use private color registers for each
graphic.
+ Ps = 8 4 5 2 -> Sixel scrolling leaves cursor to right of
+ graphic.
DCS Pa; Pb; Ph q Ps..Ps ST
See
@@ -1671,6 +1689,30 @@ DCS Pa; Pb; Ph q Ps..Ps ST
Ph -> horizontal grid size (ignored).
Ps -> sixel data
+ReGIS Graphics
+If xterm is configured as VT125, VT240, VT241, VT330 or VT340 using the
+decTerminalID resource, it supports Remote Graphic Instruction Set, a
+graphics description language.
+
+CSI Ps c xterm responds to Send Device Attributes (Primary DA) with
+ these additional codes:
+ Ps = 3 -> ReGIS graphics.
+CSI ? Pm h
+ xterm has these additional private Set Mode values:
+ Ps = 1 0 7 0 -> use private color registers for each
+ graphic.
+DCS Pm p Pr..Pr ST
+ See
+
+ http://vt100.net/docs/vt3xx-gp/chapter1.html
+
+ The ReGIS data device control string has one positional param-
+ eter with four possible values:
+ Pm = 0 -> resume command, use fullscreen mode
+ Pm = 1 -> start new command, use fullscreen mode
+ Pm = 2 -> resume command, use command display mode
+ Pm = 3 -> start new command, use command display mode
+
Tektronix 4014 Mode
Most of these sequences are standard Tektronix 4014 control sequences.
Graph mode supports the 12-bit addressing of the Tektronix 4014. The
diff --git a/app/xterm/data.h b/app/xterm/data.h
index a3e093a0c..c2ee4c8cc 100644
--- a/app/xterm/data.h
+++ b/app/xterm/data.h
@@ -1,7 +1,7 @@
-/* $XTermId: data.h,v 1.123 2013/11/23 17:00:45 tom Exp $ */
+/* $XTermId: data.h,v 1.124 2014/03/02 12:01:26 tom Exp $ */
/*
- * Copyright 2002-2012,2013 by Thomas E. Dickey
+ * Copyright 2002-2013,2014 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -205,6 +205,9 @@ typedef struct XTERM_RESOURCE {
Boolean ptyHandshake; /* use pty-handshaking */
Boolean ptySttySize; /* reset TTY size after pty handshake */
#endif
+#if OPT_REPORT_COLORS
+ Boolean reportColors; /* show color information as allocated */
+#endif
#if OPT_REPORT_FONTS
Boolean reportFonts; /* show bitmap-font information as loaded */
#endif
diff --git a/app/xterm/doublechr.c b/app/xterm/doublechr.c
index d228e7f39..906d2bd85 100644
--- a/app/xterm/doublechr.c
+++ b/app/xterm/doublechr.c
@@ -1,7 +1,7 @@
-/* $XTermId: doublechr.c,v 1.83 2013/08/30 21:35:13 tom Exp $ */
+/* $XTermId: doublechr.c,v 1.84 2014/04/25 23:41:42 tom Exp $ */
/*
- * Copyright 1997-2012,2013 by Thomas E. Dickey
+ * Copyright 1997-2013,2014 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -161,6 +161,8 @@ xterm_ResetDouble(XtermWidget xw)
if (changed) {
xtermRepaint(xw);
}
+#else
+ (void) xw;
#endif
}
diff --git a/app/xterm/fontutils.c b/app/xterm/fontutils.c
index 42dc0be11..42a959865 100644
--- a/app/xterm/fontutils.c
+++ b/app/xterm/fontutils.c
@@ -1,7 +1,7 @@
-/* $XTermId: fontutils.c,v 1.400 2013/12/09 12:20:31 tom Exp $ */
+/* $XTermId: fontutils.c,v 1.405 2014/05/03 10:49:26 tom Exp $ */
/*
- * Copyright 1998-2012,2013 by Thomas E. Dickey
+ * Copyright 1998-2013,2014 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -124,7 +124,7 @@ static int lookupOneFontSize(XtermWidget, int);
#if OPT_REPORT_FONTS || OPT_WIDE_CHARS
static unsigned
-countGlyphs(XFontStruct * fp)
+countGlyphs(XFontStruct *fp)
{
unsigned count = 0;
@@ -149,7 +149,7 @@ countGlyphs(XFontStruct * fp)
* filtering out the worst of the font mismatches.
*/
static Bool
-compatibleWideCounts(XFontStruct * wfs, XFontStruct * wbfs)
+compatibleWideCounts(XFontStruct *wfs, XFontStruct *wbfs)
{
unsigned count_w = countGlyphs(wfs);
unsigned count_wb = countGlyphs(wbfs);
@@ -255,7 +255,7 @@ check_fontname(const char *name)
* or NULL on error.
*/
static FontNameProperties *
-get_font_name_props(Display *dpy, XFontStruct * fs, char **result)
+get_font_name_props(Display *dpy, XFontStruct *fs, char **result)
{
static FontNameProperties props;
static char *last_name;
@@ -372,7 +372,10 @@ alloca_fontname(char **result, size_t next)
if (want >= have) {
want = ALLOCHUNK(want);
if (last != 0) {
+ char *save = *result;
*result = TypeRealloc(char, want, *result);
+ if (*result == 0)
+ free(save);
} else {
if ((*result = TypeMallocN(char, want)) != 0)
**result = '\0';
@@ -412,7 +415,7 @@ append_fontname_num(char **result, int value)
* by the caller.
*/
static char *
-derive_font_name(FontNameProperties * props,
+derive_font_name(FontNameProperties *props,
const char *use_weight,
int use_average_width,
const char *use_encoding)
@@ -436,7 +439,7 @@ derive_font_name(FontNameProperties * props,
}
static char *
-bold_font_name(FontNameProperties * props, int use_average_width)
+bold_font_name(FontNameProperties *props, int use_average_width)
{
return derive_font_name(props, "bold", use_average_width, props->end);
}
@@ -446,13 +449,13 @@ bold_font_name(FontNameProperties * props, int use_average_width)
derive_font_name(props, weight, props->average_width * 2, "ISO10646-1")
static char *
-wide_font_name(FontNameProperties * props)
+wide_font_name(FontNameProperties *props)
{
return derive_wide_font(props, "medium");
}
static char *
-widebold_font_name(FontNameProperties * props)
+widebold_font_name(FontNameProperties *props)
{
return derive_wide_font(props, "bold");
}
@@ -582,7 +585,7 @@ same_font_name(const char *pattern, const char *match)
* offset.
*/
static int
-got_bold_font(Display *dpy, XFontStruct * fs, String requested)
+got_bold_font(Display *dpy, XFontStruct *fs, String requested)
{
char *actual = 0;
int got;
@@ -601,7 +604,7 @@ got_bold_font(Display *dpy, XFontStruct * fs, String requested)
* leave trash on the display when we mix normal and bold fonts.
*/
static int
-same_font_size(XtermWidget xw, XFontStruct * nfs, XFontStruct * bfs)
+same_font_size(XtermWidget xw, XFontStruct *nfs, XFontStruct *bfs)
{
TScreen *screen = TScreenOf(xw);
TRACE(("same_font_size height %d/%d, min %d/%d max %d/%d\n",
@@ -621,7 +624,7 @@ same_font_size(XtermWidget xw, XFontStruct * nfs, XFontStruct * bfs)
* Check if the font looks like it has fixed width
*/
static int
-is_fixed_font(XFontStruct * fs)
+is_fixed_font(XFontStruct *fs)
{
if (fs)
return (fs->min_bounds.width == fs->max_bounds.width);
@@ -634,7 +637,7 @@ is_fixed_font(XFontStruct * fs)
*/
#if OPT_WIDE_CHARS
static int
-is_double_width_font(XFontStruct * fs)
+is_double_width_font(XFontStruct *fs)
{
return ((2 * fs->min_bounds.width) == fs->max_bounds.width);
}
@@ -663,7 +666,7 @@ is_double_width_font(XFontStruct * fs)
#define FULL_WIDTH_CHAR2 0xAC00 /* Korean script syllable 'Ka' */
static Bool
-is_double_width_font_xft(Display *dpy, XftFont * font)
+is_double_width_font_xft(Display *dpy, XftFont *font)
{
XGlyphInfo gi1, gi2;
FcChar32 c1 = HALF_WIDTH_CHAR1, c2 = HALF_WIDTH_CHAR2;
@@ -1354,7 +1357,15 @@ xtermLoadFont(XtermWidget xw,
free(tmpname);
#if OPT_RENDERFONT
- if (x_strcasecmp(myfonts.f_n, DEFFONT)) {
+ if (fontnum == fontMenu_fontsel) {
+ int old_fontnum = screen->menu_font_number;
+#if OPT_TOOLBAR
+ SetItemSensitivity(fontMenuEntries[fontnum].widget, True);
+#endif
+ Bell(xw, XkbBI_MinorError, 0);
+ myfonts.f_n = screen->MenuFontName(old_fontnum);
+ return xtermLoadFont(xw, &myfonts, doresize, old_fontnum);
+ } else if (x_strcasecmp(myfonts.f_n, DEFFONT)) {
int code;
myfonts.f_n = DEFFONT;
@@ -1551,7 +1562,7 @@ xtermLoadVTFonts(XtermWidget xw, String myName, String myClass)
#if OPT_WIDE_CHARS
static Bool
-isWideFont(XFontStruct * fp, const char *tag, Bool nullOk)
+isWideFont(XFontStruct *fp, const char *tag, Bool nullOk)
{
Bool result = False;
@@ -1617,7 +1628,7 @@ xtermLoadDefaultFonts(XtermWidget xw)
#if OPT_LOAD_VTFONTS
void
HandleLoadVTFonts(Widget w,
- XEvent * event GCC_UNUSED,
+ XEvent *event GCC_UNUSED,
String *params GCC_UNUSED,
Cardinal *param_count GCC_UNUSED)
{
@@ -1703,7 +1714,7 @@ xtermSetCursorBox(TScreen *screen)
#if OPT_RENDERFONT
static FcChar32
-xtermXftFirstChar(XftFont * xft)
+xtermXftFirstChar(XftFont *xft)
{
FcChar32 map[FC_CHARSET_MAP_SIZE];
FcChar32 next;
@@ -1725,7 +1736,7 @@ xtermXftFirstChar(XftFont * xft)
}
static FcChar32
-xtermXftLastChar(XftFont * xft)
+xtermXftLastChar(XftFont *xft)
{
FcChar32 this, last, next;
FcChar32 map[FC_CHARSET_MAP_SIZE];
@@ -1749,7 +1760,7 @@ xtermXftLastChar(XftFont * xft)
#if OPT_TRACE > 1
static void
-dumpXft(XtermWidget xw, XTermXftFonts * data)
+dumpXft(XtermWidget xw, XTermXftFonts *data)
{
XftFont *xft = data->font;
TScreen *screen = TScreenOf(xw);
@@ -1784,7 +1795,7 @@ dumpXft(XtermWidget xw, XTermXftFonts * data)
#endif
static void
-checkXft(XtermWidget xw, XTermXftFonts * data, XftFont * xft)
+checkXft(XtermWidget xw, XTermXftFonts *data, XftFont *xft)
{
FcChar32 c;
Dimension width = 0;
@@ -1818,10 +1829,10 @@ checkXft(XtermWidget xw, XTermXftFonts * data, XftFont * xft)
static void
reportXftFonts(XtermWidget xw,
- XftFont * fp,
+ XftFont *fp,
const char *name,
const char *tag,
- XftPattern * match)
+ XftPattern *match)
{
if (resource.reportFonts) {
char buffer[1024];
@@ -1854,7 +1865,7 @@ reportXftFonts(XtermWidget xw,
}
static XftFont *
-xtermOpenXft(XtermWidget xw, const char *name, XftPattern * pat, const char *tag)
+xtermOpenXft(XtermWidget xw, const char *name, XftPattern *pat, const char *tag)
{
TScreen *screen = TScreenOf(xw);
Display *dpy = screen->display;
@@ -1921,7 +1932,7 @@ dimSquareRoot(double value)
* rule.
*/
static void
-setRenderFontsize(TScreen *screen, VTwin * win, XftFont * font, const char *tag)
+setRenderFontsize(TScreen *screen, VTwin *win, XftFont *font, const char *tag)
{
if (font != 0) {
int width, height, ascent, descent;
@@ -1978,7 +1989,7 @@ checkFontInfo(int value, const char *tag)
#if OPT_RENDERFONT
void
-xtermCloseXft(TScreen *screen, XTermXftFonts * pub)
+xtermCloseXft(TScreen *screen, XTermXftFonts *pub)
{
if (pub->font != 0) {
XftFontClose(screen->display, pub->font);
@@ -2039,8 +2050,8 @@ setFaceName(XtermWidget xw, const char *value)
*/
void
xtermComputeFontInfo(XtermWidget xw,
- VTwin * win,
- XFontStruct * font,
+ VTwin *win,
+ XFontStruct *font,
int sbwidth)
{
TScreen *screen = TScreenOf(xw);
@@ -2268,7 +2279,7 @@ xtermComputeFontInfo(XtermWidget xw,
/* save this information as a side-effect for double-sized characters */
void
-xtermSaveFontInfo(TScreen *screen, XFontStruct * font)
+xtermSaveFontInfo(TScreen *screen, XFontStruct *font)
{
screen->fnt_wide = (Dimension) (font->max_bounds.width);
screen->fnt_high = (Dimension) (font->ascent + font->descent);
@@ -2728,7 +2739,7 @@ xtermDrawBoxChar(XtermWidget xw,
* see xc/lib/Xft/xftglyphs.c
*/
Bool
-xtermXftMissing(XtermWidget xw, XftFont * font, unsigned wc)
+xtermXftMissing(XtermWidget xw, XftFont *font, unsigned wc)
{
Bool result = False;
@@ -2886,11 +2897,23 @@ lookupFontSizes(XtermWidget xw)
}
#if OPT_RENDERFONT
+static double
+defaultFaceSize(void)
+{
+ double result;
+ float value;
+
+ if (sscanf(DEFFACESIZE, "%f", &value) == 1)
+ result = value;
+ else
+ result = 14.0;
+ return result;
+}
+
static void
fillInFaceSize(XtermWidget xw, int fontnum)
{
TScreen *screen = TScreenOf(xw);
- float value;
double face_size = xw->misc.face_size[fontnum];
if (face_size <= 0.0) {
@@ -2905,8 +2928,7 @@ fillInFaceSize(XtermWidget xw, int fontnum)
*/
(void) lookupOneFontSize(xw, 0);
if (fontnum == fontMenu_default) {
- sscanf(DEFFACESIZE, "%f", &value);
- face_size = value;
+ face_size = defaultFaceSize();
} else if (lookupOneFontSize(xw, fontnum)
&& (screen->menu_font_sizes[0]
!= screen->menu_font_sizes[fontnum])) {
@@ -2936,8 +2958,7 @@ fillInFaceSize(XtermWidget xw, int fontnum)
face_size = LikeBitmap(60.0);
break;
default:
- sscanf(DEFFACESIZE, "%f", &value);
- face_size = value;
+ face_size = defaultFaceSize();
break;
case fontMenu_font4:
face_size = LikeBitmap(90.0);
@@ -3086,7 +3107,7 @@ lookupRelativeFontSize(XtermWidget xw, int old, int relative)
/* ARGSUSED */
void
HandleLargerFont(Widget w GCC_UNUSED,
- XEvent * event GCC_UNUSED,
+ XEvent *event GCC_UNUSED,
String *params GCC_UNUSED,
Cardinal *param_count GCC_UNUSED)
{
@@ -3111,7 +3132,7 @@ HandleLargerFont(Widget w GCC_UNUSED,
/* ARGSUSED */
void
HandleSmallerFont(Widget w GCC_UNUSED,
- XEvent * event GCC_UNUSED,
+ XEvent *event GCC_UNUSED,
String *params GCC_UNUSED,
Cardinal *param_count GCC_UNUSED)
{
@@ -3181,7 +3202,7 @@ xtermGetFont(const char *param)
/* ARGSUSED */
void
HandleSetFont(Widget w GCC_UNUSED,
- XEvent * event GCC_UNUSED,
+ XEvent *event GCC_UNUSED,
String *params,
Cardinal *param_count)
{
diff --git a/app/xterm/graphics.c b/app/xterm/graphics.c
index 28719d09f..cb262e04a 100644
--- a/app/xterm/graphics.c
+++ b/app/xterm/graphics.c
@@ -1,7 +1,7 @@
-/* $XTermId: graphics.c,v 1.17 2013/11/26 22:15:21 tom Exp $ */
+/* $XTermId: graphics.c,v 1.42 2014/05/03 14:26:57 tom Exp $ */
/*
- * Copyright 2013 by Ross Combs
+ * Copyright 2013,2014 by Ross Combs
*
* All Rights Reserved
*
@@ -33,227 +33,289 @@
#include <xterm.h>
#include <stdio.h>
-#include <math.h>
#include <ctype.h>
#include <stdlib.h>
#include <data.h>
-#include <VTparse.h>
#include <ptyx.h>
#include <assert.h>
#include <graphics.h>
-#undef DUMP_SIXEL_BITMAP
+#undef DUMP_BITMAP
+#undef DUMP_COLORS
+#undef DEBUG_PALETTE
+#undef DEBUG_PIXEL
#undef DEBUG_REFRESH
/* TODO:
* ReGIS:
- * - everything
+ * - shading with text
+ * - polygon filling
+ * - plane write control
+ * - fix interpolated curves to more closely match implementation (identical despite direction and starting point)
+ * - text
+ * - input and output cursors
+ * - mouse input
+ * - stacks
+ * - investigate second graphic page for ReGIS -- does it also apply to text and sixel graphics? are the contents preserved?
+ * - font upload, italics, and other text attributes
+ * - enter/leave during a command
+ * - command display mode
+ * - scrolling
+ * - custom coordinate systems
+ * - scaling/re-rasterization to fit screen
+ * - macros
* sixel:
+ * - fix problem where new_row < 0 during sixel parsing (see FIXME)
+ * VT55/VT105 waveform graphics
+ * - everything
+ * common:
+ * - handle light/dark screen modes (CSI?5[hl])
+ * - update text fg/bg color which overlaps images
* - erase graphic when erasing screen
+ * - handle graphic updates in scroll regions
+ * - handle rectangular area copies (verify they work with graphics)
* - maintain ordered list/array instead of qsort()
- * - erase text under graphics if bg not transparent
+ * - erase text under graphic if bg not transparent to avoid flickering (or not: bad if the font changes or window resizes)
+ * - erase graphics under graphic if same origin and bg not transparent to avoid flickering
* - erase scrolled portions of all graphics on alt buffer
* - delete graphic if scrolled past end of scrollback
* - delete graphic if all pixels are transparent/erased
- * - dynamic memory allocation, add configurable limits
+ * - dynamic memory allocation of graphics buffers, add configurable limits
* - auto convert color graphics in VT330 mode
- * - investigate second graphic framebuffer for ReGIS -- does this apply to text and sixel graphics?
- * - fix problem where new_row < 0 during sixel parsing (see FIXME)
- * VT55/VT105 waveform graphics
- * - everything
- * escape sequences
+ * - posturize requested colors to match hardware palettes (e.g. four possible shades on VT240)
+ * - color register report/restore
+ * escape sequences:
* - way to query font size without "window ops" (or make "window ops" permissions more fine grained)
* - way to query and/or set the maximum number of color registers
+ * - way to query and set the number of graphics pages
+ * ReGIS extensions:
+ * - gradients
+ * - line width (RLogin has this and it is mentioned in docs for the DEC ReGIS to Postscript converter)
+ * - F option for screen command (mentioned in docs for the DEC ReGIS to Postscript converter)
+ * - transparency
+ * - background color as stackable write control
+ * - RGB triplets
+ * - true color (virtual color registers created upon lookup)
+ * - anti-aliasing
*/
/* font sizes:
* VT510:
* 80 Columns 132 Columns Maximum Number of Lines
* 10 x 16 6 x 16 26 lines + keyboard indicator line
+ * 10 x 13 6 x 13 26 lines + keyboard indicator line
* 10 x 10 6 x 10 42 lines + keyboard indicator line
* 10 x 8 6 x 8 53 lines + keyboard indicator line
- * 10 x 13 6 x 13 26 lines + keyboard indicator line
*/
-/***====================================================================***/
-/*
- * Parse numeric parameters which have the operator as a prefix rather than a
- * suffix as in ANSI format.
- *
- * # 0
- * #1 1
- * #1; 1
- * "1;2;640;480 4
- * #1;2;0;0;0 5
- */
-static void
-parse_prefixedtype_params(ANSI *params, const char **string)
+#define FOR_EACH_SLOT(ii) for (ii = 0U; ii < MAX_GRAPHICS; ii++)
+
+static ColorRegister *shared_color_registers;
+static Graphic *displayed_graphics[MAX_GRAPHICS];
+static unsigned next_graphic_id = 0U;
+
+static ColorRegister *
+allocRegisters(void)
{
- const char *cp = *string;
- ParmType nparam = 0;
- int last_empty = 1;
-
- memset(params, 0, sizeof(*params));
- params->a_final = CharOf(*cp);
- if (*cp != '\0')
- cp++;
-
- while (*cp != '\0') {
- Char ch = CharOf(*cp);
-
- if (isdigit(ch)) {
- last_empty = 0;
- if (nparam < NPARAM) {
- params->a_param[nparam] =
- (ParmType) ((params->a_param[nparam] * 10)
- + (ch - '0'));
- }
- } else if (ch == ';') {
- last_empty = 1;
- nparam++;
- } else if (ch == ' ' || ch == '\r' || ch == '\n') {
- /* EMPTY */ ;
- } else {
- break;
+ return TypeCallocN(ColorRegister, MAX_COLOR_REGISTERS);
+}
+
+static Graphic *
+freeGraphic(Graphic *obj)
+{
+ if (obj) {
+ if (obj->pixels)
+ free(obj->pixels);
+ if (obj->private_color_registers)
+ free(obj->private_color_registers);
+ free(obj);
+ }
+ return NULL;
+}
+
+static Graphic *
+allocGraphic(void)
+{
+ Graphic *result = TypeCalloc(Graphic);
+ if (result) {
+ if (!(result->pixels = TypeCallocN(RegisterNum, MAX_PIXELS))) {
+ result = freeGraphic(result);
+ } else if (!(result->private_color_registers = allocRegisters())) {
+ result = freeGraphic(result);
}
- cp++;
}
+ return result;
+}
- *string = cp;
- if (!last_empty)
- nparam++;
- if (nparam > NPARAM)
- params->a_nparam = NPARAM;
- else
- params->a_nparam = nparam;
+static Graphic *
+getActiveSlot(unsigned n)
+{
+ if (n < MAX_GRAPHICS &&
+ displayed_graphics[n] &&
+ displayed_graphics[n]->valid) {
+ return displayed_graphics[n];
+ }
+ return NULL;
}
-typedef struct {
- Pixel pix;
- short r, g, b;
- short allocated;
-} ColorRegister;
-
-#define MAX_COLOR_REGISTERS 256U
-#define COLOR_HOLE ((unsigned short)MAX_COLOR_REGISTERS)
-#define BUFFER_WIDTH 1000
-#define BUFFER_HEIGHT 800
-typedef struct {
- RegisterNum pixels[BUFFER_HEIGHT * BUFFER_WIDTH];
- ColorRegister private_color_registers[MAX_COLOR_REGISTERS];
- ColorRegister *color_registers;
- char color_registers_used[MAX_COLOR_REGISTERS];
- XtermWidget xw;
- int max_width; /* largest image which can be stored */
- int max_height; /* largest image which can be stored */
- RegisterNum current_register;
- int valid_registers; /* for wrap-around behavior */
- int device_background; /* 0: set to color 0, 1: unchanged */
- int background; /* current background color */
- int aspect_vertical;
- int aspect_horizontal;
- int declared_width; /* size as reported by the application */
- int declared_height; /* size as reported by the application */
- int actual_width; /* size measured during parsing */
- int actual_height; /* size measured during parsing */
- int private_colors; /* if not using the shared color registers */
- int charrow; /* upper left starting point in characters */
- int charcol; /* upper left starting point in characters */
- int pixw; /* width of graphic pixels in screen pixels */
- int pixh; /* height of graphic pixels in screen pixels */
- int row; /* context used during parsing */
- int col; /* context used during parsing */
- int bufferid; /* which screen buffer the graphic is associated with */
- unsigned int id; /* sequential id used for preserving layering */
- int valid; /* if the graphic has been initialized */
- int dirty; /* if the graphic needs to be redrawn */
-} SixelGraphic;
-
-static unsigned int next_sixel_id = 0U;
-
-static ColorRegister shared_color_registers[MAX_COLOR_REGISTERS];
-
-#define MAX_SIXEL_GRAPHICS 16U
-static SixelGraphic sixel_graphics[MAX_SIXEL_GRAPHICS];
-
-/* sixel scrolling:
- * VK100/GIGI ? (did it even support Sixel?)
- * VT125 unsupported
- * VT240 unsupported
- * VT241 unsupported
- * VT330 mode setting
- * VT340 mode setting
- * dxterm ?
- */
+static Graphic *
+getInactiveSlot(unsigned n)
+{
+ if (n < MAX_GRAPHICS &&
+ (!displayed_graphics[n] ||
+ !displayed_graphics[n]->valid)) {
+ if (!displayed_graphics[n]) {
+ displayed_graphics[n] = allocGraphic();
+ }
+ return displayed_graphics[n];
+ }
+ return NULL;
+}
+
+static ColorRegister *
+getSharedRegisters(void)
+{
+ if (!shared_color_registers)
+ shared_color_registers = allocRegisters();
+ return shared_color_registers;
+}
static void
-init_sixel_background(SixelGraphic *graphic)
+deactivateSlot(unsigned n)
{
- RegisterNum bgcolor = (RegisterNum) graphic->background;
- int r, c;
+ if (n < MAX_GRAPHICS) {
+ displayed_graphics[n] = freeGraphic(displayed_graphics[n]);
+ }
+}
- TRACE(("initializing sixel background to size=%dx%d bgcolor=%hu\n",
- graphic->declared_width,
- graphic->declared_height,
- bgcolor));
- for (r = 0; r < graphic->max_height; r++) {
- for (c = 0; c < graphic->max_width; c++) {
- if (c < graphic->declared_width && r < graphic->declared_height) {
- graphic->pixels[r * graphic->max_width + c] = bgcolor;
- } else {
- graphic->pixels[r * graphic->max_width + c] = COLOR_HOLE;
- }
- }
+extern RegisterNum
+read_pixel(Graphic *graphic, int x, int y)
+{
+ if (x < 0 && x >= graphic->actual_width &&
+ y < 0 && y >= graphic->actual_height) {
+ return COLOR_HOLE;
}
+
+ return graphic->pixels[y * graphic->max_width + x];
}
-static void
-set_sixel(SixelGraphic *graphic, int sixel)
+void
+draw_solid_pixel(Graphic *graphic, int x, int y, unsigned color)
{
- RegisterNum color;
- int pix;
+ assert(color <= MAX_COLOR_REGISTERS);
- color = graphic->current_register;
- TRACE(("drawing sixel at pos=%d,%d color=%hu (hole=%d, [%d,%d,%d])\n",
- graphic->col,
- graphic->row,
+#ifdef DEBUG_PIXEL
+ TRACE(("drawing pixel at %d,%d color=%hu (hole=%hu, [%d,%d,%d])\n",
+ x,
+ y,
color,
- color == COLOR_HOLE,
+ COLOR_HOLE,
((color != COLOR_HOLE)
- ? (unsigned int) graphic->color_registers[color].r : 0U),
+ ? (unsigned) graphic->color_registers[color].r : 0U),
((color != COLOR_HOLE)
- ? (unsigned int) graphic->color_registers[color].g : 0U),
+ ? (unsigned) graphic->color_registers[color].g : 0U),
((color != COLOR_HOLE)
- ? (unsigned int) graphic->color_registers[color].b : 0U)));
- for (pix = 0; pix < 6; pix++) {
- if (graphic->col < graphic->max_width &&
- graphic->row + pix < graphic->max_height) {
- if (sixel & (1 << pix)) {
- if (graphic->col + 1 > graphic->actual_width) {
- graphic->actual_width = graphic->col + 1;
- }
- if (graphic->row + pix + 1 > graphic->actual_height) {
- graphic->actual_height = graphic->row + pix + 1;
- }
- graphic->pixels[
- (((graphic->row + pix) * graphic->max_width)
- + graphic->col)
- ] = color;
+ ? (unsigned) graphic->color_registers[color].b : 0U)));
+#endif
+ if (x >= 0 && x < graphic->actual_width &&
+ y >= 0 && y < graphic->actual_height) {
+ graphic->pixels[y * graphic->max_width + x] = (RegisterNum) color;
+ if (color < MAX_COLOR_REGISTERS)
+ graphic->color_registers_used[color] = 1;
+ } else {
+ TRACE(("pixel %d,%d out of bounds\n", x, y));
+ }
+}
+
+void
+draw_solid_rectangle(Graphic *graphic, int x1, int y1, int x2, int y2, unsigned color)
+{
+ int x, y;
+ int tmp;
+
+ assert(color <= MAX_COLOR_REGISTERS);
+
+ if (x1 > x2) {
+ EXCHANGE(x1, x2, tmp);
+ }
+ if (y1 > y2) {
+ EXCHANGE(y1, y2, tmp);
+ }
+
+ for (y = y1; y <= y2; y++)
+ for (x = x1; x < x2; x++)
+ draw_solid_pixel(graphic, x, y, color);
+}
+
+void
+draw_solid_line(Graphic *graphic, int x1, int y1, int x2, int y2, unsigned color)
+{
+ int x, y;
+ int dx, dy;
+ int dir, diff;
+
+ assert(color <= MAX_COLOR_REGISTERS);
+
+ dx = abs(x1 - x2);
+ dy = abs(y1 - y2);
+
+ if (dx > dy) {
+ if (x1 > x2) {
+ int tmp;
+ EXCHANGE(x1, x2, tmp);
+ EXCHANGE(y1, y2, tmp);
+ }
+ if (y1 < y2)
+ dir = 1;
+ else if (y1 > y2)
+ dir = -1;
+ else
+ dir = 0;
+
+ diff = 0;
+ y = y1;
+ for (x = x1; x <= x2; x++) {
+ if (diff >= dx) {
+ diff -= dx;
+ y += dir;
}
- } else {
- TRACE(("sixel pixel %d out of bounds\n", pix));
+ diff += dy;
+ draw_solid_pixel(graphic, x, y, color);
+ }
+ } else {
+ if (y1 > y2) {
+ int tmp;
+ EXCHANGE(x1, x2, tmp);
+ EXCHANGE(y1, y2, tmp);
+ }
+ if (x1 < x2)
+ dir = 1;
+ else if (x1 > x2)
+ dir = -1;
+ else
+ dir = 0;
+
+ diff = 0;
+ x = x1;
+ for (y = y1; y <= y2; y++) {
+ if (diff >= dy) {
+ diff -= dy;
+ x += dir;
+ }
+ diff += dx;
+ draw_solid_pixel(graphic, x, y, color);
}
}
}
static void
-set_sixel_color_register(ColorRegister *color_registers,
- int color,
- int r,
- int g,
- int b)
+set_color_register(ColorRegister *color_registers,
+ unsigned color,
+ int r,
+ int g,
+ int b)
{
ColorRegister *reg = &color_registers[color];
reg->r = (short) r;
@@ -262,15 +324,99 @@ set_sixel_color_register(ColorRegister *color_registers,
reg->allocated = 0;
}
+/* Graphics which don't use private colors will act as if they are using a
+ * device-wide color palette.
+ */
+static void
+set_shared_color_register(unsigned color, int r, int g, int b)
+{
+ Graphic *graphic;
+ unsigned ii;
+
+ assert(color < MAX_COLOR_REGISTERS);
+
+ set_color_register(getSharedRegisters(), color, r, g, b);
+
+ FOR_EACH_SLOT(ii) {
+ if (!(graphic = getActiveSlot(ii)))
+ continue;
+ if (graphic->private_colors)
+ continue;
+
+ if (graphic->color_registers_used[ii]) {
+ graphic->dirty = 1;
+ }
+ }
+}
+
+void
+update_color_register(Graphic *graphic,
+ unsigned color,
+ int r,
+ int g,
+ int b)
+{
+ assert(color < MAX_COLOR_REGISTERS);
+
+ if (graphic->private_colors) {
+ set_color_register(graphic->private_color_registers,
+ color, r, g, b);
+ if (graphic->color_registers_used[color]) {
+ graphic->dirty = 1;
+ }
+ graphic->color_registers_used[color] = 1;
+ } else {
+ set_shared_color_register(color, r, g, b);
+ }
+}
+
+#define SQUARE(X) ( (X) * (X) )
+
+RegisterNum
+find_color_register(ColorRegister const *color_registers, int r, int g, int b)
+{
+ unsigned i;
+ unsigned d;
+ unsigned closest_index;
+ unsigned closest_distance;
+
+ /* I have no idea what algorithm DEC used for this.
+ * The documentation warns that it is unpredictable, especially with values
+ * far away from any allocated color so it is probably a very simple
+ * hueristic rather than something fancy like finding the minimum distance
+ * in a linear perceptive color space.
+ */
+ closest_index = MAX_COLOR_REGISTERS;
+ closest_distance = 0U;
+ for (i = 0U; i < MAX_COLOR_REGISTERS; i++) {
+ d = (unsigned) (SQUARE(2 * (color_registers[i].r - r)) +
+ SQUARE(3 * (color_registers[i].g - g)) +
+ SQUARE(1 * (color_registers[i].b - b)));
+ if (closest_index == MAX_COLOR_REGISTERS || d < closest_distance) {
+ closest_index = i;
+ closest_distance = d;
+ }
+ }
+
+ TRACE(("found closest color register to %d,%d,%d: %u (distance %u value %d,%d,%d)\n",
+ r, g, b,
+ closest_index,
+ closest_distance,
+ color_registers[closest_index].r,
+ color_registers[closest_index].g,
+ color_registers[closest_index].b));
+ return (RegisterNum) closest_index;
+}
+
static void
init_color_registers(ColorRegister *color_registers, int terminal_id)
{
- TRACE(("initializing colors for %d\n", terminal_id));
+ TRACE(("setting inital colors for terminal %d\n", terminal_id));
{
- unsigned int i;
+ unsigned i;
for (i = 0U; i < MAX_COLOR_REGISTERS; i++) {
- set_sixel_color_register(color_registers, (int) i, 0, 0, 0);
+ set_color_register(color_registers, (RegisterNum) i, 0, 0, 0);
}
}
@@ -314,266 +460,267 @@ init_color_registers(ColorRegister *color_registers, int terminal_id)
* 12: 57% gray-magenta
* 13: 71% gray-cyan
* 14: 86% gray-yellow
- * 15: 100% 75%
+ * 15: 100% 75% ("white")
+ * VT382:
+ * ? (FIXME: B&W only?)
* dxterm:
* ?
*/
switch (terminal_id) {
case 125:
case 241:
- set_sixel_color_register(color_registers, 0, 0, 0, 0);
- set_sixel_color_register(color_registers, 1, 0, 0, 100);
- set_sixel_color_register(color_registers, 2, 0, 100, 0);
- set_sixel_color_register(color_registers, 3, 100, 0, 0);
+ set_color_register(color_registers, 0, 0, 0, 0);
+ set_color_register(color_registers, 1, 0, 0, 100);
+ set_color_register(color_registers, 2, 0, 100, 0);
+ set_color_register(color_registers, 3, 100, 0, 0);
break;
case 240:
case 330:
- set_sixel_color_register(color_registers, 0, 0, 0, 0);
- set_sixel_color_register(color_registers, 1, 33, 33, 33);
- set_sixel_color_register(color_registers, 2, 66, 66, 66);
- set_sixel_color_register(color_registers, 3, 100, 100, 100);
+ set_color_register(color_registers, 0, 0, 0, 0);
+ set_color_register(color_registers, 1, 33, 33, 33);
+ set_color_register(color_registers, 2, 66, 66, 66);
+ set_color_register(color_registers, 3, 100, 100, 100);
break;
case 340:
default:
- set_sixel_color_register(color_registers, 0, 0, 0, 0);
- set_sixel_color_register(color_registers, 1, 20, 20, 80);
- set_sixel_color_register(color_registers, 2, 80, 13, 13);
- set_sixel_color_register(color_registers, 3, 20, 80, 20);
- set_sixel_color_register(color_registers, 4, 80, 20, 80);
- set_sixel_color_register(color_registers, 5, 20, 80, 80);
- set_sixel_color_register(color_registers, 6, 80, 80, 20);
- set_sixel_color_register(color_registers, 7, 53, 53, 53);
- set_sixel_color_register(color_registers, 8, 26, 26, 26);
- set_sixel_color_register(color_registers, 9, 33, 33, 60);
- set_sixel_color_register(color_registers, 10, 60, 26, 26);
- set_sixel_color_register(color_registers, 11, 33, 60, 33);
- set_sixel_color_register(color_registers, 12, 60, 33, 60);
- set_sixel_color_register(color_registers, 13, 33, 60, 60);
- set_sixel_color_register(color_registers, 14, 60, 60, 33);
- set_sixel_color_register(color_registers, 15, 80, 80, 80);
+ set_color_register(color_registers, 0, 0, 0, 0);
+ set_color_register(color_registers, 1, 20, 20, 80);
+ set_color_register(color_registers, 2, 80, 13, 13);
+ set_color_register(color_registers, 3, 20, 80, 20);
+ set_color_register(color_registers, 4, 80, 20, 80);
+ set_color_register(color_registers, 5, 20, 80, 80);
+ set_color_register(color_registers, 6, 80, 80, 20);
+ set_color_register(color_registers, 7, 53, 53, 53);
+ set_color_register(color_registers, 8, 26, 26, 26);
+ set_color_register(color_registers, 9, 33, 33, 60);
+ set_color_register(color_registers, 10, 60, 26, 26);
+ set_color_register(color_registers, 11, 33, 60, 33);
+ set_color_register(color_registers, 12, 60, 33, 60);
+ set_color_register(color_registers, 13, 33, 60, 60);
+ set_color_register(color_registers, 14, 60, 60, 33);
+ set_color_register(color_registers, 15, 80, 80, 80);
+ break;
+ case 382: /* FIXME: verify */
+ set_color_register(color_registers, 0, 0, 0, 0);
+ set_color_register(color_registers, 1, 100, 100, 100);
break;
}
-}
-static void
-init_sixel_graphic(SixelGraphic *graphic, int terminal_id, int private_colors)
-{
- TRACE(("initializing sixel graphic\n"));
+#ifdef DEBUG_PALETTE
+ {
+ unsigned i;
- graphic->dirty = 1;
- memset(graphic->pixels, 0, sizeof(graphic->pixels));
- memset(graphic->color_registers_used, 0, sizeof(graphic->color_registers_used));
+ for (i = 0U; i < MAX_COLOR_REGISTERS; i++) {
+ printf("initial value for register %03u: %d,%d,%d\n",
+ i,
+ color_registers[i].r,
+ color_registers[i].g,
+ color_registers[i].b);
+ }
+ }
+#endif
+}
- /*
- * dimensions (REGIS logical, physical):
- * VK100/GIGI 768x4?? 768x2??
- * VT125 768x460 768x230(+10status) (1:2 aspect ratio, REGIS halves vertical addresses through "odd y emulation")
- * VT240 800x460 800x230(+10status) (1:2 aspect ratio, REGIS halves vertical addresses through "odd y emulation")
- * VT241 800x460 800x230(+10status) (1:2 aspect ratio, REGIS halves vertical addresses through "odd y emulation")
- * VT330 800x480 800x480(+?status)
- * VT340 800x480 800x480(+?status)
- * dxterm ?x? variable?
- */
- graphic->max_width = BUFFER_WIDTH;
- graphic->max_height = BUFFER_HEIGHT;
+unsigned
+get_color_register_count(TScreen const *screen)
+{
+ unsigned num_color_registers;
- /* default isn't white on the VT240, but not sure what it is */
- graphic->current_register = 3; /* FIXME: using green, but not sure what it should be */
+ if (screen->numcolorregisters >= 0) {
+ num_color_registers = (unsigned) screen->numcolorregisters;
+ } else {
+ num_color_registers = 0U;
+ }
- /*
- * When an application selects the monochrome map: the terminal sets the
- * 16 entries of the color map to the default monochrome gray level.
- * Therefore, the original colors are lost when changing from the color map
- * to the monochrome map.
- *
- * If you change the color value (green, red, blue) using the Color Set-Up
- * screen or a ReGIS command, the VT340 sets the gray scale by using the
- * formula (2G + R)/3.
- *
- * When an application selects the color map: the terminal sets the 16
- * entries of the color map to the default (color) color map.
- */
+ if (num_color_registers > 1U) {
+ if (num_color_registers > MAX_COLOR_REGISTERS)
+ return MAX_COLOR_REGISTERS;
+ return num_color_registers;
+ }
/*
* color capabilities:
* VK100/GIGI 1 plane (12x1 pixel attribute blocks) colorspace is 8 fixed colors (black, white, red, green, blue, cyan, yellow, magenta)
* VT125 2 planes (4 registers) colorspace is (64?) (color), ? (grayscale)
- * VT240 2 planes (4 registers) colorspace is ? shades (grayscale)
+ * VT240 2 planes (4 registers) colorspace is 4 shades (grayscale)
* VT241 2 planes (4 registers) colorspace is ? (color), ? shades (grayscale)
* VT330 2 planes (4 registers) colorspace is 4 shades (grayscale)
* VT340 4 planes (16 registers) colorspace is r16g16b16 (color), 16 shades (grayscale)
+ * VT382 1 plane (two fixed colors: black and white) FIXME: verify
* dxterm ?
*/
- switch (terminal_id) {
+ switch (screen->terminal_id) {
case 125:
- graphic->valid_registers = 4;
- break;
+ return 4U;
case 240:
- graphic->valid_registers = 4;
- break;
+ return 4U;
case 241:
- graphic->valid_registers = 4;
- break;
+ return 4U;
case 330:
- graphic->valid_registers = 4;
- break;
+ return 4U;
case 340:
- graphic->valid_registers = 16;
- break;
+ return 16U;
+ case 382:
+ return 2U;
default:
- graphic->valid_registers = 64; /* unknown graphics model -- might as well be generous */
- break;
+ /* unknown graphics model -- might as well be generous */
+ return MAX_COLOR_REGISTERS;
}
+}
+
+static void
+init_graphic(Graphic *graphic,
+ unsigned type,
+ int terminal_id,
+ int charrow,
+ int charcol,
+ unsigned num_color_registers,
+ int private_colors)
+{
+ unsigned i;
+
+ TRACE(("initializing graphic object\n"));
+
+ graphic->dirty = 1;
+ for (i = 0U; i < MAX_PIXELS; i++)
+ graphic->pixels[i] = COLOR_HOLE;
+ memset(graphic->color_registers_used, 0, sizeof(graphic->color_registers_used));
/*
* text and graphics interactions:
* VK100/GIGI text writes on top of graphics buffer, color attribute shared with text
* VT240,VT241,VT330,VT340 text writes on top of graphics buffer
+ * VT382 text writes on top of graphics buffer FIXME: verify
* VT125 graphics buffer overlaid on top of text in B&W display, text not present in color display
*/
- /* FIXME: is this always zero? what about in light background mode? */
- graphic->device_background = 0; /* default background color register */
-
- /* pixel sizes seem to have differed by model and options */
- /* VT240 and VT340 defaulted to 2:1 ratio */
- graphic->aspect_vertical = 2;
- graphic->aspect_horizontal = 1;
-
- graphic->declared_width = 0;
- graphic->declared_height = 0;
+ /*
+ * dimensions (ReGIS logical, physical):
+ * VK100/GIGI 768x4?? 768x240(status?)
+ * VT125 768x460 768x230(+10status) (1:2 aspect ratio, ReGIS halves vertical addresses through "odd y emulation")
+ * VT240 800x460 800x230(+10status) (1:2 aspect ratio, ReGIS halves vertical addresses through "odd y emulation")
+ * VT241 800x460 800x230(+10status) (1:2 aspect ratio, ReGIS halves vertical addresses through "odd y emulation")
+ * VT330 800x480 800x480(+?status)
+ * VT340 800x480 800x480(+?status)
+ * VT382 960x750 sixel only
+ * dxterm ?x? ?x? variable?
+ */
+ graphic->max_width = BUFFER_WIDTH;
+ graphic->max_height = BUFFER_HEIGHT;
graphic->actual_width = 0;
graphic->actual_height = 0;
+ graphic->pixw = 1;
+ graphic->pixh = 1;
+
+ graphic->valid_registers = num_color_registers;
+ TRACE(("%d color registers\n", graphic->valid_registers));
+
graphic->private_colors = private_colors;
if (graphic->private_colors) {
- TRACE(("sixel using private color registers\n"));
+ TRACE(("using private color registers\n"));
init_color_registers(graphic->private_color_registers, terminal_id);
graphic->color_registers = graphic->private_color_registers;
} else {
- TRACE(("sixel using shared color registers\n"));
- graphic->color_registers = shared_color_registers;
+ TRACE(("using shared color registers\n"));
+ graphic->color_registers = getSharedRegisters();
}
- graphic->charrow = 0;
- graphic->charcol = 0;
-
- graphic->row = 0;
- graphic->col = 0;
-
+ graphic->charrow = charrow;
+ graphic->charcol = charcol;
+ graphic->type = type;
graphic->valid = 0;
}
-static SixelGraphic *
-get_sixel_graphic(XtermWidget xw)
+Graphic *
+get_new_graphic(XtermWidget xw, int charrow, int charcol, unsigned type)
{
TScreen const *screen = TScreenOf(xw);
int bufferid = screen->whichBuf;
int terminal_id = screen->terminal_id;
- int private_colors = screen->privatecolorregisters;
- SixelGraphic *graphic;
- unsigned int ii;
+ Graphic *graphic;
+ unsigned ii;
- for (ii = 0U; ii < MAX_SIXEL_GRAPHICS; ii++) {
- graphic = &sixel_graphics[ii];
- if (!graphic->valid)
+ FOR_EACH_SLOT(ii) {
+ if ((graphic = getInactiveSlot(ii))) {
+ TRACE(("using fresh graphic index=%u id=%u\n", ii, next_graphic_id));
break;
+ }
}
- if (ii >= MAX_SIXEL_GRAPHICS) {
+ /* if none are free, recycle the graphic scrolled back the farthest */
+ if (!graphic) {
int min_charrow = 0;
- SixelGraphic *min_graphic = NULL;
+ Graphic *min_graphic = NULL;
- for (ii = 0U; ii < MAX_SIXEL_GRAPHICS; ii++) {
- graphic = &sixel_graphics[ii];
+ FOR_EACH_SLOT(ii) {
+ if (!(graphic = getActiveSlot(ii)))
+ continue;
if (!min_graphic || graphic->charrow < min_charrow) {
min_charrow = graphic->charrow;
min_graphic = graphic;
}
}
+ TRACE(("recycling old graphic index=%u id=%u\n", ii, next_graphic_id));
graphic = min_graphic;
}
- graphic->xw = xw;
- graphic->bufferid = bufferid;
- graphic->id = next_sixel_id++;
- init_sixel_graphic(graphic, terminal_id, private_colors);
+ if (graphic) {
+ unsigned num_color_registers;
+ num_color_registers = get_color_register_count(screen);
+ graphic->xw = xw;
+ graphic->bufferid = bufferid;
+ graphic->id = next_graphic_id++;
+ init_graphic(graphic,
+ type,
+ terminal_id,
+ charrow,
+ charcol,
+ num_color_registers,
+ screen->privatecolorregisters);
+ }
return graphic;
}
-static void
-dump_sixel(SixelGraphic const *graphic)
+Graphic *
+get_new_or_matching_graphic(XtermWidget xw,
+ int charrow,
+ int charcol,
+ int actual_width,
+ int actual_height,
+ unsigned type)
{
-#ifdef DUMP_SIXEL_BITMAP
- int r, c;
- RegisterNum color;
- ColorRegister const *reg;
-#endif
-
- (void) graphic;
-
- TRACE(("sixel stats: charrow=%d charcol=%d actual_width=%d actual_height=%d pixw=%d pixh=%d\n",
- graphic->charrow,
- graphic->charcol,
- graphic->actual_width,
- graphic->actual_height,
- graphic->pixw,
- graphic->pixh));
-
-#ifdef DUMP_SIXEL_BITMAP
- TRACE(("sixel dump:\n"));
- for (r = 0; r < graphic->max_height; r++) {
- for (c = 0; c < graphic->max_width; c++) {
- color = graphic->pixels[r * graphic->max_width + c];
- if (color == COLOR_HOLE) {
- TRACE(("?"));
- } else {
- reg = &graphic->color_registers[color];
- if (reg->r + reg->g + reg->b > 200) {
- TRACE(("#"));
- } else if (reg->r + reg->g + reg->b > 150) {
- TRACE(("%%"));
- } else if (reg->r + reg->g + reg->b > 100) {
- TRACE((":"));
- } else if (reg->r + reg->g + reg->b > 80) {
- TRACE(("."));
- } else {
- TRACE((" "));
- }
- }
+ TScreen const *screen = TScreenOf(xw);
+ int bufferid = screen->whichBuf;
+ Graphic *graphic;
+ unsigned ii;
+
+ FOR_EACH_SLOT(ii) {
+ if ((graphic = getActiveSlot(ii)) &&
+ graphic->type == type &&
+ graphic->bufferid == bufferid &&
+ graphic->charrow == charrow &&
+ graphic->charcol == charcol &&
+ graphic->actual_width == actual_width &&
+ graphic->actual_height == actual_height) {
+ TRACE(("found existing graphic index=%u id=%u\n", ii, graphic->id));
+ return graphic;
}
- TRACE(("\n"));
}
-#endif
- TRACE(("\n"));
-}
-static void
-set_shared_color_register(int color, int r, int g, int b)
-{
- SixelGraphic *graphic;
- unsigned int ii;
-
- assert(color < (int) MAX_COLOR_REGISTERS);
-
- set_sixel_color_register(shared_color_registers, color, r, g, b);
-
- for (ii = 0U; ii < MAX_SIXEL_GRAPHICS; ii++) {
- graphic = &sixel_graphics[ii];
- if (graphic->private_colors)
- continue;
-
- if (graphic->color_registers_used[ii]) {
- graphic->dirty = 1;
- }
+ /* if no match get a new graphic */
+ if ((graphic = get_new_graphic(xw, charrow, charcol, type))) {
+ graphic->actual_width = actual_width;
+ graphic->actual_height = actual_height;
}
+ return graphic;
}
#define ScaleForXColor(s) (unsigned short) ((long)(s) * 65535 / 100)
static Pixel
-sixel_register_to_xpixel(ColorRegister *reg, XtermWidget xw)
+color_register_to_xpixel(ColorRegister *reg, XtermWidget xw)
{
if (!reg->allocated) {
XColor def;
@@ -583,6 +730,7 @@ sixel_register_to_xpixel(ColorRegister *reg, XtermWidget xw)
def.blue = ScaleForXColor(reg->b);
def.flags = DoRed | DoGreen | DoBlue;
if (!allocateBestRGB(xw, &def)) {
+ TRACE(("unable to allocate xcolor for color register\n"));
return 0UL;
}
reg->pix = def.pixel;
@@ -596,34 +744,34 @@ sixel_register_to_xpixel(ColorRegister *reg, XtermWidget xw)
}
static void
-refresh_sixel_graphic(TScreen const *screen,
- SixelGraphic *graphic,
- int xbase,
- int ybase,
- int x,
- int y,
- int w,
- int h)
+refresh_graphic(TScreen const *screen,
+ Graphic const *graphic,
+ int xbase,
+ int ybase,
+ int x,
+ int y,
+ int w,
+ int h)
{
Display *display = screen->display;
Window vwindow = WhichVWin(screen)->window;
GC graphics_gc;
int r, c;
- int wx, wy;
int pw, ph;
+ int rbase, cbase;
RegisterNum color;
RegisterNum old_fg;
XGCValues xgcv;
XtGCMask mask;
int holes, total;
- TRACE(("refreshing sixel graphic from %d,%d %dx%d (valid=%d, bg=%dx%d size=%dx%d, max=%dx%d) at base=%d,%d\n",
+ TRACE(("refreshing graphic from %d,%d %dx%d (valid=%d, size=%dx%d, scale=%dx%d max=%dx%d) at base=%d,%d\n",
x, y, w, h,
graphic->valid,
- graphic->declared_width,
- graphic->declared_height,
graphic->actual_width,
graphic->actual_height,
+ graphic->pixw,
+ graphic->pixh,
graphic->max_width,
graphic->max_height,
xbase, ybase));
@@ -647,16 +795,25 @@ refresh_sixel_graphic(TScreen const *screen,
old_fg = COLOR_HOLE;
holes = total = 0;
- for (r = 0; r < graphic->actual_height; r++)
+ rbase = 0;
+ for (r = 0; r < graphic->actual_height; r++) {
+ int rtest = rbase;
+
+ rbase += ph;
+ if (rtest + ph - 1 < y)
+ continue;
+ if (rtest > y + h - 1)
+ continue;
+
+ cbase = 0;
for (c = 0; c < graphic->actual_width; c++) {
- if (r * ph + ph - 1 < y ||
- r * ph > y + h - 1 ||
- c * pw + pw - 1 < x ||
- c * pw > x + w - 1)
- continue;
+ int ctest = cbase;
- wy = ybase + r * ph;
- wx = xbase + c * pw;
+ cbase += pw;
+ if (ctest + pw - 1 < x)
+ continue;
+ if (ctest > x + w - 1)
+ continue;
total++;
color = graphic->pixels[r * graphic->max_width + c];
@@ -667,15 +824,19 @@ refresh_sixel_graphic(TScreen const *screen,
if (color != old_fg) {
xgcv.foreground =
- sixel_register_to_xpixel(&graphic->color_registers[color],
+ color_register_to_xpixel(&graphic->color_registers[color],
graphic->xw);
XChangeGC(display, graphics_gc, mask, &xgcv);
old_fg = color;
}
XFillRectangle(display, vwindow, graphics_gc,
- wx, wy, (unsigned) pw, (unsigned) ph);
+ xbase + ctest,
+ ybase + rtest,
+ (unsigned) pw,
+ (unsigned) ph);
}
+ }
#ifdef DEBUG_REFRESH
{
@@ -724,7 +885,7 @@ refresh_sixel_graphic(TScreen const *screen,
}
#endif
XFlush(display);
- TRACE(("done refreshing sixel graphic: %d of %d refreshed pixels were holes\n",
+ TRACE(("done refreshing graphic: %d of %d refreshed pixels were holes\n",
holes, total));
XFreeGC(display, graphics_gc);
@@ -736,14 +897,14 @@ refresh_sixel_graphic(TScreen const *screen,
* red: 120 degrees
* green: 240 degrees
*/
-static void
+void
hls2rgb(int h, int l, int s, short *r, short *g, short *b)
{
double hs = (h + 240) % 360;
double hv = hs / 360.0;
double lv = l / 100.0;
double sv = s / 100.0;
- double c, x, m;
+ double c, x, m, c2;
double r1, g1, b1;
int hpi;
@@ -752,7 +913,9 @@ hls2rgb(int h, int l, int s, short *r, short *g, short *b)
return;
}
- c = (1.0 - fabs(2.0 * lv - 1.0)) * sv;
+ if ((c2 = ((2.0 * lv) - 1.0)) < 0.0)
+ c2 = -c2;
+ c = (1.0 - c2) * sv;
hpi = (int) (hv * 6.0);
x = (hpi & 1) ? c : 0.0;
m = lv - 0.5 * c;
@@ -789,7 +952,7 @@ hls2rgb(int h, int l, int s, short *r, short *g, short *b)
b1 = x;
break;
default:
- printf("BAD\n");
+ TRACE(("Bad HLS input: [%d,%d,%d], returning white\n", h, l, s));
*r = (short) 100;
*g = (short) 100;
*b = (short) 100;
@@ -814,430 +977,66 @@ hls2rgb(int h, int l, int s, short *r, short *g, short *b)
*b = 100;
}
-static void
-update_sixel_aspect(SixelGraphic *graphic)
+void
+dump_graphic(Graphic const *graphic)
{
- /* We want to keep the ratio accurate but would like every pixel to have
- * the same size so keep these as whole numbers.
- */
- /* FIXME: DEC terminals had pixels about twice as tall as they were wide,
- * and it seems the VT125 and VT24x only used data from odd graphic rows.
- * This means it basically cancels out if we ignore both, except that
- * the even rows of pixels may not be written by the application such that
- * they are suitable for display. In practice this doesn't seem to be
- * an issue but I have very few test files/programs.
- */
- if (graphic->aspect_vertical < graphic->aspect_horizontal) {
- graphic->pixw = 1;
- graphic->pixh = ((graphic->aspect_vertical
- + graphic->aspect_horizontal - 1)
- / graphic->aspect_horizontal);
- } else {
- graphic->pixw = ((graphic->aspect_horizontal
- + graphic->aspect_vertical - 1)
- / graphic->aspect_vertical);
- graphic->pixh = 1;
- }
- TRACE(("sixel aspect ratio: an=%d ad=%d -> pixw=%d pixh=%d\n",
- graphic->aspect_vertical,
- graphic->aspect_horizontal,
- graphic->pixw,
- graphic->pixh));
-}
-
-/*
- * Interpret sixel graphics sequences.
- *
- * Resources:
- * http://en.wikipedia.org/wiki/Sixel
- * http://vt100.net/docs/vt3xx-gp/chapter14.html
- * ftp://ftp.cs.utk.edu/pub/shuford/terminal/sixel_graphics_news.txt
- * ftp://ftp.cs.utk.edu/pub/shuford/terminal/all_about_sixels.txt
- */
-extern void
-parse_sixel(XtermWidget xw, ANSI *params, char const *string)
-{
- TScreen *screen = TScreenOf(xw);
- SixelGraphic *graphic;
- Char ch;
-
- graphic = get_sixel_graphic(xw);
-
- {
- int Pmacro = params->a_param[0];
- int Pbgmode = params->a_param[1];
- int Phgrid = params->a_param[2];
- int Pan = params->a_param[3];
- int Pad = params->a_param[4];
- int Ph = params->a_param[5];
- int Pv = params->a_param[6];
-
- (void) Phgrid;
-
- TRACE(("sixel bitmap graphics sequence: params=%d (Pmacro=%d Pbgmode=%d Phgrid=%d) scroll_amt=%d\n",
- params->a_nparam,
- Pmacro,
- Pbgmode,
- Phgrid,
- screen->scroll_amt));
-
- switch (params->a_nparam) {
- case 7:
- if (Pan == 0 || Pad == 0) {
- TRACE(("DATA_ERROR: invalid raster ratio %d/%d\n", Pan, Pad));
- return;
- }
- graphic->aspect_vertical = Pan;
- graphic->aspect_horizontal = Pad;
-
- if (Ph == 0 || Pv == 0) {
- TRACE(("DATA_ERROR: raster image dimensions are invalid %dx%d\n",
- Ph, Pv));
- return;
- }
- if (Ph > graphic->max_width || Pv > graphic->max_height) {
- TRACE(("DATA_ERROR: raster image dimensions are too large %dx%d\n",
- Ph, Pv));
- return;
- }
- graphic->declared_width = Ph;
- graphic->declared_height = Pv;
- if (graphic->declared_width > graphic->actual_width) {
- graphic->actual_width = graphic->declared_width;
- }
- if (graphic->declared_height > graphic->actual_height) {
- graphic->actual_height = graphic->declared_height;
- }
- break;
- case 3:
- case 2:
- switch (Pmacro) {
- case 0:
- case 1:
- graphic->aspect_vertical = 5;
- graphic->aspect_horizontal = 1;
- break;
- case 2:
- graphic->aspect_vertical = 3;
- graphic->aspect_horizontal = 1;
- break;
- case 3:
- case 4:
- graphic->aspect_vertical = 2;
- graphic->aspect_horizontal = 1;
- break;
- case 5:
- case 6:
- graphic->aspect_vertical = 2;
- graphic->aspect_horizontal = 1;
- break;
- case 7:
- case 8:
- case 9:
- graphic->aspect_vertical = 1;
- graphic->aspect_horizontal = 1;
- break;
- default:
- TRACE(("DATA_ERROR: unknown sixel macro mode parameter\n"));
- return;
- }
- break;
- case 0:
- break;
- default:
- TRACE(("DATA_ERROR: unexpected parameter count (found %d)\n", params->a_nparam));
- return;
- }
+#if defined(DUMP_COLORS) || defined(DUMP_BITMAP)
+ RegisterNum color;
+#endif
+#ifdef DUMP_BITMAP
+ int r, c;
+ ColorRegister const *reg;
+#endif
- if (Pbgmode == 1) {
- graphic->background = COLOR_HOLE;
- } else {
- graphic->background = graphic->device_background;
- }
+ (void) graphic;
- /* Ignore the grid parameter because it seems only printers paid attention to it.
- * The VT3xx was always 0.0195 cm.
- */
- }
+ TRACE(("graphic stats: id=%u charrow=%d charcol=%d actual_width=%d actual_height=%d pixw=%d pixh=%d\n",
+ graphic->id,
+ graphic->charrow,
+ graphic->charcol,
+ graphic->actual_width,
+ graphic->actual_height,
+ graphic->pixw,
+ graphic->pixh));
-#if OPT_SIXEL_GRAPHICS
- if (xw->keyboard.flags & MODE_DECSDM) {
- TRACE(("sixel scrolling enabled: inline positioning for graphic\n"));
- graphic->charrow = screen->cur_row;
- graphic->charcol = screen->cur_col;
+#ifdef DUMP_COLORS
+ TRACE(("graphic colors:\n"));
+ for (color = 0; color < graphic->valid_registers; color++) {
+ TRACE(("%03u: %d,%d,%d\n",
+ color,
+ graphic->color_registers[color].r,
+ graphic->color_registers[color].g,
+ graphic->color_registers[color].b));
}
-
- update_sixel_aspect(graphic);
#endif
- for (;;) {
- ch = CharOf(*string);
- if (ch == '\0')
- break;
-
- if (ch >= 0x3f && ch <= 0x7e) {
- int sixel = ch - 0x3f;
- TRACE(("sixel=%x (%c)\n", sixel, (char) ch));
- if (!graphic->valid) {
- init_sixel_background(graphic);
- graphic->valid = 1;
- }
- set_sixel(graphic, sixel);
- graphic->col++;
- } else if (ch == '$') { /* DECGCR */
- /* ignore DECCRNLM in sixel mode */
- TRACE(("sixel CR\n"));
- graphic->col = 0;
- } else if (ch == '-') { /* DECGNL */
- int scroll_lines;
- TRACE(("sixel NL\n"));
- scroll_lines = 0;
- while (graphic->charrow - scroll_lines +
- (((graphic->row + 6) * graphic->pixh
- + FontHeight(screen) - 1)
- / FontHeight(screen)) > screen->bot_marg) {
- scroll_lines++;
- }
- graphic->col = 0;
- graphic->row += 6;
- /* If we hit the bottom margin on the graphics page (well, we just use the text margin for now),
- * the behavior is to either scroll or to discard the remainder of the graphic depending on this
- * setting.
- */
- if (scroll_lines > 0) {
- if (xw->keyboard.flags & MODE_DECSDM) {
- Display *display = screen->display;
- xtermScroll(xw, scroll_lines);
- XSync(display, False);
- TRACE(("graphic scrolled the screen %d lines. screen->scroll_amt=%d screen->topline=%d, now starting row is %d\n",
- scroll_lines,
- screen->scroll_amt,
- screen->topline,
- graphic->charrow));
- } else {
- break;
- }
- }
- } else if (ch == '!') { /* DECGRI */
- int Pcount;
- const char *start;
- int sixel;
- int i;
-
- start = ++string;
- for (;;) {
- ch = CharOf(*string);
- if (ch != '0' &&
- ch != '1' &&
- ch != '2' &&
- ch != '3' &&
- ch != '4' &&
- ch != '5' &&
- ch != '6' &&
- ch != '7' &&
- ch != '8' &&
- ch != '9' &&
- ch != ' ' &&
- ch != '\r' &&
- ch != '\n')
- break;
- string++;
- }
- if (ch == '\0') {
- TRACE(("DATA_ERROR: sixel data string terminated in the middle of a repeat operator\n"));
- return;
- }
- if (string == start) {
- TRACE(("DATA_ERROR: sixel data string contains a repeat operator with empty count\n"));
- return;
- }
- Pcount = atoi(start);
- sixel = ch - 0x3f;
- TRACE(("sixel repeat operator: sixel=%d (%c), count=%d\n",
- sixel, (char) ch, Pcount));
- if (!graphic->valid) {
- init_sixel_background(graphic);
- graphic->valid = 1;
- }
- for (i = 0; i < Pcount; i++) {
- set_sixel(graphic, sixel);
- graphic->col++;
- }
- } else if (ch == '#') { /* DECGCI */
- ANSI color_params;
- int Pregister;
-
- parse_prefixedtype_params(&color_params, &string);
- Pregister = color_params.a_param[0];
- if (Pregister >= graphic->valid_registers) {
- TRACE(("DATA_WARNING: sixel color operator uses out-of-range register %d\n", Pregister));
- /* FIXME: supposedly the DEC terminals wrapped register indicies -- verify */
- while (Pregister >= graphic->valid_registers)
- Pregister -= graphic->valid_registers;
- TRACE(("DATA_WARNING: converted to %d\n", Pregister));
- }
-
- if (color_params.a_nparam > 2 && color_params.a_nparam <= 5) {
- int Pspace = color_params.a_param[1];
- int Pc1 = color_params.a_param[2];
- int Pc2 = color_params.a_param[3];
- int Pc3 = color_params.a_param[4];
- short r, g, b;
-
- TRACE(("sixel set color register=%d space=%d color=[%d,%d,%d] (nparams=%d)\n",
- Pregister, Pspace, Pc1, Pc2, Pc3, color_params.a_nparam));
-
- switch (Pspace) {
- case 1: /* HLS */
- if (Pc1 > 360 || Pc2 > 100 || Pc3 > 100) {
- TRACE(("DATA_ERROR: sixel set color operator uses out-of-range HLS color coordinates %d,%d,%d\n",
- Pc1, Pc2, Pc3));
- return;
- }
- hls2rgb(Pc1, Pc2, Pc3, &r, &g, &b);
- break;
- case 2: /* RGB */
- if (Pc1 > 100 || Pc2 > 100 || Pc3 > 100) {
- TRACE(("DATA_ERROR: sixel set color operator uses out-of-range RGB color coordinates %d,%d,%d\n",
- Pc1, Pc2, Pc3));
- return;
- }
- r = (short) Pc1;
- g = (short) Pc2;
- b = (short) Pc3;
- break;
- default: /* unknown */
- TRACE(("DATA_ERROR: sixel set color operator uses unknown color space %d\n", Pspace));
- return;
- }
- if (graphic->private_colors) {
- set_sixel_color_register(graphic->private_color_registers,
- Pregister,
- r, g, b);
- } else {
- set_shared_color_register(Pregister, r, g, b);
- }
- graphic->color_registers_used[Pregister] = 1;
- } else if (color_params.a_nparam == 1) {
- TRACE(("sixel switch to color register=%d (nparams=%d)\n",
- Pregister, color_params.a_nparam));
- graphic->current_register = (RegisterNum) Pregister;
+#ifdef DUMP_BITMAP
+ TRACE(("graphic pixels:\n"));
+ for (r = 0; r < graphic->actual_height; r++) {
+ for (c = 0; c < graphic->actual_width; c++) {
+ color = graphic->pixels[r * graphic->max_width + c];
+ if (color == COLOR_HOLE) {
+ TRACE(("?"));
} else {
- TRACE(("DATA_ERROR: sixel switch color operator with unexpected parameter count (nparams=%d)\n", color_params.a_nparam));
- return;
- }
- continue;
- } else if (ch == '"') /* DECGRA */ {
- ANSI raster_params;
-
- parse_prefixedtype_params(&raster_params, &string);
- if (raster_params.a_nparam < 2) {
- TRACE(("DATA_ERROR: sixel raster attribute operator with incomplete parameters (found %d, expected 2 or 4)\n", raster_params.a_nparam));
- return;
- } {
- int Pan = raster_params.a_param[0];
- int Pad = raster_params.a_param[1];
- TRACE(("sixel raster attribute with h:w=%d:%d\n", Pan, Pad));
- if (Pan == 0 || Pad == 0) {
- TRACE(("DATA_ERROR: invalid raster ratio %d/%d\n", Pan, Pad));
- return;
- }
- graphic->aspect_vertical = Pan;
- graphic->aspect_horizontal = Pad;
- update_sixel_aspect(graphic);
- }
-
- if (raster_params.a_nparam >= 4) {
- int Ph = raster_params.a_param[2];
- int Pv = raster_params.a_param[3];
-
- TRACE(("sixel raster attribute with h=%d v=%d\n", Ph, Pv));
- if (Ph == 0 || Pv == 0) {
- TRACE(("DATA_ERROR: raster image dimensions are invalid %dx%d\n",
- Ph, Pv));
- return;
- }
- if (Ph > graphic->max_width || Pv > graphic->max_height) {
- TRACE(("DATA_ERROR: raster image dimensions are too large %dx%d\n",
- Ph, Pv));
- return;
- }
- graphic->declared_width = Ph;
- graphic->declared_height = Pv;
- if (graphic->declared_width > graphic->actual_width) {
- graphic->actual_width = graphic->declared_width;
- }
- if (graphic->declared_height > graphic->actual_height) {
- graphic->actual_height = graphic->declared_height;
+ reg = &graphic->color_registers[color];
+ if (reg->r + reg->g + reg->b > 200) {
+ TRACE(("#"));
+ } else if (reg->r + reg->g + reg->b > 150) {
+ TRACE(("%%"));
+ } else if (reg->r + reg->g + reg->b > 100) {
+ TRACE((":"));
+ } else if (reg->r + reg->g + reg->b > 80) {
+ TRACE(("."));
+ } else {
+ TRACE((" "));
}
}
-
- continue;
- } else if (ch == ' ' || ch == '\r' || ch == '\n') {
- /* EMPTY */ ;
- } else {
- TRACE(("DATA_ERROR: unknown sixel command %04x (%c)\n",
- (int) ch, ch));
}
-
- string++;
- }
-
- /* update the screen */
- if (screen->scroll_amt)
- FlushScroll(xw);
-
- if (xw->keyboard.flags & MODE_DECSDM) {
- int new_row = (graphic->charrow
- + ((graphic->actual_height * graphic->pixh)
- / FontHeight(screen)));
- int new_col = (graphic->charcol
- + (((graphic->actual_width * graphic->pixw)
- + FontWidth(screen) - 1)
- / FontWidth(screen)));
-
- TRACE(("setting text position after %dx%d graphic starting on row=%d col=%d: cursor new_row=%d new_col=%d\n",
- graphic->actual_width * graphic->pixw,
- graphic->actual_height * graphic->pixh,
- graphic->charrow,
- graphic->charcol,
- new_row, new_col));
-
- if (new_col > screen->rgt_marg) {
- new_col = screen->lft_marg;
- new_row++;
- TRACE(("column past left margin, overriding to row=%d col=%d\n",
- new_row, new_col));
- }
-
- while (new_row > screen->bot_marg) {
- xtermScroll(xw, 1);
- new_row--;
- TRACE(("bottom row was past screen. new start row=%d, cursor row=%d\n",
- graphic->charrow, new_row));
- }
-
- if (new_row < 0) {
- TRACE(("new row is going to be negative (%d)!", new_row)); /* FIXME: this was triggering, now it isn't */
- }
- set_cur_row(screen, new_row);
- set_cur_col(screen, new_col <= screen->rgt_marg ? new_col : screen->rgt_marg);
+ TRACE(("\n"));
}
- refresh_modified_displayed_graphics(screen);
-
- TRACE(("DONE successfully parsed sixel data\n"));
- dump_sixel(graphic);
-}
-
-extern void
-parse_regis(XtermWidget xw, ANSI *params, char const *string)
-{
- (void) xw;
- (void) string;
- (void) params;
-
- TRACE(("ReGIS vector graphics mode, params=%d\n", params->a_nparam));
+ TRACE(("\n"));
+#endif
}
/* Erase the portion of any displayed graphic overlapping with a rectangle
@@ -1245,35 +1044,40 @@ parse_regis(XtermWidget xw, ANSI *params, char const *string)
* This is used to allow text to "erase" graphics underneath it.
*/
static void
-erase_sixel_graphic(SixelGraphic *graphic, int x, int y, int w, int h)
+erase_graphic(Graphic *graphic, int x, int y, int w, int h)
{
RegisterNum hole = COLOR_HOLE;
int pw, ph;
int r, c;
+ int rbase, cbase;
pw = graphic->pixw;
ph = graphic->pixh;
- TRACE(("erasing sixel bitmap %d,%d %dx%d\n", x, y, w, h));
+ TRACE(("erasing graphic %d,%d %dx%d\n", x, y, w, h));
+ rbase = 0;
for (r = 0; r < graphic->actual_height; r++) {
- for (c = 0; c < graphic->actual_width; c++) {
- if (r * ph + ph - 1 < y ||
- r * ph > y + h - 1 ||
- c * pw + pw - 1 < x ||
- c * pw > x + w - 1)
- continue;
-
- graphic->pixels[r * graphic->max_width + c] = hole;
+ if (rbase + ph - 1 >= y
+ && rbase <= y + h - 1) {
+ cbase = 0;
+ for (c = 0; c < graphic->actual_width; c++) {
+ if (cbase + pw - 1 >= x
+ && cbase <= x + w - 1) {
+ graphic->pixels[r * graphic->max_width + c] = hole;
+ }
+ cbase += pw;
+ }
}
+ rbase += ph;
}
}
static int
-compare_sixel_ids(const void *left, const void *right)
+compare_graphic_ids(const void *left, const void *right)
{
- const SixelGraphic *l = *(const SixelGraphic *const *) left;
- const SixelGraphic *r = *(const SixelGraphic *const *) right;
+ const Graphic *l = *(const Graphic *const *) left;
+ const Graphic *r = *(const Graphic *const *) right;
if (!l->valid || !r->valid)
return 0;
@@ -1283,30 +1087,35 @@ compare_sixel_ids(const void *left, const void *right)
return 1;
}
-extern void
+void
refresh_displayed_graphics(TScreen const *screen,
int leftcol,
int toprow,
int ncols,
int nrows)
{
- SixelGraphic *ordered_graphics[MAX_SIXEL_GRAPHICS];
- SixelGraphic *graphic;
- unsigned int ii;
+ Graphic *ordered_graphics[MAX_GRAPHICS];
+ Graphic *graphic;
+ unsigned ii;
+ unsigned jj = 0;
int x, y, w, h;
int xbase, ybase;
- for (ii = 0U; ii < MAX_SIXEL_GRAPHICS; ii++) {
- ordered_graphics[ii] = &sixel_graphics[ii];
+ FOR_EACH_SLOT(ii) {
+ if ((graphic = getActiveSlot(ii))) {
+ ordered_graphics[jj++] = graphic;
+ }
+ }
+ if (jj > 1) {
+ qsort(ordered_graphics,
+ (size_t) jj,
+ sizeof(ordered_graphics[0]),
+ compare_graphic_ids);
}
- qsort(ordered_graphics,
- (size_t) MAX_SIXEL_GRAPHICS,
- sizeof(ordered_graphics[0]),
- compare_sixel_ids);
- for (ii = 0U; ii < MAX_SIXEL_GRAPHICS; ii++) {
+ for (ii = 0; ii < jj; ++ii) {
graphic = ordered_graphics[ii];
- if (!graphic->valid || graphic->bufferid != screen->whichBuf)
+ if (graphic->bufferid != screen->whichBuf)
continue;
x = (leftcol - graphic->charcol) * FontWidth(screen);
@@ -1335,23 +1144,26 @@ refresh_displayed_graphics(TScreen const *screen,
nrows, ncols,
x, y, w, h,
xbase, ybase));
- refresh_sixel_graphic(screen, graphic, xbase, ybase, x, y, w, h);
+ refresh_graphic(screen, graphic, xbase, ybase, x, y, w, h);
}
}
-extern void
+void
refresh_modified_displayed_graphics(TScreen const *screen)
{
- SixelGraphic *graphic;
- unsigned int ii;
+ Graphic *graphic;
+ unsigned ii;
int leftcol, toprow;
int nrows, ncols;
int x, y, w, h;
int xbase, ybase;
- for (ii = 0U; ii < MAX_SIXEL_GRAPHICS; ii++) {
- graphic = &sixel_graphics[ii];
- if (!graphic->valid || graphic->bufferid != screen->whichBuf || !graphic->dirty)
+ FOR_EACH_SLOT(ii) {
+ if (!(graphic = getActiveSlot(ii)))
+ continue;
+ if (graphic->bufferid != screen->whichBuf)
+ continue;
+ if (!graphic->dirty)
continue;
leftcol = graphic->charcol;
@@ -1389,41 +1201,41 @@ refresh_modified_displayed_graphics(TScreen const *screen)
nrows, ncols,
x, y, w, h,
xbase, ybase));
- refresh_sixel_graphic(screen, graphic, xbase, ybase, x, y, w, h);
+ refresh_graphic(screen, graphic, xbase, ybase, x, y, w, h);
graphic->dirty = 0;
}
}
-extern void
+void
scroll_displayed_graphics(int rows)
{
- SixelGraphic *graphic;
- unsigned int ii;
+ Graphic *graphic;
+ unsigned ii;
TRACE(("graphics scroll: moving all up %d rows\n", rows));
- for (ii = 0U; ii < MAX_SIXEL_GRAPHICS; ii++) {
- graphic = &sixel_graphics[ii];
- if (!graphic->valid)
+ /* FIXME: VT125 ReGIS graphics are fixed at the upper left of the display; need to verify */
+
+ FOR_EACH_SLOT(ii) {
+ if (!(graphic = getActiveSlot(ii)))
continue;
graphic->charrow -= rows;
}
}
-extern void
+void
pixelarea_clear_displayed_graphics(TScreen const *screen,
int winx,
int winy,
int w,
int h)
{
- SixelGraphic *graphic;
- unsigned int ii;
+ Graphic *graphic;
+ unsigned ii;
int x, y;
- for (ii = 0U; ii < MAX_SIXEL_GRAPHICS; ii++) {
- graphic = &sixel_graphics[ii];
- if (!graphic->valid)
+ FOR_EACH_SLOT(ii) {
+ if (!(graphic = getActiveSlot(ii)))
continue;
x = winx - graphic->charcol * FontWidth(screen);
@@ -1434,11 +1246,11 @@ pixelarea_clear_displayed_graphics(TScreen const *screen,
winx, winy,
w, h,
x, y));
- erase_sixel_graphic(graphic, x, y, w, h);
+ erase_graphic(graphic, x, y, w, h);
}
}
-extern void
+void
chararea_clear_displayed_graphics(TScreen const *screen,
int leftcol,
int toprow,
@@ -1460,16 +1272,27 @@ chararea_clear_displayed_graphics(TScreen const *screen,
pixelarea_clear_displayed_graphics(screen, x, y, w, h);
}
-extern void
+void
reset_displayed_graphics(TScreen const *screen)
{
- SixelGraphic *graphic;
- unsigned int ii;
-
- init_color_registers(shared_color_registers, screen->terminal_id);
- TRACE(("resetting all sixel graphics\n"));
- for (ii = 0U; ii < MAX_SIXEL_GRAPHICS; ii++) {
- graphic = &sixel_graphics[ii];
- graphic->valid = 0;
+ unsigned ii;
+
+ init_color_registers(getSharedRegisters(), screen->terminal_id);
+
+ TRACE(("resetting all graphics\n"));
+ FOR_EACH_SLOT(ii) {
+ deactivateSlot(ii);
+ }
+}
+
+#ifdef NO_LEAKS
+void
+noleaks_graphics(void)
+{
+ unsigned ii;
+
+ FOR_EACH_SLOT(ii) {
+ deactivateSlot(ii);
}
}
+#endif
diff --git a/app/xterm/graphics.h b/app/xterm/graphics.h
index b25852298..6ae9b0d11 100644
--- a/app/xterm/graphics.h
+++ b/app/xterm/graphics.h
@@ -1,8 +1,8 @@
-/* $XTermId: graphics.h,v 1.6 2013/07/10 08:28:55 Ross.Combs Exp $ */
+/* $XTermId: graphics.h,v 1.16 2014/04/25 21:30:23 Ross.Combs Exp $ */
/*
- * Copyright 2013 by Ross Combs
- * Copyright 2013 by Thomas E. Dickey
+ * Copyright 2013,2014 by Ross Combs
+ * Copyright 2013,2014 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -37,31 +37,89 @@
#include <ptyx.h>
-#if OPT_SIXEL_GRAPHICS
+#if OPT_GRAPHICS
+
+typedef struct {
+ Pixel pix;
+ short r, g, b;
+ short allocated;
+} ColorRegister;
typedef unsigned short RegisterNum;
+#define MAX_COLOR_REGISTERS 256U
+#define COLOR_HOLE ((RegisterNum)MAX_COLOR_REGISTERS)
+
+#define MAX_GRAPHICS 16U
+
+#define BUFFER_WIDTH 1000
+#define BUFFER_HEIGHT 800
+#define MAX_PIXELS (BUFFER_HEIGHT * BUFFER_WIDTH)
+
+typedef struct {
+ RegisterNum *pixels;
+ ColorRegister *private_color_registers;
+ ColorRegister *color_registers;
+ char color_registers_used[MAX_COLOR_REGISTERS];
+ XtermWidget xw;
+ int max_width; /* largest image which can be stored */
+ int max_height; /* largest image which can be stored */
+ unsigned valid_registers; /* for wrap-around behavior */
+ int actual_width; /* size of image before scaling */
+ int actual_height; /* size of image before scaling */
+ int private_colors; /* if not using the shared color registers */
+ int charrow; /* upper left starting point in characters */
+ int charcol; /* upper left starting point in characters */
+ int pixw; /* width of graphic pixels in screen pixels */
+ int pixh; /* height of graphic pixels in screen pixels */
+ int bufferid; /* which screen buffer the graphic is associated with */
+ unsigned type; /* type of graphic 0==sixel, 1...NUM_REGIS_PAGES==ReGIS page */
+ unsigned id; /* sequential id used for preserving layering */
+ int valid; /* if the graphic has been initialized */
+ int dirty; /* if the graphic needs to be redrawn */
+} Graphic;
+
+extern Graphic *get_new_graphic(XtermWidget xw, int charrow, int charcol, unsigned type);
+extern Graphic *get_new_or_matching_graphic(XtermWidget xw, int charrow, int charcol, int actual_width, int actual_height, unsigned type);
+extern RegisterNum read_pixel(Graphic *graphic, int x, int y);
+extern void draw_solid_pixel(Graphic *graphic, int x, int y, unsigned color);
+extern void draw_solid_rectangle(Graphic *graphic, int x1, int y1, int x2, int y2, unsigned color);
+extern void draw_solid_line(Graphic *graphic, int x1, int y1, int x2, int y2, unsigned color);
+extern void hls2rgb(int h, int l, int s, short *r, short *g, short *b);
+extern void dump_graphic(Graphic const *graphic);
+extern unsigned get_color_register_count(TScreen const *screen);
+extern void update_color_register(Graphic *graphic, unsigned color, int r, int g, int b);
+extern RegisterNum find_color_register(ColorRegister const *color_registers, int r, int g, int b);
extern void chararea_clear_displayed_graphics(TScreen const *screen, int leftcol, int toprow, int ncols, int nrows);
-extern void parse_regis(XtermWidget xw, ANSI *params, char const *string);
-extern void parse_sixel(XtermWidget xw, ANSI *params, char const *string);
extern void pixelarea_clear_displayed_graphics(TScreen const *screen, int winx, int winy, int w, int h);
extern void refresh_displayed_graphics(TScreen const *screen, int leftcol, int toprow, int ncols, int nrows);
extern void refresh_modified_displayed_graphics(TScreen const *screen);
extern void reset_displayed_graphics(TScreen const *screen);
extern void scroll_displayed_graphics(int rows);
-extern void update_displayed_graphics_color_registers(TScreen const *screen, RegisterNum color, short r, short g, short b);
+
+#ifdef NO_LEAKS
+extern void noleaks_graphics(void);
+#endif
#else
+#define get_new_graphic(xw, charrow, charcol, type) /* nothing */
+#define get_new_or_matching_graphic(xw, charrow, charcol, actual_width, actual_height, type) /* nothing */
+#define read_pixel(graphic, x, y) /* nothing */
+#define draw_solid_pixel(graphic, x, y, color) /* nothing */
+#define draw_solid_rectangle(graphic, x1, y1, x2, y2, color) /* nothing */
+#define draw_solid_line(graphic, x1, y1, x2, y2, color) /* nothing */
+#define hls2rgb(h, l, s, r, g, b) /* nothing */
+#define dump_graphic(graphic) /* nothing */
+#define get_color_register_count(screen) /* nothing */
+#define update_color_register(graphic, color, r, g, b) /* nothing */
+#define find_color_register(color_registers, r, g, b) /* nothing */
#define chararea_clear_displayed_graphics(screen, leftcol, toprow, ncols, nrows) /* nothing */
-#define parse_regis(xw, params, string) /* nothing */
-#define parse_sixel(xw, params, string) /* nothing */
#define pixelarea_clear_displayed_graphics(screen, winx, winy, w, h) /* nothing */
#define refresh_displayed_graphics(screen, leftcol, toprow, ncols, nrows) /* nothing */
#define refresh_modified_displayed_graphics(screen) /* nothing */
#define reset_displayed_graphics(screen) /* nothing */
#define scroll_displayed_graphics(rows) /* nothing */
-#define update_displayed_graphics_color_registers(screen, color, r, g, b) /* nothing */
#endif
diff --git a/app/xterm/input.c b/app/xterm/input.c
index 51532b4fe..32c259fc2 100644
--- a/app/xterm/input.c
+++ b/app/xterm/input.c
@@ -1,7 +1,7 @@
-/* $XTermId: input.c,v 1.348 2013/11/26 00:12:10 tom Exp $ */
+/* $XTermId: input.c,v 1.351 2014/04/27 23:50:36 Matthieu.Herrb Exp $ */
/*
- * Copyright 1999-2012,2013 by Thomas E. Dickey
+ * Copyright 1999-2013,2014 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -1142,7 +1142,7 @@ Input(XtermWidget xw,
#if OPT_SUNPC_KBD
&& keyboard->type == keyboardIsVT220
#endif
- && ((string = (Char *) udk_lookup(dec_code, &kd.nbytes)) != 0)) {
+ && ((string = (Char *) udk_lookup(xw, dec_code, &kd.nbytes)) != 0)) {
UIntClr(evt_state, ShiftMask);
while (kd.nbytes-- > 0)
unparseputc(xw, CharOf(*string++));
diff --git a/app/xterm/main.c b/app/xterm/main.c
index 7de9790b7..76e5d4895 100644
--- a/app/xterm/main.c
+++ b/app/xterm/main.c
@@ -1,4 +1,4 @@
-/* $XTermId: main.c,v 1.741 2014/01/16 02:12:25 tom Exp $ */
+/* $XTermId: main.c,v 1.757 2014/05/03 17:17:00 tom Exp $ */
/*
* Copyright 2002-2013,2014 by Thomas E. Dickey
@@ -91,6 +91,7 @@
#include <xterm.h>
#include <version.h>
+#include <graphics.h>
#include <X11/cursorfont.h>
#include <X11/Xlocale.h>
@@ -804,7 +805,7 @@ static sigjmp_buf env;
*endptr = '\0'; \
} \
} \
- strncpy(dst, host, sizeof(dst)); \
+ copy_filled(dst, host, sizeof(dst)); \
}
#ifdef HAVE_UTMP_UT_SYSLEN
@@ -871,6 +872,9 @@ static XtResource application_resources[] =
Bres("ptyHandshake", "PtyHandshake", ptyHandshake, True),
Bres("ptySttySize", "PtySttySize", ptySttySize, DEF_PTY_STTY_SIZE),
#endif
+#if OPT_REPORT_COLORS
+ Bres("reportColors", "ReportColors", reportColors, False),
+#endif
#if OPT_REPORT_FONTS
Bres("reportFonts", "ReportFonts", reportFonts, False),
#endif
@@ -1008,6 +1012,9 @@ static XrmOptionDescRec optionDescList[] = {
{"+s", "*multiScroll", XrmoptionNoArg, (XPointer) "off"},
{"-sb", "*scrollBar", XrmoptionNoArg, (XPointer) "on"},
{"+sb", "*scrollBar", XrmoptionNoArg, (XPointer) "off"},
+#if OPT_REPORT_COLORS
+{"-report-colors","*reportColors", XrmoptionNoArg, (XPointer) "on"},
+#endif
#if OPT_REPORT_FONTS
{"-report-fonts","*reportFonts", XrmoptionNoArg, (XPointer) "on"},
#endif
@@ -1197,6 +1204,9 @@ static OptionHelp xtermOptions[] = {
{ "-/+rw", "turn on/off reverse wraparound" },
{ "-/+s", "turn on/off multiscroll" },
{ "-/+sb", "turn on/off scrollbar" },
+#if OPT_REPORT_COLORS
+{ "-report-colors", "report colors as they are allocated" },
+#endif
#if OPT_REPORT_FONTS
{ "-report-fonts", "report fonts as loaded to stdout" },
#endif
@@ -1614,9 +1624,9 @@ Help(void)
/* ARGSUSED */
static Boolean
ConvertConsoleSelection(Widget w GCC_UNUSED,
- Atom * selection GCC_UNUSED,
- Atom * target GCC_UNUSED,
- Atom * type GCC_UNUSED,
+ Atom *selection GCC_UNUSED,
+ Atom *target GCC_UNUSED,
+ Atom *type GCC_UNUSED,
XtPointer *value GCC_UNUSED,
unsigned long *length GCC_UNUSED,
int *format GCC_UNUSED)
@@ -1632,7 +1642,7 @@ ConvertConsoleSelection(Widget w GCC_UNUSED,
/* ARGSUSED */
static void
DeleteWindow(Widget w,
- XEvent * event GCC_UNUSED,
+ XEvent *event GCC_UNUSED,
String *params GCC_UNUSED,
Cardinal *num_params GCC_UNUSED)
{
@@ -1652,7 +1662,7 @@ DeleteWindow(Widget w,
/* ARGSUSED */
static void
KeyboardMapping(Widget w GCC_UNUSED,
- XEvent * event,
+ XEvent *event,
String *params GCC_UNUSED,
Cardinal *num_params GCC_UNUSED)
{
@@ -3082,6 +3092,24 @@ set_owner(char *device, unsigned uid, unsigned gid, unsigned mode)
}
}
+/*
+ * utmp data may not be null-terminated; even if it is, there may be garbage
+ * after the null. This fills the unused part of the result with nulls.
+ */
+static void
+copy_filled(char *target, const char *source, size_t len)
+{
+ size_t used = 0;
+ while (used < len) {
+ if ((target[used] = source[used]) == 0)
+ break;
+ ++used;
+ }
+ while (used < len) {
+ target[used++] = '\0';
+ }
+}
+
#if defined(HAVE_UTMP) && defined(USE_SYSV_UTMP) && !defined(USE_UTEMPTER)
/*
* getutid() only looks at ut_type and ut_id.
@@ -3092,8 +3120,8 @@ init_utmp(int type, struct UTMP_STR *tofind)
{
memset(tofind, 0, sizeof(*tofind));
tofind->ut_type = type;
- (void) strncpy(tofind->ut_id, my_utmp_id(ttydev), sizeof(tofind->ut_id));
- (void) strncpy(tofind->ut_line, my_pty_name(ttydev), sizeof(tofind->ut_line));
+ copy_filled(tofind->ut_id, my_utmp_id(ttydev), sizeof(tofind->ut_id));
+ copy_filled(tofind->ut_line, my_pty_name(ttydev), sizeof(tofind->ut_line));
}
/*
@@ -3109,19 +3137,13 @@ find_utmp(struct UTMP_STR *tofind)
for (;;) {
memset(&working, 0, sizeof(working));
working.ut_type = tofind->ut_type;
- strncpy(working.ut_id, tofind->ut_id, sizeof(tofind->ut_id));
+ copy_filled(working.ut_id, tofind->ut_id, sizeof(tofind->ut_id));
#if defined(__digital__) && defined(__unix__) && (defined(OSMAJORVERSION) && OSMAJORVERSION < 5)
working.ut_type = 0;
#endif
if ((result = call_getutid(&working)) == 0)
break;
- /*
- * ut_line may not be null-terminated, but if it is, there may be
- * garbage after the null. Use strncpy to ensure that the value
- * we check is null-terminated (if there is enough space in the
- * buffer), and that unused space is nulled.
- */
- strncpy(limited.ut_line, result->ut_line, sizeof(result->ut_line));
+ copy_filled(limited.ut_line, result->ut_line, sizeof(result->ut_line));
if (!memcmp(limited.ut_line, tofind->ut_line, sizeof(limited.ut_line)))
break;
/*
@@ -3143,6 +3165,35 @@ find_utmp(struct UTMP_STR *tofind)
#define USE_NO_DEV_TTY 0
#endif
+static int
+same_leaf(char *a, char *b)
+{
+ char *p = x_basename(a);
+ char *q = x_basename(b);
+ return !strcmp(p, q);
+}
+
+/*
+ * "good enough" (inode wouldn't port to Cygwin)
+ */
+static int
+same_file(const char *a, const char *b)
+{
+ struct stat asb;
+ struct stat bsb;
+ int result = 0;
+
+ if ((stat(a, &asb) == 0)
+ && (stat(b, &bsb) == 0)
+ && ((asb.st_mode & S_IFMT) == S_IFREG)
+ && ((bsb.st_mode & S_IFMT) == S_IFREG)
+ && (asb.st_mtime == bsb.st_mtime)
+ && (asb.st_size == bsb.st_size)) {
+ result = 1;
+ }
+ return result;
+}
+
/*
* Only set $SHELL for paths found in the standard location.
*/
@@ -3156,8 +3207,7 @@ validShell(const char *pathname)
size_t rc;
FILE *fp;
- if (!IsEmpty(pathname)
- && access(pathname, X_OK) == 0
+ if (validProgram(pathname)
&& stat(ok_shells, &sb) == 0
&& (sb.st_mode & S_IFMT) == S_IFREG
&& (sb.st_size != 0)
@@ -3167,10 +3217,15 @@ validShell(const char *pathname)
if (rc == (size_t) sb.st_size) {
char *p = blob;
char *q, *r;
+ blob[rc] = '\0';
while (!result && (q = strtok(p, "\n")) != 0) {
if ((r = x_strtrim(q)) != 0) {
+ TRACE(("...test \"%s\"\n", q));
if (!strcmp(q, pathname)) {
result = True;
+ } else if (same_leaf(q, (char *) pathname) &&
+ same_file(q, pathname)) {
+ result = True;
}
free(r);
}
@@ -3738,7 +3793,8 @@ spawnXTerm(XtermWidget xw)
/* we don't need the socket, or the pty master anymore */
close(ConnectionNumber(screen->display));
#ifndef __MVS__
- close(screen->respond);
+ if (screen->respond >= 0)
+ close(screen->respond);
#endif /* __MVS__ */
/* Now is the time to set up our process group and
@@ -4261,13 +4317,13 @@ spawnXTerm(XtermWidget xw)
#ifdef HAVE_UTMP_UT_XSTATUS
utmp.ut_xstatus = 2;
#endif
- (void) strncpy(utmp.ut_user,
- (login_name != NULL) ? login_name : "????",
- sizeof(utmp.ut_user));
+ copy_filled(utmp.ut_user,
+ (login_name != NULL) ? login_name : "????",
+ sizeof(utmp.ut_user));
/* why are we copying this string again? (see above) */
- (void) strncpy(utmp.ut_id, my_utmp_id(ttydev), sizeof(utmp.ut_id));
- (void) strncpy(utmp.ut_line,
- my_pty_name(ttydev), sizeof(utmp.ut_line));
+ copy_filled(utmp.ut_id, my_utmp_id(ttydev), sizeof(utmp.ut_id));
+ copy_filled(utmp.ut_line,
+ my_pty_name(ttydev), sizeof(utmp.ut_line));
#ifdef HAVE_UTMP_UT_HOST
SetUtmpHost(utmp.ut_host, screen);
@@ -4276,9 +4332,9 @@ spawnXTerm(XtermWidget xw)
SetUtmpSysLen(utmp);
#endif
- (void) strncpy(utmp.ut_name,
- (login_name) ? login_name : "????",
- sizeof(utmp.ut_name));
+ copy_filled(utmp.ut_name,
+ (login_name) ? login_name : "????",
+ sizeof(utmp.ut_name));
utmp.ut_pid = getpid();
#if defined(HAVE_UTMP_UT_XTIME)
@@ -4329,11 +4385,11 @@ spawnXTerm(XtermWidget xw)
if (tslot > 0 && OkPasswd(&pw) && !resource.utmpInhibit &&
(i = open(etc_utmp, O_WRONLY)) >= 0) {
memset(&utmp, 0, sizeof(utmp));
- (void) strncpy(utmp.ut_line,
- my_pty_name(ttydev),
- sizeof(utmp.ut_line));
- (void) strncpy(utmp.ut_name, login_name,
- sizeof(utmp.ut_name));
+ copy_filled(utmp.ut_line,
+ my_pty_name(ttydev),
+ sizeof(utmp.ut_line));
+ copy_filled(utmp.ut_name, login_name,
+ sizeof(utmp.ut_name));
#ifdef HAVE_UTMP_UT_HOST
SetUtmpHost(utmp.ut_host, screen);
#endif
@@ -4561,6 +4617,7 @@ spawnXTerm(XtermWidget xw)
/*
* If we have an explicit shell to run, make that set $SHELL.
+ * Next, allow an existing setting of $SHELL, for absolute paths.
* Otherwise, if $SHELL is not set, determine it from the user's
* password information, if possible.
*
@@ -4569,9 +4626,10 @@ spawnXTerm(XtermWidget xw)
*/
if (validShell(explicit_shname)) {
xtermSetenv("SHELL", explicit_shname);
- shell_path = explicit_shname;
- } else if (validShell(shell_path = x_getenv("SHELL"))) {
- ; /* OK */
+ } else if (validProgram(shell_path = x_getenv("SHELL"))) {
+ if (!validShell(shell_path)) {
+ xtermUnsetenv("SHELL");
+ }
} else if ((!OkPasswd(&pw) && !x_getpwuid(screen->uid, &pw))
|| *(shell_path = x_strdup(pw.pw_shell)) == 0) {
shell_path = resetShell(shell_path);
@@ -4585,9 +4643,11 @@ spawnXTerm(XtermWidget xw)
* Set $XTERM_SHELL, which is not necessarily a valid shell, but
* is executable.
*/
- if (explicit_shname != 0 && access(explicit_shname, X_OK) == 0) {
- free(shell_path);
+ if (validProgram(explicit_shname)) {
shell_path = explicit_shname;
+ } else if (shell_path == 0) {
+ /* this could happen if the explicit shname lost a race */
+ shell_path = resetShell(shell_path);
}
xtermSetenv("XTERM_SHELL", shell_path);
@@ -4878,7 +4938,7 @@ Exit(int n)
if (xw->misc.login_shell)
updwtmpx(WTMPX_FILE, utptr);
#elif defined(linux) && defined(__GLIBC__) && (__GLIBC__ >= 2) && !(defined(__powerpc__) && (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0))
- strncpy(utmp.ut_line, utptr->ut_line, sizeof(utmp.ut_line));
+ copy_filled(utmp.ut_line, utptr->ut_line, sizeof(utmp.ut_line));
if (xw->misc.login_shell)
call_updwtmp(etc_wtmp, utptr);
#else
@@ -4922,9 +4982,9 @@ Exit(int n)
#ifdef WTMP
if (xw->misc.login_shell &&
(wfd = open(etc_wtmp, O_WRONLY | O_APPEND)) >= 0) {
- (void) strncpy(utmp.ut_line,
- my_pty_name(ttydev),
- sizeof(utmp.ut_line));
+ copy_filled(utmp.ut_line,
+ my_pty_name(ttydev),
+ sizeof(utmp.ut_line));
utmp.ut_time = time((time_t *) 0);
IGNORE_RC(write(wfd, (char *) &utmp, sizeof(utmp)));
close(wfd);
@@ -4982,6 +5042,9 @@ Exit(int n)
sortedOpts(0, 0, 0);
noleaks_charproc();
noleaks_ptydata();
+#if OPT_GRAPHICS
+ noleaks_graphics();
+#endif
#if OPT_WIDE_CHARS
noleaks_CharacterClass();
#endif
diff --git a/app/xterm/menu.c b/app/xterm/menu.c
index 0d83b3f28..75523cf62 100644
--- a/app/xterm/menu.c
+++ b/app/xterm/menu.c
@@ -1,7 +1,7 @@
-/* $XTermId: menu.c,v 1.320 2013/06/23 22:46:18 tom Exp $ */
+/* $XTermId: menu.c,v 1.324 2014/05/03 10:53:43 tom Exp $ */
/*
- * Copyright 1999-2012,2013 by Thomas E. Dickey
+ * Copyright 1999-2013,2014 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -229,10 +229,13 @@ static void do_sco_fkeys PROTO_XT_CALLBACK_ARGS;
#endif
#if OPT_SIXEL_GRAPHICS
-static void do_privatecolorregisters PROTO_XT_CALLBACK_ARGS;
static void do_sixelscrolling PROTO_XT_CALLBACK_ARGS;
#endif
+#if OPT_GRAPHICS
+static void do_privatecolorregisters PROTO_XT_CALLBACK_ARGS;
+#endif
+
#if OPT_SUN_FUNC_KEYS
static void do_sun_fkeys PROTO_XT_CALLBACK_ARGS;
#endif
@@ -370,6 +373,8 @@ MenuEntry vtMenuEntries[] = {
{ "altscreen", do_altscreen, NULL },
#if OPT_SIXEL_GRAPHICS
{ "sixelScrolling", do_sixelscrolling, NULL },
+#endif
+#if OPT_GRAPHICS
{ "privateColorRegisters", do_privatecolorregisters, NULL },
#endif
};
@@ -713,8 +718,8 @@ indexOfMenu(String menuName)
/* ARGSUSED */
static Bool
domenu(Widget w,
- XEvent * event GCC_UNUSED,
- String * params, /* mainMenu, vtMenu, or tekMenu */
+ XEvent *event GCC_UNUSED,
+ String *params, /* mainMenu, vtMenu, or tekMenu */
Cardinal *param_count) /* 0 or 1 */
{
XtermWidget xw = term;
@@ -850,11 +855,16 @@ domenu(Widget w,
enable_allow_xxx_ops(!(screen->allowSendEvents));
#endif
}
+#if OPT_TOOLBAR
+ /* menus for toolbar are initialized once only */
+ SetItemSensitivity(fontMenuEntries[fontMenu_fontsel].widget, True);
+#else
FindFontSelection(xw, NULL, True);
SetItemSensitivity(
fontMenuEntries[fontMenu_fontsel].widget,
(screen->menu_font_names[fontMenu_fontsel][fNorm]
? True : False));
+#endif
break;
#if OPT_TEK4014
@@ -879,8 +889,8 @@ domenu(Widget w,
void
HandleCreateMenu(Widget w,
- XEvent * event,
- String * params, /* mainMenu, vtMenu, or tekMenu */
+ XEvent *event,
+ String *params, /* mainMenu, vtMenu, or tekMenu */
Cardinal *param_count) /* 0 or 1 */
{
TRACE(("HandleCreateMenu\n"));
@@ -889,8 +899,8 @@ HandleCreateMenu(Widget w,
void
HandlePopupMenu(Widget w,
- XEvent * event,
- String * params, /* mainMenu, vtMenu, or tekMenu */
+ XEvent *event,
+ String *params, /* mainMenu, vtMenu, or tekMenu */
Cardinal *param_count) /* 0 or 1 */
{
TRACE(("HandlePopupMenu\n"));
@@ -1007,8 +1017,8 @@ do_securekbd(Widget gw GCC_UNUSED,
/* ARGSUSED */
void
HandleSecure(Widget w GCC_UNUSED,
- XEvent * event GCC_UNUSED, /* unused */
- String * params GCC_UNUSED, /* [0] = volume */
+ XEvent *event GCC_UNUSED, /* unused */
+ String *params GCC_UNUSED, /* [0] = volume */
Cardinal *param_count GCC_UNUSED) /* 0 or 1 */
{
#if 0
@@ -1924,7 +1934,7 @@ do_tekhide(Widget gw GCC_UNUSED,
* public handler routines
*/
int
-decodeToggle(XtermWidget xw, String * params, Cardinal nparams)
+decodeToggle(XtermWidget xw, String *params, Cardinal nparams)
{
int dir = toggleErr;
@@ -1952,7 +1962,7 @@ decodeToggle(XtermWidget xw, String * params, Cardinal nparams)
static void
handle_toggle(void (*proc) PROTO_XT_CALLBACK_ARGS,
int var,
- String * params,
+ String *params,
Cardinal nparams,
Widget w,
XtPointer closure,
@@ -1994,8 +2004,8 @@ handle_toggle(void (*proc) PROTO_XT_CALLBACK_ARGS,
void
HandleAllowSends(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
handle_vt_toggle(do_allowsends, TScreenOf(term)->allowSendEvents,
@@ -2004,8 +2014,8 @@ HandleAllowSends(Widget w,
void
HandleSetVisualBell(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
HANDLE_VT_TOGGLE(visualbell);
@@ -2013,8 +2023,8 @@ HandleSetVisualBell(Widget w,
void
HandleSetPopOnBell(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
HANDLE_VT_TOGGLE(poponbell);
@@ -2023,8 +2033,8 @@ HandleSetPopOnBell(Widget w,
#ifdef ALLOWLOGGING
void
HandleLogging(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
HANDLE_VT_TOGGLE(logging);
@@ -2034,8 +2044,8 @@ HandleLogging(Widget w,
#if OPT_PRINT_ON_EXIT
void
HandleWriteNow(Widget w,
- XEvent * event GCC_UNUSED,
- String * params GCC_UNUSED,
+ XEvent *event GCC_UNUSED,
+ String *params GCC_UNUSED,
Cardinal *param_count GCC_UNUSED)
{
do_write_now(w, 0, 0);
@@ -2043,8 +2053,8 @@ HandleWriteNow(Widget w,
void
HandleWriteError(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
HANDLE_VT_TOGGLE(write_error);
@@ -2054,8 +2064,8 @@ HandleWriteError(Widget w,
/* ARGSUSED */
void
HandlePrintScreen(Widget w GCC_UNUSED,
- XEvent * event GCC_UNUSED,
- String * params GCC_UNUSED,
+ XEvent *event GCC_UNUSED,
+ String *params GCC_UNUSED,
Cardinal *param_count GCC_UNUSED)
{
xtermPrintScreen(term, True, getPrinterFlags(term, params, param_count));
@@ -2064,8 +2074,8 @@ HandlePrintScreen(Widget w GCC_UNUSED,
/* ARGSUSED */
void
HandlePrintEverything(Widget w GCC_UNUSED,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
xtermPrintEverything(term, getPrinterFlags(term, params, param_count));
@@ -2074,8 +2084,8 @@ HandlePrintEverything(Widget w GCC_UNUSED,
/* ARGSUSED */
void
HandlePrintControlMode(Widget w,
- XEvent * event GCC_UNUSED,
- String * params GCC_UNUSED,
+ XEvent *event GCC_UNUSED,
+ String *params GCC_UNUSED,
Cardinal *param_count GCC_UNUSED)
{
do_print_redir(w, (XtPointer) 0, (XtPointer) 0);
@@ -2084,8 +2094,8 @@ HandlePrintControlMode(Widget w,
/* ARGSUSED */
void
HandleRedraw(Widget w,
- XEvent * event GCC_UNUSED,
- String * params GCC_UNUSED,
+ XEvent *event GCC_UNUSED,
+ String *params GCC_UNUSED,
Cardinal *param_count GCC_UNUSED)
{
do_redraw(w, (XtPointer) 0, (XtPointer) 0);
@@ -2094,8 +2104,8 @@ HandleRedraw(Widget w,
/* ARGSUSED */
void
HandleSendSignal(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
/* *INDENT-OFF* */
@@ -2139,8 +2149,8 @@ HandleSendSignal(Widget w,
/* ARGSUSED */
void
HandleQuit(Widget w,
- XEvent * event GCC_UNUSED,
- String * params GCC_UNUSED,
+ XEvent *event GCC_UNUSED,
+ String *params GCC_UNUSED,
Cardinal *param_count GCC_UNUSED)
{
do_quit(w, (XtPointer) 0, (XtPointer) 0);
@@ -2148,8 +2158,8 @@ HandleQuit(Widget w,
void
Handle8BitControl(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
handle_vt_toggle(do_8bit_control, TScreenOf(term)->control_eight_bits,
@@ -2158,8 +2168,8 @@ Handle8BitControl(Widget w,
void
HandleBackarrow(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
handle_vt_toggle(do_backarrow, term->keyboard.flags & MODE_DECBKM,
@@ -2186,8 +2196,8 @@ do_fullscreen(Widget gw GCC_UNUSED,
/* ARGSUSED */
void
HandleFullscreen(Widget w,
- XEvent * event GCC_UNUSED,
- String * params GCC_UNUSED,
+ XEvent *event GCC_UNUSED,
+ String *params GCC_UNUSED,
Cardinal *param_count GCC_UNUSED)
{
XtermWidget xw = term;
@@ -2226,6 +2236,27 @@ do_sixelscrolling(Widget gw GCC_UNUSED,
update_decsdm();
}
+void
+update_decsdm(void)
+{
+ UpdateCheckbox("update_decsdm",
+ vtMenuEntries,
+ vtMenu_sixelscrolling,
+ (term->keyboard.flags & MODE_DECSDM) != 0);
+}
+
+void
+HandleSixelScrolling(Widget w,
+ XEvent *event GCC_UNUSED,
+ String *params,
+ Cardinal *param_count)
+{
+ handle_vt_toggle(do_sixelscrolling, term->keyboard.flags & MODE_DECSDM,
+ params, *param_count, w);
+}
+#endif
+
+#if OPT_GRAPHICS
static void
do_privatecolorregisters(Widget gw GCC_UNUSED,
XtPointer closure GCC_UNUSED,
@@ -2247,39 +2278,20 @@ update_privatecolorregisters(void)
}
void
-update_decsdm(void)
-{
- UpdateCheckbox("update_decsdm",
- vtMenuEntries,
- vtMenu_sixelscrolling,
- (term->keyboard.flags & MODE_DECSDM) != 0);
-}
-
-void
HandleSetPrivateColorRegisters(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
HANDLE_VT_TOGGLE(privatecolorregisters);
}
-
-void
-HandleSixelScrolling(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
- Cardinal *param_count)
-{
- handle_vt_toggle(do_sixelscrolling, term->keyboard.flags & MODE_DECSDM,
- params, *param_count, w);
-}
#endif
#if OPT_SUN_FUNC_KEYS
void
HandleSunFunctionKeys(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
handle_vt_toggle(do_sun_fkeys, term->keyboard.type == keyboardIsSun,
@@ -2290,8 +2302,8 @@ HandleSunFunctionKeys(Widget w,
#if OPT_NUM_LOCK
void
HandleNumLock(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
handle_vt_toggle(do_num_lock, term->misc.real_NumLock,
@@ -2300,8 +2312,8 @@ HandleNumLock(Widget w,
void
HandleAltEsc(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
handle_vt_toggle(do_alt_esc, !TScreenOf(term)->alt_sends_esc,
@@ -2310,8 +2322,8 @@ HandleAltEsc(Widget w,
void
HandleMetaEsc(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
handle_vt_toggle(do_meta_esc, TScreenOf(term)->meta_sends_esc,
@@ -2321,8 +2333,8 @@ HandleMetaEsc(Widget w,
void
HandleDeleteIsDEL(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
handle_vt_toggle(do_delete_del, TScreenOf(term)->delete_is_del,
@@ -2331,8 +2343,8 @@ HandleDeleteIsDEL(Widget w,
void
HandleOldFunctionKeys(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
handle_vt_toggle(do_old_fkeys, term->keyboard.type == keyboardIsLegacy,
@@ -2342,8 +2354,8 @@ HandleOldFunctionKeys(Widget w,
#if OPT_SUNPC_KBD
void
HandleSunKeyboard(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
handle_vt_toggle(do_sun_kbd, term->keyboard.type == keyboardIsVT220,
@@ -2354,8 +2366,8 @@ HandleSunKeyboard(Widget w,
#if OPT_HP_FUNC_KEYS
void
HandleHpFunctionKeys(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
handle_vt_toggle(do_hp_fkeys, term->keyboard.type == keyboardIsHP,
@@ -2366,8 +2378,8 @@ HandleHpFunctionKeys(Widget w,
#if OPT_SCO_FUNC_KEYS
void
HandleScoFunctionKeys(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
handle_vt_toggle(do_sco_fkeys, term->keyboard.type == keyboardIsSCO,
@@ -2377,8 +2389,8 @@ HandleScoFunctionKeys(Widget w,
void
HandleScrollbar(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
XtermWidget xw = term;
@@ -2393,8 +2405,8 @@ HandleScrollbar(Widget w,
void
HandleJumpscroll(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
HANDLE_VT_TOGGLE(jumpscroll);
@@ -2402,8 +2414,8 @@ HandleJumpscroll(Widget w,
void
HandleKeepSelection(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
HANDLE_VT_TOGGLE(keepSelection);
@@ -2411,8 +2423,8 @@ HandleKeepSelection(Widget w,
void
HandleSetSelect(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
handle_vt_toggle(do_selectClipboard, TScreenOf(term)->selectToClipboard,
@@ -2421,8 +2433,8 @@ HandleSetSelect(Widget w,
void
HandleReverseVideo(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
handle_vt_toggle(do_reversevideo, (term->misc.re_verse0),
@@ -2431,8 +2443,8 @@ HandleReverseVideo(Widget w,
void
HandleAutoWrap(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
handle_vt_toggle(do_autowrap, (term->flags & WRAPAROUND),
@@ -2441,8 +2453,8 @@ HandleAutoWrap(Widget w,
void
HandleReverseWrap(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
handle_vt_toggle(do_reversewrap, (term->flags & REVERSEWRAP),
@@ -2451,8 +2463,8 @@ HandleReverseWrap(Widget w,
void
HandleAutoLineFeed(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
handle_vt_toggle(do_autolinefeed, (term->flags & LINEFEED),
@@ -2461,8 +2473,8 @@ HandleAutoLineFeed(Widget w,
void
HandleAppCursor(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
handle_vt_toggle(do_appcursor, (term->keyboard.flags & MODE_DECCKM),
@@ -2471,8 +2483,8 @@ HandleAppCursor(Widget w,
void
HandleAppKeypad(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
handle_vt_toggle(do_appkeypad, (term->keyboard.flags & MODE_DECKPAM),
@@ -2481,8 +2493,8 @@ HandleAppKeypad(Widget w,
void
HandleScrollKey(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
HANDLE_VT_TOGGLE(scrollkey);
@@ -2490,8 +2502,8 @@ HandleScrollKey(Widget w,
void
HandleScrollTtyOutput(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
HANDLE_VT_TOGGLE(scrollttyoutput);
@@ -2499,8 +2511,8 @@ HandleScrollTtyOutput(Widget w,
void
HandleAllow132(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
handle_vt_toggle(do_allow132, TScreenOf(term)->c132,
@@ -2509,8 +2521,8 @@ HandleAllow132(Widget w,
void
HandleCursesEmul(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
handle_vt_toggle(do_cursesemul, TScreenOf(term)->curses,
@@ -2519,8 +2531,8 @@ HandleCursesEmul(Widget w,
void
HandleBellIsUrgent(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
HANDLE_VT_TOGGLE(bellIsUrgent);
@@ -2528,8 +2540,8 @@ HandleBellIsUrgent(Widget w,
void
HandleMarginBell(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
HANDLE_VT_TOGGLE(marginbell);
@@ -2538,8 +2550,8 @@ HandleMarginBell(Widget w,
#if OPT_BLINK_CURS
void
HandleCursorBlink(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
/* eventually want to see if sensitive or not */
@@ -2550,8 +2562,8 @@ HandleCursorBlink(Widget w,
void
HandleAltScreen(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
/* eventually want to see if sensitive or not */
@@ -2561,8 +2573,8 @@ HandleAltScreen(Widget w,
void
HandleTiteInhibit(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
/* eventually want to see if sensitive or not */
@@ -2573,8 +2585,8 @@ HandleTiteInhibit(Widget w,
/* ARGSUSED */
void
HandleSoftReset(Widget w,
- XEvent * event GCC_UNUSED,
- String * params GCC_UNUSED,
+ XEvent *event GCC_UNUSED,
+ String *params GCC_UNUSED,
Cardinal *param_count GCC_UNUSED)
{
do_softreset(w, (XtPointer) 0, (XtPointer) 0);
@@ -2583,8 +2595,8 @@ HandleSoftReset(Widget w,
/* ARGSUSED */
void
HandleHardReset(Widget w,
- XEvent * event GCC_UNUSED,
- String * params GCC_UNUSED,
+ XEvent *event GCC_UNUSED,
+ String *params GCC_UNUSED,
Cardinal *param_count GCC_UNUSED)
{
do_hardreset(w, (XtPointer) 0, (XtPointer) 0);
@@ -2593,8 +2605,8 @@ HandleHardReset(Widget w,
/* ARGSUSED */
void
HandleClearSavedLines(Widget w,
- XEvent * event GCC_UNUSED,
- String * params GCC_UNUSED,
+ XEvent *event GCC_UNUSED,
+ String *params GCC_UNUSED,
Cardinal *param_count GCC_UNUSED)
{
do_clearsavedlines(w, (XtPointer) 0, (XtPointer) 0);
@@ -2602,8 +2614,8 @@ HandleClearSavedLines(Widget w,
void
HandleAllowBoldFonts(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
HANDLE_VT_TOGGLE(allowBoldFonts);
@@ -2612,8 +2624,8 @@ HandleAllowBoldFonts(Widget w,
#if OPT_DEC_CHRSET
void
HandleFontDoublesize(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
HANDLE_VT_TOGGLE(font_doublesize);
@@ -2623,8 +2635,8 @@ HandleFontDoublesize(Widget w,
#if OPT_BOX_CHARS
void
HandleFontBoxChars(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
handle_vt_toggle(do_font_boxchars, TScreenOf(term)->force_box_chars,
@@ -2633,8 +2645,8 @@ HandleFontBoxChars(Widget w,
void
HandleFontPacked(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
handle_vt_toggle(do_font_packed, TScreenOf(term)->force_packed,
@@ -2645,8 +2657,8 @@ HandleFontPacked(Widget w,
#if OPT_DEC_SOFTFONT
void
HandleFontLoading(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
handle_vt_toggle(do_font_loadable, term->misc.font_loadable,
@@ -2670,8 +2682,8 @@ update_fontmenu(XtermWidget xw)
void
HandleRenderFont(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
XtermWidget xw = (XtermWidget) term;
@@ -2688,8 +2700,8 @@ HandleRenderFont(Widget w,
#if OPT_WIDE_CHARS
void
HandleUTF8Mode(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
handle_vt_toggle(do_font_utf8_mode, TScreenOf(term)->utf8_mode,
@@ -2698,8 +2710,8 @@ HandleUTF8Mode(Widget w,
void
HandleUTF8Fonts(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
handle_vt_toggle(do_font_utf8_fonts, TScreenOf(term)->utf8_fonts,
@@ -2708,8 +2720,8 @@ HandleUTF8Fonts(Widget w,
void
HandleUTF8Title(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
handle_vt_toggle(do_font_utf8_title, TScreenOf(term)->utf8_title,
@@ -2720,8 +2732,8 @@ HandleUTF8Title(Widget w,
#if OPT_TEK4014
void
HandleSetTerminalType(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
XtermWidget xw = term;
@@ -2748,8 +2760,8 @@ HandleSetTerminalType(Widget w,
void
HandleVisibility(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
XtermWidget xw = term;
@@ -2777,8 +2789,8 @@ HandleVisibility(Widget w,
/* ARGSUSED */
void
HandleSetTekText(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
XtermWidget xw = term;
@@ -2814,8 +2826,8 @@ HandleSetTekText(Widget w,
/* ARGSUSED */
void
HandleTekPage(Widget w,
- XEvent * event GCC_UNUSED,
- String * params GCC_UNUSED,
+ XEvent *event GCC_UNUSED,
+ String *params GCC_UNUSED,
Cardinal *param_count GCC_UNUSED)
{
do_tekpage(w, (XtPointer) 0, (XtPointer) 0);
@@ -2824,8 +2836,8 @@ HandleTekPage(Widget w,
/* ARGSUSED */
void
HandleTekReset(Widget w,
- XEvent * event GCC_UNUSED,
- String * params GCC_UNUSED,
+ XEvent *event GCC_UNUSED,
+ String *params GCC_UNUSED,
Cardinal *param_count GCC_UNUSED)
{
do_tekreset(w, (XtPointer) 0, (XtPointer) 0);
@@ -2834,8 +2846,8 @@ HandleTekReset(Widget w,
/* ARGSUSED */
void
HandleTekCopy(Widget w,
- XEvent * event GCC_UNUSED,
- String * params GCC_UNUSED,
+ XEvent *event GCC_UNUSED,
+ String *params GCC_UNUSED,
Cardinal *param_count GCC_UNUSED)
{
do_tekcopy(w, (XtPointer) 0, (XtPointer) 0);
@@ -2863,8 +2875,7 @@ InitPopup(Widget gw,
domenu(gw, (XEvent *) 0, params, &count);
- if (gw)
- XtRemoveCallback(gw, XtNpopupCallback, InitPopup, closure);
+ XtRemoveCallback(gw, XtNpopupCallback, InitPopup, closure);
}
static Dimension
@@ -2913,7 +2924,7 @@ SetupShell(Widget *menus, MenuList * shell, int n, int m)
#endif /* OPT_TOOLBAR */
void
-SetupMenus(Widget shell, Widget *forms, Widget *menus, Dimension * menu_high)
+SetupMenus(Widget shell, Widget *forms, Widget *menus, Dimension *menu_high)
{
#if OPT_TOOLBAR
Dimension button_height = 0;
@@ -3141,8 +3152,8 @@ ShowToolbar(Bool enable)
void
HandleToolbar(Widget w,
- XEvent * event GCC_UNUSED,
- String * params GCC_UNUSED,
+ XEvent *event GCC_UNUSED,
+ String *params GCC_UNUSED,
Cardinal *param_count GCC_UNUSED)
{
XtermWidget xw = term;
@@ -3754,8 +3765,8 @@ do_allowWindowOps(Widget w,
void
HandleAllowColorOps(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
HANDLE_VT_TOGGLE(allowColorOps);
@@ -3763,8 +3774,8 @@ HandleAllowColorOps(Widget w,
void
HandleAllowFontOps(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
HANDLE_VT_TOGGLE(allowFontOps);
@@ -3772,8 +3783,8 @@ HandleAllowFontOps(Widget w,
void
HandleAllowTcapOps(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
HANDLE_VT_TOGGLE(allowTcapOps);
@@ -3781,8 +3792,8 @@ HandleAllowTcapOps(Widget w,
void
HandleAllowTitleOps(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
HANDLE_VT_TOGGLE(allowTitleOps);
@@ -3790,8 +3801,8 @@ HandleAllowTitleOps(Widget w,
void
HandleAllowWindowOps(Widget w,
- XEvent * event GCC_UNUSED,
- String * params,
+ XEvent *event GCC_UNUSED,
+ String *params,
Cardinal *param_count)
{
HANDLE_VT_TOGGLE(allowWindowOps);
diff --git a/app/xterm/menu.h b/app/xterm/menu.h
index 37294c35b..da937f426 100644
--- a/app/xterm/menu.h
+++ b/app/xterm/menu.h
@@ -1,7 +1,7 @@
-/* $XTermId: menu.h,v 1.132 2013/06/23 20:52:38 tom Exp $ */
+/* $XTermId: menu.h,v 1.133 2014/04/12 00:03:12 Ross.Combs Exp $ */
/*
- * Copyright 1999-2011,2013 by Thomas E. Dickey
+ * Copyright 1999-2013,2014 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -259,6 +259,8 @@ typedef enum {
vtMenu_altscreen,
#if OPT_SIXEL_GRAPHICS
vtMenu_sixelscrolling,
+#endif
+#if OPT_GRAPHICS
vtMenu_privatecolorregisters,
#endif
vtMenu_LAST
@@ -487,9 +489,13 @@ extern void update_font_packed(void);
#if OPT_SIXEL_GRAPHICS
extern void update_decsdm(void);
-extern void update_privatecolorregisters(void);
#else
#define update_decsdm() /* nothing */
+#endif
+
+#if OPT_GRAPHICS
+extern void update_privatecolorregisters(void);
+#else
#define update_privatecolorregisters() /* nothing */
#endif
diff --git a/app/xterm/minstall.in b/app/xterm/minstall.in
index 86a40bcaf..5ffdfbd00 100644
--- a/app/xterm/minstall.in
+++ b/app/xterm/minstall.in
@@ -1,9 +1,9 @@
#!/bin/sh
-# $XTermId: minstall.in,v 1.20 2013/04/21 18:58:54 tom Exp $
+# $XTermId: minstall.in,v 1.21 2014/02/27 23:43:50 tom Exp $
# -----------------------------------------------------------------------------
# this file is part of xterm
#
-# Copyright 2001-2012,2013 by Thomas E. Dickey
+# Copyright 2001-2013,2014 by Thomas E. Dickey
#
# All Rights Reserved
#
@@ -116,8 +116,10 @@ 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/'`
+# Use that to guess an appropriate section. This relies on having the manpage
+# installed.
+X_MANPAGE=X
+X_MANSECT=`man $X_MANPAGE 2>&1 | grep $X_MANPAGE'([^)]*)' | head -n 1 | tr '\012' '\040' | sed -e 's/^[^0123456789]*\([^) ][^) ]*\).*/\1/'`
test -z "$X_MANSECT" && X_MANSECT=$suffix
VERSION_H=`echo "$OLD_FILE" | sed -e 's,/[^/]*$,/version.h,' -e s',^[^/]*$,version.h,'`
diff --git a/app/xterm/misc.c b/app/xterm/misc.c
index 1465c9c1e..d67a4dffd 100644
--- a/app/xterm/misc.c
+++ b/app/xterm/misc.c
@@ -1,4 +1,4 @@
-/* $XTermId: misc.c,v 1.686 2014/01/19 16:12:25 Egmont.Koblinger Exp $ */
+/* $XTermId: misc.c,v 1.711 2014/04/25 23:27:45 tom Exp $ */
/*
* Copyright 1999-2013,2014 by Thomas E. Dickey
@@ -95,6 +95,8 @@
#include <xtermcap.h>
#include <VTparse.h>
#include <graphics.h>
+#include <graphics_regis.h>
+#include <graphics_sixel.h>
#include <assert.h>
@@ -1330,7 +1332,6 @@ WMFrameWindow(XtermWidget xw)
*/
#define IS_WORD_CONSTITUENT(x) ((x) != ' ' && (x) != '\0')
-#define MAXWLEN 1024 /* maximum word length as in tcsh */
static int
dabbrev_prev_char(TScreen *screen, CELL *cell, LineData **ld)
@@ -1357,13 +1358,12 @@ dabbrev_prev_char(TScreen *screen, CELL *cell, LineData **ld)
}
static char *
-dabbrev_prev_word(TScreen *screen, CELL *cell, LineData **ld)
+dabbrev_prev_word(XtermWidget xw, CELL *cell, LineData **ld)
{
- static char ab[MAXWLEN];
-
+ TScreen *screen = TScreenOf(xw);
char *abword;
int c;
- char *ab_end = (ab + MAXWLEN - 1);
+ char *ab_end = (xw->work.dabbrev_data + MAX_DABBREV - 1);
char *result = 0;
abword = ab_end;
@@ -1371,7 +1371,7 @@ dabbrev_prev_word(TScreen *screen, CELL *cell, LineData **ld)
while ((c = dabbrev_prev_char(screen, cell, ld)) >= 0 &&
IS_WORD_CONSTITUENT(c)) {
- if (abword > ab) /* store only |MAXWLEN| last chars */
+ if (abword > xw->work.dabbrev_data) /* store only the last chars */
*(--abword) = (char) c;
}
@@ -1392,8 +1392,9 @@ dabbrev_prev_word(TScreen *screen, CELL *cell, LineData **ld)
}
static int
-dabbrev_expand(TScreen *screen)
+dabbrev_expand(XtermWidget xw)
{
+ TScreen *screen = TScreenOf(xw);
int pty = screen->respond; /* file descriptor of pty */
static CELL cell;
@@ -1416,7 +1417,7 @@ dabbrev_expand(TScreen *screen)
if (dabbrev_hint != 0)
free(dabbrev_hint);
- if ((dabbrev_hint = dabbrev_prev_word(screen, &cell, &ld)) != 0) {
+ if ((dabbrev_hint = dabbrev_prev_word(xw, &cell, &ld)) != 0) {
if (lastexpansion != 0)
free(lastexpansion);
@@ -1448,7 +1449,7 @@ dabbrev_expand(TScreen *screen)
hint_len = strlen(dabbrev_hint);
for (;;) {
- if ((expansion = dabbrev_prev_word(screen, &cell, &ld)) == 0) {
+ if ((expansion = dabbrev_prev_word(xw, &cell, &ld)) == 0) {
if (expansions >= 2) {
expansions = 0;
cell.col = screen->cur_col;
@@ -1501,8 +1502,7 @@ HandleDabbrevExpand(Widget w,
TRACE(("Handle dabbrev-expand for %p\n", (void *) w));
if ((xw = getXtermWidget(w)) != 0) {
- TScreen *screen = TScreenOf(xw);
- if (!dabbrev_expand(screen))
+ if (!dabbrev_expand(xw))
Bell(xw, XkbBI_TerminalBell, 0);
}
}
@@ -2153,6 +2153,46 @@ FlushLog(XtermWidget xw)
/***====================================================================***/
+int
+getVisualInfo(XtermWidget xw)
+{
+#define MYFMT "getVisualInfo \
+depth %d, \
+type %d (%s), \
+size %d \
+rgb masks (%04lx/%04lx/%04lx)\n"
+#define MYARG \
+ vi->depth,\
+ vi->class,\
+ ((vi->class & 1) ? "dynamic" : "static"),\
+ vi->colormap_size,\
+ vi->red_mask,\
+ vi->green_mask,\
+ vi->blue_mask
+
+ TScreen *screen = TScreenOf(xw);
+ Display *dpy = screen->display;
+ XVisualInfo myTemplate;
+
+ if (xw->visInfo == 0 && xw->numVisuals == 0) {
+ myTemplate.visualid = XVisualIDFromVisual(DefaultVisual(dpy,
+ XDefaultScreen(dpy)));
+ xw->visInfo = XGetVisualInfo(dpy, (long) VisualIDMask,
+ &myTemplate, &xw->numVisuals);
+
+ if ((xw->visInfo != 0) && (xw->numVisuals > 0)) {
+ XVisualInfo *vi = xw->visInfo;
+ if (resource.reportColors) {
+ printf(MYFMT, MYARG);
+ }
+ TRACE((MYFMT, MYARG));
+ }
+ }
+ return (xw->visInfo != 0) && (xw->numVisuals > 0);
+#undef MYFMT
+#undef MYARG
+}
+
#if OPT_ISO_COLORS
static void
ReportAnsiColorRequest(XtermWidget xw, int colornum, int final)
@@ -2178,22 +2218,15 @@ ReportAnsiColorRequest(XtermWidget xw, int colornum, int final)
}
static void
-getColormapInfo(Display *display, unsigned *typep, unsigned *sizep)
+getColormapInfo(XtermWidget xw, unsigned *typep, unsigned *sizep)
{
- int numFound;
- XVisualInfo myTemplate, *visInfoPtr;
-
- myTemplate.visualid = XVisualIDFromVisual(DefaultVisual(display,
- XDefaultScreen(display)));
- visInfoPtr = XGetVisualInfo(display, (long) VisualIDMask,
- &myTemplate, &numFound);
- *typep = (numFound >= 1) ? (unsigned) visInfoPtr->class : 0;
- *sizep = (numFound >= 1) ? (unsigned) visInfoPtr->colormap_size : 0;
-
- XFree((char *) visInfoPtr);
-
- TRACE(("getColormapInfo type %d (%s), size %d\n",
- *typep, ((*typep & 1) ? "dynamic" : "static"), *sizep));
+ if (getVisualInfo(xw)) {
+ *typep = (unsigned) xw->visInfo->class;
+ *sizep = (unsigned) xw->visInfo->colormap_size;
+ } else {
+ *typep = 0;
+ *sizep = 0;
+ }
}
#define MAX_COLORTABLE 4096
@@ -2207,9 +2240,9 @@ loadColorTable(XtermWidget xw, unsigned length)
Colormap cmap = xw->core.colormap;
TScreen *screen = TScreenOf(xw);
unsigned i;
- Boolean result = False;
+ Boolean result = (screen->cmap_data != 0);
- if (screen->cmap_data == 0
+ if (!result
&& length != 0
&& length < MAX_COLORTABLE) {
screen->cmap_data = TypeMallocN(XColor, (size_t) length);
@@ -2236,13 +2269,6 @@ loadColorTable(XtermWidget xw, unsigned length)
* modified with ideas from David Tong's "noflash" library.
* The code from Vim in turn was derived from FindClosestColor() in Tcl/Tk.
*
- * These provide some introduction:
- * http://en.wikipedia.org/wiki/YIQ
- * for an introduction to YIQ weights.
- * http://en.wikipedia.org/wiki/Luminance_(video)
- * for a discussion of luma.
- * http://en.wikipedia.org/wiki/YUV
- *
* Return False if not able to find or allocate a color.
*/
static Boolean
@@ -2258,7 +2284,7 @@ allocateClosestRGB(XtermWidget xw, Colormap cmap, XColor * def)
unsigned cmap_size;
unsigned i;
- getColormapInfo(screen->display, &cmap_type, &cmap_size);
+ getColormapInfo(xw, &cmap_type, &cmap_size);
if ((cmap_type & 1) != 0) {
@@ -2359,21 +2385,18 @@ static int
simpleColors(XColor * colortable, unsigned length)
{
unsigned n;
- int state = -1;
+ int state = 0;
int check;
for (n = 0; n < length; ++n) {
- if (state == -1) {
- CheckColor(state, colortable[n]);
- if (state == 0)
- state = -1;
- }
if (state > 0) {
CheckColor(check, colortable[n]);
if (check > 0 && check != state) {
state = 0;
break;
}
+ } else {
+ CheckColor(state, colortable[n]);
}
}
switch (state) {
@@ -2388,8 +2411,25 @@ simpleColors(XColor * colortable, unsigned length)
return state;
}
+/*
+ * Shift the mask left or right to put its most significant bit at the 16-bit
+ * mark.
+ */
+static unsigned
+normalizeMask(unsigned mask)
+{
+ while (mask < 0x8000) {
+ mask <<= 1;
+ }
+ while (mask >= 0x10000) {
+ mask >>= 1;
+ }
+ return mask;
+}
+
static unsigned
-searchColors(XColor * colortable, unsigned length, unsigned color, int state)
+searchColors(XColor * colortable, unsigned mask, unsigned length, unsigned
+ color, int state)
{
unsigned result = 0;
unsigned n;
@@ -2397,9 +2437,10 @@ searchColors(XColor * colortable, unsigned length, unsigned color, int state)
unsigned long diff;
unsigned value;
+ mask = normalizeMask(mask);
for (n = 0; n < length; ++n) {
SelectColor(state, colortable[n], value);
- diff = (color - value);
+ diff = ((color & mask) - (value & mask));
diff *= diff;
if (diff < best) {
#if 0
@@ -2433,7 +2474,7 @@ searchColors(XColor * colortable, unsigned length, unsigned color, int state)
* actual RGB values allocated.
*
* That is, XAllocColor() should suffice unless the color map is full. In that
- * case, allocateClosesRGB() is useful for the dynamic display classes such as
+ * case, allocateClosestRGB() is useful for the dynamic display classes such as
* PseudoColor. It is not useful for TrueColor, since XQueryColors() does not
* return regular RGB triples (unless a different scheme was used for
* specifying the pixel values); only the blue value is filled in. However, it
@@ -2451,23 +2492,28 @@ allocateExactRGB(XtermWidget xw, Colormap cmap, XColor * def)
Boolean result = (Boolean) (XAllocColor(screen->display, cmap, def) != 0);
/*
- * If this is a statically allocated display, e.g., TrueColor, see if we
- * can improve on the result by using the color values actually supported
- * by the server.
+ * If this is a statically allocated display with too many items to store
+ * in our array, i.e., TrueColor, see if we can improve on the result by
+ * using the color values actually supported by the server.
*/
if (result) {
unsigned cmap_type;
unsigned cmap_size;
int state;
- getColormapInfo(screen->display, &cmap_type, &cmap_size);
+ getColormapInfo(xw, &cmap_type, &cmap_size);
- if ((cmap_type & 1) == 0) {
+ if (cmap_type == TrueColor) {
XColor temp = *def;
if (loadColorTable(xw, cmap_size)
&& (state = simpleColors(screen->cmap_data, cmap_size)) > 0) {
-#define SearchColors(which) temp.which = (unsigned short) searchColors(screen->cmap_data, cmap_size, save.which, state)
+#define SearchColors(which) \
+ temp.which = (unsigned short) searchColors(screen->cmap_data, \
+ (unsigned) xw->visInfo->which##_mask,\
+ cmap_size, \
+ save.which, \
+ state)
SearchColors(red);
SearchColors(green);
SearchColors(blue);
@@ -2723,11 +2769,27 @@ xtermAllocColor(XtermWidget xw, XColor * def, const char *spec)
TScreen *screen = TScreenOf(xw);
Colormap cmap = xw->core.colormap;
- if (XParseColor(screen->display, cmap, spec, def)
- && allocateBestRGB(xw, def)) {
- TRACE(("xtermAllocColor -> %x/%x/%x\n",
- def->red, def->green, def->blue));
- result = True;
+ if (XParseColor(screen->display, cmap, spec, def)) {
+ XColor save_def = *def;
+ if (resource.reportColors) {
+ printf("color %04x/%04x/%04x = \"%s\"\n",
+ def->red, def->green, def->blue,
+ spec);
+ }
+ if (allocateBestRGB(xw, def)) {
+ if (resource.reportColors) {
+ if (def->red != save_def.red ||
+ def->green != save_def.green ||
+ def->blue != save_def.blue) {
+ printf("color %04x/%04x/%04x ~ \"%s\"\n",
+ def->red, def->green, def->blue,
+ spec);
+ }
+ }
+ TRACE(("xtermAllocColor -> %x/%x/%x\n",
+ def->red, def->green, def->blue));
+ result = True;
+ }
}
return result;
}
@@ -2957,24 +3019,22 @@ typedef enum {
#define OSC_RESET 100
#define OSC_Reset(code) (code) + OSC_RESET
-static ScrnColors *pOldColors = NULL;
-
static Bool
GetOldColors(XtermWidget xw)
{
int i;
- if (pOldColors == NULL) {
- pOldColors = TypeXtMalloc(ScrnColors);
- if (pOldColors == NULL) {
+ if (xw->work.oldColors == NULL) {
+ xw->work.oldColors = TypeXtMalloc(ScrnColors);
+ if (xw->work.oldColors == NULL) {
xtermWarning("allocation failure in GetOldColors\n");
return (False);
}
- pOldColors->which = 0;
+ xw->work.oldColors->which = 0;
for (i = 0; i < NCOLORS; i++) {
- pOldColors->colors[i] = 0;
- pOldColors->names[i] = NULL;
+ xw->work.oldColors->colors[i] = 0;
+ xw->work.oldColors->names[i] = NULL;
}
- GetColors(xw, pOldColors);
+ GetColors(xw, xw->work.oldColors);
}
return (True);
}
@@ -3033,14 +3093,14 @@ ReportColorRequest(XtermWidget xw, int ndx, int final)
int i = (xw->misc.re_verse) ? oppositeColor(ndx) : ndx;
GetOldColors(xw);
- color.pixel = pOldColors->colors[ndx];
+ color.pixel = xw->work.oldColors->colors[ndx];
XQueryColor(TScreenOf(xw)->display, cmap, &color);
sprintf(buffer, "%d;rgb:%04x/%04x/%04x", i + 10,
color.red,
color.green,
color.blue);
TRACE(("ReportColorRequest #%d: 0x%06lx as %s\n",
- ndx, pOldColors->colors[ndx], buffer));
+ ndx, xw->work.oldColors->colors[ndx], buffer));
unparseputc1(xw, ANSI_OSC);
unparseputs(xw, buffer);
unparseputc1(xw, final);
@@ -3062,14 +3122,14 @@ UpdateOldColors(XtermWidget xw GCC_UNUSED, ScrnColors * pNew)
*/
for (i = 0; i < NCOLORS; i++) {
if (COLOR_DEFINED(pNew, i)) {
- if (pOldColors->names[i] != NULL) {
- XtFree(pOldColors->names[i]);
- pOldColors->names[i] = NULL;
+ if (xw->work.oldColors->names[i] != NULL) {
+ XtFree(xw->work.oldColors->names[i]);
+ xw->work.oldColors->names[i] = NULL;
}
if (pNew->names[i]) {
- pOldColors->names[i] = pNew->names[i];
+ xw->work.oldColors->names[i] = pNew->names[i];
}
- pOldColors->colors[i] = pNew->colors[i];
+ xw->work.oldColors->colors[i] = pNew->colors[i];
}
}
return (True);
@@ -3142,12 +3202,13 @@ ChangeColorsRequest(XtermWidget xw,
if (names != NULL) {
*names++ = '\0';
}
- if (thisName != 0 && !strcmp(thisName, "?")) {
- ReportColorRequest(xw, ndx, final);
- } else if (!pOldColors->names[ndx]
- || (thisName
- && strcmp(thisName, pOldColors->names[ndx]))) {
- AllocateTermColor(xw, &newColors, ndx, thisName, False);
+ if (thisName != 0) {
+ if (!strcmp(thisName, "?")) {
+ ReportColorRequest(xw, ndx, final);
+ } else if (!xw->work.oldColors->names[ndx]
+ || strcmp(thisName, xw->work.oldColors->names[ndx])) {
+ AllocateTermColor(xw, &newColors, ndx, thisName, False);
+ }
}
}
}
@@ -3166,9 +3227,11 @@ ResetColorsRequest(XtermWidget xw,
int code)
{
Bool result = False;
+#if OPT_COLOR_RES
const char *thisName;
ScrnColors newColors;
int ndx;
+#endif
TRACE(("ResetColorsRequest code=%d\n", code));
@@ -3184,8 +3247,8 @@ ResetColorsRequest(XtermWidget xw,
newColors.names[ndx] = NULL;
if (thisName != 0
- && pOldColors->names[ndx] != 0
- && strcmp(thisName, pOldColors->names[ndx])) {
+ && xw->work.oldColors->names[ndx] != 0
+ && strcmp(thisName, xw->work.oldColors->names[ndx])) {
AllocateTermColor(xw, &newColors, ndx, thisName, False);
if (newColors.which != 0) {
@@ -3634,16 +3697,6 @@ do_osc(XtermWidget xw, Char *oscbuf, size_t len, int final)
unparse_end(xw);
}
-#ifdef SunXK_F36
-#define MAX_UDK 37
-#else
-#define MAX_UDK 35
-#endif
-static struct {
- char *str;
- int len;
-} user_keys[MAX_UDK];
-
/*
* Parse one nibble of a hex byte from the OSC string. We have removed the
* string-terminator (replacing it with a null), so the only other delimiter
@@ -3669,14 +3722,14 @@ udk_value(const char **cp)
}
void
-reset_decudk(void)
+reset_decudk(XtermWidget xw)
{
int n;
for (n = 0; n < MAX_UDK; n++) {
- if (user_keys[n].str != 0) {
- free(user_keys[n].str);
- user_keys[n].str = 0;
- user_keys[n].len = 0;
+ if (xw->work.user_keys[n].str != 0) {
+ free(xw->work.user_keys[n].str);
+ xw->work.user_keys[n].str = 0;
+ xw->work.user_keys[n].len = 0;
}
}
}
@@ -3685,7 +3738,7 @@ reset_decudk(void)
* Parse the data for DECUDK (user-defined keys).
*/
static void
-parse_decudk(const char *cp)
+parse_decudk(XtermWidget xw, const char *cp)
{
while (*cp) {
const char *base = cp;
@@ -3705,10 +3758,10 @@ parse_decudk(const char *cp)
}
if (len > 0 && key < MAX_UDK) {
str[len] = '\0';
- if (user_keys[key].str != 0)
- free(user_keys[key].str);
- user_keys[key].str = str;
- user_keys[key].len = len;
+ if (xw->work.user_keys[key].str != 0)
+ free(xw->work.user_keys[key].str);
+ xw->work.user_keys[key].str = str;
+ xw->work.user_keys[key].len = len;
} else {
free(str);
}
@@ -4086,8 +4139,8 @@ do_dcs(XtermWidget xw, Char *dcsbuf, size_t dcslen)
screen->vtXX_level >= 2) { /* VT220 */
parse_ansi_params(&params, &cp);
switch (params.a_final) {
-#if OPT_SIXEL_GRAPHICS
case 'p':
+#if OPT_REGIS_GRAPHICS
if (screen->terminal_id == 125 ||
screen->terminal_id == 240 ||
screen->terminal_id == 241 ||
@@ -4095,24 +4148,35 @@ do_dcs(XtermWidget xw, Char *dcsbuf, size_t dcslen)
screen->terminal_id == 340) {
parse_regis(xw, &params, cp);
}
+#else
+ TRACE(("ignoring ReGIS graphic (compilation flag not enabled)\n"));
+#endif
break;
case 'q':
+#if OPT_SIXEL_GRAPHICS
if (screen->terminal_id == 125 ||
screen->terminal_id == 240 ||
screen->terminal_id == 241 ||
screen->terminal_id == 330 ||
- screen->terminal_id == 340) {
+ screen->terminal_id == 340 ||
+ screen->terminal_id == 382) {
parse_sixel(xw, &params, cp);
}
- break;
+#else
+ TRACE(("ignoring sixel graphic (compilation flag not enabled)\n"));
#endif
+ break;
case '|': /* DECUDK */
- if (params.a_param[0] == 0)
- reset_decudk();
- parse_decudk(cp);
+ if (screen->vtXX_level >= 2) { /* VT220 */
+ if (params.a_param[0] == 0)
+ reset_decudk(xw);
+ parse_decudk(xw, cp);
+ }
break;
case '{': /* DECDLD (no '}' case though) */
- parse_decdld(&params, cp);
+ if (screen->vtXX_level >= 2) { /* VT220 */
+ parse_decdld(&params, cp);
+ }
break;
}
}
@@ -4434,6 +4498,19 @@ do_decrpm(XtermWidget xw, int nparams, int *params)
result = MdBool(screen->paste_literal_nl);
break;
#endif /* OPT_READLINE */
+#if OPT_SIXEL_GRAPHICS
+ case srm_PRIVATE_COLOR_REGISTERS:
+ result = MdBool(screen->privatecolorregisters);
+ break;
+#endif
+#if OPT_SIXEL_GRAPHICS
+ case srm_SIXEL_SCROLLS_RIGHT:
+ result = MdBool(screen->sixel_scrolls_right);
+ break;
+#endif
+ default:
+ TRACE(("DATA_ERROR: requested report for unknown private mode %d\n",
+ params[0]));
}
reply.a_param[count++] = (ParmType) params[0];
reply.a_param[count++] = (ParmType) result;
@@ -4448,11 +4525,11 @@ do_decrpm(XtermWidget xw, int nparams, int *params)
#endif /* OPT_DEC_RECTOPS */
char *
-udk_lookup(int keycode, int *len)
+udk_lookup(XtermWidget xw, int keycode, int *len)
{
if (keycode >= 0 && keycode < MAX_UDK) {
- *len = user_keys[keycode].len;
- return user_keys[keycode].str;
+ *len = xw->work.user_keys[keycode].len;
+ return xw->work.user_keys[keycode].str;
}
return 0;
}
@@ -4566,20 +4643,10 @@ which_icon_hint(void)
int
getVisualDepth(XtermWidget xw)
{
- Display *display = TScreenOf(xw)->display;
- XVisualInfo myTemplate, *visInfoPtr;
- int numFound;
int result = 0;
- myTemplate.visualid = XVisualIDFromVisual(DefaultVisual(display,
- XDefaultScreen(display)));
- visInfoPtr = XGetVisualInfo(display, (long) VisualIDMask,
- &myTemplate, &numFound);
- if (visInfoPtr != 0) {
- if (numFound != 0) {
- result = visInfoPtr->depth;
- }
- XFree(visInfoPtr);
+ if (getVisualInfo(xw)) {
+ result = xw->visInfo->depth;
}
return result;
}
@@ -4596,14 +4663,7 @@ xtermLoadIcon(XtermWidget xw)
Pixmap myMask = 0;
char *workname = 0;
ICON_HINT hint = which_icon_hint();
-#if OPT_BUILTIN_XPMS
-#include <icons/mini.xterm.xpms>
-#include <icons/filled-xterm.xpms>
-#include <icons/xterm.xpms>
-#include <icons/xterm-color.xpms>
-#else
-#include <icons/mini.xterm_48x48.xpm>
-#endif
+#include <builtin_icons.h>
TRACE(("xtermLoadIcon %p:%s\n", (void *) xw, NonNull(resource.icon_hint)));
@@ -4883,9 +4943,9 @@ ChangeXprop(char *buf)
* "dynamic" colors that might have been retrieved using OSC 10-18.
*/
void
-ReverseOldColors(void)
+ReverseOldColors(XtermWidget xw)
{
- ScrnColors *pOld = pOldColors;
+ ScrnColors *pOld = xw->work.oldColors;
Pixel tmpPix;
char *tmpName;
@@ -4894,7 +4954,7 @@ ReverseOldColors(void)
if (pOld->colors[TEXT_CURSOR] == pOld->colors[TEXT_FG]) {
pOld->colors[TEXT_CURSOR] = pOld->colors[TEXT_BG];
if (pOld->names[TEXT_CURSOR]) {
- XtFree(pOldColors->names[TEXT_CURSOR]);
+ XtFree(xw->work.oldColors->names[TEXT_CURSOR]);
pOld->names[TEXT_CURSOR] = NULL;
}
if (pOld->names[TEXT_BG]) {
@@ -5097,6 +5157,27 @@ Cleanup(int code)
Exit(code);
}
+#ifndef S_IXOTH
+#define S_IXOTH 1
+#endif
+
+Boolean
+validProgram(const char *pathname)
+{
+ Boolean result = False;
+ struct stat sb;
+
+ if (!IsEmpty(pathname)
+ && *pathname == '/'
+ && strstr(pathname, "/..") == 0
+ && stat(pathname, &sb) == 0
+ && (sb.st_mode & S_IFMT) == S_IFREG
+ && (sb.st_mode & S_IXOTH) != 0) {
+ result = True;
+ }
+ return result;
+}
+
#ifndef VMS
#ifndef PATH_MAX
#define PATH_MAX 512 /* ... is not defined consistently in Xos.h */
@@ -5142,9 +5223,7 @@ xtermFindShell(char *leaf, Bool warning)
if (skip)
++d;
s += (d - tmp);
- if (*tmp == '/'
- && strstr(tmp, "..") == 0
- && access(tmp, X_OK) == 0) {
+ if (validProgram(tmp)) {
result = x_strdup(tmp);
found = True;
allocated = True;
@@ -5161,9 +5240,7 @@ xtermFindShell(char *leaf, Bool warning)
}
}
TRACE(("...xtermFindShell(%s)\n", result));
- if (*result != '/'
- || strstr(result, "..") != 0
- || access(result, X_OK) != 0) {
+ if (!validProgram(result)) {
if (warning)
xtermWarning("No absolute path found for shell: %s\n", result);
if (allocated)
@@ -5855,6 +5932,9 @@ xtermOpenApplication(XtAppContext * app_context_return,
num_args);
IceAddConnectionWatch(icewatch, NULL);
#else
+ (void) widget_class;
+ (void) args;
+ (void) num_args;
result = XtAppInitialize(app_context_return,
my_class,
options,
diff --git a/app/xterm/package/debian/changelog b/app/xterm/package/debian/changelog
index 71b9091a6..06c4d36fc 100644
--- a/app/xterm/package/debian/changelog
+++ b/app/xterm/package/debian/changelog
@@ -1,3 +1,21 @@
+xterm-dev (304) unstable; urgency=low
+
+ * maintenance updates
+
+ -- Thomas E. Dickey <dickey@invisible-island.net> Wed, 09 Apr 2014 20:27:40 -0400
+
+xterm-dev (303) unstable; urgency=low
+
+ * maintenance updates
+
+ -- Thomas E. Dickey <dickey@invisible-island.net> Tue, 04 Mar 2014 17:46:25 -0500
+
+xterm-dev (302) unstable; urgency=low
+
+ * maintenance updates
+
+ -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 15 Feb 2014 16:19:35 -0500
+
xterm-dev (301) unstable; urgency=high
* miscellaneous fixes
diff --git a/app/xterm/package/debian/control b/app/xterm/package/debian/control
index b970db25b..96995ec4b 100644
--- a/app/xterm/package/debian/control
+++ b/app/xterm/package/debian/control
@@ -3,7 +3,7 @@ Section: x11
Priority: optional
Maintainer: Thomas E. Dickey <dickey@invisible-island.net>
Homepage: http://invisible-island.net/xterm/
-Build-Depends: debhelper (>= 7)
+Build-Depends: debhelper (>= 7), xorg-docs-core
Standards-Version: 3.8.2
Package: xterm-dev
diff --git a/app/xterm/package/debian/rules b/app/xterm/package/debian/rules
index 1d5159f42..8f818b505 100644
--- a/app/xterm/package/debian/rules
+++ b/app/xterm/package/debian/rules
@@ -181,7 +181,7 @@ binary-arch: build install
dh_install
dh_link
dh_strip
- dh_compress
+ dh_compress -Xexamples
dh_fixperms
dh_installdeb
dh_shlibdeps
diff --git a/app/xterm/package/freebsd/Makefile b/app/xterm/package/freebsd/Makefile
index c2f56322f..3cab70a47 100644
--- a/app/xterm/package/freebsd/Makefile
+++ b/app/xterm/package/freebsd/Makefile
@@ -5,7 +5,7 @@
# and "make makesum".
PORTNAME= xterm
-PORTVERSION= 301
+PORTVERSION= 304
CATEGORIES= x11
MASTER_SITES= ftp://invisible-island.net/xterm/ \
CRITICAL
diff --git a/app/xterm/package/xterm.spec b/app/xterm/package/xterm.spec
index d4a6d8498..4424bf9cd 100644
--- a/app/xterm/package/xterm.spec
+++ b/app/xterm/package/xterm.spec
@@ -1,18 +1,42 @@
-# $XTermId: xterm.spec,v 1.59 2013/12/09 12:59:32 tom Exp $
+# $XTermId: xterm.spec,v 1.67 2014/04/10 00:27:40 tom Exp $
Summary: X terminal emulator (development version)
%global my_middle xterm
%global my_suffix -dev
%global fullname %{my_middle}%{my_suffix}
%global my_class XTermDev
Name: %{fullname}
-Version: 301
+Version: 304
Release: 1
License: X11
Group: User Interface/X
Source: xterm-%{version}.tgz
-# URL: http://invisible-island.net/xterm/
+URL: ftp://invisible-island.net/xterm/
Provides: x-terminal-emulator
+# This part (the build-requires) would be useful if the various distributions
+# had provided stable package-naming, or virtual packages to cover transitions.
+# However, they have not done this in the past.
+%define use_x_manpage %(test "x$_use_x_manpage" = xyes && echo 1 || echo 0)
+%if "%{use_x_manpage}"
+
+%global is_mandriva %(test -f /etc/mandriva-release && echo %{use_x_manpage} || echo 0)
+%global is_redhat %(test -f /etc/redhat-release && echo %{use_x_manpage} || echo 0)
+%global is_suse %(test -f /etc/SuSE-release && echo %{use_x_manpage} || echo 0)
+
+%if %{is_mandriva}
+BuildRequires: x11-docs
+%else
+%if %{is_redhat}
+BuildRequires: xorg-x11-docs
+%else
+%if %{is_suse}
+BuildRequires: xorg-docs
+%endif
+%endif
+%endif
+
+%endif
+
%description
xterm is the standard terminal emulator for the X Window System.
It provides DEC VT102 and Tektronix 4014 compatible terminals for
@@ -46,14 +70,19 @@ for the program and its resource class, to avoid conflict with other packages.
%define desktop_utils %(if which desktop-file-install 2>&1 >/dev/null ; then echo 1 || echo 0 ; fi)
%define icon_theme %(test -d /usr/share/icons/hicolor && echo 1 || echo 0)
+%define apps_x11r6 %(test -d /usr/X11R6/lib/X11/app-defaults && echo 1 || echo 0)
%define apps_shared %(test -d /usr/share/X11/app-defaults && echo 1 || echo 0)
%define apps_syscnf %(test -d /etc/X11/app-defaults && echo 1 || echo 0)
+%if %{apps_x11r6}
+%define _xresdir %{_prefix}/X11R6/lib/X11/app-defaults
+%else
%if %{apps_shared}
%define _xresdir %{_datadir}/X11/app-defaults
%else
%define _xresdir %{_sysconfdir}/X11/app-defaults
%endif
+%endif
%define _iconsdir %{_datadir}/icons
%define _pixmapsdir %{_datadir}/pixmaps
@@ -142,7 +171,7 @@ make install-bin install-man install-app install-icon \
# The scripts are readable, but not executable, to let find-requires
# know that they do not depend on Perl packages.
- chmod 644 $RPM_BUILD_ROOT%{my_docdir}/vttests/*
+ chmod 644 $RPM_BUILD_ROOT%{my_docdir}/vttests/*.pl
%if "%{desktop_utils}"
make install-desktop \
@@ -164,6 +193,8 @@ if [ -x %{_bindir}/gtk-update-icon-cache ]; then
%{_bindir}/gtk-update-icon-cache %{_iconsdir}/hicolor || :
fi
%endif
+# find-requires does not care about at this point
+chmod +x %{my_docdir}/vttests/*.*
%postun
%if "%{icon_theme}"
diff --git a/app/xterm/ptyx.h b/app/xterm/ptyx.h
index 99ea119b0..733462fa0 100644
--- a/app/xterm/ptyx.h
+++ b/app/xterm/ptyx.h
@@ -1,7 +1,7 @@
-/* $XTermId: ptyx.h,v 1.789 2013/11/23 17:04:26 tom Exp $ */
+/* $XTermId: ptyx.h,v 1.802 2014/05/03 12:58:37 tom Exp $ */
/*
- * Copyright 1999-2012,2013 by Thomas E. Dickey
+ * Copyright 1999-2013,2014 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -80,6 +80,13 @@
#include <stdio.h>
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#define DECONST(type,s) ((type *)(intptr_t)(const type *)(s))
+#else
+#define DECONST(type,s) ((type *)(s))
+#endif
+
/* adapted from IntrinsicI.h */
#define MyStackAlloc(size, stack_cache_array) \
((size) <= sizeof(stack_cache_array) \
@@ -315,6 +322,7 @@ typedef Char *UString;
#endif
#define IsEmpty(s) ((s) == 0 || *(s) == '\0')
+#define IsSpace(c) ((c) == ' ' || (c) == '\t' || (c) == '\r' || (c) == '\n')
#define CharOf(n) ((Char)(n))
@@ -518,7 +526,15 @@ typedef struct {
#endif
#ifndef OPT_SIXEL_GRAPHICS
-#define OPT_SIXEL_GRAPHICS 0 /* true if xterm supports VT220-style sixel graphics */
+#define OPT_SIXEL_GRAPHICS 0 /* true if xterm supports VT240-style sixel graphics */
+#endif
+
+#ifndef OPT_REGIS_GRAPHICS
+#define OPT_REGIS_GRAPHICS 0 /* true if xterm supports VT125/VT240/VT330 ReGIS graphics */
+#endif
+
+#ifndef OPT_GRAPHICS
+#define OPT_GRAPHICS 0 /* true if xterm is configured for any type of graphics */
#endif
#ifndef OPT_DEC_SOFTFONT
@@ -657,6 +673,10 @@ typedef struct {
#endif
#endif
+#ifndef OPT_REPORT_COLORS
+#define OPT_REPORT_COLORS 1 /* provide "-report-colors" option */
+#endif
+
#ifndef OPT_REPORT_FONTS
#define OPT_REPORT_FONTS 1 /* provide "-report-fonts" option */
#endif
@@ -1040,7 +1060,7 @@ typedef enum {
#if OPT_SUNPC_KBD
,srm_VT220_FKEYS = 1061
#endif
-#if OPT_SIXEL_GRAPHICS
+#if OPT_GRAPHICS
,srm_PRIVATE_COLOR_REGISTERS = 1070
#endif
#if OPT_READLINE
@@ -1051,6 +1071,9 @@ typedef enum {
,srm_PASTE_QUOTE = SET_PASTE_QUOTE
,srm_PASTE_LITERAL_NL = SET_PASTE_LITERAL_NL
#endif /* OPT_READLINE */
+#if OPT_SIXEL_GRAPHICS
+ ,srm_SIXEL_SCROLLS_RIGHT = 8452
+#endif
} DECSET_codes;
/* indices for mapping multiple clicks to selection types */
@@ -1387,14 +1410,14 @@ typedef unsigned char IChar; /* for 8-bit characters */
#define Cres(name, class, offset, dftvalue) \
{RES_NAME(name), RES_CLASS(class), XtRPixel, sizeof(Pixel), \
- RES_OFFSET(offset), XtRString, (XtPointer) dftvalue}
+ RES_OFFSET(offset), XtRString, DECONST(char,dftvalue)}
#define Tres(name, class, offset, dftvalue) \
COLOR_RES2(name, class, screen.Tcolors[offset], dftvalue) \
#define Fres(name, class, offset, dftvalue) \
{RES_NAME(name), RES_CLASS(class), XtRFontStruct, sizeof(XFontStruct *), \
- RES_OFFSET(offset), XtRString, (XtPointer) dftvalue}
+ RES_OFFSET(offset), XtRString, DECONST(char,dftvalue)}
#define Ires(name, class, offset, dftvalue) \
{RES_NAME(name), RES_CLASS(class), XtRInt, sizeof(int), \
@@ -1402,11 +1425,11 @@ typedef unsigned char IChar; /* for 8-bit characters */
#define Dres(name, class, offset, dftvalue) \
{RES_NAME(name), RES_CLASS(class), XtRFloat, sizeof(float), \
- RES_OFFSET(offset), XtRString, (XtPointer) dftvalue}
+ RES_OFFSET(offset), XtRString, DECONST(char,dftvalue)}
#define Sres(name, class, offset, dftvalue) \
{RES_NAME(name), RES_CLASS(class), XtRString, sizeof(char *), \
- RES_OFFSET(offset), XtRString, (XtPointer) dftvalue}
+ RES_OFFSET(offset), XtRString, DECONST(char,dftvalue)}
#define Wres(name, class, offset, dftvalue) \
{RES_NAME(name), RES_CLASS(class), XtRWidget, sizeof(Widget), \
@@ -1441,7 +1464,7 @@ typedef unsigned short CellColor;
typedef Char CellColor;
#endif
#else
-typedef int CellColor;
+typedef unsigned CellColor;
#endif
#define BITS2MASK(b) ((1 << b) - 1)
@@ -1632,6 +1655,9 @@ typedef enum {
DP_TOOLBAR,
#endif
DP_X_PRIVATE_COLOR_REGISTERS,
+#if OPT_SIXEL_GRAPHICS
+ DP_SIXEL_SCROLLS_RIGHT,
+#endif
DP_LAST
} SaveModes;
@@ -1869,6 +1895,7 @@ typedef struct {
char * utf8_mode_s; /* use UTF-8 decode/encode */
char * utf8_fonts_s; /* use UTF-8 decode/encode */
int utf8_nrc_mode; /* saved UTF-8 mode for DECNRCM */
+ Boolean utf8_always; /* special case for wideChars */
int utf8_mode; /* use UTF-8 decode/encode: 0-2 */
int utf8_fonts; /* use UTF-8 decode/encode: 0-2 */
int max_combining; /* maximum # of combining chars */
@@ -2167,6 +2194,11 @@ typedef struct {
#if OPT_SIXEL_GRAPHICS
Boolean sixel_scrolling; /* sixel scrolling */
+ Boolean sixel_scrolls_right; /* sixel scrolling moves cursor to right */
+#endif
+
+#if OPT_GRAPHICS
+ int numcolorregisters; /* number of supported color registers */
Boolean privatecolorregisters; /* private color registers for each graphic */
#endif
@@ -2581,6 +2613,15 @@ typedef struct _Misc {
typedef struct _Work {
int dummy;
+#ifdef SunXK_F36
+#define MAX_UDK 37
+#else
+#define MAX_UDK 35
+#endif
+ struct {
+ char *str;
+ int len;
+ } user_keys[MAX_UDK];
#ifndef NO_ACTIVE_ICON
int active_icon; /* use application icon window */
#endif /* NO_ACTIVE_ICON */
@@ -2601,6 +2642,11 @@ typedef struct _Work {
#if OPT_RENDERFONT
Boolean render_font;
#endif
+#if OPT_DABBREV
+#define MAX_DABBREV 1024 /* maximum word length as in tcsh */
+ char dabbrev_data[MAX_DABBREV];
+#endif
+ ScrnColors *oldColors;
} Work;
typedef struct {int foo;} XtermClassPart, TekClassPart;
@@ -2634,7 +2680,6 @@ extern WidgetClass tekWidgetClass;
#define MODE_DECBKM xBIT(4) /* private mode 67: backarrow */
#define MODE_DECSDM xBIT(5) /* private mode 80: sixel scrolling mode */
-
#define N_MARGINBELL 10
#define TAB_BITS_SHIFT 5 /* FIXME: 2**5 == 32 (should derive) */
@@ -2647,6 +2692,8 @@ typedef unsigned Tabs [TAB_ARRAY_SIZE];
typedef struct _XtermWidgetRec {
CorePart core;
XSizeHints hints;
+ XVisualInfo *visInfo;
+ int numVisuals;
Bool init_menu;
TKeyboard keyboard; /* terminal keyboard */
TScreen screen; /* terminal screen */
diff --git a/app/xterm/resize.c b/app/xterm/resize.c
index 987000e7e..81255a20f 100644
--- a/app/xterm/resize.c
+++ b/app/xterm/resize.c
@@ -1,7 +1,7 @@
-/* $XTermId: resize.c,v 1.129 2013/01/06 19:42:20 tom Exp $ */
+/* $XTermId: resize.c,v 1.130 2014/04/25 23:39:42 tom Exp $ */
/*
- * Copyright 2003-2012,2013 by Thomas E. Dickey
+ * Copyright 2003-2013,2014 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -551,7 +551,7 @@ main(int argc, char **argv ENVP_ARG)
exit(EXIT_FAILURE);
}
- i = ptr - termcap + 3;
+ i = (int) (ptr - termcap) + 3;
strncpy(newtc, termcap, (size_t) i);
sprintf(newtc + i, "%d", cols);
ptr = strchr(ptr, ':');
@@ -563,7 +563,7 @@ main(int argc, char **argv ENVP_ARG)
exit(EXIT_FAILURE);
}
- i = ptr - newtc + 3;
+ i = (int) (ptr - newtc) + 3;
strncpy(termcap, newtc, (size_t) i);
sprintf(termcap + i, "%d", rows);
ptr = strchr(ptr, ':');
diff --git a/app/xterm/screen.c b/app/xterm/screen.c
index dbc6c7181..bb7df742b 100644
--- a/app/xterm/screen.c
+++ b/app/xterm/screen.c
@@ -1,7 +1,7 @@
-/* $XTermId: screen.c,v 1.487 2013/08/14 23:22:53 tom Exp $ */
+/* $XTermId: screen.c,v 1.488 2014/05/03 19:32:51 tom Exp $ */
/*
- * Copyright 1999-2012,2013 by Thomas E. Dickey
+ * Copyright 1999-2013,2014 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -71,10 +71,6 @@
#include <assert.h>
#include <signal.h>
-#ifndef _Xconst
-#define _Xconst const /* Solaris 7 workaround */
-#endif /* _Xconst */
-
#include <graphics.h>
#define inSaveBuf(screen, buf, inx) \
@@ -2311,7 +2307,7 @@ limitedParseCol(XtermWidget xw, int col)
* needed.
*/
void
-xtermParseRect(XtermWidget xw, int nparams, int *params, XTermRect * target)
+xtermParseRect(XtermWidget xw, int nparams, int *params, XTermRect *target)
{
TScreen *screen = TScreenOf(xw);
@@ -2328,7 +2324,7 @@ xtermParseRect(XtermWidget xw, int nparams, int *params, XTermRect * target)
}
static Bool
-validRect(XtermWidget xw, XTermRect * target)
+validRect(XtermWidget xw, XTermRect *target)
{
TScreen *screen = TScreenOf(xw);
@@ -2350,7 +2346,7 @@ validRect(XtermWidget xw, XTermRect * target)
*/
void
ScrnFillRectangle(XtermWidget xw,
- XTermRect * target,
+ XTermRect *target,
int value,
unsigned flags,
Bool keepColors)
@@ -2425,7 +2421,7 @@ ScrnFillRectangle(XtermWidget xw,
* the target from that.
*/
void
-ScrnCopyRectangle(XtermWidget xw, XTermRect * source, int nparam, int *params)
+ScrnCopyRectangle(XtermWidget xw, XTermRect *source, int nparam, int *params)
{
TScreen *screen = TScreenOf(xw);
@@ -2518,7 +2514,7 @@ ScrnCopyRectangle(XtermWidget xw, XTermRect * source, int nparam, int *params)
*/
void
ScrnMarkRectangle(XtermWidget xw,
- XTermRect * target,
+ XTermRect *target,
Bool reverse,
int nparam,
int *params)
@@ -2639,7 +2635,7 @@ ScrnMarkRectangle(XtermWidget xw,
*/
void
ScrnWipeRectangle(XtermWidget xw,
- XTermRect * target)
+ XTermRect *target)
{
TScreen *screen = TScreenOf(xw);
diff --git a/app/xterm/trace.c b/app/xterm/trace.c
index 423f7fbe3..590d98832 100644
--- a/app/xterm/trace.c
+++ b/app/xterm/trace.c
@@ -1,7 +1,7 @@
-/* $XTermId: trace.c,v 1.153 2013/11/26 22:41:44 tom Exp $ */
+/* $XTermId: trace.c,v 1.155 2014/04/25 21:30:23 Ross.Combs Exp $ */
/*
- * Copyright 1997-2012,2013 by Thomas E. Dickey
+ * Copyright 1997-2013,2014 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -46,6 +46,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
+#include <sys/stat.h>
#include <stdio.h>
#include <stdarg.h>
#include <assert.h>
@@ -86,7 +87,7 @@ Trace(const char *fmt,...)
trace_out = trace_who;
if (!trace_fp) {
- unsigned oldmask = umask(077);
+ unsigned oldmask = (unsigned) umask(077);
char name[BUFSIZ];
#if 0 /* usually I do not want unique names */
int unique;
@@ -917,6 +918,9 @@ TraceXtermResources(void)
XRES_B(ptyHandshake);
XRES_B(ptySttySize);
#endif
+#if OPT_REPORT_COLORS
+ XRES_B(reportColors);
+#endif
#if OPT_REPORT_FONTS
XRES_B(reportFonts);
#endif
diff --git a/app/xterm/util.c b/app/xterm/util.c
index 3b4249dcd..da8d2e4e3 100644
--- a/app/xterm/util.c
+++ b/app/xterm/util.c
@@ -1,4 +1,4 @@
-/* $XTermId: util.c,v 1.620 2014/01/15 02:02:14 tom Exp $ */
+/* $XTermId: util.c,v 1.624 2014/05/02 20:24:05 tom Exp $ */
/*
* Copyright 1999-2013,2014 by Thomas E. Dickey
@@ -1384,7 +1384,7 @@ InsertChar(XtermWidget xw, unsigned n)
ClearCurBackground(xw,
INX2ROW(screen, screen->cur_row),
screen->cur_col,
- 1,
+ 1U,
n,
(unsigned) LineFontWidth(screen, ld));
}
@@ -1453,7 +1453,7 @@ DeleteChar(XtermWidget xw, unsigned n)
ClearCurBackground(xw,
INX2ROW(screen, screen->cur_row),
col,
- 1,
+ 1U,
n,
(unsigned) LineFontWidth(screen, ld));
}
@@ -1628,7 +1628,7 @@ ClearInLine2(XtermWidget xw, int flags, int row, int col, unsigned len)
ClearCurBackground(xw,
INX2ROW(screen, row),
col,
- 1,
+ 1U,
len,
(unsigned) LineFontWidth(screen, ld));
}
@@ -1756,6 +1756,8 @@ ClearScreen(XtermWidget xw)
TScreen *screen = TScreenOf(xw);
int top;
+ TRACE(("ClearScreen\n"));
+
if (screen->cursor_state)
HideCursor();
@@ -2094,7 +2096,7 @@ scrolling_copy_area(XtermWidget xw,
* Returns 1 iff the area where the cursor was got refreshed.
*/
int
-HandleExposure(XtermWidget xw, XEvent * event)
+HandleExposure(XtermWidget xw, XEvent *event)
{
TScreen *screen = TScreenOf(xw);
XExposeEvent *reply = (XExposeEvent *) event;
@@ -2519,7 +2521,7 @@ reallySwapColors(XtermWidget xw, ToSwap * list, int count)
}
static void
-swapVTwinGCs(XtermWidget xw, VTwin * win)
+swapVTwinGCs(XtermWidget xw, VTwin *win)
{
swapCgs(xw, win, gcNorm, gcNormReverse);
swapCgs(xw, win, gcBold, gcBoldReverse);
@@ -2598,7 +2600,7 @@ ReverseVideo(XtermWidget xw)
TekRepaint(tekWidget);
}
#endif
- ReverseOldColors();
+ ReverseOldColors(xw);
set_cursor_gcs(xw);
update_reversevideo();
TRACE(("...ReverseVideo\n"));
@@ -2772,8 +2774,8 @@ getNormXftFont(XtermWidget xw,
static int
xtermXftDrawString(XtermWidget xw,
unsigned flags GCC_UNUSED,
- XftColor * color,
- XftFont * font,
+ XftColor *color,
+ XftFont *font,
int x,
int y,
IChar *text,
@@ -3130,8 +3132,8 @@ xtermSetClipRectangles(Display *dpy,
static int
drawClippedXftString(XtermWidget xw,
unsigned flags,
- XftFont * font,
- XftColor * fg_color,
+ XftFont *font,
+ XftColor *fg_color,
int x,
int y,
IChar *text,
@@ -3932,7 +3934,7 @@ drawXtermText(XtermWidget xw,
* Allocate buffer - workaround for wide-character interfaces.
*/
void
-allocXtermChars(ScrnPtr * buffer, Cardinal length)
+allocXtermChars(ScrnPtr *buffer, Cardinal length)
{
if (*buffer == 0) {
*buffer = (ScrnPtr) XtMalloc(length);
@@ -4531,7 +4533,7 @@ decode_wcwidth(XtermWidget xw)
* which will be mapped into true/false.
*/
int
-extendedBoolean(const char *value, FlagList * table, Cardinal limit)
+extendedBoolean(const char *value, const FlagList * table, Cardinal limit)
{
int result = -1;
long check;
diff --git a/app/xterm/version.h b/app/xterm/version.h
index 87a8914bb..2ad4bb6ff 100644
--- a/app/xterm/version.h
+++ b/app/xterm/version.h
@@ -1,4 +1,4 @@
-/* $XTermId: version.h,v 1.378 2014/01/19 20:58:11 tom Exp $ */
+/* $XTermId: version.h,v 1.385 2014/05/03 21:00:49 tom Exp $ */
/*
* Copyright 1998-2013,2014 by Thomas E. Dickey
@@ -38,8 +38,8 @@
* version of X to which this version of xterm has been built. The resulting
* number in parentheses is my patch number (Thomas E. Dickey).
*/
-#define XTERM_PATCH 301
-#define XTERM_DATE 2014-01-19
+#define XTERM_PATCH 304
+#define XTERM_DATE 2014-05-03
#ifndef __vendorversion__
#define __vendorversion__ "XTerm/OpenBSD"
diff --git a/app/xterm/vttests/256colors.pl b/app/xterm/vttests/256colors.pl
index 57976f7cf..a03736819 100644
--- a/app/xterm/vttests/256colors.pl
+++ b/app/xterm/vttests/256colors.pl
@@ -1,9 +1,9 @@
-#!/usr/bin/perl
-# $XTermId: 256colors.pl,v 1.4 2006/09/29 21:49:03 tom Exp $
+#!/usr/bin/env perl
+# $XTermId: 256colors.pl,v 1.5 2014/02/26 20:16:12 tom Exp $
# -----------------------------------------------------------------------------
# this file is part of xterm
#
-# Copyright 1999,2006 by Thomas E. Dickey
+# Copyright 1999-2006,2014 by Thomas E. Dickey
#
# All Rights Reserved
#
@@ -31,10 +31,15 @@
# sale, use or other dealings in this Software without prior written
# authorization.
# -----------------------------------------------------------------------------
-#
+
+use strict;
+use warnings;
+
# 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.
+our ($bg, $fg);
+
for ($bg = 0; $bg < 256; $bg++) {
# print "\x1b[9;1H\x1b[2J";
for ($fg = 0; $fg < 256; $fg++) {
diff --git a/app/xterm/vttests/256colors2.pl b/app/xterm/vttests/256colors2.pl
index af8d5b7d0..f0360ecc2 100644
--- a/app/xterm/vttests/256colors2.pl
+++ b/app/xterm/vttests/256colors2.pl
@@ -1,9 +1,9 @@
-#!/usr/bin/perl
-# $XTermId: 256colors2.pl,v 1.15 2012/09/19 23:32:48 tom Exp $
+#!/usr/bin/env perl
+# $XTermId: 256colors2.pl,v 1.16 2014/02/26 20:21:48 tom Exp $
# -----------------------------------------------------------------------------
# this file is part of xterm
#
-# Copyright 1999-2009,2012 by Thomas E. Dickey
+# Copyright 1999-2012,2014 by Thomas E. Dickey
# Copyright 2002 by Steve Wall
# Copyright 1999 by Todd Larason
#
@@ -39,6 +39,7 @@
# pleasing shades
use strict;
+use warnings;
use Getopt::Std;
use Encode 'encode_utf8';
@@ -128,9 +129,9 @@ for ($red = 0; $red < $cube; $red++) {
for ($blue = 0; $blue < $cube; $blue++) {
&define_color(
16 + (map_cube($red) * $cube * $cube) + (map_cube($green) * $cube) + map_cube($blue),
- int (@steps[$red]),
- int (@steps[$green]),
- int (@steps[$blue]));
+ int ($steps[$red]),
+ int ($steps[$green]),
+ int ($steps[$blue]));
}
}
}
diff --git a/app/xterm/vttests/88colors.pl b/app/xterm/vttests/88colors.pl
index 3db178c3f..efade5698 100644
--- a/app/xterm/vttests/88colors.pl
+++ b/app/xterm/vttests/88colors.pl
@@ -1,9 +1,9 @@
-#!/usr/bin/perl
-# $XTermId: 88colors.pl,v 1.3 1999/09/27 20:12:18 tom Exp $
+#!/usr/bin/env perl
+# $XTermId: 88colors.pl,v 1.4 2014/02/26 20:16:26 tom Exp $
# -----------------------------------------------------------------------------
# this file is part of xterm
#
-# Copyright 1999 by Thomas E. Dickey
+# Copyright 1999,2014 by Thomas E. Dickey
#
# All Rights Reserved
#
@@ -33,6 +33,11 @@
# -----------------------------------------------------------------------------
# Made from 256colors.pl
+use strict;
+use warnings;
+
+our ($bg, $fg);
+
for ($bg = 0; $bg < 88; $bg++) {
print "\x1b[9;1H\x1b[48;5;${bg}m\x1b[2J";
for ($fg = 0; $fg < 88; $fg++) {
diff --git a/app/xterm/vttests/88colors2.pl b/app/xterm/vttests/88colors2.pl
index a96747fc2..eb0d9b1f8 100644
--- a/app/xterm/vttests/88colors2.pl
+++ b/app/xterm/vttests/88colors2.pl
@@ -1,9 +1,9 @@
-#!/usr/bin/perl
-# $XTermId: 88colors2.pl,v 1.11 2012/09/19 23:31:56 tom Exp $
+#!/usr/bin/env perl
+# $XTermId: 88colors2.pl,v 1.12 2014/02/26 20:16:53 tom Exp $
# -----------------------------------------------------------------------------
# this file is part of xterm
#
-# Copyright 1999-2009,2012 by Thomas E. Dickey
+# Copyright 1999-2012,2014 by Thomas E. Dickey
# Copyright 1999 by Steve Wall
#
# All Rights Reserved
@@ -40,6 +40,7 @@
# pleasing shades
use strict;
+use warnings;
use Getopt::Std;
use Encode 'encode_utf8';
@@ -129,9 +130,9 @@ for ($red = 0; $red < $cube; $red++) {
for ($blue = 0; $blue < $cube; $blue++) {
&define_color(
16 + (map_cube($red) * $cube * $cube) + (map_cube($green) * $cube) + map_cube($blue),
- int (@steps[$red]),
- int (@steps[$green]),
- int (@steps[$blue]));
+ int ($steps[$red]),
+ int ($steps[$green]),
+ int ($steps[$blue]));
}
}
}
diff --git a/app/xterm/vttests/dynamic.pl b/app/xterm/vttests/dynamic.pl
index a7f4d5733..5932abf49 100644
--- a/app/xterm/vttests/dynamic.pl
+++ b/app/xterm/vttests/dynamic.pl
@@ -1,9 +1,9 @@
-#!/usr/bin/perl -w
-# $XTermId: dynamic.pl,v 1.2 2011/07/05 09:32:53 tom Exp $
+#!/usr/bin/env perl
+# $XTermId: dynamic.pl,v 1.3 2014/02/26 20:17:07 tom Exp $
# -----------------------------------------------------------------------------
# this file is part of xterm
#
-# Copyright 2011 by Thomas E. Dickey
+# Copyright 2011,2014 by Thomas E. Dickey
#
# All Rights Reserved
#
@@ -35,6 +35,7 @@
# The programs xtermcontrol and xtermset provide more options.
use strict;
+use warnings;
use Getopt::Std;
use IO::Handle;
diff --git a/app/xterm/vttests/paste64.pl b/app/xterm/vttests/paste64.pl
index 619a2225c..152bcff21 100644
--- a/app/xterm/vttests/paste64.pl
+++ b/app/xterm/vttests/paste64.pl
@@ -1,9 +1,9 @@
-#!/usr/bin/perl -w
-# $XTermId: paste64.pl,v 1.10 2006/03/13 01:28:02 tom Exp $
+#!/usr/bin/env perl
+# $XTermId: paste64.pl,v 1.11 2014/02/26 20:14:32 tom Exp $
# -----------------------------------------------------------------------------
# this file is part of xterm
#
-# Copyright 2006 by Thomas E. Dickey
+# Copyright 2006,2014 by Thomas E. Dickey
#
# All Rights Reserved
#
@@ -34,6 +34,8 @@
# Test the paste64 option of xterm.
use strict;
+use warnings;
+
use Term::ReadKey;
use IO::Handle;
diff --git a/app/xterm/vttests/query-color.pl b/app/xterm/vttests/query-color.pl
index be3d495bd..38e9a350b 100644
--- a/app/xterm/vttests/query-color.pl
+++ b/app/xterm/vttests/query-color.pl
@@ -1,9 +1,9 @@
-#!/usr/bin/perl -w
-# $XTermId: query-color.pl,v 1.3 2012/10/22 11:45:58 tom Exp $
+#!/usr/bin/env perl
+# $XTermId: query-color.pl,v 1.4 2014/02/26 20:14:40 tom Exp $
# -----------------------------------------------------------------------------
# this file is part of xterm
#
-# Copyright 2012 by Thomas E. Dickey
+# Copyright 2012,2014 by Thomas E. Dickey
#
# All Rights Reserved
#
@@ -37,6 +37,7 @@
# TODO: show result in #rrggbb format.
use strict;
+use warnings;
use Getopt::Std;
use IO::Handle;
diff --git a/app/xterm/vttests/query-fonts.pl b/app/xterm/vttests/query-fonts.pl
index 2b86c0748..526055cd5 100644
--- a/app/xterm/vttests/query-fonts.pl
+++ b/app/xterm/vttests/query-fonts.pl
@@ -1,9 +1,9 @@
-#!/usr/bin/perl -w
-# $XTermId: query-fonts.pl,v 1.5 2010/05/24 09:01:30 tom Exp $
+#!/usr/bin/env perl
+# $XTermId: query-fonts.pl,v 1.6 2014/02/26 20:14:50 tom Exp $
# -----------------------------------------------------------------------------
# this file is part of xterm
#
-# Copyright 2010 by Thomas E. Dickey
+# Copyright 2010,2014 by Thomas E. Dickey
#
# All Rights Reserved
#
@@ -42,6 +42,7 @@
# extend "CSI > Ps; Ps T" to query fontname in hex
use strict;
+use warnings;
use Getopt::Std;
use IO::Handle;
diff --git a/app/xterm/vttests/resize.pl b/app/xterm/vttests/resize.pl
index 29d0d9b8e..07c2ab546 100644
--- a/app/xterm/vttests/resize.pl
+++ b/app/xterm/vttests/resize.pl
@@ -1,9 +1,9 @@
-#!/usr/bin/perl
-# $XTermId: resize.pl,v 1.3 2004/03/04 02:21:58 tom Exp $
+#!/usr/bin/env perl
+# $XTermId: resize.pl,v 1.4 2014/02/26 20:20:29 tom Exp $
# -----------------------------------------------------------------------------
# this file is part of xterm
#
-# Copyright 2004 by Thomas E. Dickey
+# Copyright 2004,2014 by Thomas E. Dickey
#
# All Rights Reserved
#
@@ -34,6 +34,9 @@
# resize.sh rewritten into Perl for comparison.
# See also Term::ReadKey.
+use strict;
+use warnings;
+
use IO::Handle;
sub write_tty {
@@ -46,7 +49,7 @@ sub write_tty {
sub get_reply {
open TTY, "+</dev/tty" or die("Cannot open /dev/tty\n");
autoflush TTY 1;
- $old=`stty -g`;
+ my $old=`stty -g`;
system "stty raw -echo min 0 time 5";
print TTY @_;
@@ -57,8 +60,8 @@ sub get_reply {
}
sub csi_field {
- my $first = @_[0];
- my $second = @_[1];
+ my $first = $_[0];
+ my $second = $_[1];
$first =~ s/^[^0-9]+//;
while ( --$second > 0 ) {
$first =~ s/^[\d]+//;
@@ -68,7 +71,10 @@ sub csi_field {
return $first;
}
-$original=get_reply("\x1b[18t");
+our $original=get_reply("\x1b[18t");
+our $high;
+our $wide;
+
if ( $original =~ /\x1b\[8;\d+;\d+t/ ) {
$high=csi_field($original,2);
$wide=csi_field($original,3);
@@ -77,7 +83,10 @@ if ( $original =~ /\x1b\[8;\d+;\d+t/ ) {
die "Cannot get terminal size via escape sequence\n";
}
#
-$maximize=get_reply("\x1b[19t");
+our $maximize=get_reply("\x1b[19t");
+our $maxhigh;
+our $maxwide;
+
if ( $maximize =~ /\x1b\[9;\d+;\d+t/ ) {
$maxhigh=csi_field($maximize,2);
$maxwide=csi_field($maximize,3);
@@ -88,6 +97,9 @@ if ( $maximize =~ /\x1b\[9;\d+;\d+t/ ) {
die "Cannot get terminal size via escape sequence\n";
}
+our $zapped;
+our ( $w, $h, $a );
+
sub catch_zap {
$zapped++;
}
diff --git a/app/xterm/vttests/tcapquery.pl b/app/xterm/vttests/tcapquery.pl
index 068cb2219..dce8b098c 100644
--- a/app/xterm/vttests/tcapquery.pl
+++ b/app/xterm/vttests/tcapquery.pl
@@ -1,9 +1,9 @@
-#!/usr/bin/perl -w
-# $XTermId: tcapquery.pl,v 1.18 2010/01/04 09:43:46 tom Exp $
+#!/usr/bin/env perl
+# $XTermId: tcapquery.pl,v 1.19 2014/02/26 20:15:12 tom Exp $
# -----------------------------------------------------------------------------
# this file is part of xterm
#
-# Copyright 2004-2008,2010 by Thomas E. Dickey
+# Copyright 2004-2010,2014 by Thomas E. Dickey
#
# All Rights Reserved
#
@@ -34,6 +34,7 @@
# Test the tcap-query option of xterm.
use strict;
+use warnings;
use Getopt::Std;
use IO::Handle;
diff --git a/app/xterm/xstrings.c b/app/xterm/xstrings.c
index 0f2f158d8..0a6133107 100644
--- a/app/xterm/xstrings.c
+++ b/app/xterm/xstrings.c
@@ -1,7 +1,7 @@
-/* $XTermId: xstrings.c,v 1.58 2013/11/18 01:40:43 tom Exp $ */
+/* $XTermId: xstrings.c,v 1.60 2014/05/03 12:46:53 tom Exp $ */
/*
- * Copyright 2000-2012,2013 by Thomas E. Dickey
+ * Copyright 2000-2013,2014 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -289,7 +289,7 @@ x_nonempty(String s)
String
x_skip_blanks(String s)
{
- while (isspace(CharOf(*s)))
+ while (IsSpace(CharOf(*s)))
++s;
return s;
}
@@ -297,7 +297,7 @@ x_skip_blanks(String s)
String
x_skip_nonblanks(String s)
{
- while (*s != '\0' && !isspace(CharOf(*s)))
+ while (*s != '\0' && !IsSpace(CharOf(*s)))
++s;
return s;
}
@@ -305,7 +305,7 @@ x_skip_nonblanks(String s)
static const char *
skip_blanks(const char *s)
{
- while (isspace(CharOf(*s)))
+ while (IsSpace(CharOf(*s)))
++s;
return s;
}
@@ -331,7 +331,7 @@ x_splitargs(const char *command)
for (n = count = 0, state = 0; first[n] != '\0'; ++n) {
switch (state) {
case 0:
- if (!isspace(CharOf(first[n]))) {
+ if (!IsSpace(CharOf(first[n]))) {
state = 1;
if (pass)
result[count] = blob + n;
@@ -341,7 +341,7 @@ x_splitargs(const char *command)
}
break;
case 1:
- if (isspace(CharOf(first[n]))) {
+ if (IsSpace(CharOf(first[n]))) {
blob[n] = '\0';
state = 0;
}
@@ -454,14 +454,14 @@ x_strtrim(const char *source)
if (t != 0) {
s = t;
d = s;
- while (isspace(CharOf(*s)))
+ while (IsSpace(CharOf(*s)))
++s;
while ((*d++ = *s++) != '\0') {
;
}
if (*t != '\0') {
s = t + strlen(t);
- while (s != t && isspace(CharOf(s[-1]))) {
+ while (s != t && IsSpace(CharOf(s[-1]))) {
*--s = '\0';
}
}
diff --git a/app/xterm/xterm.h b/app/xterm/xterm.h
index 240f7bc04..961d08ef4 100644
--- a/app/xterm/xterm.h
+++ b/app/xterm/xterm.h
@@ -1,4 +1,4 @@
-/* $XTermId: xterm.h,v 1.727 2014/01/16 19:34:54 tom Exp $ */
+/* $XTermId: xterm.h,v 1.737 2014/05/03 19:30:17 tom Exp $ */
/*
* Copyright 1999-2013,2014 by Thomas E. Dickey
@@ -103,6 +103,17 @@
#define USE_POSIX_TERMIOS 1
#endif
+#ifdef __FreeBSD__
+#if __FreeBSD_version >= 900000
+#define USE_SYSV_UTMP 1
+#define UTMPX_FOR_UTMP 1
+#define HAVE_UTMP_UT_HOST 1
+#define HAVE_UTMP_UT_XTIME 1
+#define ut_name ut_user
+#define ut_xtime ut_tv.tv_sec
+#endif
+#endif
+
#ifdef __NetBSD__
#if __NetBSD_Version__ >= 106030000 /* 1.6C */
#define BSD_UTMPX 1
@@ -139,11 +150,11 @@
#define HAVE_UTMP_UT_HOST 1
#endif
-#if defined(UTMPX_FOR_UTMP) && !(defined(__MVS__) || defined(__hpux))
+#if defined(UTMPX_FOR_UTMP) && !(defined(__MVS__) || defined(__hpux) || defined(__FreeBSD__))
#define HAVE_UTMP_UT_SESSION 1
#endif
-#if !(defined(linux) && (!defined(__GLIBC__) || (__GLIBC__ < 2))) && !defined(SVR4)
+#if !(defined(linux) && (!defined(__GLIBC__) || (__GLIBC__ < 2))) && !defined(SVR4) && !defined(__FreeBSD__)
#define ut_xstatus ut_exit.e_exit
#endif
@@ -158,6 +169,7 @@
#elif defined(BSD) && (BSD >= 199103)
#ifdef BSD_UTMPX
#define USE_LASTLOGX
+#elif defined(USE_SYSV_UTMP)
#else
#define USE_LASTLOG
#define USE_STRUCT_LASTLOG
@@ -349,6 +361,10 @@ extern int errno;
extern char **environ;
#endif
+#ifndef _Xconst
+#define _Xconst const /* Solaris 7 workaround */
+#endif /* _Xconst */
+
#define XK_Fn(n) (XK_F1 + (n) - 1)
#define Maybe 2
@@ -477,6 +493,7 @@ extern char **environ;
#define XtNmultiClickTime "multiClickTime"
#define XtNmultiScroll "multiScroll"
#define XtNnMarginBell "nMarginBell"
+#define XtNnumColorRegisters "numColorRegisters"
#define XtNnumLock "numLock"
#define XtNoldXtermFKeys "oldXtermFKeys"
#define XtNpointerColor "pointerColor"
@@ -514,6 +531,7 @@ extern char **environ;
#define XtNshowWrapMarks "showWrapMarks"
#define XtNsignalInhibit "signalInhibit"
#define XtNsixelScrolling "sixelScrolling"
+#define XtNsixelScrollsRight "sixelScrollsRight"
#define XtNtekGeometry "tekGeometry"
#define XtNtekInhibit "tekInhibit"
#define XtNtekSmall "tekSmall"
@@ -655,6 +673,7 @@ extern char **environ;
#define XtCModifyStringKeys "ModifyStringKeys"
#define XtCMultiClickTime "MultiClickTime"
#define XtCMultiScroll "MultiScroll"
+#define XtCNumColorRegisters "NumColorRegisters"
#define XtCNumLock "NumLock"
#define XtCOldXtermFKeys "OldXtermFKeys"
#define XtCPointerMode "PointerMode"
@@ -688,6 +707,7 @@ extern char **environ;
#define XtCShowWrapMarks "ShowWrapMarks"
#define XtCSignalInhibit "SignalInhibit"
#define XtCSixelScrolling "SixelScrolling"
+#define XtCSixelScrollsRight "SixelScrollsRight"
#define XtCTekInhibit "TekInhibit"
#define XtCTekSmall "TekSmall"
#define XtCTekStartup "TekStartup"
@@ -1002,16 +1022,18 @@ extern Window WMFrameWindow (XtermWidget /* termw */);
extern XtInputMask xtermAppPending (void);
extern XrmOptionDescRec * sortedOptDescs (XrmOptionDescRec *, Cardinal);
extern XtermWidget getXtermWidget (Widget /* w */);
-extern char *udk_lookup (int /* keycode */, int * /* len */);
+extern char *udk_lookup (XtermWidget /* xw */, int /* keycode */, int * /* len */);
extern char *xtermEnvEncoding (void);
extern char *xtermFindShell (char * /* leaf */, Bool /* warning */);
extern const char *SysErrorMsg (int /* n */);
extern const char *SysReasonMsg (int /* n */);
extern Boolean allocateBestRGB(XtermWidget /* xw */, XColor * /* def */);
+extern Boolean validProgram(const char * /* pathname */);
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 */, unsigned /* mode */);
extern int getVisualDepth (XtermWidget /* xw */);
+extern int getVisualInfo (XtermWidget /* xw */);
extern int open_userfile (uid_t /* uid */, gid_t /* gid */, char * /* path */, Bool /* append */);
extern int xerror (Display * /* d */, XErrorEvent * /* ev */);
extern int xioerror (Display * /* dpy */);
@@ -1035,7 +1057,7 @@ extern void HandleStringEvent PROTO_XT_ACTIONS_ARGS;
extern void NormalExit (void);
extern void Panic (const char * /* s */, int /* a */);
extern void Redraw (void);
-extern void ReverseOldColors (void);
+extern void ReverseOldColors (XtermWidget /* xw */);
extern void SysError (int /* i */) GCC_NORETURN;
extern void VisualBell (void);
extern void cleanup_colored_cursor (void);
@@ -1050,7 +1072,7 @@ extern void hide_tek_window (void);
extern void hide_vt_window (void);
extern void ice_error (IceConn /* iceConn */);
extern void init_colored_cursor (void);
-extern void reset_decudk (void);
+extern void reset_decudk (XtermWidget /* xw */);
extern void set_tek_visibility (Bool /* on */);
extern void set_vt_visibility (Bool /* on */);
extern void switch_modes (Bool /* tovt */);
@@ -1314,7 +1336,7 @@ extern int ClearInLine (XtermWidget /* xw */, int /* row */, int /* col */, unsi
extern int HandleExposure (XtermWidget /* xw */, XEvent * /* event */);
extern int dimRound (double /* value */);
extern int drawXtermText (XtermWidget /* xw */, unsigned /* flags */, GC /* gc */, int /* x */, int /* y */, int /* chrset */, IChar * /* text */, Cardinal /* len */, int /* on_wide */);
-extern int extendedBoolean(const char * /* value */, FlagList * /* table */, Cardinal /* limit */);
+extern int extendedBoolean(const char * /* value */, const FlagList * /* table */, Cardinal /* limit */);
extern void ChangeColors (XtermWidget /* xw */, ScrnColors * /* pNew */);
extern void ClearRight (XtermWidget /* xw */, int /* n */);
extern void ClearScreen (XtermWidget /* xw */);
@@ -1415,12 +1437,12 @@ extern Pixel xtermGetColorRes(XtermWidget /* xw */, ColorRes * /* res */);
VDrawable(TScreenOf(xw)), \
CursorX2(TScreenOf(xw), left, fw), \
CursorY(TScreenOf(xw), top), \
- width * fw, \
- height * FontHeight(TScreenOf(xw)), \
+ ((width) * (unsigned) fw), \
+ ((height) * (unsigned) FontHeight(TScreenOf(xw))), \
False)
-#define extract_fg(xw, color, flags) (xw)->cur_foreground
-#define extract_bg(xw, color, flags) (xw)->cur_background
+#define extract_fg(xw, color, flags) (unsigned) (xw)->cur_foreground
+#define extract_bg(xw, color, flags) (unsigned) (xw)->cur_background
/* FIXME: Reverse-Video? */
#define T_COLOR(v,n) (v)->Tcolors[n]
diff --git a/app/xterm/xterm.log.html b/app/xterm/xterm.log.html
index b0c0d2c78..f63243ea5 100644
--- a/app/xterm/xterm.log.html
+++ b/app/xterm/xterm.log.html
@@ -30,7 +30,7 @@
* sale, use or other dealings in this Software without prior written *
* authorization. *
*****************************************************************************
- $XTermId: xterm.log.html,v 1.1420 2014/01/19 20:57:30 tom Exp $
+ $XTermId: xterm.log.html,v 1.1457 2014/05/03 21:01:31 tom Exp $
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
@@ -43,6 +43,9 @@
<link rev="MADE" href="mailto:dickey@invisible-island.net">
<meta http-equiv="Content-Type" content=
"text/html; charset=us-ascii">
+ <meta name="keywords" content="xterm, change log">
+ <meta name="description" content=
+ "This is the xterm change-log, distributed with xterm, with items listed by patch-number and date">
<link rel="SHORTCUT ICON" href="/img/icons/xterm.ico" type=
"image/x-icon">
</head>
@@ -69,6 +72,12 @@
CHANGELOG</a>).</p>
<ul>
+ <li><a href="#xterm_304">Patch #304 - 2014/05/03</a></li>
+
+ <li><a href="#xterm_303">Patch #303 - 2014/03/06</a></li>
+
+ <li><a href="#xterm_302">Patch #302 - 2014/03/02</a></li>
+
<li><a href="#xterm_301">Patch #301 - 2014/01/19</a></li>
<li><a href="#xterm_300">Patch #300 - 2013/12/03</a></li>
@@ -884,6 +893,143 @@
<li><a href="#xterm_01">Patch #1 - 1996/1/6</a></li>
</ul>
+ <h1><a name="xterm_304" id="xterm_304">Patch #304 -
+ 2014/05/03</a></h1>
+
+ <ul>
+ <li>add debugging check for parsing table entries, fixed a few
+ inconsistencies.</li>
+
+ <li>handle utmp/utmpx strings consistently with new function
+ that null-pads unused locations.</li>
+
+ <li>build-fix for imake configuration with FreeBSD 9 and later,
+ to account for replacing <code>utmp</code> with
+ <code>utmpx</code>.</li>
+
+ <li>improve handling of the <code>fontsel</code>
+ (font-selection) menu item:
+
+ <ul>
+ <li>initialize the menu entry differently if the toolbar
+ configuration is used, i.e., enabling it without attempting
+ to use the current selection as a font name. Because of the
+ way in which the toolbar is setup, this attempt usually
+ failed, and would result in a warning.</li>
+
+ <li>if the menu action fails, e.g., no font can be loaded
+ for the given selected name, then recover by resuming with
+ the current font. Before, the recovery went to the default
+ font. That was done to work around missing bitmap font in
+ <a href="#xterm_276">patch #276</a>.</li>
+ </ul>
+ </li>
+
+ <li>document OSC&nbsp;119 in the control sequences listing
+ (report by Egmont Koblinger).</li>
+
+ <li>modify special handling of <code>XF86Paste</code> or
+ <code>SunPaste</code> keysyms (see <a href="#xterm_227">patch
+ #227</a>) to use the standard shift/lock modifiers in case
+ those are, for example, used in level 3 in an XKB file (patch
+ by Matthieu Herrb).</li>
+
+ <li>configure macro updates:
+
+ <ul>
+ <li>drop the <code>-no-gcc</code> option from
+ CF_INTEL_COMPILER</li>
+
+ <li>modify CF_XOPEN_SOURCE to suppress the check for
+ defining _XOPEN_SOURCE on Solaris</li>
+ </ul>
+ </li>
+
+ <li>reduce bss storage used for ReGIS/Sixel modules, as well as
+ cleanup storage usage in other modules.</li>
+
+ <li>initial changes for ReGIS support (patch by Ross Combs):
+
+ <ul>
+ <li>document control-sequences</li>
+
+ <li>separate ifdef's for sixel and color-register
+ features</li>
+
+ <li>add configuration for VT382</li>
+ </ul>
+ </li>
+ </ul>
+
+ <h1><a name="xterm_303" id="xterm_303">Patch #303 -
+ 2014/03/06</a></h1>
+
+ <ul>
+ <li>improve check for <code>/etc/shells</code> to allow its
+ entries to be symbolic links.</li>
+
+ <li>fix a regression in <a href="#xterm_302">patch #302</a>
+ fixes relating to interaction of <code>SHELL</code> and
+ <code>XTERM_SHELL</code> variables (Debian #740919).</li>
+
+ <li>improve manpage discussion of use of
+ <code>/etc/shells</code> for validating the <code>SHELL</code>
+ environment variable.</li>
+
+ <li>further improve the approximation for color map by ignoring
+ bits which would not be applied by the rgb masks for the
+ current visual (report by Joe Peterson).</li>
+
+ <li>add <code>-report-colors</code> to usage-message (report by
+ Joe Peterson).</li>
+ </ul>
+
+ <h1><a name="xterm_302" id="xterm_302">Patch #302 -
+ 2014/03/02</a></h1>
+
+ <ul>
+ <li>amend approximation for color map introduced in <a href=
+ "#xterm_277">patch #277</a> to make that apply only to
+ <code>TrueColor</code> (adapted from patch by Joe
+ Peterson).</li>
+
+ <li>add <code>-report-colors</code> option, to show colors as
+ they are allocated.</li>
+
+ <li>fix some gcc <code>-Wcast-qual</code> warnings.</li>
+
+ <li>correct app-defaults location for CentOS-4 in
+ xterm.spec</li>
+
+ <li>improve check in <code>minstall.sh</code> for X manpage's
+ section number; add sample dependencies for the relevant
+ documentation package to packaging test-scripts (prompted by
+ Novell #779474).</li>
+
+ <li>modify sample build-scripts for dpkg and rpm to ensure that
+ <code>vttests</code> scripts are uncompressed and
+ executable.</li>
+
+ <li>modify Perl scripts in <code>vttests</code> to use
+ <code>env</code> to find Perl rather than relying on
+ <code>/usr/bin/perl</code> This makes the sample scripts usable
+ with NetBSD and other systems using <em>pkgsrc</em>.</li>
+
+ <li>amend check from <a href="#xterm_301">patch #301</a> for
+ valid shell to permit existing <code>SHELL</code> value to
+ specify the shell; clarify the behavior in the manpage (report
+ by Emmanuel Thom&eacute;).</li>
+
+ <li>amend change to wide-character processing from <a href=
+ "#xterm_257">patch #257</a> to allow switching to/from UTF-8
+ encoding if the <code>utf8</code> resource was not set to
+ &ldquo;always&rdquo; (report by Honza Maly).</li>
+
+ <li>fix incorrect free from <a href="#xterm_301">patch #301</a>
+ changes, if explicit program without <code>-e</code> option is
+ a valid shell (patch by Romain Francoise).</li>
+ </ul>
+
<h1><a name="xterm_301" id="xterm_301">Patch #301 -
2014/01/19</a></h1>
diff --git a/app/xterm/xterm.man b/app/xterm/xterm.man
index 84515d9e1..c7040cabb 100644
--- a/app/xterm/xterm.man
+++ b/app/xterm/xterm.man
@@ -1,5 +1,5 @@
'\" t
-.\" $XTermId: xterm.man,v 1.576 2014/01/16 01:19:19 tom Exp $
+.\" $XTermId: xterm.man,v 1.581 2014/04/14 18:42:54 Ross.Combs Exp $
.\"
.\" Copyright 1996-2013,2014 by Thomas E. Dickey
.\"
@@ -123,21 +123,29 @@ autorepeat.
Double-size characters are displayed properly if your font server supports
scalable fonts.
The VT220 emulation does not support soft fonts, it is otherwise complete.
-.IR Termcap (5)
-entries that work with
-.I \*n
-include
+.PP
+Terminal database (\fIterminfo\fP (5) or \fItermcap\fP (5))
+entries that work with \fI\*n\fP include
+.IP
an optional platform-specific entry (\*(``__default_termname__\*(''),
+.br
\*(``xterm\*('',
+.br
\*(``vt102\*('',
+.br
\*(``vt100\*('',
+.br
\*(``ansi\*('' and
-\*(``dumb\*(''.
-.I \*n
-automatically searches the termcap file in this order for these entries and then
+.br
+\*(``dumb\*(''
+.PP
+\fI\*N\fP automatically searches the
+terminal database in this order for these entries and then
sets the \*(``TERM\*('' and the \*(``TERMCAP\*('' environment variables.
You may also use \*(``vt220\*('', but must set the terminal emulation level
with the \fBdecTerminalID\fP resource.
+On most systems, \fI\*n\fP will use the terminfo database.
+Some older systems use termcap.
(The \*(``TERMCAP\*('' environment variable is not set if \fI\*n\fP is linked
against a terminfo library, since the requisite information is not provided
by the termcap emulation of terminfo libraries).
@@ -200,11 +208,7 @@ When activated, the current screen is saved and replaced with the alternate
screen.
Saving of lines scrolled off the top of the window is disabled until the
normal screen is restored.
-The
-.IR termcap (5)
-entry for
-.I \*n
-allows the visual editor
+The usual terminal description for \fI\*n\fP allows the visual editor
.IR vi (1)
to switch to the alternate screen for editing and to restore the screen
on exit.
@@ -314,22 +318,42 @@ well with \fI\*n\fP.
This happens with the color (\fB\-fg\fP, \fB\-B\fP) and reverse (\fB\-rv\fP)
options.
\fI\*N\fP makes a special case of these and
-adjusts its sense of \*(``reverse\*(''
+adjusts its sense of \*(``reverse\*(''
to lessen user surprise.
.\" ***************************************************************************
.PP
One parameter (after all options) may be given.
-That overrides \fI\*n\fP's built-in choice of shell program.
-Normally \fI\*n\fP checks the \*(``SHELL\*('' variable.
-If that is not set, \fI\*n\fP tries to use the shell program specified
-in the password file.
-If that is not set, \fI\*n\fP uses \fI/bin/sh\fP.
+That overrides \fI\*n\fP's built-in choice of shell program:
+.bP
If the parameter is not a relative path, i.e.,
beginning with \*(``./\*('' or \*(``../\*('',
\fI\*n\fP looks for the file in the user's PATH.
-In either case, it constructs an absolute path.
+In either case, this check fails
+if \fI\*n\fP cannot construct an absolute path.
+.bP
+If that check fails (or if no such parameter is given),
+\fI\*n\fP next checks the \*(``SHELL\*('' variable.
+If that specifies an executable file,
+\fI\*n\fP will attempt to start that.
+However, \fI\*n\fP additionally checks if it is a valid shell,
+and will unset \*(``SHELL\*('' if it is not.
+.bP
+If \*(``SHELL\*('' is not set to an executable file,
+\fI\*n\fP tries to use the shell program specified
+in the user's password file entry.
+As before, \fI\*n\fP verifies if this is a valid shell.
+.bP
+Finally, if the password file entry does not specify a valid shell,
+\fI\*n\fP uses \fI/bin/sh\fP.
+.PP
The \fB\-e\fP option cannot be used with this parameter since
it uses all parameters following the option.
+.PP
+\fI\*N\fP validates shell programs by finding their pathname in
+the text file \fB/etc/shells\fP.
+It treats the environment variable \*(``SHELL\*('' specially because
+(like \*(``TERM\*(''), \fI\*n\fP both reads and updates the variable,
+and because the program started by \fI\*n\fP is not necessarily a shell.
.\" ***************************************************************************
.PP
The other options are used to control the appearance and behavior.
@@ -869,6 +893,11 @@ Control-G is received.
This option indicates that the window should not be raised whenever a
Control-G is received.
.TP 8
+.B \-report\-colors
+Print a report to the standard output showing information about colors
+as \fI\*n\fP allocates them.
+This corresponds to the \fBreportColors\fP resource.
+.TP 8
.B \-report\-fonts
Print a report to the standard output showing information about fonts
which are loaded.
@@ -998,17 +1027,24 @@ This option indicates that \fI\*n\fP should start in Tektronix mode, rather
than in VT102 mode.
Switching between the two windows is done using the
\*(``Options\*('' menus.
-.IR Termcap (5)
-entries that work with
-.I \*n
+.IP
+Terminal database (\fIterminfo\fP (5) or \fItermcap\fP (5))
+entries that work with \fI\*n\fR are:
+.IP
\*(``tek4014\*('',
+.br
\*(``tek4015\*('',
+.br
\*(``tek4012\*('',
+.br
\*(``tek4013\*('',
+.br
\*(``tek4010\*('', and
+.br
\*(``dumb\*(''.
+.IP
.I \*n
-automatically searches the termcap file in this order for these entries and then
+automatically searches the terminal database in this order for these entries and then
sets the \*(``TERM\*('' and the \*(``TERMCAP\*('' environment variables.
.TP 8
.B +t
@@ -1059,7 +1095,9 @@ This option sets the \fButf8\fP resource.
When \fButf8\fP is set, \fI\*n\fP interprets incoming data as UTF-8.
This sets the \fBwideChars\fP resource as a side-effect,
but the UTF-8 mode set by this option prevents it from being turned off.
-If you must turn it on and off, use the \fBwideChars\fP resource.
+If you must turn UTF-8 encoding on and off,
+use the \fB\-wc\fP option or the corresponding \fBwideChars\fP resource,
+rather than the \fB\-u8\fP option.
.IP
This option and the \fButf8\fR resource are overridden by
the \fB\-lc\fP and \fB\-en\fP options and \fBlocale\fR resource.
@@ -1117,10 +1155,15 @@ This option indicates that a visual bell should not be used.
.TP 8
.B \-wc
This option sets the \fBwideChars\fP resource.
-When \fBwideChars\fP is set, \fI\*n\fP maintains internal structures for 16-bit
-characters.
-If you do not set this resource to \*(``true\*('',
-\fI\*n\fP will ignore the escape sequence which turns UTF-8 mode on and off.
+.IP
+When \fBwideChars\fP is set,
+\fI\*n\fP maintains internal structures for 16-bit characters.
+If \fI\*n\fP is not started in UTF-8 mode (or if this resource is not set),
+initially it maintains those structures to support 8-bit characters.
+\fI\*N\fP can later be switched,
+using a menu entry or control sequence,
+causing it to reallocate those structures to support 16-bit characters.
+.IP
The default is \*(``false\*(''.
.TP 8
.B +wc
@@ -1964,7 +2007,7 @@ If \*(``true\*('', this enables a special case in bitmap fonts to
allow the font server to choose how to display missing glyphs.
The default is \*(``true\*(''.
.IP
-The reason for this resource is to help with
+The reason for this resource is to help with
certain quasi-automatically generated fonts
(such as the ISO-10646-1 encoding of Terminus)
which have incorrect font-metrics.
@@ -5002,11 +5045,11 @@ Sixel Scrolling (sixelScrolling)
When enabled,
sixel graphics are positioned at the current text cursor location, scroll
the image vertically if larger than the screen, and leave the text cursor
-after the image when returning to text mode.
+at the start of the next complete line after the image when returning to text
+mode (this is the default).
When disabled,
sixel graphics are positioned at the upper left of the screen, are
-cropped to fit the screen, and do not affect the text cursor location
-(this is the default).
+cropped to fit the screen, and do not affect the text cursor location.
This corresponds to the
.B sixelScrolling
resource.
@@ -6394,8 +6437,13 @@ is the display name,
pointing to the X server (see \fBDISPLAY NAMES\fP in X(__miscmansuffix__)).
.TP 5
TERM
-is set according to the termcap (or terminfo) entry which it is using as
+is set according to the terminfo (or termcap) entry which it is using as
a reference.
+.IP
+On some systems, you may encounter situations where the shell which you
+use and \fI\*n\fP are built using libraries with different terminal databases.
+In that situation, \fI\*n\fP may choose a terminal description not known
+to the shell.
.TP 5
WINDOWID
is set to the X window id number of the \fI\*n\fP window.
@@ -6440,7 +6488,14 @@ when \fI\*n\fP is configured to update utmp.
.TP 5
SHELL
when \fI\*n\fP is configured to update utmp.
-It is also set if you provide the shell name as the optional parameter.
+It is also set if you provide a valid shell name as the optional parameter.
+.IP
+\fI\*N\fP sets this to an absolute pathname.
+If you have set the variable to a relative pathname,
+\fI\*n\fP may set it to a different shell pathname.
+.IP
+If you have set this to an pathname which does not correspond to a valid
+shell, \fI\*n\fP may unset it, to avoid confusion.
.TP 5
TERMCAP
the contents of the termcap entry corresponding to $TERM,
@@ -6455,6 +6510,11 @@ may be defined to a nonstandard location in the configure script.
.SH FILES
The actual pathnames given may differ on your system.
.TP 5
+\fI/etc/shells\fP
+contains a list of valid shell programs,
+used by \fI\*n\fP to decide if the \*(``SHELL\*('' environment
+variable should be set for the process started by \fI\*n\fP.
+.TP 5
\fI/etc/utmp\fP
the system logfile, which records user logins.
.TP 5
diff --git a/app/xterm/xtermcap.c b/app/xterm/xtermcap.c
index ca537f2f0..da2e79f2c 100644
--- a/app/xterm/xtermcap.c
+++ b/app/xterm/xtermcap.c
@@ -1,7 +1,7 @@
-/* $XTermId: xtermcap.c,v 1.47 2011/07/11 00:31:26 tom Exp $ */
+/* $XTermId: xtermcap.c,v 1.48 2014/05/03 12:43:20 tom Exp $ */
/*
- * Copyright 2007-2010,2011 by Thomas E. Dickey
+ * Copyright 2007-2011,2014 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -217,9 +217,11 @@ static const TCAPINFO table[] = {
/* *INDENT-ON* */
#if OPT_TCAP_FKEYS
-static void
-loadTermcapStrings(TScreen * screen)
+static Boolean
+loadTermcapStrings(TScreen *screen)
{
+ Boolean result = True;
+
if (screen->tcap_fkeys == 0) {
char name[80];
Cardinal want = XtNumber(table);
@@ -243,8 +245,11 @@ loadTermcapStrings(TScreen * screen)
screen->tcap_fkeys[have] = NO_STRING;
}
}
+ } else {
+ result = False;
}
}
+ return result;
}
#endif
@@ -262,8 +267,8 @@ keyIsDistinct(XtermWidget xw, int which)
Cardinal k;
char *fkey;
- loadTermcapStrings(screen);
- if (screen->tcap_fkeys[which] != NO_STRING) {
+ if (loadTermcapStrings(screen)
+ && screen->tcap_fkeys[which] != NO_STRING) {
for (k = 0; k < XtNumber(table); k++) {
if (table[k].code == table[which].code
&& table[k].param == 0) {
@@ -343,7 +348,7 @@ lookupTcapByName(const char *name)
* and bypass the lookup of keysym altogether.
*/
int
-xtermcapKeycode(XtermWidget xw, const char **params, unsigned *state, Bool * fkey)
+xtermcapKeycode(XtermWidget xw, const char **params, unsigned *state, Bool *fkey)
{
const TCAPINFO *data;
int which;
@@ -451,8 +456,7 @@ xtermcapString(XtermWidget xw, int keycode, unsigned mask)
TScreen *screen = TScreenOf(xw);
char *fkey;
- loadTermcapStrings(screen);
- if (screen->tcap_fkeys != 0) {
+ if (loadTermcapStrings(screen)) {
do {
if ((fkey = screen->tcap_fkeys[which]) != NO_STRING) {
StringInput(xw, (Char *) fkey, strlen(fkey));
diff --git a/app/xterm/xtermcfg.h b/app/xterm/xtermcfg.h
index 3d6d1dae1..e0a00c1c4 100644
--- a/app/xterm/xtermcfg.h
+++ b/app/xterm/xtermcfg.h
@@ -1,4 +1,4 @@
-/* $XTermId: xtermcfg.hin,v 1.203 2014/01/16 01:45:00 tom Exp $ */
+/* $XTermId: xtermcfg.hin,v 1.204 2014/04/11 19:36:41 Ross.Combs Exp $ */
/*
* Copyright 1997-2013,2014 by Thomas E. Dickey
@@ -150,7 +150,9 @@
/* #undef OPT_SELECTION_OPS /* CF_ARG_DISABLE(selection-ops) */
#define OPT_SELECT_REGEX 1 /* CF_ARG_DISABLE(regex) */
/* #undef OPT_SESSION_MGT */ /* CF_ARG_DISABLE(session-mgt) */
-/* #undef OPT_SIXEL_GRAPHICS 1 /* CF_ARG_ENABLE(sixel-graphics) */
+/* #undef OPT_REGIS_GRAPHICS /* CF_ARG_ENABLE(regis-graphics) */
+/* #undef OPT_SIXEL_GRAPHICS /* CF_ARG_ENABLE(sixel-graphics) */
+/* #undef OPT_GRAPHICS /* CF_ARG_ENABLE(graphics) */
/* #undef OPT_SUN_FUNC_KEYS */ /* CF_ARG_ENABLE(sun-fkeys) */
/* #undef OPT_TCAP_FKEYS */ /* CF_ARG_ENABLE(tcap-fkeys) */
/* #undef OPT_TCAP_QUERY */ /* CF_ARG_ENABLE(tcap-query) */
diff --git a/app/xterm/xtermcfg.hin b/app/xterm/xtermcfg.hin
index f1df9a7a8..dde1d5e25 100644
--- a/app/xterm/xtermcfg.hin
+++ b/app/xterm/xtermcfg.hin
@@ -1,4 +1,4 @@
-/* $XTermId: xtermcfg.hin,v 1.203 2014/01/16 01:45:00 tom Exp $ */
+/* $XTermId: xtermcfg.hin,v 1.204 2014/04/11 19:36:41 Ross.Combs Exp $ */
/*
* Copyright 1997-2013,2014 by Thomas E. Dickey
@@ -150,7 +150,9 @@
#undef OPT_SELECTION_OPS /* CF_ARG_DISABLE(selection-ops) */
#undef OPT_SELECT_REGEX /* CF_ARG_DISABLE(regex) */
#undef OPT_SESSION_MGT /* CF_ARG_DISABLE(session-mgt) */
+#undef OPT_REGIS_GRAPHICS /* CF_ARG_ENABLE(regis-graphics) */
#undef OPT_SIXEL_GRAPHICS /* CF_ARG_ENABLE(sixel-graphics) */
+#undef OPT_GRAPHICS /* CF_ARG_ENABLE(graphics) */
#undef OPT_SUN_FUNC_KEYS /* CF_ARG_ENABLE(sun-fkeys) */
#undef OPT_TCAP_FKEYS /* CF_ARG_ENABLE(tcap-fkeys) */
#undef OPT_TCAP_QUERY /* CF_ARG_ENABLE(tcap-query) */