diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2013-08-26 20:06:18 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2013-08-26 20:06:18 +0000 |
commit | 5c6698c8bd9ec6dbd60d36295c0cf2e19430137e (patch) | |
tree | dbcb2b0611bb09a12644791edafe3107fe349326 | |
parent | f3dc14d6ff296b48660a7519667da617fdccbad5 (diff) |
Update to xterm 296. Sixel graphics disabled for now.
32 files changed, 2624 insertions, 439 deletions
diff --git a/app/xterm/INSTALL b/app/xterm/INSTALL index c31726d51..9d555fc8f 100644 --- a/app/xterm/INSTALL +++ b/app/xterm/INSTALL @@ -1,4 +1,4 @@ --- $XTermId: INSTALL,v 1.147 2013/05/27 22:19:09 tom Exp $ +-- $XTermId: INSTALL,v 1.148 2013/06/23 20:22:46 tom Exp $ ------------------------------------------------------------------------------- -- Copyright 1997-2012,2013 by Thomas E. Dickey -- @@ -487,6 +487,10 @@ The options (in alphabetic order): Compile-in code to support SCO-style function keys. + --enable-sixel-graphics enable support for sixel-graphics + + Compile-in code to support experimental sixel-graphics + --enable-sun-fkeys enable support for Sun-style function keys Compile-in code to support Sun-style function keys. diff --git a/app/xterm/Imakefile b/app/xterm/Imakefile index 3b365ad0c..81b6ce86d 100644 --- a/app/xterm/Imakefile +++ b/app/xterm/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XTermId: Imakefile,v 1.107 2013/01/01 12:16:40 tom Exp $ +XCOMM $XTermId: Imakefile,v 1.109 2013/06/23 22:32:37 tom Exp $ XCOMM XCOMM Attention xterm porters XCOMM @@ -165,6 +165,9 @@ TERMCAPDEFINES=-DUSE_TERMINFO -DHAVE_TIGETSTR #if !HasPutenv PUTENVDEF = -DNOPUTENV #endif +#ifdef SixelXTerm + SIXELDEF = -DOPT_SIXEL_GRAPHICS=1 +#endif #ifdef TraceXTerm TRACEDEF = -DOPT_TRACE=1 #endif @@ -174,11 +177,15 @@ TERMCAPDEFINES=-DUSE_TERMINFO -DHAVE_TIGETSTR MISC_DEFINES = /* -DALLOWLOGGING -DALLOWLOGFILEEXEC */ XKB_DEFINES = XkbClientDefines PATH_DEFINES = -DPROJECTROOT=$(PROJECTROOT) - DEFINES = $(XKB_DEFINES) $(TERMCAPDEFINES) $(FEATURE_DEFINES) $(SCROLLBAR_RIGHT) $(UTF8_OPTION) $(XRFDEF) $(PATH_DEFINES) $(PUTENVDEF) $(IMAKEDEFINES) $(TRACEDEF) + DEFINES = $(XKB_DEFINES) $(TERMCAPDEFINES) $(FEATURE_DEFINES) $(SCROLLBAR_RIGHT) $(UTF8_OPTION) $(XRFDEF) $(PATH_DEFINES) $(PUTENVDEF) $(IMAKEDEFINES) $(SIXELDEF) $(TRACEDEF) INCLUDES = -I. $(XRFINCLUDES) MAINSRC = main.c MAINOBJ = main.o +#ifdef SixelXTerm + SIXELSRC = graphics.c + SIXELOBJ = graphics.o +#endif #ifdef TraceXTerm TRACESRC = trace.c TRACEOBJ = trace.o @@ -188,13 +195,13 @@ TERMCAPDEFINES=-DUSE_TERMINFO -DHAVE_TIGETSTR linedata.c menu.c misc.c print.c ptydata.c scrollback.c \ screen.c scrollbar.c tabs.c util.c version.c xstrings.c \ xtermcap.c TekPrsTbl.c Tekproc.c VTPrsTbl.c \ - $(MAINSRC) $(EXTRASRC) $(UTF8SRC) $(TRACESRC) + $(MAINSRC) $(EXTRASRC) $(UTF8SRC) $(SIXELSRC) $(TRACESRC) OBJS1 = button.o cachedGCs.o charproc.o charsets.o cursor.o \ data.o doublechr.o fontutils.o input.o \ linedata.o menu.o misc.o print.o ptydata.o scrollback.o \ screen.o scrollbar.o tabs.o util.o version.o xstrings.o \ xtermcap.o TekPrsTbl.o Tekproc.o VTPrsTbl.o \ - $(MAINOBJ) $(EXTRAOBJ) $(UTF8OBJ) $(TRACEOBJ) + $(MAINOBJ) $(EXTRAOBJ) $(UTF8OBJ) $(SIXELOBJ) $(TRACEOBJ) SRCS2 = resize.c version.c xstrings.c OBJS2 = resize.o version.o xstrings.o SRCS = $(SRCS1) $(SRCS2) diff --git a/app/xterm/MANIFEST b/app/xterm/MANIFEST index 25e9cc53d..5675bd8dd 100644 --- a/app/xterm/MANIFEST +++ b/app/xterm/MANIFEST @@ -1,4 +1,4 @@ -MANIFEST for xterm-293, version xterm-293 +MANIFEST for xterm-296, version xterm-296 -------------------------------------------------------------------------------- MANIFEST this file 256colres.h resource-definitions for 256-color mode @@ -47,6 +47,7 @@ error.h error-code definitions for 'xterm' fontutils.c xterm functions for (re)loading fonts fontutils.h interface of fontutils.c gen-pc-fkeys.pl script to generate extended function-key terminfo +graphics.c graphics support functions for 'xterm' input.c VT100 key-symbol and function-key translation install-sh install-script (needed by configure) keysym2ucs.c lookup-table for UTF-8 to keysyms diff --git a/app/xterm/THANKS b/app/xterm/THANKS index ede29c96a..dbcc4af6b 100644 --- a/app/xterm/THANKS +++ b/app/xterm/THANKS @@ -1,4 +1,4 @@ --- $XTermId: THANKS,v 1.8 2012/11/21 23:47:03 tom Exp $ +-- $XTermId: THANKS,v 1.9 2013/07/04 23:04:24 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. @@ -20,6 +20,7 @@ Alexander V Lukyanov Andrea Odetti Andreas Jaeger Andreas Schwab +Andres Perera Andrew Sumner Andrew Tipton Andries E Brouwer @@ -28,6 +29,7 @@ Balazs Kezes Ben Yoshino Bernhard R Link Bernhard Rosenkraenzer +Bertram Felgenhauer Bill Nottingham Bob Maynard Bradd W Szonye @@ -141,6 +143,7 @@ Paul Maier Paul Vojta Paul Williams Pavel Roskin +Peder Stray Per Hedeland Peter Berg Larsen Pierre Lombard @@ -150,6 +153,7 @@ Rob Braun Robert Brady Robert Earl Robin Cutshaw +Ross Combs Ross Paterson Ryan Johnson Scott Sewall @@ -161,6 +165,7 @@ Stefan Dirsch Steve Wall Stuart Lissaman Sven Verdoolaege +Taketo Kabe Taneli Huuskonen Ted Phelps Thierry Reding diff --git a/app/xterm/VTparse.h b/app/xterm/VTparse.h index 7b7b4f1c3..464c62395 100644 --- a/app/xterm/VTparse.h +++ b/app/xterm/VTparse.h @@ -1,4 +1,4 @@ -/* $XTermId: VTparse.h,v 1.59 2012/09/10 23:27:03 tom Exp $ */ +/* $XTermId: VTparse.h,v 1.61 2013/06/23 21:12:13 tom Exp $ */ /* * Copyright 2002-2011,2012 by Thomas E. Dickey diff --git a/app/xterm/XTerm.ad b/app/xterm/XTerm.ad index 81d82d8e7..2a7d86108 100644 --- a/app/xterm/XTerm.ad +++ b/app/xterm/XTerm.ad @@ -1,4 +1,4 @@ -! $XTermId: XTerm.ad,v 1.97 2011/07/11 10:52:16 tom Exp $ +! $XTermId: XTerm.ad,v 1.99 2013/06/23 08:57:13 Ross.Combs Exp $ ! ----------------------------------------------------------------------------- ! this file is part of xterm ! @@ -100,6 +100,8 @@ *vtMenu*tekmode*Label: Switch to Tek Mode *vtMenu*vthide*Label: Hide VT Window *vtMenu*altscreen*Label: Show Alternate Screen +*vtMenu*sixelScrolling*Label: Sixel Scrolling +*vtMenu*privateColorRegisters*Label: Private Color Registers *fontMenu.Label: VT Fonts *fontMenu*fontdefault*Label: Default diff --git a/app/xterm/button.c b/app/xterm/button.c index a72a856e8..79ec8bd7d 100644 --- a/app/xterm/button.c +++ b/app/xterm/button.c @@ -1,4 +1,4 @@ -/* $XTermId: button.c,v 1.456 2013/05/12 22:16:26 tom Exp $ */ +/* $XTermId: button.c,v 1.458 2013/07/01 00:50:20 tom Exp $ */ /* * Copyright 1999-2012,2013 by Thomas E. Dickey @@ -75,7 +75,6 @@ button.c Handles button events in the terminal emulator. #include <data.h> #include <error.h> #include <menu.h> -#include <xcharmouse.h> #include <charclass.h> #include <xstrings.h> @@ -3346,13 +3345,6 @@ ComputeSelect(XtermWidget xw, screen->endSel.col = 0; NextRow(endSel); } - /* Clicking on right edge will make endSel.col == screen->max_col, - * so clamp it. Otherwise XTERM_CELL and friends will fail assertion - */ - if (screen->endSel.col > screen->max_col) { - screen->endSel.col = screen->max_col; - TRACE(("Select_WORD endSel.col clamped to %d\n", screen->endSel.col)); - } } #if OPT_WIDE_CHARS if (screen->endSel.col diff --git a/app/xterm/charproc.c b/app/xterm/charproc.c index d4075296c..e615cd249 100644 --- a/app/xterm/charproc.c +++ b/app/xterm/charproc.c @@ -1,4 +1,4 @@ -/* $XTermId: charproc.c,v 1.1289 2013/05/26 21:18:52 tom Exp $ */ +/* $XTermId: charproc.c,v 1.1300 2013/07/04 15:19:32 tom Exp $ */ /* * Copyright 1999-2012,2013 by Thomas E. Dickey @@ -133,9 +133,9 @@ #include <menu.h> #include <main.h> #include <fontutils.h> -#include <xcharmouse.h> #include <charclass.h> #include <xstrings.h> +#include <graphics.h> typedef void (*BitFunc) (unsigned * /* p */ , unsigned /* mask */ ); @@ -151,8 +151,10 @@ static void RequestResize(XtermWidget /* xw */ , int /* cols */ , Bool /* text */ ); static void SwitchBufs(XtermWidget /* xw */ , - int /* toBuf */ ); -static void ToAlternate(XtermWidget /* xw */ ); + int /* toBuf */ , + Bool /* clearFirst */ ); +static void ToAlternate(XtermWidget /* xw */ , + Bool /* clearFirst */ ); static void ansi_modes(XtermWidget termw, BitFunc /* func */ ); static void bitclr(unsigned *p, unsigned mask); @@ -364,6 +366,10 @@ static XtActionsRec actionsList[] = { { "larger-vt-font", HandleLargerFont }, { "smaller-vt-font", HandleSmallerFont }, #endif +#if OPT_SIXEL_GRAPHICS + { "set-private-colors", HandleSetPrivateColorRegisters }, + { "set-sixel-scrolling", HandleSixelScrolling }, +#endif #if OPT_SUN_FUNC_KEYS { "set-sun-function-keys", HandleSunFunctionKeys }, #endif @@ -667,6 +673,12 @@ static XtResource xterm_resources[] = Bres(XtNshiftFonts, XtCShiftFonts, misc.shift_fonts, True), #endif +#if OPT_SIXEL_GRAPHICS + Bres(XtNprivateColorRegisters, XtCPrivateColorRegisters, + screen.privatecolorregisters, True), + Bres(XtNsixelScrolling, XtCSixelScrolling, screen.sixel_scrolling, False), +#endif + #if OPT_SUNPC_KBD Ires(XtNctrlFKeys, XtCCtrlFKeys, misc.ctrl_fkeys, 10), #endif @@ -1983,7 +1995,10 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp) } DumpParams(); - TRACE(("parse %04X -> %d %s\n", c, sp->nextstate, which_table(sp->parsestate))); + TRACE(("parse %04X -> %d %s (used=%lu)\n", + c, sp->nextstate, + which_table(sp->parsestate), + (unsigned long) sp->string_used)); /* * If the parameter list has subparameters (tokens separated by ":") @@ -2446,6 +2461,12 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp) */ if (screen->terminal_id < 200) { switch (screen->terminal_id) { + case 125: + reply.a_param[count++] = 12; /* VT125 */ + reply.a_param[count++] = 0 | 2 | 0; /* no STP, AVO, no GPO (ReGIS) */ + reply.a_param[count++] = 0; /* no printer */ + reply.a_param[count++] = XTERM_PATCH; /* ROM version */ + break; case 102: reply.a_param[count++] = 6; /* VT102 */ break; @@ -2455,7 +2476,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp) break; default: /* VT100 */ reply.a_param[count++] = 1; /* VT100 */ - reply.a_param[count++] = 2; /* AVO */ + reply.a_param[count++] = 0 | 2 | 0; /* no STP, AVO, no GPO (ReGIS) */ break; } } else { @@ -2464,6 +2485,15 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp) / 100); reply.a_param[count++] = 1; /* 132-columns */ reply.a_param[count++] = 2; /* printer */ +#if OPT_SIXEL_GRAPHICS + if (screen->terminal_id == 240 || + screen->terminal_id == 241 || + screen->terminal_id == 330 || + screen->terminal_id == 340) { + reply.a_param[count++] = 3; /* ReGIS graphics */ + reply.a_param[count++] = 4; /* sixel graphics */ + } +#endif reply.a_param[count++] = 6; /* selective-erase */ #if OPT_SUNPC_KBD if (xw->keyboard.type == keyboardIsVT220) @@ -2805,7 +2835,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp) TRACE(("...request printer status\n")); if (sp->private_function && screen->vtXX_level >= 2) { /* VT220 */ - reply.a_param[count++] = 13; /* implement printer */ + reply.a_param[count++] = 13; /* no printer detected */ } break; case 25: @@ -2827,7 +2857,8 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp) } } break; - case 53: + case 53: /* according to existing xterm handling */ + case 55: /* according to the VT330/VT340 Text Programming Manual */ TRACE(("...request locator status\n")); if (sp->private_function && screen->vtXX_level >= 2) { /* VT220 */ @@ -2838,6 +2869,18 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp) #endif } break; + case 56: + TRACE(("...request locator type\n")); + if (sp->private_function + && screen->vtXX_level >= 3) { /* VT330 (FIXME: what about VT220?) */ + reply.a_param[count++] = 57; +#if OPT_DEC_LOCATOR + reply.a_param[count++] = 1; /* mouse */ +#else + reply.a_param[count++] = 0; /* unknown */ +#endif + } + break; case 62: TRACE(("...request DECMSR - macro space\n")); if (sp->private_function @@ -3243,7 +3286,9 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp) break; case CASE_ST: - TRACE(("CASE_ST: End of String (%lu bytes)\n", (unsigned long) sp->string_used)); + TRACE(("CASE_ST: End of String (%lu bytes) (mode=%d)\n", + (unsigned long) sp->string_used, + sp->string_mode)); ResetState(sp); if (!sp->string_used) break; @@ -3264,6 +3309,9 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp) case ANSI_SOS: /* ignored */ break; + default: + TRACE(("unknown mode\n")); + break; } break; @@ -4797,104 +4845,6 @@ really_set_mousemode(XtermWidget xw, #endif /* - * Use this enumerated type to check consistency among dpmodes(), savemodes() - * and restoremodes(). - */ -typedef enum { - srm_DECCKM = 1 - ,srm_DECANM = 2 - ,srm_DECCOLM = 3 - ,srm_DECSCLM = 4 - ,srm_DECSCNM = 5 - ,srm_DECOM = 6 - ,srm_DECAWM = 7 - ,srm_DECARM = 8 - ,srm_X10_MOUSE = SET_X10_MOUSE -#if OPT_TOOLBAR - ,srm_RXVT_TOOLBAR = 10 -#endif -#if OPT_BLINK_CURS - ,srm_ATT610_BLINK = 12 -#endif - ,srm_DECPFF = 18 - ,srm_DECPEX = 19 - ,srm_DECTCEM = 25 - ,srm_RXVT_SCROLLBAR = 30 -#if OPT_SHIFT_FONTS - ,srm_RXVT_FONTSIZE = 35 -#endif -#if OPT_TEK4014 - ,srm_DECTEK = 38 -#endif - ,srm_132COLS = 40 - ,srm_CURSES_HACK = 41 - ,srm_DECNRCM = 42 - ,srm_MARGIN_BELL = 44 - ,srm_REVERSEWRAP = 45 -#ifdef ALLOWLOGGING - ,srm_ALLOWLOGGING = 46 -#endif - ,srm_OPT_ALTBUF_CURSOR = 1049 - ,srm_OPT_ALTBUF = 1047 - ,srm_ALTBUF = 47 - ,srm_DECNKM = 66 - ,srm_DECBKM = 67 - ,srm_DECLRMM = 69 - ,srm_DECNCSM = 95 - ,srm_VT200_MOUSE = SET_VT200_MOUSE - ,srm_VT200_HIGHLIGHT_MOUSE = SET_VT200_HIGHLIGHT_MOUSE - ,srm_BTN_EVENT_MOUSE = SET_BTN_EVENT_MOUSE - ,srm_ANY_EVENT_MOUSE = SET_ANY_EVENT_MOUSE -#if OPT_FOCUS_EVENT - ,srm_FOCUS_EVENT_MOUSE = SET_FOCUS_EVENT_MOUSE -#endif - ,srm_EXT_MODE_MOUSE = SET_EXT_MODE_MOUSE - ,srm_SGR_EXT_MODE_MOUSE = SET_SGR_EXT_MODE_MOUSE - ,srm_URXVT_EXT_MODE_MOUSE = SET_URXVT_EXT_MODE_MOUSE - ,srm_ALTERNATE_SCROLL = SET_ALTERNATE_SCROLL - ,srm_RXVT_SCROLL_TTY_OUTPUT = 1010 - ,srm_RXVT_SCROLL_TTY_KEYPRESS = 1011 - ,srm_EIGHT_BIT_META = 1034 -#if OPT_NUM_LOCK - ,srm_REAL_NUMLOCK = 1035 - ,srm_META_SENDS_ESC = 1036 -#endif - ,srm_DELETE_IS_DEL = 1037 -#if OPT_NUM_LOCK - ,srm_ALT_SENDS_ESC = 1039 -#endif - ,srm_KEEP_SELECTION = 1040 - ,srm_SELECT_TO_CLIPBOARD = 1041 - ,srm_BELL_IS_URGENT = 1042 - ,srm_POP_ON_BELL = 1043 - ,srm_TITE_INHIBIT = 1048 -#if OPT_TCAP_FKEYS - ,srm_TCAP_FKEYS = 1050 -#endif -#if OPT_SUN_FUNC_KEYS - ,srm_SUN_FKEYS = 1051 -#endif -#if OPT_HP_FUNC_KEYS - ,srm_HP_FKEYS = 1052 -#endif -#if OPT_SCO_FUNC_KEYS - ,srm_SCO_FKEYS = 1053 -#endif - ,srm_LEGACY_FKEYS = 1060 -#if OPT_SUNPC_KBD - ,srm_VT220_FKEYS = 1061 -#endif -#if OPT_READLINE - ,srm_BUTTON1_MOVE_POINT = SET_BUTTON1_MOVE_POINT - ,srm_BUTTON2_MOVE_POINT = SET_BUTTON2_MOVE_POINT - ,srm_DBUTTON3_DELETE = SET_DBUTTON3_DELETE - ,srm_PASTE_IN_BRACKET = SET_PASTE_IN_BRACKET - ,srm_PASTE_QUOTE = SET_PASTE_QUOTE - ,srm_PASTE_LITERAL_NL = SET_PASTE_LITERAL_NL -#endif /* OPT_READLINE */ -} DECSET_codes; - -/* * process DEC private modes set, reset */ static void @@ -4904,6 +4854,7 @@ dpmodes(XtermWidget xw, BitFunc func) int i, j; unsigned myflags; + TRACE(("changing %d DEC private modes\n", nparam)); for (i = 0; i < nparam; ++i) { int code = GetParam(i); @@ -5071,7 +5022,7 @@ dpmodes(XtermWidget xw, BitFunc func) if (!xw->misc.titeInhibit) { if (IsSM()) { CursorSave(xw); - ToAlternate(xw); + ToAlternate(xw, True); ClearScreen(xw); } else { FromAlternate(xw); @@ -5086,7 +5037,7 @@ dpmodes(XtermWidget xw, BitFunc func) case srm_ALTBUF: /* alternate buffer */ if (!xw->misc.titeInhibit) { if (IsSM()) { - ToAlternate(xw); + ToAlternate(xw, False); } else { if (screen->whichBuf && (code == 1047)) @@ -5119,6 +5070,20 @@ dpmodes(XtermWidget xw, BitFunc func) CursorSet(screen, 0, 0, xw->flags); } break; +#if OPT_SIXEL_GRAPHICS + case srm_DECSDM: /* sixel scrolling */ + if (screen->terminal_id == 240 || + screen->terminal_id == 241 || + screen->terminal_id == 330 || + screen->terminal_id == 340) { + (*func) (&xw->keyboard.flags, MODE_DECSDM); + TRACE(("DECSET/DECRST DECSDM %s (resource default is %d)\n", + BtoS(xw->keyboard.flags & MODE_DECSDM), + TScreenOf(xw)->sixel_scrolling)); + update_decsdm(); + } + break; +#endif case srm_DECNCSM: if (screen->vtXX_level >= 5) { /* VT510 */ (*func) (&xw->flags, NOCLEAR_COLM); @@ -5273,6 +5238,17 @@ dpmodes(XtermWidget xw, BitFunc func) set_mouseflag(paste_literal_nl); break; #endif /* OPT_READLINE */ +#if OPT_SIXEL_GRAPHICS + case srm_PRIVATE_COLOR_REGISTERS: /* private color registers for each graphic */ + TRACE(("DECSET/DECRST PRIVATE_COLOR_REGISTERS %s\n", + BtoS(screen->privatecolorregisters))); + set_bool_mode(screen->privatecolorregisters); + update_privatecolorregisters(); + break; +#endif + default: + TRACE(("DATA_ERROR: unknown private code %d\n", code)); + break; } } } @@ -5383,12 +5359,18 @@ savemodes(XtermWidget xw) case srm_DECNKM: DoSM(DP_DECKPAM, xw->keyboard.flags & MODE_DECKPAM); break; - case srm_DECBKM: + case srm_DECBKM: /* backarrow mapping */ DoSM(DP_DECBKM, xw->keyboard.flags & MODE_DECBKM); break; case srm_DECLRMM: /* left-right */ DoSM(DP_X_LRMM, LEFT_RIGHT); break; +#if OPT_SIXEL_GRAPHICS + case srm_DECSDM: /* sixel scrolling */ + DoSM(DP_DECSDM, xw->keyboard.flags & MODE_DECSDM); + update_decsdm(); + break; +#endif case srm_DECNCSM: /* noclear */ DoSM(DP_X_NCSM, NOCLEAR_COLM); break; @@ -5498,6 +5480,14 @@ savemodes(XtermWidget xw) SCREEN_FLAG_save(screen, paste_literal_nl); break; #endif /* OPT_READLINE */ +#if OPT_SIXEL_GRAPHICS + case srm_PRIVATE_COLOR_REGISTERS: /* private color registers for each graphic */ + TRACE(("save PRIVATE_COLOR_REGISTERS %s\n", + BtoS(screen->privatecolorregisters))); + DoSM(DP_X_PRIVATE_COLOR_REGISTERS, screen->privatecolorregisters); + update_privatecolorregisters(); + break; +#endif } } } @@ -5655,7 +5645,7 @@ restoremodes(XtermWidget xw) case srm_ALTBUF: /* alternate buffer */ if (!xw->misc.titeInhibit) { if (screen->save_modes[DP_X_ALTSCRN]) - ToAlternate(xw); + ToAlternate(xw, False); else FromAlternate(xw); /* update_altscreen done by ToAlt and FromAlt */ @@ -5667,7 +5657,7 @@ restoremodes(XtermWidget xw) bitcpy(&xw->flags, screen->save_modes[DP_DECKPAM], MODE_DECKPAM); update_appkeypad(); break; - case srm_DECBKM: + case srm_DECBKM: /* backarrow mapping */ bitcpy(&xw->flags, screen->save_modes[DP_DECBKM], MODE_DECBKM); update_decbkm(); break; @@ -5680,6 +5670,12 @@ restoremodes(XtermWidget xw) } CursorSet(screen, 0, 0, xw->flags); break; +#if OPT_SIXEL_GRAPHICS + case srm_DECSDM: /* sixel scrolling */ + bitcpy(&xw->keyboard.flags, screen->save_modes[DP_DECSDM], MODE_DECSDM); + update_decsdm(); + break; +#endif case srm_DECNCSM: /* noclear */ bitcpy(&xw->flags, screen->save_modes[DP_X_NCSM], NOCLEAR_COLM); break; @@ -5802,6 +5798,14 @@ restoremodes(XtermWidget xw) SCREEN_FLAG_restore(screen, paste_literal_nl); break; #endif /* OPT_READLINE */ +#if OPT_SIXEL_GRAPHICS + case srm_PRIVATE_COLOR_REGISTERS: /* private color registers for each graphic */ + TRACE(("restore PRIVATE_COLOR_REGISTERS %s\n", + BtoS(screen->privatecolorregisters))); + DoRM(DP_X_PRIVATE_COLOR_REGISTERS, screen->privatecolorregisters); + update_privatecolorregisters(); + break; +#endif } } } @@ -6365,11 +6369,11 @@ ToggleAlternate(XtermWidget xw) if (TScreenOf(xw)->whichBuf) FromAlternate(xw); else - ToAlternate(xw); + ToAlternate(xw, False); } static void -ToAlternate(XtermWidget xw) +ToAlternate(XtermWidget xw, Bool clearFirst) { TScreen *screen = TScreenOf(xw); @@ -6380,7 +6384,7 @@ ToAlternate(XtermWidget xw) (unsigned) MaxRows(screen), (unsigned) MaxCols(screen), &screen->editBuf_data[1]); - SwitchBufs(xw, 1); + SwitchBufs(xw, 1, clearFirst); screen->whichBuf = 1; #if OPT_SAVE_LINES screen->visbuf = screen->editBuf_index[screen->whichBuf]; @@ -6399,7 +6403,7 @@ FromAlternate(XtermWidget xw) if (screen->scroll_amt) FlushScroll(xw); screen->whichBuf = 0; - SwitchBufs(xw, 0); + SwitchBufs(xw, 0, False); #if OPT_SAVE_LINES screen->visbuf = screen->editBuf_index[screen->whichBuf]; #endif @@ -6408,7 +6412,7 @@ FromAlternate(XtermWidget xw) } static void -SwitchBufs(XtermWidget xw, int toBuf) +SwitchBufs(XtermWidget xw, int toBuf, Bool clearFirst) { TScreen *screen = TScreenOf(xw); int rows, top; @@ -6440,6 +6444,9 @@ SwitchBufs(XtermWidget xw, int toBuf) (unsigned) ((rows - top) * FontHeight(screen)), False); #endif + if (clearFirst) { + ClearBufRows(xw, top, rows); + } } ScrnUpdate(xw, 0, 0, rows, MaxCols(screen), False); } @@ -7844,6 +7851,19 @@ VTInitialize(Widget wrequest, TRACE(("initialized DECBKM %s\n", BtoS(wnew->keyboard.flags & MODE_DECBKM))); +#if OPT_SIXEL_GRAPHICS + init_Bres(screen.sixel_scrolling); + if (TScreenOf(wnew)->sixel_scrolling) /* FIXME: should this be off unconditionally here? */ + wnew->keyboard.flags |= MODE_DECSDM; + TRACE(("initialized DECSDM %s (resource default is %d)\n", + BtoS(wnew->keyboard.flags & MODE_DECSDM), + TScreenOf(wnew)->sixel_scrolling)); + + init_Bres(screen.privatecolorregisters); /* FIXME: should this be off unconditionally here? */ + TRACE(("initialized PRIVATE_COLOR_REGISTERS to resource default %s\n", + BtoS(TScreenOf(wnew)->privatecolorregisters))); +#endif + /* look for focus related events on the shell, because we need * to care about the shell's border being part of our focus. */ @@ -9592,6 +9612,11 @@ HideCursor(void) screen->cursor_state = OFF; resetXtermGC(xw, flags, in_selection); + refresh_displayed_graphics(screen, + screen->cursorp.col, + screen->cursorp.row, + 1, 1); + return; } @@ -9809,6 +9834,8 @@ ReallyReset(XtermWidget xw, Bool full, Bool saved) bitclr(&xw->flags, PROTECTED); screen->protected_mode = OFF_PROTECT; + reset_displayed_graphics(screen); + if (full) { /* RIS */ if (screen->bellOnReset) Bell(xw, XkbBI_TerminalBell, 0); @@ -9833,9 +9860,17 @@ ReallyReset(XtermWidget xw, Bool full, Bool saved) xw->keyboard.flags |= MODE_DECBKM; TRACE(("full reset DECBKM %s\n", BtoS(xw->keyboard.flags & MODE_DECBKM))); +#if OPT_SIXEL_GRAPHICS + if (TScreenOf(xw)->sixel_scrolling) /* FIXME: should this be off unconditionally here? */ + xw->keyboard.flags |= MODE_DECSDM; + TRACE(("full reset DECSDM %s (resource default is %d)\n", + BtoS(xw->keyboard.flags & MODE_DECSDM), + TScreenOf(xw)->sixel_scrolling)); +#endif update_appcursor(); update_appkeypad(); update_decbkm(); + update_decsdm(); show_8bit_control(False); reset_decudk(); diff --git a/app/xterm/configure.in b/app/xterm/configure.in index c05419cfd..e439d76c7 100644 --- a/app/xterm/configure.in +++ b/app/xterm/configure.in @@ -1,4 +1,4 @@ -dnl $XTermId: configure.in,v 1.316 2013/05/27 13:46:02 tom Exp $ +dnl $XTermId: configure.in,v 1.318 2013/06/23 21:39:24 tom Exp $ dnl dnl ----------------------------------------------------------------------------- dnl this file is part of xterm @@ -904,6 +904,19 @@ if test "$enable_dec_locator" = yes ; then AC_DEFINE(OPT_DEC_LOCATOR,1,[Define to 1 to enable DECterm Locator support]) fi +AC_MSG_CHECKING(if you want sixel graphics support) +CF_ARG_ENABLE(sixel-graphics, + [ --enable-sixel-graphics enable sixel graphics support], + [enable_sixel_graphics=yes], + [enable_sixel_graphics=no]) +AC_MSG_RESULT($enable_sixel_graphics) +if test "$enable_sixel_graphics" = yes ; then + AC_DEFINE(OPT_SIXEL_GRAPHICS,1,[Define to 1 to enable sixel graphics support]) + EXTRAHDRS="$EXTRAHDRS graphics.h" + EXTRASRCS="$EXTRASRCS graphics.c" + EXTRAOBJS="$EXTRAOBJS graphics.o" +fi + AC_MSG_CHECKING(if you want VT420 rectangle support) CF_ARG_DISABLE(rectangles, [ --disable-rectangles disable VT420 rectangle support], diff --git a/app/xterm/ctlseqs.ms b/app/xterm/ctlseqs.ms index b99d7be62..c141cbfe9 100644 --- a/app/xterm/ctlseqs.ms +++ b/app/xterm/ctlseqs.ms @@ -1,6 +1,6 @@ .\"#! troff -ms $1 -*- Nroff -*- .\" "Xterm Control Sequences" document -.\" $XTermId: ctlseqs.ms,v 1.288 2013/04/24 09:49:19 tom Exp $ +.\" $XTermId: ctlseqs.ms,v 1.295 2013/07/05 20:14:27 tom Exp $ .\" .\" .\" Copyright 1996-2012,2013 by Thomas E. Dickey @@ -69,8 +69,8 @@ .\" .ds XT XTerm .ds xt xterm -.ds LF Patch #292 -.ds RF 2013/04/24 +.ds LF Patch #294 +.ds RF 2013/07/05 .\" .if n .pl 9999v \" no page breaks in nroff .ND @@ -88,7 +88,7 @@ .. .\" Bulleted paragraph .de bP -.IP \(bu 4 +.IP \(bu 0.2i .. .\" Normal leading paragraph .de lP @@ -165,7 +165,7 @@ .[] Sg \v'-1p'\s\nsSPA\s0\v'1p' .[] Dc \v'-1p'\s\nsDCS\s0\v'1p' .[] Ht \v'-1p'\s\nsHTS\s0\v'1p' -.[] ID \v'-1p'\s\nsIND\s0\v'1p' +.[] Id \v'-1p'\s\nsIND\s0\v'1p' .[] Nl \v'-1p'\s\nsNEL\s0\v'1p' .[] Os \v'-1p'\s\nsOSC\s0\v'1p' .[] RI \v'-1p'\s\nsRI\s0\v'1p' @@ -288,11 +288,13 @@ .ds Cb \fIC\v'.3m'\h'-.2m'\s-2b\s0\v'-.3m'\fP .ds Cx \fIC\v'.3m'\h'-.2m'\s-2x\s0\v'-.3m'\fP .ds Cy \fIC\v'.3m'\h'-.2m'\s-2y\s0\v'-.3m'\fP +.ds Pa \fIP\v'.3m'\h'-.2m'\s-2a\s0\v'-.3m'\fP .ds Pb \fIP\v'.3m'\h'-.2m'\s-2b\s0\v'-.3m'\fP .ds Pc \fIP\v'.3m'\h'-.2m'\s-2c\s0\v'-.3m'\fP .ds Pd \fIP\v'.3m'\h'-.2m'\s-2d\s0\v'-.3m'\fP .ds Pe \fIP\v'.3m'\h'-.2m'\s-2e\s0\v'-.3m'\fP .ds Pg \fIP\v'.3m'\h'-.2m'\s-2g\s0\v'-.3m'\fP +.ds Ph \fIP\v'.3m'\h'-.2m'\s-2h\s0\v'-.3m'\fP .ds Pi \fIP\v'.3m'\h'-.2m'\s-2i\s0\v'-.3m'\fP .ds Pl \fIP\v'.3m'\h'-.2m'\s-2l\s0\v'-.3m'\fP .ds Pm \fIP\v'.3m'\h'-.2m'\s-2m\s0\v'-.3m'\fP @@ -328,7 +330,7 @@ X Consortium (1994) Thomas Dickey .AI XFree86 Project (1996-2006) -invisible-island.net (2006-2012) +invisible-island.net (2006-2013) updated for \*(XT \*(LF (\*(RF) .AU . @@ -356,7 +358,7 @@ It generates 7-bit controls (by default) or 8-bit if S8C1T is enabled. The following pairs of 7-bit and 8-bit control characters are equivalent: .St .IP \\*(Es\\*D -Index (\*(ID is 0x84). +Index (\*(Id is 0x84). .IP \\*(Es\\*E Next Line (\*(Nl is 0x85). .IP \\*(Es\\*H @@ -401,13 +403,18 @@ but there is support for later DEC VT terminals as well as ISO 6429 and \fIaixterm\fP color controls. The only VT102 feature not supported is auto-repeat, since the only way X provides for this will affect all windows. +.LP There are additional control sequences to provide \fIxterm-\fPdependent functions, such as the scrollbar or window size. Where the function is specified by DEC or ISO 6429, the code assigned to it is given in parentheses. +.LP The escape codes to designate and invoke character sets are specified by ISO 2022; see that document for a discussion of character sets. +.LP +Many of the features are optional; +\fI\*(xt\fP can be configured and built without support for them. . .St .\" @@ -660,7 +667,7 @@ and \fIxterm\fP responds with \*(Dc\*1\*+\*r\*(Pt\*s\*(ST for valid requests, adding to \*(Pt an \*=, -and the value of the corresponding string that \*(xt would send, +and the value of the corresponding string that \fI\*(xt\fP would send, or \*(Dc\*0\*+\*r\*(Pt\*s\*(ST for invalid requests. @@ -1114,6 +1121,21 @@ Device Status Report (DSR). \*(Ps = \*6 \(-> Report Cursor Position (CPR) [row;column]. Result is .br \*(Cs\*(Ir\*s\*;\*(Ic\*s\*R +.sp +\fBNote\fP: +it is possible for this sequence to be sent by a function key. +For example, with the default keyboard configuration +the shifted F1 key may send (with shift-, control-, alt-modifiers) +.br + \*(Cs\*1\*s\*;\*2\*s\*R, or + \*(Cs\*1\*s\*;\*5\*s\*R, or + \*(Cs\*1\*s\*;\*6\*s\*R, etc. +.br +The second parameter encodes the modifiers; values range from 2 to 16. +See the section \fBPC-Style Function Keys\fP for the codes. +The \fBmodifyFunctionKeys\fP and \fBmodifyKeyboard\fP resources +can change the form of the string sent from the modified F1 key. +.sp . .IP \\*(Cs\\*>\\*(Ps\\*s\\*n Disable modifiers which may be enabled via the @@ -1153,6 +1175,12 @@ The last two parameters apply to VT400 & up, and denote keyboard ready and LK01 \*(Ps = \*5\*3 \(-> Report Locator status as \*(Cs\*?\*5\*3\*n Locator available, if compiled-in, or \*(Cs\*?\*5\*0\*n No Locator, if not. + \*(Ps = \*5\*5 \(-> Report Locator status as +\*(Cs\*?\*5\*3\*n Locator available, if compiled-in, or +\*(Cs\*?\*5\*0\*n No Locator, if not. + \*(Ps = \*5\*6 \(-> Report Locator type as +\*(Cs\*?\*5\*7\*;\*1\*n Mouse, if compiled-in, or +\*(Cs\*?\*5\*7\*;\*0\*n Cannot identify, if not. \*(Ps = \*6\*2 \(-> Report macro space (DECMSR) as \*(Cs\*(Pn\*s\\*\*s\*{ \*(Ps = \*6\*3 \(-> Report memory checksum (DECCKSR) as @@ -1439,7 +1467,7 @@ Request Locator Position (DECRQLP). Valid values for the parameter are: \*(Ps = \*0, 1 or omitted \(-> transmit a single DECLRP locator report. .sP -If Locator Reporting has been enabled by a DECELR, \*(xt will respond +If Locator Reporting has been enabled by a DECELR, \fI\*(xt\fP will respond with a DECLRP Locator Report. This report is also generated on button up and down events if they have been enabled with a DECSLE, or when @@ -1452,7 +1480,7 @@ Parameters are [event;button;row;column;page]. .br Valid values for the event: \*(Pe = \*0 \(-> locator unavailable - no other parameters sent. - \*(Pe = \*1 \(-> request - \*(xt received a DECRQLP. + \*(Pe = \*1 \(-> request - \fI\*(xt\fP received a DECRQLP. \*(Pe = \*2 \(-> left button down. \*(Pe = \*3 \(-> left button up. \*(Pe = \*4 \(-> middle button down. @@ -1471,7 +1499,7 @@ Valid values for the event: \*(Pb & \*8 \(<- M4 button down. .br ``row'' and ``column'' parameters are the coordinates of the locator -position in the \*(xt window, encoded as ASCII decimal. +position in the \fI\*(xt\fP window, encoded as ASCII decimal. .br The ``page'' parameter is not used by \*(xt, and will be omitted. . @@ -1509,7 +1537,7 @@ their bright versions 8-15, and if supported, the remainder of the 88-color or 256-color table. .sP If a "?" is given rather than a name or RGB specification, -\*(xt replies with a control sequence of the same form which can be used +\fI\*(xt\fP replies with a control sequence of the same form which can be used to set the corresponding color. Because more than one pair of color number and specification can be given in one control sequence, \fIxterm\fR can make more than one reply. @@ -1539,7 +1567,7 @@ The value of \*(Ps tells the starting point in the list. The colors are specified by name or RGB specification as per \fIXParseColor\fP. .sP If a "?" is given rather than a name or RGB specification, -\*(xt replies with a control sequence of the same form which can be used +\fI\*(xt\fP replies with a control sequence of the same form which can be used to set the corresponding dynamic color. Because more than one pair of color number and specification can be given in one control sequence, \fIxterm\fR can make more than one reply. @@ -1650,7 +1678,7 @@ Common keyboard configurations assign the \fIMeta\fP modifier to an "Alt" key. By using \fIxmodmap\fP one may have the modifier assigned to a different key, and have "real" alt and meta keys. Here is an example: -.DS B +.ID ! put meta on mod3 to distinguish it from alt keycode 64 = Alt_L clear mod1 @@ -1845,7 +1873,7 @@ Code Modifiers _ .TH .T& -l | l . +c | l . 2 Shift 3 Alt 4 Shift + Alt @@ -1853,6 +1881,14 @@ l | l . 6 Shift + Control 7 Alt + Control 8 Shift + Alt + Control +9 Meta +10 Meta + Shift +11 Meta + Alt +12 Meta + Alt + Shift +13 Meta + Ctrl +14 Meta + Ctrl + Shift +15 Meta + Ctrl + Alt +16 Meta + Ctrl +Alt + Shift _ .TE For example, shift-F5 would be sent as @@ -2120,7 +2156,7 @@ control sequence. Manifest constants for the parameter values are defined in \fBxcharmouse.h\fP as follows: . -.DS B +.ID #define SET_X10_MOUSE 9 #define SET_VT200_MOUSE 1000 #define SET_VT200_HIGHLIGHT_MOUSE 1001 @@ -2240,10 +2276,10 @@ otherwise: .br The parameters are \fIstartx, starty, endx, endy, mousex,\fP and \fImousey.\fP .RS -.IP \- 5 +.IP \- 0.2i \fIstartx, starty, endx, \fPand\fI endy\fP give the starting and ending character positions of the region. -.IP \- 5 +.IP \- 0.2i \fImousex\fP and \fImousey\fP give the location of the mouse at button up, which may not be over a character. @@ -2341,6 +2377,38 @@ and the Window manipulation controls. For these reasons, the 1015 control is not recommended; it is not an improvement over 1005. . +.Sh "Sixel Graphics" +.LP +If \fI\*(xt\fP is configured as +VT240, +VT241, +VT330 or +VT340 +using the \fBdecTerminalID\fP resource, +it supports Sixel Graphics controls, a subset of ReGIS graphics. +.St +.IP \\*(Cs\\*(Ps\\*s\\*c +\fI\*(xt\fP responds to Send Device Attributes (Primary DA) with these +additional codes: + \*(Ps = \*3 \(-> ReGIS graphics. + \*(Ps = \*4 \(-> SIXEL graphics. +.IP \\*(Cs\\*?\\*(Pm\\*s\\*h +\fI\*(xt\fP has these additional private Set Mode values: + \*(Ps = \*8\*0 \(-> SIXEL scrolling. + \*(Ps = \*1\*0\*7\*0 \(-> use private color registers for each graphic. +.IP \\*(Dc\\*(Pa\\*;\\*(Pb\\*;\\*(Ph\\*s\\*q\\*s\\*(Ps..\\*(Ps\fP\\*(ST +See +.ID +http://vt100.net/docs/vt3xx-gp/chapter14.html +.DE +The sixel data device control string has three positional parameters, +following the \*q with sixel data. + \*(Pa \(-> pixel aspect ratio + \*(Pb \(-> background color option + \*(Ph \(-> horizontal grid size (ignored). + \*(Ps \(-> sixel data +.Ed +. .Sh "Tektronix 4014 Mode" .LP Most of these sequences are standard Tektronix 4014 control sequences. diff --git a/app/xterm/ctlseqs.txt b/app/xterm/ctlseqs.txt index 247ae7ac1..c5058cb0f 100644 --- a/app/xterm/ctlseqs.txt +++ b/app/xterm/ctlseqs.txt @@ -20,8 +20,8 @@ Thomas Dickey XFree86 Project (1996-2006) - invisible-island.net (2006-2012) - updated for XTerm Patch #292 (2013/04/24) + invisible-island.net (2006-2013) + updated for XTerm Patch #294 (2013/07/05) @@ -89,12 +89,15 @@ Most of these control sequences are standard VT102 control sequences, but there is support for later DEC VT terminals (i.e., VT220, VT320, VT420, VT510), as well as ISO 6429 and aixterm color controls. The only VT102 feature not supported is auto-repeat, since the only way X pro- -vides for this will affect all windows. There are additional control -sequences to provide xterm-dependent functions, such as the scrollbar or -window size. Where the function is specified by DEC or ISO 6429, the -code assigned to it is given in parentheses. The escape codes to desig- -nate and invoke character sets are specified by ISO 2022; see that docu- -ment for a discussion of character sets. +vides for this will affect all windows. +There are additional control sequences to provide xterm-dependent func- +tions, such as the scrollbar or window size. Where the function is +specified by DEC or ISO 6429, the code assigned to it is given in paren- +theses. +The escape codes to designate and invoke character sets are specified by +ISO 2022; see that document for a discussion of character sets. +Many of the features are optional; xterm can be configured and built +without support for them. Single-character functions BEL Bell (Ctrl-G). @@ -579,11 +582,11 @@ CSI Pm m Character Attributes (SGR). Xterm maintains a color palette whose entries are identified by an index beginning with zero. If 88- or 256-color support is compiled, the following apply: - o All parameters are decimal integers. - o RGB values range from zero (0) to 255. - o ISO-8613-3 can be interpreted in more than one way; xterm - allows the semicolons in this control to be replaced by - colons (but after the first colon, colons must be used). + o All parameters are decimal integers. + o RGB values range from zero (0) to 255. + o ISO-8613-3 can be interpreted in more than one way; xterm + allows the semicolons in this control to be replaced by + colons (but after the first colon, colons must be used). These ISO-8613-3 controls are supported: Ps = 3 8 ; 2 ; Pr ; Pg ; Pb -> Set foreground color to the @@ -614,6 +617,20 @@ CSI Ps n Device Status Report (DSR). Ps = 6 -> Report Cursor Position (CPR) [row;column]. Result is CSI r ; c R + + Note: it is possible for this sequence to be sent by a func- + tion key. For example, with the default keyboard configura- + tion the shifted F1 key may send (with shift-, control-, alt- + modifiers) + CSI 1 ; 2 R , or + CSI 1 ; 5 R , or + CSI 1 ; 6 R , etc. + The second parameter encodes the modifiers; values range from + 2 to 16. See the section PC-Style Function Keys for the + codes. The modifyFunctionKeys and modifyKeyboard resources + can change the form of the string sent from the modified F1 + key. + CSI > Ps n Disable modifiers which may be enabled via the CSI > Ps; Ps m sequence. This corresponds to a resource value of "-1", which @@ -642,6 +659,10 @@ CSI ? Ps n board ready and LK01 respectively. Ps = 5 3 -> Report Locator status as CSI ? 5 3 n Locator available, if compiled-in, or CSI ? 5 0 n No Locator, if not. + Ps = 5 5 -> Report Locator status as CSI ? 5 3 n Locator + available, if compiled-in, or CSI ? 5 0 n No Locator, if not. + Ps = 5 6 -> Report Locator type as CSI ? 5 7 ; 1 n Mouse, + if compiled-in, or CSI ? 5 7 ; 0 n Cannot identify, if not. Ps = 6 2 -> Report macro space (DECMSR) as CSI Pn \* { Ps = 6 3 -> Report memory checksum (DECCKSR) as DCS Pt ! x x x x ST @@ -1068,13 +1089,13 @@ keyboard configurations assign the Meta modifier to an "Alt" key. By using xmodmap one may have the modifier assigned to a different key, and have "real" alt and meta keys. Here is an example: - ! put meta on mod3 to distinguish it from alt - keycode 64 = Alt_L - clear mod1 - add mod1 = Alt_L - keycode 115 = Meta_L - clear mod3 - add mod3 = Meta_L + ! put meta on mod3 to distinguish it from alt + keycode 64 = Alt_L + clear mod1 + add mod1 = Alt_L + keycode 115 = Meta_L + clear mod3 + add mod3 = Meta_L The metaSendsEscape resource (and altSendsEscape if altIsNotMeta is set) @@ -1216,16 +1237,24 @@ In normal mode, i.e., a Sun/PC keyboard when the sunKeyboard resource is false, xterm recognizes function key modifiers which are parameters appended before the final character of the control sequence. - Code Modifiers - ---------+----------------------- - 2 | Shift - 3 | Alt - 4 | Shift + Alt - 5 | Control - 6 | Shift + Control - 7 | Alt + Control - 8 | Shift + Alt + Control - ---------+----------------------- + Code Modifiers + ---------+-------------------------- + 2 | Shift + 3 | Alt + 4 | Shift + Alt + 5 | Control + 6 | Shift + Control + 7 | Alt + Control + 8 | Shift + Alt + Control + 9 | Meta + 10 | Meta + Shift + 11 | Meta + Alt + 12 | Meta + Alt + Shift + 13 | Meta + Ctrl + 14 | Meta + Ctrl + Shift + 15 | Meta + Ctrl + Alt + 16 | Meta + Ctrl +Alt + Shift + ---------+-------------------------- For example, shift-F5 would be sent as CSI 1 5 ; 2 ~ @@ -1424,8 +1453,8 @@ tion on button presses. These modes are typically used by editors and other full-screen applications that want to make use of the mouse. There are two sets of mutually exclusive modes: -o mouse protocol -o protocol encoding +o mouse protocol +o protocol encoding The mouse protocols include DEC Locator mode, enabled by the DECELR CSI Ps ; Ps ' z control sequence, and is not described here (control @@ -1436,19 +1465,19 @@ protocols are each enabled (or disabled) by a different parameter in the Manifest constants for the parameter values are defined in xcharmouse.h as follows: - #define SET_X10_MOUSE 9 - #define SET_VT200_MOUSE 1000 - #define SET_VT200_HIGHLIGHT_MOUSE 1001 - #define SET_BTN_EVENT_MOUSE 1002 - #define SET_ANY_EVENT_MOUSE 1003 + #define SET_X10_MOUSE 9 + #define SET_VT200_MOUSE 1000 + #define SET_VT200_HIGHLIGHT_MOUSE 1001 + #define SET_BTN_EVENT_MOUSE 1002 + #define SET_ANY_EVENT_MOUSE 1003 - #define SET_FOCUS_EVENT_MOUSE 1004 + #define SET_FOCUS_EVENT_MOUSE 1004 - #define SET_EXT_MODE_MOUSE 1005 - #define SET_SGR_EXT_MODE_MOUSE 1006 - #define SET_URXVT_EXT_MODE_MOUSE 1015 + #define SET_EXT_MODE_MOUSE 1005 + #define SET_SGR_EXT_MODE_MOUSE 1006 + #define SET_URXVT_EXT_MODE_MOUSE 1015 - #define SET_ALTERNATE_SCROLL 1007 + #define SET_ALTERNATE_SCROLL 1007 The motion reporting modes are strictly xterm extensions, and are not part of any standard, though they are analogous to the DEC VT200 DECELR @@ -1466,26 +1495,26 @@ X10 compatibility mode sends an escape sequence only on button press, encoding the location and the mouse button pressed. It is enabled by specifying parameter 9 to DECSET. On button press, xterm sends CSI M CbCxCy (6 characters). -o Cb is button-1. -o Cx and Cy are the x and y coordinates of the mouse when the button - was pressed. +o Cb is button-1. +o Cx and Cy are the x and y coordinates of the mouse when the button was + pressed. Normal tracking mode Normal tracking mode sends an escape sequence on both button press and release. Modifier key (shift, ctrl, meta) information is also sent. It is enabled by specifying parameter 1000 to DECSET. On button press or release, xterm sends CSI M CbCxCy. -o The low two bits of Cb encode button information: 0=MB1 pressed, - 1=MB2 pressed, 2=MB3 pressed, 3=release. -o The next three bits encode the modifiers which were down when the - button was pressed and are added together: 4=Shift, 8=Meta, 16=Con- - trol. Note however that the shift and control bits are normally - unavailable because xterm uses the control modifier with mouse for - popup menus, and the shift modifier is used in the default transla- - tions for button events. The Meta modifier recognized by xterm is - the mod1 mask, and is not necessarily the "Meta" key (see xmodmap). -o Cx and Cy are the x and y coordinates of the mouse event, encoded as - in X10 mode. +o The low two bits of Cb encode button information: 0=MB1 pressed, 1=MB2 + pressed, 2=MB3 pressed, 3=release. +o The next three bits encode the modifiers which were down when the but- + ton was pressed and are added together: 4=Shift, 8=Meta, 16=Control. + Note however that the shift and control bits are normally unavailable + because xterm uses the control modifier with mouse for popup menus, + and the shift modifier is used in the default translations for button + events. The Meta modifier recognized by xterm is the mod1 mask, and + is not necessarily the "Meta" key (see xmodmap). +o Cx and Cy are the x and y coordinates of the mouse event, encoded as + in X10 mode. Wheel mice Wheel mice may return buttons 4 and 5. Those buttons are represented by @@ -1520,15 +1549,15 @@ location tracks the mouse, but will never be above row firstrow and will always be above row lastrow. (The top of the screen is row 1.) When the button is released, xterm reports the ending position one of two ways: -o if the start and end coordinates are the same locations: - CSI t CxCy. -o otherwise: - CSI T CxCyCxCyCxCy. - The parameters are startx, starty, endx, endy, mousex, and mousey. - - startx, starty, endx, and endy give the starting and ending - character positions of the region. - - mousex and mousey give the location of the mouse at button up, - which may not be over a character. +o if the start and end coordinates are the same locations: + CSI t CxCy. +o otherwise: + CSI T CxCyCxCyCxCy. + The parameters are startx, starty, endx, endy, mousex, and mousey. + - startx, starty, endx, and endy give the starting and ending charac- + ter positions of the region. + - mousex and mousey give the location of the mouse at button up, which + may not be over a character. Button-event tracking Button-event tracking is essentially the same as normal tracking, but @@ -1536,14 +1565,13 @@ xterm also reports button-motion events. Motion events are reported only if the mouse pointer has moved to a different character cell. It is enabled by specifying parameter 1002 to DECSET. On button press or release, xterm sends the same codes used by normal tracking mode. -o On button-motion events, xterm adds 32 to the event code (the third - character, Cb). -o The other bits of the event code specify button and modifier keys as - in normal mode. For example, motion into cell x,y with button 1 - down is reported as CSI M @ CxCy. ( @ = 32 + 0 (button 1) + 32 - (motion indicator) ). Similarly, motion with button 3 down is - reported as CSI M B CxCy. ( B = 32 + 2 (button 3) + 32 (motion - indicator) ). +o On button-motion events, xterm adds 32 to the event code (the third + character, Cb). +o The other bits of the event code specify button and modifier keys as + in normal mode. For example, motion into cell x,y with button 1 down + is reported as CSI M @ CxCy. ( @ = 32 + 0 (button 1) + 32 (motion + indicator) ). Similarly, motion with button 3 down is reported as CSI + M B CxCy. ( B = 32 + 2 (button 3) + 32 (motion indicator) ). Any-event tracking Any-event mode is the same as button-event mode, except that all motion @@ -1581,14 +1609,13 @@ SGR (1006) semicolon-separated encoded button value, the Cx and Cy ordi- nates and a final character which is M for button press and m for button release. - o The encoded button value in this case does not add 32 - since that was useful only in the X10 scheme for ensuring - that the byte containing the button value is a printable - code. - o The modifiers are encoded in the same way. - o A different final character is used for button release to - resolve the X10 ambiguity regarding which button was - released. + o The encoded button value in this case does not add 32 since + that was useful only in the X10 scheme for ensuring that the + byte containing the button value is a printable code. + o The modifiers are encoded in the same way. + o A different final character is used for button release to + resolve the X10 ambiguity regarding which button was + released. The highlight tracking responses are also modified to an SGR- like format, using the same SGR-style scheme and button-encod- ings. @@ -1604,6 +1631,32 @@ URXVT (1015) sons, the 1015 control is not recommended; it is not an improvement over 1005. +Sixel Graphics +If xterm is configured as VT240, VT241, VT330 or VT340 using the decTer- +minalID resource, it supports Sixel Graphics controls, a subset of ReGIS +graphics. + +CSI Ps c xterm responds to Send Device Attributes (Primary DA) with + these additional codes: + Ps = 3 -> ReGIS graphics. + Ps = 4 -> SIXEL graphics. +CSI ? Pm h + xterm has these additional private Set Mode values: + Ps = 8 0 -> SIXEL scrolling. + Ps = 1 0 7 0 -> use private color registers for each + graphic. +DCS Pa; Pb; Ph q Ps..PsST + See + + http://vt100.net/docs/vt3xx-gp/chapter14.html + + The sixel data device control string has three positional + parameters, following the q with sixel data. + Pa -> pixel aspect ratio + Pb -> background color option + Ph -> horizontal grid size (ignored). + Ps -> sixel data + Tektronix 4014 Mode Most of these sequences are standard Tektronix 4014 control sequences. Graph mode supports the 12-bit addressing of the Tektronix 4014. The diff --git a/app/xterm/graphics.c b/app/xterm/graphics.c new file mode 100644 index 000000000..9bdc50c02 --- /dev/null +++ b/app/xterm/graphics.c @@ -0,0 +1,1475 @@ +/* $XTermId: graphics.c,v 1.12 2013/07/10 22:35:28 Ross.Combs Exp $ */ + +/* + * Copyright 2013 by Ross Combs + * + * All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization. + */ + +#include <xterm.h> + +#include <stdio.h> +#include <math.h> +#include <ctype.h> +#include <stdlib.h> + +#include <data.h> +#include <VTparse.h> +#include <ptyx.h> + +#include <assert.h> +#include <graphics.h> + +#undef DUMP_SIXEL_BITMAP +#undef DEBUG_REFRESH + +/* TODO: + * ReGIS: + * - everything + * sixel: + * - erase graphic when erasing screen + * - maintain ordered list/array instead of qsort() + * - erase text under graphics if bg not transparent + * - erase scrolled portions of all graphics on alt buffer + * - delete graphic if scrolled past end of scrollback + * - delete graphic if all pixels are transparent/erased + * - dynamic memory allocation, add configurable limits + * - auto convert color graphics in VT330 mode + * - investigate second graphic framebuffer for ReGIS -- does this apply to text and sixel graphics? + * - fix problem where new_row < 0 during sixel parsing (see FIXME) + * VT55/VT105 waveform graphics + * - everything + * escape sequences + * - way to query font size without "window ops" (or make "window ops" permissions more fine grained) + * - way to query and/or set the maximum number of color registers + */ + +/* font sizes: + * VT510: + * 80 Columns 132 Columns Maximum Number of Lines + * 10 x 16 6 x 16 26 lines + keyboard indicator line + * 10 x 10 6 x 10 42 lines + keyboard indicator line + * 10 x 8 6 x 8 53 lines + keyboard indicator line + * 10 x 13 6 x 13 26 lines + keyboard indicator line +*/ + +/***====================================================================***/ +/* + * Parse numeric parameters which have the operator as a prefix rather than a + * suffix as in ANSI format. + * + * # 0 + * #1 1 + * #1; 1 + * "1;2;640;480 4 + * #1;2;0;0;0 5 + */ +static void +parse_prefixedtype_params(ANSI *params, const char **string) +{ + const char *cp = *string; + ParmType nparam = 0; + int last_empty = 1; + + memset(params, 0, sizeof(*params)); + params->a_final = CharOf(*cp); + if (*cp != '\0') + cp++; + + while (*cp != '\0') { + Char ch = CharOf(*cp); + + if (isdigit(ch)) { + last_empty = 0; + if (nparam < NPARAM) { + params->a_param[nparam] = + (ParmType) ((params->a_param[nparam] * 10) + + (ch - '0')); + } + } else if (ch == ';') { + last_empty = 1; + nparam++; + } else if (ch == ' ' || ch == '\r' || ch == '\n') { + /* EMPTY */ ; + } else { + break; + } + cp++; + } + + *string = cp; + if (!last_empty) + nparam++; + if (nparam > NPARAM) + params->a_nparam = NPARAM; + else + params->a_nparam = nparam; +} + +typedef struct { + Pixel pix; + short r, g, b; + short allocated; +} ColorRegister; + +#define MAX_COLOR_REGISTERS 256U +#define COLOR_HOLE ((unsigned short)MAX_COLOR_REGISTERS) +#define BUFFER_WIDTH 1000 +#define BUFFER_HEIGHT 800 +typedef struct { + RegisterNum pixels[BUFFER_HEIGHT * BUFFER_WIDTH]; + ColorRegister private_color_registers[MAX_COLOR_REGISTERS]; + ColorRegister *color_registers; + char color_registers_used[MAX_COLOR_REGISTERS]; + XtermWidget xw; + int max_width; /* largest image which can be stored */ + int max_height; /* largest image which can be stored */ + RegisterNum current_register; + int valid_registers; /* for wrap-around behavior */ + int device_background; /* 0: set to color 0, 1: unchanged */ + int background; /* current background color */ + int aspect_vertical; + int aspect_horizontal; + int declared_width; /* size as reported by the application */ + int declared_height; /* size as reported by the application */ + int actual_width; /* size measured during parsing */ + int actual_height; /* size measured during parsing */ + int private_colors; /* if not using the shared color registers */ + int charrow; /* upper left starting point in characters */ + int charcol; /* upper left starting point in characters */ + int pixw; /* width of graphic pixels in screen pixels */ + int pixh; /* height of graphic pixels in screen pixels */ + int row; /* context used during parsing */ + int col; /* context used during parsing */ + int bufferid; /* which screen buffer the graphic is associated with */ + unsigned int id; /* sequential id used for preserving layering */ + int valid; /* if the graphic has been initialized */ + int dirty; /* if the graphic needs to be redrawn */ +} SixelGraphic; + +static unsigned int next_sixel_id = 0U; + +static ColorRegister shared_color_registers[MAX_COLOR_REGISTERS]; + +#define MAX_SIXEL_GRAPHICS 16U +static SixelGraphic sixel_graphics[MAX_SIXEL_GRAPHICS]; + +/* sixel scrolling: + * VK100/GIGI ? (did it even support Sixel?) + * VT125 unsupported + * VT240 unsupported + * VT241 unsupported + * VT330 mode setting + * VT340 mode setting + * dxterm ? + */ + +static void +init_sixel_background(SixelGraphic *graphic) +{ + RegisterNum bgcolor = (RegisterNum) graphic->background; + int r, c; + + TRACE(("initializing sixel background to size=%dx%d bgcolor=%hu\n", + graphic->declared_width, + graphic->declared_height, + bgcolor)); + for (r = 0; r < graphic->max_height; r++) { + for (c = 0; c < graphic->max_width; c++) { + if (c < graphic->declared_width && r < graphic->declared_height) { + graphic->pixels[r * graphic->max_width + c] = bgcolor; + } else { + graphic->pixels[r * graphic->max_width + c] = COLOR_HOLE; + } + } + } +} + +static void +set_sixel(SixelGraphic *graphic, int sixel) +{ + RegisterNum color; + int pix; + + color = graphic->current_register; + TRACE(("drawing sixel at pos=%d,%d color=%hu (hole=%d, [%d,%d,%d])\n", + graphic->col, + graphic->row, + color, + color == COLOR_HOLE, + ((color != COLOR_HOLE) + ? (unsigned int) graphic->color_registers[color].r : 0U), + ((color != COLOR_HOLE) + ? (unsigned int) graphic->color_registers[color].g : 0U), + ((color != COLOR_HOLE) + ? (unsigned int) graphic->color_registers[color].b : 0U))); + for (pix = 0; pix < 6; pix++) { + if (graphic->col < graphic->max_width && + graphic->row + pix < graphic->max_height) { + if (sixel & (1 << pix)) { + if (graphic->col + 1 > graphic->actual_width) { + graphic->actual_width = graphic->col + 1; + } + if (graphic->row + pix + 1 > graphic->actual_height) { + graphic->actual_height = graphic->row + pix + 1; + } + graphic->pixels[ + (((graphic->row + pix) * graphic->max_width) + + graphic->col) + ] = color; + } + } else { + TRACE(("sixel pixel %d out of bounds\n", pix)); + } + } +} + +static void +set_sixel_color_register(ColorRegister *color_registers, + RegisterNum color, + short r, + short g, + short b) +{ + ColorRegister *reg = &color_registers[color]; + reg->r = r; + reg->g = g; + reg->b = b; + reg->allocated = 0; +} + +static void +init_color_registers(ColorRegister *color_registers, int terminal_id) +{ + TRACE(("initializing colors for %d\n", terminal_id)); + { + unsigned int i; + + for (i = 0U; i < MAX_COLOR_REGISTERS; i++) { + set_sixel_color_register(color_registers, (RegisterNum) i, 0, 0, 0); + } + } + + /* + * default color registers: + * (mono) (color) + * VK100/GIGI (fixed) + * VT125: + * 0: 0% 0% + * 1: 33% blue + * 2: 66% red + * 3: 100% green + * VT240: + * 0: 0% 0% + * 1: 33% blue + * 2: 66% red + * 3: 100% green + * VT241: + * 0: 0% 0% + * 1: 33% blue + * 2: 66% red + * 3: 100% green + * VT330: + * 0: 0% 0% (bg for light on dark mode) + * 1: 33% blue (red?) + * 2: 66% red (green?) + * 3: 100% green (yellow?) (fg for light on dark mode) + * VT340: + * 0: 0% 0% (bg for light on dark mode) + * 1: 14% blue + * 2: 29% red + * 3: 43% green + * 4: 57% magenta + * 5: 71% cyan + * 6: 86% yellow + * 7: 100% 50% (fg for light on dark mode) + * 8: 0% 25% + * 9: 14% gray-blue + * 10: 29% gray-red + * 11: 43% gray-green + * 12: 57% gray-magenta + * 13: 71% gray-cyan + * 14: 86% gray-yellow + * 15: 100% 75% + * dxterm: + * ? + */ + switch (terminal_id) { + case 125: + case 241: + set_sixel_color_register(color_registers, 0, 0, 0, 0); + set_sixel_color_register(color_registers, 1, 0, 0, 100); + set_sixel_color_register(color_registers, 2, 0, 100, 0); + set_sixel_color_register(color_registers, 3, 100, 0, 0); + break; + case 240: + case 330: + set_sixel_color_register(color_registers, 0, 0, 0, 0); + set_sixel_color_register(color_registers, 1, 33, 33, 33); + set_sixel_color_register(color_registers, 2, 66, 66, 66); + set_sixel_color_register(color_registers, 3, 100, 100, 100); + break; + case 340: + default: + set_sixel_color_register(color_registers, 0, 0, 0, 0); + set_sixel_color_register(color_registers, 1, 20, 20, 80); + set_sixel_color_register(color_registers, 2, 80, 13, 13); + set_sixel_color_register(color_registers, 3, 20, 80, 20); + set_sixel_color_register(color_registers, 4, 80, 20, 80); + set_sixel_color_register(color_registers, 5, 20, 80, 80); + set_sixel_color_register(color_registers, 6, 80, 80, 20); + set_sixel_color_register(color_registers, 7, 53, 53, 53); + set_sixel_color_register(color_registers, 8, 26, 26, 26); + set_sixel_color_register(color_registers, 9, 33, 33, 60); + set_sixel_color_register(color_registers, 10, 60, 26, 26); + set_sixel_color_register(color_registers, 11, 33, 60, 33); + set_sixel_color_register(color_registers, 12, 60, 33, 60); + set_sixel_color_register(color_registers, 13, 33, 60, 60); + set_sixel_color_register(color_registers, 14, 60, 60, 33); + set_sixel_color_register(color_registers, 15, 80, 80, 80); + break; + } +} + +static void +init_sixel_graphic(SixelGraphic *graphic, int terminal_id, int private_colors) +{ + TRACE(("initializing sixel graphic\n")); + + graphic->dirty = 1; + memset(graphic->pixels, 0, sizeof(graphic->pixels)); + memset(graphic->color_registers_used, 0, sizeof(graphic->color_registers_used)); + + /* + * dimensions (REGIS logical, physical): + * VK100/GIGI 768x4?? 768x2?? + * VT125 768x460 768x230(+10status) (1:2 aspect ratio, REGIS halves vertical addresses through "odd y emulation") + * VT240 800x460 800x230(+10status) (1:2 aspect ratio, REGIS halves vertical addresses through "odd y emulation") + * VT241 800x460 800x230(+10status) (1:2 aspect ratio, REGIS halves vertical addresses through "odd y emulation") + * VT330 800x480 800x480(+?status) + * VT340 800x480 800x480(+?status) + * dxterm ?x? variable? + */ + graphic->max_width = BUFFER_WIDTH; + graphic->max_height = BUFFER_HEIGHT; + + /* default isn't white on the VT240, but not sure what it is */ + graphic->current_register = 3; /* FIXME: using green, but not sure what it should be */ + + /* + * When an application selects the monochrome map: the terminal sets the + * 16 entries of the color map to the default monochrome gray level. + * Therefore, the original colors are lost when changing from the color map + * to the monochrome map. + * + * If you change the color value (green, red, blue) using the Color Set-Up + * screen or a ReGIS command, the VT340 sets the gray scale by using the + * formula (2G + R)/3. + * + * When an application selects the color map: the terminal sets the 16 + * entries of the color map to the default (color) color map. + */ + + /* + * color capabilities: + * VK100/GIGI 1 plane (12x1 pixel attribute blocks) colorspace is 8 fixed colors (black, white, red, green, blue, cyan, yellow, magenta) + * VT125 2 planes (4 registers) colorspace is (64?) (color), ? (grayscale) + * VT240 2 planes (4 registers) colorspace is ? shades (grayscale) + * VT241 2 planes (4 registers) colorspace is ? (color), ? shades (grayscale) + * VT330 2 planes (4 registers) colorspace is 4 shades (grayscale) + * VT340 4 planes (16 registers) colorspace is r16g16b16 (color), 16 shades (grayscale) + * dxterm ? + */ + switch (terminal_id) { + case 125: + graphic->valid_registers = 4; + break; + case 240: + graphic->valid_registers = 4; + break; + case 241: + graphic->valid_registers = 4; + break; + case 330: + graphic->valid_registers = 4; + break; + case 340: + graphic->valid_registers = 16; + break; + default: + graphic->valid_registers = 64; /* unknown graphics model -- might as well be generous */ + break; + } + + /* + * text and graphics interactions: + * VK100/GIGI text writes on top of graphics buffer, color attribute shared with text + * VT240,VT241,VT330,VT340 text writes on top of graphics buffer + * VT125 graphics buffer overlaid on top of text in B&W display, text not present in color display + */ + + /* FIXME: is this always zero? what about in light background mode? */ + graphic->device_background = 0; /* default background color register */ + + /* pixel sizes seem to have differed by model and options */ + /* VT240 and VT340 defaulted to 2:1 ratio */ + graphic->aspect_vertical = 2; + graphic->aspect_horizontal = 1; + + graphic->declared_width = 0; + graphic->declared_height = 0; + + graphic->actual_width = 0; + graphic->actual_height = 0; + + graphic->private_colors = private_colors; + if (graphic->private_colors) { + TRACE(("sixel using private color registers\n")); + init_color_registers(graphic->private_color_registers, terminal_id); + graphic->color_registers = graphic->private_color_registers; + } else { + TRACE(("sixel using shared color registers\n")); + graphic->color_registers = shared_color_registers; + } + + graphic->charrow = 0; + graphic->charcol = 0; + + graphic->row = 0; + graphic->col = 0; + + graphic->valid = 0; +} + +static SixelGraphic * +get_sixel_graphic(XtermWidget xw) +{ + TScreen const *screen = TScreenOf(xw); + int bufferid = screen->whichBuf; + int terminal_id = screen->terminal_id; + int private_colors = screen->privatecolorregisters; + SixelGraphic *graphic; + unsigned int ii; + + for (ii = 0U; ii < MAX_SIXEL_GRAPHICS; ii++) { + graphic = &sixel_graphics[ii]; + if (!graphic->valid) + break; + } + + if (ii >= MAX_SIXEL_GRAPHICS) { + int min_charrow = 0; + SixelGraphic *min_graphic = NULL; + + for (ii = 0U; ii < MAX_SIXEL_GRAPHICS; ii++) { + graphic = &sixel_graphics[ii]; + if (!min_graphic || graphic->charrow < min_charrow) { + min_charrow = graphic->charrow; + min_graphic = graphic; + } + } + graphic = min_graphic; + } + + graphic->xw = xw; + graphic->bufferid = bufferid; + graphic->id = next_sixel_id++; + init_sixel_graphic(graphic, terminal_id, private_colors); + return graphic; +} + +static void +dump_sixel(SixelGraphic const *graphic) +{ +#ifdef DUMP_SIXEL_BITMAP + int r, c; + RegisterNum color; + ColorRegister const *reg; +#endif + + (void) graphic; + + TRACE(("sixel stats: charrow=%d charcol=%d actual_width=%d actual_height=%d pixw=%d pixh=%d\n", + graphic->charrow, + graphic->charcol, + graphic->actual_width, + graphic->actual_height, + graphic->pixw, + graphic->pixh)); + +#ifdef DUMP_SIXEL_BITMAP + TRACE(("sixel dump:\n")); + for (r = 0; r < graphic->max_height; r++) { + for (c = 0; c < graphic->max_width; c++) { + color = graphic->pixels[r * graphic->max_width + c]; + if (color == COLOR_HOLE) { + TRACE(("?")); + } else { + reg = &graphic->color_registers[color]; + if (reg->r + reg->g + reg->b > 200) { + TRACE(("#")); + } else if (reg->r + reg->g + reg->b > 150) { + TRACE(("%%")); + } else if (reg->r + reg->g + reg->b > 100) { + TRACE((":")); + } else if (reg->r + reg->g + reg->b > 80) { + TRACE((".")); + } else { + TRACE((" ")); + } + } + } + TRACE(("\n")); + } +#endif + TRACE(("\n")); +} + +static void +set_shared_color_register(RegisterNum color, short r, short g, short b) +{ + SixelGraphic *graphic; + unsigned int ii; + + assert(color < MAX_COLOR_REGISTERS); + + set_sixel_color_register(shared_color_registers, color, r, g, b); + + for (ii = 0U; ii < MAX_SIXEL_GRAPHICS; ii++) { + graphic = &sixel_graphics[ii]; + if (graphic->private_colors) + continue; + + if (graphic->color_registers_used[ii]) { + graphic->dirty = 1; + } + } +} + +#define ScaleForXColor(s) (unsigned short) ((long)(s) * 65535 / 100) + +static Pixel +sixel_register_to_xpixel(ColorRegister *reg, XtermWidget xw) +{ + if (!reg->allocated) { + XColor def; + + def.red = ScaleForXColor(reg->r); + def.green = ScaleForXColor(reg->g); + def.blue = ScaleForXColor(reg->b); + def.flags = DoRed | DoGreen | DoBlue; + if (!allocateBestRGB(xw, &def)) { + return 0UL; + } + reg->pix = def.pixel; + reg->allocated = 1; + } + + /* FIXME: with so many possible colors we need to determine + * when to free them to be nice to PseudoColor displays + */ + return reg->pix; +} + +static void +refresh_sixel_graphic(TScreen const *screen, + SixelGraphic *graphic, + int xbase, + int ybase, + int x, + int y, + int w, + int h) +{ + Display *display = screen->display; + Window vwindow = WhichVWin(screen)->window; + GC graphics_gc; + int r, c; + int wx, wy; + int pw, ph; + RegisterNum color; + RegisterNum old_fg; + XGCValues xgcv; + XtGCMask mask; + int holes, total; + + TRACE(("refreshing sixel graphic from %d,%d %dx%d (valid=%d, bg=%dx%d size=%dx%d, max=%dx%d) at base=%d,%d\n", + x, y, w, h, + graphic->valid, + graphic->declared_width, + graphic->declared_height, + graphic->actual_width, + graphic->actual_height, + graphic->max_width, + graphic->max_height, + xbase, ybase)); + + memset(&xgcv, 0, sizeof(xgcv)); + xgcv.foreground = 0UL; + xgcv.graphics_exposures = False; + mask = GCForeground | GCGraphicsExposures; + graphics_gc = XCreateGC(display, vwindow, mask, &xgcv); + + pw = graphic->pixw; + ph = graphic->pixh; + + TRACE(("refreshed graphic covers 0,0 to %d,%d\n", + (graphic->actual_width - 1) * pw + pw - 1, + (graphic->actual_height - 1) * ph + ph - 1)); + TRACE(("refreshed area covers %d,%d to %d,%d\n", + x, y, + x + w - 1, + y + h - 1)); + + old_fg = COLOR_HOLE; + holes = total = 0; + for (r = 0; r < graphic->actual_height; r++) + for (c = 0; c < graphic->actual_width; c++) { + if (r * ph + ph - 1 < y || + r * ph > y + h - 1 || + c * pw + pw - 1 < x || + c * pw > x + w - 1) + continue; + + wy = ybase + r * ph; + wx = xbase + c * pw; + + total++; + color = graphic->pixels[r * graphic->max_width + c]; + if (color == COLOR_HOLE) { + holes++; + continue; + } + + if (color != old_fg) { + xgcv.foreground = + sixel_register_to_xpixel(&graphic->color_registers[color], + graphic->xw); + XChangeGC(display, graphics_gc, mask, &xgcv); + old_fg = color; + } + + XFillRectangle(display, vwindow, graphics_gc, + wx, wy, (unsigned) pw, (unsigned) ph); + } + +#ifdef DEBUG_REFRESH + { + XColor def; + + def.red = (short) (1.0 * 65535.0); + def.green = (short) (0.1 * 65535.0); + def.blue = (short) (1.0 * 65535.0); + def.flags = DoRed | DoGreen | DoBlue; + if (allocateBestRGB(graphic->xw, &def)) { + xgcv.foreground = def.pixel; + XChangeGC(display, graphics_gc, mask, &xgcv); + } + XFillRectangle(display, vwindow, graphics_gc, + xbase + 0, + ybase + 0, + (unsigned) pw, (unsigned) ph); + XFillRectangle(display, vwindow, graphics_gc, + xbase + (graphic->actual_width - 1) * pw, + ybase + (graphic->actual_height - 1) * ph, + (unsigned) pw, (unsigned) ph); + + def.red = (unsigned short) ((1.0 - 0.1 * (rand() / (double) + RAND_MAX) * 65535.0)); + def.green = (unsigned short) ((0.7 + 0.2 * (rand() / (double) + RAND_MAX)) * 65535.0); + def.blue = (unsigned short) ((0.1 + 0.1 * (rand() / (double) + RAND_MAX)) * 65535.0); + def.flags = DoRed | DoGreen | DoBlue; + if (allocateBestRGB(graphic->xw, &def)) { + xgcv.foreground = def.pixel; + XChangeGC(display, graphics_gc, mask, &xgcv); + } + XDrawLine(display, vwindow, graphics_gc, + xbase + x + 0, ybase + y + 0, + xbase + x + w - 1, ybase + y + 0); + XDrawLine(display, vwindow, graphics_gc, + xbase + x + w - 1, ybase + y + 0, + xbase + x + 0, ybase + y + h - 1); + XDrawLine(display, vwindow, graphics_gc, + xbase + x + 0, ybase + y + h - 1, + xbase + x + w - 1, ybase + y + h - 1); + XDrawLine(display, vwindow, graphics_gc, + xbase + x + w - 1, ybase + y + h - 1, + xbase + x + 0, ybase + y + 0); + } +#endif + XFlush(display); + TRACE(("done refreshing sixel graphic: %d of %d refreshed pixels were holes\n", + holes, total)); + + XFreeGC(display, graphics_gc); +} + +/* + * Primary color hues: + * blue: 0 degrees + * red: 120 degrees + * green: 240 degrees + */ +static void +hls2rgb(int h, int l, int s, short *r, short *g, short *b) +{ + double hs = (h + 240) % 360; + double hv = hs / 360.0; + double lv = l / 100.0; + double sv = s / 100.0; + double c, x, m; + double r1, g1, b1; + int hpi; + + if (s == 0) { + *r = *g = *b = (short) l; + return; + } + + c = (1.0 - fabs(2.0 * lv - 1.0)) * sv; + hpi = (int) (hv * 6.0); + x = (hpi & 1) ? c : 0.0; + m = lv - 0.5 * c; + + switch (hpi) { + case 0: + r1 = c; + g1 = x; + b1 = 0.0; + break; + case 1: + r1 = x; + g1 = c; + b1 = 0.0; + break; + case 2: + r1 = 0.0; + g1 = c; + b1 = x; + break; + case 3: + r1 = 0.0; + g1 = x; + b1 = c; + break; + case 4: + r1 = x; + g1 = 0.0; + b1 = c; + break; + case 5: + r1 = c; + g1 = 0.0; + b1 = x; + break; + default: + printf("BAD\n"); + *r = (short) 100; + *g = (short) 100; + *b = (short) 100; + return; + } + + *r = (short) ((r1 + m) * 100.0 + 0.5); + *g = (short) ((g1 + m) * 100.0 + 0.5); + *b = (short) ((b1 + m) * 100.0 + 0.5); + + if (*r < 0) + *r = 0; + else if (*r > 100) + *r = 100; + if (*g < 0) + *g = 0; + else if (*g > 100) + *g = 100; + if (*b < 0) + *b = 0; + else if (*b > 100) + *b = 100; +} + +static void +update_sixel_aspect(SixelGraphic *graphic) +{ + /* We want to keep the ratio accurate but would like every pixel to have + * the same size so keep these as whole numbers. + */ + /* FIXME: DEC terminals had pixels about twice as tall as they were wide, + * and it seems the VT125 and VT24x only used data from odd graphic rows. + * This means it basically cancels out if we ignore both, except that + * the even rows of pixels may not be written by the application such that + * they are suitable for display. In practice this doesn't seem to be + * an issue but I have very few test files/programs. + */ + if (graphic->aspect_vertical < graphic->aspect_horizontal) { + graphic->pixw = 1; + graphic->pixh = ((graphic->aspect_vertical + + graphic->aspect_horizontal - 1) + / graphic->aspect_horizontal); + } else { + graphic->pixw = ((graphic->aspect_horizontal + + graphic->aspect_vertical - 1) + / graphic->aspect_vertical); + graphic->pixh = 1; + } + TRACE(("sixel aspect ratio: an=%d ad=%d -> pixw=%d pixh=%d\n", + graphic->aspect_vertical, + graphic->aspect_horizontal, + graphic->pixw, + graphic->pixh)); +} + +/* + * Interpret sixel graphics sequences. + * + * Resources: + * http://en.wikipedia.org/wiki/Sixel + * http://vt100.net/docs/vt3xx-gp/chapter14.html + * ftp://ftp.cs.utk.edu/pub/shuford/terminal/sixel_graphics_news.txt + * ftp://ftp.cs.utk.edu/pub/shuford/terminal/all_about_sixels.txt + */ +extern void +parse_sixel(XtermWidget xw, ANSI *params, char const *string) +{ + TScreen *screen = TScreenOf(xw); + SixelGraphic *graphic; + Char ch; + + graphic = get_sixel_graphic(xw); + + { + int Pmacro = params->a_param[0]; + int Pbgmode = params->a_param[1]; + int Phgrid = params->a_param[2]; + int Pan = params->a_param[3]; + int Pad = params->a_param[4]; + int Ph = params->a_param[5]; + int Pv = params->a_param[6]; + + (void) Phgrid; + + TRACE(("sixel bitmap graphics sequence: params=%d (Pmacro=%d Pbgmode=%d Phgrid=%d) scroll_amt=%d\n", + params->a_nparam, + Pmacro, + Pbgmode, + Phgrid, + screen->scroll_amt)); + + switch (params->a_nparam) { + case 7: + if (Pan == 0 || Pad == 0) { + TRACE(("DATA_ERROR: invalid raster ratio %d/%d\n", Pan, Pad)); + return; + } + graphic->aspect_vertical = Pan; + graphic->aspect_horizontal = Pad; + + if (Ph == 0 || Pv == 0) { + TRACE(("DATA_ERROR: raster image dimensions are invalid %dx%d\n", + Ph, Pv)); + return; + } + if (Ph > graphic->max_width || Pv > graphic->max_height) { + TRACE(("DATA_ERROR: raster image dimensions are too large %dx%d\n", + Ph, Pv)); + return; + } + graphic->declared_width = Ph; + graphic->declared_height = Pv; + if (graphic->declared_width > graphic->actual_width) { + graphic->actual_width = graphic->declared_width; + } + if (graphic->declared_height > graphic->actual_height) { + graphic->actual_height = graphic->declared_height; + } + break; + case 3: + case 2: + switch (Pmacro) { + case 0: + case 1: + graphic->aspect_vertical = 5; + graphic->aspect_horizontal = 1; + break; + case 2: + graphic->aspect_vertical = 3; + graphic->aspect_horizontal = 1; + break; + case 3: + case 4: + graphic->aspect_vertical = 2; + graphic->aspect_horizontal = 1; + break; + case 5: + case 6: + graphic->aspect_vertical = 2; + graphic->aspect_horizontal = 1; + break; + case 7: + case 8: + case 9: + graphic->aspect_vertical = 1; + graphic->aspect_horizontal = 1; + break; + default: + TRACE(("DATA_ERROR: unknown sixel macro mode parameter\n")); + return; + } + break; + case 0: + break; + default: + TRACE(("DATA_ERROR: unexpected parameter count (found %d)\n", params->a_nparam)); + return; + } + + if (Pbgmode == 1) { + graphic->background = COLOR_HOLE; + } else { + graphic->background = graphic->device_background; + } + + /* Ignore the grid parameter because it seems only printers paid attention to it. + * The VT3xx was always 0.0195 cm. + */ + } + +#if OPT_SIXEL_GRAPHICS + if (xw->keyboard.flags & MODE_DECSDM) { + TRACE(("sixel scrolling enabled: inline positioning for graphic\n")); + graphic->charrow = screen->cur_row; + graphic->charcol = screen->cur_col; + } + + update_sixel_aspect(graphic); +#endif + + for (;;) { + ch = CharOf(*string); + if (ch == '\0') + break; + + if (ch >= 0x3f && ch <= 0x7e) { + int sixel = ch - 0x3f; + TRACE(("sixel=%x (%c)\n", sixel, (char) ch)); + if (!graphic->valid) { + init_sixel_background(graphic); + graphic->valid = 1; + } + set_sixel(graphic, sixel); + graphic->col++; + } else if (ch == '$') { /* DECGCR */ + /* ignore DECCRNLM in sixel mode */ + TRACE(("sixel CR\n")); + graphic->col = 0; + } else if (ch == '-') { /* DECGNL */ + int scroll_lines; + TRACE(("sixel NL\n")); + scroll_lines = 0; + while (graphic->charrow - scroll_lines + + (((graphic->row + 6) * graphic->pixh + + FontHeight(screen) - 1) + / FontHeight(screen)) > screen->bot_marg) { + scroll_lines++; + } + graphic->col = 0; + graphic->row += 6; + /* If we hit the bottom margin on the graphics page (well, we just use the text margin for now), + * the behavior is to either scroll or to discard the remainder of the graphic depending on this + * setting. + */ + if (scroll_lines > 0) { + if (xw->keyboard.flags & MODE_DECSDM) { + Display *display = screen->display; + xtermScroll(xw, scroll_lines); + XSync(display, False); + TRACE(("graphic scrolled the screen %d lines. screen->scroll_amt=%d screen->topline=%d, now starting row is %d\n", + scroll_lines, + screen->scroll_amt, + screen->topline, + graphic->charrow)); + } else { + break; + } + } + } else if (ch == '!') { /* DECGRI */ + int Pcount; + const char *start; + int sixel; + int i; + + start = ++string; + for (;;) { + ch = CharOf(*string); + if (ch != '0' && + ch != '1' && + ch != '2' && + ch != '3' && + ch != '4' && + ch != '5' && + ch != '6' && + ch != '7' && + ch != '8' && + ch != '9' && + ch != ' ' && + ch != '\r' && + ch != '\n') + break; + string++; + } + if (ch == '\0') { + TRACE(("DATA_ERROR: sixel data string terminated in the middle of a repeat operator\n")); + return; + } + if (string == start) { + TRACE(("DATA_ERROR: sixel data string contains a repeat operator with empty count\n")); + return; + } + Pcount = atoi(start); + sixel = ch - 0x3f; + TRACE(("sixel repeat operator: sixel=%d (%c), count=%d\n", + sixel, (char) ch, Pcount)); + if (!graphic->valid) { + init_sixel_background(graphic); + graphic->valid = 1; + } + for (i = 0; i < Pcount; i++) { + set_sixel(graphic, sixel); + graphic->col++; + } + } else if (ch == '#') { /* DECGCI */ + ANSI color_params; + int Pregister; + + parse_prefixedtype_params(&color_params, &string); + Pregister = color_params.a_param[0]; + if (Pregister >= graphic->valid_registers) { + TRACE(("DATA_WARNING: sixel color operator uses out-of-range register %d\n", Pregister)); + /* FIXME: supposedly the DEC terminals wrapped register indicies -- verify */ + while (Pregister >= graphic->valid_registers) + Pregister -= graphic->valid_registers; + TRACE(("DATA_WARNING: converted to %d\n", Pregister)); + } + + if (color_params.a_nparam > 2 && color_params.a_nparam <= 5) { + int Pspace = color_params.a_param[1]; + int Pc1 = color_params.a_param[2]; + int Pc2 = color_params.a_param[3]; + int Pc3 = color_params.a_param[4]; + short r, g, b; + + TRACE(("sixel set color register=%d space=%d color=[%d,%d,%d] (nparams=%d)\n", + Pregister, Pspace, Pc1, Pc2, Pc3, color_params.a_nparam)); + + switch (Pspace) { + case 1: /* HLS */ + if (Pc1 > 360 || Pc2 > 100 || Pc3 > 100) { + TRACE(("DATA_ERROR: sixel set color operator uses out-of-range HLS color coordinates %d,%d,%d\n", + Pc1, Pc2, Pc3)); + return; + } + hls2rgb(Pc1, Pc2, Pc3, &r, &g, &b); + break; + case 2: /* RGB */ + if (Pc1 > 100 || Pc2 > 100 || Pc3 > 100) { + TRACE(("DATA_ERROR: sixel set color operator uses out-of-range RGB color coordinates %d,%d,%d\n", + Pc1, Pc2, Pc3)); + return; + } + r = (short) Pc1; + g = (short) Pc2; + b = (short) Pc3; + break; + default: /* unknown */ + TRACE(("DATA_ERROR: sixel set color operator uses unknown color space %d\n", Pspace)); + return; + } + if (graphic->private_colors) { + set_sixel_color_register(graphic->private_color_registers, + (RegisterNum) Pregister, + r, g, b); + } else { + set_shared_color_register((RegisterNum) Pregister, r, g, b); + } + graphic->color_registers_used[Pregister] = 1; + } else if (color_params.a_nparam == 1) { + TRACE(("sixel switch to color register=%d (nparams=%d)\n", + Pregister, color_params.a_nparam)); + graphic->current_register = (RegisterNum) Pregister; + } else { + TRACE(("DATA_ERROR: sixel switch color operator with unexpected parameter count (nparams=%d)\n", color_params.a_nparam)); + return; + } + continue; + } else if (ch == '"') /* DECGRA */ { + ANSI raster_params; + + parse_prefixedtype_params(&raster_params, &string); + if (raster_params.a_nparam < 2) { + TRACE(("DATA_ERROR: sixel raster attribute operator with incomplete parameters (found %d, expected 2 or 4)\n", raster_params.a_nparam)); + return; + } { + int Pan = raster_params.a_param[0]; + int Pad = raster_params.a_param[1]; + TRACE(("sixel raster attribute with h:w=%d:%d\n", Pan, Pad)); + if (Pan == 0 || Pad == 0) { + TRACE(("DATA_ERROR: invalid raster ratio %d/%d\n", Pan, Pad)); + return; + } + graphic->aspect_vertical = Pan; + graphic->aspect_horizontal = Pad; + update_sixel_aspect(graphic); + } + + if (raster_params.a_nparam >= 4) { + int Ph = raster_params.a_param[2]; + int Pv = raster_params.a_param[3]; + + TRACE(("sixel raster attribute with h=%d v=%d\n", Ph, Pv)); + if (Ph == 0 || Pv == 0) { + TRACE(("DATA_ERROR: raster image dimensions are invalid %dx%d\n", + Ph, Pv)); + return; + } + if (Ph > graphic->max_width || Pv > graphic->max_height) { + TRACE(("DATA_ERROR: raster image dimensions are too large %dx%d\n", + Ph, Pv)); + return; + } + graphic->declared_width = Ph; + graphic->declared_height = Pv; + if (graphic->declared_width > graphic->actual_width) { + graphic->actual_width = graphic->declared_width; + } + if (graphic->declared_height > graphic->actual_height) { + graphic->actual_height = graphic->declared_height; + } + } + + continue; + } else if (ch == ' ' || ch == '\r' || ch == '\n') { + /* EMPTY */ ; + } else { + TRACE(("DATA_ERROR: unknown sixel command %04x (%c)\n", + (int) ch, ch)); + } + + string++; + } + + /* update the screen */ + if (screen->scroll_amt) + FlushScroll(xw); + + if (xw->keyboard.flags & MODE_DECSDM) { + int new_row = (graphic->charrow + + ((graphic->actual_height * graphic->pixh) + / FontHeight(screen))); + int new_col = (graphic->charcol + + (((graphic->actual_width * graphic->pixw) + + FontWidth(screen) - 1) + / FontWidth(screen))); + + TRACE(("setting text position after %dx%d graphic starting on row=%d col=%d: cursor new_row=%d new_col=%d\n", + graphic->actual_width * graphic->pixw, + graphic->actual_height * graphic->pixh, + graphic->charrow, + graphic->charcol, + new_row, new_col)); + + if (new_col > screen->rgt_marg) { + new_col = screen->lft_marg; + new_row++; + TRACE(("column past left margin, overriding to row=%d col=%d\n", + new_row, new_col)); + } + + while (new_row > screen->bot_marg) { + xtermScroll(xw, 1); + new_row--; + TRACE(("bottom row was past screen. new start row=%d, cursor row=%d\n", + graphic->charrow, new_row)); + } + + if (new_row < 0) { + TRACE(("new row is going to be negative (%d)!", new_row)); /* FIXME: this was triggering, now it isn't */ + } + set_cur_row(screen, new_row); + set_cur_col(screen, new_col <= screen->rgt_marg ? new_col : screen->rgt_marg); + } + + refresh_modified_displayed_graphics(screen); + + TRACE(("DONE successfully parsed sixel data\n")); + dump_sixel(graphic); +} + +extern void +parse_regis(XtermWidget xw, ANSI *params, char const *string) +{ + (void) xw; + (void) string; + (void) params; + + TRACE(("ReGIS vector graphics mode, params=%d\n", params->a_nparam)); +} + +/* Erase the portion of any displayed graphic overlapping with a rectangle + * of the given size and location in pixels. + * This is used to allow text to "erase" graphics underneath it. + */ +static void +erase_sixel_graphic(SixelGraphic *graphic, int x, int y, int w, int h) +{ + RegisterNum hole = COLOR_HOLE; + int pw, ph; + int r, c; + + pw = graphic->pixw; + ph = graphic->pixh; + + TRACE(("erasing sixel bitmap %d,%d %dx%d\n", x, y, w, h)); + + for (r = 0; r < graphic->actual_height; r++) { + for (c = 0; c < graphic->actual_width; c++) { + if (r * ph + ph - 1 < y || + r * ph > y + h - 1 || + c * pw + pw - 1 < x || + c * pw > x + w - 1) + continue; + + graphic->pixels[r * graphic->max_width + c] = hole; + } + } +} + +static int +compare_sixel_ids(const void *left, const void *right) +{ + const SixelGraphic *l = *(const SixelGraphic *const *) left; + const SixelGraphic *r = *(const SixelGraphic *const *) right; + + if (!l->valid || !r->valid) + return 0; + if (l->id < r->id) + return -1; + else + return 1; +} + +extern void +refresh_displayed_graphics(TScreen const *screen, + int leftcol, + int toprow, + int ncols, + int nrows) +{ + SixelGraphic *ordered_graphics[MAX_SIXEL_GRAPHICS]; + SixelGraphic *graphic; + unsigned int ii; + int x, y, w, h; + int xbase, ybase; + + for (ii = 0U; ii < MAX_SIXEL_GRAPHICS; ii++) { + ordered_graphics[ii] = &sixel_graphics[ii]; + } + qsort(ordered_graphics, + MAX_SIXEL_GRAPHICS, + sizeof(ordered_graphics[0]), + compare_sixel_ids); + + for (ii = 0U; ii < MAX_SIXEL_GRAPHICS; ii++) { + graphic = ordered_graphics[ii]; + if (!graphic->valid || graphic->bufferid != screen->whichBuf) + continue; + + x = (leftcol - graphic->charcol) * FontWidth(screen); + y = (toprow - graphic->charrow) * FontHeight(screen); + w = ncols * FontWidth(screen); + h = nrows * FontHeight(screen); + + xbase = (screen->border + + graphic->charcol * FontWidth(screen)); + ybase = (screen->border + + (graphic->charrow - screen->topline) * FontHeight(screen)); + + if (xbase + x + w + screen->border > FullWidth(screen)) + w = FullWidth(screen) - (xbase + x + screen->border); + if (ybase + y + h + screen->border > FullHeight(screen)) + h = FullHeight(screen) - (ybase + y + screen->border); + else if (ybase + y < screen->border) { + int diff = screen->border - (ybase + y); + y += diff; + h -= diff; + } + + TRACE(("graphics refresh: screen->topline=%d leftcol=%d toprow=%d nrows=%d ncols=%d x=%d y=%d w=%d h=%d xbase=%d ybase=%d\n", + screen->topline, + leftcol, toprow, + nrows, ncols, + x, y, w, h, + xbase, ybase)); + refresh_sixel_graphic(screen, graphic, xbase, ybase, x, y, w, h); + } +} + +extern void +refresh_modified_displayed_graphics(TScreen const *screen) +{ + SixelGraphic *graphic; + unsigned int ii; + int leftcol, toprow; + int nrows, ncols; + int x, y, w, h; + int xbase, ybase; + + for (ii = 0U; ii < MAX_SIXEL_GRAPHICS; ii++) { + graphic = &sixel_graphics[ii]; + if (!graphic->valid || graphic->bufferid != screen->whichBuf || !graphic->dirty) + continue; + + leftcol = graphic->charcol; + toprow = graphic->charrow; + nrows = (((graphic->actual_height * graphic->pixh) + + FontHeight(screen) - 1) + / FontHeight(screen)); + ncols = (((graphic->actual_width * graphic->pixw) + + FontWidth(screen) - 1) + / FontWidth(screen)); + + x = (leftcol - graphic->charcol) * FontWidth(screen); + y = (toprow - graphic->charrow) * FontHeight(screen); + w = ncols * FontWidth(screen); + h = nrows * FontHeight(screen); + + xbase = (screen->border + + graphic->charcol * FontWidth(screen)); + ybase = (screen->border + + (graphic->charrow - screen->topline) * FontHeight(screen)); + + if (xbase + x + w + screen->border > FullWidth(screen)) + w = FullWidth(screen) - (xbase + x + screen->border); + if (ybase + y + h + screen->border > FullHeight(screen)) + h = FullHeight(screen) - (ybase + y + screen->border); + else if (ybase + y < screen->border) { + int diff = screen->border - (ybase + y); + y += diff; + h -= diff; + } + + TRACE(("full graphics refresh: screen->topline=%d leftcol=%d toprow=%d nrows=%d ncols=%d x=%d y=%d w=%d h=%d xbase=%d ybase=%d\n", + screen->topline, + leftcol, toprow, + nrows, ncols, + x, y, w, h, + xbase, ybase)); + refresh_sixel_graphic(screen, graphic, xbase, ybase, x, y, w, h); + graphic->dirty = 0; + } +} + +extern void +scroll_displayed_graphics(int rows) +{ + SixelGraphic *graphic; + unsigned int ii; + + TRACE(("graphics scroll: moving all up %d rows\n", rows)); + for (ii = 0U; ii < MAX_SIXEL_GRAPHICS; ii++) { + graphic = &sixel_graphics[ii]; + if (!graphic->valid) + continue; + + graphic->charrow -= rows; + } +} + +extern void +pixelarea_clear_displayed_graphics(TScreen const *screen, + int winx, + int winy, + int w, + int h) +{ + SixelGraphic *graphic; + unsigned int ii; + int x, y; + + for (ii = 0U; ii < MAX_SIXEL_GRAPHICS; ii++) { + graphic = &sixel_graphics[ii]; + if (!graphic->valid) + continue; + + x = winx - graphic->charcol * FontWidth(screen); + y = winy - graphic->charrow * FontHeight(screen); + + TRACE(("pixelarea graphics erase: screen->topline=%d winx=%d winy=%d w=%d h=%d x=%d y=%d\n", + screen->topline, + winx, winy, + w, h, + x, y)); + erase_sixel_graphic(graphic, x, y, w, h); + } +} + +extern void +chararea_clear_displayed_graphics(TScreen const *screen, + int leftcol, + int toprow, + int ncols, + int nrows) +{ + int x, y, w, h; + + x = leftcol * FontWidth(screen); + y = toprow * FontHeight(screen); + w = ncols * FontWidth(screen); + h = nrows * FontHeight(screen); + + TRACE(("chararea clear graphics: screen->topline=%d leftcol=%d toprow=%d nrows=%d ncols=%d x=%d y=%d w=%d h=%d\n", + screen->topline, + leftcol, toprow, + nrows, ncols, + x, y, w, h)); + pixelarea_clear_displayed_graphics(screen, x, y, w, h); +} + +extern void +reset_displayed_graphics(TScreen const *screen) +{ + SixelGraphic *graphic; + unsigned int ii; + + init_color_registers(shared_color_registers, screen->terminal_id); + TRACE(("resetting all sixel graphics\n")); + for (ii = 0U; ii < MAX_SIXEL_GRAPHICS; ii++) { + graphic = &sixel_graphics[ii]; + graphic->valid = 0; + } +} diff --git a/app/xterm/graphics.h b/app/xterm/graphics.h new file mode 100644 index 000000000..b25852298 --- /dev/null +++ b/app/xterm/graphics.h @@ -0,0 +1,70 @@ +/* $XTermId: graphics.h,v 1.6 2013/07/10 08:28:55 Ross.Combs Exp $ */ + +/* + * Copyright 2013 by Ross Combs + * Copyright 2013 by Thomas E. Dickey + * + * All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization. + */ + +#ifndef included_graphics_h +#define included_graphics_h +/* *INDENT-OFF* */ + +#include <ptyx.h> + +#if OPT_SIXEL_GRAPHICS + +typedef unsigned short RegisterNum; + +extern void chararea_clear_displayed_graphics(TScreen const *screen, int leftcol, int toprow, int ncols, int nrows); +extern void parse_regis(XtermWidget xw, ANSI *params, char const *string); +extern void parse_sixel(XtermWidget xw, ANSI *params, char const *string); +extern void pixelarea_clear_displayed_graphics(TScreen const *screen, int winx, int winy, int w, int h); +extern void refresh_displayed_graphics(TScreen const *screen, int leftcol, int toprow, int ncols, int nrows); +extern void refresh_modified_displayed_graphics(TScreen const *screen); +extern void reset_displayed_graphics(TScreen const *screen); +extern void scroll_displayed_graphics(int rows); +extern void update_displayed_graphics_color_registers(TScreen const *screen, RegisterNum color, short r, short g, short b); + +#else + +#define chararea_clear_displayed_graphics(screen, leftcol, toprow, ncols, nrows) /* nothing */ +#define parse_regis(xw, params, string) /* nothing */ +#define parse_sixel(xw, params, string) /* nothing */ +#define pixelarea_clear_displayed_graphics(screen, winx, winy, w, h) /* nothing */ +#define refresh_displayed_graphics(screen, leftcol, toprow, ncols, nrows) /* nothing */ +#define refresh_modified_displayed_graphics(screen) /* nothing */ +#define reset_displayed_graphics(screen) /* nothing */ +#define scroll_displayed_graphics(rows) /* nothing */ +#define update_displayed_graphics_color_registers(screen, color, r, g, b) /* nothing */ + +#endif + +/* *INDENT-ON* */ + +#endif /* included_graphics_h */ diff --git a/app/xterm/menu.c b/app/xterm/menu.c index 308f37066..0d83b3f28 100644 --- a/app/xterm/menu.c +++ b/app/xterm/menu.c @@ -1,4 +1,4 @@ -/* $XTermId: menu.c,v 1.313 2013/02/03 21:53:58 tom Exp $ */ +/* $XTermId: menu.c,v 1.320 2013/06/23 22:46:18 tom Exp $ */ /* * Copyright 1999-2012,2013 by Thomas E. Dickey @@ -228,6 +228,11 @@ static void do_font_renderfont PROTO_XT_CALLBACK_ARGS; static void do_sco_fkeys PROTO_XT_CALLBACK_ARGS; #endif +#if OPT_SIXEL_GRAPHICS +static void do_privatecolorregisters PROTO_XT_CALLBACK_ARGS; +static void do_sixelscrolling PROTO_XT_CALLBACK_ARGS; +#endif + #if OPT_SUN_FUNC_KEYS static void do_sun_fkeys PROTO_XT_CALLBACK_ARGS; #endif @@ -363,6 +368,10 @@ MenuEntry vtMenuEntries[] = { { "vthide", do_vthide, NULL }, #endif { "altscreen", do_altscreen, NULL }, +#if OPT_SIXEL_GRAPHICS + { "sixelScrolling", do_sixelscrolling, NULL }, + { "privateColorRegisters", do_privatecolorregisters, NULL }, +#endif }; MenuEntry fontMenuEntries[] = { @@ -778,10 +787,12 @@ domenu(Widget w, update_bellIsUrgent(); update_cursorblink(); update_altscreen(); + update_decsdm(); /* Sixel Display Mode */ update_titeInhibit(); #ifndef NO_ACTIVE_ICON update_activeicon(); #endif /* NO_ACTIVE_ICON */ + update_privatecolorregisters(); } break; @@ -2205,6 +2216,65 @@ update_fullscreen(void) #endif /* OPT_MAXIMIZE */ +#if OPT_SIXEL_GRAPHICS +static void +do_sixelscrolling(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) +{ + term->keyboard.flags ^= MODE_DECSDM; + update_decsdm(); +} + +static void +do_privatecolorregisters(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) +{ + TScreen *screen = TScreenOf(term); + + ToggleFlag(screen->privatecolorregisters); + update_privatecolorregisters(); +} + +void +update_privatecolorregisters(void) +{ + UpdateCheckbox("update_privatecolorregisters", + vtMenuEntries, + vtMenu_privatecolorregisters, + TScreenOf(term)->privatecolorregisters); +} + +void +update_decsdm(void) +{ + UpdateCheckbox("update_decsdm", + vtMenuEntries, + vtMenu_sixelscrolling, + (term->keyboard.flags & MODE_DECSDM) != 0); +} + +void +HandleSetPrivateColorRegisters(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal *param_count) +{ + HANDLE_VT_TOGGLE(privatecolorregisters); +} + +void +HandleSixelScrolling(Widget w, + XEvent * event GCC_UNUSED, + String * params, + Cardinal *param_count) +{ + handle_vt_toggle(do_sixelscrolling, term->keyboard.flags & MODE_DECSDM, + params, *param_count, w); +} +#endif + #if OPT_SUN_FUNC_KEYS void HandleSunFunctionKeys(Widget w, diff --git a/app/xterm/menu.h b/app/xterm/menu.h index 30c991eb8..37294c35b 100644 --- a/app/xterm/menu.h +++ b/app/xterm/menu.h @@ -1,7 +1,7 @@ -/* $XTermId: menu.h,v 1.128 2012/09/21 10:39:10 tom Exp $ */ +/* $XTermId: menu.h,v 1.132 2013/06/23 20:52:38 tom Exp $ */ /* - * Copyright 1999-2010,2011 by Thomas E. Dickey + * Copyright 1999-2011,2013 by Thomas E. Dickey * * All Rights Reserved * @@ -126,10 +126,12 @@ extern void HandleScrollbar PROTO_XT_ACTIONS_ARGS; extern void HandleSecure PROTO_XT_ACTIONS_ARGS; extern void HandleSendSignal PROTO_XT_ACTIONS_ARGS; extern void HandleSetPopOnBell PROTO_XT_ACTIONS_ARGS; +extern void HandleSetPrivateColorRegisters PROTO_XT_ACTIONS_ARGS; extern void HandleSetSelect PROTO_XT_ACTIONS_ARGS; extern void HandleSetTekText PROTO_XT_ACTIONS_ARGS; extern void HandleSetTerminalType PROTO_XT_ACTIONS_ARGS; extern void HandleSetVisualBell PROTO_XT_ACTIONS_ARGS; +extern void HandleSixelScrolling PROTO_XT_ACTIONS_ARGS; extern void HandleSoftReset PROTO_XT_ACTIONS_ARGS; extern void HandleSunFunctionKeys PROTO_XT_ACTIONS_ARGS; extern void HandleSunKeyboard PROTO_XT_ACTIONS_ARGS; @@ -255,6 +257,10 @@ typedef enum { vtMenu_vthide, #endif vtMenu_altscreen, +#if OPT_SIXEL_GRAPHICS + vtMenu_sixelscrolling, + vtMenu_privatecolorregisters, +#endif vtMenu_LAST } vtMenuIndices; @@ -479,6 +485,14 @@ extern void update_font_packed(void); #define update_font_packed() /* nothing */ #endif +#if OPT_SIXEL_GRAPHICS +extern void update_decsdm(void); +extern void update_privatecolorregisters(void); +#else +#define update_decsdm() /* nothing */ +#define update_privatecolorregisters() /* nothing */ +#endif + #if OPT_DEC_SOFTFONT extern void update_font_loadable(void); #else diff --git a/app/xterm/misc.c b/app/xterm/misc.c index c9e9b18a4..571818bfb 100644 --- a/app/xterm/misc.c +++ b/app/xterm/misc.c @@ -1,4 +1,4 @@ -/* $XTermId: misc.c,v 1.660 2013/05/26 21:16:20 tom Exp $ */ +/* $XTermId: misc.c,v 1.670 2013/06/23 22:11:54 tom Exp $ */ /* * Copyright 1999-2012,2013 by Thomas E. Dickey @@ -91,10 +91,10 @@ #include <error.h> #include <menu.h> #include <fontutils.h> -#include <xcharmouse.h> #include <xstrings.h> #include <xtermcap.h> #include <VTparse.h> +#include <graphics.h> #include <assert.h> @@ -534,8 +534,10 @@ xtermAppPending(void) while (result && XtAppPeekEvent(app_con, &this_event)) { if (this_event.type == Expose) { result = mergeExposeEvents(&this_event); + TRACE(("got merged expose events\n")); } else if (this_event.type == ConfigureNotify) { result = mergeConfigureEvents(&this_event); + TRACE(("got merged configure notify events\n")); } else { TRACE(("pending %s\n", visibleEventType(this_event.type))); break; @@ -2624,6 +2626,14 @@ ResetAnsiColorRequest(XtermWidget xw, char *buf, int start) #define allocateExactRGB(xw, cmap, def) XAllocColor(TScreenOf(xw)->display, cmap, def) #endif /* OPT_ISO_COLORS */ +Boolean +allocateBestRGB(XtermWidget xw, XColor * def) +{ + Colormap cmap = xw->core.colormap; + + return allocateExactRGB(xw, cmap, def) || allocateClosestRGB(xw, cmap, def); +} + static Boolean xtermAllocColor(XtermWidget xw, XColor * def, const char *spec) { @@ -2632,8 +2642,7 @@ xtermAllocColor(XtermWidget xw, XColor * def, const char *spec) Colormap cmap = xw->core.colormap; if (XParseColor(screen->display, cmap, spec, def) - && (allocateExactRGB(xw, cmap, def) - || allocateClosestRGB(xw, cmap, def))) { + && allocateBestRGB(xw, def)) { TRACE(("xtermAllocColor -> %x/%x/%x\n", def->red, def->green, def->blue)); result = True; @@ -3624,6 +3633,49 @@ parse_decudk(const char *cp) } } +/* + * Parse numeric parameters. Normally we use a state machine to simplify + * interspersing with control characters, but have the string already. + */ +static void +parse_ansi_params(ANSI * params, const char **string) +{ + const char *cp = *string; + ParmType nparam = 0; + int last_empty = 1; + + memset(params, 0, sizeof(*params)); + while (*cp != '\0') { + Char ch = CharOf(*cp++); + + if (isdigit(ch)) { + last_empty = 0; + if (nparam < NPARAM) { + params->a_param[nparam] = + (ParmType) ((params->a_param[nparam] * 10) + + (ch - '0')); + } + } else if (ch == ';') { + last_empty = 1; + nparam++; + } else if (ch < 32) { + /* EMPTY */ ; + } else { + /* should be 0x30 to 0x7e */ + params->a_final = ch; + break; + } + } + + *string = cp; + if (!last_empty) + nparam++; + if (nparam > NPARAM) + params->a_nparam = NPARAM; + else + params->a_nparam = nparam; +} + #if OPT_TRACE #define SOFT_WIDE 10 #define SOFT_HIGH 20 @@ -3738,40 +3790,6 @@ parse_decdld(ANSI * params, const char *string) #define parse_decdld(p,q) /* nothing */ #endif -/* - * Parse numeric parameters. Normally we use a state machine to simplify - * interspersing with control characters, but have the string already. - */ -static void -parse_ansi_params(ANSI * params, const char **string) -{ - const char *cp = *string; - ParmType nparam = 0; - - memset(params, 0, sizeof(*params)); - while (*cp != '\0') { - Char ch = CharOf(*cp++); - - if (isdigit(ch)) { - if (nparam < NPARAM) { - params->a_param[nparam] = - (ParmType) ((params->a_param[nparam] * 10) - + (ch - '0')); - } - } else if (ch == ';') { - if (++nparam < NPARAM) - params->a_nparam = nparam; - } else if (ch < 32) { - /* EMPTY */ ; - } else { - /* should be 0x30 to 0x7e */ - params->a_final = ch; - break; - } - } - *string = cp; -} - void do_dcs(XtermWidget xw, Char * dcsbuf, size_t dcslen) { @@ -3978,9 +3996,30 @@ do_dcs(XtermWidget xw, Char * dcsbuf, size_t dcslen) break; #endif default: - if (screen->vtXX_level >= 2) { /* VT220 */ + if (screen->terminal_id == 125 || + screen->vtXX_level >= 2) { /* VT220 */ parse_ansi_params(¶ms, &cp); switch (params.a_final) { +#if OPT_SIXEL_GRAPHICS + case 'p': + if (screen->terminal_id == 125 || + screen->terminal_id == 240 || + screen->terminal_id == 241 || + screen->terminal_id == 330 || + screen->terminal_id == 340) { + parse_regis(xw, ¶ms, cp); + } + break; + case 'q': + if (screen->terminal_id == 125 || + screen->terminal_id == 240 || + screen->terminal_id == 241 || + screen->terminal_id == 330 || + screen->terminal_id == 340) { + parse_sixel(xw, ¶ms, cp); + } + break; +#endif case '|': /* DECUDK */ if (params.a_param[0] == 0) reset_decudk(); @@ -4085,222 +4124,227 @@ do_decrpm(XtermWidget xw, int nparams, int *params) TScreen *screen = TScreenOf(xw); switch (params[0]) { - case 1: /* DECCKM */ + case srm_DECCKM: result = MdFlag(xw->keyboard.flags, MODE_DECCKM); break; - case 2: /* DECANM - ANSI/VT52 mode */ + case srm_DECANM: /* ANSI/VT52 mode */ #if OPT_VT52_MODE result = MdBool(screen->vtXX_level >= 1); #else result = mdMaybeSet; #endif break; - case 3: /* DECCOLM */ + case srm_DECCOLM: result = MdFlag(xw->flags, IN132COLUMNS); break; - case 4: /* DECSCLM (slow scroll) */ + case srm_DECSCLM: /* (slow scroll) */ result = MdFlag(xw->flags, SMOOTHSCROLL); break; - case 5: /* DECSCNM */ + case srm_DECSCNM: result = MdFlag(xw->flags, REVERSE_VIDEO); break; - case 6: /* DECOM */ + case srm_DECOM: result = MdFlag(xw->flags, ORIGIN); break; - case 7: /* DECAWM */ + case srm_DECAWM: result = MdFlag(xw->flags, WRAPAROUND); break; - case 8: /* DECARM */ + case srm_DECARM: result = mdAlwaysReset; break; - case SET_X10_MOUSE: /* X10 mouse */ + case srm_X10_MOUSE: /* X10 mouse */ result = MdBool(screen->send_mouse_pos == X10_MOUSE); break; #if OPT_TOOLBAR - case 10: /* rxvt */ + case srm_RXVT_TOOLBAR: result = MdBool(resource.toolBar); break; #endif #if OPT_BLINK_CURS - case 12: /* att610: Start/stop blinking cursor */ + case srm_ATT610_BLINK: /* att610: Start/stop blinking cursor */ result = MdBool(screen->cursor_blink_res); break; #endif - case 18: /* DECPFF: print form feed */ + case srm_DECPFF: /* print form feed */ result = MdBool(PrinterOf(screen).printer_formfeed); break; - case 19: /* DECPEX: print extent */ + case srm_DECPEX: /* print extent */ result = MdBool(PrinterOf(screen).printer_extent); break; - case 25: /* DECTCEM: Show/hide cursor (VT200) */ + case srm_DECTCEM: /* Show/hide cursor (VT200) */ result = MdBool(screen->cursor_set); break; - case 30: /* rxvt */ + case srm_RXVT_SCROLLBAR: result = MdBool(screen->fullVwin.sb_info.width != OFF); break; #if OPT_SHIFT_FONTS - case 35: /* rxvt */ + case srm_RXVT_FONTSIZE: result = MdBool(xw->misc.shift_fonts); break; #endif #if OPT_TEK4014 - case 38: /* DECTEK */ + case srm_DECTEK: result = MdBool(TEK4014_ACTIVE(xw)); break; #endif - case 40: /* 132 column mode */ + case srm_132COLS: result = MdBool(screen->c132); break; - case 41: /* curses hack */ + case srm_CURSES_HACK: result = MdBool(screen->curses); break; - case 42: /* DECNRCM national charset (VT220) */ + case srm_DECNRCM: /* national charset (VT220) */ result = MdFlag(xw->flags, NATIONAL); break; - case 44: /* margin bell */ + case srm_MARGIN_BELL: /* margin bell */ result = MdBool(screen->marginbell); break; - case 45: /* reverse wraparound */ + case srm_REVERSEWRAP: /* reverse wraparound */ result = MdFlag(xw->flags, REVERSEWRAP); break; #ifdef ALLOWLOGGING - case 46: /* logging */ + case srm_ALLOWLOGGING: /* logging */ #ifdef ALLOWLOGFILEONOFF result = MdBool(screen->logging); #endif /* ALLOWLOGFILEONOFF */ break; #endif - case 1049: /* alternate buffer & cursor */ + case srm_OPT_ALTBUF_CURSOR: /* alternate buffer & cursor */ /* FALLTHRU */ - case 1047: + case srm_OPT_ALTBUF: /* FALLTHRU */ - case 47: /* alternate buffer */ + case srm_ALTBUF: result = MdBool(screen->whichBuf); break; - case 66: /* DECNKM */ + case srm_DECNKM: result = MdFlag(xw->keyboard.flags, MODE_DECKPAM); break; - case 67: /* DECBKM */ + case srm_DECBKM: result = MdFlag(xw->keyboard.flags, MODE_DECBKM); break; - case 69: /* DECLRMM */ + case srm_DECLRMM: result = MdFlag(xw->flags, LEFT_RIGHT); break; - case 95: /* DECNCSM */ +#if OPT_SIXEL_GRAPHICS + case srm_DECSDM: + result = MdFlag(xw->keyboard.flags, MODE_DECSDM); + break; +#endif + case srm_DECNCSM: result = MdFlag(xw->flags, NOCLEAR_COLM); break; - case SET_VT200_MOUSE: /* xterm bogus sequence */ + case srm_VT200_MOUSE: /* xterm bogus sequence */ result = MdBool(screen->send_mouse_pos == VT200_MOUSE); break; - case SET_VT200_HIGHLIGHT_MOUSE: /* xterm sequence w/hilite tracking */ + case srm_VT200_HIGHLIGHT_MOUSE: /* xterm sequence w/hilite tracking */ result = MdBool(screen->send_mouse_pos == VT200_HIGHLIGHT_MOUSE); break; - case SET_BTN_EVENT_MOUSE: + case srm_BTN_EVENT_MOUSE: result = MdBool(screen->send_mouse_pos == BTN_EVENT_MOUSE); break; - case SET_ANY_EVENT_MOUSE: + case srm_ANY_EVENT_MOUSE: result = MdBool(screen->send_mouse_pos == ANY_EVENT_MOUSE); break; #if OPT_FOCUS_EVENT - case SET_FOCUS_EVENT_MOUSE: + case srm_FOCUS_EVENT_MOUSE: result = MdBool(screen->send_focus_pos); break; #endif - case SET_EXT_MODE_MOUSE: + case srm_EXT_MODE_MOUSE: /* FALLTHRU */ - case SET_SGR_EXT_MODE_MOUSE: + case srm_SGR_EXT_MODE_MOUSE: /* FALLTHRU */ - case SET_URXVT_EXT_MODE_MOUSE: + case srm_URXVT_EXT_MODE_MOUSE: result = MdBool(screen->extend_coords == params[0]); break; - case SET_ALTERNATE_SCROLL: + case srm_ALTERNATE_SCROLL: result = MdBool(screen->alternateScroll); break; - case 1010: /* rxvt */ + case srm_RXVT_SCROLL_TTY_OUTPUT: result = MdBool(screen->scrollttyoutput); break; - case 1011: /* rxvt */ + case srm_RXVT_SCROLL_TTY_KEYPRESS: result = MdBool(screen->scrollkey); break; - case 1034: + case srm_EIGHT_BIT_META: result = MdBool(screen->eight_bit_meta); break; #if OPT_NUM_LOCK - case 1035: + case srm_REAL_NUMLOCK: result = MdBool(xw->misc.real_NumLock); break; - case 1036: + case srm_META_SENDS_ESC: result = MdBool(screen->meta_sends_esc); break; #endif - case 1037: + case srm_DELETE_IS_DEL: result = MdBool(screen->delete_is_del); break; #if OPT_NUM_LOCK - case 1039: + case srm_ALT_SENDS_ESC: result = MdBool(screen->alt_sends_esc); break; #endif - case 1040: + case srm_KEEP_SELECTION: result = MdBool(screen->keepSelection); break; - case 1041: + case srm_SELECT_TO_CLIPBOARD: result = MdBool(screen->selectToClipboard); break; - case 1042: + case srm_BELL_IS_URGENT: result = MdBool(screen->bellIsUrgent); break; - case 1043: + case srm_POP_ON_BELL: result = MdBool(screen->poponbell); break; - case 1048: + case srm_TITE_INHIBIT: result = MdBool(screen->sc[screen->whichBuf].saved); break; #if OPT_TCAP_FKEYS - case 1050: + case srm_TCAP_FKEYS: result = MdBool(xw->keyboard.type == keyboardIsTermcap); break; #endif #if OPT_SUN_FUNC_KEYS - case 1051: + case srm_SUN_FKEYS: result = MdBool(xw->keyboard.type == keyboardIsSun); break; #endif #if OPT_HP_FUNC_KEYS - case 1052: + case srm_HP_FKEYS: result = MdBool(xw->keyboard.type == keyboardIsHP); break; #endif #if OPT_SCO_FUNC_KEYS - case 1053: + case srm_SCO_FKEYS: result = MdBool(xw->keyboard.type == keyboardIsSCO); break; #endif - case 1060: + case srm_LEGACY_FKEYS: result = MdBool(xw->keyboard.type == keyboardIsLegacy); break; #if OPT_SUNPC_KBD - case 1061: + case srm_VT220_FKEYS: result = MdBool(xw->keyboard.type == keyboardIsVT220); break; #endif #if OPT_READLINE - case SET_BUTTON1_MOVE_POINT: + case srm_BUTTON1_MOVE_POINT: result = MdBool(screen->click1_moves); break; - case SET_BUTTON2_MOVE_POINT: + case srm_BUTTON2_MOVE_POINT: result = MdBool(screen->paste_moves); break; - case SET_DBUTTON3_DELETE: + case srm_DBUTTON3_DELETE: result = MdBool(screen->dclick3_deletes); break; - case SET_PASTE_IN_BRACKET: + case srm_PASTE_IN_BRACKET: result = MdBool(screen->paste_brackets); break; - case SET_PASTE_QUOTE: + case srm_PASTE_QUOTE: result = MdBool(screen->paste_quotes); break; - case SET_PASTE_LITERAL_NL: + case srm_PASTE_LITERAL_NL: result = MdBool(screen->paste_literal_nl); break; #endif /* OPT_READLINE */ diff --git a/app/xterm/package/debian/changelog b/app/xterm/package/debian/changelog index 30357ffa5..5fda61a07 100644 --- a/app/xterm/package/debian/changelog +++ b/app/xterm/package/debian/changelog @@ -1,3 +1,21 @@ +xterm-dev (296) unstable; urgency=low + + * Build-fix for #295 changes + + -- Thomas E. Dickey <dickey@invisible-island.net> Tue, 09 Jul 2013 21:20:04 -0400 + +xterm-dev (295) unstable; urgency=low + + * Workaround for problem with ld --as-needed option + + -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 06 Jul 2013 21:20:33 -0400 + +xterm-dev (294) unstable; urgency=low + + * Add experimental support for sixel graphics + + -- Thomas E. Dickey <dickey@invisible-island.net> Sun, 23 Jun 2013 10:36:52 -0400 + xterm-dev (293) unstable; urgency=low * Miscellaneous fixes. diff --git a/app/xterm/package/debian/rules b/app/xterm/package/debian/rules index 9f027791f..1d5159f42 100644 --- a/app/xterm/package/debian/rules +++ b/app/xterm/package/debian/rules @@ -72,6 +72,7 @@ configure-stamp: --enable-paste64 \ --enable-rectangles \ --enable-sco-fkeys \ + --enable-sixel-graphics \ --enable-tcap-fkeys \ --enable-tcap-query \ --enable-toolbar \ diff --git a/app/xterm/package/freebsd/Makefile b/app/xterm/package/freebsd/Makefile index 45eb070d7..91d647bfa 100644 --- a/app/xterm/package/freebsd/Makefile +++ b/app/xterm/package/freebsd/Makefile @@ -5,7 +5,7 @@ # and "make makesum". PORTNAME= xterm -PORTVERSION= 291 +PORTVERSION= 296 CATEGORIES= x11 MASTER_SITES= ftp://invisible-island.net/xterm/ \ CRITICAL diff --git a/app/xterm/package/xterm.spec b/app/xterm/package/xterm.spec index 98b3331ba..22ed3b778 100644 --- a/app/xterm/package/xterm.spec +++ b/app/xterm/package/xterm.spec @@ -1,11 +1,11 @@ -# $XTermId: xterm.spec,v 1.50 2013/05/27 15:17:47 tom Exp $ +# $XTermId: xterm.spec,v 1.54 2013/07/10 01:19:30 tom Exp $ Summary: X terminal emulator (development version) %global my_middle xterm %global my_suffix -dev %global fullname %{my_middle}%{my_suffix} %global my_class XTermDev Name: %{fullname} -Version: 293 +Version: 296 Release: 1 License: X11 Group: User Interface/X @@ -95,6 +95,7 @@ CPPFLAGS="-DMISC_EXP -DEXP_HTTP_HEADERS" \ --enable-mini-luit \ --enable-paste64 \ --enable-sco-fkeys \ + --enable-sixel-graphics \ --enable-tcap-fkeys \ --enable-tcap-query \ --enable-toolbar \ diff --git a/app/xterm/plink.sh b/app/xterm/plink.sh index c3c991b10..ea7e268ed 100644 --- a/app/xterm/plink.sh +++ b/app/xterm/plink.sh @@ -1,12 +1,12 @@ #!/bin/sh -# $XTermId: plink.sh,v 1.7 2010/11/28 23:55:35 tom Exp $ +# $XTermId: plink.sh,v 1.10 2013/07/07 01:20:48 tom Exp $ # ----------------------------------------------------------------------------- # this file is part of xterm # -# Copyright 2001-2005,2010 by Thomas E. Dickey -# +# Copyright 2001-2010,2013 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 @@ -14,10 +14,10 @@ # 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. @@ -25,7 +25,7 @@ # 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 @@ -34,8 +34,27 @@ # # Reduce the number of dynamic libraries used to link an executable. LINKIT= +ASNEED=no while test $# != 0 do + if test $ASNEED = no && test -n "$LINKIT" + then + ASNEED=yes + OPT=-Wl,-as-needed + if ( eval $LINKIT $OPT $* >/dev/null 2>/dev/null ) + then + WARNED=`eval $LINKIT $OPT $* 2>&1` + case ".$WARNED" in + *Warning*|*nsupported*|*nrecognized*|*nknown*) + ;; + *) + LINKIT="$LINKIT $OPT $*" + break + ;; + esac + fi + fi + OPT="$1" shift case $OPT in diff --git a/app/xterm/ptyx.h b/app/xterm/ptyx.h index 440a9f5d2..2a6e4e7f1 100644 --- a/app/xterm/ptyx.h +++ b/app/xterm/ptyx.h @@ -1,4 +1,4 @@ -/* $XTermId: ptyx.h,v 1.767 2013/05/27 22:21:32 tom Exp $ */ +/* $XTermId: ptyx.h,v 1.776 2013/06/23 22:00:58 tom Exp $ */ /* * Copyright 1999-2012,2013 by Thomas E. Dickey @@ -517,6 +517,10 @@ typedef struct { #define OPT_DEC_RECTOPS 0 /* true if xterm is configured for VT420 rectangles */ #endif +#ifndef OPT_SIXEL_GRAPHICS +#define OPT_SIXEL_GRAPHICS 0 /* true if xterm supports VT220-style sixel graphics */ +#endif + #ifndef OPT_DEC_SOFTFONT #define OPT_DEC_SOFTFONT 0 /* true if xterm is configured for VT220 softfonts */ #endif @@ -891,6 +895,112 @@ typedef enum { #define IsTitleMode(xw,mode) (((xw)->screen.title_modes & mode) != 0) +#include <xcharmouse.h> + +/* + * Use this enumerated type to check consistency among dpmodes(), savemodes() + * restoremodes() and do_decrpm(). + */ +typedef enum { + srm_DECCKM = 1 + ,srm_DECANM = 2 + ,srm_DECCOLM = 3 + ,srm_DECSCLM = 4 + ,srm_DECSCNM = 5 + ,srm_DECOM = 6 + ,srm_DECAWM = 7 + ,srm_DECARM = 8 + ,srm_X10_MOUSE = SET_X10_MOUSE +#if OPT_TOOLBAR + ,srm_RXVT_TOOLBAR = 10 +#endif +#if OPT_BLINK_CURS + ,srm_ATT610_BLINK = 12 +#endif + ,srm_DECPFF = 18 + ,srm_DECPEX = 19 + ,srm_DECTCEM = 25 + ,srm_RXVT_SCROLLBAR = 30 +#if OPT_SHIFT_FONTS + ,srm_RXVT_FONTSIZE = 35 +#endif +#if OPT_TEK4014 + ,srm_DECTEK = 38 +#endif + ,srm_132COLS = 40 + ,srm_CURSES_HACK = 41 + ,srm_DECNRCM = 42 + ,srm_MARGIN_BELL = 44 + ,srm_REVERSEWRAP = 45 +#ifdef ALLOWLOGGING + ,srm_ALLOWLOGGING = 46 +#endif + ,srm_OPT_ALTBUF_CURSOR = 1049 + ,srm_OPT_ALTBUF = 1047 + ,srm_ALTBUF = 47 + ,srm_DECNKM = 66 + ,srm_DECBKM = 67 + ,srm_DECLRMM = 69 +#if OPT_SIXEL_GRAPHICS + ,srm_DECSDM = 80 /* Sixel Display Mode */ +#endif + ,srm_DECNCSM = 95 + ,srm_VT200_MOUSE = SET_VT200_MOUSE + ,srm_VT200_HIGHLIGHT_MOUSE = SET_VT200_HIGHLIGHT_MOUSE + ,srm_BTN_EVENT_MOUSE = SET_BTN_EVENT_MOUSE + ,srm_ANY_EVENT_MOUSE = SET_ANY_EVENT_MOUSE +#if OPT_FOCUS_EVENT + ,srm_FOCUS_EVENT_MOUSE = SET_FOCUS_EVENT_MOUSE +#endif + ,srm_EXT_MODE_MOUSE = SET_EXT_MODE_MOUSE + ,srm_SGR_EXT_MODE_MOUSE = SET_SGR_EXT_MODE_MOUSE + ,srm_URXVT_EXT_MODE_MOUSE = SET_URXVT_EXT_MODE_MOUSE + ,srm_ALTERNATE_SCROLL = SET_ALTERNATE_SCROLL + ,srm_RXVT_SCROLL_TTY_OUTPUT = 1010 + ,srm_RXVT_SCROLL_TTY_KEYPRESS = 1011 + ,srm_EIGHT_BIT_META = 1034 +#if OPT_NUM_LOCK + ,srm_REAL_NUMLOCK = 1035 + ,srm_META_SENDS_ESC = 1036 +#endif + ,srm_DELETE_IS_DEL = 1037 +#if OPT_NUM_LOCK + ,srm_ALT_SENDS_ESC = 1039 +#endif + ,srm_KEEP_SELECTION = 1040 + ,srm_SELECT_TO_CLIPBOARD = 1041 + ,srm_BELL_IS_URGENT = 1042 + ,srm_POP_ON_BELL = 1043 + ,srm_TITE_INHIBIT = 1048 +#if OPT_TCAP_FKEYS + ,srm_TCAP_FKEYS = 1050 +#endif +#if OPT_SUN_FUNC_KEYS + ,srm_SUN_FKEYS = 1051 +#endif +#if OPT_HP_FUNC_KEYS + ,srm_HP_FKEYS = 1052 +#endif +#if OPT_SCO_FUNC_KEYS + ,srm_SCO_FKEYS = 1053 +#endif + ,srm_LEGACY_FKEYS = 1060 +#if OPT_SUNPC_KBD + ,srm_VT220_FKEYS = 1061 +#endif +#if OPT_SIXEL_GRAPHICS + ,srm_PRIVATE_COLOR_REGISTERS = 1070 +#endif +#if OPT_READLINE + ,srm_BUTTON1_MOVE_POINT = SET_BUTTON1_MOVE_POINT + ,srm_BUTTON2_MOVE_POINT = SET_BUTTON2_MOVE_POINT + ,srm_DBUTTON3_DELETE = SET_DBUTTON3_DELETE + ,srm_PASTE_IN_BRACKET = SET_PASTE_IN_BRACKET + ,srm_PASTE_QUOTE = SET_PASTE_QUOTE + ,srm_PASTE_LITERAL_NL = SET_PASTE_LITERAL_NL +#endif /* OPT_READLINE */ +} DECSET_codes; + /* indices for mapping multiple clicks to selection types */ typedef enum { Select_CHAR=0 @@ -1458,12 +1568,16 @@ typedef enum { #if OPT_SHIFT_FONTS DP_RXVT_FONTSIZE, #endif +#if OPT_SIXEL_GRAPHICS + DP_DECSDM, +#endif #if OPT_TEK4014 DP_DECTEK, #endif #if OPT_TOOLBAR DP_TOOLBAR, #endif + DP_X_PRIVATE_COLOR_REGISTERS, DP_LAST } SaveModes; @@ -1955,7 +2069,7 @@ typedef struct { int scrolls; /* outstanding scroll count, used only with multiscroll */ SavedCursor sc[SAVED_CURSORS]; /* data for restore cursor */ - unsigned save_modes[DP_LAST]; /* save dec/xterm private modes */ + unsigned int save_modes[DP_LAST]; /* save dec/xterm private modes */ int title_modes; /* control set/get of titles */ SaveTitle *save_title; @@ -1995,6 +2109,11 @@ typedef struct { Boolean scroll_dirty; /* scrolling makes screen dirty */ #endif +#if OPT_SIXEL_GRAPHICS + Boolean sixel_scrolling; /* sixel scrolling */ + Boolean privatecolorregisters; /* private color registers for each graphic */ +#endif + #if OPT_VT52_MODE Char vt52_save_curgl; Char vt52_save_curgr; @@ -2452,11 +2571,12 @@ extern WidgetClass tekWidgetClass; #endif /* define masks for keyboard.flags */ -#define MODE_KAM xBIT(0) /* keyboard action mode */ +#define MODE_KAM xBIT(0) /* mode 2: keyboard action mode */ #define MODE_DECKPAM xBIT(1) /* keypad application mode */ -#define MODE_DECCKM xBIT(2) /* cursor keys */ -#define MODE_SRM xBIT(3) /* send-receive mode */ -#define MODE_DECBKM xBIT(4) /* backarrow */ +#define MODE_DECCKM xBIT(2) /* private mode 1: cursor keys */ +#define MODE_SRM xBIT(3) /* mode 12: send-receive mode */ +#define MODE_DECBKM xBIT(4) /* private mode 67: backarrow */ +#define MODE_DECSDM xBIT(5) /* private mode 80: sixel scrolling mode */ #define N_MARGINBELL 10 diff --git a/app/xterm/screen.c b/app/xterm/screen.c index 9de8ad4fd..6f9ac6064 100644 --- a/app/xterm/screen.c +++ b/app/xterm/screen.c @@ -1,4 +1,4 @@ -/* $XTermId: screen.c,v 1.477 2013/04/23 09:50:23 Bertram.Felgenhauer Exp $ */ +/* $XTermId: screen.c,v 1.485 2013/07/10 22:52:16 tom Exp $ */ /* * Copyright 1999-2012,2013 by Thomas E. Dickey @@ -58,7 +58,6 @@ #include <xterm.h> #include <error.h> #include <data.h> -#include <xcharmouse.h> #include <xterm_io.h> #include <X11/Xatom.h> @@ -76,6 +75,8 @@ #define _Xconst const /* Solaris 7 workaround */ #endif /* _Xconst */ +#include <graphics.h> + #define inSaveBuf(screen, buf, inx) \ ((buf) == (screen)->saveBuf_index && \ ((inx) < (screen)->savelines || (screen)->savelines == 0)) @@ -135,7 +136,7 @@ #if OPT_TRACE > 1 static void -traceScrnBuf(const char *tag, TScreen * screen, ScrnBuf sb, unsigned len) +traceScrnBuf(const char *tag, TScreen *screen, ScrnBuf sb, unsigned len) { unsigned j; @@ -155,7 +156,7 @@ traceScrnBuf(const char *tag, TScreen * screen, ScrnBuf sb, unsigned len) #endif static unsigned -scrnHeadSize(TScreen * screen, unsigned count) +scrnHeadSize(TScreen *screen, unsigned count) { unsigned result = SizeOfLineData; @@ -172,7 +173,7 @@ scrnHeadSize(TScreen * screen, unsigned count) } ScrnBuf -scrnHeadAddr(TScreen * screen, ScrnBuf base, unsigned offset) +scrnHeadAddr(TScreen *screen, ScrnBuf base, unsigned offset) { unsigned size = scrnHeadSize(screen, offset); ScrnBuf result = ScrnBufAddr(base, size); @@ -186,7 +187,7 @@ scrnHeadAddr(TScreen * screen, ScrnBuf base, unsigned offset) * Given a block of data, build index to it in the 'base' parameter. */ void -setupLineData(TScreen * screen, ScrnBuf base, Char * data, unsigned nrow, unsigned ncol) +setupLineData(TScreen *screen, ScrnBuf base, Char *data, unsigned nrow, unsigned ncol) { unsigned i; unsigned offset = 0; @@ -248,7 +249,7 @@ setupLineData(TScreen * screen, ScrnBuf base, Char * data, unsigned nrow, unsign * new copy of the screen buffer. */ static void -extractScrnData(TScreen * screen, +extractScrnData(TScreen *screen, ScrnBuf dstPtrs, ScrnBuf srcPtrs, unsigned nrows, @@ -269,7 +270,7 @@ extractScrnData(TScreen * screen, } static ScrnPtr * -allocScrnHead(TScreen * screen, unsigned nrow) +allocScrnHead(TScreen *screen, unsigned nrow) { ScrnPtr *result; unsigned size = scrnHeadSize(screen, 1); @@ -288,7 +289,7 @@ allocScrnHead(TScreen * screen, unsigned nrow) * Return the size of a line's data. */ static unsigned -sizeofScrnRow(TScreen * screen, unsigned ncol) +sizeofScrnRow(TScreen *screen, unsigned ncol) { unsigned result; unsigned sizeAttribs; @@ -321,7 +322,7 @@ sizeofScrnRow(TScreen * screen, unsigned ncol) } Char * -allocScrnData(TScreen * screen, unsigned nrow, unsigned ncol) +allocScrnData(TScreen *screen, unsigned nrow, unsigned ncol) { Char *result; size_t length; @@ -330,7 +331,7 @@ allocScrnData(TScreen * screen, unsigned nrow, unsigned ncol) length = ((nrow + 1) * sizeofScrnRow(screen, ncol)); if (length == 0 || (result = (Char *) calloc(length, sizeof(Char))) == 0) - SysError(ERROR_SCALLOC2); + SysError(ERROR_SCALLOC2); TRACE(("allocScrnData %ux%u -> %lu -> %p..%p\n", nrow, ncol, (unsigned long) length, result, result + length - 1)); @@ -351,7 +352,7 @@ allocScrnData(TScreen * screen, unsigned nrow, unsigned ncol) * We store it all as pointers, because of alignment considerations. */ ScrnBuf -allocScrnBuf(XtermWidget xw, unsigned nrow, unsigned ncol, Char ** addr) +allocScrnBuf(XtermWidget xw, unsigned nrow, unsigned ncol, Char **addr) { TScreen *screen = TScreenOf(xw); ScrnBuf base = 0; @@ -372,7 +373,7 @@ allocScrnBuf(XtermWidget xw, unsigned nrow, unsigned ncol, Char ** addr) * Copy line-data from the visible (edit) buffer to the save-lines buffer. */ static void -saveEditBufLines(TScreen * screen, ScrnBuf sb, unsigned n) +saveEditBufLines(TScreen *screen, ScrnBuf sb, unsigned n) { unsigned j; @@ -396,7 +397,7 @@ saveEditBufLines(TScreen * screen, ScrnBuf sb, unsigned n) * Copy line-data from the save-lines buffer to the visible (edit) buffer. */ static void -unsaveEditBufLines(TScreen * screen, ScrnBuf sb, unsigned n) +unsaveEditBufLines(TScreen *screen, ScrnBuf sb, unsigned n) { unsigned j; @@ -429,8 +430,8 @@ unsaveEditBufLines(TScreen * screen, ScrnBuf sb, unsigned n) */ static int Reallocate(XtermWidget xw, - ScrnBuf * sbuf, - Char ** sbufaddr, + ScrnBuf *sbuf, + Char **sbufaddr, unsigned nrow, unsigned ncol, unsigned oldrow) @@ -523,8 +524,8 @@ Reallocate(XtermWidget xw, */ static void ReallocateBufOffsets(XtermWidget xw, - ScrnBuf * sbuf, - Char ** sbufaddr, + ScrnBuf *sbuf, + Char **sbufaddr, unsigned nrow, unsigned ncol) { @@ -708,10 +709,10 @@ ChangeToWide(XtermWidget xw) #endif /* - * Clear cells, no side-effects. + * Copy cells, no side-effects. */ void -CopyCells(TScreen * screen, LineData * src, LineData * dst, int col, int len) +CopyCells(TScreen *screen, LineData *src, LineData *dst, int col, int len) { if (len > 0) { int n; @@ -819,7 +820,7 @@ ScrnDisownSelection(XtermWidget xw) */ void ScrnWriteText(XtermWidget xw, - IChar * str, + IChar *str, unsigned flags, unsigned cur_fg_bg, unsigned length) @@ -835,7 +836,7 @@ ScrnWriteText(XtermWidget xw, unsigned n; unsigned real_width = visual_width(str, length); - (void) cur_fg_bg; + (void) cur_fg_bg; /* quiet compiler warnings when unused */ if (real_width + (unsigned) screen->cur_col > (unsigned) MaxCols(screen)) { real_width = (unsigned) (MaxCols(screen) - screen->cur_col); @@ -937,6 +938,15 @@ ScrnWriteText(XtermWidget xw, screen->last_written_row = screen->cur_row; #endif + TRACE(("text erasing cur_col=%d cur_row=%d real_width=%d\n", + screen->cur_col, + screen->cur_row, + real_width)); + chararea_clear_displayed_graphics(screen, + screen->cur_col, + screen->cur_row, + (int) real_width, 1); + if_OPT_XMC_GLITCH(screen, { Resolve_XMC(xw); }); @@ -1007,6 +1017,17 @@ ScrnClearLines(XtermWidget xw, ScrnBuf sb, int where, unsigned n, unsigned size) #endif base = ScrnBufAddr(base, jump); } + + TRACE(("clear lines erasing where=%d screen->savelines=%d n=%d screen->max_col=%d\n", + where, + screen->savelines, + n, + screen->max_col)); + chararea_clear_displayed_graphics(screen, + where + screen->savelines, + 0, + screen->max_col + 1, + (int) n); } /* @@ -1064,7 +1085,7 @@ ScrnAllocBuf(XtermWidget xw) } size_t -ScrnPointers(TScreen * screen, size_t len) +ScrnPointers(TScreen *screen, size_t len) { size_t result = scrnHeadSize(screen, (unsigned) len); @@ -1337,7 +1358,7 @@ ScrnDeleteChar(XtermWidget xw, unsigned n) * its line-wrapping state. */ void -ShowWrapMarks(XtermWidget xw, int row, LineData * ld) +ShowWrapMarks(XtermWidget xw, int row, LineData *ld) { TScreen *screen = TScreenOf(xw); Boolean set = (Boolean) LineTstWrapped(ld); @@ -1699,6 +1720,12 @@ ScrnRefresh(XtermWidget xw, resetXtermGC(xw, flags, hilite); } + refresh_displayed_graphics(screen, + leftcol, + toprow + screen->topline, + ncols, + nrows); + /* * If we're in color mode, reset the various GC's to the current * screen foreground and background so that other functions (e.g., @@ -2142,6 +2169,7 @@ ScreenResize(XtermWidget xw, screen->fullVwin.height = height - border; screen->fullVwin.width = width - border - screen->fullVwin.sb_info.width; + scroll_displayed_graphics(-move_down_by); } else if (FullHeight(screen) == height && FullWidth(screen) == width) return (0); /* nothing has changed at all */ @@ -2211,7 +2239,7 @@ ScreenResize(XtermWidget xw, * nonnull. */ Bool -non_blank_line(TScreen * screen, +non_blank_line(TScreen *screen, int row, int col, int len) @@ -2768,7 +2796,7 @@ unset_resize_increments(XtermWidget xw) } static void -set_ewmh_hint(Display * dpy, Window window, int operation, _Xconst char *prop) +set_ewmh_hint(Display *dpy, Window window, int operation, _Xconst char *prop) { XEvent e; Atom atom_fullscreen = XInternAtom(dpy, prop, False); @@ -2799,7 +2827,7 @@ set_ewmh_hint(Display * dpy, Window window, int operation, _Xconst char *prop) * window. */ static Boolean -probe_netwm(Display * dpy, _Xconst char *propname) +probe_netwm(Display *dpy, _Xconst char *propname) { Atom atom_fullscreen = XInternAtom(dpy, propname, False); Atom atom_supported = XInternAtom(dpy, "_NET_SUPPORTED", False); diff --git a/app/xterm/scrollbar.c b/app/xterm/scrollbar.c index 8c554e1e1..58bd1875b 100644 --- a/app/xterm/scrollbar.c +++ b/app/xterm/scrollbar.c @@ -1,4 +1,4 @@ -/* $XTermId: scrollbar.c,v 1.196 2013/02/26 23:36:05 tom Exp $ */ +/* $XTermId: scrollbar.c,v 1.197 2013/06/23 21:55:39 tom Exp $ */ /* * Copyright 2000-2012,2013 by Thomas E. Dickey @@ -74,7 +74,6 @@ #include <data.h> #include <error.h> #include <menu.h> -#include <xcharmouse.h> #include <xstrings.h> /* diff --git a/app/xterm/util.c b/app/xterm/util.c index f5efc1067..b36db3730 100644 --- a/app/xterm/util.c +++ b/app/xterm/util.c @@ -1,4 +1,4 @@ -/* $XTermId: util.c,v 1.601 2013/05/09 01:00:59 tom Exp $ */ +/* $XTermId: util.c,v 1.606 2013/07/10 22:52:14 tom Exp $ */ /* * Copyright 1999-2012,2013 by Thomas E. Dickey @@ -73,6 +73,8 @@ #include <wcwidth.h> #endif +#include <graphics.h> + static int handle_translated_exposure(XtermWidget xw, int rect_x, int rect_y, @@ -104,7 +106,7 @@ int (*my_wcwidth) (wchar_t); * that we should fill with blanks, return true if filling is needed. */ int -DamagedCells(TScreen * screen, unsigned n, int *klp, int *krp, int row, int col) +DamagedCells(TScreen *screen, unsigned n, int *klp, int *krp, int row, int col) { LineData *ld = getLineData(screen, row); int result = False; @@ -157,7 +159,7 @@ DamagedCells(TScreen * screen, unsigned n, int *klp, int *krp, int row, int col) } int -DamagedCurCells(TScreen * screen, unsigned n, int *klp, int *krp) +DamagedCurCells(TScreen *screen, unsigned n, int *klp, int *krp) { return DamagedCells(screen, n, klp, krp, screen->cur_row, screen->cur_col); } @@ -685,6 +687,8 @@ xtermScroll(XtermWidget xw, int amount) } } + scroll_displayed_graphics(amount); + if (refreshheight > 0) { ScrnRefresh(xw, refreshtop, @@ -1012,7 +1016,7 @@ resetZIconBeep(XtermWidget xw) * the current cursor position. update cursor position. */ void -WriteText(XtermWidget xw, IChar * str, Cardinal len) +WriteText(XtermWidget xw, IChar *str, Cardinal len) { TScreen *screen = TScreenOf(xw); LineData *ld = 0; @@ -1485,6 +1489,12 @@ ClearAbove(XtermWidget xw) if ((height = screen->cur_row + top) > screen->max_row) height = screen->max_row + 1; if ((height -= top) > 0) { + chararea_clear_displayed_graphics(screen, + 0, + top, + MaxCols(screen), + height); + ClearCurBackground(xw, top, 0, @@ -1523,6 +1533,11 @@ ClearBelow(XtermWidget xw) if (screen->scroll_amt) FlushScroll(xw); if (++top <= screen->max_row) { + chararea_clear_displayed_graphics(screen, + 0, + top, + MaxCols(screen), + (screen->max_row - top + 1)); ClearCurBackground(xw, top, 0, @@ -1749,6 +1764,11 @@ ClearScreen(XtermWidget xw) if ((top = INX2ROW(screen, 0)) <= screen->max_row) { if (screen->scroll_amt) FlushScroll(xw); + chararea_clear_displayed_graphics(screen, + 0, + top, + MaxCols(screen), + (screen->max_row - top + 1)); ClearCurBackground(xw, top, 0, @@ -2029,14 +2049,18 @@ vertical_copy_area(XtermWidget xw, { TScreen *screen = TScreenOf(xw); + TRACE(("vertical_copy_area - firstline=%d nlines=%d left=%d right=%d amount=%d\n", + firstline, nlines, left, right, amount)); + if (nlines > 0) { int src_x = CursorX(screen, left); int src_y = firstline * FontHeight(screen) + screen->border; + unsigned int w = (unsigned) ((right + 1 - left) * FontWidth(screen)); + unsigned int h = (unsigned) (nlines * FontHeight(screen)); + int dst_x = src_x; + int dst_y = src_y - amount * FontHeight(screen); - copy_area(xw, src_x, src_y, - (unsigned) ((right + 1 - left) * FontWidth(screen)), - (unsigned) (nlines * FontHeight(screen)), - src_x, src_y - amount * FontHeight(screen)); + copy_area(xw, src_x, src_y, w, h, dst_x, dst_y); if (screen->show_wrap_marks) { LineData *ld; @@ -2078,10 +2102,10 @@ HandleExposure(XtermWidget xw, XEvent * event) #ifndef NO_ACTIVE_ICON if (reply->window == screen->iconVwin.window) { WhichVWin(screen) = &screen->iconVwin; - TRACE(("HandleExposure - icon")); + TRACE(("HandleExposure - icon\n")); } else { WhichVWin(screen) = &screen->fullVwin; - TRACE(("HandleExposure - normal")); + TRACE(("HandleExposure - normal\n")); } TRACE((" event %d,%d %dx%d\n", reply->y, @@ -2387,13 +2411,13 @@ xtermRepaint(XtermWidget xw) Boolean isDefaultForeground(const char *name) { - return (Boolean) ! x_strcasecmp(name, XtDefaultForeground); + return (Boolean) !x_strcasecmp(name, XtDefaultForeground); } Boolean isDefaultBackground(const char *name) { - return (Boolean) ! x_strcasecmp(name, XtDefaultBackground); + return (Boolean) !x_strcasecmp(name, XtDefaultBackground); } #if OPT_WIDE_CHARS @@ -2540,7 +2564,7 @@ ReverseVideo(XtermWidget xw) swapVTwinGCs(xw, &(screen->iconVwin)); #endif /* NO_ACTIVE_ICON */ - xw->misc.re_verse = (Boolean) ! xw->misc.re_verse; + xw->misc.re_verse = (Boolean) !xw->misc.re_verse; if (XtIsRealized((Widget) xw)) { xtermDisplayCursor(xw); @@ -2581,7 +2605,7 @@ ReverseVideo(XtermWidget xw) } void -recolor_cursor(TScreen * screen, +recolor_cursor(TScreen *screen, Cursor cursor, /* X cursor ID to set */ unsigned long fg, /* pixel indexes to look up */ unsigned long bg) /* pixel indexes to look up */ @@ -2688,7 +2712,7 @@ xtermXftDrawString(XtermWidget xw, XftFont * font, int x, int y, - IChar * text, + IChar *text, Cardinal len, Bool really) { @@ -2972,7 +2996,7 @@ xtermFillCells(XtermWidget xw, #if OPT_TRACE static void -xtermSetClipRectangles(Display * dpy, +xtermSetClipRectangles(Display *dpy, GC gc, int x, int y, @@ -3061,7 +3085,7 @@ drawClippedXftString(XtermWidget xw, XftColor * fg_color, int x, int y, - IChar * text, + IChar *text, Cardinal len) { int ncells = xtermXftWidth(xw, flags, @@ -3100,13 +3124,14 @@ int drawXtermText(XtermWidget xw, unsigned flags, GC gc, - int x, - int y, + int start_x, + int start_y, int chrset, - IChar * text, + IChar *text, Cardinal len, int on_wide) { + int x = start_x, y = start_y; TScreen *screen = TScreenOf(xw); Cardinal real_length = len; Cardinal underline_len = 0; @@ -3421,7 +3446,10 @@ drawXtermText(XtermWidget xw, x + (int) underline_len * FontWidth(screen) - 1, y); } - return x + (int) len *FontWidth(screen); + + x += (int) len *FontWidth(screen); + + return x; } #endif /* OPT_RENDERFONT */ /* @@ -3471,6 +3499,7 @@ drawXtermText(XtermWidget xw, gc, x + adj, y, chrset, text++, 1, on_wide) - adj; } + return x; } #if OPT_BOX_CHARS @@ -3812,7 +3841,8 @@ drawXtermText(XtermWidget xw, x, y, (x + (int) underline_len * font_width - 1), y); } - return x + (int) real_length *FontWidth(screen); + x += (int) real_length *FontWidth(screen); + return x; } #if OPT_WIDE_CHARS @@ -4113,7 +4143,7 @@ ClearCurBackground(XtermWidget xw, * Returns a single base character for the given cell. */ unsigned -getXtermCell(TScreen * screen, int row, int col) +getXtermCell(TScreen *screen, int row, int col) { LineData *ld = getLineData(screen, row); @@ -4126,7 +4156,7 @@ getXtermCell(TScreen * screen, int row, int col) * Sets a single base character for the given cell. */ void -putXtermCell(TScreen * screen, int row, int col, int ch) +putXtermCell(TScreen *screen, int row, int col, int ch) { LineData *ld = getLineData(screen, row); @@ -4146,7 +4176,7 @@ putXtermCell(TScreen * screen, int row, int col, int ch) * Add a combining character for the given cell */ void -addXtermCombining(TScreen * screen, int row, int col, unsigned ch) +addXtermCombining(TScreen *screen, int row, int col, unsigned ch) { if (ch != 0) { LineData *ld = getLineData(screen, row); @@ -4165,7 +4195,7 @@ addXtermCombining(TScreen * screen, int row, int col, unsigned ch) } unsigned -getXtermCombining(TScreen * screen, int row, int col, int off) +getXtermCombining(TScreen *screen, int row, int col, int off) { LineData *ld = getLineData(screen, row); return ld->combData[off][col]; diff --git a/app/xterm/version.h b/app/xterm/version.h index 2c28fd889..88ccf98c2 100644 --- a/app/xterm/version.h +++ b/app/xterm/version.h @@ -1,4 +1,4 @@ -/* $XTermId: version.h,v 1.364 2013/05/28 00:02:50 tom Exp $ */ +/* $XTermId: version.h,v 1.370 2013/07/10 23:53:57 tom Exp $ */ /* * Copyright 1998-2012,2013 by Thomas E. Dickey @@ -38,8 +38,8 @@ * version of X to which this version of xterm has been built. The resulting * number in parentheses is my patch number (Thomas E. Dickey). */ -#define XTERM_PATCH 293 -#define XTERM_DATE 2013-05-27 +#define XTERM_PATCH 296 +#define XTERM_DATE 2013-07-10 #ifndef __vendorversion__ #define __vendorversion__ "XTerm/OpenBSD" diff --git a/app/xterm/xterm.h b/app/xterm/xterm.h index 2a8ceb376..6c8550b1f 100644 --- a/app/xterm/xterm.h +++ b/app/xterm/xterm.h @@ -1,4 +1,4 @@ -/* $XTermId: xterm.h,v 1.718 2013/04/24 08:55:50 tom Exp $ */ +/* $XTermId: xterm.h,v 1.720 2013/06/23 08:57:13 Ross.Combs Exp $ */ /* * Copyright 1999-2012,2013 by Thomas E. Dickey @@ -479,6 +479,7 @@ extern char **environ; #define XtNpointerMode "pointerMode" #define XtNpointerShape "pointerShape" #define XtNpopOnBell "popOnBell" +#define XtNprivateColorRegisters "privateColorRegisters" #define XtNprecompose "precompose" #define XtNprintAttributes "printAttributes" #define XtNprinterAutoClose "printerAutoClose" @@ -507,6 +508,7 @@ extern char **environ; #define XtNshowMissingGlyphs "showMissingGlyphs" #define XtNshowWrapMarks "showWrapMarks" #define XtNsignalInhibit "signalInhibit" +#define XtNsixelScrolling "sixelScrolling" #define XtNtekGeometry "tekGeometry" #define XtNtekInhibit "tekInhibit" #define XtNtekSmall "tekSmall" @@ -636,8 +638,8 @@ extern char **environ; #define XtCMenuBar "MenuBar" #define XtCMenuHeight "MenuHeight" #define XtCMetaSendsEscape "MetaSendsEscape" -#define XtCMkSamplePass "MkSamplePass" -#define XtCMkSampleSize "MkSampleSize" +#define XtCMkSamplePass "MkSamplePass" +#define XtCMkSampleSize "MkSampleSize" #define XtCMkWidth "MkWidth" #define XtCModifyCursorKeys "ModifyCursorKeys" #define XtCModifyFunctionKeys "ModifyFunctionKeys" @@ -651,6 +653,7 @@ extern char **environ; #define XtCOldXtermFKeys "OldXtermFKeys" #define XtCPointerMode "PointerMode" #define XtCPopOnBell "PopOnBell" +#define XtCPrivateColorRegisters "PrivateColorRegisters" #define XtCPrecompose "Precompose" #define XtCPrintAttributes "PrintAttributes" #define XtCPrinterAutoClose "PrinterAutoClose" @@ -678,6 +681,7 @@ extern char **environ; #define XtCShowMissingGlyphs "ShowMissingGlyphs" #define XtCShowWrapMarks "ShowWrapMarks" #define XtCSignalInhibit "SignalInhibit" +#define XtCSixelScrolling "SixelScrolling" #define XtCTekInhibit "TekInhibit" #define XtCTekSmall "TekSmall" #define XtCTekStartup "TekStartup" @@ -997,6 +1001,7 @@ extern char *xtermEnvEncoding (void); extern char *xtermFindShell (char * /* leaf */, Bool /* warning */); extern const char *SysErrorMsg (int /* n */); extern const char *SysReasonMsg (int /* n */); +extern Boolean allocateBestRGB(XtermWidget /* xw */, XColor * /* def */); extern int ResetAnsiColorRequest (XtermWidget, char *, int); extern int XStrCmp (char * /* s1 */, char * /* s2 */); extern int creat_as (uid_t /* uid */, gid_t /* gid */, Bool /* append */, char * /* pathname */, unsigned /* mode */); diff --git a/app/xterm/xterm.log.html b/app/xterm/xterm.log.html index 03278a2eb..13954ea18 100644 --- a/app/xterm/xterm.log.html +++ b/app/xterm/xterm.log.html @@ -30,7 +30,7 @@ * sale, use or other dealings in this Software without prior written * * authorization. * ***************************************************************************** - $XTermId: xterm.log.html,v 1.1351 2013/05/28 00:01:55 tom Exp $ + $XTermId: xterm.log.html,v 1.1366 2013/07/10 23:46:32 tom Exp $ --> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> @@ -69,6 +69,12 @@ CHANGELOG</a>).</p> <ul> + <li><a href="#xterm_296">Patch #296 - 2013/07/10</a></li> + + <li><a href="#xterm_295">Patch #295 - 2013/07/06</a></li> + + <li><a href="#xterm_294">Patch #294 - 2013/07/05</a></li> + <li><a href="#xterm_293">Patch #293 - 2013/05/27</a></li> <li><a href="#xterm_292">Patch #292 - 2013/04/25</a></li> @@ -868,6 +874,62 @@ <li><a href="#xterm_01">Patch #1 - 1996/1/6</a></li> </ul> + <h1><a name="xterm_296" id="xterm_296">Patch #296 - + 2013/07/10</a></h1> + + <ul> + <li>improve experimental sixel feature (patch by Ross + Combs).</li> + + <li>modify delimiter in configure macro used to add a library + after a given library to avoid confusion with <code>-Wl</code> + pass-through options to linker (NetBSD #48031).</li> + + <li>fix quoting in expression used to trim extra libraries from + <a href="#xterm_295">patch #295</a> changes (report by Thomas + Klausner).</li> + </ul> + + <h1><a name="xterm_295" id="xterm_295">Patch #295 - + 2013/07/06</a></h1> + + <ul> + <li>adjust order of libraries to work around incomplete symbol + resolution when using <code>--as-needed</code> option + (ArchLinux #36047).</li> + + <li>minor fix for <code>plink.sh</code>, for IRIX64.</li> + </ul> + + <h1><a name="xterm_294" id="xterm_294">Patch #294 - + 2013/07/05</a></h1> + + <ul> + <li>add note in ctlseqs.ms for CPR response pointing out a + potential point of confusion with the string sent by a modified + F1 key (suggested by Bram Moolenaar).</li> + + <li>improve <code>plink.sh</code> by checking if the linker + supports the <code>--as-needed</code> option (suggested by + David Philippi).</li> + + <li>improve clearing for private mode 1049 when switching to + the alternate screen (Debian #711758).</li> + + <li>amend fix from <a href="#xterm_292">patch #292</a> by + removing now-unneeded chunk which introduced problem in + selection (Debian #714527).</li> + + <li>add definition to optionally override compiled-in class for + xterm from makefile, needed for test-packages.</li> + + <li>add configure option + <code>--enable-sixel-graphics</code></li> + + <li>add experimental support for sixel graphics (patch by Ross + Combs).</li> + </ul> + <h1><a name="xterm_293" id="xterm_293">Patch #293 - 2013/05/27</a></h1> @@ -1001,8 +1063,8 @@ by Peder Stray).</li> <li>fix inconsistent use of noreturn-attribute in - <code>Exit</code> function which interfered with analysis by - clang.</li> + <code>Exit</code> function which interfered with clang + --analyze.</li> <li>remove incorrect <code>free</code> used in computation of <code>XTERM_SHELL</code> variable, from Coverity fixes in @@ -1127,9 +1189,9 @@ <li>modify the handling of focus-change events to ignore those whose detail is <code>NotifyPointer</code>, since those are sent in addition to focus-change events directed to the old/new - windows having focus (prompted by patch by Balazs Kezes to - prevent the urgency-hint from being reset in this - scenario).</li> + windows having focus. In particular, this prevents the + urgency-hint from being reset inadvertantly (prompted by patch + by Balazs Kezes).</li> <li>modify description of <code>iconName</code> in manpage to make it clearer that this resource does not specify the @@ -1219,7 +1281,7 @@ existing uses of the <code>iconName</code> resource in the <code>Shell</code> widget (report by Emanuel Haupt).</li> - <li>fix documentation errata (reports by Miroslav Lichvar): + <li>fix documentation errata reported by Miroslav Lichvar: <ul> <li>correct manpage default for <code>allowTcapOps</code> @@ -8528,7 +8590,7 @@ Klanderman). Smith).</li> <li>modify terminfo entry for <code>xterm-xfree86</code> to - reflect modifiers for shift and control which (from a patch by + reflect modifiers for shift and control (from a patch by Alexander V Lukyanov).</li> <li>modify terminfo entry for <code>xterm-sun</code> to match diff --git a/app/xterm/xterm.man b/app/xterm/xterm.man index 5afc9975c..e91174049 100644 --- a/app/xterm/xterm.man +++ b/app/xterm/xterm.man @@ -1,5 +1,5 @@ '\" t -.\" $XTermId: xterm.man,v 1.564 2013/05/16 09:57:06 tom Exp $ +.\" $XTermId: xterm.man,v 1.569 2013/07/05 20:35:30 tom Exp $ .\" .\" Copyright 1996-2012,2013 by Thomas E. Dickey .\" @@ -971,7 +971,7 @@ Specify the name used by \fI\*n\fP to select the correct response to terminal ID queries. It also specifies the emulation level, used to determine the type of response to a DA control sequence. -Valid values include vt52, vt100, vt101, vt102, and vt220 +Valid values include vt52, vt100, vt101, vt102, vt220, and vt240 (the \*(``vt\*('' is optional). The default is \*(``vt__default_termid__\*(''. The term_id argument specifies the terminal ID to use. @@ -3540,6 +3540,13 @@ Controls whether a newline is sent to the printer at the end of a print page function. The default is \*(``true\*(''. .TP 8 +.B "privateColorRegisters (\fPclass\fB privateColorRegisters)" +If true, allocate separate color registers for each sixel +device control string, e.g., for DECGCI. +If not true, color registers are allocated only once, +when the terminal is reset. +The default is \*(``true\*(''. +.TP 8 .B "quietGrab (\fPclass\fB QuietGrab)" Controls whether the cursor is repainted when \fINotifyGrab\fP and \fINotifyUngrab\fP @@ -3743,6 +3750,11 @@ Specifies whether or not the entries in the \*(``Main Options\*('' menu for send signals to \fI\*n\fP should be disallowed. The default is \*(``false\*(''. .TP 8 +.B "sixelScrolling (\fPclass\fB SixelScrolling)" +If true, graphics scroll up one line at a time when sixels would be written +past the bottom line on the window. +The default is \*(``false\*(''. +.TP 8 .B "tekGeometry (\fPclass\fB Geometry)" Specifies the preferred size and position of the Tektronix window. There is no default for this resource. @@ -4240,6 +4252,9 @@ This entry invokes the \fBset-visibility(vt,off)\fP action. .TP 8 .B "altscreen (\fPclass\fB SmeBSB)" This entry invokes the \fBset-altscreen(toggle)\fP action. +.TP 8 +.B "sixelScrolling (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-sixel-scrolling(toggle)\fP action. . .PP The \fIVT Fonts\fP menu (widget name \fIfontMenu\fP) @@ -4908,6 +4923,34 @@ This corresponds to the option and the .B activeIcon resource. +. +.TP +Sixel Scrolling (sixelScrolling) +When enabled, +sixel graphics are positioned at the current text cursor location, scroll +the image vertically if larger than the screen, and leave the text cursor +after the image when returning to text mode. +When disabled, +sixel graphics are positioned at the upper left of the screen, are +cropped to fit the screen, and do not affect the text cursor location +(this is the default). +This corresponds to the +.B sixelScrolling +resource. +There is no corresponding command-line option. +. +.TP +Private Color Registers (privateColorRegisters) +When enabled, +each graphic image uses a separate set of color registers, so that it +essentially has a private palette (this is the default). If it is not set, +all graphics images share a common set of registers which is how sixel and +ReGIS graphics worked on actual hardware. The default is likely a more +useful mode on modern TrueColor hardware. +This corresponds to the +.B privateColorRegisters +resource. +There is no corresponding command-line option. .RE . .TP @@ -5883,6 +5926,9 @@ This action toggles the state of the \fBnumLock\fP resource. This action sets, unsets or toggles the \fBpopOnBell\fP resource. It is also invoked by the \fBpoponbell\fP entry in \fIvtMenu\fP. .TP 8 +.B "set-private-colors(\fIon/off/toggle\fP)" +This action sets, unsets or toggles the \fBprivateColorRegisters\fP resource. +.TP 8 .B "set-render-font(\fIon/off/toggle\fP)" This action sets, unsets or toggles the \fBrenderFont\fP resource. It is also invoked by the \fBrender-font\fP entry in \fIfontMenu\fP. @@ -5907,13 +5953,18 @@ It is also invoked from the \fBscrollttyoutput\fP entry in \fIvtMenu\fP. This action sets, unsets or toggles the \fBscrollbar\fP resource. It is also invoked by the \fBscrollbar\fP entry in \fIvtMenu\fP. .TP 8 +.B "set-sco-function-keys(\fIon/off/toggle\fP)" +This action sets, unsets or toggles the \fBscoFunctionKeys\fP resource. +It is also invoked by the \fBscoFunctionKeys\fP entry in \fImainMenu\fP. +.TP 8 .B "set-select(\fIon/off/toggle\fP)" This action sets, unsets or toggles the \fBselectToClipboard\fP resource. It is also invoked by the \fBselectToClipboard\fP entry in \fIvtMenu\fP. .TP 8 -.B "set-sco-function-keys(\fIon/off/toggle\fP)" -This action sets, unsets or toggles the \fBscoFunctionKeys\fP resource. -It is also invoked by the \fBscoFunctionKeys\fP entry in \fImainMenu\fP. +.B "set-sixel-scrolling(\fIon/off/toggle\fP)" +This action toggles between inline (sixel scrolling) and absolute positioning. +It can also be controlled via DEC private mode 80 (DECSDM) or from +the \fBsixelScrolling\fP entry in the \fIbtMenu\fP. .TP 8 .B "set-sun-function-keys(\fIon/off/toggle\fP)" This action sets, unsets or toggles the \fBsunFunctionKeys\fP resource. @@ -6089,7 +6140,6 @@ This action sends the indicated graphics input code. The default bindings in the VT102 window use the SELECT token, which is set by the \fBselectToClipboard\fP resource: .NS -.ta 2.5i Shift <KeyPress> Prior:scroll-back(1,halfpage) \\n\\\& Shift <KeyPress> Next:scroll-forw(1,halfpage) \\n\\\& Shift <KeyPress> Select:select-cursor-start() \\\& @@ -6138,7 +6188,6 @@ which is set by the \fBselectToClipboard\fP resource: The default bindings for the scrollbar widget are separate from the VT100 widget: .NS -.ta 2.5i <Btn5Down>: StartScroll(Forward) \\n\\\& <Btn1Down>: StartScroll(Forward) \\n\\\& <Btn2Down>: StartScroll(Continuous) MoveThumb() NotifyThumb() \\n\\\& @@ -6150,7 +6199,6 @@ are separate from the VT100 widget: .PP The default bindings in the Tektronix window are: .NS -.ta 2.5i ~Meta<KeyPress>: insert-seven-bit() \\n\\\& Meta<KeyPress>: insert-eight-bit() \\n\\\& !Ctrl <Btn1Down>: popup-menu(mainMenu) \\n\\\& @@ -6180,7 +6228,6 @@ While \fI\*n\fP owns the selection, it highlights it. When it loses the selection, it removes the corresponding highlight. But you can still paste from the corresponding cut buffer. .NS -.ta .5i 1.5i *VT100*translations: #override \\n\\\& ~Shift~Ctrl<Btn2Up>: insert-selection(PRIMARY, CUT_BUFFER0) \\n\\\& Shift~Ctrl<Btn2Up>: insert-selection(CLIPBOARD, CUT_BUFFER1) \\n\\\& @@ -6191,7 +6238,6 @@ But you can still paste from the corresponding cut buffer. Below is a sample of how the \fBkeymap()\fP action is used to add special keys for entering commonly-typed works: .NS -.ta .5i 1.5i *VT100.Translations: #override <Key>F13: keymap(dbx) *VT100.dbxKeymap.translations: \\\& <Key>F14: keymap(None) \\n\\\& @@ -6205,7 +6251,6 @@ Some people prefer using the left pointer button for dragging the scrollbar thumb. That can be setup by altering the translations resource, e.g., .NS -.ta .5i 1.5i *VT100.scrollbar.translations: #override \\n\\\& <Btn5Down>: StartScroll(Forward) \\n\\\& <Btn1Down>: StartScroll(Continuous) MoveThumb() NotifyThumb() \\n\\\& diff --git a/app/xterm/xtermcap.h b/app/xterm/xtermcap.h index 66aa08088..8c4bc41ef 100644 --- a/app/xterm/xtermcap.h +++ b/app/xterm/xtermcap.h @@ -1,4 +1,4 @@ -/* $XTermId: xtermcap.h,v 1.18 2011/09/11 14:59:33 tom Exp $ */ +/* $XTermId: xtermcap.h,v 1.19 2013/06/23 15:34:37 tom Exp $ */ /* * Copyright 2007-2010,2011 by Thomas E. Dickey @@ -35,6 +35,7 @@ */ #ifndef included_xtermcap_h #define included_xtermcap_h +/* *INDENT-OFF* */ #include <xterm.h> @@ -115,4 +116,5 @@ extern int xtermcapKeycode(XtermWidget /* xw */, const char ** /* params */, uns } #endif +/* *INDENT-ON* */ #endif /* included_xtermcap_h */ diff --git a/app/xterm/xtermcfg.h b/app/xterm/xtermcfg.h index 959ad2d06..105208948 100644 --- a/app/xterm/xtermcfg.h +++ b/app/xterm/xtermcfg.h @@ -1,4 +1,4 @@ -/* $XTermId: xtermcfg.hin,v 1.199 2013/05/27 21:05:23 tom Exp $ */ +/* $XTermId: xtermcfg.hin,v 1.200 2013/06/23 19:20:22 tom Exp $ */ /************************************************************ @@ -148,6 +148,7 @@ authorization. /* #undef OPT_SELECTION_OPS /* CF_ARG_DISABLE(selection-ops) */ #define OPT_SELECT_REGEX 1 /* CF_ARG_DISABLE(regex) */ /* #undef OPT_SESSION_MGT */ /* CF_ARG_DISABLE(session-mgt) */ +/* #undef OPT_SIXEL_GRAPHICS 1 /* CF_ARG_ENABLE(sixel-graphics) */ /* #undef OPT_SUN_FUNC_KEYS */ /* CF_ARG_ENABLE(sun-fkeys) */ /* #undef OPT_TCAP_FKEYS */ /* CF_ARG_ENABLE(tcap-fkeys) */ /* #undef OPT_TCAP_QUERY */ /* CF_ARG_ENABLE(tcap-query) */ diff --git a/app/xterm/xtermcfg.hin b/app/xterm/xtermcfg.hin index f6841e681..381f2a7fd 100644 --- a/app/xterm/xtermcfg.hin +++ b/app/xterm/xtermcfg.hin @@ -1,4 +1,4 @@ -/* $XTermId: xtermcfg.hin,v 1.199 2013/05/27 21:05:23 tom Exp $ */ +/* $XTermId: xtermcfg.hin,v 1.200 2013/06/23 19:20:22 tom Exp $ */ /* * Copyright 1997-2012,2013 by Thomas E. Dickey @@ -147,6 +147,7 @@ #undef OPT_SELECTION_OPS /* CF_ARG_DISABLE(selection-ops) */ #undef OPT_SELECT_REGEX /* CF_ARG_DISABLE(regex) */ #undef OPT_SESSION_MGT /* CF_ARG_DISABLE(session-mgt) */ +#undef OPT_SIXEL_GRAPHICS /* CF_ARG_ENABLE(sixel-graphics) */ #undef OPT_SUN_FUNC_KEYS /* CF_ARG_ENABLE(sun-fkeys) */ #undef OPT_TCAP_FKEYS /* CF_ARG_ENABLE(tcap-fkeys) */ #undef OPT_TCAP_QUERY /* CF_ARG_ENABLE(tcap-query) */ |