diff options
Diffstat (limited to 'app/xterm')
-rw-r--r-- | app/xterm/Makefile | 6 | ||||
-rw-r--r-- | app/xterm/Makefile.in | 97 | ||||
-rw-r--r-- | app/xterm/Tekproc.c | 974 | ||||
-rw-r--r-- | app/xterm/XTerm.ad | 5 | ||||
-rw-r--r-- | app/xterm/data.h | 25 | ||||
-rw-r--r-- | app/xterm/main.c | 382 | ||||
-rw-r--r-- | app/xterm/ptyx.h | 280 | ||||
-rw-r--r-- | app/xterm/version.h | 4 | ||||
-rw-r--r-- | app/xterm/xterm.h | 134 | ||||
-rw-r--r-- | app/xterm/xterm.man | 336 | ||||
-rw-r--r-- | app/xterm/xtermcfg.h | 22 |
11 files changed, 1373 insertions, 892 deletions
diff --git a/app/xterm/Makefile b/app/xterm/Makefile index a4086a4b6..8dcd2003a 100644 --- a/app/xterm/Makefile +++ b/app/xterm/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.3 2007/05/11 06:42:50 matthieu Exp $ +# $OpenBSD: Makefile,v 1.4 2007/06/15 19:34:50 matthieu Exp $ SUBDIR= resize @@ -20,7 +20,9 @@ SRCS= TekPrsTbl.c charproc.c fontutils.c precompose.c scrollbar.c \ Tekproc.c charsets.c input.c print.c tabs.c \ VTPrsTbl.c cursor.c main.c ptydata.c util.c \ button.c data.c menu.c wcwidth.c \ - charclass.c doublechr.c misc.c screen.c xstrings.c + cachedGCs.c \ + charclass.c doublechr.c misc.c screen.c xstrings.c \ + xtermcap.c X11BASE?= /usr/X11R6 MANDIR= ${X11BASE}/man/cat diff --git a/app/xterm/Makefile.in b/app/xterm/Makefile.in index c54c39714..4a2b98c12 100644 --- a/app/xterm/Makefile.in +++ b/app/xterm/Makefile.in @@ -1,8 +1,8 @@ -## $XTermId: Makefile.in,v 1.135 2006/08/03 21:15:53 tom Exp $ +## $XTermId: Makefile.in,v 1.145 2007/03/24 00:09:52 tom Exp $ ## ## $XFree86: xc/programs/xterm/Makefile.in,v 3.56 2006/06/19 00:36:50 dickey Exp $ ## ## -## Copyright 2002-2005,2006 by Thomas E. Dickey +## Copyright 2002-2006,2007 by Thomas E. Dickey ## ## All Rights Reserved ## @@ -48,9 +48,6 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_DATA = @INSTALL_DATA@ transform = @program_transform_name@ -X_LIBS = @X_LIBS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ - EXTRA_CFLAGS = @EXTRA_CFLAGS@ EXTRA_CPPFLAGS = @EXTRA_CPPFLAGS@ EXTRA_LOADFLAGS = @IMAKE_LOADFLAGS@ @@ -84,27 +81,27 @@ EXTRAHDR = @EXTRAHDRS@ EXTRASRC = @EXTRASRCS@ EXTRAOBJ = @EXTRAOBJS@ - SRCS1 = button.c charproc.c charsets.c cursor.c \ + 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 \ + screen.c scrollbar.c tabs.c util.c xstrings.c xtermcap.c \ VTPrsTbl.c $(EXTRASRC) - OBJS1 = button$o charproc$o charsets$o cursor$o \ + 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 \ + 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 SRCS = $(SRCS1) $(SRCS2) OBJS = $(OBJS1) $(OBJS2) HDRS = VTparse.h data.h error.h main.h menu.h proto.h \ - ptyx.h version.h xstrings.h xterm.h $(EXTRAHDR) + ptyx.h version.h xstrings.h xterm.h xtermcap.h $(EXTRAHDR) PROGRAMS = xterm$x resize$x all : $(PROGRAMS) - -.SUFFIXES : .i .def .hin +################################################################################ +.SUFFIXES : .i .def .hin .html .$(manext) .ms .man .ps .pdf .txt .c$o : @RULE_CC@ @@ -117,6 +114,30 @@ all : $(PROGRAMS) .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 +################################################################################ main$o : main.h misc$o : version.h @@ -124,10 +145,10 @@ $(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) $(X_LIBS) $(X_EXTRA_LIBS) $(LIBS) $(EXTRA_LOADFLAGS) + @ECHO_LD@$(LINK) $(LDFLAGS) -o $@ $(OBJS1) $(LIBS) $(EXTRA_LOADFLAGS) resize$x : $(OBJS2) - @ECHO_LD@$(SHELL) $(srcdir)/plink.sh $(LINK) $(LDFLAGS) -o $@ $(OBJS2) $(X_LIBS) $(X_EXTRA_LIBS) $(LIBS) + @ECHO_LD@$(SHELL) $(srcdir)/plink.sh $(LINK) $(LDFLAGS) -o $@ $(OBJS2) $(LIBS) 256colres.h : -rm -f $@ @@ -138,7 +159,7 @@ resize$x : $(OBJS2) perl $(srcdir)/88colres.pl > $@ charproc$o : main.h @CHARPROC_DEPS@ - +################################################################################ actual_xterm = `echo xterm| sed '$(transform)'` actual_resize = `echo resize| sed '$(transform)'` actual_uxterm = `echo uxterm| sed '$(transform)'` @@ -162,18 +183,18 @@ install-full :: xterm$x resize$x $(BINDIR) else \ $(INSTALL_SCRIPT) -m 755 $(srcdir)/uxterm $(BINDIR)/$(binary_uxterm); \ fi' - @-$(SHELL) -c "(test @XTERM_SYMLINK@ != NONE && cd $(BINDIR) && rm -f @XTERM_SYMLINK@) || exit 0" - @-$(SHELL) -c "(test @XTERM_SYMLINK@ != NONE && cd $(BINDIR) && $(LN_S) $(binary_xterm) @XTERM_SYMLINK@) || exit 0" - @-$(SHELL) -c "(test @XTERM_SYMLINK@ != NONE && cd $(BINDIR) && echo '... created symbolic link:' && ls -l $(binary_xterm) @XTERM_SYMLINK@) || exit 0" + @-$(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" 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) -c "(test @XTERM_SYMLINK@ != NONE && cd $(MANDIR) && rm -f @XTERM_SYMLINK@.$(manext)) || exit 0" - @-$(SHELL) -c "(test @XTERM_SYMLINK@ != NONE && cd $(MANDIR) && $(LN_S) $(actual_xterm).$(manext) @XTERM_SYMLINK@.$(manext)) || exit 0" - @-$(SHELL) -c "(test @XTERM_SYMLINK@ != NONE && cd $(MANDIR) && echo '... created symbolic link:' && ls -l $(actual_xterm).$(manext) @XTERM_SYMLINK@.$(manext)) || exit 0" + @-$(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" @no_appsdir@install \ @no_appsdir@install-app \ @@ -198,29 +219,29 @@ SET_TERMINFO = @SET_TERMINFO@ install-full \ install-ti :: $(TERMINFO_DIR) - $(SET_TERMINFO) tic $(srcdir)/terminfo + @$(SHELL) -c "$(SET_TERMINFO) $(srcdir)/run-tic.sh $(srcdir)/terminfo" @echo 'Completed installation of terminfo description.' install-full \ install-tc :: - @test -f /etc/termcap && echo 'You must install the termcap entry manually by editing /etc/termcap' + @-$(SHELL) -c "test -f /etc/termcap && echo 'You must install the termcap entry manually by editing /etc/termcap'" installdirs : $(INSTALL_DIRS) - +################################################################################ uninstall \ uninstall-bin \ uninstall-full :: -$(RM) $(BINDIR)/$(binary_xterm) -$(RM) $(BINDIR)/$(binary_resize) -$(RM) $(BINDIR)/$(binary_uxterm) - @-$(SHELL) -c "test @XTERM_SYMLINK@ != NONE && cd $(BINDIR) && rm -f @XTERM_SYMLINK@" + @-$(SHELL) -c "if test @XTERM_SYMLINK@ != NONE ; then cd $(BINDIR) && rm -f @XTERM_SYMLINK@; fi" uninstall \ uninstall-man \ uninstall-full :: -$(RM) $(MANDIR)/$(actual_xterm).$(manext) -$(RM) $(MANDIR)/$(actual_resize).$(manext) - @-$(SHELL) -c "test @XTERM_SYMLINK@ != NONE && cd $(MANDIR) && rm -f @XTERM_SYMLINK@.$(manext)" + @-$(SHELL) -c "if test @XTERM_SYMLINK@ != NONE ; then cd $(MANDIR) && rm -f @XTERM_SYMLINK@.$(manext); fi" @no_appsdir@uninstall \ @no_appsdir@uninstall-app \ @@ -228,7 +249,7 @@ uninstall-full :: @no_appsdir@ -$(RM) $(APPSDIR)/$(CLASS) @no_appsdir@ -$(RM) $(APPSDIR)/$(CLASS)-color @no_appsdir@ -$(RM) $(APPSDIR)/UXTerm - +################################################################################ mostlyclean : -$(RM) *$o *.[is] XtermLog.* .pure core *~ *.bak *.BAK *.out *.tmp @@ -237,22 +258,26 @@ clean : mostlyclean distclean : clean -$(RM) Makefile config.status config.cache config.log xtermcfg.h + -$(RM) *.ps *.pdf *.png + -$(RM) xterm.html xterm.$(manext) xterm.txt + -$(RM) ctlseqs.html ctlseqs.$(manext) realclean : distclean - -$(RM) tags TAGS ctlseqs.ps ctlseqs.txt + -$(RM) tags TAGS maintainer-clean : realclean -$(RM) 256colres.h 88colres.h - +################################################################################ ctlseqs.html : ctlseqs.ms - GROFF_NO_SGR=stupid $(SHELL) -c "tbl ctlseqs.ms | groff -Thtml -ms" >$@ - -ctlseqs.txt : ctlseqs.ms - GROFF_NO_SGR=stupid $(SHELL) -c "tbl ctlseqs.ms | nroff -Tascii -ms | col -bx" >$@ - +ctlseqs.pdf : ctlseqs.ps ctlseqs.ps : ctlseqs.ms - tbl ctlseqs.ms | groff -ms >$@ - +ctlseqs.txt : ctlseqs.ms +################################################################################ +xterm.html : xterm.$(manext) +xterm.pdf : xterm.ps +xterm.ps : xterm.$(manext) +xterm.txt : xterm.$(manext) +################################################################################ lint : $(LINT) $(CPPFLAGS) $(SRCS1) $(LINT) $(CPPFLAGS) $(SRCS2) diff --git a/app/xterm/Tekproc.c b/app/xterm/Tekproc.c index 0532d393e..f02f7e836 100644 --- a/app/xterm/Tekproc.c +++ b/app/xterm/Tekproc.c @@ -1,4 +1,4 @@ -/* $XTermId: Tekproc.c,v 1.138 2006/07/23 16:44:28 tom Exp $ */ +/* $XTermId: Tekproc.c,v 1.155 2007/03/19 23:51:52 tom Exp $ */ /* * Warning, there be crufty dragons here. @@ -7,7 +7,7 @@ /* -Copyright 2001-2005,2006 by Thomas E. Dickey +Copyright 2001-2006,2007 by Thomas E. Dickey All Rights Reserved @@ -113,7 +113,7 @@ in this Software without prior written authorization from The Open Group. #include <error.h> #include <menu.h> -#define DefaultGCID XGContextFromGC(DefaultGC(screen->display, DefaultScreen(screen->display))) +#define DefaultGCID XGContextFromGC(DefaultGC(XtDisplay(tw), DefaultScreen(XtDisplay(tw)))) /* Tek defines */ @@ -136,16 +136,16 @@ in this Software without prior written authorization from The Open Group. #define TEKDEFHEIGHT 565 #define TEKDEFWIDTH 750 #define TEKHEIGHT 3072 -#define TEKHOME ((TekChar[screen->page.fontsize].nlines - 1)\ - * TekChar[screen->page.fontsize].vsize) +#define TEKHOME ( (TekChar[tekscr->page.fontsize].nlines - 1) \ + * TekChar[tekscr->page.fontsize].vsize) #define TEKMINHEIGHT 452 #define TEKMINWIDTH 600 #define TEKTOPPAD 34 #define TEKWIDTH 4096 #define WEST 02 -#define TekMove(x,y) screen->cur_X = x; screen->cur_Y = y -#define input() Tinput() +#define TekMove(tw,x,y) tekscr->cur_X = x; tekscr->cur_Y = y +#define input() Tinput(tw) #define unput(c) *Tpushback++ = c /* *INDENT-OFF* */ static struct Tek_Char { @@ -262,7 +262,7 @@ static XtResource resources[] = Fres("font2", XtCFont, tek.Tfont[TEK_FONT_2], "6x13"), Fres("font3", XtCFont, tek.Tfont[TEK_FONT_3], "8x13"), Fres("fontSmall", XtCFont, tek.Tfont[TEK_FONT_SMALL], DFT_FONT_SMALL), - Sres("initialFont", "InitialFont", tek.initial_font, "large"), + Sres(XtNinitialFont, XtCInitialFont, tek.initial_font, "large"), Sres("ginTerminator", "GinTerminator", tek.gin_terminator_str, GIN_TERM_NONE_STR), #if OPT_TOOLBAR Wres(XtNmenuBar, XtCMenuBar, tek.tb_info.menu_bar, 0), @@ -270,25 +270,31 @@ static XtResource resources[] = #endif }; -static IChar Tinput(void); -static int getpoint(void); -static void TCursorBack(void); -static void TCursorDown(void); -static void TCursorForward(void); -static void TCursorUp(void); -static void TekBackground(TScreen * screen); -static void TekConfigure(Widget w); -static void TekDraw(int x, int y); -static void TekEnq(unsigned status, int x, int y); -static void TekFlush(void); -static void TekInitialize(Widget request, - Widget wnew, - ArgList args, - Cardinal *num_args); -static void TekPage(void); -static void TekRealize(Widget gw, - XtValueMask * valuemaskp, - XSetWindowAttributes * values); +static IChar Tinput(TekWidget /* tw */ ); +static int getpoint(TekWidget /* tw */ ); +static void TCursorBack(TekWidget /* tw */ ); +static void TCursorDown(TekWidget /* tw */ ); +static void TCursorForward(TekWidget /* tw */ ); +static void TCursorUp(TekWidget /* tw */ ); +static void TekBackground(TekWidget /* tw */ , + TScreen * /* screen */ ); +static void TekConfigure(Widget /* w */ ); +static void TekDraw(TekWidget /* tw */ , + int /* x */ , + int /* y */ ); +static void TekEnq(TekWidget /* tw */ , + unsigned /* status */ , + int /* x */ , + int /* y */ ); +static void TekFlush(TekWidget /* tw */ ); +static void TekInitialize(Widget /* request */ , + Widget /* wnew */ , + ArgList /* args */ , + Cardinal * /* num_args */ ); +static void TekPage(TekWidget /* tw */ ); +static void TekRealize(Widget /* gw */ , + XtValueMask * /* valuemaskp */ , + XSetWindowAttributes * /* values */ ); static WidgetClassRec tekClassRec = { @@ -328,7 +334,7 @@ static WidgetClassRec tekClassRec = NULL /* extension */ } }; -#define tekWidgetClass ((WidgetClass)&tekClassRec) +WidgetClass tekWidgetClass = (WidgetClass) & tekClassRec; static Bool Tfailed = False; @@ -340,13 +346,27 @@ TekInit(void) if (!Tfailed && tekWidget == 0) { + Cardinal nargs = 0; + Arg myArgs[3]; + Boolean iconic = 0; TRACE(("TekInit\n")); + XtSetArg(myArgs[nargs], XtNiconic, &iconic); + ++nargs; + XtGetValues(toplevel, myArgs, nargs); + + nargs = 0; + XtSetArg(myArgs[nargs], XtNiconic, iconic); + ++nargs; + XtSetArg(myArgs[nargs], XtNallowShellResize, True); + ++nargs; + XtSetArg(myArgs[nargs], XtNinput, True); + ++nargs; + /* this causes the Initialize method to be called */ tekshellwidget = XtCreatePopupShell("tektronix", topLevelShellWidgetClass, - toplevel, ourTopLevelShellArgs, - number_ourTopLevelShellArgs); + toplevel, myArgs, nargs); SetupMenus(tekshellwidget, &form_top, &menu_top, &menu_high); @@ -392,9 +412,10 @@ TekPtyData(void) } static void -Tekparse(void) +Tekparse(TekWidget tw) { - TScreen *screen = &term->screen; + TScreen *screen = TScreenOf(term); + TekScreen *tekscr = TekScreenOf(tw); int x, y; IChar c = 0; IChar ch; @@ -420,42 +441,42 @@ Tekparse(void) switch (nextstate) { case CASE_REPORT: TRACE(("case: report address\n")); - if (screen->TekGIN) { - TekGINoff(); - TekEnqMouse(0); + if (tekscr->TekGIN) { + TekGINoff(tw); + TekEnqMouse(tw, 0); } else { c = 064; /* has hard copy unit */ - if (screen->margin == MARGIN2) + if (tekscr->margin == MARGIN2) c |= 02; - TekEnq(c, screen->cur_X, screen->cur_Y); + TekEnq(tw, c, tekscr->cur_X, tekscr->cur_Y); } - TekRecord->ptr[-1] = NAK; /* remove from recording */ + TekRecord->ptr[-1] = ANSI_NAK; /* remove from recording */ Tparsestate = curstate; break; case CASE_VT_MODE: TRACE(("case: special return to vt102 mode\n")); Tparsestate = curstate; - TekRecord->ptr[-1] = NAK; /* remove from recording */ - FlushLog(screen); + TekRecord->ptr[-1] = ANSI_NAK; /* remove from recording */ + FlushLog(&(term->screen)); return; case CASE_SPT_STATE: TRACE(("case: Enter Special Point Plot mode\n")); - if (screen->TekGIN) - TekGINoff(); + if (tekscr->TekGIN) + TekGINoff(tw); Tparsestate = curstate = Tspttable; break; case CASE_GIN: TRACE(("case: Do Tek GIN mode\n")); - screen->TekGIN = &TekRecord->ptr[-1]; + tekscr->TekGIN = &TekRecord->ptr[-1]; /* Set cross-hair cursor raster array */ if ((GINcursor = make_colored_cursor(XC_tcross, T_COLOR(screen, MOUSE_FG), T_COLOR(screen, MOUSE_BG))) != 0) { - XDefineCursor(screen->display, TWindow(screen), + XDefineCursor(XtDisplay(tw), TWindow(tekscr), GINcursor); } Tparsestate = Tbyptable; /* Bypass mode */ @@ -463,88 +484,88 @@ Tekparse(void) case CASE_BEL: TRACE(("case: BEL\n")); - if (screen->TekGIN) - TekGINoff(); - if (!TekRefresh) + if (tekscr->TekGIN) + TekGINoff(tw); + if (!tekRefreshList) Bell(XkbBI_TerminalBell, 0); Tparsestate = curstate; /* clear bypass condition */ break; case CASE_BS: TRACE(("case: BS\n")); - if (screen->TekGIN) - TekGINoff(); + if (tekscr->TekGIN) + TekGINoff(tw); Tparsestate = curstate; /* clear bypass condition */ - TCursorBack(); + TCursorBack(tw); break; case CASE_PT_STATE: TRACE(("case: Enter Tek Point Plot mode\n")); - if (screen->TekGIN) - TekGINoff(); + if (tekscr->TekGIN) + TekGINoff(tw); Tparsestate = curstate = Tpttable; break; case CASE_PLT_STATE: TRACE(("case: Enter Tek Plot mode\n")); - if (screen->TekGIN) - TekGINoff(); + if (tekscr->TekGIN) + TekGINoff(tw); Tparsestate = curstate = Tplttable; - if ((c = input()) == BEL) - screen->pen = PENDOWN; + if ((c = input()) == ANSI_BEL) + tekscr->pen = PENDOWN; else { unput(c); - screen->pen = PENUP; + tekscr->pen = PENUP; } break; case CASE_TAB: TRACE(("case: HT\n")); - if (screen->TekGIN) - TekGINoff(); + if (tekscr->TekGIN) + TekGINoff(tw); Tparsestate = curstate; /* clear bypass condition */ - TCursorForward(); + TCursorForward(tw); break; case CASE_IPL_STATE: TRACE(("case: Enter Tek Incremental Plot mode\n")); - if (screen->TekGIN) - TekGINoff(); + if (tekscr->TekGIN) + TekGINoff(tw); Tparsestate = curstate = Tipltable; break; case CASE_ALP_STATE: TRACE(("case: Enter Tek Alpha mode from any other mode\n")); - if (screen->TekGIN) - TekGINoff(); + if (tekscr->TekGIN) + TekGINoff(tw); /* if in one of graphics states, move alpha cursor */ if (nplot > 0) /* flush line VTbuffer */ - TekFlush(); + TekFlush(tw); Tparsestate = curstate = Talptable; break; case CASE_UP: TRACE(("case: cursor up\n")); - if (screen->TekGIN) - TekGINoff(); + if (tekscr->TekGIN) + TekGINoff(tw); Tparsestate = curstate; /* clear bypass condition */ - TCursorUp(); + TCursorUp(tw); break; case CASE_COPY: TRACE(("case: make copy\n")); - if (screen->TekGIN) - TekGINoff(); - TekCopy(); - TekRecord->ptr[-1] = NAK; /* remove from recording */ + if (tekscr->TekGIN) + TekGINoff(tw); + TekCopy(tw); + TekRecord->ptr[-1] = ANSI_NAK; /* remove from recording */ Tparsestate = curstate; /* clear bypass condition */ break; case CASE_PAGE: TRACE(("case: Page Function\n")); - if (screen->TekGIN) - TekGINoff(); - TekPage(); /* clear bypass condition */ + if (tekscr->TekGIN) + TekGINoff(tw); + TekPage(tw); /* clear bypass condition */ break; case CASE_BES_STATE: @@ -575,18 +596,18 @@ Tekparse(void) case CASE_CHAR_SIZE: TRACE(("case: character size selector\n")); - TekSetFontSize((int) (c & 03)); + TekSetFontSize(tw, (int) (c & 03)); Tparsestate = curstate; break; case CASE_BEAM_VEC: TRACE(("case: beam and vector selector\n")); /* only line types */ - if ((c &= LINEMASK) != screen->cur.linetype) { + if ((c &= LINEMASK) != tekscr->cur.linetype) { if (nplot > 0) - TekFlush(); + TekFlush(tw); if (c <= TEKNUMLINES) - screen->cur.linetype = c; + tekscr->cur.linetype = c; } Tparsestate = curstate; break; @@ -597,18 +618,18 @@ Tekparse(void) case CASE_PENUP: TRACE(("case: Ipl: penup\n")); - screen->pen = PENUP; + tekscr->pen = PENUP; break; case CASE_PENDOWN: TRACE(("case: Ipl: pendown\n")); - screen->pen = PENDOWN; + tekscr->pen = PENDOWN; break; case CASE_IPL_POINT: TRACE(("case: Ipl: point\n")); - x = screen->cur_X; - y = screen->cur_Y; + x = tekscr->cur_X; + y = tekscr->cur_Y; if (c & NORTH) y++; else if (c & SOUTH) @@ -617,50 +638,50 @@ Tekparse(void) x++; else if (c & WEST) x--; - if (screen->pen == PENDOWN) - TekDraw(x, y); + if (tekscr->pen == PENDOWN) + TekDraw(tw, x, y); else - TekMove(x, y); + TekMove(tw, x, y); break; case CASE_PLT_VEC: TRACE(("case: Plt: vector\n")); unput(c); - if (getpoint()) { - if (screen->pen == PENDOWN) { - TekDraw(screen->cur.x, screen->cur.y); + if (getpoint(tw)) { + if (tekscr->pen == PENDOWN) { + TekDraw(tw, tekscr->cur.x, tekscr->cur.y); } else { - TekMove(screen->cur.x, screen->cur.y); + TekMove(tw, tekscr->cur.x, tekscr->cur.y); } - screen->pen = PENDOWN; + tekscr->pen = PENDOWN; } break; case CASE_PT_POINT: TRACE(("case: Pt: point\n")); unput(c); - if (getpoint()) { - TekMove(screen->cur.x, screen->cur.y); - TekDraw(screen->cur.x, screen->cur.y); + if (getpoint(tw)) { + TekMove(tw, tekscr->cur.x, tekscr->cur.y); + TekDraw(tw, tekscr->cur.x, tekscr->cur.y); } break; case CASE_SPT_POINT: TRACE(("case: Spt: point\n")); /* ignore intensity character in c */ - if (getpoint()) { - TekMove(screen->cur.x, screen->cur.y); - TekDraw(screen->cur.x, screen->cur.y); + if (getpoint(tw)) { + TekMove(tw, tekscr->cur.x, tekscr->cur.y); + TekDraw(tw, tekscr->cur.x, tekscr->cur.y); } break; case CASE_CR: TRACE(("case: CR\n")); - if (screen->TekGIN) - TekGINoff(); + if (tekscr->TekGIN) + TekGINoff(tw); if (nplot > 0) /* flush line VTbuffer */ - TekFlush(); - screen->cur_X = screen->margin == MARGIN1 ? 0 : + TekFlush(tw); + tekscr->cur_X = tekscr->margin == MARGIN1 ? 0 : TEKWIDTH / 2; Tparsestate = curstate = Talptable; break; @@ -672,25 +693,25 @@ Tekparse(void) case CASE_LF: TRACE(("case: LF\n")); - if (screen->TekGIN) - TekGINoff(); - TCursorDown(); - if (!TekRefresh) + if (tekscr->TekGIN) + TekGINoff(tw); + TCursorDown(tw); + if (!tekRefreshList) do_xevents(); break; case CASE_SP: TRACE(("case: SP\n")); - TCursorForward(); + TCursorForward(tw); break; case CASE_PRINT: TRACE(("case: printable character\n")); ch = c; - c = screen->cur.fontsize; - x = (int) (screen->cur_X * TekScale(screen)) + c = tekscr->cur.fontsize; + x = (int) (tekscr->cur_X * TekScale(tekscr)) + screen->border; - y = (int) ((TEKHEIGHT + TEKTOPPAD - screen->cur_Y) * TekScale(screen)) + y = (int) ((TEKHEIGHT + TEKTOPPAD - tekscr->cur_Y) * TekScale(tekscr)) + screen->border; #if OPT_WIDE_CHARS @@ -699,23 +720,23 @@ Tekparse(void) XChar2b sbuf; sbuf.byte2 = CharOf(ch); sbuf.byte1 = CharOf(ch >> 8); - XDrawImageString16(screen->display, - TWindow(screen), - screen->TnormalGC, + XDrawImageString16(XtDisplay(tw), + TWindow(tekscr), + tekscr->TnormalGC, x, y, &sbuf, 1); } else #endif - XDrawString(screen->display, - TWindow(screen), - screen->TnormalGC, + XDrawString(XtDisplay(tw), + TWindow(tekscr), + tekscr->TnormalGC, x, y, (char *) &ch, 1); - TCursorForward(); + TCursorForward(tw); break; case CASE_OSC: /* FIXME: someone should disentangle the input queues @@ -724,7 +745,7 @@ Tekparse(void) TRACE(("case: do osc escape\n")); { /* - * do_osc() can call TekExpose(), which calls dorefresh(), + * do_osc() can call TekExpose(), which calls TekRefresh(), * and sends us recurring here - don't do that... */ static int nested; @@ -732,7 +753,7 @@ Tekparse(void) Char buf2[512]; IChar c2; unsigned len = 0; - while ((c2 = input()) != BEL) { + while ((c2 = input()) != ANSI_BEL) { if (!isprint(c2 & 0x7f) || len + 2 >= (int) sizeof(buf2)) break; @@ -740,8 +761,8 @@ Tekparse(void) } buf2[len] = 0; if (!nested++) { - if (c2 == BEL) - do_osc(term, buf2, len, BEL); + if (c2 == ANSI_BEL) + do_osc(term, buf2, len, ANSI_BEL); } --nested; } @@ -756,24 +777,25 @@ static char *rptr; static PtySelect Tselect_mask; static IChar -Tinput(void) +Tinput(TekWidget tw) { - TScreen *screen = &term->screen; + TekScreen *tekscr = TekScreenOf(tw); + TScreen *screen = TScreenOf(term); TekLink *tek; if (Tpushback > Tpushb) return (*--Tpushback); - if (TekRefresh) { + if (tekRefreshList) { if (rcnt-- > 0) return (*rptr++); - if ((tek = TekRefresh->next) != 0) { - TekRefresh = tek; + if ((tek = tekRefreshList->next) != 0) { + tekRefreshList = tek; rptr = tek->data; rcnt = tek->count - 1; - TekSetFontSize(tek->fontsize); + TekSetFontSize(tw, tek->fontsize); return (*rptr++); } - TekRefresh = (TekLink *) 0; + tekRefreshList = (TekLink *) 0; longjmp(Tekjump, 1); } again: @@ -781,7 +803,7 @@ Tinput(void) int update = VTbuffer->update; if (nplot > 0) /* flush line */ - TekFlush(); + TekFlush(tw); #ifdef VMS Tselect_mask = pty_mask; /* force a read */ #else /* VMS */ @@ -800,7 +822,7 @@ Tinput(void) break; } if (Ttoggled && curstate == Talptable) { - TCursorToggle(TOGGLE); + TCursorToggle(tw, TOGGLE); Ttoggled = False; } if (XtAppPending(app_con) & XtIMXEvent) { @@ -810,7 +832,7 @@ Tinput(void) XFD_COPYSET(&X_mask, &Tselect_mask); #endif /* VMS */ } else { - XFlush(screen->display); + XFlush(XtDisplay(tw)); #ifdef VMS Tselect_mask = Select_mask; @@ -832,7 +854,7 @@ Tinput(void) goto again; } #else /* VMS */ - if (FD_ISSET(ConnectionNumber(screen->display), &Tselect_mask)) { + if (FD_ISSET(ConnectionNumber(XtDisplay(tw)), &Tselect_mask)) { xevents(); if (VTbuffer->update != update) goto again; @@ -840,18 +862,18 @@ Tinput(void) #endif /* VMS */ } if (!Ttoggled && curstate == Talptable) { - TCursorToggle(TOGGLE); + TCursorToggle(tw, TOGGLE); Ttoggled = True; } } tek = TekRecord; if (tek->count >= TEK_LINK_BLOCK_SIZE - || tek->fontsize != screen->cur.fontsize) { + || tek->fontsize != tekscr->cur.fontsize) { if ((TekRecord = tek->next = CastMalloc(TekLink)) == 0) Panic("Tinput: malloc error (%d)\n", errno); tek = tek->next; tek->next = (TekLink *) 0; - tek->fontsize = screen->cur.fontsize; + tek->fontsize = tekscr->cur.fontsize; tek->count = 0; tek->ptr = tek->data; } @@ -861,96 +883,119 @@ Tinput(void) return (*tek->ptr++ = nextPtyData(screen, VTbuffer)); } +static void +TekClear(TekWidget tw) +{ + TekScreen *tekscr = TekScreenOf(tw); + + if (TWindow(tekscr)) + XClearWindow(XtDisplay(tw), TWindow(tekscr)); +} + /* this should become the Tek Widget's Resize proc */ static void TekConfigure(Widget w) { - TScreen *screen = &term->screen; - int border = 2 * screen->border; - double d; - - if (TWindow(screen)) - XClearWindow(screen->display, TWindow(screen)); - TWidth(screen) = w->core.width - border; - THeight(screen) = w->core.height - border; - TekScale(screen) = (double) TWidth(screen) / TEKWIDTH; - if ((d = (double) THeight(screen) / (TEKHEIGHT + TEKTOPPAD + TEKBOTTOMPAD)) - < TekScale(screen)) - TekScale(screen) = d; - TFullWidth(screen) = w->core.width; - TFullHeight(screen) = w->core.height; + if (IsTekWidget(w)) { + TekWidget tw = (TekWidget) w; + TekScreen *tekscr = TekScreenOf(tw); + TScreen *screen = TScreenOf(term); + int border = 2 * screen->border; + double d; + + TekClear(tw); + TWidth(tekscr) = w->core.width - border; + THeight(tekscr) = w->core.height - border; + TekScale(tekscr) = (double) TWidth(tekscr) / TEKWIDTH; + if ((d = (double) THeight(tekscr) / (TEKHEIGHT + TEKTOPPAD + TEKBOTTOMPAD)) + < TekScale(tekscr)) + TekScale(tekscr) = d; + TFullWidth(tekscr) = w->core.width; + TFullHeight(tekscr) = w->core.height; + } } /*ARGSUSED*/ void -TekExpose(Widget w GCC_UNUSED, +TekExpose(Widget w, XEvent * event GCC_UNUSED, Region region GCC_UNUSED) { - TScreen *screen = &term->screen; + if (IsTekWidget(w)) { + TekWidget tw = (TekWidget) w; + TekScreen *tekscr = TekScreenOf(tw); - TRACE(("TekExpose\n")); + TRACE(("TekExpose\n")); #ifdef lint - region = region; + region = region; #endif - if (!Ttoggled) - TCursorToggle(CLEAR); - Ttoggled = True; - Tpushback = Tpushb; - screen->cur_X = 0; - screen->cur_Y = TEKHOME; - TekSetFontSize(screen->page.fontsize); - screen->cur = screen->page; - screen->margin = MARGIN1; - if (screen->TekGIN) { - screen->TekGIN = NULL; - TekGINoff(); + if (!Ttoggled) + TCursorToggle(tw, CLEAR); + Ttoggled = True; + Tpushback = Tpushb; + tekscr->cur_X = 0; + tekscr->cur_Y = TEKHOME; + TekSetFontSize(tw, tekscr->page.fontsize); + tekscr->cur = tekscr->page; + tekscr->margin = MARGIN1; + if (tekscr->TekGIN) { + tekscr->TekGIN = NULL; + TekGINoff(tw); + } + tekRefreshList = &Tek0; + rptr = tekRefreshList->data; + rcnt = tekRefreshList->count; + Tparsestate = curstate = Talptable; + TRACE(("TekExpose resets data to replay %d bytes\n", rcnt)); + if (resource.wait_for_map) + first_map_occurred(); + if (!tekscr->waitrefresh) + TekRefresh(tw); } - TekRefresh = &Tek0; - rptr = TekRefresh->data; - rcnt = TekRefresh->count; - Tparsestate = curstate = Talptable; - TRACE(("TekExpose resets data to replay %d bytes\n", rcnt)); - if (waiting_for_initial_map) - first_map_occurred(); - if (!screen->waitrefresh) - dorefresh(); } void -dorefresh(void) +TekRefresh(TekWidget tw) { - TScreen *screen = &term->screen; + TekScreen *tekscr = TekScreenOf(tw); + TScreen *screen = TScreenOf(term); static Cursor wait_cursor = None; if (wait_cursor == None) wait_cursor = make_colored_cursor(XC_watch, T_COLOR(screen, MOUSE_FG), T_COLOR(screen, MOUSE_BG)); - XDefineCursor(screen->display, TWindow(screen), wait_cursor); - XFlush(screen->display); + XDefineCursor(XtDisplay(tw), TWindow(tekscr), wait_cursor); + XFlush(XtDisplay(tw)); if (!setjmp(Tekjump)) - Tekparse(); - XDefineCursor(screen->display, TWindow(screen), - (screen->TekGIN && GINcursor) ? GINcursor : screen->arrow); + Tekparse(tw); + XDefineCursor(XtDisplay(tw), TWindow(tekscr), + (tekscr->TekGIN && GINcursor) ? GINcursor : tekscr->arrow); +} + +void +TekRepaint(TekWidget tw) +{ + TekClear(tw); + TekExpose((Widget) tw, (XEvent *) NULL, (Region) NULL); } static void -TekPage(void) +TekPage(TekWidget tw) { - TScreen *screen = &term->screen; + TekScreen *tekscr = TekScreenOf(tw); TekLink *tek; - XClearWindow(screen->display, TWindow(screen)); - screen->cur_X = 0; - screen->cur_Y = TEKHOME; - screen->margin = MARGIN1; - screen->page = screen->cur; - if (screen->TekGIN) - TekGINoff(); + TekClear(tw); + tekscr->cur_X = 0; + tekscr->cur_Y = TEKHOME; + tekscr->margin = MARGIN1; + tekscr->page = tekscr->cur; + if (tekscr->TekGIN) + TekGINoff(tw); tek = TekRecord = &Tek0; - tek->fontsize = screen->cur.fontsize; + tek->fontsize = tekscr->cur.fontsize; tek->count = 0; tek->ptr = tek->data; tek = tek->next; @@ -962,7 +1007,7 @@ TekPage(void) tek = tek2; } while (tek); TekRecord->next = (TekLink *) 0; - TekRefresh = (TekLink *) 0; + tekRefreshList = (TekLink *) 0; Ttoggled = True; Tparsestate = curstate = Talptable; /* Tek Alpha mode */ } @@ -976,13 +1021,13 @@ TekPage(void) #define TWOBITS 03 static int -getpoint(void) +getpoint(TekWidget tw) { int c, x, y, e, lo_y = 0; - TScreen *screen = &term->screen; + TekScreen *tekscr = TekScreenOf(tw); - x = screen->cur.x; - y = screen->cur.y; + x = tekscr->cur.x; + y = tekscr->cur.y; for (;;) { if ((c = input()) < ' ') { /* control character */ unput(c); @@ -1002,8 +1047,8 @@ getpoint(void) if (c < '`') { /* Lo X */ x &= ~LOBITS; x |= (c & FIVEBITS) << SHIFTLO; - screen->cur.x = x; - screen->cur.y = y; + tekscr->cur.x = x; + tekscr->cur.y = y; return (1); /* OK */ } /* else Lo Y */ @@ -1021,190 +1066,195 @@ getpoint(void) } static void -TCursorBack(void) +TCursorBack(TekWidget tw) { - TScreen *screen = &term->screen; + TekScreen *tekscr = TekScreenOf(tw); struct Tek_Char *t; int x, l; - x = (screen->cur_X -= - (t = &TekChar[screen->cur.fontsize])->hsize + x = (tekscr->cur_X -= + (t = &TekChar[tekscr->cur.fontsize])->hsize ); - if (((screen->margin == MARGIN1) && (x < 0)) - || ((screen->margin == MARGIN2) && (x < TEKWIDTH / 2))) { - if ((l = (screen->cur_Y + (t->vsize - 1)) / t->vsize + 1) >= + if (((tekscr->margin == MARGIN1) && (x < 0)) + || ((tekscr->margin == MARGIN2) && (x < TEKWIDTH / 2))) { + if ((l = (tekscr->cur_Y + (t->vsize - 1)) / t->vsize + 1) >= t->nlines) { - screen->margin = !screen->margin; + tekscr->margin = !tekscr->margin; l = 0; } - screen->cur_Y = l * t->vsize; - screen->cur_X = (t->charsperline - 1) * t->hsize; + tekscr->cur_Y = l * t->vsize; + tekscr->cur_X = (t->charsperline - 1) * t->hsize; } } static void -TCursorForward(void) +TCursorForward(TekWidget tw) { - TScreen *screen = &term->screen; + TekScreen *tekscr = TekScreenOf(tw); struct Tek_Char *t; int l; - if ((screen->cur_X += - (t = &TekChar[screen->cur.fontsize])->hsize + if ((tekscr->cur_X += + (t = &TekChar[tekscr->cur.fontsize])->hsize ) > TEKWIDTH ) { - if ((l = screen->cur_Y / t->vsize - 1) < 0) { - screen->margin = !screen->margin; + if ((l = tekscr->cur_Y / t->vsize - 1) < 0) { + tekscr->margin = !tekscr->margin; l = t->nlines - 1; } - screen->cur_Y = l * t->vsize; - screen->cur_X = screen->margin == MARGIN1 ? 0 : TEKWIDTH / 2; + tekscr->cur_Y = l * t->vsize; + tekscr->cur_X = tekscr->margin == MARGIN1 ? 0 : TEKWIDTH / 2; } } static void -TCursorUp(void) +TCursorUp(TekWidget tw) { - TScreen *screen = &term->screen; + TekScreen *tekscr = TekScreenOf(tw); struct Tek_Char *t; int l; - t = &TekChar[screen->cur.fontsize]; + t = &TekChar[tekscr->cur.fontsize]; - if ((l = (screen->cur_Y + (t->vsize - 1)) / t->vsize + 1) >= t->nlines) { + if ((l = (tekscr->cur_Y + (t->vsize - 1)) / t->vsize + 1) >= t->nlines) { l = 0; - if ((screen->margin = !screen->margin) != MARGIN1) { - if (screen->cur_X < TEKWIDTH / 2) - screen->cur_X += TEKWIDTH / 2; - } else if (screen->cur_X >= TEKWIDTH / 2) - screen->cur_X -= TEKWIDTH / 2; + if ((tekscr->margin = !tekscr->margin) != MARGIN1) { + if (tekscr->cur_X < TEKWIDTH / 2) + tekscr->cur_X += TEKWIDTH / 2; + } else if (tekscr->cur_X >= TEKWIDTH / 2) + tekscr->cur_X -= TEKWIDTH / 2; } - screen->cur_Y = l * t->vsize; + tekscr->cur_Y = l * t->vsize; } static void -TCursorDown(void) +TCursorDown(TekWidget tw) { - TScreen *screen = &term->screen; + TekScreen *tekscr = TekScreenOf(tw); struct Tek_Char *t; int l; - t = &TekChar[screen->cur.fontsize]; + t = &TekChar[tekscr->cur.fontsize]; - if ((l = screen->cur_Y / t->vsize - 1) < 0) { + if ((l = tekscr->cur_Y / t->vsize - 1) < 0) { l = t->nlines - 1; - if ((screen->margin = !screen->margin) != MARGIN1) { - if (screen->cur_X < TEKWIDTH / 2) - screen->cur_X += TEKWIDTH / 2; - } else if (screen->cur_X >= TEKWIDTH / 2) - screen->cur_X -= TEKWIDTH / 2; + if ((tekscr->margin = !tekscr->margin) != MARGIN1) { + if (tekscr->cur_X < TEKWIDTH / 2) + tekscr->cur_X += TEKWIDTH / 2; + } else if (tekscr->cur_X >= TEKWIDTH / 2) + tekscr->cur_X -= TEKWIDTH / 2; } - screen->cur_Y = l * t->vsize; + tekscr->cur_Y = l * t->vsize; } static void -AddToDraw(int x1, int y1, int x2, int y2) +AddToDraw(TekWidget tw, int x1, int y1, int x2, int y2) { - TScreen *screen = &term->screen; + TekScreen *tekscr = TekScreenOf(tw); + TScreen *screen = TScreenOf(term); XSegment *lp; TRACE(("AddToDraw (%d,%d) (%d,%d)\n", x1, y1, x2, y2)); if (nplot >= MAX_PTS) { - TekFlush(); + TekFlush(tw); } lp = line_pt++; - lp->x1 = x1 = (int) (x1 * TekScale(screen) + screen->border); - lp->y1 = y1 = (int) ((TEKHEIGHT + TEKTOPPAD - y1) * TekScale(screen) + + lp->x1 = x1 = (int) (x1 * TekScale(tekscr) + screen->border); + lp->y1 = y1 = (int) ((TEKHEIGHT + TEKTOPPAD - y1) * TekScale(tekscr) + screen->border); - lp->x2 = x2 = (int) (x2 * TekScale(screen) + screen->border); - lp->y2 = y2 = (int) ((TEKHEIGHT + TEKTOPPAD - y2) * TekScale(screen) + + lp->x2 = x2 = (int) (x2 * TekScale(tekscr) + screen->border); + lp->y2 = y2 = (int) ((TEKHEIGHT + TEKTOPPAD - y2) * TekScale(tekscr) + screen->border); nplot++; TRACE(("...AddToDraw %d points\n", nplot)); } static void -TekDraw(int x, int y) +TekDraw(TekWidget tw, int x, int y) { - TScreen *screen = &term->screen; + TekScreen *tekscr = TekScreenOf(tw); - if (nplot == 0 || T_lastx != screen->cur_X || T_lasty != screen->cur_Y) { + if (nplot == 0 || T_lastx != tekscr->cur_X || T_lasty != tekscr->cur_Y) { /* * We flush on each unconnected line segment if the line * type is not solid. This solves a bug in X when drawing * points while the line type is not solid. */ - if (nplot > 0 && screen->cur.linetype != SOLIDLINE) - TekFlush(); + if (nplot > 0 && tekscr->cur.linetype != SOLIDLINE) + TekFlush(tw); } - AddToDraw(screen->cur_X, screen->cur_Y, x, y); - T_lastx = screen->cur_X = x; - T_lasty = screen->cur_Y = y; + AddToDraw(tw, tekscr->cur_X, tekscr->cur_Y, x, y); + T_lastx = tekscr->cur_X = x; + T_lasty = tekscr->cur_Y = y; } static void -TekFlush(void) +TekFlush(TekWidget tw) { - TScreen *screen = &term->screen; + TekScreen *tekscr = TekScreenOf(tw); TRACE(("TekFlush\n")); - XDrawSegments(screen->display, TWindow(screen), - ((screen->cur.linetype == SOLIDLINE) ? screen->TnormalGC : - screen->linepat[screen->cur.linetype - 1]), + XDrawSegments(XtDisplay(tw), TWindow(tekscr), + ((tekscr->cur.linetype == SOLIDLINE) + ? tekscr->TnormalGC + : tekscr->linepat[tekscr->cur.linetype - 1]), Tline, nplot); nplot = 0; line_pt = Tline; } void -TekGINoff(void) +TekGINoff(TekWidget tw) { - TScreen *screen = &term->screen; + TekScreen *tekscr = TekScreenOf(tw); TRACE(("TekGINoff\n")); - XDefineCursor(screen->display, TWindow(screen), screen->arrow); + XDefineCursor(XtDisplay(tw), TWindow(tekscr), tekscr->arrow); if (GINcursor) - XFreeCursor(screen->display, GINcursor); - if (screen->TekGIN) { - *screen->TekGIN = CAN; /* modify recording */ - screen->TekGIN = NULL; + XFreeCursor(XtDisplay(tw), GINcursor); + if (tekscr->TekGIN) { + *tekscr->TekGIN = ANSI_CAN; /* modify recording */ + tekscr->TekGIN = NULL; } } void -TekEnqMouse(int c) /* character pressed */ +TekEnqMouse(TekWidget tw, int c) /* character pressed */ { - TScreen *screen = &term->screen; + TekScreen *tekscr = TekScreenOf(tw); + TScreen *screen = TScreenOf(term); int mousex, mousey, rootx, rooty; unsigned int mask; /* XQueryPointer */ Window root, subw; TRACE(("TekEnqMouse\n")); XQueryPointer( - screen->display, TWindow(screen), + XtDisplay(tw), TWindow(tekscr), &root, &subw, &rootx, &rooty, &mousex, &mousey, &mask); - if ((mousex = (int) ((mousex - screen->border) / TekScale(screen))) < 0) + if ((mousex = (int) ((mousex - screen->border) / TekScale(tekscr))) < 0) mousex = 0; else if (mousex >= TEKWIDTH) mousex = TEKWIDTH - 1; if ((mousey = (int) (TEKHEIGHT + TEKTOPPAD - (mousey - screen->border) / - TekScale(screen))) < 0) + TekScale(tekscr))) < 0) mousey = 0; else if (mousey >= TEKHEIGHT) mousey = TEKHEIGHT - 1; - TekEnq((unsigned) c, mousex, mousey); + TekEnq(tw, (unsigned) c, mousex, mousey); } static void -TekEnq(unsigned status, +TekEnq(TekWidget tw, + unsigned status, int x, int y) { - TScreen *screen = &term->screen; + TekScreen *tekscr = TekScreenOf(tw); + TScreen *screen = TScreenOf(term); Char cplot[7]; int len = 5; int adj = (status != 0) ? 0 : 1; @@ -1217,9 +1267,9 @@ TekEnq(unsigned status, cplot[3] = 040 | ((y >> SHIFTHI) & FIVEBITS); cplot[4] = 040 | ((y >> SHIFTLO) & FIVEBITS); - if (screen->gin_terminator != GIN_TERM_NONE) + if (tekscr->gin_terminator != GIN_TERM_NONE) cplot[len++] = '\r'; - if (screen->gin_terminator == GIN_TERM_EOT) + if (tekscr->gin_terminator == GIN_TERM_EOT) cplot[len++] = '\004'; #ifdef VMS tt_write(cplot + adj, len - adj); @@ -1231,34 +1281,35 @@ TekEnq(unsigned status, void TekRun(void) { - TScreen *screen = &term->screen; - - TRACE(("TekRun ...\n")); + if (tekWidget == 0) { + TekInit(); + } + if (tekWidget != 0) { + TRACE(("TekRun ...\n")); - if (!TWindow(screen) && !TekInit()) { - if (VWindow(screen)) { - screen->TekEmu = False; - return; + if (!TEK4014_SHOWN(term)) { + set_tek_visibility(True); } - Exit(ERROR_TINIT); - } - if (!screen->Tshow) { - set_tek_visibility(True); - } - update_vttekmode(); - update_vtshow(); - update_tekshow(); - set_tekhide_sensitivity(); + update_vttekmode(); + update_vtshow(); + update_tekshow(); + set_tekhide_sensitivity(); - Tpushback = Tpushb; - Ttoggled = True; - if (!setjmp(Tekend)) - Tekparse(); - if (!Ttoggled) { - TCursorToggle(TOGGLE); + Tpushback = Tpushb; Ttoggled = True; + if (!setjmp(Tekend)) + Tekparse(tekWidget); + if (!Ttoggled) { + TCursorToggle(tekWidget, TOGGLE); + Ttoggled = True; + } + TEK4014_ACTIVE(term) = False; + } else { + TEK4014_ACTIVE(term) = False; + if (VWindow(&(term->screen)) == 0) { + Exit(ERROR_TINIT); + } } - screen->TekEmu = False; } #define DOTTED_LENGTH 2 @@ -1314,8 +1365,13 @@ TekInitialize(Widget request GCC_UNUSED, HandleLeaveWindow, (Opaque) 0); XtAddEventHandler(tekparent, FocusChangeMask, False, HandleFocusChange, (Opaque) 0); - XtAddEventHandler((Widget) wnew, PropertyChangeMask, False, + XtAddEventHandler(wnew, PropertyChangeMask, False, HandleBellPropertyChange, (Opaque) 0); + +#ifndef NO_ACTIVE_ICON + ((TekWidget) wnew)->screen.whichTwin = &((TekWidget) wnew)->screen.fullTwin; +#endif /* NO_ACTIVE_ICON */ + } static void @@ -1324,7 +1380,8 @@ TekRealize(Widget gw, XSetWindowAttributes * values) { TekWidget tw = (TekWidget) gw; - TScreen *screen = &term->screen; + TekScreen *tekscr = TekScreenOf(tw); + TScreen *screen = TScreenOf(term); int i; TekLink *tek; double d; @@ -1336,16 +1393,21 @@ TekRealize(Widget gw, unsigned TEKgcFontMask; TRACE(("TekRealize\n")); + memset(tekscr, 0, sizeof(tekscr)); #ifndef NO_ACTIVE_ICON - term->screen.whichTwin = &term->screen.fullTwin; + tekscr->whichTwin = &tekscr->fullTwin; #endif /* NO_ACTIVE_ICON */ BorderPixel(tw) = BorderPixel(term); + tekscr->arrow = make_colored_cursor(XC_left_ptr, + T_COLOR(screen, MOUSE_FG), + T_COLOR(screen, MOUSE_BG)); + for (i = 0; i < TEKNUMFONTS; i++) { if (!tw->tek.Tfont[i]) { - tw->tek.Tfont[i] = XQueryFont(screen->display, DefaultGCID); + tw->tek.Tfont[i] = XQueryFont(XtDisplay(tw), DefaultGCID); } TRACE(("Tfont[%d] %dx%d\n", i, @@ -1385,10 +1447,10 @@ TekRealize(Widget gw, (unsigned int *) &height); TRACE(("... position %d,%d size %dx%d\n", winY, winX, height, width)); if ((pr & XValue) && (pr & XNegative)) - winX += DisplayWidth(screen->display, DefaultScreen(screen->display)) + winX += DisplayWidth(XtDisplay(tw), DefaultScreen(XtDisplay(tw))) - width - (BorderWidth(SHELL_OF(term)) * 2); if ((pr & YValue) && (pr & YNegative)) - winY += DisplayHeight(screen->display, DefaultScreen(screen->display)) + winY += DisplayHeight(XtDisplay(tw), DefaultScreen(XtDisplay(tw))) - height - (BorderWidth(SHELL_OF(term)) * 2); /* set up size hints */ @@ -1446,8 +1508,8 @@ TekRealize(Widget gw, values->win_gravity = NorthWestGravity; values->background_pixel = T_COLOR(screen, TEK_BG); - XtWindow(tw) = TWindow(screen) = - XCreateWindow(screen->display, + XtWindow(tw) = TWindow(tekscr) = + XCreateWindow(XtDisplay(tw), XtWindow(SHELL_OF(tw)), tw->core.x, tw->core.y, tw->core.width, tw->core.height, @@ -1457,44 +1519,35 @@ TekRealize(Widget gw, ((*valuemaskp) | CWBackPixel | CWWinGravity), values); - TFullWidth(screen) = width; - TFullHeight(screen) = height; - TWidth(screen) = width - border; - THeight(screen) = height - border; - TekScale(screen) = (double) TWidth(screen) / TEKWIDTH; - if ((d = (double) THeight(screen) / (TEKHEIGHT + TEKTOPPAD + - TEKBOTTOMPAD)) < TekScale(screen)) - TekScale(screen) = d; + TFullWidth(tekscr) = width; + TFullHeight(tekscr) = height; + TWidth(tekscr) = width - border; + THeight(tekscr) = height - border; + TekScale(tekscr) = (double) TWidth(tekscr) / TEKWIDTH; + if ((d = (double) THeight(tekscr) / (TEKHEIGHT + TEKTOPPAD + + TEKBOTTOMPAD)) < TekScale(tekscr)) + TekScale(tekscr) = d; - screen->cur.fontsize = TEK_FONT_LARGE; + tekscr->cur.fontsize = TEK_FONT_LARGE; if (tw->tek.initial_font) { - char *s = tw->tek.initial_font; - - if (XmuCompareISOLatin1(s, "large") == 0) - screen->cur.fontsize = TEK_FONT_LARGE; - else if (XmuCompareISOLatin1(s, "2") == 0 || - XmuCompareISOLatin1(s, "two") == 0) - screen->cur.fontsize = TEK_FONT_2; - else if (XmuCompareISOLatin1(s, "3") == 0 || - XmuCompareISOLatin1(s, "three") == 0) - screen->cur.fontsize = TEK_FONT_3; - else if (XmuCompareISOLatin1(s, "small") == 0) - screen->cur.fontsize = TEK_FONT_SMALL; + int result = TekGetFontSize(tw->tek.initial_font); + if (result >= 0) + tekscr->cur.fontsize = result; } #define TestGIN(s) XmuCompareISOLatin1(tw->tek.gin_terminator_str, s) if (TestGIN(GIN_TERM_NONE_STR) == 0) - screen->gin_terminator = GIN_TERM_NONE; + tekscr->gin_terminator = GIN_TERM_NONE; else if (TestGIN(GIN_TERM_CR_STR) == 0) - screen->gin_terminator = GIN_TERM_CR; + tekscr->gin_terminator = GIN_TERM_CR; else if (TestGIN(GIN_TERM_EOT_STR) == 0) - screen->gin_terminator = GIN_TERM_EOT; + tekscr->gin_terminator = GIN_TERM_EOT; else fprintf(stderr, "%s: illegal GIN terminator setting \"%s\"\n", xterm_name, tw->tek.gin_terminator_str); gcv.graphics_exposures = True; /* default */ - gcv.font = tw->tek.Tfont[screen->cur.fontsize]->fid; + gcv.font = tw->tek.Tfont[tekscr->cur.fontsize]->fid; gcv.foreground = T_COLOR(screen, TEK_FG); gcv.background = T_COLOR(screen, TEK_BG); @@ -1502,7 +1555,7 @@ TekRealize(Widget gw, the Default GC's ID, meaning that we must use the server default font. */ TEKgcFontMask = (gcv.font == DefaultGCID) ? 0 : GCFont; - screen->TnormalGC = XCreateGC(screen->display, TWindow(screen), + tekscr->TnormalGC = XCreateGC(XtDisplay(tw), TWindow(tekscr), (TEKgcFontMask | GCGraphicsExposures | GCForeground | GCBackground), &gcv); @@ -1512,25 +1565,25 @@ TekRealize(Widget gw, T_COLOR(screen, TEK_CURSOR)); gcv.join_style = JoinMiter; /* default */ gcv.line_width = 1; - screen->TcursorGC = XCreateGC(screen->display, TWindow(screen), + tekscr->TcursorGC = XCreateGC(XtDisplay(tw), TWindow(tekscr), (GCFunction | GCPlaneMask), &gcv); gcv.foreground = T_COLOR(screen, TEK_FG); gcv.line_style = LineOnOffDash; gcv.line_width = 0; for (i = 0; i < TEKNUMLINES; i++) { - screen->linepat[i] = XCreateGC(screen->display, TWindow(screen), + tekscr->linepat[i] = XCreateGC(XtDisplay(tw), TWindow(tekscr), (GCForeground | GCLineStyle), &gcv); - XSetDashes(screen->display, screen->linepat[i], 0, + XSetDashes(XtDisplay(tw), tekscr->linepat[i], 0, (char *) dashes[i], dash_length[i]); } - TekBackground(screen); + TekBackground(tw, screen); - screen->margin = MARGIN1; /* Margin 1 */ - screen->TekGIN = False; /* GIN off */ + tekscr->margin = MARGIN1; /* Margin 1 */ + tekscr->TekGIN = False; /* GIN off */ - XDefineCursor(screen->display, TWindow(screen), screen->pointer_cursor); + XDefineCursor(XtDisplay(tw), TWindow(tekscr), tekscr->arrow); { /* there's gotta be a better way... */ static Arg args[] = @@ -1558,53 +1611,81 @@ TekRealize(Widget gw, tek = TekRecord = &Tek0; tek->next = (TekLink *) 0; - tek->fontsize = screen->cur.fontsize; + tek->fontsize = tekscr->cur.fontsize; tek->count = 0; tek->ptr = tek->data; Tpushback = Tpushb; - screen->cur_X = 0; - screen->cur_Y = TEKHOME; + tekscr->cur_X = 0; + tekscr->cur_Y = TEKHOME; line_pt = Tline; Ttoggled = True; - screen->page = screen->cur; + tekscr->page = tekscr->cur; return; } -void -TekSetFontSize(int newitem) +int +TekGetFontSize(const char *param) { - TScreen *screen = &term->screen; - int oldsize = screen->cur.fontsize; - int newsize = MI2FS(newitem); - Font fid; + int result; + + if (XmuCompareISOLatin1(param, "l") == 0 || + XmuCompareISOLatin1(param, "large") == 0) + result = TEK_FONT_LARGE; + else if (XmuCompareISOLatin1(param, "2") == 0 || + XmuCompareISOLatin1(param, "two") == 0) + result = TEK_FONT_2; + else if (XmuCompareISOLatin1(param, "3") == 0 || + XmuCompareISOLatin1(param, "three") == 0) + result = TEK_FONT_3; + else if (XmuCompareISOLatin1(param, "s") == 0 || + XmuCompareISOLatin1(param, "small") == 0) + result = TEK_FONT_SMALL; + else + result = -1; - TRACE(("TekSetFontSize(%d)\n", newitem)); + return result; +} - if (!tekWidget || oldsize == newsize) - return; - if (!Ttoggled) - TCursorToggle(TOGGLE); - set_tekfont_menu_item(oldsize, False); - - fid = tekWidget->tek.Tfont[newsize]->fid; - if (fid == DefaultGCID) - /* we didn't succeed in opening a real font - for this size. Instead, use server default. */ - XCopyGC(screen->display, - DefaultGC(screen->display, DefaultScreen(screen->display)), - GCFont, screen->TnormalGC); - else - XSetFont(screen->display, screen->TnormalGC, fid); +void +TekSetFontSize(TekWidget tw, int newitem) +{ + if (tw != 0) { + TekScreen *tekscr = TekScreenOf(tw); + int oldsize = tekscr->cur.fontsize; + int newsize = MI2FS(newitem); + Font fid; + + TRACE(("TekSetFontSize(%d)\n", newitem)); + if (newsize < 0 || newsize >= TEKNUMFONTS) { + Bell(XkbBI_MinorError, 0); + } else if (oldsize != newsize) { + if (!Ttoggled) + TCursorToggle(tw, TOGGLE); + set_tekfont_menu_item(oldsize, False); + + fid = tw->tek.Tfont[newsize]->fid; + if (fid == DefaultGCID) { + /* we didn't succeed in opening a real font + for this size. Instead, use server default. */ + XCopyGC(XtDisplay(tw), + DefaultGC(XtDisplay(tw), DefaultScreen(XtDisplay(tw))), + GCFont, tekscr->TnormalGC); + } else { + XSetFont(XtDisplay(tw), tekscr->TnormalGC, fid); + } - screen->cur.fontsize = newsize; - set_tekfont_menu_item(newsize, True); - if (!Ttoggled) - TCursorToggle(TOGGLE); + tekscr->cur.fontsize = newsize; + set_tekfont_menu_item(newsize, True); + if (!Ttoggled) + TCursorToggle(tw, TOGGLE); + } + } } void -ChangeTekColors(TScreen * screen, ScrnColors * pNew) +ChangeTekColors(TekWidget tw, TScreen * screen, ScrnColors * pNew) { + TekScreen *tekscr = TekScreenOf(tw); int i; XGCValues gcv; @@ -1624,36 +1705,38 @@ ChangeTekColors(TScreen * screen, ScrnColors * pNew) TRACE(("... TEK_CURSOR: %#lx\n", T_COLOR(screen, TEK_CURSOR))); } - if (tekWidget) { - XSetForeground(screen->display, screen->TnormalGC, + if (tw) { + XSetForeground(XtDisplay(tw), tekscr->TnormalGC, T_COLOR(screen, TEK_FG)); - XSetBackground(screen->display, screen->TnormalGC, + XSetBackground(XtDisplay(tw), tekscr->TnormalGC, T_COLOR(screen, TEK_BG)); - if (BorderPixel(tekWidget) == T_COLOR(screen, TEK_BG)) { - BorderPixel(tekWidget) = T_COLOR(screen, TEK_FG); - BorderPixel(XtParent(tekWidget)) = T_COLOR(screen, TEK_FG); - if (XtWindow(XtParent(tekWidget))) - XSetWindowBorder(screen->display, - XtWindow(XtParent(tekWidget)), - BorderPixel(tekWidget)); + if (BorderPixel(tw) == T_COLOR(screen, TEK_BG)) { + BorderPixel(tw) = T_COLOR(screen, TEK_FG); + BorderPixel(XtParent(tw)) = T_COLOR(screen, TEK_FG); + if (XtWindow(XtParent(tw))) + XSetWindowBorder(XtDisplay(tw), + XtWindow(XtParent(tw)), + BorderPixel(tw)); } for (i = 0; i < TEKNUMLINES; i++) { - XSetForeground(screen->display, screen->linepat[i], + XSetForeground(XtDisplay(tw), tekscr->linepat[i], T_COLOR(screen, TEK_FG)); } gcv.plane_mask = (T_COLOR(screen, TEK_BG) ^ T_COLOR(screen, TEK_CURSOR)); - XChangeGC(screen->display, screen->TcursorGC, GCPlaneMask, &gcv); - TekBackground(screen); + XChangeGC(XtDisplay(tw), tekscr->TcursorGC, GCPlaneMask, &gcv); + TekBackground(tw, screen); } return; } void -TekReverseVideo(TScreen * screen) +TekReverseVideo(TekWidget tw) { + TScreen *screen = TScreenOf(term); + TekScreen *tekscr = TekScreenOf(tw); int i; XGCValues gcv; @@ -1661,36 +1744,38 @@ TekReverseVideo(TScreen * screen) T_COLOR(screen, TEK_CURSOR) = T_COLOR(screen, TEK_FG); - if (tekWidget) { - XSetForeground(screen->display, screen->TnormalGC, T_COLOR(screen, TEK_FG)); - XSetBackground(screen->display, screen->TnormalGC, T_COLOR(screen, TEK_BG)); - - if (BorderPixel(tekWidget) == T_COLOR(screen, TEK_BG)) { - BorderPixel(tekWidget) = T_COLOR(screen, TEK_FG); - BorderPixel(XtParent(tekWidget)) = T_COLOR(screen, TEK_FG); - if (XtWindow(XtParent(tekWidget))) - XSetWindowBorder(screen->display, - XtWindow(XtParent(tekWidget)), - BorderPixel(tekWidget)); + if (tw) { + XSetForeground(XtDisplay(tw), tekscr->TnormalGC, T_COLOR(screen, TEK_FG)); + XSetBackground(XtDisplay(tw), tekscr->TnormalGC, T_COLOR(screen, TEK_BG)); + + if (BorderPixel(tw) == T_COLOR(screen, TEK_BG)) { + BorderPixel(tw) = T_COLOR(screen, TEK_FG); + BorderPixel(XtParent(tw)) = T_COLOR(screen, TEK_FG); + if (XtWindow(XtParent(tw))) + XSetWindowBorder(XtDisplay(tw), + XtWindow(XtParent(tw)), + BorderPixel(tw)); } for (i = 0; i < TEKNUMLINES; i++) { - XSetForeground(screen->display, screen->linepat[i], + XSetForeground(XtDisplay(tw), tekscr->linepat[i], T_COLOR(screen, TEK_FG)); } gcv.plane_mask = (T_COLOR(screen, TEK_BG) ^ T_COLOR(screen, TEK_CURSOR)); - XChangeGC(screen->display, screen->TcursorGC, GCPlaneMask, &gcv); - TekBackground(screen); + XChangeGC(XtDisplay(tw), tekscr->TcursorGC, GCPlaneMask, &gcv); + TekBackground(tw, screen); } } static void -TekBackground(TScreen * screen) +TekBackground(TekWidget tw, TScreen * screen) { - if (TWindow(screen)) - XSetWindowBackground(screen->display, TWindow(screen), + TekScreen *tekscr = TekScreenOf(tw); + + if (TWindow(tekscr)) + XSetWindowBackground(XtDisplay(tw), TWindow(tekscr), T_COLOR(screen, TEK_BG)); } @@ -1698,32 +1783,33 @@ TekBackground(TScreen * screen) * Toggles cursor on or off at cursor position in screen. */ void -TCursorToggle(int toggle) /* TOGGLE or CLEAR */ +TCursorToggle(TekWidget tw, int toggle) /* TOGGLE or CLEAR */ { - TScreen *screen = &term->screen; + TekScreen *tekscr = TekScreenOf(tw); + TScreen *screen = TScreenOf(term); int c, x, y; unsigned int cellwidth, cellheight; - if (!screen->Tshow) + if (!TEK4014_SHOWN(term)) return; - c = screen->cur.fontsize; - cellwidth = (unsigned) tekWidget->tek.Tfont[c]->max_bounds.width; - cellheight = (unsigned) (tekWidget->tek.Tfont[c]->ascent + - tekWidget->tek.Tfont[c]->descent); + c = tekscr->cur.fontsize; + cellwidth = (unsigned) tw->tek.Tfont[c]->max_bounds.width; + cellheight = (unsigned) (tw->tek.Tfont[c]->ascent + + tw->tek.Tfont[c]->descent); - x = (int) ((screen->cur_X * TekScale(screen)) + screen->border); - y = (int) (((TEKHEIGHT + TEKTOPPAD - screen->cur_Y) * TekScale(screen)) - + screen->border - tekWidget->tek.tobaseline[c]); + x = (int) ((tekscr->cur_X * TekScale(tekscr)) + screen->border); + y = (int) (((TEKHEIGHT + TEKTOPPAD - tekscr->cur_Y) * TekScale(tekscr)) + + screen->border - tw->tek.tobaseline[c]); if (toggle == TOGGLE) { if (screen->select || screen->always_highlight) - XFillRectangle(screen->display, TWindow(screen), - screen->TcursorGC, x, y, + XFillRectangle(XtDisplay(tw), TWindow(tekscr), + tekscr->TcursorGC, x, y, cellwidth, cellheight); else { /* fix to use different GC! */ - XDrawRectangle(screen->display, TWindow(screen), - screen->TcursorGC, x, y, + XDrawRectangle(XtDisplay(tw), TWindow(tekscr), + tekscr->TcursorGC, x, y, cellwidth - 1, cellheight - 1); } } else { @@ -1733,33 +1819,34 @@ TCursorToggle(int toggle) /* TOGGLE or CLEAR */ * event and is easier than trying to figure out exactly * which part of the cursor needs to be erased. */ - XClearArea(screen->display, TWindow(screen), x, y, + XClearArea(XtDisplay(tw), TWindow(tekscr), x, y, cellwidth, cellheight, False); } } void -TekSimulatePageButton(Bool reset) +TekSimulatePageButton(TekWidget tw, Bool reset) { - TScreen *screen = &term->screen; + if (tw != 0) { + TekScreen *tekscr = TekScreenOf(tw); - if (!tekWidget) - return; - if (reset) { - bzero((char *) &screen->cur, sizeof screen->cur); + if (reset) { + bzero((char *) &tekscr->cur, sizeof tekscr->cur); + } + tekRefreshList = (TekLink *) 0; + TekPage(tw); + tekscr->cur_X = 0; + tekscr->cur_Y = TEKHOME; } - TekRefresh = (TekLink *) 0; - TekPage(); - screen->cur_X = 0; - screen->cur_Y = TEKHOME; } /* write copy of screen to a file */ void -TekCopy(void) +TekCopy(TekWidget tw) { - TScreen *screen = &term->screen; + TekScreen *tekscr = TekScreenOf(tw); + TScreen *screen = TScreenOf(term); TekLink *Tp; char buf[32]; @@ -1781,8 +1868,8 @@ TekCopy(void) if ((tekcopyfd = open_userfile(screen->uid, screen->gid, buf, False)) >= 0) { sprintf(initbuf, "%c%c%c%c", - ESC, (char) (screen->page.fontsize + '8'), - ESC, (char) (screen->page.linetype + '`')); + ANSI_ESC, (char) (tekscr->page.fontsize + '8'), + ANSI_ESC, (char) (tekscr->page.linetype + '`')); write(tekcopyfd, initbuf, 4); Tp = &Tek0; do { @@ -1792,3 +1879,36 @@ TekCopy(void) close(tekcopyfd); } } + +/*ARGSUSED*/ +void +HandleGINInput(Widget w, + XEvent * event GCC_UNUSED, + String * param_list, + Cardinal *nparamsp) +{ + if (IsTekWidget(w)) { + TekWidget tw = (TekWidget) w; + TekScreen *tekscr = TekScreenOf(tw); + + if (tekscr->TekGIN && *nparamsp == 1) { + int c = param_list[0][0]; + switch (c) { + case 'l': + case 'm': + case 'r': + case 'L': + case 'M': + case 'R': + break; + default: + Bell(XkbBI_MinorError, 0); /* let them know they goofed */ + c = 'l'; /* provide a default */ + } + TekEnqMouse(tw, c | 0x80); + TekGINoff(tw); + } else { + Bell(XkbBI_MinorError, 0); + } + } +} diff --git a/app/xterm/XTerm.ad b/app/xterm/XTerm.ad index dafef5f25..8d829f048 100644 --- a/app/xterm/XTerm.ad +++ b/app/xterm/XTerm.ad @@ -1,4 +1,4 @@ -! $XTermId: XTerm.ad,v 1.81 2006/06/24 14:34:45 tom Exp $ +! $XTermId: XTerm.ad,v 1.83 2007/03/18 22:41:40 tom Exp $ ! $XFree86: xc/programs/xterm/XTerm.ad,v 3.37 2006/04/10 00:34:36 dickey Exp $ *scrollBar: true @@ -31,6 +31,7 @@ *mainMenu*sunKeyboard*Label: VT220 Keyboard *mainMenu*hpFunctionKeys*Label: HP Function-Keys *mainMenu*scoFunctionKeys*Label: SCO Function-Keys +*mainMenu*tcapFunctionKeys*Label: Termcap Function-Keys *mainMenu*suspend*Label: Send STOP Signal *mainMenu*continue*Label: Send CONT Signal *mainMenu*interrupt*Label: Send INT Signal @@ -54,8 +55,8 @@ *vtMenu*selectToClipboard*Label: Select to Clipboard *vtMenu*cursesemul*Label: Enable Curses Emulation *vtMenu*visualbell*Label: Enable Visual Bell +*vtMenu*bellIsUrgent*Label: Enable Bell Urgency *vtMenu*poponbell*Label: Enable Pop on Bell -*vtMenu*marginbell*Label: Enable Margin Bell *vtMenu*cursorblink*Label: Enable Blinking Cursor *vtMenu*titeInhibit*Label: Enable Alternate Screen Switching *vtMenu*activeicon*Label: Enable Active Icon diff --git a/app/xterm/data.h b/app/xterm/data.h index 24ff77f63..73ac717cb 100644 --- a/app/xterm/data.h +++ b/app/xterm/data.h @@ -1,9 +1,9 @@ -/* $XTermId: data.h,v 1.95 2006/07/15 12:05:25 tom Exp $ */ +/* $XTermId: data.h,v 1.101 2007/03/16 23:46:24 tom Exp $ */ /* $XFree86: xc/programs/xterm/data.h,v 3.39 2006/02/13 01:14:58 dickey Exp $ */ /* - * Copyright 2002-2005,2006 by Thomas E. Dickey + * Copyright 2002-2006,2007 by Thomas E. Dickey * * All Rights Reserved * @@ -80,7 +80,7 @@ extern struct q_head read_queue; #if OPT_TEK4014 extern Char *Tpushb; extern Char *Tpushback; -extern TekLink *TekRefresh; +extern TekLink *tekRefreshList; extern TekWidget tekWidget; extern Widget tekshellwidget; extern int T_lastx; @@ -94,15 +94,6 @@ extern char *ttydev; extern char *xterm_name; extern int hold_screen; -#if OPT_ZICONBEEP -extern int zIconBeep; -extern Boolean zIconBeep_flagged; -#endif - -#if OPT_SAME_NAME -extern Boolean sameName; -#endif - extern PtyData *VTbuffer; extern int am_slave; extern int max_plus1; @@ -116,10 +107,6 @@ extern PtySelect Select_mask; extern PtySelect X_mask; extern PtySelect pty_mask; -extern Boolean waitingForTrackInfo; - -extern EventMode eventMode; - extern XtermWidget term; @@ -141,7 +128,6 @@ extern SIG_ATOMIC_T need_cleanup; extern char *ProgramName; extern Arg ourTopLevelShellArgs[]; extern Cardinal number_ourTopLevelShellArgs; -extern Bool waiting_for_initial_map; extern Atom wm_delete_window; typedef struct XTERM_RESOURCE { @@ -160,6 +146,8 @@ typedef struct XTERM_RESOURCE { Boolean utmpDisplayId; Boolean messages; + String menuLocale; + String keyboardType; #if OPT_SUNPC_KBD Boolean sunKeyboard; @@ -173,6 +161,9 @@ typedef struct XTERM_RESOURCE { #if OPT_SUN_FUNC_KEYS Boolean sunFunctionKeys; /* %%% should be VT100 widget resource? */ #endif +#if OPT_TCAP_FKEYS + Boolean termcapKeys; +#endif #if OPT_INITIAL_ERASE Boolean ptyInitialErase; /* if true, use pty's sense of erase char */ diff --git a/app/xterm/main.c b/app/xterm/main.c index d3618bc6d..bed1da7cd 100644 --- a/app/xterm/main.c +++ b/app/xterm/main.c @@ -1,4 +1,4 @@ -/* $XTermId: main.c,v 1.522 2006/08/03 22:20:15 tom Exp $ */ +/* $XTermId: main.c,v 1.557 2007/03/24 15:26:47 tom Exp $ */ /* * W A R N I N G @@ -15,7 +15,7 @@ /*********************************************************** -Copyright 2002-2005,2006 by Thomas E. Dickey +Copyright 2002-2006,2007 by Thomas E. Dickey All Rights Reserved @@ -120,6 +120,7 @@ SOFTWARE. #include <menu.h> #include <main.h> #include <xstrings.h> +#include <xtermcap.h> #include <xterm_io.h> #if OPT_WIDE_CHARS @@ -269,7 +270,8 @@ static Bool IsPts = False; #else #define USE_SYSV_PGRP extern __inline__ -ttyslot() +int +ttyslot(void) { return 1; /* yuk */ } @@ -443,19 +445,9 @@ extern char *ttyname(); extern char *ptsname(int); #endif -#ifdef __cplusplus -extern "C" { -#endif - - extern int tgetent(char *ptr, char *name); - extern char *tgetstr(char *name, char **ptr); - -#ifdef __cplusplus -} -#endif #ifndef VMS static SIGNAL_T reapchild(int n); -static int spawn(void); +static int spawnXTerm(XtermWidget /* xw */ ); static void remove_termcap_entry(char *buf, char *str); #ifdef USE_PTY_SEARCH static int pty_search(int *pty); @@ -463,8 +455,7 @@ static int pty_search(int *pty); #endif /* ! VMS */ static int get_pty(int *pty, char *from); -static void get_terminal(void); -static void resize(TScreen * s, char *oldtc, char *newtc); +static void resize_termcap(XtermWidget xw, char *newtc); static void set_owner(char *device, uid_t uid, gid_t gid, mode_t mode); static Bool added_utmp_entry = False; @@ -491,7 +482,7 @@ static char *explicit_shname = NULL; ** Ordinarily it should be okay to omit the assignment in the following ** statement. Apparently the c89 compiler on AIX 4.1.3 has a bug, or does ** it? Without the assignment though the compiler will init command_to_exec -** to 0xffffffff instead of NULL; and subsequent usage, e.g. in spawn() to +** to 0xffffffff instead of NULL; and subsequent usage, e.g. in spawnXTerm() to ** SEGV. */ static char **command_to_exec = NULL; @@ -758,6 +749,7 @@ static XtResource application_resources[] = Bres("messages", "Messages", messages, True), Ires("minBufSize", "MinBufSize", minBufSize, 4096), Ires("maxBufSize", "MaxBufSize", maxBufSize, 32768), + Sres("menuLocale", "MenuLocale", menuLocale, ""), Sres("keyboardType", "KeyboardType", keyboardType, "unknown"), #if OPT_SUNPC_KBD Bres("sunKeyboard", "SunKeyboard", sunKeyboard, False), @@ -771,6 +763,9 @@ static XtResource application_resources[] = #if OPT_SUN_FUNC_KEYS Bres("sunFunctionKeys", "SunFunctionKeys", sunFunctionKeys, False), #endif +#if OPT_TCAP_FKEYS + Bres("tcapFunctionKeys", "TcapFunctionKeys", termcapKeys, False), +#endif #if OPT_INITIAL_ERASE #ifndef __OpenBSD__ Bres("ptyInitialErase", "PtyInitialErase", ptyInitialErase, DEF_INITIAL_ERASE), @@ -870,6 +865,8 @@ static XrmOptionDescRec optionDescList[] = { #endif #if OPT_HIGHLIGHT_COLOR {"-hc", "*highlightColor", XrmoptionSepArg, (caddr_t) NULL}, +{"-selfg", "*highlightTextColor", XrmoptionSepArg, (caddr_t) NULL}, +{"-selbg", "*highlightColor", XrmoptionSepArg, (caddr_t) NULL}, #endif #if OPT_HP_FUNC_KEYS {"-hf", "*hpFunctionKeys",XrmoptionNoArg, (caddr_t) "on"}, @@ -1052,7 +1049,8 @@ static OptionHelp xtermOptions[] = { { "-/+cu", "turn on/off curses emulation" }, { "-/+dc", "turn off/on dynamic color selection" }, #if OPT_HIGHLIGHT_COLOR -{ "-hc color", "selection background color" }, +{ "-selbg color", "selection background color" }, +{ "-selfg color", "selection foreground color" }, #endif #if OPT_HP_FUNC_KEYS { "-/+hf", "turn on/off HP Function Key escape codes" }, @@ -1179,7 +1177,7 @@ decode_keyvalue(char **ptr, int termcap) if (*string == '^') { switch (*++string) { case '?': - value = A2E(DEL); + value = A2E(ANSI_DEL); break; case '-': if (!termcap) { @@ -1223,36 +1221,6 @@ decode_keyvalue(char **ptr, int termcap) return value; } -/* - * If we're linked to terminfo, tgetent() will return an empty buffer. We - * cannot use that to adjust the $TERMCAP variable. - */ -static Bool -get_termcap(char *name, char *buffer, char *resized) -{ - TScreen *screen = &term->screen; - - *buffer = 0; /* initialize, in case we're using terminfo's tgetent */ - - if (name != 0) { - if (tgetent(buffer, name) == 1) { - TRACE(("get_termcap(%s) succeeded (%s)\n", name, - (*buffer - ? "ok:termcap, we can update $TERMCAP" - : "assuming this is terminfo"))); - if (*buffer) { - if (!TEK4014_ACTIVE(screen)) { - resize(screen, buffer, resized); - } - } - return True; - } else { - *buffer = 0; /* just in case */ - } - } - return False; -} - static int abbrev(char *tst, char *cmp, size_t need) { @@ -1363,7 +1331,7 @@ DeleteWindow(Widget w, { #if OPT_TEK4014 if (w == toplevel) { - if (term->screen.Tshow) + if (TEK4014_SHOWN(term)) hide_vt_window(); else do_hangup(w, (XtPointer) 0, (XtPointer) 0); @@ -1588,32 +1556,38 @@ posix_signal(int signo, sigfunc func) static void disableSetUid(void) { - TRACE(("disableSetUid\n")); + TRACE(("process %d disableSetUid\n", (int) getpid())); if (setuid(save_ruid) == -1) { fprintf(stderr, "%s: unable to reset uid\n", ProgramName); exit(1); } TRACE_IDS; } -#endif +#else +#define disableSetUid() /* nothing */ +#endif /* DISABLE_SETUID */ -#if defined(USE_UTMP_SETGID) +#if defined(DISABLE_SETGID) || defined(USE_UTMP_SETGID) static void disableSetGid(void) { - TRACE(("disableSetGid\n")); + TRACE(("process %d disableSetGid\n", (int) getpid())); if (setegid(save_rgid) == -1) { fprintf(stderr, "%s: unable to reset effective gid\n", ProgramName); exit(1); } TRACE_IDS; } -#endif /* USE_UTMP_SETGID */ +#else +#define disableSetGid() /* nothing */ +#endif /* DISABLE_SETGID */ -#if defined(HAVE_POSIX_SAVED_IDS) && !defined(USE_UTEMPTER) +#if defined(HAVE_POSIX_SAVED_IDS) +#if (!defined(USE_UTEMPTER) || !defined(DISABLE_SETGID)) static void setEffectiveGroup(gid_t group) { + TRACE(("process %d setEffectiveGroup(%d)\n", (int) getpid(), (int) group)); if (setegid(group) == -1) { #ifdef __MVS__ if (!(errno == EMVSERR)) /* could happen if _BPX_SHAREAS=REUSE */ @@ -1625,11 +1599,13 @@ setEffectiveGroup(gid_t group) } TRACE_IDS; } +#endif -#if !defined(USE_UTMP_SETGID) +#if !defined(USE_UTMP_SETGID) && (!defined(USE_UTEMPTER) || !defined(DISABLE_SETUID)) static void setEffectiveUser(uid_t user) { + TRACE(("process %d setEffectiveUser(%d)\n", (int) getpid(), (int) user)); if (seteuid(user) == -1) { #ifdef __MVS__ if (!(errno == EMVSERR)) @@ -1641,7 +1617,7 @@ setEffectiveUser(uid_t user) } TRACE_IDS; } -#endif /* !USE_UTMP_SETGID */ +#endif #endif /* HAVE_POSIX_SAVED_IDS */ int @@ -1653,6 +1629,9 @@ main(int argc, char *argv[]ENVP_ARG) int mode; char *my_class = DEFCLASS; Window winToEmbedInto = None; +#if OPT_COLOR_RES + Bool reversed = False; +#endif ProgramName = argv[0]; @@ -1664,8 +1643,13 @@ main(int argc, char *argv[]ENVP_ARG) save_ruid = getuid(); save_rgid = getgid(); -#ifdef DISABLE_SETUID +#if defined(DISABLE_SETUID) || defined(DISABLE_SETGID) +#if defined(DISABLE_SETUID) disableSetUid(); +#endif +#if defined(DISABLE_SETGID) + disableSetGid(); +#endif TRACE_IDS; #endif @@ -1718,6 +1702,14 @@ main(int argc, char *argv[]ENVP_ARG) } unique = 3; } else { +#if OPT_COLOR_RES + if (abbrev(argv[n], "-reverse", 2) + || !strcmp("-rv", argv[n])) { + reversed = True; + } else if (!strcmp("+rv", argv[n])) { + reversed = False; + } +#endif quit = False; unique = 3; } @@ -1829,7 +1821,7 @@ main(int argc, char *argv[]ENVP_ARG) d_tio.c_cflag &= ~(HUPCL | PARENB); #endif d_tio.c_cc[VINTR] = CONTROL('C'); /* '^C' */ - d_tio.c_cc[VERASE] = DEL; /* DEL */ + d_tio.c_cc[VERASE] = ANSI_DEL; /* DEL */ d_tio.c_cc[VKILL] = CONTROL('U'); /* '^U' */ d_tio.c_cc[VQUIT] = CQUIT; /* '^\' */ d_tio.c_cc[VEOF] = CEOF; /* '^D' */ @@ -1993,15 +1985,19 @@ main(int argc, char *argv[]ENVP_ARG) XtNumber(application_resources), NULL, 0); TRACE_XRES(); -#if defined(HAVE_POSIX_SAVED_IDS) && !defined(USE_UTMP_SETGID) && !defined(DISABLE_SETUID) +#if defined(HAVE_POSIX_SAVED_IDS) && !defined(USE_UTMP_SETGID) +#if !defined(DISABLE_SETUID) || !defined(DISABLE_SETGID) +#if !defined(DISABLE_SETUID) setEffectiveUser(save_euid); +#endif +#if !defined(DISABLE_SETGID) setEffectiveGroup(save_egid); +#endif TRACE_IDS; #endif +#endif } - waiting_for_initial_map = resource.wait_for_map; - /* * ICCCM delete_window. */ @@ -2020,17 +2016,12 @@ main(int argc, char *argv[]ENVP_ARG) } } #if OPT_ZICONBEEP - zIconBeep = resource.zIconBeep; - zIconBeep_flagged = False; - if (zIconBeep > 100 || zIconBeep < -100) { - zIconBeep = 0; /* was 100, but I prefer to defaulting off. */ + if (resource.zIconBeep > 100 || resource.zIconBeep < -100) { + resource.zIconBeep = 0; /* was 100, but I prefer to defaulting off. */ fprintf(stderr, "a number between -100 and 100 is required for zIconBeep. 0 used by default\n"); } #endif /* OPT_ZICONBEEP */ -#if OPT_SAME_NAME - sameName = resource.sameName; -#endif hold_screen = resource.hold_screen ? 1 : 0; xterm_name = resource.xterm_name; if (strcmp(xterm_name, "-") == 0) @@ -2159,7 +2150,7 @@ main(int argc, char *argv[]ENVP_ARG) (XtPointer) 0); decode_keyboard_type(term, &resource); - screen = &term->screen; + screen = TScreenOf(term); screen->inhibit = 0; #ifdef ALLOWLOGGING @@ -2178,9 +2169,9 @@ main(int argc, char *argv[]ENVP_ARG) */ #if OPT_TEK4014 if (screen->inhibit & I_TEK) - screen->TekEmu = False; + TEK4014_ACTIVE(term) = False; - if (screen->TekEmu && !TekInit()) + if (TEK4014_ACTIVE(term) && !TekInit()) SysError(ERROR_INIT); #endif @@ -2277,10 +2268,7 @@ main(int argc, char *argv[]ENVP_ARG) } #endif /* DEBUG */ - /* open a terminal for client */ - get_terminal(); - - spawn(); + spawnXTerm(term); #ifndef VMS /* Child process is out there, let's catch its termination */ @@ -2296,7 +2284,7 @@ main(int argc, char *argv[]ENVP_ARG) char buf[80]; buf[0] = '\0'; - sprintf(buf, "%lx\n", XtWindow(SHELL_OF(CURRENT_EMU(screen)))); + sprintf(buf, "%lx\n", XtWindow(SHELL_OF(CURRENT_EMU()))); write(screen->respond, buf, strlen(buf)); } #ifdef AIXV3 @@ -2342,6 +2330,7 @@ main(int argc, char *argv[]ENVP_ARG) #else screen->dabbrev_erase_char = d_sg.sg_erase; #endif + TRACE(("set dabbrev erase_char %#x\n", screen->dabbrev_erase_char)); #endif FD_ZERO(&pty_mask); @@ -2387,7 +2376,7 @@ main(int argc, char *argv[]ENVP_ARG) NonNull(term->screen.Tcolors[TEXT_FG].resource), NonNull(term->screen.Tcolors[TEXT_BG].resource))); - if ((term->misc.re_verse) + if ((reversed && term->misc.re_verse0) && ((term->screen.Tcolors[TEXT_FG].resource && (x_strcasecmp(term->screen.Tcolors[TEXT_FG].resource, XtDefaultForeground) != 0) @@ -2402,7 +2391,7 @@ main(int argc, char *argv[]ENVP_ARG) for (;;) { #if OPT_TEK4014 - if (screen->TekEmu) + if (TEK4014_ACTIVE(term)) TekRun(); else #endif @@ -2464,8 +2453,8 @@ get_pty(int *pty, char *from GCC_UNUSED) Since we can open either a /dev/ttyp? or a /dev/pts??? device, the flag "IsPts" is set here so that we know which type of - device we're dealing with in routine spawn(). That's the reason - for the "if (IsPts)" statement in spawn(); we have two different + device we're dealing with in routine spawnXTerm(). That's the reason + for the "if (IsPts)" statement in spawnXTerm(); we have two different device types which need to be handled differently. */ result = pty_search(pty); @@ -2692,19 +2681,6 @@ pty_search(int *pty) #endif /* USE_PTY_SEARCH */ /* - * sets up X and initializes the terminal structure except for term.buf.fildes. - */ -static void -get_terminal(void) -{ - TScreen *screen = &term->screen; - - screen->arrow = make_colored_cursor(XC_left_ptr, - T_COLOR(screen, MOUSE_FG), - T_COLOR(screen, MOUSE_BG)); -} - -/* * The only difference in /etc/termcap between 4014 and 4015 is that * the latter has support for switching character sets. We support the * 4015 protocol, but ignore the character switches. Therefore, we @@ -2812,7 +2788,7 @@ void first_map_occurred(void) { handshake_t handshake; - TScreen *screen = &term->screen; + TScreen *screen = TScreenOf(term); handshake.status = PTY_EXEC; handshake.rows = screen->max_row; @@ -2820,7 +2796,7 @@ first_map_occurred(void) write(pc_pipe[1], (char *) &handshake, sizeof(handshake)); close(cp_pipe[0]); close(pc_pipe[1]); - waiting_for_initial_map = False; + resource.wait_for_map = False; } #else /* @@ -2935,18 +2911,21 @@ find_utmp(struct UTMP_STR *tofind) * If slave, the pty named in passedPty is already open for use */ static int -spawn(void) +spawnXTerm(XtermWidget xw) { - TScreen *screen = &term->screen; + TScreen *screen = TScreenOf(xw); #if OPT_PTY_HANDSHAKE handshake_t handshake; int done; #endif #if OPT_INITIAL_ERASE int initial_erase = VAL_INITIAL_ERASE; + Bool setInitialErase; #endif int rc = 0; int ttyfd = -1; + Bool ok_termcap; + char *newtc; #ifdef TERMIO_STRUCT TERMIO_STRUCT tio; @@ -2972,8 +2951,6 @@ spawn(void) #endif /* sony */ #endif /* TERMIO_STRUCT */ - char termcap[TERMCAP_SIZE]; - char newtc[TERMCAP_SIZE]; char *ptr, *shname, *shname_minus; int i, no_dev_tty = False; char **envnew; /* new environment */ @@ -3009,9 +2986,6 @@ spawn(void) screen->uid = save_ruid; screen->gid = save_rgid; - termcap[0] = '\0'; - newtc[0] = '\0'; - #ifdef SIGTTOU /* so that TIOCSWINSZ || TIOCSIZE doesn't block */ signal(SIGTTOU, SIG_IGN); @@ -3045,6 +3019,7 @@ spawn(void) ttyfd = -1; errno = ENXIO; } + pw = NULL; #if OPT_INITIAL_ERASE initial_erase = VAL_INITIAL_ERASE; #endif @@ -3172,12 +3147,12 @@ spawn(void) } /* avoid double MapWindow requests */ - XtSetMappedWhenManaged(SHELL_OF(CURRENT_EMU(screen)), False); + XtSetMappedWhenManaged(SHELL_OF(CURRENT_EMU()), False); wm_delete_window = XInternAtom(XtDisplay(toplevel), "WM_DELETE_WINDOW", False); - if (!TEK4014_ACTIVE(screen)) + if (!TEK4014_ACTIVE(xw)) VTInit(); /* realize now so know window size for tty driver */ #if defined(TIOCCONS) || defined(SRIOCSREDIR) if (Console) { @@ -3188,20 +3163,20 @@ spawn(void) XmuGetHostname(mit_console_name + MIT_CONSOLE_LEN, 255); mit_console = XInternAtom(screen->display, mit_console_name, False); /* the user told us to be the console, so we can use CurrentTime */ - XtOwnSelection(SHELL_OF(CURRENT_EMU(screen)), + XtOwnSelection(SHELL_OF(CURRENT_EMU()), mit_console, CurrentTime, ConvertConsoleSelection, NULL, NULL); } #endif #if OPT_TEK4014 - if (screen->TekEmu) { + if (TEK4014_ACTIVE(xw)) { envnew = tekterm; - ptr = newtc; + newtc = TekScreenOf(tekWidget)->tcapbuf; } else #endif { envnew = vtterm; - ptr = termcap; + newtc = screen->tcapbuf; } /* @@ -3210,19 +3185,25 @@ spawn(void) * the program to proceed (but not to set $TERMCAP) if the termcap * entry is not found. */ - if (!get_termcap(TermName = resource.term_name, ptr, newtc)) { + ok_termcap = True; + if (!get_termcap(TermName = resource.term_name, newtc)) { char *last = NULL; TermName = *envnew; + ok_termcap = False; while (*envnew != NULL) { if ((last == NULL || strcmp(last, *envnew)) - && get_termcap(*envnew, ptr, newtc)) { + && get_termcap(*envnew, newtc)) { TermName = *envnew; + ok_termcap = True; break; } last = *envnew; envnew++; } } + if (ok_termcap) { + resize_termcap(xw, newtc); + } /* * Check if ptyInitialErase is not set. If so, we rely on the termcap @@ -3231,12 +3212,19 @@ spawn(void) #if OPT_INITIAL_ERASE TRACE(("resource ptyInitialErase is %sset\n", resource.ptyInitialErase ? "" : "not ")); - if (!resource.ptyInitialErase) { + setInitialErase = False; + if (override_tty_modes && ttymodelist[XTTYMODE_erase].set) { + initial_erase = ttymodelist[XTTYMODE_erase].value; + setInitialErase = True; + } else if (resource.ptyInitialErase) { + ; + } else if (ok_termcap) { char temp[1024], *p = temp; char *s = tgetstr(TERMCAP_ERASE, &p); TRACE(("...extracting initial_erase value from termcap\n")); if (s != 0) { initial_erase = decode_keyvalue(&s, True); + setInitialErase = True; } } TRACE(("...initial_erase:%d\n", initial_erase)); @@ -3244,28 +3232,28 @@ spawn(void) TRACE(("resource backarrowKeyIsErase is %sset\n", resource.backarrow_is_erase ? "" : "not ")); if (resource.backarrow_is_erase) { /* see input.c */ - if (initial_erase == DEL) { - term->keyboard.flags &= ~MODE_DECBKM; + if (initial_erase == ANSI_DEL) { + xw->keyboard.flags &= ~MODE_DECBKM; } else { - term->keyboard.flags |= MODE_DECBKM; - term->keyboard.reset_DECBKM = 1; + xw->keyboard.flags |= MODE_DECBKM; + xw->keyboard.reset_DECBKM = 1; } TRACE(("...sets DECBKM %s\n", - (term->keyboard.flags & MODE_DECBKM) ? "on" : "off")); + (xw->keyboard.flags & MODE_DECBKM) ? "on" : "off")); } else { - term->keyboard.reset_DECBKM = 2; + xw->keyboard.reset_DECBKM = 2; } #endif /* OPT_INITIAL_ERASE */ #ifdef TTYSIZE_STRUCT /* tell tty how big window is */ #if OPT_TEK4014 - if (TEK4014_ACTIVE(screen)) { + if (TEK4014_ACTIVE(xw)) { TTYSIZE_ROWS(ts) = 38; TTYSIZE_COLS(ts) = 81; #if defined(USE_STRUCT_WINSIZE) - ts.ws_xpixel = TFullWidth(screen); - ts.ws_ypixel = TFullHeight(screen); + ts.ws_xpixel = TFullWidth(&(tekWidget->screen)); + ts.ws_ypixel = TFullHeight(&(tekWidget->screen)); #endif } else #endif @@ -3306,6 +3294,10 @@ spawn(void) SysError(ERROR_FORK); if (screen->pid == 0) { +#ifdef USE_USG_PTYS + int ptyfd; + char *pty_name; +#endif /* * now in child process */ @@ -3318,10 +3310,10 @@ spawn(void) #ifdef USE_USG_PTYS #ifdef USE_ISPTS_FLAG - if (IsPts) { /* SYSV386 supports both, which did we open? */ + if (IsPts) { /* SYSV386 supports both, which did we open? */ #endif - int ptyfd = 0; - char *pty_name = 0; + ptyfd = 0; + pty_name = 0; setpgrp(); grantpt(screen->respond); @@ -3358,12 +3350,12 @@ spawn(void) #ifdef TTYSIZE_STRUCT /* tell tty how big window is */ #if OPT_TEK4014 - if (TEK4014_ACTIVE(screen)) { + if (TEK4014_ACTIVE(xw)) { TTYSIZE_ROWS(ts) = 24; TTYSIZE_COLS(ts) = 80; #ifdef USE_STRUCT_WINSIZE - ts.ws_xpixel = TFullWidth(screen); - ts.ws_ypixel = TFullHeight(screen); + ts.ws_xpixel = TFullWidth(&(tekWidget->screen)); + ts.ws_ypixel = TFullHeight(&(tekWidget->screen)); #endif } else #endif /* OPT_TEK4014 */ @@ -3454,7 +3446,7 @@ spawn(void) /* make /dev/tty work */ ioctl(ttyfd, TCSETCTTY, 0); #endif -#if defined(__GNU__) && defined(TIOCSCTTY) +#if ((defined(__GLIBC__) && defined(__FreeBSD_kernel__)) || defined(__GNU__)) && defined(TIOCSCTTY) /* make /dev/tty work */ ioctl(ttyfd, TIOCSCTTY, 0); #endif @@ -3821,23 +3813,18 @@ spawn(void) signal(SIGTERM, SIG_DFL); /* - * If we're not asked to make the parent process set the - * terminal's erase mode, and if we had no ttyModes resource, - * then set the terminal's erase mode from our best guess. + * If we're not asked to let the parent process set the terminal's + * erase mode, or if we had the ttyModes erase resource, then set + * the terminal's erase mode from our best guess. */ #if OPT_INITIAL_ERASE TRACE(("check if we should set erase to %d:%s\n\tptyInitialErase:%d,\n\toveride_tty_modes:%d,\n\tXTTYMODE_erase:%d\n", initial_erase, - (!resource.ptyInitialErase - && !override_tty_modes - && !ttymodelist[XTTYMODE_erase].set) - ? "YES" : "NO", + setInitialErase ? "YES" : "NO", resource.ptyInitialErase, override_tty_modes, ttymodelist[XTTYMODE_erase].set)); - if (!resource.ptyInitialErase - && !override_tty_modes - && !ttymodelist[XTTYMODE_erase].set) { + if (setInitialErase) { #if OPT_TRACE int old_erase; #endif @@ -3890,7 +3877,7 @@ spawn(void) *newtc = 0; sprintf(buf, "%lu", - ((unsigned long) XtWindow(SHELL_OF(CURRENT_EMU(screen))))); + ((unsigned long) XtWindow(SHELL_OF(CURRENT_EMU())))); xtermSetenv("WINDOWID=", buf); /* put the display into the environment of the shell */ @@ -4073,13 +4060,13 @@ spawn(void) } #ifdef WTMP #if defined(WTMPX_FILE) && (defined(SVR4) || defined(__SCO__)) - if (term->misc.login_shell) + if (xw->misc.login_shell) updwtmpx(WTMPX_FILE, &utmp); #elif defined(linux) && defined(__GLIBC__) && (__GLIBC__ >= 2) && !(defined(__powerpc__) && (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0)) - if (term->misc.login_shell) + if (xw->misc.login_shell) call_updwtmp(etc_wtmp, &utmp); #else - if (term->misc.login_shell && + if (xw->misc.login_shell && (i = open(etc_wtmp, O_WRONLY | O_APPEND)) >= 0) { write(i, (char *) &utmp, sizeof(utmp)); close(i); @@ -4113,14 +4100,14 @@ spawn(void) close(i); added_utmp_entry = True; #if defined(WTMP) - if (term->misc.login_shell && + if (xw->misc.login_shell && (i = open(etc_wtmp, O_WRONLY | O_APPEND)) >= 0) { int status; status = write(i, (char *) &utmp, sizeof(utmp)); status = close(i); } #elif defined(MNX_LASTLOG) - if (term->misc.login_shell && + if (xw->misc.login_shell && (i = open(_U_LASTLOG, O_WRONLY)) >= 0) { lseek(i, (long) (screen->uid * sizeof(utmp)), 0); @@ -4143,7 +4130,7 @@ spawn(void) #endif /* USE_SYSV_UTMP */ #ifdef USE_LASTLOGX - if (term->misc.login_shell) { + if (xw->misc.login_shell) { bzero((char *) &lastlogx, sizeof(lastlogx)); (void) strncpy(lastlogx.ll_line, my_pty_name(ttydev), @@ -4155,7 +4142,7 @@ spawn(void) #endif #ifdef USE_LASTLOG - if (term->misc.login_shell && + if (xw->misc.login_shell && (i = open(etc_lastlog, O_WRONLY)) >= 0) { size_t size = sizeof(struct lastlog); off_t offset = (screen->uid * size); @@ -4221,7 +4208,7 @@ spawn(void) (void) strcpy(handshake.buffer, ttydev); (void) write(cp_pipe[1], (char *) &handshake, sizeof(handshake)); - if (waiting_for_initial_map) { + if (resource.wait_for_map) { i = read(pc_pipe[0], (char *) &handshake, sizeof(handshake)); if (i != sizeof(handshake) || @@ -4265,11 +4252,8 @@ spawn(void) xtermSetenv("TERMINFO=", OWN_TERMINFO_DIR); #endif #else /* USE_SYSV_ENVVARS */ - if (!TEK4014_ACTIVE(screen) && *newtc) { - strcpy(termcap, newtc); - resize(screen, termcap, newtc); - } - if (term->misc.titeInhibit && !term->misc.tiXtraScroll) { + resize_termcap(xw, newtc); + if (xw->misc.titeInhibit && !xw->misc.tiXtraScroll) { remove_termcap_entry(newtc, "ti="); remove_termcap_entry(newtc, "te="); } @@ -4370,11 +4354,11 @@ spawn(void) #endif /* !TERMIO_STRUCT */ #ifdef USE_LOGIN_DASH_P - if (term->misc.login_shell && pw && added_utmp_entry) + if (xw->misc.login_shell && pw && added_utmp_entry) execl(bin_login, "login", "-p", "-f", login_name, (void *) 0); #endif execlp(ptr, - (term->misc.login_shell ? shname_minus : shname), + (xw->misc.login_shell ? shname_minus : shname), (void *) 0); /* Exec failed. */ @@ -4457,7 +4441,7 @@ spawn(void) } } /* close our sides of the pipes */ - if (!waiting_for_initial_map) { + if (!resource.wait_for_map) { close(cp_pipe[0]); close(pc_pipe[1]); } @@ -4516,12 +4500,12 @@ spawn(void) #endif /* USE_SYSV_SIGNALS and not SIGTSTP */ return 0; -} /* end spawn */ +} /* end spawnXTerm */ SIGNAL_T Exit(int n) { - TScreen *screen = &term->screen; + TScreen *screen = TScreenOf(term); #ifdef USE_UTEMPTER if (!resource.utmpInhibit && added_utmp_entry) @@ -4677,46 +4661,52 @@ Exit(int n) /* ARGSUSED */ static void -resize(TScreen * screen, char *oldtc, char *newtc) +resize_termcap(XtermWidget xw, char *newtc) { #ifndef USE_SYSV_ENVVARS - char *ptr1, *ptr2; - size_t i; - int li_first = 0; - char *temp; - - TRACE(("resize %s\n", oldtc)); - if ((ptr1 = x_strindex(oldtc, "co#")) == NULL) { - strcat(oldtc, "co#80:"); - ptr1 = x_strindex(oldtc, "co#"); - } - if ((ptr2 = x_strindex(oldtc, "li#")) == NULL) { - strcat(oldtc, "li#24:"); - ptr2 = x_strindex(oldtc, "li#"); - } - if (ptr1 > ptr2) { - li_first++; - temp = ptr1; - ptr1 = ptr2; - ptr2 = temp; + if (!TEK4014_ACTIVE(xw) && *newtc) { + TScreen *screen = TScreenOf(xw); + char *ptr1, *ptr2; + size_t i; + int li_first = 0; + char *temp; + char oldtc[TERMCAP_SIZE]; + + strcpy(oldtc, newtc); + TRACE(("resize %s\n", oldtc)); + if ((ptr1 = x_strindex(oldtc, "co#")) == NULL) { + strcat(oldtc, "co#80:"); + ptr1 = x_strindex(oldtc, "co#"); + } + if ((ptr2 = x_strindex(oldtc, "li#")) == NULL) { + strcat(oldtc, "li#24:"); + ptr2 = x_strindex(oldtc, "li#"); + } + if (ptr1 > ptr2) { + li_first++; + temp = ptr1; + ptr1 = ptr2; + ptr2 = temp; + } + ptr1 += 3; + ptr2 += 3; + strncpy(newtc, oldtc, i = ptr1 - oldtc); + temp = newtc + i; + sprintf(temp, "%d", (li_first + ? MaxRows(screen) + : MaxCols(screen))); + temp += strlen(temp); + ptr1 = strchr(ptr1, ':'); + strncpy(temp, ptr1, i = ptr2 - ptr1); + temp += i; + sprintf(temp, "%d", (li_first + ? MaxCols(screen) + : MaxRows(screen))); + ptr2 = strchr(ptr2, ':'); + strcat(temp, ptr2); + TRACE((" ==> %s\n", newtc)); + TRACE((" new size %dx%d\n", MaxRows(screen), MaxCols(screen))); } - ptr1 += 3; - ptr2 += 3; - strncpy(newtc, oldtc, i = ptr1 - oldtc); - temp = newtc + i; - sprintf(temp, "%d", (li_first - ? MaxRows(screen) - : MaxCols(screen))); - temp += strlen(temp); - ptr1 = strchr(ptr1, ':'); - strncpy(temp, ptr1, i = ptr2 - ptr1); - temp += i; - sprintf(temp, "%d", (li_first - ? MaxCols(screen) - : MaxRows(screen))); - ptr2 = strchr(ptr2, ':'); - strcat(temp, ptr2); - TRACE((" ==> %s\n", newtc)); #endif /* USE_SYSV_ENVVARS */ } @@ -4775,7 +4765,7 @@ reapchild(int n GCC_UNUSED) fputs("Exiting\n", stderr); #endif if (!hold_screen) - need_cleanup = TRUE; + need_cleanup = True; } } while ((pid = nonblocking_wait()) > 0); diff --git a/app/xterm/ptyx.h b/app/xterm/ptyx.h index 5c276d7dc..26423b507 100644 --- a/app/xterm/ptyx.h +++ b/app/xterm/ptyx.h @@ -1,9 +1,9 @@ -/* $XTermId: ptyx.h,v 1.439 2006/07/23 16:39:41 tom Exp $ */ +/* $XTermId: ptyx.h,v 1.484 2007/03/20 23:56:09 tom Exp $ */ /* $XFree86: xc/programs/xterm/ptyx.h,v 3.134 2006/06/19 00:36:51 dickey Exp $ */ /* - * Copyright 1999-2005,2006 by Thomas E. Dickey + * Copyright 1999-2006,2007 by Thomas E. Dickey * * All Rights Reserved * @@ -135,7 +135,7 @@ #define USE_PTY_DEVICE 1 #define USE_PTY_SEARCH 1 -#if defined(__osf__) || (defined(linux) && defined(__GLIBC__) && (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) +#if defined(__osf__) || (defined(linux) && defined(__GLIBC__) && (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__) #undef USE_PTY_DEVICE #undef USE_PTY_SEARCH #define USE_PTS_DEVICE 1 @@ -264,7 +264,7 @@ * mouse events into the proper routines. */ typedef enum { - NORMAL + NORMAL = 0 , LEFTEXTENSION , RIGHTEXTENSION } EventMode; @@ -294,32 +294,23 @@ typedef struct { /* * ANSI emulation, special character codes */ -#define INQ 0x05 -#define BEL 0x07 -#define FF 0x0C /* C0, C1 control names */ -#define LS1 0x0E -#define LS0 0x0F -#define NAK 0x15 -#define CAN 0x18 -#define SUB 0x1A -#define ESC 0x1B -#define XPOUND 0x1E /* internal mapping for '#' */ -#define US 0x1F -#define DEL 0x7F -#define RI 0x8D -#define SS2 0x8E -#define SS3 0x8F -#define DCS 0x90 -#define SPA 0x96 -#define EPA 0x97 -#define SOS 0x98 -#define OLDID 0x9A /* ESC Z */ -#define CSI 0x9B -#define ST 0x9C -#define OSC 0x9D -#define PM 0x9E -#define APC 0x9F -#define RDEL 0xFF +#define ANSI_BEL 0x07 +#define ANSI_FF 0x0C /* C0, C1 control names */ +#define ANSI_NAK 0x15 +#define ANSI_CAN 0x18 +#define ANSI_ESC 0x1B +#define ANSI_SPA 0x20 +#define XTERM_POUND 0x1E /* internal mapping for '#' */ +#define ANSI_DEL 0x7F +#define ANSI_SS2 0x8E +#define ANSI_SS3 0x8F +#define ANSI_DCS 0x90 +#define ANSI_SOS 0x98 +#define ANSI_CSI 0x9B +#define ANSI_ST 0x9C +#define ANSI_OSC 0x9D +#define ANSI_PM 0x9E +#define ANSI_APC 0x9F #define MIN_DECID 52 /* can emulate VT52 */ #define MAX_DECID 420 /* ...through VT420 */ @@ -476,6 +467,14 @@ typedef struct { #endif #endif +#ifndef OPT_EXEC_XTERM +#define OPT_EXEC_XTERM 0 /* true if xterm can fork/exec copies of itself */ +#endif + +#ifndef OPT_FOCUS_EVENT +#define OPT_FOCUS_EVENT 1 /* focus in/out events */ +#endif + #ifndef OPT_HP_FUNC_KEYS #define OPT_HP_FUNC_KEYS 0 /* true if xterm supports HP-style function keys */ #endif @@ -608,6 +607,10 @@ typedef struct { #define OPT_SUNPC_KBD 1 /* true if xterm supports Sun/PC keyboard map */ #endif +#ifndef OPT_TCAP_FKEYS +#define OPT_TCAP_FKEYS 0 /* true for experimental termcap function-keys */ +#endif + #ifndef OPT_TCAP_QUERY #define OPT_TCAP_QUERY 0 /* true for experimental termcap query */ #endif @@ -711,22 +714,57 @@ typedef enum { , fMAX } VTFontEnum; +/* + * Indices for cachedGCs.c (unrelated to VTFontEnum). + */ +typedef enum { + gcNorm = 0 + , gcBold + , gcNormReverse + , gcBoldReverse +#if OPT_BOX_CHARS + , gcLine + , gcDots +#endif +#if OPT_DEC_CHRSET + , gcCNorm + , gcCBold +#endif +#if OPT_WIDE_CHARS + , gcWide + , gcWBold + , gcWideReverse + , gcWBoldReverse +#endif + , gcVTcursNormal + , gcVTcursFilled + , gcVTcursReverse + , gcVTcursOutline +#if OPT_TEK4014 + , gcTKcurs +#endif + , gcMAX +} CgsEnum; + +#define for_each_text_gc(n) for (n = gcNorm; n < gcVTcursNormal; ++n) +#define for_each_curs_gc(n) for (n = gcVTcursNormal; n <= gcVTcursOutline; ++n) +#define for_each_gc(n) for (n = gcNorm; n < gcMAX; ++n) + /* indices for the normal terminal colors in screen.Tcolors[] */ typedef enum { TEXT_FG = 0 /* text foreground */ - , TEXT_BG = 1 /* text background */ - , TEXT_CURSOR = 2 /* text cursor */ - , MOUSE_FG = 3 /* mouse foreground */ - , MOUSE_BG = 4 /* mouse background */ + , TEXT_BG /* text background */ + , TEXT_CURSOR /* text cursor */ + , MOUSE_FG /* mouse foreground */ + , MOUSE_BG /* mouse background */ #if OPT_TEK4014 - , TEK_FG = 5 /* tektronix foreground */ - , TEK_BG = 6 /* tektronix background */ + , TEK_FG /* tektronix foreground */ + , TEK_BG /* tektronix background */ + , TEK_CURSOR /* tektronix cursor */ #endif #if OPT_HIGHLIGHT_COLOR - , HIGHLIGHT_BG = 7 /* highlight background */ -#endif -#if OPT_TEK4014 - , TEK_CURSOR = 8 /* tektronix cursor */ + , HIGHLIGHT_BG /* highlight background */ + , HIGHLIGHT_FG /* highlight foreground */ #endif , NCOLORS /* total number of colors */ } TermColors; @@ -797,7 +835,7 @@ typedef enum { #define COLOR_RV (NUM_ANSI_COLORS+3) /* REVERSE */ #define MAXCOLORS (NUM_ANSI_COLORS+4) #ifndef DFT_COLORMODE -#define DFT_COLORMODE TRUE /* default colorMode resource */ +#define DFT_COLORMODE True /* default colorMode resource */ #endif #define ReverseOrHilite(screen,flags,hilite) \ @@ -808,7 +846,7 @@ typedef enum { /* Define a fake XK code, we need it for the fake color response in * xtermcapKeycode(). */ -#if OPT_TCAP_QUERY +#if OPT_TCAP_QUERY && OPT_ISO_COLORS # define XK_COLORS 0x0003 #endif @@ -925,13 +963,15 @@ extern int A2E(int); /***====================================================================***/ #if OPT_TEK4014 -#define TEK4014_ACTIVE(screen) ((screen)->TekEmu) -#define CURRENT_EMU_VAL(screen,tek,vt) (TEK4014_ACTIVE(screen) ? tek : vt) -#define CURRENT_EMU(screen) CURRENT_EMU_VAL(screen, (Widget)tekWidget, (Widget)term) +#define TEK4014_ACTIVE(xw) ((xw)->misc.TekEmu) +#define TEK4014_SHOWN(xw) ((xw)->misc.Tshow) +#define CURRENT_EMU_VAL(tek,vt) (TEK4014_ACTIVE(term) ? tek : vt) +#define CURRENT_EMU() CURRENT_EMU_VAL((Widget)tekWidget, (Widget)term) #else -#define TEK4014_ACTIVE(screen) 0 -#define CURRENT_EMU_VAL(screen,tek,vt) (vt) -#define CURRENT_EMU(screen) ((Widget)term) +#define TEK4014_ACTIVE(screen) 0 +#define TEK4014_SHOWN(xw) 0 +#define CURRENT_EMU_VAL(tek,vt) (vt) +#define CURRENT_EMU() ((Widget)term) #endif /***====================================================================***/ @@ -1090,7 +1130,6 @@ typedef struct { unsigned chrset; unsigned flags; XFontStruct * fs; - GC gc; char * fn; } XTermFonts; @@ -1130,6 +1169,9 @@ typedef enum { #if OPT_BLINK_CURS DP_CRS_BLINK, #endif +#if OPT_FOCUS_EVENT + DP_X_FOCUS, +#endif #if OPT_TOOLBAR DP_TOOLBAR, #endif @@ -1205,7 +1247,7 @@ typedef struct { #define VT100_TB_INFO(name) screen.fullVwin.tb_info.name #endif -struct _vtwin { +typedef struct { Window window; /* X window id */ int width; /* width of columns */ int height; /* height of rows */ @@ -1216,24 +1258,20 @@ struct _vtwin { int f_ascent; /* ascent of font in pixels */ int f_descent; /* descent of font in pixels */ SbInfo sb_info; - GC normalGC; /* normal painting */ - GC reverseGC; /* reverse painting */ - GC normalboldGC; /* normal painting, bold font */ - GC reverseboldGC; /* reverse painting, bold font */ #if OPT_TOOLBAR Boolean active; /* true if toolbars are used */ TbInfo tb_info; /* toolbar information */ #endif -}; +} VTwin; -struct _tekwin { +typedef struct { Window window; /* X window id */ int width; /* width of columns */ int height; /* height of rows */ Dimension fullwidth; /* full width of window */ Dimension fullheight; /* full height of window */ double tekscale; /* scale factor Tek -> vs100 */ -}; +} TKwin; typedef struct { /* These parameters apply to both windows */ @@ -1251,10 +1289,6 @@ typedef struct { pid_t pid; /* pid of process on far side */ uid_t uid; /* user id of actual person */ gid_t gid; /* group id of actual person */ - GC cursorGC; /* normal cursor painting */ - GC fillCursorGC; /* special cursor painting */ - GC reversecursorGC;/* reverse cursor painting */ - GC cursoroutlineGC;/* for painting lines around */ ColorRes Tcolors[NCOLORS]; /* terminal colors */ #if OPT_ISO_COLORS ColorRes Acolors[MAXCOLORS]; /* ANSI color emulation */ @@ -1306,14 +1340,14 @@ typedef struct { #endif int border; /* inner border */ int scrollBarBorder; /* scrollBar border */ - Cursor arrow; /* arrow cursor */ unsigned long event_mask; unsigned short send_mouse_pos; /* user wants mouse transition */ /* and position information */ + Boolean send_focus_pos; /* user wants focus in/out info */ #if OPT_PASTE64 int base64_paste; /* set to send paste in base64 */ int base64_final; /* string-terminator for paste */ - /* _qWriteSelectionData expects these to be initialized to zero. + /* _qWriteSelectionData expects these to be initialized to zero. * base64_flush() is the last step of the conversion, it clears these * variables. */ @@ -1363,10 +1397,10 @@ typedef struct { /* VT window parameters */ Boolean Vshow; /* VT window showing */ - struct _vtwin fullVwin; + VTwin fullVwin; #ifndef NO_ACTIVE_ICON - struct _vtwin iconVwin; - struct _vtwin * whichVwin; + VTwin iconVwin; + VTwin *whichVwin; #endif /* NO_ACTIVE_ICON */ Cursor pointer_cursor; /* pointer cursor in window */ @@ -1411,6 +1445,9 @@ typedef struct { int blink_off; /* cursor off time (msecs) */ XtIntervalId blink_timer; /* timer-id for cursor-proc */ #endif +#if OPT_ZICONBEEP + Boolean zIconBeep_flagged; /* True if icon name was changed */ +#endif /* OPT_ZICONBEEP */ int cursor_GC; /* see ShowCursor() */ int cursor_set; /* requested state */ CELL cursorp; /* previous cursor row/column */ @@ -1494,12 +1531,13 @@ typedef struct { int vtXX_level; /* 0=vt52, 1,2,3 = vt100 ... vt320 */ int ansi_level; /* levels 1,2,3 */ int protected_mode; /* 0=off, 1=DEC, 2=ISO */ - Boolean old_fkeys; /* true for compatible fkeys */ + Boolean always_bold_mode; /* compare normal/bold font */ + Boolean always_highlight; /* whether to highlight cursor */ + Boolean bold_mode; /* use bold font or overstrike */ Boolean delete_is_del; /* true for compatible Delete key */ Boolean jumpscroll; /* whether we should jumpscroll */ - Boolean always_highlight; /* whether to highlight cursor */ + Boolean old_fkeys; /* true for compatible fkeys */ Boolean underline; /* whether to underline text */ - Boolean bold_mode; /* whether to use bold font */ #if OPT_MAXIMIZE Boolean restore_data; @@ -1524,43 +1562,20 @@ typedef struct { Boolean move_sgr_ok; /* SGR is reset on move */ #endif -#if OPT_TEK4014 -/* Tektronix window parameters */ - GC TnormalGC; /* normal painting */ - GC TcursorGC; /* normal cursor painting */ - - Boolean Tshow; /* Tek window showing */ - Boolean waitrefresh; /* postpone refresh */ - struct _tekwin fullTwin; -#ifndef NO_ACTIVE_ICON - struct _tekwin iconTwin; - struct _tekwin *whichTwin; -#endif /* NO_ACTIVE_ICON */ - - GC linepat[TEKNUMLINES]; /* line patterns */ - Boolean TekEmu; /* true if Tektronix emulation */ - int cur_X; /* current x */ - int cur_Y; /* current y */ - Tmodes cur; /* current tek modes */ - Tmodes page; /* starting tek modes on page */ - int margin; /* 0 -> margin 1, 1 -> margin 2 */ - int pen; /* current Tektronix pen 0=up, 1=dn */ - char *TekGIN; /* nonzero if Tektronix GIN mode*/ - int gin_terminator; /* Tek strap option */ -#endif /* OPT_TEK4014 */ - /* * Bell */ int visualBellDelay; /* msecs to delay for visibleBell */ int bellSuppressTime; /* msecs after Bell before another allowed */ Boolean bellInProgress; /* still ringing/flashing prev bell? */ + Boolean bellIsUrgent; /* set XUrgency WM hint on bell */ /* * Select/paste state. */ Boolean selectToClipboard; /* primary vs clipboard */ String *mappedSelect; /* mapping for "SELECT" to "PRIMARY" */ + Boolean waitingForTrackInfo; int numberOfClicks; int maxClicks; int multiClickTime; /* time between multiclick selects */ @@ -1579,6 +1594,7 @@ typedef struct { Char *selection_data; /* the current selection */ int selection_size; /* size of allocated buffer */ int selection_length; /* number of significant bytes */ + EventMode eventMode; Time selection_time; /* latest event timestamp */ Time lastButtonUpTime; @@ -1611,15 +1627,21 @@ typedef struct { Boolean output_eight_bits; /* honor all bits or strip */ Boolean control_eight_bits; /* send CSI as 8-bits */ Boolean backarrow_key; /* backspace/delete */ + Boolean alt_is_not_meta; /* use both Alt- and Meta-key */ + Boolean alt_sends_esc; /* Alt-key sends ESC prefix */ Boolean meta_sends_esc; /* Meta-key sends ESC prefix */ /* * Fonts */ Pixmap menu_item_bitmap; /* mask for checking items */ + String initial_font; String menu_font_names[NMENUFONTS][fMAX]; #define MenuFontName(n) menu_font_names[n][fNorm] long menu_font_sizes[NMENUFONTS]; int menu_font_number; +#if OPT_CLIP_BOLD + Boolean use_clipping; +#endif #if OPT_RENDERFONT XftFont * renderFontNorm[NMENUFONTS]; XftFont * renderFontBold[NMENUFONTS]; @@ -1639,6 +1661,11 @@ typedef struct { int dabbrev_working; /* nonzero during dabbrev process */ unsigned char dabbrev_erase_char; /* used for deleting inserted completion */ #endif + char tcapbuf[TERMCAP_SIZE]; +#if OPT_TCAP_FKEYS + char ** tcap_fkeys; + char tcap_area[TERMCAP_SIZE]; +#endif } TScreen; typedef struct _TekPart { @@ -1651,6 +1678,31 @@ typedef struct _TekPart { #endif } TekPart; +/* Tektronix window parameters */ +typedef struct _TekScreen { + GC TnormalGC; /* normal painting */ + GC TcursorGC; /* normal cursor painting */ + + Boolean waitrefresh; /* postpone refresh */ + TKwin fullTwin; +#ifndef NO_ACTIVE_ICON + TKwin iconTwin; + TKwin *whichTwin; +#endif /* NO_ACTIVE_ICON */ + + Cursor arrow; /* arrow cursor */ + GC linepat[TEKNUMLINES]; /* line patterns */ + int cur_X; /* current x */ + int cur_Y; /* current y */ + Tmodes cur; /* current tek modes */ + Tmodes page; /* starting tek modes on page */ + int margin; /* 0 -> margin 1, 1 -> margin 2 */ + int pen; /* current Tektronix pen 0=up, 1=dn */ + char *TekGIN; /* nonzero if Tektronix GIN mode*/ + int gin_terminator; /* Tek strap option */ + char tcapbuf[TERMCAP_SIZE]; +} TekScreen; + #if OPT_READLINE #define SCREEN_FLAG(screenp,f) (1&(screenp)->f) #define SCREEN_FLAG_set(screenp,f) ((screenp)->f |= 1) @@ -1674,6 +1726,7 @@ typedef enum { keyboardIsHP, keyboardIsSCO, keyboardIsSun, + keyboardIsTermcap, keyboardIsVT220 } xtermKeyboardType; @@ -1708,7 +1761,13 @@ typedef enum { /* legal values for screen.utf8_mode */ #define NAME_VT220_KT /*nothing*/ #endif -#define KEYBOARD_TYPES NAME_HP_KT NAME_SCO_KT NAME_SUN_KT NAME_VT220_KT +#if OPT_TCAP_FKEYS +#define NAME_TCAP_KT " tcap" +#else +#define NAME_TCAP_KT /*nothing*/ +#endif + +#define KEYBOARD_TYPES NAME_TCAP_KT NAME_HP_KT NAME_SCO_KT NAME_SUN_KT NAME_VT220_KT #if OPT_TRACE extern const char * visibleKeyboardType(xtermKeyboardType); @@ -1777,6 +1836,8 @@ typedef struct _Misc { #if OPT_TEK4014 Boolean tekInhibit; Boolean tekSmall; /* start tek window in small size */ + Boolean TekEmu; /* true if Tektronix emulation */ + Boolean Tshow; /* Tek window showing */ #endif Boolean scrollbar; #ifdef SCROLLBAR_RIGHT @@ -1819,7 +1880,7 @@ typedef struct _Misc { #if OPT_RENDERFONT char *face_name; char *face_wide_name; - float face_size; + float face_size[NMENUFONTS]; Boolean render_font; #endif } Misc; @@ -1840,6 +1901,11 @@ typedef struct _TekClassRec { CoreClassPart core_class; TekClassPart tek_class; } TekClassRec; + +extern WidgetClass tekWidgetClass; + +#define IsTekWidget(w) (XtClass(w) == tekWidgetClass) + #endif /* define masks for keyboard.flags */ @@ -1886,7 +1952,8 @@ typedef struct _XtermWidgetRec { #if OPT_TEK4014 typedef struct _TekWidgetRec { CorePart core; - TekPart tek; + TekPart tek; /* contains resources */ + TekScreen screen; /* contains working data (no resources) */ Bool init_menu; XSizeHints hints; } TekWidgetRec, *TekWidget; @@ -1974,6 +2041,9 @@ typedef struct _TekWidgetRec { #define DEC_PROTECT 1 #define ISO_PROTECT 2 +#define TScreenOf(xw) (&(xw)->screen) +#define TekScreenOf(tw) (&(tw)->screen) + #ifdef SCROLLBAR_RIGHT #define OriginX(screen) (((term->misc.useRight)?0:ScrollbarWidth(screen)) + screen->border) #else @@ -2019,6 +2089,8 @@ typedef struct _TekWidgetRec { #endif /* NO_ACTIVE_ICON */ +#define okFont(font) ((font) != 0 && (font)->fid != 0) + /* * Macro to check if we are iconified; do not use render for that case. */ @@ -2042,11 +2114,17 @@ typedef struct _TekWidgetRec { #define NormalFont(screen) WhichVFont(screen, fnts[fNorm]) #define BoldFont(screen) WhichVFont(screen, fnts[fBold]) +#if OPT_WIDE_CHARS +#define NormalWFont(screen) WhichVFont(screen, fnts[fWide]) +#define BoldWFont(screen) WhichVFont(screen, fnts[fWBold]) +#endif + #define ScrollbarWidth(screen) WhichVWin(screen)->sb_info.width -#define NormalGC(screen) WhichVWin(screen)->normalGC -#define ReverseGC(screen) WhichVWin(screen)->reverseGC -#define NormalBoldGC(screen) WhichVWin(screen)->normalboldGC -#define ReverseBoldGC(screen) WhichVWin(screen)->reverseboldGC + +#define NormalGC(w,sp) getCgsGC(w, WhichVWin(sp), gcNorm) +#define ReverseGC(w,sp) getCgsGC(w, WhichVWin(sp), gcNormReverse) +#define NormalBoldGC(w,sp) getCgsGC(w, WhichVWin(sp), gcBold) +#define ReverseBoldGC(w,sp) getCgsGC(w, WhichVWin(sp), gcBoldReverse) #define TWidth(screen) WhichTWin(screen)->width #define THeight(screen) WhichTWin(screen)->height diff --git a/app/xterm/version.h b/app/xterm/version.h index b8ce4a47d..e230c0eb3 100644 --- a/app/xterm/version.h +++ b/app/xterm/version.h @@ -1,4 +1,4 @@ -/* $XTermId: version.h,v 1.271 2006/06/21 00:34:24 tom Exp $ */ +/* $XTermId: version.h,v 1.280 2007/03/18 23:17:18 tom Exp $ */ /* $XFree86: xc/programs/xterm/version.h,v 3.126 2006/06/20 00:42:38 dickey Exp $ */ /* @@ -7,7 +7,7 @@ * version of X to which this version of xterm has been built. The number in * parentheses is my patch number (T.Dickey). */ -#define XTERM_PATCH 216 +#define XTERM_PATCH 225 #ifndef __vendorversion__ #define __vendorversion__ "XTerm/OpenBSD" diff --git a/app/xterm/xterm.h b/app/xterm/xterm.h index 638d0463d..eb1cb4ec3 100644 --- a/app/xterm/xterm.h +++ b/app/xterm/xterm.h @@ -1,10 +1,10 @@ -/* $XTermId: xterm.h,v 1.415 2006/08/03 23:43:39 tom Exp $ */ +/* $XTermId: xterm.h,v 1.461 2007/03/20 23:56:57 tom Exp $ */ /* $XFree86: xc/programs/xterm/xterm.h,v 3.117 2006/06/19 00:36:52 dickey Exp $ */ /************************************************************ -Copyright 1999-2005,2006 by Thomas E. Dickey +Copyright 1999-2006,2007 by Thomas E. Dickey All Rights Reserved @@ -164,15 +164,15 @@ authorization. #endif #if defined(__OpenBSD__) -#define USE_UTMP_SETGID TRUE -#define USE_OPENPTY TRUE -#define DEFDELETE_DEL TRUE -#define DEF_BACKARO_ERASE TRUE -#define DEF_INITIAL_ERASE TRUE +#define USE_UTMP_SETGID True +#define USE_OPENPTY True +#define DEFDELETE_DEL True +#define DEF_BACKARO_ERASE True +#define DEF_INITIAL_ERASE True #endif #if defined(__SCO__) || defined(__UNIXWARE__) -#define DEFDELETE_DEL TRUE +#define DEFDELETE_DEL True #define OPT_SCO_FUNC_KEYS 1 #endif @@ -328,11 +328,16 @@ extern int errno; extern char **environ; #endif +#define XK_Fn(n) (XK_F1 + (n) - 1) + /***====================================================================***/ #define XtNallowC1Printable "allowC1Printable" #define XtNallowSendEvents "allowSendEvents" #define XtNallowWindowOps "allowWindowOps" +#define XtNaltIsNotMeta "altIsNotMeta" +#define XtNaltSendsEscape "altSendsEscape" +#define XtNalwaysBoldMode "alwaysBoldMode" #define XtNalwaysHighlight "alwaysHighlight" #define XtNalwaysUseMods "alwaysUseMods" #define XtNanswerbackString "answerbackString" @@ -341,6 +346,7 @@ extern char **environ; #define XtNautoWrap "autoWrap" #define XtNawaitInput "awaitInput" #define XtNbackarrowKey "backarrowKey" +#define XtNbellIsUrgent "bellIsUrgent" #define XtNbellOnReset "bellOnReset" #define XtNbellSuppressTime "bellSuppressTime" #define XtNboldColors "boldColors" @@ -389,8 +395,10 @@ extern char **environ; #define XtNfreeBoldBox "freeBoldBox" #define XtNhighlightColor "highlightColor" #define XtNhighlightSelection "highlightSelection" +#define XtNhighlightTextColor "highlightTextColor" #define XtNhpLowerleftBugCompat "hpLowerleftBugCompat" #define XtNi18nSelections "i18nSelections" +#define XtNinitialFont "initialFont" #define XtNinternalBorder "internalBorder" #define XtNitalicULMode "italicULMode" #define XtNjumpScroll "jumpScroll" @@ -452,6 +460,7 @@ extern char **environ; #define XtNtoolBar "toolBar" #define XtNtrimSelection "trimSelection" #define XtNunderLine "underLine" +#define XtNuseClipping "useClipping" #define XtNutf8 "utf8" #define XtNutf8Latin1 "utf8Latin1" #define XtNutf8Title "utf8Title" @@ -471,6 +480,9 @@ extern char **environ; #define XtCAllowC1Printable "AllowC1Printable" #define XtCAllowSendEvents "AllowSendEvents" #define XtCAllowWindowOps "AllowWindowOps" +#define XtCAltIsNotMeta "AltIsNotMeta" +#define XtCAltSendsEscape "AltSendsEscape" +#define XtCAlwaysBoldMode "AlwaysBoldMode" #define XtCAlwaysHighlight "AlwaysHighlight" #define XtCAlwaysUseMods "AlwaysUseMods" #define XtCAnswerbackString "AnswerbackString" @@ -479,6 +491,7 @@ extern char **environ; #define XtCAutoWrap "AutoWrap" #define XtCAwaitInput "AwaitInput" #define XtCBackarrowKey "BackarrowKey" +#define XtCBellIsUrgent "BellIsUrgent" #define XtCBellOnReset "BellOnReset" #define XtCBellSuppressTime "BellSuppressTime" #define XtCBoldFont "BoldFont" @@ -523,6 +536,7 @@ extern char **environ; #define XtCHighlightSelection "HighlightSelection" #define XtCHpLowerleftBugCompat "HpLowerleftBugCompat" #define XtCI18nSelections "I18nSelections" +#define XtCInitialFont "InitialFont" #define XtCJumpScroll "JumpScroll" #define XtCKeyboardDialect "KeyboardDialect" #define XtCLimitResize "LimitResize" @@ -576,6 +590,7 @@ extern char **environ; #define XtCToolBar "ToolBar" #define XtCTrimSelection "TrimSelection" #define XtCUnderLine "UnderLine" +#define XtCUseClipping "UseClipping" #define XtCUtf8 "Utf8" #define XtCUtf8Latin1 "Utf8Latin1" #define XtCUtf8Title "Utf8Title" @@ -601,10 +616,12 @@ extern char **environ; #define XtCCursorColor "CursorColor" #define XtCPointerColor "PointerColor" #define XtCHighlightColor "HighlightColor" +#define XtCHighlightTextColor "HighlightTextColor" #else #define XtCCursorColor XtCForeground #define XtCPointerColor XtCForeground #define XtCHighlightColor XtCForeground +#define XtCHighlightTextColor XtCBackground #endif /***====================================================================***/ @@ -616,19 +633,24 @@ extern "C" { struct XTERM_RESOURCE; /* Tekproc.c */ +#if OPT_TEK4014 +extern int TekGetFontSize (const char * /* param */); extern int TekInit (void); extern int TekPtyData(void); -extern void ChangeTekColors (TScreen * /* screen */, ScrnColors * /* pNew */); -extern void TCursorToggle (int /* toggle */); -extern void TekCopy (void); -extern void TekEnqMouse (int /* c */); +extern void ChangeTekColors (TekWidget /* tw */, TScreen * /* screen */, ScrnColors * /* pNew */); +extern void HandleGINInput PROTO_XT_ACTIONS_ARGS; +extern void TCursorToggle (TekWidget /* tw */, int /* toggle */); +extern void TekCopy (TekWidget /* tw */); +extern void TekEnqMouse (TekWidget /* tw */, int /* c */); extern void TekExpose (Widget /* w */, XEvent * /* event */, Region /* region */); -extern void TekGINoff (void); -extern void TekReverseVideo (TScreen * /* screen */); +extern void TekGINoff (TekWidget /* tw */); +extern void TekRefresh (TekWidget /* tw */); +extern void TekRepaint (TekWidget /* xw */); +extern void TekReverseVideo (TekWidget /* tw */); extern void TekRun (void); -extern void TekSetFontSize (int /* newitem */); -extern void TekSimulatePageButton (Bool /* reset */); -extern void dorefresh (void); +extern void TekSetFontSize (TekWidget /* tw */, int /* newitem */); +extern void TekSimulatePageButton (TekWidget /* tw */, Bool /* reset */); +#endif /* button.c */ #define MotionOff( s, t ) { \ @@ -644,7 +666,6 @@ extern void dorefresh (void); extern Bool SendMousePosition (XtermWidget /* w */, XEvent* /* event */); extern void DiredButton PROTO_XT_ACTIONS_ARGS; extern void DisownSelection (XtermWidget /* termw */); -extern void HandleGINInput PROTO_XT_ACTIONS_ARGS; extern void HandleInsertSelection PROTO_XT_ACTIONS_ARGS; extern void HandleKeyboardSelectEnd PROTO_XT_ACTIONS_ARGS; extern void HandleKeyboardSelectExtend PROTO_XT_ACTIONS_ARGS; @@ -665,6 +686,12 @@ extern void GetLocatorPosition (XtermWidget /* w */); extern void InitLocatorFilter (XtermWidget /* w */); #endif /* OPT_DEC_LOCATOR */ +#if OPT_FOCUS_EVENT +extern void SendFocusButton(XtermWidget /* xw */, XFocusChangeEvent * /* event */); +#else +#define SendFocusBotton(xw, event) /* nothing */ +#endif + #if OPT_PASTE64 extern void AppendToSelectionBuffer (TScreen * /* screen */, unsigned /* c */); extern void ClearSelectionBuffer (TScreen * /* screen */); @@ -680,6 +707,22 @@ extern void ReadLineButton PROTO_XT_ACTIONS_ARGS; extern Bool iswide(int /* i */); #endif +/* cachedCgs.c */ +extern CgsEnum getCgsId(XtermWidget /*xw*/, VTwin * /*cgsWin*/, GC /*gc*/); +extern GC freeCgs(XtermWidget /*xw*/, VTwin * /*cgsWin*/, CgsEnum /*cgsId*/); +extern GC getCgsGC(XtermWidget /*xw*/, VTwin * /*cgsWin*/, CgsEnum /*cgsId*/); +extern Pixel getCgsBack(XtermWidget /*xw*/, VTwin * /*cgsWin*/, GC /*gc*/); +extern Pixel getCgsFore(XtermWidget /*xw*/, VTwin * /*cgsWin*/, GC /*gc*/); +extern XFontStruct * getCgsFont(XtermWidget /*xw*/, VTwin * /*cgsWin*/, GC /*gc*/); +extern void clrCgsFonts(XtermWidget /*xw*/, VTwin * /*cgsWin*/, XFontStruct * /*font*/); +extern void copyCgs(XtermWidget /*xw*/, VTwin * /*cgsWin*/, CgsEnum /*dstCgsId*/, CgsEnum /*srcCgsId*/); +extern void redoCgs(XtermWidget /*xw*/, Pixel /*fg*/, Pixel /*bg*/, CgsEnum /*cgsId*/); +extern void setCgsBack(XtermWidget /*xw*/, VTwin * /*cgsWin*/, CgsEnum /*cgsId*/, Pixel /*bg*/); +extern void setCgsCSet(XtermWidget /*xw*/, VTwin * /*cgsWin*/, CgsEnum /*cgsId*/, unsigned /*cset*/); +extern void setCgsFont(XtermWidget /*xw*/, VTwin * /*cgsWin*/, CgsEnum /*cgsId*/, XFontStruct * /*font*/); +extern void setCgsFore(XtermWidget /*xw*/, VTwin * /*cgsWin*/, CgsEnum /*cgsId*/, Pixel /*fg*/); +extern void swapCgs(XtermWidget /*xw*/, VTwin * /*cgsWin*/, CgsEnum /*dstCgsId*/, CgsEnum /*srcCgsId*/); + /* charproc.c */ extern int VTInit (void); extern int v_write (int /* f */, Char * /* d */, unsigned /* len */); @@ -691,6 +734,8 @@ extern void ToggleAlternate (XtermWidget /* xw */); extern void VTReset (XtermWidget /* xw */, int /* full */, int /* saved */); extern void VTRun (void); extern void dotext (XtermWidget /* xw */, int /* charset */, IChar * /* buf */, Cardinal /* len */); +extern void releaseCursorGCs(XtermWidget /*xw*/); +extern void releaseWindowGCs(XtermWidget /*xw*/, VTwin * /*win*/); extern void resetCharsets (TScreen * /* screen */); extern void set_cursor_gcs (XtermWidget /* xw */); extern void set_max_col(TScreen * /* screen */, int /* cols */); @@ -744,12 +789,12 @@ extern int set_cur_row(TScreen * /* screen */, int /* value */); #endif /* doublechr.c */ -extern void xterm_DECDHL (Bool /* top */); -extern void xterm_DECSWL (void); -extern void xterm_DECDWL (void); +extern void xterm_DECDHL (XtermWidget /* xw */, Bool /* top */); +extern void xterm_DECSWL (XtermWidget /* xw */); +extern void xterm_DECDWL (XtermWidget /* xw */); #if OPT_DEC_CHRSET -extern int xterm_Double_index(unsigned /* chrset */, unsigned /* flags */); -extern GC xterm_DoubleGC(unsigned /* chrset */, unsigned /* flags */, GC /* old_gc */); +extern int xterm_Double_index(XtermWidget /* xw */, unsigned /* chrset */, unsigned /* flags */); +extern GC xterm_DoubleGC(XtermWidget /* xw */, unsigned /* chrset */, unsigned /* flags */, GC /* old_gc */); #endif /* input.c */ @@ -761,10 +806,6 @@ extern void StringInput (XtermWidget /* xw */, Char * /* string */, size_t /* n extern void VTInitModifiers(XtermWidget /* xw */); #endif -#if OPT_TCAP_QUERY -extern int xtermcapKeycode(XtermWidget /* xw */, char ** /* params */, unsigned * /* state */, Bool * /* fkey */); -#endif - /* main.c */ #ifndef __UNIXOS2__ #define ENVP_ARG /**/ @@ -814,9 +855,9 @@ extern int xerror (Display * /* d */, XErrorEvent * /* ev */); extern int xioerror (Display * /* dpy */); extern int xtermResetIds(TScreen * /* screen */); extern void Bell (Atom /* which */, int /* percent */); +extern void ChangeIconName (char * /* name */); +extern void ChangeTitle (char * /* name */); extern void ChangeXprop (char * /* name */); -extern void Changename (char * /* name */); -extern void Changetitle (char * /* name */); extern void Cleanup (int /* code */); extern void HandleBellPropertyChange PROTO_XT_EV_HANDLER_ARGS; extern void HandleEightBitKeyPressed PROTO_XT_ACTIONS_ARGS; @@ -825,6 +866,7 @@ extern void HandleFocusChange PROTO_XT_EV_HANDLER_ARGS; extern void HandleInterpret PROTO_XT_ACTIONS_ARGS; extern void HandleKeyPressed PROTO_XT_ACTIONS_ARGS; extern void HandleLeaveWindow PROTO_XT_EV_HANDLER_ARGS; +extern void HandleSpawnTerminal PROTO_XT_ACTIONS_ARGS; extern void HandleStringEvent PROTO_XT_ACTIONS_ARGS; extern void Panic (char * /* s */, int /* a */); extern void Redraw (void); @@ -889,6 +931,7 @@ extern void xtermPrintScreen (Bool /* use_DECPEX */); #define PtySelect fd_set #endif +extern Bool decodeUtf8 (PtyData * /* data */); extern int readPtyData (TScreen * /* screen */, PtySelect * /* select_mask */, PtyData * /* data */); extern void fillPtyData (TScreen * /* screen */, PtyData * /* data */, char * /* value */, int /* length */); extern void initPtyData (PtyData ** /* data */); @@ -902,6 +945,8 @@ extern void noleaks_ptydata ( void ); extern Bool morePtyData (TScreen * /* screen */, PtyData * /* data */); extern Char *convertToUTF8 (Char * /* lp */, unsigned /* c */); extern IChar nextPtyData (TScreen * /* screen */, PtyData * /* data */); +extern IChar skipPtyData (PtyData * /* data */); +extern PtyData * fakePtyData(PtyData * /* result */, Char * /* next */, Char * /* last */); extern void switchPtyData (TScreen * /* screen */, int /* f */); extern void writePtyData (int /* f */, IChar * /* d */, unsigned /* len */); #else @@ -982,11 +1027,11 @@ extern void HandleScrollBack PROTO_XT_ACTIONS_ARGS; extern void HandleScrollForward PROTO_XT_ACTIONS_ARGS; extern void ResizeScrollBar (XtermWidget /* xw */); extern void ScrollBarDrawThumb (Widget /* scrollWidget */); -extern void ScrollBarOff (TScreen * /* screen */); +extern void ScrollBarOff (XtermWidget /* xw */); extern void ScrollBarOn (XtermWidget /* xw */, int /* init */, int /* doalloc */); extern void ScrollBarReverseVideo (Widget /* scrollWidget */); -extern void ToggleScrollBar (XtermWidget /* w */); -extern void WindowScroll (TScreen * /* screen */, int /* top */); +extern void ToggleScrollBar (XtermWidget /* xw */); +extern void WindowScroll (XtermWidget /* xw */, int /* top */); #ifdef SCROLLBAR_RIGHT extern void updateRightScrollbar(XtermWidget /* xw */); @@ -1008,7 +1053,6 @@ extern int AddToRefresh (TScreen * /* screen */); extern int HandleExposure (XtermWidget /* xw */, XEvent * /* event */); extern int char2lower (int /* ch */); extern int drawXtermText (XtermWidget /* xw */, unsigned /* flags */, GC /* gc */, int /* x */, int /* y */, int /* chrset */, PAIRED_CHARS(Char * /* text */, Char * /* text2 */), Cardinal /* len */, int /* on_wide */); -extern void ChangeAnsiColors (XtermWidget /* xw */); extern void ChangeColors (XtermWidget /* xw */, ScrnColors * /* pNew */); extern void ClearRight (XtermWidget /* xw */, int /* n */); extern void ClearScreen (XtermWidget /* xw */); @@ -1024,6 +1068,7 @@ extern void decode_keyboard_type (XtermWidget /* xw */, struct XTERM_RESOURCE * extern void decode_wcwidth (int /* mode */); extern void do_erase_display (XtermWidget /* xw */, int /* param */, int /* mode */); extern void do_erase_line (XtermWidget /* xw */, int /* param */, int /* mode */); +extern void getXtermSizeHints (XtermWidget /* xw */); extern void init_keyboard_type (XtermWidget /* xw */, xtermKeyboardType /* type */, Bool /* set */); extern void recolor_cursor (TScreen * /* screen */, Cursor /* cursor */, unsigned long /* fg */, unsigned long /* bg */); extern void resetXtermGC (XtermWidget /* xw */, unsigned /* flags */, Bool /* hilite */); @@ -1031,6 +1076,8 @@ extern void scrolling_copy_area (XtermWidget /* xw */, int /* firstline */, int extern void set_keyboard_type (XtermWidget /* xw */, xtermKeyboardType /* type */, Bool /* set */); extern void toggle_keyboard_type (XtermWidget /* xw */, xtermKeyboardType /* type */); extern void update_keyboard_type (void); +extern void xtermClear (XtermWidget /* xw */); +extern void xtermRepaint (XtermWidget /* xw */); extern void xtermScroll (XtermWidget /* xw */, int /* amount */); extern void xtermSizeHints (XtermWidget /* xw */, int /* scrollbarWidth */); @@ -1056,11 +1103,13 @@ extern void ClearCurBackground (XtermWidget /* xw */, int /* top */, int /* le #if OPT_COLOR_RES #define GET_COLOR_RES(res) xtermGetColorRes(&(res)) #define SET_COLOR_RES(res,color) (res)->value = color +#define EQL_COLOR_RES(res,color) (res)->value == color #define T_COLOR(v,n) (v)->Tcolors[n].value extern Pixel xtermGetColorRes(ColorRes *res); #else #define GET_COLOR_RES(res) res #define SET_COLOR_RES(res,color) *res = color +#define EQL_COLOR_RES(res,color) *res == color #define T_COLOR(v,n) (v)->Tcolors[n] #endif @@ -1087,9 +1136,12 @@ extern Pixel xtermGetColorRes(ColorRes *res); #else /* !OPT_ISO_COLORS */ +#define ClearDFtBackground(xw, top, left, height, width) \ + ClearCurBackground(xw, top, left, height, width) + #define ClearCurBackground(xw, top, left, height, width) \ XClearArea (xw->screen.display, VWindow(&(xw->screen)), \ - left, top, width, height, FALSE) + left, top, width, height, False) #define extract_fg(xw, color, flags) (xw)->cur_foreground #define extract_bg(xw, color, flags) (xw)->cur_background @@ -1120,7 +1172,21 @@ extern Pixel xtermGetColorRes(ColorRes *res); extern unsigned getXtermCell (TScreen * /* screen */, int /* row */, int /* col */); extern void putXtermCell (TScreen * /* screen */, int /* row */, int /* col */, int /* ch */); +#if OPT_HIGHLIGHT_COLOR +#define isNotForeground(xw, fg, bg, sel) \ + ((sel) != T_COLOR(&((xw)->screen), TEXT_FG) \ + && (sel) != (fg) \ + && (sel) != (bg) \ + && (sel) != (xw)->dft_foreground) +#define isNotBackground(xw, fg, bg, sel) \ + ((sel) != T_COLOR(&((xw)->screen), TEXT_BG) \ + && (sel) != (fg) \ + && (sel) != (bg) \ + && (sel) != (xw)->dft_background) +#endif + #if OPT_WIDE_CHARS +extern unsigned AsciiEquivs(unsigned /* ch */); extern unsigned getXtermCellComb (TScreen * /* screen */, int /* row */, int /* col */, int /* off */); extern unsigned getXtermCellComb1 (TScreen * /* screen */, int /* row */, int /* col */); extern unsigned getXtermCellComb2 (TScreen * /* screen */, int /* row */, int /* col */); diff --git a/app/xterm/xterm.man b/app/xterm/xterm.man index 7331c6289..0fac5c522 100644 --- a/app/xterm/xterm.man +++ b/app/xterm/xterm.man @@ -1,6 +1,7 @@ -.\" $XTermId: xterm.man,v 1.355 2006/07/31 23:14:27 tom Exp $ +'\" t +.\" $XTermId: xterm.man,v 1.380 2007/03/24 00:05:57 tom Exp $ .\" -.\" Copyright 1996-2005,2006 by Thomas E. Dickey +.\" Copyright 1996-2006,2007 by Thomas E. Dickey .\" .\" All Rights Reserved .\" @@ -441,7 +442,7 @@ This font must be the same height and width as the normal font. If only one of the normal or bold fonts is specified, it will be used as the normal font and the bold font will be produced by overstriking this font. The default is to do overstriking of the normal font. -See also the discussion of \fBboldFont\fP and \fBboldMode\fP resources. +See also the discussion of \fBboldFont\fP, \fBboldMode\fP and \fBalwaysBoldMode\fP resources. .TP 8 .BI -fa " pattern" This option sets the pattern for fonts selected from the FreeType @@ -511,11 +512,7 @@ in the "OverTheSpot" input method. See also the discussion of the \fBximFont\fP resource. .TP 8 .BI -hc " color" -This option specifies the color to use for the background of -selected or otherwise highlighted text. -If not specified, -reverse video is used. -See the discussion of the \fBhighlightColor\fP resource. +(see \fB-selbg\fP). .TP 8 .BI -hf This option indicates that HP Function Key escape codes should be generated @@ -591,7 +588,8 @@ Possible values include: ``default'', ``hp'', ``sco'', -``sun'' and +``sun'', +``tcap'' and ``vt220''. .IP The value ``unknown'', @@ -601,7 +599,8 @@ The value ``default'', suppresses the associated resources .BR hpFunctionKeys , .BR scoFunctionKeys , -.BR sunFunctionKeys +.BR sunFunctionKeys, +.BR tcapFunctionKeys and .BR sunKeyboard , using the Sun/PC keyboard layout. @@ -800,6 +799,16 @@ This option may be turned on and off from the .B +sb This option indicates that a scrollbar should not be displayed. .TP 8 +.BI -selbg " color" +This option specifies the color to use for the background of selected text. +If not specified, reverse video is used. +See the discussion of the \fBhighlightColor\fP resource. +.TP 8 +.BI -selfg " color" +This option specifies the color to use for selected text. +If not specified, reverse video is used. +See the discussion of the \fBhighlightTextColor\fP resource. +.TP 8 .B -sf This option indicates that Sun Function Key escape codes should be generated for function keys. @@ -1064,6 +1073,14 @@ The default is ``XtDefaultBackground.'' .TP 8 .B -bw \fInumber\fP This option specifies the width in pixels of the border surrounding the window. +.IP +This appears to be a legacy of older X releases. +It sets the \fBborderWidth\fP resource of the shell widget, +and may provide advice to your window manager to set the thickness of the +window frame. +Most window managers do not use this information. +See the \fB-b\fP option, which controls the inner border of the \fBxterm\fP +window. .TP 8 .B -display \fIdisplay\fP This option specifies the X server to contact; see \fIX(__miscmansuffix__)\fP. @@ -1151,10 +1168,11 @@ The default is the application name. Enables one (or none) of the various keyboard-type resources: \fBhpFunctionKeys\fP, \fBscoFunctionKeys\fP, -\fBsunFunctionKeys\fP and +\fBsunFunctionKeys\fP, +\fBtcapFunctionKeys\fP and \fBsunKeyboard\fP. The resource's value should be one of the corresponding strings -hp, sco, sun or vt220. +``hp'', ``sco'', ``sun'', ``tcap'' or ``vt220''. The individual resources are provided for legacy support; this resource is simpler to use. .TP 8 @@ -1174,6 +1192,19 @@ Specifies whether write access to the terminal is allowed initially. See .BR mesg (1). The default is ``true''. +.TP 9 +.B "menuLocale (\fPclass\fB MenuLocale)" +Specify the locale used for character-set computations when loading +the popup menus. +Use this to improve initialization performance of the Athena popup menus, +which may load unnecessary (and very large) fonts, e.g., +in a locale having UTF-8 encoding. +The default is an empty string, which uses the current locale setting. +.IP +Set it to ``C'' to achieve the best performance using the default +menu resource settings. +If you happen to be using localized menu resources, +set the resource accordingly. .TP 8 .B "minBufSize (\fPclass\fB MinBufSize)" Specify the minimum size of the input buffer, i.e., the amount of data @@ -1195,6 +1226,7 @@ configuration, using the \fBkb\fP string from the termcap entry as a reference, if available. In either case, the result is applied to the TERMCAP variable which \fIxterm\fP sets. +See also the \fBttyModes\fP resource, which may modify this. The default is ``false''. .TP 8 .B "sameName (\fPclass\fB SameName)" @@ -1245,6 +1277,12 @@ as described for the \fBeightBitInput\fP resource. If they do, note that the PC-style bindings are evaluated first. See also the \fBkeyboardType\fP resource. .TP 8 +.B "tcapFunctionKeys (\fPclass\fB TcapFunctionKeys)" +Specifies whether or not function key escape codes read from the +termcap/terminfo entry should be generated for +function keys instead of standard escape sequences. +See also the \fBkeyboardType\fP resource. +.TP 8 .B "termName (\fPclass\fB TermName)" Specifies the terminal type name to be set in the TERM environment variable. .TP 8 @@ -1291,6 +1329,10 @@ the default terminal settings without having to do an \fIstty\fP every time an \fIxterm\fP is started. Note, however, that the stty program on a given host may use different keywords; \fIxterm\fR's table is built-in. +.IP +If the \fBttyModes\fP resource specifies a value for \fBerase\fP, +that overrides the \fBptyInitialErase\fP resource setting, +i.e., \fIxterm\fP initializes the terminal to match that value. .TP 8 .B "useInsertMode (\fPclass\fB UseInsertMode)" Force use of insert mode by adding appropriate entries to the TERMCAP @@ -1325,7 +1367,8 @@ Most window managers will detect this change immediately, showing you which window has the output. (A similar feature was in x10 \fIxterm\fR.) The default is ``false.'' -. +.\" +.SS VT100 Widget Resources .PP The following resources are specified as part of the \fIvt100\fP widget (class \fIVT100\fP): @@ -1363,6 +1406,51 @@ Specifies whether extended window control sequences (as used in dtterm) for should be allowed. The default is ``true.'' .TP 8 +.B "altIsNotMeta (\fPclass\fB AltIsNotMeta\fP)" +If ``true'', treat the Alt-key as if it were the Meta-key. +Your keyboard may happen to be configured so they are the same. +But if they are not, this allows you to use the same prefix- and shifting +operations with the Alt-key as with the Meta-key. +See \fBaltSendsEscape\fP and \fBmetaSendsEscape\fP. +The default is ``false.'' +.TP 8 +.B "altSendsEscape (\fPclass\fB AltSendsEscape\fP)" +This is an additional keyboard operation that may be processed +after the logic for \fBmetaSendsEscape\fP. +It is only available if the \fBaltIsNotMeta\fP resource is set. +.IP +If ``true'', Alt characters +(a character combined with the modifier associated with left/right Alt-keys) +are converted into a two-character +sequence with the character itself preceded by ESC. +This applies as well to function key control sequences, unless \fIxterm\fP +sees that \fBAlt\fP is used in your key translations. +If ``false'', Alt characters input from the keyboard cause a shift to +8-bit characters (just like \fBmetaSendsEscape\fP). +By combining the Alt- and Meta-modifiers, you can create corresponding +combinations of ESC-prefix and 8-bit characters. +The default is ``false.'' +.TP 8 +.B "alwaysBoldMode (\fPclass\fB AlwaysBoldMode)" +Specifies whether \fIxterm\fP should check if the normal and bold +fonts are distinct before deciding whether to use overstriking to +simulate bold fonts. +If this resource is true, +\fIxterm\fP does not make the check for +distinct fonts when deciding how to handle the \fBboldMode\fP resource. +The default is ``false.'' +.TS +l l l l +_ _ _ _ +l l l l. +\fIboldMode\fR \fIalwaysBoldMode\fR \fIComparison\fR \fIAction\fP +false false ignored use font +false true ignored use font +true false same overstrike +true false different use font +true true ignored overstrike +.TE +.TP 8 .B "alwaysHighlight (\fPclass\fB AlwaysHighlight)" Specifies whether or not \fIxterm\fP should always display a highlighted text cursor. @@ -1416,6 +1504,11 @@ Specifies the color to use for the background of the window. The default is ``XtDefaultBackground.'' .TP 8 +.B "bellIsUrgent (\fPclass\fB BellIsUrgent)" +Specifies whether to set the Urgency hint for the window manager +when making a bell sound. +The default is ``false.'' +.TP 8 .B "bellOnReset (\fPclass\fB BellOnReset)" Specifies whether to sound a bell when doing a hard reset. The default is ``true.'' @@ -1446,13 +1539,19 @@ overstruck to simulate bold fonts if the resolved bold font is the same as the normal font. It may be desirable to disable bold fonts when color is being used for the bold attribute. +.IP Note that \fIxterm\fP has one bold font which you may set explicitly. -It attempts to match a bold font for the other font selections +\fIXterm\fP attempts to derive a bold font for the other font selections (\fBfont1\fP through \fBfont6\fP). -If the normal and bold fonts are distinct, this resource has no effect. +If it cannot find a bold font, it will use the normal font. +In each case (whether the explicit resource or the derived font), +if the normal and bold fonts are distinct, this resource has no effect. The default is ``true.'' .IP -Although \fIxterm\fP attempts to match a bold font for other font selections, +See the \fBalwaysBoldMode\fP resource which can modify the behavior +of this resource. +.IP +Although \fIxterm\fP attempts to derive a bold font for other font selections, the font server may not cooperate. Since X11R6, bitmap fonts have been scaled. The font server claims to provide the bold font that \fIxterm\fP requests, @@ -1507,9 +1606,7 @@ used to switch between 80 and 132 columns, should be honored. The default is ``false.'' .TP 8 .B "cacheDoublesize (\fPclass\fB CacheDoublesize)" -Specifies the maximum number of double-sized fonts which are cached by -\fIxterm\fR. -The default (8) may be too large for some X terminals with limited memory. +Tells whether to cache double-sized fonts by \fIxterm\fR. Set this to zero to disable doublesize fonts altogether. .TP 8 .B "charClass (\fPclass\fB CharClass)" @@ -1544,7 +1641,7 @@ The default is ``false.'' .B "color6 (\fPclass\fB Color6)" .TP 8 .B "color7 (\fPclass\fB Color7)" -These specify the colors for the ISO 6429 extension. +These specify the colors for the ISO-6429 extension. The defaults are, respectively, black, @@ -1574,7 +1671,7 @@ to be used as brighter versions. .B "color14 (\fPclass\fB Color14)" .TP 8 .B "color15 (\fPclass\fB Color15)" -These specify the colors for the ISO 6429 extension if the bold attribute +These specify the colors for the ISO-6429 extension if the bold attribute is also enabled. The default resource values are respectively, gray30, @@ -1628,7 +1725,7 @@ Note that setting \fBcolorMode\fR off disables all colors, including this. The default is ``false.'' .TP 8 .B "colorMode (\fPclass\fB ColorMode)" -Specifies whether or not recognition of ANSI (ISO 6429) +Specifies whether or not recognition of ANSI (ISO-6429) color change escape sequences should be enabled. The default is ``true.'' .TP 8 @@ -1732,14 +1829,14 @@ The default is ``false.'' .TP 8 .B "eightBitInput (\fPclass\fB EightBitInput\fP)" If ``true'', Meta characters -(a single-byte character combined with the \fIkeys\fP modifier key) +(a single-byte character combined with the \fIMeta\fP modifier key) input from the keyboard are presented as a single character with the eighth bit turned on. The terminal is put into 8-bit mode. If ``false'', Meta characters are converted into a two-character sequence with the character itself preceded by ESC. On startup, \fIxterm\fP tries to put the terminal into 7-bit mode. -The \fBmetaSendsEscape\fP resource may override this. +The \fBmetaSendsEscape\fP and \fBaltSendsEscape\fP resources may override this. The default is ``true.'' .IP Generally keyboards do not have a key labeled "Meta", @@ -1793,6 +1890,32 @@ If the application uses double-wide characters and this resource is not given, Specify the pointsize for fonts selected from the FreeType library if support for that library was compiled into \fIxterm\fR. The default is ``14.'' +On the \fBVT\ Fonts\fP menu, this corresponds to the \fIDefault\fP entry. +You can specify the pointsize for TrueType fonts selected with the other +size-related menu entries such as Medium, Huge, etc., by using one of +the following resource values. +If you do not specify a value, +they default to ``0.0'', +which causes \fIxterm\fP to use the ratio of font sizes from the bitmap +font resources to obtain a TrueType pointsize. +.TP 8 +.B "faceSize1 (\fPclass\fB FaceSize1)" +Specifies the pointsize of the first alternative font. +.TP 8 +.B "faceSize2 (\fPclass\fB FaceSize2)" +Specifies the pointsize of the second alternative font. +.TP 8 +.B "faceSize3 (\fPclass\fB FaceSize3)" +Specifies the pointsize of the third alternative font. +.TP 8 +.B "faceSize4 (\fPclass\fB FaceSize4)" +Specifies the pointsize of the fourth alternative font. +.TP 8 +.B "faceSize5 (\fPclass\fB FaceSize5)" +Specifies the pointsize of the fifth alternative font. +.TP 8 +.B "faceSize6 (\fPclass\fB FaceSize6)" +Specifies the pointsize of the sixth alternative font. .TP 8 .B "font (\fPclass\fB Font)" Specifies the name of the normal font. @@ -1813,7 +1936,7 @@ xterm.vt100.font .IP and .RS -xterm.vt100..utf8fonts.font +xterm.vt100.utf8fonts.font .RE .IP which is probably not what you intended. @@ -1885,9 +2008,8 @@ Specifies the preferred size and position of the VT102 window. There is no default for this resource. .TP 8 .B "highlightColor (\fPclass\fB HighlightColor)" -Specifies the color to use for the background of selected or otherwise -highlighted text. -If not specified, reverse video is used. +Specifies the color to use for the background of selected (highlighted) text. +If not specified (i.e., matching the default foreground), reverse video is used. The default is ``XtDefaultForeground.'' .TP 8 .B "highlightSelection (\fPclass\fB HighlightSelection)" @@ -1906,6 +2028,11 @@ Blanks written since the last erase are selectable. If you do not wish to have trailing blanks in a selection, use the \fBtrimSelection\fP resource. .TP 8 +.B "highlightTextColor (\fPclass\fB HighlightTextColor)" +Specifies the color to use for the foreground of selected (highlighted) text. +If not specified (i.e., matching the default background), reverse video is used. +The default is ``XtDefaultBackground.'' +.TP 8 .B "hpLowerleftBugCompat (\fPclass\fB HpLowerleftBugCompat)" Specifies whether to work around a bug in HP's \fIxdb\fP, which ignores termcap and always sends @@ -1939,6 +2066,11 @@ Specifies the font for the miniature active icon window, if this feature is compiled into \fIxterm\fR. The default is "nil2". .TP 8 +.B "initialFont (\fPclass\fB InitialFont)" +Specifies which of the VT100 fonts to use initially. +Values are the same as for the \fIset-vt-font\fP action. +The default is ``d'', i.e., "default". +.TP 8 .B "internalBorder (\fPclass\fB BorderWidth)" Specifies the number of pixels between the characters and the window border. The default is 2. @@ -2060,6 +2192,8 @@ Control-, Shift-, Alt- or Meta-modifiers are used to add a parameter to the escape sequence returned by a cursor-key. The default is ``2'': .IP +Set it to -1 to disable it. +.br Set it to 0 to use the old/obsolete behavior. .br Set it to 1 to prefix modified sequences with CSI. @@ -2076,7 +2210,7 @@ the escape sequence returned by a (numbered) function-key. The default is ``2''. The resource values are similar to \fBmodifyCursorKeys\fP: .IP -Set it to -1 to permit the user to user shift- and control-modifiers +Set it to -1 to permit the user to use shift- and control-modifiers to construct function-key strings using the normal encoding scheme. .br Set it to 0 to use the old/obsolete behavior. @@ -2143,7 +2277,8 @@ The default is ``false.'' .TP 8 .B "nMarginBell (\fPclass\fB Column)" Specifies the number of characters from the right margin at which the margin -bell should be rung, when enabled. +bell should be rung, when enabled by the \fBmarginBell\fP resource. +The default is 10. .TP 8 .B "numLock (\fPclass\fB NumLock)" If ``true'', \fIxterm\fR checks if NumLock is used as a modifier (see \fIxmodmap\fP(1)). @@ -2226,8 +2361,7 @@ Specifies the name of the shape of the pointer. The default is ``xterm.'' .TP 8 .B "popOnBell (\fPclass\fB PopOnBell)" -Specifies whether the window would be raised when Control-G is -received. +Specifies whether the window would be raised when Control-G is received. The default is ``false.'' .TP 8 .B "printAttributes (\fPclass\fB PrintAttributes)" @@ -2449,6 +2583,13 @@ It may be desirable to disable underlining when color is being used for the underline attribute. The default is ``true.'' .TP 8 +.B "useClipping (\fPclass\fB UseClipping)" +Tell \fIxterm\fP whether to use clipping to keep +from producing dots outside the text drawing area. +Originally used to work around for overstriking effects, +this is also needed to work with some incorrectly-sized fonts. +The default is ``true.'' +.TP 8 .B "utf8 (\fPclass\fB Utf8)" This specifies whether \fIxterm\fP will run in UTF-8 mode. If you set this resource, \fIxterm\fP also sets the \fBwideChars\fP resource as a side-effect. @@ -2572,7 +2713,8 @@ The font is be supplied by a "fontset", whose default value is "*". This matches every font, the X library automatically chooses fonts with proper charsets. The \fBximFont\fP resource is provided to override this default font setting. -. +.\" +.SS Tek4014 Widget Resources .PP The following resources are specified as part of the \fItek4014\fP widget (class \fITek4014\fP). @@ -2606,7 +2748,8 @@ The default is ``large.'' .TP 8 .B "width (\fPclass\fB Width)" Specifies the width of the Tektronix window in pixels. -. +.\" +.SS Menu Resources .PP The resources that may be specified for the various menus are described in the documentation for the Athena \fBSimpleMenu\fP widget. @@ -2737,12 +2880,12 @@ This entry invokes the \fBset-cursesemul(toggle)\fP action. .B "visualbell (\fPclass\fB SmeBSB)" This entry invokes the \fBset-visualbell(toggle)\fP action. .TP 8 +.B "bellIsUrgent (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-bellIsUrgent(toggle)\fP action. +.TP 8 .B "poponbell (\fPclass\fB SmeBSB)" This entry invokes the \fBset-poponbell(toggle)\fP action. .TP 8 -.B "marginbell (\fPclass\fB SmeBSB)" -This entry invokes the \fBset-marginbell(toggle)\fP action. -.TP 8 .B "cursorblink (\fPclass\fB SmeBSB)" This entry invokes the \fBset-cursorblink(toggle)\fP action. .TP 8 @@ -2826,7 +2969,7 @@ This entry invokes the \fBset-utf8-title(s)\fP action. The \fItekMenu\fP has the following entries: .TP 8 .B "tektextlarge (\fPclass\fB SmeBSB)" -This entry invokes the \fBset-tek-text(l)\fP action. +This entry invokes the \fBset-tek-text(large)\fP action. .TP 8 .B "tektext2 (\fPclass\fB SmeBSB)" This entry invokes the \fBset-tek-text(2)\fP action. @@ -2835,7 +2978,7 @@ This entry invokes the \fBset-tek-text(2)\fP action. This entry invokes the \fBset-tek-text(3)\fP action. .TP 8 .B "tektextsmall (\fPclass\fB SmeBSB)" -This entry invokes the \fBset-tek-text(s)\fP action. +This entry invokes the \fBset-tek-text(small)\fP action. .TP 8 .B "tekpage (\fPclass\fB SmeBSB)" This entry invokes the \fBtek-page()\fP action. @@ -2854,7 +2997,8 @@ This entry invokes the \fBset-terminal-type(vt)\fP action. .TP 8 .B "tekhide (\fPclass\fB SmeBSB)" This entry invokes the \fBset-visibility(tek,toggle)\fP action. -. +.\" +.SS Scrollbar Resources .PP The following resources are useful when specified for the Athena Scrollbar widget: @@ -3231,7 +3375,7 @@ resource. . .TP Scroll to Bottom on Tty Output (scrollttyoutput) -Enable (or disable) scrolling to the bottom of the scrolling region on output to the terminal.. +Enable (or disable) scrolling to the bottom of the scrolling region on output to the terminal. This corresponds to the .B -si option and the @@ -3267,21 +3411,19 @@ option and the resource. . .TP -Enable Pop on Bell (poponbell) -Enable (or disable) raising of the window when Control-G is received. +Enable Bell Urgency (bellIsUrgent) +Enable (or disable) Urgency window manager hint when Control-G is received. This corresponds to the -.B -pop -option and the -.B popOnBell +.B bellIsUrgent resource. . .TP -Enable Margin Bell (marginbell) -Enable (or disable) a bell when the user types near the right margin. +Enable Pop on Bell (poponbell) +Enable (or disable) raising of the window when Control-G is received. This corresponds to the -.B -mb +.B -pop option and the -.B marginBell +.B popOnBell resource. . .TP @@ -3585,7 +3727,7 @@ will sound in warning. . . .SH "CHARACTER CLASSES" -Clicking the left mouse button twice in rapid succession +Clicking the left pointer button twice in rapid succession (double-clicking) causes all characters of the same class (e.g., letters, white space, punctuation) to be selected as a ``word''. Since different people have different preferences for what should @@ -3889,6 +4031,10 @@ entry in \fImainMenu\fP. This action is similar to \fBselect-end\fP except that it should be used with \fBselect-cursor-start\fP. .TP 8 +.B "select-cursor-extend()" +This action is similar to \fBselect-extend\fP except that it should be used +with \fBselect-cursor-start\fP. +.TP 8 .B "select-cursor-start()" This action is similar to \fBselect-start\fP except that it begins the selection at the current text cursor position. @@ -3957,6 +4103,10 @@ the \fBautowrap\fP entry in \fIvtMenu\fP. This action toggles the \fBbackarrowKey\fP resource and is also invoked from the \fBbackarrow key\fP entry in \fIvtMenu\fP. .TP 8 +.B "set-bellIsUrgent(\fIon/off/toggle\fP)" +This action toggles the \fBbellIsUrgent\fP resource and is also invoked +by the \fBbellIsUrgent\fP entry in \fIvtMenu\fP. +.TP 8 .B "set-cursorblink(\fIon/off/toggle\fP)" This action toggles the \fBcursorBlink\fP resource and is also invoked from the \fBcursorblink\fP entry in \fIvtMenu\fP. @@ -3990,8 +4140,7 @@ This action toggles the state of legacy function keys and is also invoked by the \fBoldFunctionKeys\fP entry in \fImainMenu\fP. .TP 8 .B "set-marginbell(\fIon/off/toggle\fP)" -This action toggles the \fBmarginBell\fP resource and is also invoked from -the \fBmarginbell\fP entry in \fIvtMenu\fP. +This action toggles the \fBmarginBell\fP resource. .TP 8 .B "set-num-lock()" This action toggles the state of the \fBnumLock\fP resource. @@ -4044,7 +4193,7 @@ the \fBsunKeyboard\fP entry in \fImainMenu\fP. This action sets font used in the Tektronix window to the value of the resources \fBtektextlarge\fP, \fBtektext2\fP, \fBtektext3\fP, and \fBtektextsmall\fP according to the argument. -It is also by the entries +It is also invoked by the entries of the same names as the resources in \fItekMenu\fP. .TP 8 .B "set-terminal-type(\fItype\fP)" @@ -4115,6 +4264,21 @@ This action resets the scrolling region and is also invoked from the \fBsoftreset\fP entry in \fIvtMenu\fP. The effect is identical to a soft reset (DECSTR) control sequence. .TP 8 +.B "spawn-new-terminal(params)" +Spawn a new \fIxterm\fP process. +This is available on systems which have a modern version of the +process filesystem, e.g., "/proc", which \fIxterm\fP can read. +.IP +Use the "cwd" process entry, e.g., /proc/12345/cwd to obtain the +working directory of the process which is running in the current \fIxterm\fP. +.IP +On systems which have the "exe" process entry, e.g., /proc/12345/exe, +use this to obtain the actual executable. +Otherwise, use the $PATH variable to find \fIxterm\fP. +.IP +If parameters are given in the action, +pass them to the new \fIxterm\fP process. +.TP 8 .B "start-extend()" This action is similar to \fBselect-start\fP except that the selection is extended to the current pointer location. @@ -4221,25 +4385,38 @@ which is set by the \fBselectToClipboard\fP resource: <BtnDown>:ignore() .DE .PP +The default bindings for the scrollbar widget +are separate from the VT100 widget: +.DS +.ta 2.5i + <Btn5Down>: StartScroll(Forward) \\n\\\& + <Btn1Down>: StartScroll(Forward) \\n\\\& + <Btn2Down>: StartScroll(Continuous) MoveThumb() NotifyThumb() \\n\\\& + <Btn3Down>: StartScroll(Backward) \\n\\\& + <Btn4Down>: StartScroll(Backward) \\n\\\& + <Btn2Motion>: MoveThumb() NotifyThumb() \\n\\\& + <BtnUp>: NotifyScroll(Proportional) EndScroll() +.DE +.PP The default bindings in the Tektronix window are: .DS .ta 2.5i - ~Meta<KeyPress>: insert-seven-bit() \\n\\\& - Meta<KeyPress>: insert-eight-bit() \\n\\\& - !Ctrl <Btn1Down>: popup-menu(mainMenu) \\n\\\& - !Lock Ctrl <Btn1Down>: popup-menu(mainMenu) \\n\\\& -!Lock Ctrl @Num_Lock <Btn1Down>: popup-menu(mainMenu) \\n\\\& - !Ctrl @Num_Lock <Btn1Down>: popup-menu(mainMenu) \\n\\\& - !Ctrl <Btn2Down>: popup-menu(tekMenu) \\n\\\& - !Lock Ctrl <Btn2Down>: popup-menu(tekMenu) \\n\\\& -!Lock Ctrl @Num_Lock <Btn2Down>: popup-menu(tekMenu) \\n\\\& - !Ctrl @Num_Lock <Btn2Down>: popup-menu(tekMenu) \\n\\\& - Shift ~Meta<Btn1Down>: gin-press(L) \\n\\\& - ~Meta<Btn1Down>: gin-press(l) \\n\\\& - Shift ~Meta<Btn2Down>: gin-press(M) \\n\\\& - ~Meta<Btn2Down>: gin-press(m) \\n\\\& - Shift ~Meta<Btn3Down>: gin-press(R) \\n\\\& - ~Meta<Btn3Down>: gin-press(r) + ~Meta<KeyPress>: insert-seven-bit() \\n\\\& + Meta<KeyPress>: insert-eight-bit() \\n\\\& + !Ctrl <Btn1Down>: popup-menu(mainMenu) \\n\\\& + !Lock Ctrl <Btn1Down>: popup-menu(mainMenu) \\n\\\& + !Lock Ctrl @Num_Lock <Btn1Down>: popup-menu(mainMenu) \\n\\\& + !Ctrl @Num_Lock <Btn1Down>: popup-menu(mainMenu) \\n\\\& + !Ctrl <Btn2Down>: popup-menu(tekMenu) \\n\\\& + !Lock Ctrl <Btn2Down>: popup-menu(tekMenu) \\n\\\& + !Lock Ctrl @Num_Lock <Btn2Down>: popup-menu(tekMenu) \\n\\\& + !Ctrl @Num_Lock <Btn2Down>: popup-menu(tekMenu) \\n\\\& + Shift ~Meta<Btn1Down>: gin-press(L) \\n\\\& + ~Meta<Btn1Down>: gin-press(l) \\n\\\& + Shift ~Meta<Btn2Down>: gin-press(M) \\n\\\& + ~Meta<Btn2Down>: gin-press(m) \\n\\\& + Shift ~Meta<Btn3Down>: gin-press(R) \\n\\\& + ~Meta<Btn3Down>: gin-press(r) .DE .PP Here is an example which uses shifted select/paste to copy to the clipboard, @@ -4273,11 +4450,24 @@ keys for entering commonly-typed works: <Key>F19: string("continue") string(0x0d) \\n\\\& <Key>F20: string("print ") insert-selection(PRIMARY, CUT_BUFFER0) .DE +.PP +Some people prefer using the left pointer button +for dragging the scrollbar thumb. +That can be setup by altering the translations resource, e.g., +.DS +.ta .5i 1.5i +*VT100.scrollbar.translations: #override \\n\\\& + <Btn5Down>: StartScroll(Forward) \\n\\\& + <Btn1Down>: StartScroll(Continuous) MoveThumb() NotifyThumb() \\n\\\& + <Btn4Down>: StartScroll(Backward) \\n\\\& + <Btn1Motion>: MoveThumb() NotifyThumb() \\n\\\& + <BtnUp>: NotifyScroll(Proportional) EndScroll() +.DE .SH "CONTROL SEQUENCES AND KEYBOARD" The \fIXterm Control Sequences\fP document lists the control sequences which an application can send \fIxterm\fP to make it perform various operations. Most of these operations are standardized, from either the DEC or Tektronix -terminals, or from more widely used standards such as ISO 6429. +terminals, or from more widely used standards such as ISO-6429. . . .SH ENVIRONMENT @@ -4631,6 +4821,8 @@ resize(1), luit(1), X(__miscmansuffix__), pty(4), tty(4) (this is the file ctlseqs.ms). .sp http://invisible-island.net/xterm/xterm.html +.br +http://invisible-island.net/xterm/ctlseqs/ctlseqs.html . . .SH AUTHORS @@ -4646,7 +4838,7 @@ Consortium), Dave Serisky (HP), Jonathan Kamens (MIT-Athena), Jason Bacon, Stephen P. Wall, David Wexelblat, and -Thomas Dickey (XFree86 Project). +Thomas Dickey (invisible-island.net). .SH OPENBSD SPECIFICS On OpenBSD, the following resources have different default values: .TP 8 diff --git a/app/xterm/xtermcfg.h b/app/xterm/xtermcfg.h index 2b1edcdf8..bca94a487 100644 --- a/app/xterm/xtermcfg.h +++ b/app/xterm/xtermcfg.h @@ -1,5 +1,5 @@ /* xtermcfg.h. Generated automatically by configure. */ -/* $XTermId: xtermcfg.hin,v 1.154 2006/07/15 12:10:03 tom Exp $ */ +/* $XTermId: xtermcfg.hin,v 1.163 2007/03/21 22:05:18 tom Exp $ */ /* * $XFree86: xc/programs/xterm/xtermcfg.hin,v 3.61 2006/06/19 00:36:52 dickey Exp $ @@ -7,7 +7,7 @@ /************************************************************ -Copyright 1997-2005,2006 by Thomas E. Dickey +Copyright 1997-2006,2007 by Thomas E. Dickey All Rights Reserved @@ -42,6 +42,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. /* #undef DFT_COLORMODE */ /* AC_ARG_WITH(default-color-mode) */ #define DFT_DECID "100" /* AC_ARG_WITH(default-terminal-id) */ #define DFT_TERMTYPE "xterm" /* AC_ARG_WITH(default-term-type) */ +/* #undef DISABLE_SETGID */ /* CF_ARG_DISABLE(setgid) */ /* #undef DISABLE_SETUID */ /* CF_ARG_DISABLE(setuid) */ #define HAVE_GETHOSTNAME 1 /* AC_CHECK_FUNCS(gethostname) */ #define HAVE_GETLOGIN 1 /* AC_CHECK_FUNCS(getlogin) */ @@ -67,6 +68,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #define HAVE_TERMCAP_H 1 /* AC_CHECK_HEADERS(termcap.h) */ #define HAVE_TERMIOS_H 1 /* AC_CHECK_HEADERS(termios.h) */ /* #undef HAVE_TERMIO_C_ISPEED */ /* CF_TERMIO_C_ISPEED */ +#define HAVE_TERM_H 1 /* AC_CHECK_HEADERS(term.h) */ #define HAVE_UNISTD_H 1 /* AC_CHECK_HEADERS(unistd.h) */ #define HAVE_UTMP 1 /* CF_UTMP */ #define HAVE_UTMP_UT_HOST 1 /* CF_UTMP_UT_HOST */ @@ -80,6 +82,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #define HAVE_X11_DECKEYSYM_H 1 /* AC_CHECK_HEADERS(X11/DECkeysym.h) */ #define HAVE_X11_SUNKEYSYM_H 1 /* AC_CHECK_HEADERS(X11/Sunkeysym.h) */ #define HAVE_X11_XPOLL_H 1 /* AC_CHECK_HEADERS(X11/Xpoll.h) */ +#define HAVE_XFTDRAWSETCLIP 1 /* CF_X_FREETYPE */ +#define HAVE_XFTDRAWSETCLIPRECTANGLES 1 /* CF_X_FREETYPE */ #define HAVE_XKB_BELL_EXT 1 /* CF_XKB_BELL_EXT */ #define LUIT_PATH "/usr/X11R6/bin/luit" /* CF_ARG_ENABLE(luit) */ /* #undef NO_ACTIVE_ICON */ /* CF_ARG_DISABLE(active-icon) */ @@ -97,6 +101,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. /* #undef OPT_DABBREV */ /* CF_ARG_ENABLE(dabbrev) */ /* #undef OPT_DEC_CHRSET */ /* CF_ARG_DISABLE(doublechars) */ /* #undef OPT_DEC_LOCATOR */ /* CF_ARG_ENABLE(dec-locator) */ +/* #undef OPT_DEC_RECTOPS */ /* CF_ARG_ENABLE(rectangles) */ +/* #undef OPT_EXEC_XTERM */ /* CF_ARG_ENABLE(exec-xterm) */ /* #undef OPT_HIGHLIGHT_COLOR */ /* CF_ARG_DISABLE(highlighting) */ /* #undef OPT_HP_FUNC_KEYS */ /* CF_ARG_ENABLE(hp-fkeys) */ /* #undef OPT_I18N_SUPPORT */ /* CF_ARG_DISABLE(i18n) */ @@ -116,15 +122,16 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #define OPT_SELECT_REGEX 1 /* CF_ARG_DISABLE(regex) */ /* #undef OPT_SESSION_MGT */ /* CF_ARG_DISABLE(session-mgt) */ /* #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) */ /* #undef OPT_TEK4014 */ /* CF_ARG_DISABLE(tek4014) */ /* #undef OPT_TOOLBAR */ /* CF_ARG_ENABLE(toolbar) */ -/* #undef OPT_TRACE */ /* CF_ARG_ENABLE(trace) */ /* #undef OPT_VT52_MODE */ /* CF_ARG_DISABLE(vt52) */ #define OPT_WIDE_CHARS 1 /* CF_ARG_OPTION(wide-chars) */ /* #undef OPT_XMC_GLITCH */ /* CF_ARG_ENABLE(xmc-glitch) */ /* #undef OPT_ZICONBEEP */ /* CF_ARG_DISABLE(ziconbeep) */ /* #undef OWN_TERMINFO_DIR */ /* AC_ARG_WITH(own-terminfo) */ +/* #undef PROCFS_ROOT */ /* CF_ARG_ENABLE(exec-xterm) */ #define SCROLLBAR_RIGHT 1 /* CF_ARG_ENABLE(rightbar) */ #define SIG_ATOMIC_T volatile sig_atomic_t /* CF_SIG_ATOMIC_T */ /* #undef SVR4 */ /* CF_SVR4, imake */ @@ -158,6 +165,13 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. /* #undef ut_xtime */ /* CF_UTMP_UT_XTIME */ /* + * Ifdef'd to make it simple to override. + */ +#ifndef OPT_TRACE +/* #undef OPT_TRACE */ /* CF_ARG_ENABLE(trace) */ +#endif + +/* * g++ support for __attribute__() is haphazard. */ #ifndef __cplusplus @@ -183,4 +197,6 @@ extern char *my_strerror(int n); #define NO_XPOLL_H /* X11R6.1 & up use Xpoll.h for select() definitions */ #endif +/* vile:cmode + */ #endif /* included_xtermcfg_h */ |