diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2007-08-25 18:58:44 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2007-08-25 18:58:44 +0000 |
commit | 22f880d38f6216541377416bf43500717467421c (patch) | |
tree | a5d1f236428371a90c8a1291dada7713d6a11cfd /app/xterm | |
parent | 3ab81faaae1e1f849274d67a055629ebac26d1fe (diff) |
update to xterm 229. Tested on various architectures by aanriot@
Diffstat (limited to 'app/xterm')
-rw-r--r-- | app/xterm/Makefile.in | 31 | ||||
-rw-r--r-- | app/xterm/Tekproc.c | 92 | ||||
-rw-r--r-- | app/xterm/data.h | 21 | ||||
-rw-r--r-- | app/xterm/main.c | 309 | ||||
-rw-r--r-- | app/xterm/ptyx.h | 42 | ||||
-rw-r--r-- | app/xterm/version.h | 7 | ||||
-rw-r--r-- | app/xterm/xterm.h | 96 | ||||
-rw-r--r-- | app/xterm/xterm.man | 106 | ||||
-rw-r--r-- | app/xterm/xtermcfg.h | 3 |
9 files changed, 513 insertions, 194 deletions
diff --git a/app/xterm/Makefile.in b/app/xterm/Makefile.in index 4a2b98c12..d7867e030 100644 --- a/app/xterm/Makefile.in +++ b/app/xterm/Makefile.in @@ -1,4 +1,4 @@ -## $XTermId: Makefile.in,v 1.145 2007/03/24 00:09:52 tom Exp $ +## $XTermId: Makefile.in,v 1.148 2007/06/16 18:47:51 tom Exp $ ## ## $XFree86: xc/programs/xterm/Makefile.in,v 3.56 2006/06/19 00:36:50 dickey Exp $ ## ## @@ -65,6 +65,7 @@ bindir = @bindir@ libdir = @libdir@ mandir = @mandir@/man$(manext) appsdir = @appsdir@ +icondir = @icondir@ #### End of system configuration section. #### @@ -73,8 +74,9 @@ BINDIR = $(DESTDIR)$(bindir) LIBDIR = $(DESTDIR)$(libdir) MANDIR = $(DESTDIR)$(mandir) APPSDIR = $(DESTDIR)$(appsdir) +ICONDIR = $(DESTDIR)$(icondir) -INSTALL_DIRS = $(BINDIR) $(APPSDIR) $(MANDIR) +INSTALL_DIRS = $(BINDIR) $(APPSDIR) $(ICONDIR) $(MANDIR) CLASS = XTerm EXTRAHDR = @EXTRAHDRS@ @@ -209,6 +211,16 @@ install-full :: $(MANDIR) @no_appsdir@ @sed -e s/XTerm/$(CLASS)/ $(srcdir)/UXTerm.ad >XTerm.tmp @no_appsdir@ @$(INSTALL_DATA) XTerm.tmp $(APPSDIR)/UXTerm @no_appsdir@ @rm -f XTerm.tmp +@no_icondir@ @echo "... installed app-defaults" + +@no_icondir@install \ +@no_icondir@install-icon \ +@no_icondir@install-full :: $(ICONDIR) +@no_icondir@ @$(INSTALL_DATA) $(srcdir)/icons/xterm-color_32x32.xpm $(ICONDIR) +@no_icondir@ @$(INSTALL_DATA) $(srcdir)/icons/xterm-color_48x48.xpm $(ICONDIR) +@no_icondir@ @$(INSTALL_DATA) $(srcdir)/icons/xterm_32x32.xpm $(ICONDIR) +@no_icondir@ @$(INSTALL_DATA) $(srcdir)/icons/xterm_48x48.xpm $(ICONDIR) +@no_icondir@ @echo "... installed icons" install :: @echo 'Completed installation of executables and documentation.' @@ -249,6 +261,21 @@ uninstall-full :: @no_appsdir@ -$(RM) $(APPSDIR)/$(CLASS) @no_appsdir@ -$(RM) $(APPSDIR)/$(CLASS)-color @no_appsdir@ -$(RM) $(APPSDIR)/UXTerm + +@no_icondir@uninstall \ +@no_icondir@uninstall-icon \ +@no_icondir@uninstall-full :: +@no_icondir@ -$(RM) $(ICONDIR)/xterm-color_32x32.xpm +@no_icondir@ -$(RM) $(ICONDIR)/xterm_48x48.xpm +@no_icondir@ -$(RM) $(ICONDIR)/xterm-color_32x32.xpm +@no_icondir@ -$(RM) $(ICONDIR)/xterm_48x48.xpm +################################################################################ +# Desktop-utils does not provide an uninstall, and is not uniformly available. +@desktop_utils@DESKTOP_FLAGS = @DESKTOP_FLAGS@ +@desktop_utils@install-desktop \ +@desktop_utils@install-full :: +@desktop_utils@ desktop-file-install $(DESKTOP_FLAGS) xterm.desktop +@desktop_utils@ desktop-file-install $(DESKTOP_FLAGS) uxterm.desktop ################################################################################ mostlyclean : -$(RM) *$o *.[is] XtermLog.* .pure core *~ *.bak *.BAK *.out *.tmp diff --git a/app/xterm/Tekproc.c b/app/xterm/Tekproc.c index f02f7e836..c01fb9960 100644 --- a/app/xterm/Tekproc.c +++ b/app/xterm/Tekproc.c @@ -1,4 +1,4 @@ -/* $XTermId: Tekproc.c,v 1.155 2007/03/19 23:51:52 tom Exp $ */ +/* $XTermId: Tekproc.c,v 1.157 2007/07/10 19:53:11 tom Exp $ */ /* * Warning, there be crufty dragons here. @@ -948,8 +948,7 @@ TekExpose(Widget w, rcnt = tekRefreshList->count; Tparsestate = curstate = Talptable; TRACE(("TekExpose resets data to replay %d bytes\n", rcnt)); - if (resource.wait_for_map) - first_map_occurred(); + first_map_occurred(); if (!tekscr->waitrefresh) TekRefresh(tw); } @@ -958,20 +957,22 @@ TekExpose(Widget w, void TekRefresh(TekWidget tw) { - 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(XtDisplay(tw), TWindow(tekscr), wait_cursor); - XFlush(XtDisplay(tw)); - if (!setjmp(Tekjump)) - Tekparse(tw); - XDefineCursor(XtDisplay(tw), TWindow(tekscr), - (tekscr->TekGIN && GINcursor) ? GINcursor : tekscr->arrow); + if (tw != 0) { + 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(XtDisplay(tw), TWindow(tekscr), wait_cursor); + XFlush(XtDisplay(tw)); + if (!setjmp(Tekjump)) + Tekparse(tw); + XDefineCursor(XtDisplay(tw), TWindow(tekscr), + (tekscr->TekGIN && GINcursor) ? GINcursor : tekscr->arrow); + } } void @@ -1845,38 +1846,41 @@ TekSimulatePageButton(TekWidget tw, Bool reset) void TekCopy(TekWidget tw) { - TekScreen *tekscr = TekScreenOf(tw); - TScreen *screen = TScreenOf(term); + if (tw != 0) { + TekScreen *tekscr = TekScreenOf(tw); + TScreen *screen = TScreenOf(term); - TekLink *Tp; - char buf[32]; - char initbuf[5]; - int tekcopyfd; + TekLink *Tp; + char buf[32]; + char initbuf[5]; + int tekcopyfd; - timestamp_filename(buf, "COPY"); - if (access(buf, F_OK) >= 0 - && access(buf, W_OK) < 0) { - Bell(XkbBI_MinorError, 0); - return; - } + timestamp_filename(buf, "COPY"); + if (access(buf, F_OK) >= 0 + && access(buf, W_OK) < 0) { + Bell(XkbBI_MinorError, 0); + return; + } #ifndef VMS - if (access(".", W_OK) < 0) { /* can't write in directory */ - Bell(XkbBI_MinorError, 0); - return; - } + if (access(".", W_OK) < 0) { /* can't write in directory */ + Bell(XkbBI_MinorError, 0); + return; + } #endif - if ((tekcopyfd = open_userfile(screen->uid, screen->gid, buf, False)) >= 0) { - sprintf(initbuf, "%c%c%c%c", - ANSI_ESC, (char) (tekscr->page.fontsize + '8'), - ANSI_ESC, (char) (tekscr->page.linetype + '`')); - write(tekcopyfd, initbuf, 4); - Tp = &Tek0; - do { - write(tekcopyfd, Tp->data, Tp->count); - Tp = Tp->next; - } while (Tp); - close(tekcopyfd); + tekcopyfd = open_userfile(screen->uid, screen->gid, buf, False); + if (tekcopyfd >= 0) { + sprintf(initbuf, "%c%c%c%c", + ANSI_ESC, (char) (tekscr->page.fontsize + '8'), + ANSI_ESC, (char) (tekscr->page.linetype + '`')); + write(tekcopyfd, initbuf, 4); + Tp = &Tek0; + do { + write(tekcopyfd, Tp->data, Tp->count); + Tp = Tp->next; + } while (Tp); + close(tekcopyfd); + } } } diff --git a/app/xterm/data.h b/app/xterm/data.h index 73ac717cb..3421dbb60 100644 --- a/app/xterm/data.h +++ b/app/xterm/data.h @@ -1,4 +1,4 @@ -/* $XTermId: data.h,v 1.101 2007/03/16 23:46:24 tom Exp $ */ +/* $XTermId: data.h,v 1.105 2007/07/22 16:03:16 tom Exp $ */ /* $XFree86: xc/programs/xterm/data.h,v 3.39 2006/02/13 01:14:58 dickey Exp $ */ @@ -107,6 +107,8 @@ extern PtySelect Select_mask; extern PtySelect X_mask; extern PtySelect pty_mask; +extern int ice_fd; + extern XtermWidget term; @@ -130,6 +132,19 @@ extern Arg ourTopLevelShellArgs[]; extern Cardinal number_ourTopLevelShellArgs; extern Atom wm_delete_window; +#if HANDLE_STRUCT_NOTIFY +/* Flag icon name with "*** " on window output when iconified. + * I'd like to do something like reverse video, but I don't + * know how to tell this to window managers in general. + * + * mapstate can be IsUnmapped, !IsUnmapped, or -1; + * -1 means no change; the other two are set by event handlers + * and indicate a new mapstate. !IsMapped is done in the handler. + * we worry about IsUnmapped when output occurs. -IAN! + */ +extern int mapstate; +#endif /* HANDLE_STRUCT_NOTIFY */ + typedef struct XTERM_RESOURCE { char *xterm_name; char *icon_geometry; @@ -169,13 +184,15 @@ typedef struct XTERM_RESOURCE { Boolean ptyInitialErase; /* if true, use pty's sense of erase char */ Boolean backarrow_is_erase; /* override backspace/delete */ #endif - Boolean wait_for_map; Boolean useInsertMode; #if OPT_ZICONBEEP int zIconBeep; /* beep level when output while iconified */ #endif #if OPT_PTY_HANDSHAKE + Boolean wait_for_map; + Boolean wait_for_map0; /* ...initial value of .wait_for_map */ Boolean ptyHandshake; /* use pty-handshaking */ + Boolean ptySttySize; /* reset TTY size after pty handshake */ #endif #if OPT_SAME_NAME Boolean sameName; /* Don't change the title or icon name if it is diff --git a/app/xterm/main.c b/app/xterm/main.c index bed1da7cd..6995b740e 100644 --- a/app/xterm/main.c +++ b/app/xterm/main.c @@ -1,4 +1,4 @@ -/* $XTermId: main.c,v 1.557 2007/03/24 15:26:47 tom Exp $ */ +/* $XTermId: main.c,v 1.574 2007/07/22 20:02:22 tom Exp $ */ /* * W A R N I N G @@ -560,10 +560,12 @@ static char **command_to_exec_with_luit = NULL; #define TERMIO_STRUCT struct termio #define ttySetAttr(fd, datap) ioctl(fd, TCSETA, datap) #define ttyGetAttr(fd, datap) ioctl(fd, TCGETA, datap) +#define ttyFlush(fd) ioctl(fd, TCFLSH, 1) #elif defined(USE_POSIX_TERMIOS) #define TERMIO_STRUCT struct termios #define ttySetAttr(fd, datap) tcsetattr(fd, TCSANOW, datap) #define ttyGetAttr(fd, datap) tcgetattr(fd, datap) +#define ttyFlush(fd) tcflush(fd, TCOFLUSH) #endif /* USE_ANY_SYSV_TERMIO */ #ifndef VMS @@ -669,6 +671,7 @@ static struct _xttymodes { static int parse_tty_modes(char *s, struct _xttymodes *modelist); +#ifndef USE_UTEMPTER #ifdef USE_SYSV_UTMP #if (defined(AIXV3) && (OSMAJORVERSION < 4)) && !(defined(getutid)) extern struct utmp *getutid(); @@ -678,7 +681,6 @@ extern struct utmp *getutid(); static char etc_utmp[] = UTMP_FILENAME; #endif /* USE_SYSV_UTMP */ -#ifndef USE_UTEMPTER #if defined(USE_LASTLOG) && defined(USE_STRUCT_LASTLOG) static char etc_lastlog[] = LASTLOG_FILENAME; #else @@ -775,13 +777,14 @@ static XtResource application_resources[] = Bres("backarrowKeyIsErase", "BackarrowKeyIsErase", backarrow_is_erase, DEF_BACKARO_ERASE), #endif #endif - Bres("waitForMap", "WaitForMap", wait_for_map, False), Bres("useInsertMode", "UseInsertMode", useInsertMode, False), #if OPT_ZICONBEEP Ires("zIconBeep", "ZIconBeep", zIconBeep, 0), #endif #if OPT_PTY_HANDSHAKE + Bres("waitForMap", "WaitForMap", wait_for_map, False), Bres("ptyHandshake", "PtyHandshake", ptyHandshake, True), + Bres("ptySttySize", "PtySttySize", ptySttySize, DEF_PTY_STTY_SIZE), #endif #if OPT_SAME_NAME Bres("sameName", "SameName", sameName, True), @@ -1317,6 +1320,22 @@ save_callback(Widget w GCC_UNUSED, /* we have nothing to save */ token->save_success = True; } + +static void +icewatch(IceConn iceConn, + IcePointer clientData GCC_UNUSED, + Bool opening, + IcePointer * watchData GCC_UNUSED) +{ + if (opening) { + ice_fd = IceConnectionNumber(iceConn); + TRACE(("got IceConnectionNumber %d\n", ice_fd)); + } else { + ice_fd = -1; + TRACE(("reset IceConnectionNumber\n")); + } +} + #endif /* OPT_SESSION_MGT */ /* @@ -1971,6 +1990,7 @@ main(int argc, char *argv[]ENVP_ARG) &argc, argv, fallback_resources, sessionShellWidgetClass, NULL, 0); + IceAddConnectionWatch(icewatch, NULL); #else toplevel = XtAppInitialize(&app_con, my_class, optionDescList, @@ -1984,6 +2004,9 @@ main(int argc, char *argv[]ENVP_ARG) application_resources, XtNumber(application_resources), NULL, 0); TRACE_XRES(); +#if OPT_PTY_HANDSHAKE + resource.wait_for_map0 = resource.wait_for_map; +#endif #if defined(HAVE_POSIX_SAVED_IDS) && !defined(USE_UTMP_SETGID) #if !defined(DISABLE_SETUID) || !defined(DISABLE_SETGID) @@ -2580,6 +2603,7 @@ set_pty_permissions(uid_t uid, gid_t gid, mode_t mode) endgrent(); #endif /* USE_TTY_GROUP */ + TRACE_IDS; set_owner(ttydev, uid, gid, mode); } @@ -2735,13 +2759,12 @@ hungtty(int i GCC_UNUSED) SIGNAL_RETURN; } -/* - * declared outside OPT_PTY_HANDSHAKE so HsSysError() callers can use - */ -static int cp_pipe[2]; /* this pipe is used for child to parent transfer */ - #if OPT_PTY_HANDSHAKE -static int pc_pipe[2]; /* this pipe is used for parent to child transfer */ +#define NO_FDS {-1, -1} + +static int cp_pipe[2] = NO_FDS; /* this pipe is used for child to parent transfer */ +static int pc_pipe[2] = NO_FDS; /* this pipe is used for parent to child transfer */ + typedef enum { /* c == child, p == parent */ PTY_BAD, /* c->p: can't open pty slave for some reason */ PTY_FATALERROR, /* c->p: we had a fatal error with the pty */ @@ -2763,6 +2786,49 @@ typedef struct { char buffer[1024]; } handshake_t; +#if OPT_TRACE +static void +trace_handshake(const char *tag, handshake_t * data) +{ + const char *status = "?"; + switch (data->status) { + case PTY_BAD: + status = "PTY_BAD"; + break; + case PTY_FATALERROR: + status = "PTY_FATALERROR"; + break; + case PTY_GOOD: + status = "PTY_GOOD"; + break; + case PTY_NEW: + status = "PTY_NEW"; + break; + case PTY_NOMORE: + status = "PTY_NOMORE"; + break; + case UTMP_ADDED: + status = "UTMP_ADDED"; + break; + case UTMP_TTYSLOT: + status = "UTMP_TTYSLOT"; + break; + case PTY_EXEC: + status = "PTY_EXEC"; + break; + } + TRACE(("handshake %s %s errno=%d, error=%d device \"%s\"\n", + tag, + status, + data->error, + data->fatal_error, + data->buffer)); +} +#define TRACE_HANDSHAKE(tag, data) trace_handshake(tag, data) +#else +#define TRACE_HANDSHAKE(tag, data) /* nothing */ +#endif + /* HsSysError() * * This routine does the equivalent of a SysError but it handshakes @@ -2772,49 +2838,69 @@ typedef struct { */ static void -HsSysError(int pf, int error) +HsSysError(int error) { handshake_t handshake; + memset(&handshake, 0, sizeof(handshake)); handshake.status = PTY_FATALERROR; handshake.error = errno; handshake.fatal_error = error; strcpy(handshake.buffer, ttydev); - write(pf, (char *) &handshake, sizeof(handshake)); + + if (resource.ptyHandshake && (cp_pipe[1] >= 0)) { + TRACE(("HsSysError errno=%d, error=%d device \"%s\"\n", + handshake.error, + handshake.fatal_error, + handshake.buffer)); + TRACE_HANDSHAKE("writing", &handshake); + write(cp_pipe[1], (char *) &handshake, sizeof(handshake)); + } else { + fprintf(stderr, + "%s: fatal pty error errno=%d, error=%d device \"%s\"\n", + ProgramName, + handshake.error, + handshake.fatal_error, + handshake.buffer); + fprintf(stderr, "%s\n", SysErrorMsg(handshake.error)); + fprintf(stderr, "Reason: %s\n", SysReasonMsg(handshake.fatal_error)); + } exit(error); } void first_map_occurred(void) { - handshake_t handshake; - TScreen *screen = TScreenOf(term); - - handshake.status = PTY_EXEC; - handshake.rows = screen->max_row; - handshake.cols = screen->max_col; - write(pc_pipe[1], (char *) &handshake, sizeof(handshake)); - close(cp_pipe[0]); - close(pc_pipe[1]); - resource.wait_for_map = False; + if (resource.wait_for_map) { + handshake_t handshake; + TScreen *screen = TScreenOf(term); + + memset(&handshake, 0, sizeof(handshake)); + handshake.status = PTY_EXEC; + handshake.rows = screen->max_row; + handshake.cols = screen->max_col; + + if (pc_pipe[1] >= 0) { + TRACE(("first_map_occurred: %dx%d\n", handshake.rows, handshake.cols)); + TRACE_HANDSHAKE("writing", &handshake); + write(pc_pipe[1], (char *) &handshake, sizeof(handshake)); + close(cp_pipe[0]); + close(pc_pipe[1]); + } + resource.wait_for_map = False; + } } #else /* * temporary hack to get xterm working on att ptys */ static void -HsSysError(int pf GCC_UNUSED, int error) +HsSysError(int error) { fprintf(stderr, "%s: fatal pty error %d (errno=%d) on tty %s\n", - xterm_name, error, errno, ttydev); + ProgramName, error, errno, ttydev); exit(error); } - -void -first_map_occurred(void) -{ - return; -} #endif /* OPT_PTY_HANDSHAKE else !OPT_PTY_HANDSHAKE */ #ifndef VMS @@ -2823,6 +2909,7 @@ set_owner(char *device, uid_t uid, gid_t gid, mode_t mode) { int why; + TRACE_IDS; TRACE(("set_owner(%s, uid=%d, gid=%d, mode=%#o\n", device, uid, gid, mode)); if (chown(device, uid, gid) < 0) { @@ -2915,6 +3002,7 @@ spawnXTerm(XtermWidget xw) { TScreen *screen = TScreenOf(xw); #if OPT_PTY_HANDSHAKE + Bool got_handshake_size = False; handshake_t handshake; int done; #endif @@ -2954,7 +3042,6 @@ spawnXTerm(XtermWidget xw) char *ptr, *shname, *shname_minus; int i, no_dev_tty = False; char **envnew; /* new environment */ - int envsize; /* elements in new environment */ char buf[64]; char *TermName = NULL; #ifdef TTYSIZE_STRUCT @@ -2991,6 +3078,10 @@ spawnXTerm(XtermWidget xw) signal(SIGTTOU, SIG_IGN); #endif +#if OPT_PTY_HANDSHAKE + memset(&handshake, 0, sizeof(handshake)); +#endif + if (am_slave >= 0) { screen->respond = am_slave; set_pty_id(ttydev, passedPty); @@ -3020,6 +3111,9 @@ spawnXTerm(XtermWidget xw) errno = ENXIO; } pw = NULL; +#if OPT_PTY_HANDSHAKE + got_handshake_size = False; +#endif /* OPT_PTY_HANDSHAKE */ #if OPT_INITIAL_ERASE initial_erase = VAL_INITIAL_ERASE; #endif @@ -3329,7 +3423,7 @@ spawnXTerm(XtermWidget xw) SysError(ERROR_PTEM); } #if !defined(SVR4) && !(defined(SYSV) && defined(i386)) - if (!getenv("CONSEM") && ioctl(ptyfd, I_PUSH, "consem") < 0) { + if (!x_getenv("CONSEM") && ioctl(ptyfd, I_PUSH, "consem") < 0) { SysError(ERROR_CONSEM); } #endif /* !SVR4 */ @@ -3473,6 +3567,7 @@ spawnXTerm(XtermWidget xw) handshake.status = PTY_BAD; handshake.error = errno; strcpy(handshake.buffer, ttydev); + TRACE_HANDSHAKE("writing", &handshake); write(cp_pipe[1], (char *) &handshake, sizeof(handshake)); @@ -3709,14 +3804,14 @@ spawnXTerm(XtermWidget xw) ltc.t_werasc = ltc.t_lnextc = _POSIX_VDISABLE; #endif /* __hpux */ if (ioctl(ttyfd, TIOCSLTC, <c) == -1) - HsSysError(cp_pipe[1], ERROR_TIOCSETC); + HsSysError(ERROR_TIOCSETC); #endif /* HAS_LTCHARS */ #ifdef TIOCLSET if (ioctl(ttyfd, TIOCLSET, (char *) &lmode) == -1) - HsSysError(cp_pipe[1], ERROR_TIOCLSET); + HsSysError(ERROR_TIOCLSET); #endif /* TIOCLSET */ if (ttySetAttr(ttyfd, &tio) == -1) - HsSysError(cp_pipe[1], ERROR_TIOCSETP); + HsSysError(ERROR_TIOCSETP); /* ignore errors here - some platforms don't work */ tio.c_cflag &= ~CSIZE; @@ -3765,20 +3860,20 @@ spawnXTerm(XtermWidget xw) } if (ioctl(ttyfd, TIOCSETP, (char *) &sg) == -1) - HsSysError(cp_pipe[1], ERROR_TIOCSETP); + HsSysError(ERROR_TIOCSETP); if (ioctl(ttyfd, TIOCSETC, (char *) &tc) == -1) - HsSysError(cp_pipe[1], ERROR_TIOCSETC); + HsSysError(ERROR_TIOCSETC); if (ioctl(ttyfd, TIOCSETD, (char *) &discipline) == -1) - HsSysError(cp_pipe[1], ERROR_TIOCSETD); + HsSysError(ERROR_TIOCSETD); if (ioctl(ttyfd, TIOCSLTC, (char *) <c) == -1) - HsSysError(cp_pipe[1], ERROR_TIOCSLTC); + HsSysError(ERROR_TIOCSLTC); if (ioctl(ttyfd, TIOCLSET, (char *) &lmode) == -1) - HsSysError(cp_pipe[1], ERROR_TIOCLSET); + HsSysError(ERROR_TIOCLSET); #ifdef sony if (ioctl(ttyfd, TIOCKSET, (char *) &jmode) == -1) - HsSysError(cp_pipe[1], ERROR_TIOCKSET); + HsSysError(ERROR_TIOCKSET); if (ioctl(ttyfd, TIOCKSETC, (char *) &jtc) == -1) - HsSysError(cp_pipe[1], ERROR_TIOCKSETC); + HsSysError(ERROR_TIOCKSETC); #endif /* sony */ #endif /* TERMIO_STRUCT */ #if defined(TIOCCONS) || defined(SRIOCSREDIR) @@ -3787,13 +3882,13 @@ spawnXTerm(XtermWidget xw) int on = 1; if (ioctl(ttyfd, TIOCCONS, (char *) &on) == -1) fprintf(stderr, "%s: cannot open console: %s\n", - xterm_name, strerror(errno)); + ProgramName, strerror(errno)); #endif #ifdef SRIOCSREDIR int fd = open("/dev/console", O_RDWR); if (fd == -1 || ioctl(fd, SRIOCSREDIR, ttyfd) == -1) fprintf(stderr, "%s: cannot open console: %s\n", - xterm_name, strerror(errno)); + ProgramName, strerror(errno)); (void) close(fd); #endif } @@ -3850,40 +3945,21 @@ spawnXTerm(XtermWidget xw) } #endif - /* copy the environment before Setenv'ing */ - for (i = 0; environ[i] != NULL; i++) ; - /* compute number of xtermSetenv() calls below */ - envsize = 1; /* (NULL terminating entry) */ - envsize += 5; /* TERM, WINDOWID, DISPLAY, _SHELL, _VERSION */ -#ifdef HAVE_UTMP - envsize += 1; /* LOGNAME */ -#endif /* HAVE_UTMP */ -#ifdef USE_SYSV_ENVVARS - envsize += 2; /* COLUMNS, LINES */ -#ifdef HAVE_UTMP - envsize += 2; /* HOME, SHELL */ -#endif /* HAVE_UTMP */ -#ifdef OWN_TERMINFO_DIR - envsize += 1; /* TERMINFO */ -#endif -#else /* USE_SYSV_ENVVARS */ - envsize += 1; /* TERMCAP */ -#endif /* USE_SYSV_ENVVARS */ - envnew = TypeCallocN(char *, (unsigned) i + envsize); - memmove((char *) envnew, (char *) environ, i * sizeof(char *)); - environ = envnew; - xtermSetenv("TERM=", TermName); + xtermCopyEnv(environ); + + xtermSetenv("TERM", TermName); if (!TermName) *newtc = 0; sprintf(buf, "%lu", ((unsigned long) XtWindow(SHELL_OF(CURRENT_EMU())))); - xtermSetenv("WINDOWID=", buf); + xtermSetenv("WINDOWID", buf); /* put the display into the environment of the shell */ - xtermSetenv("DISPLAY=", XDisplayString(screen->display)); + xtermSetenv("DISPLAY", XDisplayString(screen->display)); - xtermSetenv("XTERM_VERSION=", xtermVersion()); + xtermSetenv("XTERM_VERSION", xtermVersion()); + xtermSetenv("XTERM_LOCALE", xtermEnvLocale()); signal(SIGTERM, SIG_DFL); @@ -3959,8 +4035,8 @@ spawnXTerm(XtermWidget xw) * from the user's $LOGNAME or $USER environment variables. */ if (((login_name = getlogin()) != NULL - || (login_name = getenv("LOGNAME")) != NULL - || (login_name = getenv("USER")) != NULL) + || (login_name = x_getenv("LOGNAME")) != NULL + || (login_name = x_getenv("USER")) != NULL) && strcmp(login_name, pw->pw_name)) { struct passwd *pw2 = getpwnam(login_name); if (pw2 != 0) { @@ -3979,7 +4055,7 @@ spawnXTerm(XtermWidget xw) login_name = x_strdup(login_name); } if (login_name != NULL) { - xtermSetenv("LOGNAME=", login_name); /* for POSIX */ + xtermSetenv("LOGNAME", login_name); /* for POSIX */ } #ifndef USE_UTEMPTER #ifdef USE_UTMP_SETGID @@ -4173,6 +4249,7 @@ spawnXTerm(XtermWidget xw) handshake.status = UTMP_ADDED; handshake.error = 0; strcpy(handshake.buffer, ttydev); + TRACE_HANDSHAKE("writing", &handshake); (void) write(cp_pipe[1], (char *) &handshake, sizeof(handshake)); } #endif /* OPT_PTY_HANDSHAKE */ @@ -4206,6 +4283,7 @@ spawnXTerm(XtermWidget xw) handshake.status = PTY_GOOD; handshake.error = 0; (void) strcpy(handshake.buffer, ttydev); + TRACE_HANDSHAKE("writing", &handshake); (void) write(cp_pipe[1], (char *) &handshake, sizeof(handshake)); if (resource.wait_for_map) { @@ -4217,9 +4295,12 @@ spawnXTerm(XtermWidget xw) exit(ERROR_PTY_EXEC); } if (handshake.rows > 0 && handshake.cols > 0) { + TRACE(("handshake ttysize: %dx%d\n", + handshake.rows, handshake.cols)); set_max_row(screen, handshake.rows); set_max_col(screen, handshake.cols); #ifdef TTYSIZE_STRUCT + got_handshake_size = True; TTYSIZE_ROWS(ts) = MaxRows(screen); TTYSIZE_COLS(ts) = MaxCols(screen); #if defined(USE_STRUCT_WINSIZE) @@ -4236,20 +4317,20 @@ spawnXTerm(XtermWidget xw) { char numbuf[12]; sprintf(numbuf, "%d", MaxCols(screen)); - xtermSetenv("COLUMNS=", numbuf); + xtermSetenv("COLUMNS", numbuf); sprintf(numbuf, "%d", MaxRows(screen)); - xtermSetenv("LINES=", numbuf); + xtermSetenv("LINES", numbuf); } #ifdef HAVE_UTMP if (pw) { /* SVR4 doesn't provide these */ - if (!getenv("HOME")) - xtermSetenv("HOME=", pw->pw_dir); - if (!getenv("SHELL")) - xtermSetenv("SHELL=", pw->pw_shell); + if (!x_getenv("HOME")) + xtermSetenv("HOME", pw->pw_dir); + if (!x_getenv("SHELL")) + xtermSetenv("SHELL", pw->pw_shell); } #endif /* HAVE_UTMP */ #ifdef OWN_TERMINFO_DIR - xtermSetenv("TERMINFO=", OWN_TERMINFO_DIR); + xtermSetenv("TERMINFO", OWN_TERMINFO_DIR); #endif #else /* USE_SYSV_ENVVARS */ resize_termcap(xw, newtc); @@ -4279,16 +4360,23 @@ spawnXTerm(XtermWidget xw) TERMCAP_ERASE, CharOf(initial_erase)); #endif - xtermSetenv("TERMCAP=", newtc); + xtermSetenv("TERMCAP", newtc); } #endif /* USE_SYSV_ENVVARS */ - /* need to reset after all the ioctl bashing we did above */ #if OPT_PTY_HANDSHAKE - if (resource.ptyHandshake) { + /* + * Need to reset after all the ioctl bashing we did above. + * + * If we expect the waitForMap logic to set the handshake-size, + * use that to prevent races. + */ + if (resource.ptyHandshake + && resource.ptySttySize + && (got_handshake_size || !resource.wait_for_map0)) { #ifdef TTYSIZE_STRUCT i = SET_TTYSIZE(0, ts); - TRACE(("spawn SET_TTYSIZE %dx%d return %d\n", + TRACE(("ptyHandshake SET_TTYSIZE %dx%d return %d\n", TTYSIZE_ROWS(ts), TTYSIZE_COLS(ts), i)); #endif /* TTYSIZE_STRUCT */ @@ -4297,15 +4385,15 @@ spawnXTerm(XtermWidget xw) signal(SIGHUP, SIG_DFL); if ((ptr = explicit_shname) == NULL) { - if (((ptr = getenv("SHELL")) == NULL || *ptr == 0) && + if (((ptr = x_getenv("SHELL")) == NULL) && ((pw == NULL && (pw = getpwuid(screen->uid)) == NULL) || *(ptr = pw->pw_shell) == 0)) { ptr = "/bin/sh"; } } else { - xtermSetenv("SHELL=", explicit_shname); + xtermSetenv("SHELL", explicit_shname); } - xtermSetenv("XTERM_SHELL=", ptr); + xtermSetenv("XTERM_SHELL", ptr); shname = x_basename(ptr); TRACE(("shell path '%s' leaf '%s'\n", ptr, shname)); @@ -4317,19 +4405,19 @@ spawnXTerm(XtermWidget xw) * to command that the user gave anyway. */ if (command_to_exec_with_luit) { - xtermSetenv("XTERM_SHELL=", + xtermSetenv("XTERM_SHELL", xtermFindShell(*command_to_exec_with_luit, False)); TRACE(("spawning command \"%s\"\n", *command_to_exec_with_luit)); execvp(*command_to_exec_with_luit, command_to_exec_with_luit); /* print error message on screen */ fprintf(stderr, "%s: Can't execvp %s: %s\n", - xterm_name, *command_to_exec_with_luit, strerror(errno)); + ProgramName, *command_to_exec_with_luit, strerror(errno)); fprintf(stderr, "%s: cannot support your locale.\n", - xterm_name); + ProgramName); } #endif if (command_to_exec) { - xtermSetenv("XTERM_SHELL=", + xtermSetenv("XTERM_SHELL", xtermFindShell(*command_to_exec, False)); TRACE(("spawning command \"%s\"\n", *command_to_exec)); execvp(*command_to_exec, command_to_exec); @@ -4337,7 +4425,7 @@ spawnXTerm(XtermWidget xw) execlp(ptr, shname, "-c", command_to_exec[0], (void *) 0); /* print error message on screen */ fprintf(stderr, "%s: Can't execvp %s: %s\n", - xterm_name, *command_to_exec, strerror(errno)); + ProgramName, *command_to_exec, strerror(errno)); } #ifdef USE_SYSV_SIGHUP /* fix pts sh hanging around */ @@ -4362,7 +4450,7 @@ spawnXTerm(XtermWidget xw) (void *) 0); /* Exec failed. */ - fprintf(stderr, "%s: Could not exec %s: %s\n", xterm_name, + fprintf(stderr, "%s: Could not exec %s: %s\n", ProgramName, ptr, strerror(errno)); (void) sleep(5); exit(ERROR_EXEC); @@ -4389,6 +4477,7 @@ spawnXTerm(XtermWidget xw) break; } + TRACE_HANDSHAKE("read", &handshake); switch (handshake.status) { case PTY_GOOD: /* Success! Let's free up resources and @@ -4406,13 +4495,15 @@ spawnXTerm(XtermWidget xw) /* no more ptys! */ fprintf(stderr, "%s: child process can find no available ptys: %s\n", - xterm_name, strerror(errno)); + ProgramName, strerror(errno)); handshake.status = PTY_NOMORE; + TRACE_HANDSHAKE("writing", &handshake); write(pc_pipe[1], (char *) &handshake, sizeof(handshake)); exit(ERROR_PTYS); } handshake.status = PTY_NEW; (void) strcpy(handshake.buffer, ttydev); + TRACE_HANDSHAKE("writing", &handshake); write(pc_pipe[1], (char *) &handshake, sizeof(handshake)); break; @@ -4434,9 +4525,13 @@ spawnXTerm(XtermWidget xw) free(ttydev); ttydev = x_strdup(handshake.buffer); break; + case PTY_NEW: + case PTY_NOMORE: + case UTMP_TTYSLOT: + case PTY_EXEC: default: fprintf(stderr, "%s: unexpected handshake status %d\n", - xterm_name, + ProgramName, (int) handshake.status); } } @@ -4618,19 +4713,31 @@ Exit(int n) #endif /* USE_SYSV_UTMP */ #endif /* HAVE_UTMP */ - close(screen->respond); /* close explicitly to avoid race with slave side */ -#ifdef ALLOWLOGGING - if (screen->logging) - CloseLog(screen); -#endif + /* + * Flush pending data before releasing ownership, so nobody else can write + * in the middle of the data. + */ + ttyFlush(screen->respond); if (am_slave < 0) { + TRACE_IDS; /* restore ownership of tty and pty */ set_owner(ttydev, 0, 0, 0666U); #if (defined(USE_PTY_DEVICE) && !defined(__sgi) && !defined(__hpux)) set_owner(ptydev, 0, 0, 0666U); #endif } + + /* + * Close after releasing ownership to avoid race condition: other programs + * grabbing it, and *then* having us release ownership.... + */ + close(screen->respond); /* close explicitly to avoid race with slave side */ +#ifdef ALLOWLOGGING + if (screen->logging) + CloseLog(screen); +#endif + #ifdef NO_LEAKS if (n == 0) { TRACE(("Freeing memory leaks\n")); @@ -4647,8 +4754,12 @@ Exit(int n) #if OPT_WIDE_CHARS noleaks_CharacterClass(); #endif + /* XrmSetDatabase(dpy, 0); increases leaks ;-) */ XtCloseDisplay(dpy); XtDestroyApplicationContext(app_con); +#if OPT_SESSION_MGT + IceRemoveConnectionWatch(icewatch, NULL); +#endif TRACE(("closed display\n")); } TRACE((0)); diff --git a/app/xterm/ptyx.h b/app/xterm/ptyx.h index 26423b507..674ca9118 100644 --- a/app/xterm/ptyx.h +++ b/app/xterm/ptyx.h @@ -1,4 +1,4 @@ -/* $XTermId: ptyx.h,v 1.484 2007/03/20 23:56:09 tom Exp $ */ +/* $XTermId: ptyx.h,v 1.494 2007/07/17 21:08:07 tom Exp $ */ /* $XFree86: xc/programs/xterm/ptyx.h,v 3.134 2006/06/19 00:36:51 dickey Exp $ */ @@ -89,7 +89,7 @@ #define TypeCalloc(type) TypeCalloc(type,1) #define TypeMallocN(type,n) (type *)malloc(sizeof(type) * (n)) -#define TypeMalloc(type) TypeMallocN(type,0) +#define TypeMalloc(type) TypeMallocN(type,1) #define TypeRealloc(type,n,p) (type *)realloc(p, (n) * sizeof(type)) @@ -471,6 +471,10 @@ typedef struct { #define OPT_EXEC_XTERM 0 /* true if xterm can fork/exec copies of itself */ #endif +#ifndef OPT_EXTRA_PASTE +#define OPT_EXTRA_PASTE 1 +#endif + #ifndef OPT_FOCUS_EVENT #define OPT_FOCUS_EVENT 1 /* focus in/out events */ #endif @@ -627,6 +631,10 @@ typedef struct { #define OPT_TRACE 0 /* true if we're using debugging traces */ #endif +#ifndef OPT_TRACE_FLAGS +#define OPT_TRACE_FLAGS 0 /* additional tracing used for SCRN_BUF_FLAGS */ +#endif + #ifndef OPT_VT52_MODE #define OPT_VT52_MODE 1 /* true if xterm supports VT52 emulation */ #endif @@ -1102,6 +1110,13 @@ typedef enum { #define ROW2INX(screen, row) ((row) + (screen)->topline) #define INX2ROW(screen, inx) ((inx) - (screen)->topline) +#define ROW2ABS(screen, row) ((row) + (screen)->savedlines) +#define INX2ABS(screen, inx) ROW2ABS(screen, INX2ROW(screen, inx)) + +#define okScrnRow(screen, row) \ + ((row) <= (screen)->max_row \ + && (row) >= -((screen)->savedlines)) + /* ScrnBuf-level macros */ #define BUFFER_PTR(buf, row, off) (buf[MAX_PTRS * (row) + off]) @@ -1290,6 +1305,9 @@ typedef struct { uid_t uid; /* user id of actual person */ gid_t gid; /* group id of actual person */ ColorRes Tcolors[NCOLORS]; /* terminal colors */ +#if OPT_HIGHLIGHT_COLOR + Boolean hilite_reverse; /* hilite overrides reverse */ +#endif #if OPT_ISO_COLORS ColorRes Acolors[MAXCOLORS]; /* ANSI color emulation */ int veryBoldColors; /* modifier for boldColors */ @@ -1382,8 +1400,10 @@ typedef struct { Boolean visualbell; /* visual bell mode */ Boolean poponbell; /* pop on bell mode */ Boolean allowSendEvents;/* SendEvent mode */ + Boolean allowTitleOps; /* TitleOps mode */ Boolean allowWindowOps; /* WindowOps mode */ Boolean allowSendEvent0;/* initial SendEvent mode */ + Boolean allowTitleOp0; /* initial TitleOps mode */ Boolean allowWindowOp0; /* initial WindowOps mode */ Boolean awaitInput; /* select-timeout mode */ Boolean grabbedKbd; /* keyboard is grabbed */ @@ -1642,6 +1662,10 @@ typedef struct { #if OPT_CLIP_BOLD Boolean use_clipping; #endif + void * main_cgs_cache; +#ifndef NO_ACTIVE_ICON + void * icon_cgs_cache; +#endif #if OPT_RENDERFONT XftFont * renderFontNorm[NMENUFONTS]; XftFont * renderFontBold[NMENUFONTS]; @@ -1785,7 +1809,10 @@ typedef struct typedef struct { xtermKeyboardType type; - unsigned flags; + unsigned flags; + char *shell_translations; + char *xterm_translations; + char *extra_translations; #if OPT_INITIAL_ERASE int reset_DECBKM; /* reset should set DECBKM */ #endif @@ -1811,6 +1838,8 @@ typedef struct _Misc { #if OPT_WIDE_CHARS Boolean cjk_width; /* true for built-in CJK wcwidth() */ Boolean mk_width; /* true for simpler built-in wcwidth() */ + int mk_samplesize; + int mk_samplepass; #endif #if OPT_LUIT_PROG Boolean callfilter; /* true to invoke luit */ @@ -2029,6 +2058,13 @@ typedef struct _TekWidgetRec { * around and lines that have ended naturally * with a CR at column max_col. */ + +#if OPT_ZICONBEEP || OPT_TOOLBAR +#define HANDLE_STRUCT_NOTIFY 1 +#else +#define HANDLE_STRUCT_NOTIFY 0 +#endif + /* * If we've set protected attributes with the DEC-style DECSCA, then we'll have * to use DECSED or DECSEL to erase preserving protected text. (The normal ED, diff --git a/app/xterm/version.h b/app/xterm/version.h index e230c0eb3..e29f71ad0 100644 --- a/app/xterm/version.h +++ b/app/xterm/version.h @@ -1,13 +1,12 @@ -/* $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 $ */ +/* $XTermId: version.h,v 1.285 2007/08/12 15:37:19 tom Exp $ */ /* * These definitions are used to build the string that's printed in response to * "xterm -version", or embedded in "xterm -help". It usually indicates the * version of X to which this version of xterm has been built. The number in - * parentheses is my patch number (T.Dickey). + * parentheses is my patch number (Thomas E. Dickey). */ -#define XTERM_PATCH 225 +#define XTERM_PATCH 229 #ifndef __vendorversion__ #define __vendorversion__ "XTerm/OpenBSD" diff --git a/app/xterm/xterm.h b/app/xterm/xterm.h index eb1cb4ec3..01e17b77d 100644 --- a/app/xterm/xterm.h +++ b/app/xterm/xterm.h @@ -1,4 +1,4 @@ -/* $XTermId: xterm.h,v 1.461 2007/03/20 23:56:57 tom Exp $ */ +/* $XTermId: xterm.h,v 1.482 2007/07/22 20:14:48 tom Exp $ */ /* $XFree86: xc/programs/xterm/xterm.h,v 3.117 2006/06/19 00:36:52 dickey Exp $ */ @@ -66,14 +66,6 @@ authorization. #include <sys/param.h> #endif -#ifndef HAVE_X11_DECKEYSYM_H -#define HAVE_X11_DECKEYSYM_H 1 -#endif - -#ifndef HAVE_X11_SUNKEYSYM_H -#define HAVE_X11_SUNKEYSYM_H 1 -#endif - #ifndef DFT_TERMTYPE #define DFT_TERMTYPE "xterm" #endif @@ -221,6 +213,18 @@ authorization. #endif /* HAVE_CONFIG_H */ +#ifndef HAVE_X11_DECKEYSYM_H +#define HAVE_X11_DECKEYSYM_H 1 +#endif + +#ifndef HAVE_X11_SUNKEYSYM_H +#define HAVE_X11_SUNKEYSYM_H 1 +#endif + +#ifndef HAVE_X11_XF86KEYSYM_H +#define HAVE_X11_XF86KEYSYM_H 0 +#endif + /***====================================================================***/ /* if compiling with gcc -ansi -pedantic, we must fix POSIX definitions */ @@ -324,7 +328,7 @@ extern int errno; #define environ gblenvp /* circumvent a bug */ #endif -#if !defined(VMS) && !(defined(linux) && defined(__USE_GNU)) && !defined(__hpux) && !defined(_ALL_SOURCE) && !defined(__osf__) +#if !defined(VMS) && !(defined(linux) && defined(__USE_GNU)) && !defined(__hpux) && !defined(_ALL_SOURCE) && !defined(__osf__) extern char **environ; #endif @@ -334,6 +338,7 @@ extern char **environ; #define XtNallowC1Printable "allowC1Printable" #define XtNallowSendEvents "allowSendEvents" +#define XtNallowTitleOps "allowTitleOps" #define XtNallowWindowOps "allowWindowOps" #define XtNaltIsNotMeta "altIsNotMeta" #define XtNaltSendsEscape "altSendsEscape" @@ -394,6 +399,7 @@ extern char **environ; #define XtNforceBoxChars "forceBoxChars" #define XtNfreeBoldBox "freeBoldBox" #define XtNhighlightColor "highlightColor" +#define XtNhighlightReverse "highlightReverse" #define XtNhighlightSelection "highlightSelection" #define XtNhighlightTextColor "highlightTextColor" #define XtNhpLowerleftBugCompat "hpLowerleftBugCompat" @@ -414,6 +420,8 @@ extern char **environ; #define XtNmenuBar "menuBar" #define XtNmenuHeight "menuHeight" #define XtNmetaSendsEscape "metaSendsEscape" +#define XtNmkSamplePass "mkSamplePass" +#define XtNmkSampleSize "mkSampleSize" #define XtNmkWidth "mkWidth" #define XtNmodifyCursorKeys "modifyCursorKeys" #define XtNmodifyFunctionKeys "modifyFunctionKeys" @@ -479,6 +487,7 @@ extern char **environ; #define XtCAllowC1Printable "AllowC1Printable" #define XtCAllowSendEvents "AllowSendEvents" +#define XtCAllowTitleOps "AllowTitleOps" #define XtCAllowWindowOps "AllowWindowOps" #define XtCAltIsNotMeta "AltIsNotMeta" #define XtCAltSendsEscape "AltSendsEscape" @@ -533,6 +542,7 @@ extern char **environ; #define XtCFontStyle "FontStyle" #define XtCForceBoxChars "ForceBoxChars" #define XtCFreeBoldBox "FreeBoldBox" +#define XtCHighlightReverse "HighlightReverse" #define XtCHighlightSelection "HighlightSelection" #define XtCHpLowerleftBugCompat "HpLowerleftBugCompat" #define XtCI18nSelections "I18nSelections" @@ -550,6 +560,8 @@ extern char **environ; #define XtCMenuBar "MenuBar" #define XtCMenuHeight "MenuHeight" #define XtCMetaSendsEscape "MetaSendsEscape" +#define XtCMkSamplePass "MkSamplePass" +#define XtCMkSampleSize "MkSampleSize" #define XtCMkWidth "MkWidth" #define XtCModifyCursorKeys "ModifyCursorKeys" #define XtCModifyFunctionKeys "ModifyFunctionKeys" @@ -723,6 +735,10 @@ extern void setCgsFont(XtermWidget /*xw*/, VTwin * /*cgsWin*/, CgsEnum /*cgsId*/ extern void setCgsFore(XtermWidget /*xw*/, VTwin * /*cgsWin*/, CgsEnum /*cgsId*/, Pixel /*fg*/); extern void swapCgs(XtermWidget /*xw*/, VTwin * /*cgsWin*/, CgsEnum /*dstCgsId*/, CgsEnum /*srcCgsId*/); +#ifdef NO_LEAKS +extern void noleaks_cachedCgs (XtermWidget /* xw */); +#endif + /* charproc.c */ extern int VTInit (void); extern int v_write (int /* f */, Char * /* d */, unsigned /* len */); @@ -817,7 +833,12 @@ extern int main (int /* argc */, char ** /* argv */ ENVP_ARG); extern int GetBytesAvailable (int /* fd */); extern int kill_process_group (int /* pid */, int /* sig */); extern int nonblocking_wait (void); + +#if OPT_PTY_HANDSHAKE extern void first_map_occurred (void); +#else +#define first_map_occurred() /* nothing */ +#endif #ifdef SIGNAL_T extern SIGNAL_T Exit (int /* n */); @@ -838,16 +859,17 @@ extern void show_8bit_control (Bool /* value */); /* misc.c */ extern Bool AllocateTermColor(XtermWidget, ScrnColors *, int, const char *); -extern Cursor make_colored_cursor (unsigned /* cursorindex */, unsigned long /* fg */, unsigned long /* bg */); +extern Cursor make_colored_cursor (unsigned /* cursorindex */, unsigned long /* fg */, unsigned long /* bg */); extern OptionHelp * sortedOpts(OptionHelp *, XrmOptionDescRec *, Cardinal); -extern Window WMFrameWindow(XtermWidget /* termw */); +extern Window WMFrameWindow(XtermWidget /* termw */); extern XrmOptionDescRec * sortedOptDescs(XrmOptionDescRec *, Cardinal); -extern char *SysErrorMsg (int /* n */); -extern char *udk_lookup (int /* keycode */, int * /* len */); +extern char *udk_lookup (int /* keycode */, int * /* len */); extern char *xtermEnvEncoding (void); extern char *xtermEnvLocale (void); extern char *xtermFindShell(char * /* leaf */, Bool /* warning */); extern char *xtermVersion(void); +extern const char *SysErrorMsg (int /* n */); +extern const char *SysReasonMsg (int /* n */); extern int XStrCmp (char * /* s1 */, char * /* s2 */); extern int creat_as (uid_t /* uid */, gid_t /* gid */, Bool /* append */, char * /* pathname */, int /* mode */); extern int open_userfile (uid_t /* uid */, gid_t /* gid */, char * /* path */, Bool /* append */); @@ -887,6 +909,7 @@ extern void switch_modes (Bool /* tovt */); extern void timestamp_filename(char * /* dst */, const char * /* src */); extern void xevents (void); extern void xt_error (String /* message */); +extern void xtermCopyEnv (char ** /* oldenv */); extern void xtermSetenv (char * /* var */, char * /* value */); #if OPT_DABBREV @@ -964,35 +987,44 @@ extern ScrnBuf Allocate (int /* nrow */, int /* ncol */, Char ** /* addr */); extern int ScreenResize (XtermWidget /* xw */, int /* width */, int /* height */, unsigned * /* flags */); extern size_t ScrnPointers (TScreen * /* screen */, size_t /* len */); extern void ClearBufRows (XtermWidget /* xw */, int /* first */, int /* last */); -extern void ScreenWrite (XtermWidget /* xw */, PAIRED_CHARS(Char * /* str */, Char * /* str2 */), unsigned /* flags */, unsigned /* cur_fg_bg */, unsigned /* length */); +extern void ClearCells (XtermWidget /* xw */, int /* flags */, unsigned /* len */, int /* row */, int /* col */); +extern void ScrnClearCells (XtermWidget /* xw */, int /* row */, int /* col */, unsigned /* len */); extern void ScrnDeleteChar (XtermWidget /* xw */, unsigned /* n */); extern void ScrnDeleteLine (XtermWidget /* xw */, ScrnBuf /* sb */, int /* n */, int /* last */, unsigned /* size */, unsigned /* where */); +extern void ScrnDisownSelection (XtermWidget /* xw */); extern void ScrnFillRectangle (XtermWidget /* xw */, XTermRect *, int , unsigned); extern void ScrnInsertChar (XtermWidget /* xw */, unsigned /* n */); extern void ScrnInsertLine (XtermWidget /* xw */, ScrnBuf /* sb */, int /* last */, int /* where */, unsigned /* n */, unsigned /* size */); extern void ScrnRefresh (XtermWidget /* xw */, int /* toprow */, int /* leftcol */, int /* nrows */, int /* ncols */, Bool /* force */); extern void ScrnUpdate (XtermWidget /* xw */, int /* toprow */, int /* leftcol */, int /* nrows */, int /* ncols */, Bool /* force */); -extern void ScrnDisownSelection (XtermWidget /* xw */); +extern void ScrnWriteText (XtermWidget /* xw */, PAIRED_CHARS(Char * /* str */, Char * /* str2 */), unsigned /* flags */, unsigned /* cur_fg_bg */, unsigned /* length */); extern void xtermParseRect (XtermWidget /* xw */, int, int *, XTermRect *); +#if OPT_TRACE && OPT_TRACE_FLAGS +extern int ScrnTstFlag(TScreen * /* screen */, int /* row */, int /* flag */); +extern void ScrnClrFlag(TScreen * /* screen */, int /* row */, int /* flag */); +extern void ScrnSetFlag(TScreen * /* screen */, int /* row */, int /* flag */); +#else #define ScrnClrFlag(screen, row, flag) \ - SCRN_BUF_FLAGS(screen, ROW2INX(screen, row)) = \ - (Char *)((long)SCRN_BUF_FLAGS(screen, ROW2INX(screen, row)) & ~ (flag)) + SCRN_BUF_FLAGS(screen, row) = \ + (Char *)((long)SCRN_BUF_FLAGS(screen, row) & ~ (flag)) #define ScrnSetFlag(screen, row, flag) \ - SCRN_BUF_FLAGS(screen, ROW2INX(screen, row)) = \ - (Char *)(((long)SCRN_BUF_FLAGS(screen, ROW2INX(screen, row)) | (flag))) + SCRN_BUF_FLAGS(screen, row) = \ + (Char *)(((long)SCRN_BUF_FLAGS(screen, row) | (flag))) #define ScrnTstFlag(screen, row, flag) \ - (ROW2INX(screen, row + screen->savelines) >= 0 && ((long)SCRN_BUF_FLAGS(screen, ROW2INX(screen, row)) & (flag)) != 0) + (okScrnRow(screen, row) && \ + ((long)SCRN_BUF_FLAGS(screen, row) & (flag)) != 0) +#endif /* OPT_TRACE && OPT_TRACE_FLAGS */ -#define ScrnClrBlinked(screen, row) ScrnClrFlag(screen, row, BLINK) -#define ScrnSetBlinked(screen, row) ScrnSetFlag(screen, row, BLINK) -#define ScrnTstBlinked(screen, row) ScrnTstFlag(screen, row, BLINK) +#define ScrnClrBlinked(screen, row) ScrnClrFlag(screen, ROW2INX(screen, row), BLINK) +#define ScrnSetBlinked(screen, row) ScrnSetFlag(screen, ROW2INX(screen, row), BLINK) +#define ScrnTstBlinked(screen, row) ScrnTstFlag(screen, ROW2INX(screen, row), BLINK) -#define ScrnClrWrapped(screen, row) ScrnClrFlag(screen, row, LINEWRAPPED) -#define ScrnSetWrapped(screen, row) ScrnSetFlag(screen, row, LINEWRAPPED) -#define ScrnTstWrapped(screen, row) ScrnTstFlag(screen, row, LINEWRAPPED) +#define ScrnClrWrapped(screen, row) ScrnClrFlag(screen, ROW2INX(screen, row), LINEWRAPPED) +#define ScrnSetWrapped(screen, row) ScrnSetFlag(screen, ROW2INX(screen, row), LINEWRAPPED) +#define ScrnTstWrapped(screen, row) ScrnTstFlag(screen, ROW2INX(screen, row), LINEWRAPPED) #define ScrnHaveSelection(screen) \ ((screen)->startH.row != (screen)->endH.row \ @@ -1049,7 +1081,8 @@ extern void TabZonk (Tabs /* tabs */); /* util.c */ extern GC updatedXtermGC (XtermWidget /* xw */, unsigned /* flags */, unsigned /* fg_bg */, Bool /* hilite */); -extern int AddToRefresh (TScreen * /* screen */); +extern int AddToRefresh (XtermWidget /* xw */); +extern int ClearInLine (XtermWidget /* xw */, int /* row */, int /* col */, unsigned /* len */); 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 */); @@ -1064,8 +1097,9 @@ extern void InsertChar (XtermWidget /* xw */, unsigned /* n */); extern void InsertLine (XtermWidget /* xw */, int /* n */); extern void RevScroll (XtermWidget /* xw */, int /* amount */); extern void ReverseVideo (XtermWidget /* termw */); +extern void WriteText (XtermWidget /* xw */, PAIRED_CHARS(Char * /* str */, Char * /* str2 */), Cardinal /* len */); extern void decode_keyboard_type (XtermWidget /* xw */, struct XTERM_RESOURCE * /* rp */); -extern void decode_wcwidth (int /* mode */); +extern void decode_wcwidth (int /* mode */, int /* samplesize */, int /* samplepass */); 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 */); @@ -1186,10 +1220,10 @@ extern void putXtermCell (TScreen * /* screen */, int /* row */, int /* col */ #endif #if OPT_WIDE_CHARS +extern int DamagedCells(TScreen * /* screen */, unsigned /* n */, int * /* klp */, int * /* krp */, int /* row */, int /* col */); +extern int DamagedCurCells(TScreen * /* screen */, unsigned /* n */, int * /* klp */, int * /* krp */); 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 */); extern void addXtermCombining (TScreen * /* screen */, int /* row */, int /* col */, unsigned /* ch */); #endif diff --git a/app/xterm/xterm.man b/app/xterm/xterm.man index 0fac5c522..1c5e7d3f4 100644 --- a/app/xterm/xterm.man +++ b/app/xterm/xterm.man @@ -1,5 +1,5 @@ '\" t -.\" $XTermId: xterm.man,v 1.380 2007/03/24 00:05:57 tom Exp $ +.\" $XTermId: xterm.man,v 1.392 2007/07/22 17:14:09 tom Exp $ .\" .\" Copyright 1996-2006,2007 by Thomas E. Dickey .\" @@ -354,7 +354,7 @@ Otherwise, they have a column width of 1. This may be useful for some legacy CJK text terminal-based programs assuming box drawings and others to have a column width of 2. -It also has to be turned on when you specify a TrueType +It also should be turned on when you specify a TrueType CJK double-width (bi-width/monospace) font either with \fB-fa\fP at the command line or \fBfaceName\fP resource. The default is ``false'' @@ -451,6 +451,9 @@ This corresponds to the \fBfaceName\fP resource. When a CJK double-width font is specified, you also need to turn on the \fBcjkWidth\fP resource. +See also the \fBrenderFont\fP resource, +which combines with this to determine whether FreeType fonts are +initially active. .TP 8 .BI -fbb This option indicates that \fIxterm\fP should compare normal and bold fonts bounding @@ -944,6 +947,16 @@ color rather than with underlining. This option enables the display of characters with underline attribute as color rather than with underlining. .TP 8 +.B "-ulit" +This option, corresponding to the \fBitalicULMode\fP resource, +disables the display of characters with underline attribute as +italics rather than with underlining. +.TP 8 +.B "+ulit" +This option, corresponding to the \fBitalicULMode\fP resource, +enables the display of characters with underline attribute as +italics rather than with underlining. +.TP 8 .B -ut This option indicates that \fIxterm\fP should not write a record into the the system \fIutmp\fP log file. @@ -1216,6 +1229,10 @@ You cannot set this to a value less than 64. If ``true'', \fIxterm\fP will perform handshaking during initialization to ensure that the parent and child processes update the \fButmp\fP and \fBstty\fP state. +See also \fBwaitForMap\fP which waits for the pseudo-terminal's notion +of the screen size, +and \fBptySttySize\fP which resets the screen size after other terminal +initialization is complete. The default is ``true''. .TP 8 .B "ptyInitialErase (\fPclass\fB PtyInitialErase)" @@ -1229,6 +1246,18 @@ which \fIxterm\fP sets. See also the \fBttyModes\fP resource, which may modify this. The default is ``false''. .TP 8 +.B "ptySttySize (\fPclass\fB PtySttySize) +If ``true'', \fIxterm\fP will reset the screen size after +terminal initialization is complete. +This is needed for some systems whose pseudo-terminals cannot +propagate terminal characteristics. +Where it is not needed, it can interfere with other methods for +setting the intial screen size, e.g., via window manager interaction. +See also \fBwaitForMap\fP which waits for a handshake-message +giving the pseudo-terminal's notion of the screen size. +The default is ``false'' on Linux and OS X systems, +``true'' otherwise. +.TP 8 .B "sameName (\fPclass\fB SameName)" If the value of this resource is ``true'', \fIxterm\fP does not send title and icon name change requests when the request @@ -1356,6 +1385,14 @@ The default is ``false.'' .B "waitForMap (\fPclass\fB WaitForMap)" Specifies whether or not \fIxterm\fP should wait for the initial window map before starting the subprocess. +This is part of the +.B ptyHandshake +logic. +When \fIxterm\fP is directed to wait in this fashion, +it passes the terminal size from the display end of the pseudo-terminal +to the terminal I/O connection, e.g., according to the window manager. +Otherwise, it uses the size as given in resource values or command-line +option \fB-geom\fP. The default is ``false.'' .TP 8 .B "zIconBeep (\fPclass\fB ZIconBeep)" @@ -1401,9 +1438,14 @@ Note that allowing such events creates a very large security hole. The default is ``false.'' .TP +.B "allowTitleOps (\fPclass\fB AllowTitleOps)" +Specifies whether control sequences that modify the window title or icon name +should be allowed. +The default is ``true.'' +.TP .B "allowWindowOps (\fPclass\fB AllowWindowOps)" Specifies whether extended window control sequences (as used in dtterm) -for should be allowed. +should be allowed. The default is ``true.'' .TP 8 .B "altIsNotMeta (\fPclass\fB AltIsNotMeta\fP)" @@ -1624,6 +1666,8 @@ When turned on, characters with East Asian Ambiguous (A) category in UTR You may have to set this option to ``true'' if you have some old East Asian terminal based programs that assume that line-drawing characters have a column width of 2. +If this resource is false, the \fBmkWidth\fP resource controls the +choice between the system's \fBwcwidth\fP and \fIxterm\fP's built-in tables. The default is ``false.'' .TP 8 .B "color0 (\fPclass\fB Color0)" @@ -2012,6 +2056,15 @@ 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 "highlightReverse (\fPclass\fB HighlightReverse)" +Specifies whether \fIxterm\fP should reverse the selection foreground +and background colors when selecting text with reverse-video attribute. +This applies only to +the \fBhighlightColor\fP and \fBhighlightTextColor\fP resources, +e.g., to match the color scheme of \fIxwsh\fP. +If ``true'', \fIxterm\fP reverses the colors, +The default is ``true.'' +.TP 8 .B "highlightSelection (\fPclass\fB HighlightSelection)" If ``false'', selecting with the mouse highlights all positions on the screen between the beginning of the selection and the current position. @@ -2078,6 +2131,7 @@ The default is 2. .B "italicULMode (\fPclass\fB ColorAttrMode)" Specifies whether characters with the underline attribute should be displayed in an italic font or as underlined characters. +It is implemented only for TrueType fonts. .TP 8 .B "jumpScroll (\fPclass\fB JumpScroll)" Specifies whether or not jump scroll should be used. @@ -2181,10 +2235,38 @@ If ``false'', Meta characters input from the keyboard are handled according to the \fBeightBitInput\fP resource. The default is ``false.'' .TP 8 +.B "mkSamplePass (\fPclass\fB MkSamplePass)" +If \fBmkSampleSize\fP is nonzero, +and \fBmkWidth\fP (and \fBcjkWidth\fP) are false, +on startup \fIxterm\fP compares its built-in tables to the system's +wide character width data to decide if it will use the system's data. +It tests the first \fBmkSampleSize\fP character values, +and allows up to \fBmkSamplePass\fP mismatches before the test fails. +The default (for the allowed number of mismatches) is 256. +.TP 8 +.B "mkSampleSize (\fPclass\fB MkSampleSize)" +With \fBmkSamplePass\fP, this specifies a startup test used for +initializing wide character width calculations. +The default (number of characters to check) is 1024. +.TP 8 .B "mkWidth (\fPclass\fB MkWidth)" Specifies whether \fIxterm\fP should use a built-in version of the wide character width calculation. +See also the \fBcjkWidth\fP resource which can override this. The default is ``false.'' +.IP +Here is a summary of the resources which control the choice of +wide character width calculation: +.TS +l l l +_ _ _ +l l l. +\fIcjkWidth\fR \fImkWidth\fR \fIAction\fP +false false use system tables subject to \fBmkSamplePass\fP +false true use built-in tables +true false use built-in CJK tables +true true use built-in CJK tables +.TE .TP 8 .B "modifyCursorKeys (\fPclass\fB ModifyCursorKeys\fP)" Tells how to handle the special case where @@ -2281,7 +2363,7 @@ 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)). +If ``true'', \fIxterm\fR checks if NumLock is used as a modifier (see \fIxmodmap\fP(__mansuffix__)). If so, this modifier is used to simplify the logic when implementing special NumLock for the \fBsunKeyboard\fP resource. Also (when \fBsunKeyboard\fP is false), similar logic is used to find the @@ -2897,7 +2979,7 @@ This entry toggles active icons on and off if this feature was compiled into \fIxterm\fP. It is enabled only if \fIxterm\fP was started with the command line option +ai or the \fBactiveIcon\fP -resource is set to ``True.'' +resource is set to ``true.'' .TP 8 .B "softreset (\fPclass\fB SmeBSB)" This entry invokes the \fBsoft-reset()\fP action. @@ -3660,7 +3742,7 @@ run under \fIxdm\fP, are capable of using a ``magic cookie'' authorization scheme that can provide a reasonable level of security for many people. If your server is only using a host-based mechanism to control access to -the server (see \fIxhost(1)\fP), then if you enable access for a host and +the server (see \fIxhost(__mansuffix__)\fP), then if you enable access for a host and other users are also permitted to run clients on that same host, it is possible that someone can run an application which uses the basic services of the X protocol to snoop on your activities, @@ -4248,7 +4330,7 @@ indicate the normal and bold fonts that have been set through escape codes (or specified as the second and third action arguments, respectively), and .HP \fIs\fP or \fIS\fP indicate the font selection (as made by programs such as -\fIxfontsel(1)\fP) indicated by the second action argument. +\fIxfontsel(__mansuffix__)\fP) indicated by the second action argument. .RE .IP If \fIxterm\fR is configured to support wide characters, an @@ -4273,7 +4355,7 @@ 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. +use this to obtain the actual executable. Otherwise, use the $PATH variable to find \fIxterm\fP. .IP If parameters are given in the action, @@ -4347,6 +4429,8 @@ which is set by the \fBselectToClipboard\fP resource: Shift <KeyPress> Select:select-cursor-start() \\\& select-cursor-end(SELECT, CUT_BUFFER0) \\n\\\& Shift <KeyPress> Insert:insert-selection(SELECT, CUT_BUFFER0) \\n\\\& + <KeyPress> XF86Paste:insert-selection(SELECT, CUT_BUFFER0) \\n\\\& + <KeyPress> SunPaste:insert-selection(SELECT, CUT_BUFFER0) \\n\\\& Shift~Ctrl <KeyPress> KP_Add:larger-vt-font() \\n\\\& Shift Ctrl <KeyPress> KP_Add:smaller-vt-font() \\n\\\& Shift <KeyPress> KP_Subtract:smaller-vt-font() \\n\\\& @@ -4485,6 +4569,10 @@ a reference. WINDOWID is set to the X window id number of the \fIxterm\fP window. .TP 5 +XTERM_LOCALE +shows the locale which was used by \fIxterm\fP on startup. +Some shell initialization scripts may set a different locale. +.TP 5 XTERM_SHELL is set to the pathname of the program which is invoked. Usually that is a shell program, e.g., \fB/bin/sh\fP. @@ -4815,7 +4903,7 @@ There needs to be a dialog box to allow entry of the Tek COPY file name. . . .SH "SEE ALSO" -resize(1), luit(1), X(__miscmansuffix__), pty(4), tty(4) +resize(__mansuffix__), luit(__mansuffix__), X(__miscmansuffix__), pty(4), tty(4) .br \fIXterm Control Sequences\fP (this is the file ctlseqs.ms). diff --git a/app/xterm/xtermcfg.h b/app/xterm/xtermcfg.h index bca94a487..6664e6cdb 100644 --- a/app/xterm/xtermcfg.h +++ b/app/xterm/xtermcfg.h @@ -81,6 +81,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #define HAVE_WCWIDTH 1 /* AC_CHECK_FUNCS(wcwidth) */ #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_XF86KEYSYM_H 1 /* AC_CHECK_HEADERS(X11/XF86keysym.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 */ @@ -117,6 +118,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #define OPT_PASTE64 0 /* CF_ARG_ENABLE(past64) */ /* #undef OPT_PC_COLORS */ /* CF_ARG_DISABLE(pc-color) */ #define OPT_PTY_HANDSHAKE 1 /* CF_ARG_ENABLE(pty-handshake) */ +/* #undef OPT_READLINE */ /* CF_ARG_ENABLE(readline-mouse) */ /* #undef OPT_SAME_NAME */ /* CF_ARG_DISABLE(samename) */ /* #undef OPT_SCO_FUNC_KEYS */ /* CF_ARG_ENABLE(sco-fkeys) */ #define OPT_SELECT_REGEX 1 /* CF_ARG_DISABLE(regex) */ @@ -169,6 +171,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef OPT_TRACE /* #undef OPT_TRACE */ /* CF_ARG_ENABLE(trace) */ +/* #undef OPT_TRACE_FLAGS */ /* ...no option */ #endif /* |