diff options
Diffstat (limited to 'app')
35 files changed, 1305 insertions, 513 deletions
diff --git a/app/xterm/Imakefile b/app/xterm/Imakefile index 57a7fd06b..5bfaba7ee 100644 --- a/app/xterm/Imakefile +++ b/app/xterm/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XTermId: Imakefile,v 1.102 2009/04/27 19:26:34 tom Exp $ +XCOMM $XTermId: Imakefile,v 1.103 2011/02/19 13:09:15 tom Exp $ XCOMM XCOMM Attention xterm porters XCOMM @@ -7,8 +7,6 @@ XCOMM Xterm assumes that bcopy can handle overlapping arguments. If your XCOMM bcopy (or memcpy) cannot, write a routine called bcopy and link it in XCOMM or add -Dbcopy=mybcopy to the DEFINES list below. XCOMM -XCOMM $XFree86: xc/programs/xterm/Imakefile,v 3.73 2006/04/10 00:34:36 dickey Exp $ -XCOMM /* Uncomment SCROLLBAR_RIGHT if you want the scroll bar to be on the right */ SCROLLBAR_RIGHT = -DSCROLLBAR_RIGHT @@ -144,6 +142,14 @@ module.o: ; $(CC) -c defines $(CFLAGS) module.c OSMAJORVERSION = OSMajorVersion OSMINORVERSION = OSMinorVersion +#if defined(NTOArchitecture) || \ + defined(LinuxArchitecture) || \ + defined(OpenBSDArchitecture) || \ + defined(SGIArchitecture) || \ + defined(SunArchitecture) +TERMCAPDEFINES=-DUSE_TERMINFO -DHAVE_TIGETSTR +#endif + #if !defined(OS2Architecture) && !defined(__GNU__) #if defined(UseUtempter) UTMPDEF = -DUSE_UTEMPTER diff --git a/app/xterm/MANIFEST b/app/xterm/MANIFEST index c5e1d32ec..fe2ab6db9 100644 --- a/app/xterm/MANIFEST +++ b/app/xterm/MANIFEST @@ -1,4 +1,4 @@ -MANIFEST for xterm-267, version xterm-267 +MANIFEST for xterm-269, version xterm-269 -------------------------------------------------------------------------------- MANIFEST this file 256colres.h resource-definitions for 256-color mode diff --git a/app/xterm/THANKS b/app/xterm/THANKS index 424dfa2cc..97d533c15 100644 --- a/app/xterm/THANKS +++ b/app/xterm/THANKS @@ -1,4 +1,4 @@ --- $XTermId: THANKS,v 1.2 2010/10/24 17:46:47 tom Exp $ +-- $XTermId: THANKS,v 1.4 2011/02/11 10:55:53 tom Exp $ -- vile:txtmode fk=8bit There's no AUTHORS file in this distribution; it would be redundant since I (Thomas E. Dickey) have done more than 80% of the work on xterm since 1996. @@ -40,6 +40,7 @@ Chuck Blake D Roland Walker Daniel Colascione Daniel Jacobowitz +Dave Simmons David Dawes David Krause David Madore @@ -50,6 +51,7 @@ David Yeo Denis Zaitsev Dennis Preiser Dennis Schneider +Dimitrios Christidis Dr Werner Fink Ed Schouten Eddy De Greef diff --git a/app/xterm/Tekproc.c b/app/xterm/Tekproc.c index 1d9b9c01b..dd14e5d78 100644 --- a/app/xterm/Tekproc.c +++ b/app/xterm/Tekproc.c @@ -1,8 +1,7 @@ -/* $XTermId: Tekproc.c,v 1.184 2010/10/14 08:07:03 tom Exp $ */ +/* $XTermId: Tekproc.c,v 1.188 2011/02/20 00:55:33 tom Exp $ */ /* - * - * Copyright 2001-2009,2010 by Thomas E. Dickey + * Copyright 2001-2010,2011 by Thomas E. Dickey * * All Rights Reserved * @@ -398,7 +397,7 @@ TekPtyData(void) if (Tpushb == 0) { if ((Tpushb = TypeMallocN(Char, 10)) == NULL || (Tline = TypeMallocN(XSegment, MAX_VTX)) == NULL) { - fprintf(stderr, "%s: Not enough core for Tek mode\n", xterm_name); + fprintf(stderr, "%s: Not enough core for Tek mode\n", ProgramName); if (Tpushb) free(Tpushb); Tfailed = True; @@ -601,7 +600,8 @@ Tekparse(TekWidget tw) case CASE_BEAM_VEC: TRACE(("case: beam and vector selector\n")); /* only line types */ - if ((c &= LINEMASK) != tekscr->cur.linetype) { + c = (IChar) (c & LINEMASK); + if (c != tekscr->cur.linetype) { if (nplot > 0) TekFlush(tw); if (c <= TEKNUMLINES) @@ -1540,7 +1540,7 @@ TekRealize(Widget gw, XtWindow(tw) = TWindow(tekscr) = XCreateWindow(XtDisplay(tw), - XtWindow(SHELL_OF(tw)), + VShellWindow(tw), tw->core.x, tw->core.y, tw->core.width, tw->core.height, BorderWidth(tw), @@ -1574,7 +1574,7 @@ TekRealize(Widget gw, tekscr->gin_terminator = GIN_TERM_EOT; else fprintf(stderr, "%s: illegal GIN terminator setting \"%s\"\n", - xterm_name, tw->tek.gin_terminator_str); + ProgramName, tw->tek.gin_terminator_str); gcv.graphics_exposures = True; /* default */ gcv.font = tw->tek.Tfont[tekscr->cur.fontsize]->fid; diff --git a/app/xterm/XTerm.ad b/app/xterm/XTerm.ad index ffbb0e2cb..701109273 100644 --- a/app/xterm/XTerm.ad +++ b/app/xterm/XTerm.ad @@ -1,8 +1,8 @@ -! $XTermId: XTerm.ad,v 1.93 2010/06/15 10:55:59 tom Exp $ +! $XTermId: XTerm.ad,v 1.94 2011/01/19 22:05:58 tom Exp $ ! ----------------------------------------------------------------------------- ! this file is part of xterm ! -! Copyright 1996-2009,2010 by Thomas E. Dickey +! Copyright 1996-2010,2011 by Thomas E. Dickey ! ! All Rights Reserved ! @@ -44,6 +44,7 @@ *mainMenu.Label: Main Options *mainMenu*toolbar*Label: Toolbar +*mainMenu*fullscreen*Label: Full Screen *mainMenu*securekbd*Label: Secure Keyboard *mainMenu*allowsends*Label: Allow SendEvents *mainMenu*redraw*Label: Redraw Window diff --git a/app/xterm/button.c b/app/xterm/button.c index fee568121..d29be1829 100644 --- a/app/xterm/button.c +++ b/app/xterm/button.c @@ -1,7 +1,7 @@ -/* $XTermId: button.c,v 1.391 2010/11/11 11:50:13 tom Exp $ */ +/* $XTermId: button.c,v 1.397 2011/02/13 20:09:31 tom Exp $ */ /* - * Copyright 1999-2009,2010 by Thomas E. Dickey + * Copyright 1999-2010,2011 by Thomas E. Dickey * * All Rights Reserved * @@ -1261,8 +1261,7 @@ xtermUtf8ToTextList(XtermWidget xw, (void) UTF8toLatin1(screen, data, size, &size); new_size += size + 1; } - new_text_list = - (char **) XtMalloc((Cardinal) sizeof(char *) * (unsigned) *text_list_count); + new_text_list = TypeXtMallocN(char *, *text_list_count); new_text_list[0] = tmp = XtMalloc((Cardinal) new_size); for (i = 0; i < (*text_list_count); ++i) { data = (Char *) (*text_list)[i]; @@ -1342,8 +1341,7 @@ overrideTargets(Widget w, String value, Atom ** resultp) if (copied[n] == ',') ++count; } - result = (Atom *) XtMalloc(((2 * count) + 1) - * (Cardinal) sizeof(Atom)); + result = TypeXtMallocN(Atom, (2 * count) + 1); if (result == NULL) { TRACE(("Couldn't allocate selection types\n")); } else { @@ -1355,7 +1353,7 @@ overrideTargets(Widget w, String value, Atom ** resultp) size_t len = strlen(listp); if (len == 0) { - ; + /* EMPTY */ ; } #if OPT_WIDE_CHARS else if (sameItem(listp, "UTF8")) { @@ -1403,7 +1401,7 @@ allocUtf8Targets(Widget w, TScreen * screen) Atom *result; if (!overrideTargets(w, screen->utf8_select_types, &result)) { - result = (Atom *) XtMalloc((Cardinal) (5 * sizeof(Atom))); + result = TypeXtMallocN(Atom, 5); if (result == NULL) { TRACE(("Couldn't allocate utf-8 selection targets\n")); } else { @@ -1437,7 +1435,7 @@ alloc8bitTargets(Widget w, TScreen * screen) Atom *result = 0; if (!overrideTargets(w, screen->eightbit_select_types, &result)) { - result = (Atom *) XtMalloc((Cardinal) (5 * sizeof(Atom))); + result = TypeXtMallocN(Atom, 5); if (result == NULL) { TRACE(("Couldn't allocate 8bit selection targets\n")); } else { @@ -1682,7 +1680,7 @@ xtermGetSelection(Widget w, if (num_params) { /* 'list' is freed in SelectionReceived */ - list = XtNew(struct _SelectionList); + list = TypeXtMalloc(struct _SelectionList); if (list != 0) { list->params = params; list->count = num_params; @@ -1984,7 +1982,7 @@ SelectionReceived(Widget w, #if OPT_PASTE64 if (screen->base64_paste) { - ; + /* EMPTY */ ; } else #endif #if OPT_READLINE @@ -3633,10 +3631,10 @@ ConvertSelection(Widget w, Atom *my_targets = _SelectionTargets(w); TRACE(("XmuConvertStandardSelection - success\n")); - std_targets = (Atom *) (std_return); + std_targets = (Atom *) (void *) (std_return); *length = std_length + 6; - targetP = (Atom *) XtMalloc((Cardinal) (sizeof(Atom) * (*length))); + targetP = TypeXtMallocN(Atom, *length); allocP = targetP; *value = (XtPointer) targetP; @@ -3821,7 +3819,7 @@ _OwnSelection(XtermWidget xw, if (count > screen->sel_atoms_size) { XtFree((char *) atoms); - atoms = (Atom *) XtMalloc((Cardinal) (count * sizeof(Atom))); + atoms = TypeXtMallocN(Atom, count); screen->selection_atoms = atoms; screen->sel_atoms_size = count; } @@ -3836,7 +3834,7 @@ _OwnSelection(XtermWidget xw, screen->selection_length, cutbuffer)); fprintf(stderr, "%s: selection too big (%lu bytes), not storing in CUT_BUFFER%d\n", - xterm_name, screen->selection_length, cutbuffer); + ProgramName, screen->selection_length, cutbuffer); } else { /* This used to just use the UTF-8 data, which was totally * broken as not even the corresponding paste code in Xterm @@ -4046,8 +4044,7 @@ SaveText(TScreen * screen, */ /* Position: 32 - 255. */ - -static Char +static int BtnCode(XButtonEvent * event, int button) { int result = (int) (32 + (KeyState(event->state) << 2)); @@ -4061,7 +4058,21 @@ BtnCode(XButtonEvent * event, int button) result += 32; result += button; } - return CharOf(result); + return result; +} + +static unsigned +EmitButtonCode(TScreen * screen, Char * line, unsigned count, XButtonEvent * event) +{ + int value = BtnCode(event, screen->mouse_button); + + if (!screen->ext_mode_mouse || value < 128) { + line[count++] = CharOf(value); + } else { + line[count++] = CharOf(0xC0 + (value >> 6)); + line[count++] = CharOf(0x80 + (value & 0x3F)); + } + return count; } static void @@ -4127,7 +4138,8 @@ EditorButton(XtermWidget xw, XButtonEvent * event) /* Button-Motion events */ switch (event->type) { case ButtonPress: - line[count++] = BtnCode(event, screen->mouse_button = button); + screen->mouse_button = button; + count = EmitButtonCode(screen, line, count, event); break; case ButtonRelease: /* @@ -4137,7 +4149,8 @@ EditorButton(XtermWidget xw, XButtonEvent * event) */ if (button < 3) button = -1; - line[count++] = BtnCode(event, screen->mouse_button = button); + screen->mouse_button = button; + count = EmitButtonCode(screen, line, count, event); break; case MotionNotify: /* BTN_EVENT_MOUSE and ANY_EVENT_MOUSE modes send motion @@ -4147,7 +4160,7 @@ EditorButton(XtermWidget xw, XButtonEvent * event) && (col == screen->mouse_col)) { changed = False; } else { - line[count++] = BtnCode(event, screen->mouse_button); + count = EmitButtonCode(screen, line, count, event); } break; default: diff --git a/app/xterm/cachedGCs.c b/app/xterm/cachedGCs.c index 3b5608279..aca07aaeb 100644 --- a/app/xterm/cachedGCs.c +++ b/app/xterm/cachedGCs.c @@ -1,8 +1,8 @@ -/* $XTermId: cachedGCs.c,v 1.59 2010/04/15 00:00:17 tom Exp $ */ +/* $XTermId: cachedGCs.c,v 1.60 2011/02/09 10:11:44 tom Exp $ */ /************************************************************ -Copyright 2007-2009,2010 by Thomas E. Dickey +Copyright 2007-2010,2011 by Thomas E. Dickey All Rights Reserved @@ -513,6 +513,7 @@ setCgsFont(XtermWidget xw, VTwin * cgsWin, CgsEnum cgsId, XTermFonts * font) NEXT(font) = font; me->mask |= GCFont; } else { + /* EMPTY */ TRACE2(("...NOT updated font for %s\n", traceCgsEnum(cgsId))); } diff --git a/app/xterm/charproc.c b/app/xterm/charproc.c index 098e47272..c9f6506cc 100644 --- a/app/xterm/charproc.c +++ b/app/xterm/charproc.c @@ -1,58 +1,58 @@ -/* $XTermId: charproc.c,v 1.1091 2010/11/11 11:41:26 tom Exp $ */ +/* $XTermId: charproc.c,v 1.1112 2011/02/20 00:50:46 tom Exp $ */ /* - -Copyright 1999-2009,2010 by Thomas E. Dickey - - All Rights Reserved - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name(s) of the above copyright -holders shall not be used in advertising or otherwise to promote the -sale, use or other dealings in this Software without prior written -authorization. - -Copyright 1988 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ + * Copyright 1999-2010,2011 by Thomas E. Dickey + * + * All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization. + * + * + * Copyright 1988 The Open Group + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation. + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of The Open Group shall not be + * used in advertising or otherwise to promote the sale, use or other dealings + * in this Software without prior written authorization from The Open Group. + * + */ /* * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. * @@ -132,11 +132,6 @@ in this Software without prior written authorization from The Open Group. #include <charclass.h> #include <xstrings.h> -typedef struct { - const char *name; - int code; -} FlagList; - typedef void (*BitFunc) (unsigned * /* p */ , unsigned /* mask */ ); @@ -218,60 +213,7 @@ static void HandleStructNotify PROTO_XT_EV_HANDLER_ARGS; static String _Font_Selected_ = "yes"; /* string is arbitrary */ -static char defaultTranslations[] = -"\ - Shift <KeyPress> Prior:scroll-back(1,halfpage) \n\ - Shift <KeyPress> Next:scroll-forw(1,halfpage) \n\ - Shift <KeyPress> Select:select-cursor-start() select-cursor-end(SELECT, CUT_BUFFER0) \n\ - Shift <KeyPress> Insert:insert-selection(SELECT, CUT_BUFFER0) \n\ -" -#if OPT_SCROLL_LOCK -"\ - <KeyRelease> Scroll_Lock:scroll-lock() \n\ -" -#endif -#if OPT_SHIFT_FONTS -"\ - 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\ -" -#endif -"\ - ~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\ - ! @Num_Lock Ctrl <Btn1Down>:popup-menu(mainMenu) \n\ - ~Meta <Btn1Down>:select-start() \n\ - ~Meta <Btn1Motion>:select-extend() \n\ - !Ctrl <Btn2Down>:popup-menu(vtMenu) \n\ - !Lock Ctrl <Btn2Down>:popup-menu(vtMenu) \n\ - !Lock Ctrl @Num_Lock <Btn2Down>:popup-menu(vtMenu) \n\ - ! @Num_Lock Ctrl <Btn2Down>:popup-menu(vtMenu) \n\ - ~Ctrl ~Meta <Btn2Down>:ignore() \n\ - Meta <Btn2Down>:clear-saved-lines() \n\ - ~Ctrl ~Meta <Btn2Up>:insert-selection(SELECT, CUT_BUFFER0) \n\ - !Ctrl <Btn3Down>:popup-menu(fontMenu) \n\ - !Lock Ctrl <Btn3Down>:popup-menu(fontMenu) \n\ - !Lock Ctrl @Num_Lock <Btn3Down>:popup-menu(fontMenu) \n\ - ! @Num_Lock Ctrl <Btn3Down>:popup-menu(fontMenu) \n\ - ~Ctrl ~Meta <Btn3Down>:start-extend() \n\ - ~Meta <Btn3Motion>:select-extend() \n\ - Ctrl <Btn4Down>:scroll-back(1,halfpage,m) \n\ - Lock Ctrl <Btn4Down>:scroll-back(1,halfpage,m) \n\ - Lock @Num_Lock Ctrl <Btn4Down>:scroll-back(1,halfpage,m) \n\ - @Num_Lock Ctrl <Btn4Down>:scroll-back(1,halfpage,m) \n\ - <Btn4Down>:scroll-back(5,line,m) \n\ - Ctrl <Btn5Down>:scroll-forw(1,halfpage,m) \n\ - Lock Ctrl <Btn5Down>:scroll-forw(1,halfpage,m) \n\ - Lock @Num_Lock Ctrl <Btn5Down>:scroll-forw(1,halfpage,m) \n\ - @Num_Lock Ctrl <Btn5Down>:scroll-forw(1,halfpage,m) \n\ - <Btn5Down>:scroll-forw(5,line,m) \n\ - <BtnUp>:select-end(SELECT, CUT_BUFFER0) \n\ - <BtnDown>:ignore() \ -"; /* PROCURA added "Meta <Btn2Down>:clear-saved-lines()" */ +static const char *defaultTranslations; /* *INDENT-OFF* */ static XtActionsRec actionsList[] = { { "allow-send-events", HandleAllowSends }, @@ -374,6 +316,7 @@ static XtActionsRec actionsList[] = { #endif #if OPT_MAXIMIZE { "deiconify", HandleDeIconify }, + { "fullscreen", HandleFullscreen }, { "iconify", HandleIconify }, { "maximize", HandleMaximize }, { "restore", HandleRestoreSize }, @@ -813,7 +756,7 @@ WidgetClassRec xtermClassRec = NULL, /* accept_focus */ XtVersion, /* version */ NULL, /* callback_offsets */ - defaultTranslations, /* tm_table */ + 0, /* tm_table */ XtInheritQueryGeometry, /* query_geometry */ XtInheritDisplayAccelerator, /* display_accelerator */ NULL /* extension */ @@ -865,6 +808,9 @@ xtermAddInput(Widget w) #if OPT_DABBREV { "dabbrev-expand", HandleDabbrevExpand }, #endif +#if OPT_MAXIMIZE + { "fullscreen", HandleFullscreen }, +#endif #if OPT_SCROLL_LOCK { "scroll-lock", HandleScrollLock }, #endif @@ -3400,7 +3346,7 @@ v_write(int f, const Char * data, unsigned len) } else { /* no memory: ignore entire write request */ fprintf(stderr, "%s: cannot allocate buffer space\n", - xterm_name); + ProgramName); v_buffer = v_bufstr; /* restore clobbered pointer */ } } @@ -3889,7 +3835,7 @@ dotext(XtermWidget xw, } #else /* ! OPT_WIDE_CHARS */ - for (offset = 0; offset < len; offset += this_col) { + for (offset = 0; offset < len; offset += (Cardinal) this_col) { #if OPT_DEC_CHRSET LineData *ld = getLineData(screen, screen->cur_row); #endif @@ -3905,8 +3851,8 @@ dotext(XtermWidget xw, } this_col = 1; } - if (offset + this_col > len) { - this_col = len - offset; + if (offset + (Cardinal) this_col > len) { + this_col = (int) (len - offset); } next_col = screen->cur_col + this_col; @@ -3917,7 +3863,7 @@ dotext(XtermWidget xw, * If screen->cur_col is less than next_col, we must have * hit the right margin - so set the do_wrap flag. */ - screen->do_wrap = (screen->cur_col < next_col); + screen->do_wrap = (Boolean) (screen->cur_col < next_col); } #endif /* OPT_WIDE_CHARS */ @@ -4061,6 +4007,7 @@ SetCursorBlink(TScreen * screen, Bool enable) if (DoStartBlinking(screen)) { StartBlinking(screen); } else { + /* EMPTY */ #if !OPT_BLINK_TEXT StopBlinking(screen); #endif @@ -4152,7 +4099,7 @@ dpmodes(XtermWidget xw, BitFunc func) * Setting DECANM should have no effect, since this function * cannot be reached from vt52 mode. */ - ; + /* EMPTY */ ; } #if OPT_VT52_MODE else if (screen->terminal_id >= 100) { /* VT52 */ @@ -4842,7 +4789,7 @@ get_icon_label(XtermWidget xw) XTextProperty text; char *result = 0; - if (XGetWMIconName(TScreenOf(xw)->display, VShellWindow, &text)) { + if (XGetWMIconName(TScreenOf(xw)->display, VShellWindow(xw), &text)) { result = property_to_string(xw, &text); } return result; @@ -4854,7 +4801,7 @@ get_window_label(XtermWidget xw) XTextProperty text; char *result = 0; - if (XGetWMName(TScreenOf(xw)->display, VShellWindow, &text)) { + if (XGetWMName(TScreenOf(xw)->display, VShellWindow(xw), &text)) { result = property_to_string(xw, &text); } return result; @@ -4912,7 +4859,7 @@ window_ops(XtermWidget xw) if (AllowWindowOps(xw, ewRestoreWin)) { TRACE(("...de-iconify window\n")); XMapWindow(screen->display, - VShellWindow); + VShellWindow(xw)); } break; @@ -4920,7 +4867,7 @@ window_ops(XtermWidget xw) if (AllowWindowOps(xw, ewMinimizeWin)) { TRACE(("...iconify window\n")); XIconifyWindow(screen->display, - VShellWindow, + VShellWindow(xw), DefaultScreen(screen->display)); } break; @@ -4932,7 +4879,7 @@ window_ops(XtermWidget xw) TRACE(("...move window to %d,%d\n", values.x, values.y)); value_mask = (CWX | CWY); XReconfigureWMWindow(screen->display, - VShellWindow, + VShellWindow(xw), DefaultScreen(screen->display), value_mask, &values); @@ -4948,14 +4895,14 @@ window_ops(XtermWidget xw) case ewRaiseWin: /* Raise the window to the front of the stack */ if (AllowWindowOps(xw, ewRaiseWin)) { TRACE(("...raise window\n")); - XRaiseWindow(screen->display, VShellWindow); + XRaiseWindow(screen->display, VShellWindow(xw)); } break; case ewLowerWin: /* Lower the window to the bottom of the stack */ if (AllowWindowOps(xw, ewLowerWin)) { TRACE(("...lower window\n")); - XLowerWindow(screen->display, VShellWindow); + XLowerWindow(screen->display, VShellWindow(xw)); } break; @@ -4978,6 +4925,11 @@ window_ops(XtermWidget xw) RequestMaximize(xw, zero_if_default(1)); } break; + case ewFullscreenWin: /* Fullscreen or restore */ + if (AllowWindowOps(xw, ewFullscreenWin)) { + FullScreen(xw, zero_if_default(1)); + } + break; #endif case ewGetWinState: /* Report the window's state */ @@ -5442,6 +5394,10 @@ VTRun(XtermWidget xw) } #endif screen->is_running = True; +#if OPT_MAXIMIZE + if (resource.fullscreen == esTrue || resource.fullscreen == esAlways) + FullScreen(term, True); +#endif if (!setjmp(VTend)) VTparse(xw); StopBlinking(screen); @@ -5608,7 +5564,7 @@ RequestResize(XtermWidget xw, int rows, int cols, Bool text) TRACE(("%s@%d -- ", __FILE__, __LINE__)); TRACE_HINTS(&xw->hints); - XSetWMNormalHints(screen->display, VShellWindow, &xw->hints); + XSetWMNormalHints(screen->display, VShellWindow(xw), &xw->hints); TRACE(("%s@%d -- ", __FILE__, __LINE__)); TRACE_WM_HINTS(xw); } @@ -5944,49 +5900,6 @@ set_flags_from_list(char *target, } } -/* - * Extend a (normally) boolean resource value by checking for additional values - * which will be mapped into true/false. - */ -#if OPT_RENDERFONT -static int -extendedBoolean(const char *value, FlagList * table, Cardinal limit) -{ - int result = -1; - long check; - char *next; - Cardinal n; - - if ((x_strcasecmp(value, "true") == 0) - || (x_strcasecmp(value, "yes") == 0) - || (x_strcasecmp(value, "on") == 0)) { - result = True; - } else if ((x_strcasecmp(value, "false") == 0) - || (x_strcasecmp(value, "no") == 0) - || (x_strcasecmp(value, "off") == 0)) { - result = False; - } else if ((check = strtol(value, &next, 0)) >= 0 && *next == '\0') { - if (check >= (long) limit) - check = True; - result = (int) check; - } else { - for (n = 0; n < limit; ++n) { - if (x_strcasecmp(value, table[n].name) == 0) { - result = table[n].code; - break; - } - } - } - - if (result < 0) { - fprintf(stderr, "Unrecognized keyword: %s\n", value); - result = False; - } - - return result; -} -#endif /* OPT_RENDERFONT */ - /* ARGSUSED */ static void VTInitialize(Widget wrequest, @@ -6038,6 +5951,7 @@ VTInitialize(Widget wrequest, ,DATA(SetWinSizeChars) #if OPT_MAXIMIZE ,DATA(MaximizeWin) + ,DATA(FullscreenWin) #endif ,DATA(GetWinState) ,DATA(GetWinPosition) @@ -7019,7 +6933,7 @@ VTRealize(Widget w, char *use_font = x_strdup(DEFFONT); fprintf(stderr, "%s: unable to open font \"%s\", trying \"%s\"....\n", - xterm_name, myfont->f_n, use_font); + ProgramName, myfont->f_n, use_font); (void) xtermLoadFont(xw, xtermFontName(use_font), False, @@ -7031,7 +6945,7 @@ VTRealize(Widget w, /* really screwed if we couldn't open default font */ if (!screen->fnts[fNorm].fs) { fprintf(stderr, "%s: unable to locate a suitable font\n", - xterm_name); + ProgramName); Exit(1); } #if OPT_WIDE_CHARS @@ -7098,6 +7012,13 @@ VTRealize(Widget w, xw->hints.x = xpos; xw->hints.y = ypos; +#if OPT_MAXIMIZE + /* assure single-increment resize for fullscreen */ + if (term->screen.fullscreen) { + xw->hints.width_inc = 1; + xw->hints.height_inc = 1; + } +#endif if ((XValue & pr) || (YValue & pr)) { xw->hints.flags |= USSize | USPosition; xw->hints.flags |= PWinGravity; @@ -7142,12 +7063,12 @@ VTRealize(Widget w, * realized, so that it can do the right thing. */ if (xw->hints.flags & USPosition) - XMoveWindow(XtDisplay(xw), XtWindow(SHELL_OF(xw)), + XMoveWindow(XtDisplay(xw), VShellWindow(xw), xw->hints.x, xw->hints.y); TRACE(("%s@%d -- ", __FILE__, __LINE__)); TRACE_HINTS(&xw->hints); - XSetWMNormalHints(XtDisplay(xw), XtWindow(SHELL_OF(xw)), &xw->hints); + XSetWMNormalHints(XtDisplay(xw), VShellWindow(xw), &xw->hints); TRACE(("%s@%d -- ", __FILE__, __LINE__)); TRACE_WM_HINTS(xw); @@ -7155,7 +7076,7 @@ VTRealize(Widget w, /* XChangeProperty format 32 really is "long" */ unsigned long pid_l = (unsigned long) getpid(); TRACE(("Setting _NET_WM_PID property to %lu\n", pid_l)); - XChangeProperty(XtDisplay(xw), VShellWindow, + XChangeProperty(XtDisplay(xw), VShellWindow(xw), pid_atom, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &pid_l, 1); } @@ -7290,7 +7211,7 @@ VTRealize(Widget w, resetCharsets(screen); - XDefineCursor(screen->display, VShellWindow, screen->pointer_cursor); + XDefineCursor(screen->display, VShellWindow(xw), screen->pointer_cursor); set_cur_col(screen, 0); set_cur_row(screen, 0); @@ -7330,6 +7251,7 @@ VTRealize(Widget w, screen->fullVwin.sb_info.width = 0; ScrollBarOn(xw, False); } + return; } @@ -7607,6 +7529,29 @@ VTInitI18N(XtermWidget xw) } #endif /* OPT_I18N_SUPPORT && OPT_INPUT_METHOD */ +static void +set_cursor_outline_gc(XtermWidget xw, + Bool filled, + Pixel fg, + Pixel bg, + Pixel cc) +{ + TScreen *screen = TScreenOf(xw); + VTwin *win = WhichVWin(screen); + CgsEnum cgsId = gcVTcursOutline; + + if (cc == bg) + cc = fg; + + if (filled) { + setCgsFore(xw, win, cgsId, bg); + setCgsBack(xw, win, cgsId, cc); + } else { + setCgsFore(xw, win, cgsId, cc); + setCgsBack(xw, win, cgsId, bg); + } +} + static Boolean VTSetValues(Widget cur, Widget request GCC_UNUSED, @@ -7861,7 +7806,9 @@ ShowCursor(void) #if OPT_HIGHLIGHT_COLOR if (screen->hilite_reverse) { if (in_selection && !reversed) { - ; /* really INVERSE ... */ + /* EMPTY */ + /* really INVERSE ... */ + ; } else if (in_selection || reversed) { if (use_selbg) { if (use_selfg) { @@ -7907,10 +7854,9 @@ ShowCursor(void) y = CursorY(screen, screen->cur_row); if (screen->cursor_underline) { - /* - * Overriding the combination of filled, reversed, in_selection - * is too complicated since the underline and the text-cell use + * Overriding the combination of filled, reversed, in_selection is + * too complicated since the underline and the text-cell use * different rules. Just redraw the text-cell, and draw the * underline on top of it. */ @@ -7918,7 +7864,7 @@ ShowCursor(void) /* * Our current-GC is likely to have been modified in HideCursor(). - * Setup a new request. + * Set up a new request. */ if (filled) { if (T_COLOR(screen, TEXT_CURSOR) == xw->dft_foreground) { @@ -7929,10 +7875,23 @@ ShowCursor(void) setCgsFore(xw, currentWin, currentCgs, fg_pix); setCgsBack(xw, currentWin, currentCgs, bg_pix); } + } + + /* + * Update the outline-gc, to keep the cursor color distinct from the + * background color. + */ + set_cursor_outline_gc(xw, + filled, + fg_pix, + bg_pix, + T_COLOR(screen, TEXT_CURSOR)); - outlineGC = getCgsGC(xw, currentWin, gcVTcursOutline); - if (outlineGC == 0) - outlineGC = currentGC; + outlineGC = getCgsGC(xw, currentWin, gcVTcursOutline); + if (outlineGC == 0) + outlineGC = currentGC; + + if (screen->cursor_underline) { /* * Finally, draw the underline. @@ -7942,9 +7901,6 @@ ShowCursor(void) XDrawLines(screen->display, VWindow(screen), outlineGC, screen->box, NBOX, CoordModePrevious); } else { - outlineGC = getCgsGC(xw, currentWin, gcVTcursOutline); - if (outlineGC == 0) - outlineGC = currentGC; drawXtermText(xw, flags & DRAWX_MASK, currentGC, x, y, @@ -8694,9 +8650,7 @@ FindFontSelection(XtermWidget xw, const char *atom_name, Bool justprobe) break; } if (!a) { - atoms = (AtomPtr *) XtRealloc((char *) atoms, - (Cardinal) sizeof(AtomPtr) - * (atomCount + 1)); + atoms = TypeXtReallocN(AtomPtr, atoms, atomCount + 1); *(pAtom = &atoms[atomCount]) = XmuMakeAtom(atom_name); } @@ -8766,16 +8720,11 @@ set_cursor_gcs(XtermWidget xw) /* both GC's use the same color */ setCgsFore(xw, win, gcVTcursReverse, bg); setCgsBack(xw, win, gcVTcursReverse, cc); - - setCgsFore(xw, win, gcVTcursOutline, bg); - setCgsBack(xw, win, gcVTcursOutline, cc); } else { setCgsFore(xw, win, gcVTcursReverse, bg); setCgsBack(xw, win, gcVTcursReverse, cc); - - setCgsFore(xw, win, gcVTcursOutline, cc); - setCgsBack(xw, win, gcVTcursOutline, bg); } + set_cursor_outline_gc(xw, screen->always_highlight, fg, bg, cc); changed = True; } @@ -8785,6 +8734,182 @@ set_cursor_gcs(XtermWidget xw) return changed; } +/* + * Build up the default translations string, allowing the user to suppress + * some of the features. + */ +void +VTInitTranslations(void) +{ + /* *INDENT-OFF* */ + static struct { + Boolean wanted; + const char *name; + const char *value; + } table[] = { + { + False, + "default", +"\ + Shift <KeyPress> Prior:scroll-back(1,halfpage) \n\ + Shift <KeyPress> Next:scroll-forw(1,halfpage) \n\ + Shift <KeyPress> Select:select-cursor-start() select-cursor-end(SELECT, CUT_BUFFER0) \n\ + Shift <KeyPress> Insert:insert-selection(SELECT, CUT_BUFFER0) \n\ +" + }, +#if OPT_MAXIMIZE + { + False, + "fullscreen", +"\ + Alt <Key>Return:fullscreen() \n\ +" + }, +#endif +#if OPT_SCROLL_LOCK + { + False, + "scroll-lock", +"\ + <KeyRelease> Scroll_Lock:scroll-lock() \n\ +" + }, +#endif +#if OPT_SHIFT_FONTS + { + False, + "shift-fonts", +"\ + 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\ +" + }, +#endif + /* PROCURA added "Meta <Btn2Down>:clear-saved-lines()" */ + { + False, + "default", +"\ + ~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\ + ! @Num_Lock Ctrl <Btn1Down>:popup-menu(mainMenu) \n\ + ~Meta <Btn1Down>:select-start() \n\ + ~Meta <Btn1Motion>:select-extend() \n\ + !Ctrl <Btn2Down>:popup-menu(vtMenu) \n\ + !Lock Ctrl <Btn2Down>:popup-menu(vtMenu) \n\ + !Lock Ctrl @Num_Lock <Btn2Down>:popup-menu(vtMenu) \n\ + ! @Num_Lock Ctrl <Btn2Down>:popup-menu(vtMenu) \n\ + ~Ctrl ~Meta <Btn2Down>:ignore() \n\ + Meta <Btn2Down>:clear-saved-lines() \n\ + ~Ctrl ~Meta <Btn2Up>:insert-selection(SELECT, CUT_BUFFER0) \n\ + !Ctrl <Btn3Down>:popup-menu(fontMenu) \n\ + !Lock Ctrl <Btn3Down>:popup-menu(fontMenu) \n\ + !Lock Ctrl @Num_Lock <Btn3Down>:popup-menu(fontMenu) \n\ + ! @Num_Lock Ctrl <Btn3Down>:popup-menu(fontMenu) \n\ + ~Ctrl ~Meta <Btn3Down>:start-extend() \n\ + ~Meta <Btn3Motion>:select-extend() \n\ +" + }, + { + False, + "wheel-mouse", +"\ + Ctrl <Btn4Down>:scroll-back(1,halfpage,m) \n\ + Lock Ctrl <Btn4Down>:scroll-back(1,halfpage,m) \n\ + Lock @Num_Lock Ctrl <Btn4Down>:scroll-back(1,halfpage,m) \n\ + @Num_Lock Ctrl <Btn4Down>:scroll-back(1,halfpage,m) \n\ + <Btn4Down>:scroll-back(5,line,m) \n\ + Ctrl <Btn5Down>:scroll-forw(1,halfpage,m) \n\ + Lock Ctrl <Btn5Down>:scroll-forw(1,halfpage,m) \n\ + Lock @Num_Lock Ctrl <Btn5Down>:scroll-forw(1,halfpage,m) \n\ + @Num_Lock Ctrl <Btn5Down>:scroll-forw(1,halfpage,m) \n\ + <Btn5Down>:scroll-forw(5,line,m) \n\ +" + }, + { + False, + "default", +"\ + <BtnUp>:select-end(SELECT, CUT_BUFFER0) \n\ + <BtnDown>:ignore() \ +" + } + }; + /* *INDENT-ON* */ + + size_t needed = 0; + char *result = 0; + + int pass; + Cardinal item; + + TRACE(("VTInitTranslations\n")); + for (item = 0; item < XtNumber(table); ++item) { + table[item].wanted = True; + } +#if OPT_MAXIMIZE + /* + * As a special case, allow for disabling the alt-enter translation if + * the resource settings prevent fullscreen from being used. We would + * do the same for scroll-lock and shift-fonts if they were application + * resources too, rather than in the widget. + */ + if (resource.fullscreen == esNever) { + for (item = 0; item < XtNumber(table); ++item) { + if (!strcmp(table[item].name, "fullscreen")) + table[item].wanted = False; + } + } +#endif + if (!IsEmpty(resource.omitTranslation)) { + char *value; + const char *source = resource.omitTranslation; + + while (*source != '\0' && (value = ParseList(&source)) != 0) { + size_t len = strlen(value); + + TRACE(("parsed:%s\n", value)); + for (item = 0; item < XtNumber(table); ++item) { + if (strlen(table[item].name) >= len + && x_strncasecmp(table[item].name, + value, + (unsigned) len) == 0) { + table[item].wanted = False; + TRACE(("omit(%s):\n%s\n", table[item].name, table[item].value)); + break; + } + } + free(value); + } + } + + for (pass = 0; pass < 2; ++pass) { + needed = 0; + for (item = 0; item < XtNumber(table); ++item) { + if (table[item].wanted) { + if (pass) { + strcat(result, table[item].value); + } else { + needed += strlen(table[item].value) + 1; + } + } + } + if (!pass) { + result = XtMalloc((Cardinal) needed); + *result = '\0'; + } + } + + TRACE(("result:\n%s\n", result)); + + defaultTranslations = result; + xtermClassRec.core_class.tm_table = result; +} + #ifdef NO_LEAKS void noleaks_charproc(void) diff --git a/app/xterm/ctlseqs.ms b/app/xterm/ctlseqs.ms index a1118b919..b88ed2049 100644 --- a/app/xterm/ctlseqs.ms +++ b/app/xterm/ctlseqs.ms @@ -1,9 +1,9 @@ .\"#! troff -ms $1 -*- Nroff -*- .\" "Xterm Control Sequences" document -.\" $XTermId: ctlseqs.ms,v 1.235 2010/11/19 00:51:33 tom Exp $ +.\" $XTermId: ctlseqs.ms,v 1.238 2011/02/16 11:57:19 tom Exp $ .\" .\" -.\" Copyright 1996-2009,2010 by Thomas E. Dickey +.\" Copyright 1996-2010,2011 by Thomas E. Dickey .\" .\" All Rights Reserved .\" @@ -1117,7 +1117,7 @@ Soft terminal reset (DECSTR). Request ANSI mode (DECRQM). For VT300 and up, reply is .br - \*(Cs\*(Ps\*;\*(Pm\*$\*p + \*(Cs\*(Ps\*;\*(Pm\*$\*y .br where \*(Ps is the mode number as in RM, and \*(Pm is the mode value: @@ -1208,6 +1208,8 @@ Valid values for the first (and any additional parameters) are: \*(Ps = \*8\*s\*;\*s\fIheight\*s\*;\*swidth\fP \(-> Resize the text area to [height;width] in characters. \*(Ps = \*9\*s\*;\*s\*0 \(-> Restore maximized window. \*(Ps = \*9\*s\*;\*s\*1 \(-> Maximize window (i.e., resize to screen size). + \*(Ps = \*1\*0\*s\*;\*s\*0 \(-> Undo full-screen mode. + \*(Ps = \*1\*0\*s\*;\*s\*1 \(-> Change to full-screen. \*(Ps = \*1\*1 \(-> Report \fIxterm\fP window state. If the \fIxterm\fP window is open (non-iconified), it returns \*(Cs\*1\*t. If the \fIxterm\fP window is iconified, it returns \*(Cs\*2\*t. @@ -2139,6 +2141,8 @@ For positions less than 95, the resulting output is identical under both modes. Under extended mouse mode, positions greater than 95 generate "extra" bytes which will confuse applications which do not treat their input as a UTF-8 stream. +Likewise, \*(Cb will be UTF-8 encoded, +to reduce confusion with wheel mouse events. .lP NOTE: Under normal mouse mode, positions outside (160,94) result in byte pairs which can be interpreted as a single UTF-8 character; diff --git a/app/xterm/ctlseqs.txt b/app/xterm/ctlseqs.txt index a16fe2767..6f2d9c9a3 100644 --- a/app/xterm/ctlseqs.txt +++ b/app/xterm/ctlseqs.txt @@ -607,7 +607,7 @@ CSI > Ps p CSI ! p Soft terminal reset (DECSTR). CSI Ps$ p Request ANSI mode (DECRQM). For VT300 and up, reply is - CSI Ps; Pm$ p + CSI Ps; Pm$ y where Ps is the mode number as in RM, and Pm is the mode value: 0 - not recognized @@ -685,6 +685,8 @@ CSI Ps ; Ps ; Ps t Ps = 9 ; 0 -> Restore maximized window. Ps = 9 ; 1 -> Maximize window (i.e., resize to screen size). + Ps = 1 0 ; 0 -> Undo full-screen mode. + Ps = 1 0 ; 1 -> Change to full-screen. Ps = 1 1 -> Report xterm window state. If the xterm window is open (non-iconified), it returns CSI 1 t . If the xterm window is iconified, it returns CSI 2 t . @@ -1449,7 +1451,8 @@ tracking modes, expanding the maximum encodable position from 223 to 2015. For positions less than 95, the resulting output is identical under both modes. Under extended mouse mode, positions greater than 95 generate "extra" bytes which will confuse applications which do not -treat their input as a UTF-8 stream. +treat their input as a UTF-8 stream. Likewise, Cb will be UTF-8 +encoded, to reduce confusion with wheel mouse events. NOTE: Under normal mouse mode, positions outside (160,94) result in byte pairs which can be interpreted as a single UTF-8 character; applications diff --git a/app/xterm/data.c b/app/xterm/data.c index 7840f8baa..bbccd5a40 100644 --- a/app/xterm/data.c +++ b/app/xterm/data.c @@ -1,7 +1,7 @@ -/* $XTermId: data.c,v 1.91 2009/10/12 00:33:20 tom Exp $ */ +/* $XTermId: data.c,v 1.92 2011/02/13 19:59:23 tom Exp $ */ /* - * Copyright 2002-2006,2007 by Thomas E. Dickey + * Copyright 2002-2009,2011 by Thomas E. Dickey * * All Rights Reserved * @@ -90,7 +90,6 @@ int debug = 0; /* true causes error messages to be displayed */ XtAppContext app_con; XtermWidget term; /* master data structure for client */ -char *xterm_name; /* argv[0] */ int hold_screen; SIG_ATOMIC_T need_cleanup = False; diff --git a/app/xterm/data.h b/app/xterm/data.h index edeefe83d..396765e19 100644 --- a/app/xterm/data.h +++ b/app/xterm/data.h @@ -1,7 +1,7 @@ -/* $XTermId: data.h,v 1.110 2009/10/12 00:33:08 tom Exp $ */ +/* $XTermId: data.h,v 1.115 2011/02/18 01:23:22 tom Exp $ */ /* - * Copyright 2002-2007,2009 by Thomas E. Dickey + * Copyright 2002-2009,2011 by Thomas E. Dickey * * All Rights Reserved * @@ -89,7 +89,6 @@ extern jmp_buf Tekend; extern char *ptydev; extern char *ttydev; -extern char *xterm_name; extern int hold_screen; extern PtyData *VTbuffer; @@ -143,7 +142,6 @@ extern int mapstate; #endif /* HANDLE_STRUCT_NOTIFY */ typedef struct XTERM_RESOURCE { - char *xterm_name; char *icon_geometry; char *title; char *icon_name; @@ -159,6 +157,7 @@ typedef struct XTERM_RESOURCE { Boolean messages; String menuLocale; + String omitTranslation; String keyboardType; #if OPT_SUNPC_KBD @@ -206,6 +205,8 @@ typedef struct XTERM_RESOURCE { #endif #if OPT_MAXIMIZE Boolean maximized; + String fullscreen_s; /* resource for "fullscreen" */ + int fullscreen; /* derived from fullscreen_s */ #endif } XTERM_RESOURCE; diff --git a/app/xterm/input.c b/app/xterm/input.c index 3a586b624..ffbddb72d 100644 --- a/app/xterm/input.c +++ b/app/xterm/input.c @@ -1,7 +1,7 @@ -/* $XTermId: input.c,v 1.326 2010/06/15 22:41:09 tom Exp $ */ +/* $XTermId: input.c,v 1.327 2011/02/09 10:15:07 tom Exp $ */ /* - * Copyright 1999-2009,2010 by Thomas E. Dickey + * Copyright 1999-2010,2011 by Thomas E. Dickey * * All Rights Reserved * @@ -486,7 +486,7 @@ allowedCharModifiers(XtermWidget xw, unsigned state, KEY_DATA * kd) UIntClr(result, ControlMask); } } else if (kd->keysym == XK_Tab || kd->keysym == XK_Return) { - ; + /* EMPTY */ ; } else if (IsControlAlias(kd)) { /* Things like "^_" work here... */ if (Masked(result, (ControlMask | ShiftMask)) == 0) { @@ -1989,7 +1989,7 @@ VTInitModifiers(XtermWidget xw) for (l = 0; l < keysyms_per_keycode; ++l) { keysym = XKeycodeToKeysym(dpy, code, l); if (keysym == NoSymbol) { - ; + /* EMPTY */ ; } else if (keysym == XK_Num_Lock) { SaveMask(num_lock); } else if (keysym == XK_Alt_L || keysym == XK_Alt_R) { @@ -1999,14 +1999,14 @@ VTInitModifiers(XtermWidget xw) } else if (mask == ShiftMask && (keysym == XK_Shift_L || keysym == XK_Shift_R)) { - ; /* ignore */ + /* EMPTY */ ; } else if (mask == ControlMask && (keysym == XK_Control_L || keysym == XK_Control_R)) { - ; /* ignore */ + /* EMPTY */ ; } else if (mask == LockMask && (keysym == XK_Caps_Lock)) { - ; /* ignore */ + /* EMPTY */ ; } else if (keysym == XK_Mode_switch #ifdef XK_ISO_Level3_Shift || keysym == XK_ISO_Level3_Shift diff --git a/app/xterm/linedata.c b/app/xterm/linedata.c index d39772b72..5d47d1a11 100644 --- a/app/xterm/linedata.c +++ b/app/xterm/linedata.c @@ -1,8 +1,8 @@ -/* $XTermId: linedata.c,v 1.78 2010/04/14 23:41:10 tom Exp $ */ +/* $XTermId: linedata.c,v 1.79 2011/01/21 00:07:35 tom Exp $ */ /************************************************************ -Copyright 2009,2010 by Thomas E. Dickey +Copyright 2009-2010,2011 by Thomas E. Dickey All Rights Reserved @@ -189,7 +189,7 @@ initLineData(XtermWidget xw) #define CellDataSize(screen) (SizeOfCellData + screen->lineExtra) #define CellDataAddr(screen, data, cell) \ - (CellData *)((char *)data + (cell * CellDataSize(screen))) + (CellData *)(void *) ((char *)data + (cell * CellDataSize(screen))) CellData * newCellData(XtermWidget xw, Cardinal count) diff --git a/app/xterm/main.c b/app/xterm/main.c index f19399727..e01b29d50 100644 --- a/app/xterm/main.c +++ b/app/xterm/main.c @@ -1,4 +1,4 @@ -/* $XTermId: main.c,v 1.618 2010/06/20 21:11:51 tom Exp $ */ +/* $XTermId: main.c,v 1.625 2011/02/18 01:24:50 tom Exp $ */ /* * W A R N I N G @@ -15,7 +15,7 @@ /*********************************************************** -Copyright 2002-2009,2010 by Thomas E. Dickey +Copyright 2002-2010,2011 by Thomas E. Dickey All Rights Reserved @@ -832,7 +832,6 @@ static sigjmp_buf env; static XtResource application_resources[] = { - Sres("name", "Name", xterm_name, DFT_TERMTYPE), Sres("iconGeometry", "IconGeometry", icon_geometry, NULL), Sres(XtNtitle, XtCTitle, title, NULL), Sres(XtNiconName, XtCIconName, icon_name, NULL), @@ -845,6 +844,7 @@ static XtResource application_resources[] = Ires("minBufSize", "MinBufSize", minBufSize, 4096), Ires("maxBufSize", "MaxBufSize", maxBufSize, 32768), Sres("menuLocale", "MenuLocale", menuLocale, DEF_MENU_LOCALE), + Sres("omitTranslation", "OmitTranslation", omitTranslation, NULL), Sres("keyboardType", "KeyboardType", keyboardType, "unknown"), #if OPT_SUNPC_KBD Bres("sunKeyboard", "SunKeyboard", sunKeyboard, False), @@ -890,6 +890,7 @@ static XtResource application_resources[] = #endif #if OPT_MAXIMIZE Bres(XtNmaximized, XtCMaximized, maximized, False), + Sres(XtNfullscreen, XtCFullscreen, fullscreen_s, "off"), #endif }; @@ -1086,6 +1087,8 @@ static XrmOptionDescRec optionDescList[] = { #if OPT_MAXIMIZE {"-maximized", "*maximized", XrmoptionNoArg, (XPointer) "on"}, {"+maximized", "*maximized", XrmoptionNoArg, (XPointer) "off"}, +{"-fullscreen", "*fullscreen", XrmoptionNoArg, (XPointer) "on"}, +{"+fullscreen", "*fullscreen", XrmoptionNoArg, (XPointer) "off"}, #endif /* options that we process ourselves */ {"-help", NULL, XrmoptionSkipNArgs, (XPointer) NULL}, @@ -1261,6 +1264,7 @@ static OptionHelp xtermOptions[] = { #endif #if OPT_MAXIMIZE {"-/+maximized", "turn on/off maxmize on startup" }, +{"-/+fullscreen", "turn on/off fullscreen on startup" }, #endif { NULL, NULL }}; /* *INDENT-ON* */ @@ -1752,15 +1756,22 @@ setEffectiveUser(uid_t user) int main(int argc, char *argv[]ENVP_ARG) { +#if OPT_MAXIMIZE +#define DATA(name) { #name, es##name } + static FlagList tblFullscreen[] = + { + DATA(Always), + DATA(Never) + }; +#undef DATA +#endif + Widget form_top, menu_top; Dimension menu_high; TScreen *screen; int mode; char *my_class = DEFCLASS; Window winToEmbedInto = None; -#if OPT_COLOR_RES - Bool reversed = False; -#endif ProgramName = argv[0]; @@ -1831,14 +1842,6 @@ main(int argc, char *argv[]ENVP_ARG) } unique = 3; } else { -#if OPT_COLOR_RES - if (abbrev(argv[n], "-reverse", (size_t) 2) - || !strcmp("-rv", argv[n])) { - reversed = True; - } else if (!strcmp("+rv", argv[n])) { - reversed = False; - } -#endif quit = False; unique = 3; } @@ -2003,6 +2006,12 @@ main(int argc, char *argv[]ENVP_ARG) application_resources, XtNumber(application_resources), NULL, 0); TRACE_XRES(); + VTInitTranslations(); +#if OPT_MAXIMIZE + resource.fullscreen = extendedBoolean(resource.fullscreen_s, + tblFullscreen, + XtNumber(tblFullscreen)); +#endif #if OPT_PTY_HANDSHAKE resource.wait_for_map0 = resource.wait_for_map; #endif @@ -2045,9 +2054,6 @@ main(int argc, char *argv[]ENVP_ARG) } #endif /* OPT_ZICONBEEP */ hold_screen = resource.hold_screen ? 1 : 0; - xterm_name = resource.xterm_name; - if (strcmp(xterm_name, "-") == 0) - xterm_name = DFT_TERMTYPE; if (resource.icon_geometry != NULL) { int scr, junk; int ix, iy; @@ -2393,18 +2399,26 @@ main(int argc, char *argv[]ENVP_ARG) winToEmbedInto, 0, 0); } #if OPT_COLOR_RES - TRACE(("checking resource values rv %s fg %s, bg %s\n", - BtoS(term->misc.re_verse0), + TRACE(("checking reverseVideo before rv %s fg %s, bg %s\n", + term->misc.re_verse0 ? "reverse" : "normal", NonNull(TScreenOf(term)->Tcolors[TEXT_FG].resource), NonNull(TScreenOf(term)->Tcolors[TEXT_BG].resource))); - if ((reversed && term->misc.re_verse0) - && ((TScreenOf(term)->Tcolors[TEXT_FG].resource - && !isDefaultForeground(TScreenOf(term)->Tcolors[TEXT_FG].resource)) - || (TScreenOf(term)->Tcolors[TEXT_BG].resource - && !isDefaultBackground(TScreenOf(term)->Tcolors[TEXT_BG].resource)) - )) - ReverseVideo(term); + if (term->misc.re_verse0) { + if (isDefaultForeground(TScreenOf(term)->Tcolors[TEXT_FG].resource) + && isDefaultBackground(TScreenOf(term)->Tcolors[TEXT_BG].resource)) { + TScreenOf(term)->Tcolors[TEXT_FG].resource = x_strdup(XtDefaultBackground); + TScreenOf(term)->Tcolors[TEXT_BG].resource = x_strdup(XtDefaultForeground); + } else { + ReverseVideo(term); + } + term->misc.re_verse = True; + update_reversevideo(); + TRACE(("updated reverseVideo after rv %s fg %s, bg %s\n", + term->misc.re_verse ? "reverse" : "normal", + NonNull(TScreenOf(term)->Tcolors[TEXT_FG].resource), + NonNull(TScreenOf(term)->Tcolors[TEXT_BG].resource))); + } #endif /* OPT_COLOR_RES */ #if OPT_MAXIMIZE @@ -3323,6 +3337,7 @@ spawnXTerm(XtermWidget xw) } } if (ok_termcap) { + resource.term_name = TermName; resize_termcap(xw); } @@ -3338,7 +3353,7 @@ spawnXTerm(XtermWidget xw) initial_erase = ttymodelist[XTTYMODE_erase].value; setInitialErase = True; } else if (resource.ptyInitialErase) { - ; + /* EMPTY */ ; } else if (ok_termcap) { char *s = get_tcap_erase(xw); TRACE(("...extracting initial_erase value from termcap\n")); @@ -3550,7 +3565,7 @@ spawnXTerm(XtermWidget xw) #endif /* __MVS__ */ } - while (1) { + for (;;) { #if USE_NO_DEV_TTY if (!no_dev_tty && (ttyfd = open("/dev/tty", O_RDWR)) >= 0) { @@ -3898,8 +3913,8 @@ spawnXTerm(XtermWidget xw) xtermCopyEnv(environ); - xtermSetenv("TERM", TermName); - if (!TermName) + xtermSetenv("TERM", resource.term_name); + if (!resource.term_name) *get_tcap_buffer(xw) = 0; sprintf(buf, "%lu", @@ -4926,7 +4941,7 @@ parse_tty_modes(char *s, struct _xttymodes *modelist) int count = 0; TRACE(("parse_tty_modes\n")); - while (1) { + for (;;) { size_t len; while (*s && isascii(CharOf(*s)) && isspace(CharOf(*s))) diff --git a/app/xterm/menu.c b/app/xterm/menu.c index 3179feeea..7e8f5e7e5 100644 --- a/app/xterm/menu.c +++ b/app/xterm/menu.c @@ -1,8 +1,7 @@ -/* $XTermId: menu.c,v 1.267 2010/06/20 21:09:10 tom Exp $ */ +/* $XTermId: menu.c,v 1.284 2011/02/17 00:46:18 tom Exp $ */ /* - * - * Copyright 1999-2009,2010 by Thomas E. Dickey + * Copyright 1999-2010,2011 by Thomas E. Dickey * * All Rights Reserved * @@ -30,6 +29,7 @@ * sale, use or other dealings in this Software without prior written * authorization. * + * * Copyright 1989 The Open Group * * Permission to use, copy, modify, distribute, and sell this software and its @@ -51,7 +51,6 @@ * Except as contained in this notice, the name of The Open Group shall not be * used in advertising or otherwise to promote the sale, use or other dealings * in this Software without prior written authorization from The Open Group. - * */ #include <xterm.h> @@ -121,6 +120,12 @@ #include <stdio.h> #include <signal.h> +#if OPT_TRACE +#define UpdateCheckbox(func, mn, mi, val) UpdateMenuItem(func, mn, mi, val) +#else +#define UpdateCheckbox(func, mn, mi, val) UpdateMenuItem(mn, mi, val) +#endif + #define ToggleFlag(flag) flag = (Boolean) !flag /* *INDENT-OFF* */ static void do_8bit_control PROTO_XT_CALLBACK_ARGS; @@ -199,6 +204,10 @@ static void do_font_loadable PROTO_XT_CALLBACK_ARGS; static void do_hp_fkeys PROTO_XT_CALLBACK_ARGS; #endif +#if OPT_MAXIMIZE +static void do_fullscreen PROTO_XT_CALLBACK_ARGS; +#endif + #if OPT_NUM_LOCK static void do_alt_esc PROTO_XT_CALLBACK_ARGS; static void do_num_lock PROTO_XT_CALLBACK_ARGS; @@ -261,6 +270,9 @@ MenuEntry mainMenuEntries[] = { #if OPT_TOOLBAR { "toolbar", do_toolbar, NULL }, #endif +#if OPT_MAXIMIZE + { "fullscreen", do_fullscreen, NULL }, +#endif { "securekbd", do_securekbd, NULL }, { "allowsends", do_allowsends, NULL }, { "redraw", do_redraw, NULL }, @@ -626,6 +638,7 @@ domenu(Widget w, case mainMenu: if (created) { update_toolbar(); + update_fullscreen(); update_securekbd(); update_allowsends(); update_logging(); @@ -835,10 +848,83 @@ handle_send_signal(Widget gw GCC_UNUSED, int sig) #endif } +static void +UpdateMenuItem( +#if OPT_TRACE + const char *func, +#endif + MenuEntry * menu, + int which, + Bool val) +{ + static Arg menuArgs = + {XtNleftBitmap, (XtArgVal) 0}; + Widget mi = menu[which].widget; + + if (mi) { + menuArgs.value = (XtArgVal) ((val) + ? TScreenOf(term)->menu_item_bitmap + : None); + XtSetValues(mi, &menuArgs, (Cardinal) 1); + } + TRACE(("%s(%d): %s\n", func, which, BtoS(val))); +} + +void +SetItemSensitivity(Widget mi, Bool val) +{ + static Arg menuArgs = + {XtNsensitive, (XtArgVal) 0}; + + if (mi) { + menuArgs.value = (XtArgVal) (val); + XtSetValues(mi, &menuArgs, (Cardinal) 1); + } +} + /* * action routines */ +#if OPT_MAXIMIZE +static void +do_fullscreen(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) +{ + XtermWidget xw = term; + TScreen *screen = TScreenOf(xw); + + if (resource.fullscreen != esNever) + FullScreen(xw, !screen->fullscreen); +} + +/* ARGSUSED */ +void +HandleFullscreen(Widget w, + XEvent * event GCC_UNUSED, + String * params GCC_UNUSED, + Cardinal *param_count GCC_UNUSED) +{ + do_fullscreen(w, (XtPointer) 0, (XtPointer) 0); +} + +void +update_fullscreen(void) +{ + if (resource.fullscreen <= 1) { + UpdateCheckbox("update_fullscreen", + mainMenuEntries, + mainMenu_fullscreen, + TScreenOf(term)->fullscreen); + } else { + SetItemSensitivity(mainMenuEntries[mainMenu_fullscreen].widget, + False); + } +} + +#endif /* OPT_MAXIMIZE */ + static void do_securekbd(Widget gw GCC_UNUSED, XtPointer closure GCC_UNUSED, @@ -1329,7 +1415,7 @@ do_marginbell(Widget gw GCC_UNUSED, { TScreen *screen = TScreenOf(term); - if (!(ToggleFlag(screen->marginbell))) + if ((ToggleFlag(screen->marginbell)) == 0) screen->bellArmed = -1; update_marginbell(); } @@ -2461,46 +2547,6 @@ HandleTekCopy(Widget w, } #endif /* OPT_TEK4014 */ -static void -UpdateMenuItem( -#if OPT_TRACE - const char *func, -#endif - MenuEntry * menu, - int which, - Bool val) -{ - static Arg menuArgs = - {XtNleftBitmap, (XtArgVal) 0}; - Widget mi = menu[which].widget; - - if (mi) { - menuArgs.value = (XtArgVal) ((val) - ? TScreenOf(term)->menu_item_bitmap - : None); - XtSetValues(mi, &menuArgs, (Cardinal) 1); - } - TRACE(("%s(%d): %s\n", func, which, BtoS(val))); -} - -#if OPT_TRACE -#define UpdateCheckbox(func, mn, mi, val) UpdateMenuItem(func, mn, mi, val) -#else -#define UpdateCheckbox(func, mn, mi, val) UpdateMenuItem(mn, mi, val) -#endif - -void -SetItemSensitivity(Widget mi, Bool val) -{ - static Arg menuArgs = - {XtNsensitive, (XtArgVal) 0}; - - if (mi) { - menuArgs.value = (XtArgVal) (val); - XtSetValues(mi, &menuArgs, (Cardinal) 1); - } -} - #if OPT_TOOLBAR /* * The normal style of xterm popup menu delays initialization until the menu is @@ -2658,13 +2704,14 @@ SetupMenus(Widget shell, Widget *forms, Widget *menus, Dimension * menu_high) void repairSizeHints(void) { - TScreen *screen = TScreenOf(term); + XtermWidget xw = term; + TScreen *screen = TScreenOf(xw); - if (XtIsRealized((Widget) term)) { - getXtermSizeHints(term); - xtermSizeHints(term, ScrollbarWidth(screen)); + if (XtIsRealized((Widget) xw)) { + getXtermSizeHints(xw); + xtermSizeHints(xw, ScrollbarWidth(screen)); - XSetWMNormalHints(screen->display, XtWindow(SHELL_OF(term)), &term->hints); + XSetWMNormalHints(screen->display, VShellWindow(xw), &xw->hints); } } diff --git a/app/xterm/menu.h b/app/xterm/menu.h index bde9a4979..f894a95eb 100644 --- a/app/xterm/menu.h +++ b/app/xterm/menu.h @@ -1,8 +1,7 @@ -/* $XTermId: menu.h,v 1.119 2010/01/04 22:16:06 tom Exp $ */ +/* $XTermId: menu.h,v 1.122 2011/01/20 09:42:50 tom Exp $ */ /* - * - * Copyright 1999-2009,2010 by Thomas E. Dickey + * Copyright 1999-2010,2011 by Thomas E. Dickey * * All Rights Reserved * @@ -30,6 +29,7 @@ * sale, use or other dealings in this Software without prior written * authorization. * + * * Copyright 1989 The Open Group * * Permission to use, copy, modify, distribute, and sell this software and its @@ -58,6 +58,7 @@ #ifndef included_menu_h #define included_menu_h +/* *INDENT-OFF* */ #include <xterm.h> @@ -98,6 +99,7 @@ extern void HandleFontBoxChars PROTO_XT_ACTIONS_ARGS; extern void HandleFontDoublesize PROTO_XT_ACTIONS_ARGS; extern void HandleFontLoading PROTO_XT_ACTIONS_ARGS; extern void HandleFontPacked PROTO_XT_ACTIONS_ARGS; +extern void HandleFullscreen PROTO_XT_ACTIONS_ARGS; extern void HandleHardReset PROTO_XT_ACTIONS_ARGS; extern void HandleHpFunctionKeys PROTO_XT_ACTIONS_ARGS; extern void HandleJumpscroll PROTO_XT_ACTIONS_ARGS; @@ -109,8 +111,8 @@ extern void HandleNumLock PROTO_XT_ACTIONS_ARGS; extern void HandleOldFunctionKeys PROTO_XT_ACTIONS_ARGS; extern void HandlePopupMenu PROTO_XT_ACTIONS_ARGS; extern void HandlePrintControlMode PROTO_XT_ACTIONS_ARGS; -extern void HandlePrintScreen PROTO_XT_ACTIONS_ARGS; extern void HandlePrintEverything PROTO_XT_ACTIONS_ARGS; +extern void HandlePrintScreen PROTO_XT_ACTIONS_ARGS; extern void HandleQuit PROTO_XT_ACTIONS_ARGS; extern void HandleRedraw PROTO_XT_ACTIONS_ARGS; extern void HandleRenderFont PROTO_XT_ACTIONS_ARGS; @@ -157,6 +159,9 @@ typedef enum { #if OPT_TOOLBAR mainMenu_toolbar, #endif +#if OPT_MAXIMIZE + mainMenu_fullscreen, +#endif mainMenu_securekbd, mainMenu_allowsends, mainMenu_redraw, @@ -297,7 +302,6 @@ typedef enum { fontMenu_LAST } fontMenuIndices; - /* * items in tek4014 mode menu */ @@ -335,6 +339,12 @@ extern void update_toolbar(void); #define update_toolbar() /* nothing */ #endif +#if OPT_MAXIMIZE +extern void update_fullscreen(void); +#else +#define update_fullscreen() /* nothing */ +#endif + extern void update_securekbd(void); extern void update_allowsends(void); @@ -492,4 +502,6 @@ extern void set_tekfont_menu_item(int n,int val); extern void set_menu_font(int val); -#endif /*included_menu_h*/ +/* *INDENT-ON* */ + +#endif /* included_menu_h */ diff --git a/app/xterm/misc.c b/app/xterm/misc.c index ce3c0c1f2..384f27f2f 100644 --- a/app/xterm/misc.c +++ b/app/xterm/misc.c @@ -1,7 +1,7 @@ -/* $XTermId: misc.c,v 1.511 2010/11/10 00:56:29 tom Exp $ */ +/* $XTermId: misc.c,v 1.520 2011/02/13 21:03:21 tom Exp $ */ /* - * Copyright 1999-2009,2010 by Thomas E. Dickey + * Copyright 1999-2010,2011 by Thomas E. Dickey * * All Rights Reserved * @@ -250,17 +250,19 @@ DoSpecialLeaveNotify(XtermWidget xw, XEnterWindowEvent * ev) #endif static void -setXUrgency(TScreen * screen, Bool enable) +setXUrgency(XtermWidget xw, Bool enable) { + TScreen *screen = TScreenOf(xw); + if (screen->bellIsUrgent) { - XWMHints *h = XGetWMHints(screen->display, VShellWindow); + XWMHints *h = XGetWMHints(screen->display, VShellWindow(xw)); if (h != 0) { - if (enable) { + if (enable && !(screen->select & FOCUS)) { h->flags |= XUrgencyHint; } else { h->flags &= ~XUrgencyHint; } - XSetWMHints(screen->display, VShellWindow, h); + XSetWMHints(screen->display, VShellWindow(xw), h); } } } @@ -739,9 +741,9 @@ HandleFocusChange(Widget w GCC_UNUSED, if (screen->quiet_grab && (event->mode == NotifyGrab || event->mode == NotifyUngrab)) { - ; + /* EMPTY */ ; } else if (event->type == FocusIn) { - setXUrgency(screen, False); + setXUrgency(xw, False); /* * NotifyNonlinear only happens (on FocusIn) if the pointer was not in @@ -856,7 +858,7 @@ xtermBell(XtermWidget xw, int which, int percent) #if defined(HAVE_XKB_BELL_EXT) if (tony != None) { - XkbBell(screen->display, VShellWindow, percent, tony); + XkbBell(screen->display, VShellWindow(xw), percent, tony); } else #endif XBell(screen->display, percent); @@ -874,7 +876,7 @@ Bell(XtermWidget xw, int which, int percent) return; } - setXUrgency(screen, True); + setXUrgency(xw, True); /* has enough time gone by that we are allowed to ring the bell again? */ @@ -901,7 +903,7 @@ Bell(XtermWidget xw, int which, int percent) } if (screen->poponbell) - XRaiseWindow(screen->display, VShellWindow); + XRaiseWindow(screen->display, VShellWindow(xw)); if (screen->bellSuppressTime) { /* now we change a property and wait for the notify event to come @@ -972,19 +974,19 @@ HandleBellPropertyChange(Widget w GCC_UNUSED, } Window -WMFrameWindow(XtermWidget termw) +WMFrameWindow(XtermWidget xw) { Window win_root, win_current, *children; Window win_parent = 0; unsigned int nchildren; - win_current = XtWindow(termw); + win_current = XtWindow(xw); /* find the parent which is child of root */ do { if (win_parent) win_current = win_parent; - XQueryTree(TScreenOf(termw)->display, + XQueryTree(TScreenOf(xw)->display, win_current, &win_root, &win_parent, @@ -1196,7 +1198,7 @@ HandleDeIconify(Widget w, if ((xw = getXtermWidget(w)) != 0) { TScreen *screen = TScreenOf(xw); - XMapWindow(screen->display, VShellWindow); + XMapWindow(screen->display, VShellWindow(xw)); } } @@ -1212,15 +1214,15 @@ HandleIconify(Widget w, if ((xw = getXtermWidget(w)) != 0) { TScreen *screen = TScreenOf(xw); XIconifyWindow(screen->display, - VShellWindow, + VShellWindow(xw), DefaultScreen(screen->display)); } } int -QueryMaximize(XtermWidget termw, unsigned *width, unsigned *height) +QueryMaximize(XtermWidget xw, unsigned *width, unsigned *height) { - TScreen *screen = TScreenOf(termw); + TScreen *screen = TScreenOf(xw); XSizeHints hints; long supp = 0; Window root_win; @@ -1230,7 +1232,7 @@ QueryMaximize(XtermWidget termw, unsigned *width, unsigned *height) unsigned root_depth; if (XGetGeometry(screen->display, - RootWindowOfScreen(XtScreen(termw)), + RootWindowOfScreen(XtScreen(xw)), &root_win, &root_x, &root_y, @@ -1250,7 +1252,7 @@ QueryMaximize(XtermWidget termw, unsigned *width, unsigned *height) hints.flags = PMaxSize; if (XGetWMNormalHints(screen->display, - VShellWindow, + VShellWindow(xw), &hints, &supp) && (hints.flags & PMaxSize) != 0) { @@ -1270,9 +1272,9 @@ QueryMaximize(XtermWidget termw, unsigned *width, unsigned *height) } void -RequestMaximize(XtermWidget termw, int maximize) +RequestMaximize(XtermWidget xw, int maximize) { - TScreen *screen = TScreenOf(termw); + TScreen *screen = TScreenOf(xw); XWindowAttributes wm_attrs, vshell_attrs; unsigned root_width, root_height; @@ -1280,14 +1282,14 @@ RequestMaximize(XtermWidget termw, int maximize) if (maximize) { - if (QueryMaximize(termw, &root_width, &root_height)) { + if (QueryMaximize(xw, &root_width, &root_height)) { if (XGetWindowAttributes(screen->display, - WMFrameWindow(termw), + WMFrameWindow(xw), &wm_attrs)) { if (XGetWindowAttributes(screen->display, - VShellWindow, + VShellWindow(xw), &vshell_attrs)) { if (screen->restore_data != True @@ -1313,7 +1315,7 @@ RequestMaximize(XtermWidget termw, int maximize) (unsigned) ((wm_attrs.height - vshell_attrs.height) + (wm_attrs.border_width * 2)); - XMoveResizeWindow(screen->display, VShellWindow, + XMoveResizeWindow(screen->display, VShellWindow(xw), 0 + wm_attrs.border_width, /* x */ 0 + wm_attrs.border_width, /* y */ root_width, @@ -1331,7 +1333,7 @@ RequestMaximize(XtermWidget termw, int maximize) screen->restore_data = False; XMoveResizeWindow(screen->display, - VShellWindow, + VShellWindow(xw), screen->restore_x, screen->restore_y, screen->restore_width, @@ -1440,7 +1442,7 @@ open_userfile(uid_t uid, gid_t gid, char *path, Bool append) if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644)) < 0) { int the_error = errno; fprintf(stderr, "%s: cannot open %s: %d:%s\n", - xterm_name, + ProgramName, path, the_error, SysErrorMsg(the_error)); @@ -1453,7 +1455,7 @@ open_userfile(uid_t uid, gid_t gid, char *path, Bool append) || ((fd = open(path, O_WRONLY | O_APPEND)) < 0)) { int the_error = errno; fprintf(stderr, "%s: cannot open %s: %d:%s\n", - xterm_name, + ProgramName, path, the_error, SysErrorMsg(the_error)); @@ -1468,7 +1470,7 @@ open_userfile(uid_t uid, gid_t gid, char *path, Bool append) if (fstat(fd, &sb) < 0 || sb.st_uid != uid || (sb.st_mode & 022) != 0) { - fprintf(stderr, "%s: you do not own %s\n", xterm_name, path); + fprintf(stderr, "%s: you do not own %s\n", ProgramName, path); close(fd); return -1; } @@ -1722,7 +1724,8 @@ StartLog(XtermWidget xw) execl(shell, shell, "-c", &screen->logfile[1], (void *) 0); - fprintf(stderr, "%s: Can't exec `%s'\n", xterm_name, + fprintf(stderr, "%s: Can't exec `%s'\n", + ProgramName, &screen->logfile[1]); exit(ERROR_LOGEXEC); } @@ -1992,7 +1995,7 @@ xtermGetColorRes(XtermWidget xw, ColorRes * res) res->mode = -True; fprintf(stderr, "%s: Cannot allocate color \"%s\"\n", - xterm_name, + ProgramName, NonNull(res->resource)); } result = res->value; @@ -2309,7 +2312,7 @@ GetOldColors(XtermWidget xw) { int i; if (pOldColors == NULL) { - pOldColors = (ScrnColors *) XtMalloc((Cardinal) sizeof(ScrnColors)); + pOldColors = TypeXtMalloc(ScrnColors); if (pOldColors == NULL) { fprintf(stderr, "allocation failure in GetOldColors\n"); return (False); @@ -2673,7 +2676,9 @@ ChangeFontRequest(XtermWidget xw, String buf) } #if OPT_RENDERFONT if (UsingRenderFont(xw)) { - ; /* there is only one font entry to load */ + /* EMPTY */ + /* there is only one font entry to load */ + ; } else #endif { @@ -3172,7 +3177,7 @@ parse_ansi_params(ANSI * params, const char **string) if (++nparam < NPARAM) params->a_nparam = nparam; } else if (ch < 32) { - ; + /* EMPTY */ ; } else { /* should be 0x30 to 0x7e */ params->a_final = ch; @@ -3342,7 +3347,7 @@ do_dcs(XtermWidget xw, Char * dcsbuf, size_t dcslen) } else #endif if (code == XK_TCAPNAME) { - unparseputs(xw, xterm_name); + unparseputs(xw, resource.term_name); } else { XKeyEvent event; event.state = state; @@ -3826,14 +3831,14 @@ ChangeGroup(XtermWidget xw, const char *attribute, char *value) if (IsSetUtf8Title(xw)) { TRACE(("...updating %s\n", propname)); TRACE(("...value is %s\n", value)); - XChangeProperty(dpy, VShellWindow, my_atom, + XChangeProperty(dpy, VShellWindow(xw), my_atom, XA_UTF8_STRING(dpy), 8, PropModeReplace, (Char *) value, (int) strlen(value)); } else { TRACE(("...deleting %s\n", propname)); - XDeleteProperty(dpy, VShellWindow, my_atom); + XDeleteProperty(dpy, VShellWindow(xw), my_atom); } } } @@ -3985,7 +3990,7 @@ Panic(const char *s GCC_UNUSED, int a GCC_UNUSED) { #ifdef DEBUG if (debug) { - fprintf(stderr, "%s: PANIC!\t", xterm_name); + fprintf(stderr, "%s: PANIC!\t", ProgramName); fprintf(stderr, s, a); fputs("\r\n", stderr); fflush(stderr); @@ -4068,7 +4073,7 @@ SysError(int code) { int oerrno = errno; - fprintf(stderr, "%s: Error %d, errno %d: ", xterm_name, code, oerrno); + fprintf(stderr, "%s: Error %d, errno %d: ", ProgramName, code, oerrno); fprintf(stderr, "%s\n", SysErrorMsg(oerrno)); fprintf(stderr, "Reason: %s\n", SysReasonMsg(code)); @@ -4255,7 +4260,7 @@ xtermSetenv(const char *var, const char *value) int xerror(Display * d, XErrorEvent * ev) { - fprintf(stderr, "%s: warning, error event received:\n", xterm_name); + fprintf(stderr, "%s: warning, error event received:\n", ProgramName); (void) XmuPrintDefaultErrorMessage(d, ev, stderr); Exit(ERROR_XERROR); return 0; /* appease the compiler */ @@ -4269,7 +4274,7 @@ xioerror(Display * dpy) (void) fprintf(stderr, "%s: fatal IO error %d (%s) or KillClient on X server \"%s\"\r\n", - xterm_name, the_error, SysErrorMsg(the_error), + ProgramName, the_error, SysErrorMsg(the_error), DisplayString(dpy)); Exit(ERROR_XIOERROR); @@ -4316,16 +4321,17 @@ withdraw_window(Display * dpy, Window w, int scr) void set_vt_visibility(Bool on) { - TScreen *screen = TScreenOf(term); + XtermWidget xw = term; + TScreen *screen = TScreenOf(xw); TRACE(("set_vt_visibility(%d)\n", on)); if (on) { - if (!screen->Vshow && term) { - VTInit(term); - XtMapWidget(XtParent(term)); + if (!screen->Vshow && xw) { + VTInit(xw); + XtMapWidget(XtParent(xw)); #if OPT_TOOLBAR /* we need both of these during initialization */ - XtMapWidget(SHELL_OF(term)); + XtMapWidget(SHELL_OF(xw)); ShowToolbar(resource.toolBar); #endif screen->Vshow = True; @@ -4333,10 +4339,10 @@ set_vt_visibility(Bool on) } #if OPT_TEK4014 else { - if (screen->Vshow && term) { - withdraw_window(XtDisplay(term), - VShellWindow, - XScreenNumberOfScreen(XtScreen(term))); + if (screen->Vshow && xw) { + withdraw_window(XtDisplay(xw), + VShellWindow(xw), + XScreenNumberOfScreen(XtScreen(xw))); screen->Vshow = False; } } @@ -4547,6 +4553,7 @@ sortedOpts(OptionHelp * options, XrmOptionDescRec * descs, Cardinal numDescs) #if OPT_TRACE for (j = 0; j < opt_count; j++) { if (!strncmp(opt_array[j].opt, "-/+", 3)) { + char temp[80]; const char *name = opt_array[j].opt + 3; for (k = 0; k < numDescs; ++k) { const char *value = res_array[k].value; @@ -4557,7 +4564,8 @@ sortedOpts(OptionHelp * options, XrmOptionDescRec * descs, Cardinal numDescs) } else { code = 0; } - if (x_strindex(opt_array[j].desc, "inhibit") != 0) + strcpy(temp, opt_array[j].desc); + if (x_strindex(temp, "inhibit") != 0) code = -code; if (code != 0 && res_array[k].value != 0 diff --git a/app/xterm/os2main.c b/app/xterm/os2main.c index d560e8c90..4382d49d2 100644 --- a/app/xterm/os2main.c +++ b/app/xterm/os2main.c @@ -1,4 +1,4 @@ -/* $XTermId: os2main.c,v 1.265 2010/06/20 21:27:07 tom Exp $ */ +/* $XTermId: os2main.c,v 1.268 2011/02/14 10:01:09 tom Exp $ */ /* removed all foreign stuff to get the code more clear (hv) * and did some rewrite for the obscure OS/2 environment @@ -262,7 +262,6 @@ static jmp_buf env; static XtResource application_resources[] = { - Sres("name", "Name", xterm_name, DFT_TERMTYPE), Sres("iconGeometry", "IconGeometry", icon_geometry, NULL), Sres(XtNtitle, XtCTitle, title, NULL), Sres(XtNiconName, XtCIconName, icon_name, NULL), @@ -274,7 +273,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("menuLocale", "MenuLocale", menuLocale, DEF_MENU_LOCALE), Sres("keyboardType", "KeyboardType", keyboardType, "unknown"), #if OPT_SUNPC_KBD Bres("sunKeyboard", "SunKeyboard", sunKeyboard, False), @@ -728,7 +727,7 @@ decode_keyvalue(char **ptr, int termcap) char *string = *ptr; int value = -1; - TRACE(("...decode '%s'\n", string)); + TRACE(("decode_keyvalue '%s'\n", string)); if (*string == '^') { switch (*++string) { case '?': @@ -742,7 +741,7 @@ decode_keyvalue(char **ptr, int termcap) #endif #if defined(_PC_VDISABLE) if (value == -1) { - value = fpathconf(0, _PC_VDISABLE); + value = (int) fpathconf(0, _PC_VDISABLE); if (value == -1) { if (errno != 0) break; /* skip this (error) */ @@ -763,7 +762,7 @@ decode_keyvalue(char **ptr, int termcap) ++string; } else if (termcap && (*string == '\\')) { char *d; - int temp = strtol(string + 1, &d, 8); + int temp = (int) strtol(string + 1, &d, 8); if (temp > 0 && d != string) { value = temp; string = d; @@ -773,6 +772,7 @@ decode_keyvalue(char **ptr, int termcap) ++string; } *ptr = string; + TRACE(("...decode_keyvalue %#x\n", value)); return value; } @@ -956,7 +956,7 @@ main(int argc, char **argv ENVP_ARG) TRACE_ARGV("Before XtOpenApplication", argv); if (argc > 1) { int n; - unsigned unique = 2; + size_t unique = 2; Bool quit = True; for (n = 1; n < argc; n++) { @@ -965,7 +965,7 @@ main(int argc, char **argv ENVP_ARG) Version(); } else if (abbrev(argv[n], "-help", unique)) { Help(); - } else if (abbrev(argv[n], "-class", 3)) { + } else if (abbrev(argv[n], "-class", (size_t) 3)) { if ((my_class = argv[++n]) == 0) { Help(); } else { @@ -973,14 +973,6 @@ 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; } @@ -1076,9 +1068,6 @@ main(int argc, char **argv ENVP_ARG) } #endif /* OPT_ZICONBEEP */ hold_screen = resource.hold_screen ? 1 : 0; - xterm_name = resource.xterm_name; - if (strcmp(xterm_name, "-") == 0) - xterm_name = DFT_TERMTYPE; if (resource.icon_geometry != NULL) { int scr, junk; int ix, iy; @@ -1259,10 +1248,10 @@ main(int argc, char **argv ENVP_ARG) int n; char **c; for (n = 0, c = command_to_exec; *c; n++, c++) ; - c = TypeMallocN(char *, n + 3 + u); + c = TypeMallocN(char *, (unsigned) (n + 3 + u)); if (c == NULL) SysError(ERROR_LUMALLOC); - memcpy(c + 2 + u, command_to_exec, (n + 1) * sizeof(char *)); + memcpy(c + 2 + u, command_to_exec, (unsigned) (n + 1) * sizeof(char *)); c[0] = term->misc.localefilter; if (u) { c[1] = "-encoding"; @@ -1365,18 +1354,26 @@ main(int argc, char **argv ENVP_ARG) winToEmbedInto, 0, 0); } #if OPT_COLOR_RES - TRACE(("checking resource values rv %s fg %s, bg %s\n", - BtoS(term->misc.re_verse0), + TRACE(("checking reverseVideo before rv %s fg %s, bg %s\n", + term->misc.re_verse0 ? "reverse" : "normal", NonNull(TScreenOf(term)->Tcolors[TEXT_FG].resource), NonNull(TScreenOf(term)->Tcolors[TEXT_BG].resource))); - if ((reversed && term->misc.re_verse0) - && ((TScreenOf(term)->Tcolors[TEXT_FG].resource - && !isDefaultForeground(TScreenOf(term)->Tcolors[TEXT_FG].resource)) - || (TScreenOf(term)->Tcolors[TEXT_BG].resource - && !isDefaultBackground(TScreenOf(term)->Tcolors[TEXT_BG].resource)) - )) - ReverseVideo(term); + if (term->misc.re_verse0) { + if (isDefaultForeground(TScreenOf(term)->Tcolors[TEXT_FG].resource) + && isDefaultBackground(TScreenOf(term)->Tcolors[TEXT_BG].resource)) { + TScreenOf(term)->Tcolors[TEXT_FG].resource = x_strdup(XtDefaultBackground); + TScreenOf(term)->Tcolors[TEXT_BG].resource = x_strdup(XtDefaultForeground); + } else { + ReverseVideo(term); + } + term->misc.re_verse = True; + update_reversevideo(); + TRACE(("updated reverseVideo after rv %s fg %s, bg %s\n", + term->misc.re_verse ? "reverse" : "normal", + NonNull(TScreenOf(term)->Tcolors[TEXT_FG].resource), + NonNull(TScreenOf(term)->Tcolors[TEXT_BG].resource))); + } #endif /* OPT_COLOR_RES */ #if OPT_MAXIMIZE @@ -1688,22 +1685,30 @@ spawnXTerm(XtermWidget xw) * entry is not found. */ ok_termcap = True; - if (!get_termcap(TermName = resource.term_name)) { - char *last = NULL; - TermName = *envnew; + if (!get_termcap(xw, TermName = resource.term_name)) { + const char *last = NULL; + char *next; + + TermName = x_strdup(*envnew); ok_termcap = False; while (*envnew != NULL) { - if ((last == NULL || strcmp(last, *envnew)) - && get_termcap(*envnew)) { - TermName = *envnew; - ok_termcap = True; - break; + if (last == NULL || strcmp(last, *envnew)) { + next = x_strdup(*envnew); + if (get_termcap(xw, next)) { + free(TermName); + TermName = next; + ok_termcap = True; + break; + } else { + free(next); + } } last = *envnew; envnew++; } } if (ok_termcap) { + resource.term_name = TermName; resize_termcap(xw); } @@ -1810,8 +1815,8 @@ spawnXTerm(XtermWidget xw) xtermCopyEnv(gblenvp); - xtermSetenv("TERM", TermName); - if (!TermName) + xtermSetenv("TERM", resource.term_name); + if (!resource.term_name) *get_tcap_buffer(xw) = 0; sprintf(buf, "%lu", @@ -1831,7 +1836,7 @@ spawnXTerm(XtermWidget xw) /* dup the tty */ for (i = 0; i <= 2; i++) if (i != ttyfd) { - (void) close(i); + IGNORE_RC(close(i)); IGNORE_RC(dup(ttyfd)); } @@ -1847,10 +1852,10 @@ spawnXTerm(XtermWidget xw) handshake.rows, handshake.cols)); set_max_row(screen, handshake.rows); set_max_col(screen, handshake.cols); - TTYSIZE_ROWS(ts) = MaxRows(screen); - TTYSIZE_COLS(ts) = MaxCols(screen); - ts.ws_xpixel = FullWidth(screen); - ts.ws_ypixel = FullHeight(screen); + TTYSIZE_ROWS(ts) = (ttySize_t) MaxRows(screen); + TTYSIZE_COLS(ts) = (ttySize_t) MaxCols(screen); + ts.ws_xpixel = (ttySize_t) FullWidth(screen); + ts.ws_ypixel = (ttySize_t) FullHeight(screen); } sprintf(numbuf, "%d", MaxCols(screen)); @@ -2018,7 +2023,7 @@ Exit(int n) #endif TRACE(("closed display\n")); } - TRACE((0)); + TRACE_CLOSE(); } #endif @@ -2091,7 +2096,7 @@ parse_tty_modes(char *s, struct _xttymodes *modelist) int count = 0; TRACE(("parse_tty_modes\n")); - while (1) { + for (;;) { size_t len; while (*s && isascii(CharOf(*s)) && isspace(CharOf(*s))) diff --git a/app/xterm/package/debian/changelog b/app/xterm/package/debian/changelog index 50586396e..ec8ec16b6 100644 --- a/app/xterm/package/debian/changelog +++ b/app/xterm/package/debian/changelog @@ -1,3 +1,15 @@ +xterm-dev (269) unstable; urgency=low + + * amend translations for fullscreen toggle. + + -- Thomas E. Dickey <dickey@invisible-island.net> Sun, 13 Feb 2011 19:20:48 -0500 + +xterm-dev (268) unstable; urgency=low + + * build-fixes, etc. + + -- Thomas E. Dickey <dickey@invisible-island.net> Wed, 24 Nov 2010 06:17:16 -0500 + xterm-dev (267) unstable; urgency=low * build-fixes, etc. diff --git a/app/xterm/package/debian/copyright b/app/xterm/package/debian/copyright index fef8e131b..8a1304af4 100644 --- a/app/xterm/package/debian/copyright +++ b/app/xterm/package/debian/copyright @@ -35,7 +35,7 @@ authorization. Files: * */* License: MIT-X11 -Copyright 1996-2010 by Thomas E. Dickey +Copyright 1996-2011 by Thomas E. Dickey (date ranges vary, depending on when the respective files were first changed significantly, and run through the most recent change date). diff --git a/app/xterm/package/xterm.spec b/app/xterm/package/xterm.spec index 6f3fc3477..151ea9cb5 100644 --- a/app/xterm/package/xterm.spec +++ b/app/xterm/package/xterm.spec @@ -1,8 +1,8 @@ -# $XTermId: xterm.spec,v 1.6 2010/11/10 23:45:54 tom Exp $ +# $XTermId: xterm.spec,v 1.8 2011/02/14 00:19:58 tom Exp $ Summary: A text-based Web browser Name: xterm Version: dev -Release: 267 +Release: 269 License: X11 Group: Applications/Internet Source: xterm-%{release}.tgz diff --git a/app/xterm/plink.sh b/app/xterm/plink.sh index 5fa63c1bb..c3c991b10 100644 --- a/app/xterm/plink.sh +++ b/app/xterm/plink.sh @@ -1,9 +1,9 @@ #!/bin/sh -# $XTermId: plink.sh,v 1.6 2010/06/15 22:32:19 tom Exp $ +# $XTermId: plink.sh,v 1.7 2010/11/28 23:55:35 tom Exp $ # ----------------------------------------------------------------------------- # this file is part of xterm # -# Copyright 2001,2005 by Thomas E. Dickey +# Copyright 2001-2005,2010 by Thomas E. Dickey # # All Rights Reserved # diff --git a/app/xterm/print.c b/app/xterm/print.c index dc6e6e184..99b17f219 100644 --- a/app/xterm/print.c +++ b/app/xterm/print.c @@ -1,8 +1,8 @@ -/* $XTermId: print.c,v 1.119 2010/06/13 17:46:27 tom Exp $ */ +/* $XTermId: print.c,v 1.121 2011/02/09 10:11:44 tom Exp $ */ /************************************************************ -Copyright 1997-2009,2010 by Thomas E. Dickey +Copyright 1997-2010,2011 by Thomas E. Dickey All Rights Reserved @@ -135,7 +135,6 @@ printLine(XtermWidget xw, int row, unsigned chr, PrinterFlags * p) int last = MaxCols(screen); int col; #if OPT_ISO_COLORS && OPT_PRINT_COLORS - CellColor *fb = 0; #define ColorOf(ld,col) (ld->color[col]) #endif unsigned fg = NO_COLOR, last_fg = NO_COLOR; @@ -151,9 +150,6 @@ printLine(XtermWidget xw, int row, unsigned chr, PrinterFlags * p) row, ROW2INX(screen, row), screen->topline, screen->max_row, chr, visibleIChars(ld->charData, (unsigned) last))); - if_OPT_ISO_COLORS(screen, { - fb = ld->color; - }); while (last > 0) { if ((ld->attribs[last - 1] & CHARDRAWN) == 0) last--; @@ -675,7 +671,7 @@ getPrinterFlags(XtermWidget xw, String * params, Cardinal *param_count) TRACE(("param%d:%s\n", j, params[j])); for (k = 0; k < XtNumber(table); ++k) { if (!x_strcasecmp(params[j], table[k].name)) { - int *ptr = (int *) ((char *) result + table[k].offset); + int *ptr = (int *) (void *) ((char *) result + table[k].offset); TRACE(("...PrinterFlags(%s) %d->%d\n", table[k].name, *ptr, diff --git a/app/xterm/ptydata.c b/app/xterm/ptydata.c index 781cce9cc..9e261208b 100644 --- a/app/xterm/ptydata.c +++ b/app/xterm/ptydata.c @@ -1,8 +1,8 @@ -/* $XTermId: ptydata.c,v 1.98 2010/06/20 21:41:15 tom Exp $ */ +/* $XTermId: ptydata.c,v 1.100 2011/02/02 01:45:14 tom Exp $ */ /************************************************************ -Copyright 1999-2009,2010 by Thomas E. Dickey +Copyright 1999-2010,2011 by Thomas E. Dickey All Rights Reserved @@ -75,7 +75,7 @@ decodeUtf8(PtyData * data) /* We received an ASCII character */ if (utf_count > 0) { data->utf_data = UCS_REPL; /* prev. sequence incomplete */ - data->utf_size = (i + 1); + data->utf_size = i; } else { data->utf_data = (IChar) c; data->utf_size = 1; @@ -138,8 +138,9 @@ decodeUtf8(PtyData * data) if (c < 0xe0) { utf_count = 1; utf_char = (c & 0x1f); - if (!(c & 0x1e)) + if (!(c & 0x1e)) { utf_char = UCS_REPL; /* overlong sequence */ + } } else if (c < 0xf0) { utf_count = 2; utf_char = (c & 0x0f); @@ -323,8 +324,7 @@ initPtyData(PtyData ** result) TRACE(("initPtyData using minBufSize %d, maxBufSize %d\n", FRG_SIZE, BUF_SIZE)); - data = (PtyData *) XtMalloc((Cardinal) (sizeof(*data) - + (unsigned) (BUF_SIZE + FRG_SIZE))); + data = TypeXtMallocX(PtyData, (BUF_SIZE + FRG_SIZE)); memset(data, 0, sizeof(*data)); data->next = data->buffer; diff --git a/app/xterm/ptyx.h b/app/xterm/ptyx.h index d59caa106..70b8304af 100644 --- a/app/xterm/ptyx.h +++ b/app/xterm/ptyx.h @@ -1,7 +1,7 @@ -/* $XTermId: ptyx.h,v 1.675 2010/10/11 08:25:53 tom Exp $ */ +/* $XTermId: ptyx.h,v 1.684 2011/02/17 00:13:06 tom Exp $ */ /* - * Copyright 1999-2009,2010 by Thomas E. Dickey + * Copyright 1999-2010,2011 by Thomas E. Dickey * * All Rights Reserved * @@ -60,6 +60,7 @@ #endif /* ptyx.h */ +/* *INDENT-OFF* */ /* @(#)ptyx.h X10/6.6 11/10/86 */ #include <X11/IntrinsicP.h> @@ -91,6 +92,12 @@ #define TypeRealloc(type,n,p) (type *)realloc(p, (n) * sizeof(type)) +#define TypeXtReallocN(t,p,n) (t *)(void *)XtRealloc((char *)(p), (Cardinal)(sizeof(t) * (size_t) (n))) + +#define TypeXtMallocX(type,n) (type *)(void *)XtMalloc((Cardinal)(sizeof(type) + (size_t) (n))) +#define TypeXtMallocN(type,n) (type *)(void *)XtMalloc((Cardinal)(sizeof(type) * (size_t) (n))) +#define TypeXtMalloc(type) TypeXtMallocN(type, 1) + /* use these to allocate partly-structured data */ #define CastMallocN(type,n) (type *)malloc(sizeof(type) + (size_t) (n)) #define CastMalloc(type) CastMallocN(type,0) @@ -886,6 +893,13 @@ typedef enum { } FontOps; typedef enum { + esFalse = 0 + , esTrue + , esAlways + , esNever +} FullscreenOps; + +typedef enum { etSetTcap = 1 , etGetTcap , etLAST @@ -903,6 +917,7 @@ typedef enum { , ewSetWinSizeChars = 8 #if OPT_MAXIMIZE , ewMaximizeWin = 9 + , ewFullscreenWin = 10 #endif , ewGetWinState = 11 , ewGetWinPosition = 13 @@ -1653,6 +1668,9 @@ typedef struct { Boolean awaitInput; /* select-timeout mode */ Boolean grabbedKbd; /* keyboard is grabbed */ +#if OPT_MAXIMIZE + Boolean fullscreen; /* window is fullscreen */ +#endif #ifdef ALLOWLOGGING int logging; /* logging mode */ int logfd; /* file descriptor of log */ @@ -2034,6 +2052,11 @@ typedef struct _TekScreen { #define MULTICLICKTIME 250 /* milliseconds */ +typedef struct { + const char *name; + int code; +} FlagList; + typedef enum { fwNever = 0, fwResource, @@ -2458,7 +2481,7 @@ typedef struct _TekWidgetRec { * These definitions do not depend on whether xterm supports active-icon. */ #define VWindow(screen) WhichVWin(screen)->window -#define VShellWindow XtWindow(SHELL_OF(term)) +#define VShellWindow(xw) XtWindow(SHELL_OF(xw)) #define TWindow(screen) WhichTWin(screen)->window #define TShellWindow XtWindow(SHELL_OF(tekWidget)) @@ -2511,8 +2534,8 @@ typedef struct _TekWidgetRec { #if OPT_TOOLBAR #define ToolbarHeight(w) ((resource.toolBar) \ - ? (term->VT100_TB_INFO(menu_height) \ - + term->VT100_TB_INFO(menu_border) * 2) \ + ? ((w)->VT100_TB_INFO(menu_height) \ + + (w)->VT100_TB_INFO(menu_border) * 2) \ : 0) #else #define ToolbarHeight(w) 0 @@ -2606,4 +2629,6 @@ typedef struct Tek_Link #define TRACE2(p) /*nothing*/ #endif +/* *INDENT-ON* */ + #endif /* included_ptyx_h */ diff --git a/app/xterm/screen.c b/app/xterm/screen.c index 952a584bc..14ae746d1 100644 --- a/app/xterm/screen.c +++ b/app/xterm/screen.c @@ -1,7 +1,7 @@ -/* $XTermId: screen.c,v 1.426 2010/10/11 00:46:05 tom Exp $ */ +/* $XTermId: screen.c,v 1.436 2011/02/20 00:48:23 tom Exp $ */ /* - * Copyright 1999-2009,2010 by Thomas E. Dickey + * Copyright 1999-2010,2011 by Thomas E. Dickey * * All Rights Reserved * @@ -61,11 +61,14 @@ #include <xcharmouse.h> #include <xterm_io.h> +#include <X11/Xatom.h> + #if OPT_WIDE_CHARS #include <fontutils.h> -#include <menu.h> #endif +#include <menu.h> + #include <assert.h> #include <signal.h> @@ -119,12 +122,12 @@ value = (value | (unsigned) AlignMask()) + 1 #define SetupScrnPtr(dst,src,type) \ - dst = (type *) src; \ + dst = (type *) (void *) src; \ assert(IsAligned(dst)); \ src += skipNcol##type -#define ScrnBufAddr(ptrs, offset) (ScrnBuf) ((char *) (ptrs) + (offset)) -#define LineDataAddr(ptrs, offset) (LineData *) ((char *) (ptrs) + (offset)) +#define ScrnBufAddr(ptrs, offset) (ScrnBuf) ((void *) ((char *) (ptrs) + (offset))) +#define LineDataAddr(ptrs, offset) (LineData *) ((void *) ((char *) (ptrs) + (offset))) #if OPT_TRACE > 1 static void @@ -580,6 +583,43 @@ ReallocateBufOffsets(XtermWidget xw, TRACE(("ReallocateBufOffsets %dx%d ->%p\n", nrow, ncol, *sbufaddr)); } +#if OPT_FIFO_LINES +/* + * Allocate a new FIFO index. + */ +static void +ReallocateFifoIndex(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + + if (screen->savelines > 0 && screen->saveBuf_index != 0) { + ScrnBuf newBufHead; + LineData *dstPtrs; + LineData *srcPtrs; + unsigned i; + unsigned old_jump = scrnHeadSize(screen, 1); + unsigned new_jump; + + screen->wide_chars = True; + newBufHead = allocScrnHead(screen, (unsigned) screen->savelines); + new_jump = scrnHeadSize(screen, 1); + + srcPtrs = (LineData *) screen->saveBuf_index; + dstPtrs = (LineData *) newBufHead; + + for (i = 0; i < (unsigned) screen->savelines; ++i) { + memcpy(dstPtrs, srcPtrs, SizeOfLineData); + srcPtrs = LineDataAddr(srcPtrs, old_jump); + dstPtrs = LineDataAddr(dstPtrs, new_jump); + } + + screen->wide_chars = False; + free(screen->saveBuf_index); + screen->saveBuf_index = newBufHead; + } +} +#endif + /* * This function dynamically adds support for wide-characters. */ @@ -611,7 +651,9 @@ ChangeToWide(XtermWidget xw) SwitchBufPtrs(screen, 0); #if OPT_SAVE_LINES -#if !OPT_FIFO_LINES +#if OPT_FIFO_LINES + ReallocateFifoIndex(xw); +#else ReallocateBufOffsets(xw, &screen->saveBuf_index, &screen->saveBuf_data, @@ -1254,7 +1296,7 @@ void ShowWrapMarks(XtermWidget xw, int row, LineData * ld) { TScreen *screen = TScreenOf(xw); - Boolean set = LineTstWrapped(ld); + Boolean set = (Boolean) LineTstWrapped(ld); CgsEnum cgsId = set ? gcVTcursFilled : gcVTcursReverse; VTwin *currentWin = WhichVWin(screen); int y = row * FontHeight(screen) + screen->border; @@ -2339,6 +2381,7 @@ ScrnCopyRectangle(XtermWidget xw, XTermRect * source, int nparam, int *params) (j * wide) + k, ld, col); } else { + /* EMPTY */ /* FIXME - clear the target cell? */ } ld->attribs[col] |= CHARDRAWN; @@ -2532,3 +2575,182 @@ ScrnWipeRectangle(XtermWidget xw, } } #endif /* OPT_DEC_RECTOPS */ + +#if OPT_MAXIMIZE + +static void +set_resize_increments(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + int min_width = (2 * screen->border) + screen->fullVwin.sb_info.width; + int min_height = (2 * screen->border); + XSizeHints sizehints; + + memset(&sizehints, 0, sizeof(XSizeHints)); + sizehints.width_inc = FontWidth(screen); + sizehints.height_inc = FontHeight(screen); + sizehints.flags = PResizeInc; + XSetWMNormalHints(screen->display, VShellWindow(xw), &sizehints); + + XtVaSetValues(SHELL_OF(xw), + XtNbaseWidth, min_width, + XtNbaseHeight, min_height, + XtNminWidth, min_width + FontWidth(screen), + XtNminHeight, min_height + FontHeight(screen), + XtNwidthInc, FontWidth(screen), + XtNheightInc, FontHeight(screen), + (XtPointer) 0); + + XFlush(XtDisplay(xw)); +} + +static void +unset_resize_increments(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + XSizeHints sizehints; + + memset(&sizehints, 0, sizeof(XSizeHints)); + sizehints.width_inc = 1; + sizehints.height_inc = 1; + sizehints.flags = PResizeInc; + XSetWMNormalHints(screen->display, VShellWindow(xw), &sizehints); + + XtVaSetValues(SHELL_OF(xw), + XtNwidthInc, 1, + XtNheightInc, 1, + (XtPointer) 0); + + XFlush(XtDisplay(xw)); +} + +static void +netwm_fullscreen(XtermWidget xw, int operation) +{ + TScreen *screen = TScreenOf(xw); + XEvent e; + Display *dpy = screen->display; + Window window = VShellWindow(xw); + Atom atom_fullscreen = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False); + Atom atom_state = XInternAtom(dpy, "_NET_WM_STATE", False); + + memset(&e, 0, sizeof(e)); + e.xclient.type = ClientMessage; + e.xclient.message_type = atom_state; + e.xclient.display = dpy; + e.xclient.window = window; + e.xclient.format = 32; + e.xclient.data.l[0] = operation; + e.xclient.data.l[1] = (long) atom_fullscreen; + + XSendEvent(dpy, DefaultRootWindow(dpy), False, + SubstructureRedirectMask, &e); +} + +/* + * Check if the "fullscreen" property is supported on the root window. + * The XGetWindowProperty function returns a list of Atom's which corresponds + * to the output of xprop. The actual list (ignore the manpage, which refers + * to an array of 32-bit values) is constructed by _XRead32, which uses long + * as a datatype. + * + * Alternatively, we could check _NET_WM_ALLOWED_ACTIONS on the application's + * window. + */ +static Boolean +probe_netwm_fullscreen_capability(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + Display *dpy = screen->display; + Atom atom_fullscreen = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False); + Atom atom_supported = XInternAtom(dpy, "_NET_SUPPORTED", False); + Atom actual_type; + int actual_format; + long long_offset = 0; + long long_length = 128; /* number of items to ask for at a time */ + unsigned int i; + unsigned long nitems, bytes_after; + unsigned char *args; + long *ldata; + Boolean netwm_fullscreen_capability = False; + int rc; + + while (!netwm_fullscreen_capability) { + rc = XGetWindowProperty(dpy, + DefaultRootWindow(dpy), + atom_supported, + long_offset, + long_length, + False, /* do not delete */ + AnyPropertyType, /* req_type */ + &actual_type, /* actual_type_return */ + &actual_format, /* actual_format_return */ + &nitems, /* nitems_return */ + &bytes_after, /* bytes_after_return */ + &args /* prop_return */ + ); + if (rc != Success + || actual_type != XA_ATOM) { + break; + } + ldata = (long *) (void *) args; + for (i = 0; i < nitems; i++) { + if ((Atom) ldata[i] == atom_fullscreen) { + netwm_fullscreen_capability = True; + break; + } + } + XFree(ldata); + + if (!netwm_fullscreen_capability) { + if (bytes_after != 0) { + long remaining = (long) (bytes_after / sizeof(long)); + if (long_length > remaining) + long_length = remaining; + long_offset += (long) nitems; + } else { + break; + } + } + } + + return netwm_fullscreen_capability; +} + +/* + * Enable/disable fullscreen mode for the xterm widget, if the window manager + * supports that feature. + */ +void +FullScreen(XtermWidget xw, Bool enabled) +{ + TScreen *screen = TScreenOf(xw); + + static Boolean initialized = False; + static Boolean netwm_fullscreen_capability = False; + + TRACE(("FullScreen %s\n", BtoS(enabled))); + + if (resource.fullscreen == esNever) { + initialized = True; + netwm_fullscreen_capability = False; + } else if (!initialized) { + initialized = True; + netwm_fullscreen_capability = probe_netwm_fullscreen_capability(xw); + } + + if (netwm_fullscreen_capability) { + if (enabled) { + unset_resize_increments(xw); + netwm_fullscreen(xw, 1); + } else { + set_resize_increments(xw); + netwm_fullscreen(xw, 0); + } + screen->fullscreen = (Boolean) enabled; + update_fullscreen(); + } else { + Bell(xw, XkbBI_MinorError, 100); + } +} +#endif /* OPT_MAXIMIZE */ diff --git a/app/xterm/scrollbar.c b/app/xterm/scrollbar.c index 6e861fd31..37bdb36d3 100644 --- a/app/xterm/scrollbar.c +++ b/app/xterm/scrollbar.c @@ -1,7 +1,7 @@ -/* $XTermId: scrollbar.c,v 1.173 2010/06/15 22:47:34 tom Exp $ */ +/* $XTermId: scrollbar.c,v 1.180 2011/02/17 00:50:23 tom Exp $ */ /* - * Copyright 2000-2009,2010 by Thomas E. Dickey + * Copyright 2000-2010,2011 by Thomas E. Dickey * * All Rights Reserved * @@ -174,13 +174,30 @@ DoResizeScreen(XtermWidget xw) /* These are obsolete, but old clients may use them */ xw->hints.width = MaxCols(screen) * FontWidth(screen) + xw->hints.min_width; xw->hints.height = MaxRows(screen) * FontHeight(screen) + xw->hints.min_height; +#if OPT_MAXIMIZE + /* assure single-increment resize for fullscreen */ + if (screen->fullscreen) { + xw->hints.width_inc = 1; + xw->hints.height_inc = 1; + } +#endif /* OPT_MAXIMIZE */ #endif - XSetWMNormalHints(screen->display, XtWindow(SHELL_OF(xw)), &xw->hints); + XSetWMNormalHints(screen->display, VShellWindow(xw), &xw->hints); reqWidth = (Dimension) (MaxCols(screen) * FontWidth(screen) + min_wide); reqHeight = (Dimension) (MaxRows(screen) * FontHeight(screen) + min_high); +#if OPT_MAXIMIZE + /* compensate for fullscreen mode */ + if (screen->fullscreen) { + Screen *xscreen = DefaultScreenOfDisplay(xw->screen.display); + reqWidth = (Dimension) WidthOfScreen(xscreen); + reqHeight = (Dimension) HeightOfScreen(xscreen); + ScreenResize(xw, reqWidth, reqHeight, &xw->flags); + } +#endif /* OPT_MAXIMIZE */ + TRACE(("...requesting screensize chars %dx%d, pixels %dx%d\n", MaxRows(screen), MaxCols(screen), @@ -213,7 +230,7 @@ DoResizeScreen(XtermWidget xw) xw->hints.height = repHeight; xw->hints.width = repWidth; TRACE_HINTS(&xw->hints); - XSetWMNormalHints(screen->display, VShellWindow, &xw->hints); + XSetWMNormalHints(screen->display, VShellWindow(xw), &xw->hints); } #endif XSync(screen->display, False); /* synchronize */ @@ -583,7 +600,7 @@ CompareWidths(const char *a, const char *b, int *modifier) if (!a || !b) return 0; - while (1) { + for (;;) { ca = x_toupper(*a); cb = x_toupper(*b); if (ca != cb || ca == '\0') @@ -900,6 +917,7 @@ SetScrollLock(TScreen * screen, Bool enable) } } +/* ARGSUSED */ void HandleScrollLock(Widget w, XEvent * event GCC_UNUSED, diff --git a/app/xterm/trace.c b/app/xterm/trace.c index 5fb958558..f2ddd8908 100644 --- a/app/xterm/trace.c +++ b/app/xterm/trace.c @@ -1,8 +1,7 @@ -/* $XTermId: trace.c,v 1.115 2010/06/15 22:40:28 tom Exp $ */ +/* $XTermId: trace.c,v 1.121 2011/02/17 00:34:47 tom Exp $ */ /* - * - * Copyright 1997-2009,2010 by Thomas E. Dickey + * Copyright 1997-2010,2011 by Thomas E. Dickey * * All Rights Reserved * @@ -37,6 +36,9 @@ */ #include <xterm.h> /* for definition of GCC_UNUSED */ + +#if OPT_TRACE + #include <data.h> #include <trace.h> @@ -300,7 +302,7 @@ visibleIChar(IChar * buf, unsigned len) return result; } -#define CASETYPE(name) case name: result = #name; break; +#define CASETYPE(name) case name: result = #name; break const char * visibleKeyboardType(xtermKeyboardType type) @@ -566,6 +568,7 @@ TraceWMSizeHints(XtermWidget xw) * Some calls to XGetAtom() will fail, and we don't want to stop. So we use * our own error-handler. */ +/* ARGSUSED */ static int no_error(Display * dpy GCC_UNUSED, XErrorEvent * event GCC_UNUSED) { @@ -627,7 +630,6 @@ TraceXtermResources(void) XTERM_RESOURCE *resp = &resource; Trace("XTERM_RESOURCE settings:\n"); - XRES_S(xterm_name); XRES_S(icon_geometry); XRES_S(title); XRES_S(icon_name); @@ -668,6 +670,13 @@ TraceXtermResources(void) #if OPT_SESSION_MGT XRES_B(sessionMgt); #endif +#if OPT_TOOLBAR + XRES_B(toolBar); +#endif +#if OPT_MAXIMIZE + XRES_B(maximized); + XRES_S(fullscreen_s); +#endif } void @@ -686,7 +695,7 @@ parse_option(char *dst, String src, int first) { char *s; - if (!strncmp(src, "-/+", 3)) { + if (!strncmp(src, "-/+", (size_t) 3)) { dst[0] = (char) first; strcpy(dst + 1, src + 3); } else { @@ -833,3 +842,10 @@ TraceOptions(OptionHelp * options, XrmOptionDescRec * resources, Cardinal res_co } } } +#else +extern void empty_trace(void); +void +empty_trace(void) +{ +} +#endif diff --git a/app/xterm/util.c b/app/xterm/util.c index e16b168c0..328880476 100644 --- a/app/xterm/util.c +++ b/app/xterm/util.c @@ -1,7 +1,7 @@ -/* $XTermId: util.c,v 1.541 2010/10/11 00:32:28 tom Exp $ */ +/* $XTermId: util.c,v 1.545 2011/02/17 00:28:45 tom Exp $ */ /* - * Copyright 1999-2009,2010 by Thomas E. Dickey + * Copyright 1999-2010,2011 by Thomas E. Dickey * * All Rights Reserved * @@ -1250,7 +1250,7 @@ ClearInLine2(XtermWidget xw, int flags, int row, int col, unsigned len) } while (!done); screen->protected_mode = saved_mode; - if (len <= 0) { + if ((int) len <= 0) { return 0; } } @@ -1518,7 +1518,7 @@ CopyWait(XtermWidget xw) XEvent reply; XEvent *rep = &reply; - while (1) { + for (;;) { XWindowEvent(screen->display, VWindow(screen), ExposureMask, &reply); switch (reply.type) { @@ -1722,7 +1722,7 @@ set_background(XtermWidget xw, int color GCC_UNUSED) Pixel c = getXtermBackground(xw, xw->flags, color); TRACE(("set_background(%d) %#lx\n", color, c)); - XSetWindowBackground(screen->display, VShellWindow, c); + XSetWindowBackground(screen->display, VShellWindow(xw), c); XSetWindowBackground(screen->display, VWindow(screen), c); } @@ -3403,7 +3403,7 @@ getXtermSizeHints(XtermWidget xw) TScreen *screen = TScreenOf(xw); long supp; - if (!XGetWMNormalHints(screen->display, XtWindow(SHELL_OF(xw)), + if (!XGetWMNormalHints(screen->display, VShellWindow(xw), &xw->hints, &supp)) memset(&xw->hints, 0, sizeof(xw->hints)); TRACE_HINTS(&(xw->hints)); @@ -3969,3 +3969,45 @@ decode_wcwidth(XtermWidget xw) } } #endif + +/* + * Extend a (normally) boolean resource value by checking for additional values + * which will be mapped into true/false. + */ +int +extendedBoolean(const char *value, FlagList * table, Cardinal limit) +{ + int result = -1; + long check; + char *next; + Cardinal n; + + if ((x_strcasecmp(value, "true") == 0) + || (x_strcasecmp(value, "yes") == 0) + || (x_strcasecmp(value, "on") == 0)) { + result = True; + } else if ((x_strcasecmp(value, "false") == 0) + || (x_strcasecmp(value, "no") == 0) + || (x_strcasecmp(value, "off") == 0)) { + result = False; + } else if ((check = strtol(value, &next, 0)) >= 0 && *next == '\0') { + if (check >= (long) limit) + check = True; + result = (int) check; + } else { + for (n = 0; n < limit; ++n) { + if (x_strcasecmp(value, table[n].name) == 0) { + result = table[n].code; + break; + } + } + } + + if (result < 0) { + fprintf(stderr, "Unrecognized keyword: %s\n", value); + result = False; + } + + TRACE(("extendedBoolean(%s) = %d\n", value, result)); + return result; +} diff --git a/app/xterm/version.h b/app/xterm/version.h index f4b389e7a..46063cdc4 100644 --- a/app/xterm/version.h +++ b/app/xterm/version.h @@ -1,9 +1,9 @@ /* - * $XTermId: version.h,v 1.325 2010/11/10 00:51:22 tom Exp $ + * $XTermId: version.h,v 1.327 2011/02/14 00:21:29 tom Exp $ * ---------------------------------------------------------------------------- * this file is part of xterm * - * Copyright 1998-2009,2010 by Thomas E. Dickey + * Copyright 1998-2010,2011 by Thomas E. Dickey * * All Rights Reserved * @@ -39,7 +39,7 @@ * version of X to which this version of xterm has been built. The number in * parentheses is my patch number (Thomas E. Dickey). */ -#define XTERM_PATCH 267 +#define XTERM_PATCH 269 #ifndef __vendorversion__ #define __vendorversion__ "XTerm/OpenBSD" diff --git a/app/xterm/xterm.h b/app/xterm/xterm.h index fb46c3bc6..8555f1b79 100644 --- a/app/xterm/xterm.h +++ b/app/xterm/xterm.h @@ -1,8 +1,8 @@ -/* $XTermId: xterm.h,v 1.637 2010/11/11 11:41:54 tom Exp $ */ +/* $XTermId: xterm.h,v 1.644 2011/02/20 00:49:16 tom Exp $ */ /************************************************************ -Copyright 1999-2009,2010 by Thomas E. Dickey +Copyright 1999-2010,2011 by Thomas E. Dickey All Rights Reserved @@ -40,11 +40,16 @@ authorization. */ #ifndef included_xterm_h #define included_xterm_h +/* *INDENT-OFF* */ #ifdef HAVE_CONFIG_H #include <xtermcfg.h> #endif +#ifndef GCC_PRINTFLIKE +#define GCC_PRINTFLIKE(f,n) /* nothing */ +#endif + #ifndef GCC_UNUSED #define GCC_UNUSED /* nothing */ #endif @@ -418,6 +423,7 @@ extern char **environ; #define XtNforcePackedFont "forcePackedFont" #define XtNformatOtherKeys "formatOtherKeys" #define XtNfreeBoldBox "freeBoldBox" +#define XtNfullscreen "fullscreen" #define XtNhighlightColor "highlightColor" #define XtNhighlightColorMode "highlightColorMode" #define XtNhighlightReverse "highlightReverse" @@ -545,7 +551,7 @@ extern char **environ; #define XtCC132 "C132" #define XtCCacheDoublesize "CacheDoublesize" #define XtCCharClass "CharClass" -#define XtCCjkWidth "CjkWidth" +#define XtCCjkWidth "CjkWidth" #define XtCColorAttrMode "ColorAttrMode" #define XtCColorMode "ColorMode" #define XtCColumn "Column" @@ -587,6 +593,7 @@ extern char **environ; #define XtCForcePackedFont "ForcePackedFont" #define XtCFormatOtherKeys "FormatOtherKeys" #define XtCFreeBoldBox "FreeBoldBox" +#define XtCFullscreen "Fullscreen" #define XtCHighlightColorMode "HighlightColorMode" #define XtCHighlightReverse "HighlightReverse" #define XtCHighlightSelection "HighlightSelection" @@ -610,7 +617,7 @@ extern char **environ; #define XtCMetaSendsEscape "MetaSendsEscape" #define XtCMkSamplePass "MkSamplePass" #define XtCMkSampleSize "MkSampleSize" -#define XtCMkWidth "MkWidth" +#define XtCMkWidth "MkWidth" #define XtCModifyCursorKeys "ModifyCursorKeys" #define XtCModifyFunctionKeys "ModifyFunctionKeys" #define XtCModifyKeypadKeys "ModifyKeypadKeys" @@ -813,6 +820,7 @@ extern void RestartBlinking(TScreen * /* screen */); extern void ShowCursor (void); extern void SwitchBufPtrs (TScreen * /* screen */, int /* toBuf */); extern void ToggleAlternate (XtermWidget /* xw */); +extern void VTInitTranslations (void); extern void VTReset (XtermWidget /* xw */, int /* full */, int /* saved */); extern void VTRun (XtermWidget /* xw */); extern void dotext (XtermWidget /* xw */, int /* charset */, IChar * /* buf */, Cardinal /* len */); @@ -974,7 +982,7 @@ extern void HandleStringEvent PROTO_XT_ACTIONS_ARGS; extern void Panic (const char * /* s */, int /* a */); extern void Redraw (void); extern void ReverseOldColors (void); -extern void SysError (int /* i */) GCC_NORETURN; +extern void SysError (int /* i */) GCC_NORETURN; extern void VisualBell (void); extern void do_dcs (XtermWidget /* xw */, Char * /* buf */, size_t /* len */); extern void do_decrpm (XtermWidget /* xw */, int /* nparam */, int * /* params */); @@ -1081,10 +1089,10 @@ extern void writePtyData (int /* f */, IChar * /* d */, unsigned /* len */); : False) #else #define morePtyData(screen, data) ((data)->last > (data)->next) -#define nextPtyData(screen, data) (*((data)->next++) & \ - (screen->output_eight_bits \ - ? 0xff \ - : 0x7f)) +#define nextPtyData(screen, data) (IChar) (*((data)->next++) & \ + (screen->output_eight_bits \ + ? 0xff \ + : 0x7f)) #define writePtyData(f,d,len) v_write(f,d,len) #endif @@ -1097,6 +1105,7 @@ extern int ScreenResize (XtermWidget /* xw */, int /* width */, int /* height extern size_t ScrnPointers (TScreen * /* screen */, size_t /* len */); extern void ClearBufRows (XtermWidget /* xw */, int /* first */, int /* last */); extern void ClearCells (XtermWidget /* xw */, int /* flags */, unsigned /* len */, int /* row */, int /* col */); +extern void FullScreen(XtermWidget /* xw */, Bool /* enabled */); extern void ScrnAllocBuf (XtermWidget /* xw */); extern void ScrnClearCells (XtermWidget /* xw */, int /* row */, int /* col */, unsigned /* len */); extern void ScrnDeleteChar (XtermWidget /* xw */, unsigned /* n */); @@ -1200,6 +1209,7 @@ 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 drawXtermText (XtermWidget /* xw */, unsigned /* flags */, GC /* gc */, int /* x */, int /* y */, int /* chrset */, IChar * /* text */, Cardinal /* len */, int /* on_wide */); +extern int extendedBoolean(const char * /* value */, FlagList * /* table */, Cardinal /* limit */); extern void ChangeColors (XtermWidget /* xw */, ScrnColors * /* pNew */); extern void ClearRight (XtermWidget /* xw */, int /* n */); extern void ClearScreen (XtermWidget /* xw */); @@ -1267,10 +1277,10 @@ extern Pixel xtermGetColorRes(XtermWidget /* xw */, ColorRes * /* res */); #define MapToColorMode(fg, screen, flags) \ (((screen)->colorBLMode && ((flags) & BLINK)) \ ? COLOR_BL \ - : (((screen)->colorULMode && ((flags) & UNDERLINE)) \ - ? COLOR_UL \ - : (((screen)->colorBDMode && ((flags) & BOLD)) \ - ? COLOR_BD \ + : (((screen)->colorBDMode && ((flags) & BOLD)) \ + ? COLOR_BD \ + : (((screen)->colorULMode && ((flags) & UNDERLINE)) \ + ? COLOR_UL \ : fg))) #define checkVeryBoldAttr(flags, fg, code, attr) \ @@ -1359,5 +1369,6 @@ unsigned visual_width(IChar * /* str */, Cardinal /* len */); #ifdef __cplusplus } #endif +/* *INDENT-ON* */ -#endif /* included_xterm_h */ +#endif /* included_xterm_h */ diff --git a/app/xterm/xterm.log.html b/app/xterm/xterm.log.html index e19f6579c..56db3389a 100644 --- a/app/xterm/xterm.log.html +++ b/app/xterm/xterm.log.html @@ -3,7 +3,7 @@ ***************************************************************************** * this file is part of xterm * * * - * Copyright 1997-2009,2010 by Thomas E. Dickey * + * Copyright 1997-2010,2011 by Thomas E. Dickey * * * * All Rights Reserved * * * @@ -31,7 +31,7 @@ * sale, use or other dealings in this Software without prior written * * authorization. * ***************************************************************************** - $XTermId: xterm.log.html,v 1.995 2010/11/21 23:40:00 tom Exp $ + $XTermId: xterm.log.html,v 1.1020 2011/02/20 01:30:19 tom Exp $ --> <HTML> <HEAD> @@ -56,6 +56,8 @@ Most of these are summarized in the XFree86 CHANGELOG is the latest version of this file. <UL> +<LI><A HREF="#xterm_269">Patch #269 - 2011/02/19</A> +<LI><A HREF="#xterm_268">Patch #268 - 2011/02/10</A> <LI><A HREF="#xterm_267">Patch #267 - 2010/11/20</A> <LI><A HREF="#xterm_266">Patch #266 - 2010/10/24</A> <LI><A HREF="#xterm_265">Patch #265 - 2010/10/22</A> @@ -326,6 +328,100 @@ is the latest version of this file. <LI><A HREF="#xterm_01">Patch #1 - 1996/1/6</A> </UL> +<H1><A NAME="xterm_269">Patch #269 - 2011/02/19</A></H1> +<ul> + <li>build-fixes for <code>imake</code> (report by Heiko Berges). + + <li>modify autoconf macro CF_PKG_CONFIG to work with cross-compile + environments (patch by Thierry Reding). + + <li>modify <code>MapToColorMode()</code> to favor bold over underline, + matching the precedence used before + <a href="#xterm_252">patch #252</a> + (report/analysis by Nicolas George). + + <li>add <code>omitTranslation</code> resource, which can be used to + suppress the default translations for these features: + <ul> + <li>fullscreen + <li>scroll-lock + <li>shift-fonts + <li>wheel-mouse + </ul> + + <li>make the fullscreen feature configurable (Debian #612978) + <ul> + <li>add it to the configurable list + <code>disallowedWindowOps</code>. + + <li>add command-line option <code>-fullscreen</code> to allow the + feature to be enabled at startup. + + <li>add resource <code>fullscreen</code> to control whether the + feature is active or may be enabled. + </ul> + + <li>modify <code>probe_netwm_fullscreen_capability</code> for 64-bit + machines. Contrary to <code>XGetWindowProperty</code> manpage, + that function returns 32-bit data packed as <code>long</code>'s. + + <li>eliminate copy of <code>name</code> resource, which was otherwise + used only to give the terminal-description name for the tcap-query + feature. Use the actual <code>$TERM</code> value instead, as + derived from <code>termName</code> resource, etc. + + <li>eliminate an old inconsistency with error messages, some used the + <code>-name</code> option, while others used <code>argv[0]</code>. + The latter is now used consistently. + + <li>improve configure check for rpath-hack, to improve builds on + systems where gcc will not search /usr/local/lib, etc. + + <li>build-fix for Xaw3d configuration (report by H Merijn Brand). + + <li>update config.guess, config.sub +</ul> + +<H1><A NAME="xterm_268">Patch #268 - 2011/02/10</A></H1> +<ul> + <li>fix an inconsistency of the "Enable Reverse Video" checkbox in + the VT Options menu. + This also removes a special case + added in <a href="#xterm_217">patch #217</a> + which limited the effect of the <code>reverseVideo</code> resource + (Debian #603808). + + <li>amend decoding of misformed UTF-8 sequences to avoid absorbing + valid characters as documented in Unicode 6.0 section 3.9 + (report by Keith Winstein). + + <li>do not set urgency hint when window already has focus + (patch by Dimitrios Christidis). + + <li>amend extended mouse-coordinate mode from + <a href="#xterm_262">patch #262</a> changes to include + the <em>Cb</em> button-code, which also may be greater than 127 + (report by Ailin Nemui). + + <li>ensure that underline-cursor is visible when an application happens + to set the background color (report by Christian Weisgerber). + + <li>add feature for + <a href="http://www.davidsimmons.com/soft/xtermhacks/xterm-fullscreen.patch">full-screen toggling</a> + using either Alt-Enter + or a menu selection + (integrated patch by Dave Simmons). + + <li>add missing logic to handle reallocation of FIFO index for the + "UTF-8" menu entry (report by David Holland, NetBSD #44344). + + <li>add makefile rules <code>docs-ctlseqs</code>, + <code>docs-xterm</code>, etc. + + <li>correct typo in description of DECRPM in control sequences + document (report by Ailin Nemui). +</ul> + <H1><A NAME="xterm_267">Patch #267 - 2010/11/20</A></H1> <ul> <li>minor formatting changes to ctlseqs.ms to simplify a script which diff --git a/app/xterm/xterm.man b/app/xterm/xterm.man index 869045398..680ff3884 100644 --- a/app/xterm/xterm.man +++ b/app/xterm/xterm.man @@ -1,7 +1,7 @@ '\" t -.\" $XTermId: xterm.man,v 1.469 2010/11/11 11:57:07 tom Exp $ +.\" $XTermId: xterm.man,v 1.481 2011/02/18 10:48:14 tom Exp $ .\" -.\" Copyright 1996-2009,2010 by Thomas E. Dickey +.\" Copyright 1996-2010,2011 by Thomas E. Dickey .\" .\" All Rights Reserved .\" @@ -55,7 +55,11 @@ .\" from The Open Group. .\" .\" updated by Thomas E. Dickey for XFree86, July 1996 - February 2006. -. +.\" +.\" Bulleted paragraph +.de bP +.IP \(bu 4 +.. .\" these would be fallbacks for DS/DE, .\" but groff changed the meaning of the macros. .de NS @@ -506,6 +510,17 @@ This option sets the pointsize for fonts selected from the FreeType library if support for that library was compiled into \fIxterm\fP. This corresponds to the \fBfaceSize\fP resource. .TP 8 +.BI \-fullscreen +This option indicates that \fIxterm\fP should ask the window manager to +let it use the full-screen for display, +e.g., without window decorations. +It sets the \fBfullscreen\fP resource to \*(``true\*(''. +.TP 8 +.BI +fullscreen +This option indicates that \fIxterm\fP should not ask the window manager to +let it use the full-screen for display. +It sets the \fBfullscreen\fP resource to \*(``false\*(''. +.TP 8 .B \-fw \fIfont\fP This option specifies the font to be used for displaying wide text. By default, @@ -1214,6 +1229,33 @@ together by setting the DECBKM state according to whether the initial value of stty erase is a backspace (8) or delete (127) character. The default is \*(``false\*('', which disables this feature. .TP 8 +.B "fullscreen (\fPclass\fB Fullscreen)" +Specifies whether or not \fIxterm\fP should ask the window manager to +use a fullscreen layout on startup. +\fIXterm\fP accepts either a keyword (ignoring case) +or the number shown in parentheses: +.RS +.TP 3 +false (0) +Fullscreen layout is not used initially, +but may be later via menu-selection or control sequence. +.TP 3 +true (1) +Fullscreen layout is used initially, +but may be disabled later via menu-selection or control sequence. +.TP 3 +always (2) +Fullscreen layout is used initially, +and cannot be disabled later via menu-selection or control sequence. +.TP 3 +never (3) +Fullscreen layout is not used, +and cannot be enabled later via menu-selection or control sequence. +.RE +.IP +The default is +\*(``false.\*('' +.TP 8 .B "hold (\fPclass\fB Hold)" If true, \fIxterm\fP will not immediately destroy its window when the shell command completes. @@ -1294,6 +1336,19 @@ that \fIxterm\fR requests on each read. The default is 4096. You cannot set this to a value less than 64. .TP 8 +.B "omitTranslation (\fPclass\fB OmitTranslation)" +Selectively omit one or more parts of \fIxterm\fP's default translations +at startup. +The resource value is a comma-separated list of keywords, +which may be abbreviated: +\*(``fullscreen\*('', +\*(``scroll-lock\*('', +\*(``shift-fonts\*('' or +\*(``wheel-mouse\*(''. +\fIXterm\fP also recognizes \*(``default\*('', +but omitting that will make the program unusable +unless you provide a similar definition in your resource settings. +.TP 8 .B "ptyHandshake (\fPclass\fB PtyHandshake) If \*(``true\*('', \fIxterm\fP will perform handshaking during initialization to ensure that the parent and child processes update the \fIutmp\fP @@ -2207,6 +2262,9 @@ Lower the xterm window to the bottom of the stacking order. MaximizeWin (9) Maximize window (i.e., resize to screen size). .TP 5 +FullscreenWin (10) +Use full screen (i.e., resize to screen size, without window decorations). +.TP 5 MinimizeWin (2) Iconify window. .TP 5 @@ -3121,6 +3179,54 @@ The default is ``3''. Specifies whether or not reverse video should be simulated. The default is \*(``false.\*('' +.IP +There are several aspects to reverse video in \fIxterm\fP: +.RS +.bP +The command-line \fB\-rv\fP option tells the X libraries to reverse +the foreground and background colors. +\fIXterm\fP's command-line options set resource values. +In particular, the X Toolkit sets the \fBreverseVideo\fP resource +when the \fB\-rv\fP option is used. +.bP +If the user has also used command-line options \fB\-fg\fP or \fB\-bg\fP +to set the foreground and background colors, +\fIxterm\fP does not see these options directly. +Instead, +it examines the resource values to reconstruct the command-line options, +and determine which of the colors is the user's intended foreground, etc. +Their actual values are irrelevant to the reverse video function; +some users prefer the X defaults (black text on a white background), +others prefer white text on a black background. +.bP +After startup, +the user can toggle the "Enable Reverse Video" menu entry. +This exchanges the current foreground and background colors +of the VT100 widget, +and repaints the screen. +Because of the X resource hierarchy, +the \fBreverseVideo\fP resource applies to more than the VT100 widget. +.RE +.IP +Programs running in an \fIxterm\fP can also use control sequences +to enable the VT100 reverse video mode. +These are independent of the \fIreverseVideo\fP resource and the menu entry. +\fIXterm\fP exchanges the current foreground and background colors +when drawing text affected by these control sequences. +.IP +Other control sequences can alter the foreground and background colors +which are used: +.RS +.bP +Programs can also use the ANSI color control sequences to set the +foreground and background colors. +.bP +Extensions to the ANSI color controls (such as 16-, 88- or 256-colors) +are treated similarly to the ANSI control. +.bP +Using other control sequences (the "\fIdynamic colors\fR" feature), +a program can change the foreground and background colors. +.RE .TP 8 .B "reverseWrap (\fPclass\fB ReverseWrap)" Specifies whether or not reverse-wraparound should be enabled. @@ -3363,6 +3469,8 @@ it translates the ISO-8859-1 string to UTF-8 to work with the X libraries which assume the string is UTF-8. .IP However, some users may wish to write a title string encoded in UTF-8. +The window manager is responsible for drawing window titles. +Some window managers (not all) support UTF-8 encoding of window titles. Set this resource to \*(``true\*('' to allow UTF-8 encoded title strings. That cancels the translation to UTF-8, allowing UTF-8 strings to be displayed as is. @@ -4782,6 +4890,9 @@ by echoing the event's position ^X ESC G <line+\*(`` \*(''> <col+\*(`` \*(''> .in -8 .TP 8 +.B "fullscreen()" +Asks the window manager to change the window to full-screen. +.TP 8 .B "iconify()" Iconifies the window. .TP 8 @@ -5310,6 +5421,7 @@ 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\\\& + Alt <Key>Return:fullscreen() \\n\\\& <KeyRelease> Scroll_Lock:scroll-lock() \\n\\\& Shift~Ctrl <KeyPress> KP_Add:larger-vt-font() \\n\\\& Shift Ctrl <KeyPress> KP_Add:smaller-vt-font() \\n\\\& diff --git a/app/xterm/xtermcap.c b/app/xterm/xtermcap.c index b9f68bf43..a3884db5f 100644 --- a/app/xterm/xtermcap.c +++ b/app/xterm/xtermcap.c @@ -1,7 +1,7 @@ -/* $XTermId: xtermcap.c,v 1.44 2010/06/13 17:46:27 tom Exp $ */ +/* $XTermId: xtermcap.c,v 1.45 2011/02/19 20:28:13 tom Exp $ */ /* - * Copyright 2007-2009,2010 by Thomas E. Dickey + * Copyright 2007-2010,2011 by Thomas E. Dickey * * All Rights Reserved * |