Compare commits
	
		
			63 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | cc7568c498 | ||
|  | 56e044e39f | ||
|  | 10ecb6e59a | ||
|  | 77b8738d51 | ||
| 87f18bcee6 | |||
|  | 7d4fe918bc | ||
|  | 37f1db62d4 | ||
|  | 13974f558a | ||
|  | 40bc165ce4 | ||
|  | bd21c14273 | ||
|  | f95dcd2cbb | ||
|  | f700edae17 | ||
|  | 43071f5bad | ||
|  | 8430e5c5ec | ||
|  | f114bcedd1 | ||
|  | 98610fcd37 | ||
|  | 6009e6e25b | ||
|  | a0274bc20e | ||
|  | 5dbcca4926 | ||
|  | d63b9eb902 | ||
|  | 497a756382 | ||
|  | 8c68ec5241 | ||
|  | 5ce9716281 | ||
|  | f20e169a20 | ||
|  | 95f22c5305 | ||
|  | 7473a8d1a5 | ||
|  | a3f7420310 | ||
|  | 9846a56bd7 | ||
|  | 559fdc2786 | ||
|  | 8abe4bcb41 | ||
|  | 2fc7e532b2 | ||
|  | a6bbc0c96b | ||
|  | eb3b894f40 | ||
|  | 3a6d6d7401 | ||
|  | 211964d56e | ||
|  | f17abd25b3 | ||
|  | 7e8050cc62 | ||
|  | e5e959835b | ||
|  | 68d1ad9b54 | ||
|  | 0008519903 | ||
|  | 72fd32736a | ||
|  | baa9357e96 | ||
|  | 8629d9a1da | ||
|  | ef0551932f | ||
|  | af3bb68add | ||
|  | 2aefa348ba | ||
|  | e823e2308f | ||
|  | 2c5edf28ec | ||
|  | b1d97fec47 | ||
|  | ea7cd7b62f | ||
|  | 7fb0c0cc68 | ||
|  | 7e1c68f25d | ||
|  | 65f1dc4283 | ||
|  | a0467c802d | ||
|  | 273db5ceaf | ||
|  | 8e31030390 | ||
|  | 2f6e597ed8 | ||
|  | 1d3142da96 | ||
|  | 2ec571a30c | ||
|  | 4536f46cff | ||
|  | 9e68fdbcdb | ||
|  | 4ef0cbd8b9 | ||
|  | 28b4c822c5 | 
							
								
								
									
										7
									
								
								FAQ
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								FAQ
									
									
									
									
									
								
							| @@ -29,8 +29,8 @@ you can manually run `tic -sx st.info`. | ||||
|  | ||||
| ## I would like to have utmp and/or scroll functionality by default | ||||
|  | ||||
| You can add the absolute patch of both programs in your config.h | ||||
| file. You only have to modify the value of utmp and scroll variables. | ||||
| You can add the absolute path of both programs in your config.h file. You only | ||||
| have to modify the value of utmp and scroll variables. | ||||
|  | ||||
|  | ||||
| ## Why doesn't the Del key work in some programs? | ||||
| @@ -248,3 +248,6 @@ fonts: | ||||
|  | ||||
| Please don't bother reporting this bug to st, but notify the upstream Xft | ||||
| developers about fixing this bug. | ||||
|  | ||||
| As of 2022-09-05 this now seems to be finally fixed in libXft 2.3.5: | ||||
| https://gitlab.freedesktop.org/xorg/lib/libxft/-/blob/libXft-2.3.5/NEWS | ||||
|   | ||||
							
								
								
									
										2
									
								
								LICENSE
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								LICENSE
									
									
									
									
									
								
							| @@ -1,6 +1,6 @@ | ||||
| MIT/X Consortium License | ||||
|  | ||||
| © 2014-2020 Hiltjo Posthuma <hiltjo at codemadness dot org> | ||||
| © 2014-2022 Hiltjo Posthuma <hiltjo at codemadness dot org> | ||||
| © 2018 Devin J. Pohly <djpohly at gmail dot com> | ||||
| © 2014-2017 Quentin Rameau <quinq at fifth dot space> | ||||
| © 2009-2012 Aurélien APTEL <aurelien dot aptel at gmail dot com> | ||||
|   | ||||
							
								
								
									
										12
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								Makefile
									
									
									
									
									
								
							| @@ -4,16 +4,10 @@ | ||||
|  | ||||
| include config.mk | ||||
|  | ||||
| SRC = st.c x.c | ||||
| SRC = st.c x.c $(SIXEL_C) | ||||
| OBJ = $(SRC:.c=.o) | ||||
|  | ||||
| all: options st | ||||
|  | ||||
| options: | ||||
| 	@echo st build options: | ||||
| 	@echo "CFLAGS  = $(STCFLAGS)" | ||||
| 	@echo "LDFLAGS = $(STLDFLAGS)" | ||||
| 	@echo "CC      = $(CC)" | ||||
| all: st | ||||
|  | ||||
| config.h: | ||||
| 	cp config.def.h config.h | ||||
| @@ -54,4 +48,4 @@ uninstall: | ||||
| 	rm -f $(DESTDIR)$(PREFIX)/bin/st | ||||
| 	rm -f $(DESTDIR)$(MANPREFIX)/man1/st.1 | ||||
|  | ||||
| .PHONY: all options clean dist install uninstall | ||||
| .PHONY: all clean dist install uninstall | ||||
|   | ||||
							
								
								
									
										57
									
								
								config.def.h
									
									
									
									
									
								
							
							
						
						
									
										57
									
								
								config.def.h
									
									
									
									
									
								
							| @@ -23,7 +23,10 @@ char *scroll = NULL; | ||||
| char *stty_args = "stty raw pass8 nl -echo -iexten -cstopb 38400"; | ||||
|  | ||||
| /* identification sequence returned in DA and DECID */ | ||||
| char *vtiden = "\033[?6c"; | ||||
| char *vtiden = "\033[?62;4c"; /* VT200 family (62) with sixel (4) */ | ||||
|  | ||||
| /* sixel rgb byte order: LSBFirst or MSBFirst */ | ||||
| int const sixelbyteorder = LSBFirst; | ||||
|  | ||||
| /* Kerning / character bounding-box multipliers */ | ||||
| static float cwscale = 1.0; | ||||
| @@ -53,7 +56,7 @@ int allowwindowops = 0; | ||||
|  * near minlatency, but it waits longer for slow updates to avoid partial draw. | ||||
|  * low minlatency will tear/flicker more, as it can "detect" idle too early. | ||||
|  */ | ||||
| static double minlatency = 8; | ||||
| static double minlatency = 2; | ||||
| static double maxlatency = 33; | ||||
|  | ||||
| /* | ||||
| @@ -95,31 +98,23 @@ unsigned int tabspaces = 8; | ||||
|  | ||||
| /* Terminal colors (16 first used in escape sequence) */ | ||||
| static const char *colorname[] = { | ||||
| 	/* 8 normal colors */ | ||||
| 	"black", | ||||
| 	"red3", | ||||
| 	"green3", | ||||
| 	"yellow3", | ||||
| 	"blue2", | ||||
| 	"magenta3", | ||||
| 	"cyan3", | ||||
| 	"gray90", | ||||
|  | ||||
| 	/* 8 bright colors */ | ||||
| 	"gray50", | ||||
| 	"red", | ||||
| 	"green", | ||||
| 	"yellow", | ||||
| 	"#5c5cff", | ||||
| 	"magenta", | ||||
| 	"cyan", | ||||
| 	"white", | ||||
|  | ||||
| 	[255] = 0, | ||||
|  | ||||
| 	/* more colors can be added after 255 to use with DefaultXX */ | ||||
| 	"#cccccc", | ||||
| 	"#555555", | ||||
| 	/* solarized dark */ | ||||
| 	"#03171d",  /*  0: black    */ | ||||
| 	"#dc322f",  /*  1: red      */ | ||||
| 	"#859900",  /*  2: green    */ | ||||
| 	"#b58900",  /*  3: yellow   */ | ||||
| 	"#268bd2",  /*  4: blue     */ | ||||
| 	"#d33682",  /*  5: magenta  */ | ||||
| 	"#2aa198",  /*  6: cyan     */ | ||||
| 	"#eee8d5",  /*  7: white    */ | ||||
| 	"#001014",  /*  8: brblack  */ | ||||
| 	"#cb4b16",  /*  9: brred    */ | ||||
| 	"#586e75",  /* 10: brgreen  */ | ||||
| 	"#657b83",  /* 11: bryellow */ | ||||
| 	"#839496",  /* 12: brblue   */ | ||||
| 	"#6c71c4",  /* 13: brmagenta*/ | ||||
| 	"#93a1a1",  /* 14: brcyan   */ | ||||
| 	"#fdf6e3",  /* 15: brwhite  */ | ||||
| }; | ||||
|  | ||||
|  | ||||
| @@ -127,10 +122,10 @@ static const char *colorname[] = { | ||||
|  * Default colors (colorname index) | ||||
|  * foreground, background, cursor, reverse cursor | ||||
|  */ | ||||
| unsigned int defaultfg = 7; | ||||
| unsigned int defaultbg = 0; | ||||
| static unsigned int defaultcs = 256; | ||||
| static unsigned int defaultrcs = 257; | ||||
| unsigned int defaultfg = 12; | ||||
| unsigned int defaultbg = 8; | ||||
| unsigned int defaultcs = 14; | ||||
| static unsigned int defaultrcs = 15; | ||||
|  | ||||
| /* | ||||
|  * Default shape of cursor | ||||
|   | ||||
							
								
								
									
										467
									
								
								config.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										467
									
								
								config.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,467 @@ | ||||
| /* See LICENSE file for copyright and license details. */ | ||||
|  | ||||
| /* | ||||
|  * appearance | ||||
|  * | ||||
|  * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html | ||||
|  */ | ||||
| static char *font = "Inconsolata:size=10:antialias=true:hinting=true"; | ||||
| static int borderpx = 2; | ||||
|  | ||||
| /* | ||||
|  * What program is execed by st depends of these precedence rules: | ||||
|  * 1: program passed with -e | ||||
|  * 2: scroll and/or utmp | ||||
|  * 3: SHELL environment variable | ||||
|  * 4: value of shell in /etc/passwd | ||||
|  * 5: value of shell in config.h | ||||
|  */ | ||||
| static char *shell = "/bin/sh"; | ||||
| char *utmp = NULL; | ||||
| /* scroll program: to enable use a string like "scroll" */ | ||||
| char *scroll = NULL; | ||||
| char *stty_args = "stty raw pass8 nl -echo -iexten -cstopb 38400"; | ||||
|  | ||||
| /* identification sequence returned in DA and DECID */ | ||||
| char *vtiden = "\033[?62;4c"; /* VT200 family (62) with sixel (4) */ | ||||
|  | ||||
| /* sixel rgb byte order: LSBFirst or MSBFirst */ | ||||
| int const sixelbyteorder = LSBFirst; | ||||
|  | ||||
| /* Kerning / character bounding-box multipliers */ | ||||
| static float cwscale = 1.0; | ||||
| static float chscale = 1.0; | ||||
|  | ||||
| /* | ||||
|  * word delimiter string | ||||
|  * | ||||
|  * More advanced example: L" `'\"()[]{}" | ||||
|  */ | ||||
| wchar_t *worddelimiters = L" │`'\"()[]{}"; | ||||
|  | ||||
| /* selection timeouts (in milliseconds) */ | ||||
| static unsigned int doubleclicktimeout = 300; | ||||
| static unsigned int tripleclicktimeout = 600; | ||||
|  | ||||
| /* alt screens */ | ||||
| int allowaltscreen = 1; | ||||
|  | ||||
| /* allow certain non-interactive (insecure) window operations such as: | ||||
|    setting the clipboard text */ | ||||
| int allowwindowops = 0; | ||||
|  | ||||
| /* | ||||
|  * draw latency range in ms - from new content/keypress/etc until drawing. | ||||
|  * within this range, st draws when content stops arriving (idle). mostly it's | ||||
|  * near minlatency, but it waits longer for slow updates to avoid partial draw. | ||||
|  * low minlatency will tear/flicker more, as it can "detect" idle too early. | ||||
|  */ | ||||
| static double minlatency = 8; | ||||
| static double maxlatency = 33; | ||||
|  | ||||
| /* | ||||
|  * blinking timeout (set to 0 to disable blinking) for the terminal blinking | ||||
|  * attribute. | ||||
|  */ | ||||
| static unsigned int blinktimeout = 800; | ||||
|  | ||||
| /* | ||||
|  * thickness of underline and bar cursors | ||||
|  */ | ||||
| static unsigned int cursorthickness = 2; | ||||
|  | ||||
| /* | ||||
|  * bell volume. It must be a value between -100 and 100. Use 0 for disabling | ||||
|  * it | ||||
|  */ | ||||
| static int bellvolume = 0; | ||||
|  | ||||
| /* default TERM value */ | ||||
| char *termname = "st-256color"; | ||||
|  | ||||
| /* | ||||
|  * spaces per tab | ||||
|  * | ||||
|  * When you are changing this value, don't forget to adapt the »it« value in | ||||
|  * the st.info and appropriately install the st.info in the environment where | ||||
|  * you use this st version. | ||||
|  * | ||||
|  *	it#$tabspaces, | ||||
|  * | ||||
|  * Secondly make sure your kernel is not expanding tabs. When running `stty | ||||
|  * -a` »tab0« should appear. You can tell the terminal to not expand tabs by | ||||
|  *  running following command: | ||||
|  * | ||||
|  *	stty tabs | ||||
|  */ | ||||
| unsigned int tabspaces = 4; | ||||
|  | ||||
| /* Terminal colors (16 first used in escape sequence) */ | ||||
| static const char *colorname[] = { | ||||
| 	/* solarized dark */ | ||||
| 	"#03171d",  /*  0: black    */ | ||||
| 	"#dc322f",  /*  1: red      */ | ||||
| 	"#859900",  /*  2: green    */ | ||||
| 	"#b58900",  /*  3: yellow   */ | ||||
| 	"#268bd2",  /*  4: blue     */ | ||||
| 	"#d33682",  /*  5: magenta  */ | ||||
| 	"#2aa198",  /*  6: cyan     */ | ||||
| 	"#eee8d5",  /*  7: white    */ | ||||
| 	"#001014",  /*  8: brblack  */ | ||||
| 	"#cb4b16",  /*  9: brred    */ | ||||
| 	"#586e75",  /* 10: brgreen  */ | ||||
| 	"#657b83",  /* 11: bryellow */ | ||||
| 	"#839496",  /* 12: brblue   */ | ||||
| 	"#6c71c4",  /* 13: brmagenta*/ | ||||
| 	"#93a1a1",  /* 14: brcyan   */ | ||||
| 	"#fdf6e3",  /* 15: brwhite  */ | ||||
| }; | ||||
|  | ||||
|  | ||||
| /* | ||||
|  * Default colors (colorname index) | ||||
|  * foreground, background, cursor, reverse cursor | ||||
|  */ | ||||
| unsigned int defaultfg = 12; | ||||
| unsigned int defaultbg = 8; | ||||
| unsigned int defaultcs = 14; | ||||
| static unsigned int defaultrcs = 15; | ||||
|  | ||||
| /* | ||||
|  * Default shape of cursor | ||||
|  * 2: Block ("█") | ||||
|  * 4: Underline ("_") | ||||
|  * 6: Bar ("|") | ||||
|  * 7: Snowman ("☃") | ||||
|  */ | ||||
| static unsigned int cursorshape = 2; | ||||
|  | ||||
| /* | ||||
|  * Default columns and rows numbers | ||||
|  */ | ||||
|  | ||||
| static unsigned int cols = 80; | ||||
| static unsigned int rows = 24; | ||||
|  | ||||
| /* | ||||
|  * Default colour and shape of the mouse cursor | ||||
|  */ | ||||
| static unsigned int mouseshape = XC_xterm; | ||||
| static unsigned int mousefg = 7; | ||||
| static unsigned int mousebg = 0; | ||||
|  | ||||
| /* | ||||
|  * Color used to display font attributes when fontconfig selected a font which | ||||
|  * doesn't match the ones requested. | ||||
|  */ | ||||
| static unsigned int defaultattr = 11; | ||||
|  | ||||
| /* | ||||
|  * Force mouse select/shortcuts while mask is active (when MODE_MOUSE is set). | ||||
|  * Note that if you want to use ShiftMask with selmasks, set this to an other | ||||
|  * modifier, set to 0 to not use it. | ||||
|  */ | ||||
| static uint forcemousemod = 0; | ||||
|  | ||||
| /* | ||||
|  * Internal mouse shortcuts. | ||||
|  * Beware that overloading Button1 will disable the selection. | ||||
|  */ | ||||
| static MouseShortcut mshortcuts[] = { | ||||
| 	/* mask                 button   function        argument       release */ | ||||
| 	{ XK_ANY_MOD,           Button2, selpaste,       {.i = 0},      1 }, | ||||
| 	{ ShiftMask,            Button4, ttysend,        {.s = "\033[5;2~"} }, | ||||
| 	{ XK_ANY_MOD,           Button4, ttysend,        {.s = "\031"} }, | ||||
| 	{ ShiftMask,            Button5, ttysend,        {.s = "\033[6;2~"} }, | ||||
| 	{ XK_ANY_MOD,           Button5, ttysend,        {.s = "\005"} }, | ||||
| }; | ||||
|  | ||||
| /* Internal keyboard shortcuts. */ | ||||
| #define MODKEY Mod1Mask | ||||
| #define TERMMOD (ControlMask|ShiftMask) | ||||
|  | ||||
| static Shortcut shortcuts[] = { | ||||
| 	/* mask                 keysym          function        argument */ | ||||
| 	{ XK_ANY_MOD,           XK_Break,       sendbreak,      {.i =  0} }, | ||||
| 	{ ControlMask,          XK_Print,       toggleprinter,  {.i =  0} }, | ||||
| 	{ ShiftMask,            XK_Print,       printscreen,    {.i =  0} }, | ||||
| 	{ XK_ANY_MOD,           XK_Print,       printsel,       {.i =  0} }, | ||||
| 	{ TERMMOD,              XK_Prior,       zoom,           {.f = +1} }, | ||||
| 	{ TERMMOD,              XK_Next,        zoom,           {.f = -1} }, | ||||
| 	{ TERMMOD,              XK_Home,        zoomreset,      {.f =  0} }, | ||||
| 	{ TERMMOD,              XK_C,           clipcopy,       {.i =  0} }, | ||||
| 	{ TERMMOD,              XK_V,           clippaste,      {.i =  0} }, | ||||
| 	{ TERMMOD,              XK_Y,           selpaste,       {.i =  0} }, | ||||
| 	{ ShiftMask,            XK_Insert,      selpaste,       {.i =  0} }, | ||||
| 	{ TERMMOD,              XK_Num_Lock,    numlock,        {.i =  0} }, | ||||
| }; | ||||
|  | ||||
| /* | ||||
|  * Special keys (change & recompile st.info accordingly) | ||||
|  * | ||||
|  * Mask value: | ||||
|  * * Use XK_ANY_MOD to match the key no matter modifiers state | ||||
|  * * Use XK_NO_MOD to match the key alone (no modifiers) | ||||
|  * appkey value: | ||||
|  * * 0: no value | ||||
|  * * > 0: keypad application mode enabled | ||||
|  * *   = 2: term.numlock = 1 | ||||
|  * * < 0: keypad application mode disabled | ||||
|  * appcursor value: | ||||
|  * * 0: no value | ||||
|  * * > 0: cursor application mode enabled | ||||
|  * * < 0: cursor application mode disabled | ||||
|  * | ||||
|  * Be careful with the order of the definitions because st searches in | ||||
|  * this table sequentially, so any XK_ANY_MOD must be in the last | ||||
|  * position for a key. | ||||
|  */ | ||||
|  | ||||
| /* | ||||
|  * If you want keys other than the X11 function keys (0xFD00 - 0xFFFF) | ||||
|  * to be mapped below, add them to this array. | ||||
|  */ | ||||
| static KeySym mappedkeys[] = { -1 }; | ||||
|  | ||||
| /* | ||||
|  * State bits to ignore when matching key or button events.  By default, | ||||
|  * numlock (Mod2Mask) and keyboard layout (XK_SWITCH_MOD) are ignored. | ||||
|  */ | ||||
| static uint ignoremod = Mod2Mask|XK_SWITCH_MOD; | ||||
|  | ||||
| /* | ||||
|  * This is the huge key array which defines all compatibility to the Linux | ||||
|  * world. Please decide about changes wisely. | ||||
|  */ | ||||
| static Key key[] = { | ||||
| 	/* keysym           mask            string      appkey appcursor */ | ||||
| 	{ XK_KP_Home,       ShiftMask,      "\033[2J",       0,   -1}, | ||||
| 	{ XK_KP_Home,       ShiftMask,      "\033[1;2H",     0,   +1}, | ||||
| 	{ XK_KP_Home,       XK_ANY_MOD,     "\033[H",        0,   -1}, | ||||
| 	{ XK_KP_Home,       XK_ANY_MOD,     "\033[1~",       0,   +1}, | ||||
| 	{ XK_KP_Up,         XK_ANY_MOD,     "\033Ox",       +1,    0}, | ||||
| 	{ XK_KP_Up,         XK_ANY_MOD,     "\033[A",        0,   -1}, | ||||
| 	{ XK_KP_Up,         XK_ANY_MOD,     "\033OA",        0,   +1}, | ||||
| 	{ XK_KP_Down,       XK_ANY_MOD,     "\033Or",       +1,    0}, | ||||
| 	{ XK_KP_Down,       XK_ANY_MOD,     "\033[B",        0,   -1}, | ||||
| 	{ XK_KP_Down,       XK_ANY_MOD,     "\033OB",        0,   +1}, | ||||
| 	{ XK_KP_Left,       XK_ANY_MOD,     "\033Ot",       +1,    0}, | ||||
| 	{ XK_KP_Left,       XK_ANY_MOD,     "\033[D",        0,   -1}, | ||||
| 	{ XK_KP_Left,       XK_ANY_MOD,     "\033OD",        0,   +1}, | ||||
| 	{ XK_KP_Right,      XK_ANY_MOD,     "\033Ov",       +1,    0}, | ||||
| 	{ XK_KP_Right,      XK_ANY_MOD,     "\033[C",        0,   -1}, | ||||
| 	{ XK_KP_Right,      XK_ANY_MOD,     "\033OC",        0,   +1}, | ||||
| 	{ XK_KP_Prior,      ShiftMask,      "\033[5;2~",     0,    0}, | ||||
| 	{ XK_KP_Prior,      XK_ANY_MOD,     "\033[5~",       0,    0}, | ||||
| 	{ XK_KP_Begin,      XK_ANY_MOD,     "\033[E",        0,    0}, | ||||
| 	{ XK_KP_End,        ControlMask,    "\033[J",       -1,    0}, | ||||
| 	{ XK_KP_End,        ControlMask,    "\033[1;5F",    +1,    0}, | ||||
| 	{ XK_KP_End,        ShiftMask,      "\033[K",       -1,    0}, | ||||
| 	{ XK_KP_End,        ShiftMask,      "\033[1;2F",    +1,    0}, | ||||
| 	{ XK_KP_End,        XK_ANY_MOD,     "\033[4~",       0,    0}, | ||||
| 	{ XK_KP_Next,       ShiftMask,      "\033[6;2~",     0,    0}, | ||||
| 	{ XK_KP_Next,       XK_ANY_MOD,     "\033[6~",       0,    0}, | ||||
| 	{ XK_KP_Insert,     ShiftMask,      "\033[2;2~",    +1,    0}, | ||||
| 	{ XK_KP_Insert,     ShiftMask,      "\033[4l",      -1,    0}, | ||||
| 	{ XK_KP_Insert,     ControlMask,    "\033[L",       -1,    0}, | ||||
| 	{ XK_KP_Insert,     ControlMask,    "\033[2;5~",    +1,    0}, | ||||
| 	{ XK_KP_Insert,     XK_ANY_MOD,     "\033[4h",      -1,    0}, | ||||
| 	{ XK_KP_Insert,     XK_ANY_MOD,     "\033[2~",      +1,    0}, | ||||
| 	{ XK_KP_Delete,     ControlMask,    "\033[M",       -1,    0}, | ||||
| 	{ XK_KP_Delete,     ControlMask,    "\033[3;5~",    +1,    0}, | ||||
| 	{ XK_KP_Delete,     ShiftMask,      "\033[2K",      -1,    0}, | ||||
| 	{ XK_KP_Delete,     ShiftMask,      "\033[3;2~",    +1,    0}, | ||||
| 	{ XK_KP_Delete,     XK_ANY_MOD,     "\033[P",       -1,    0}, | ||||
| 	{ XK_KP_Delete,     XK_ANY_MOD,     "\033[3~",      +1,    0}, | ||||
| 	{ XK_KP_Multiply,   XK_ANY_MOD,     "\033Oj",       +2,    0}, | ||||
| 	{ XK_KP_Add,        XK_ANY_MOD,     "\033Ok",       +2,    0}, | ||||
| 	{ XK_KP_Enter,      XK_ANY_MOD,     "\033OM",       +2,    0}, | ||||
| 	{ XK_KP_Enter,      XK_ANY_MOD,     "\r",           -1,    0}, | ||||
| 	{ XK_KP_Subtract,   XK_ANY_MOD,     "\033Om",       +2,    0}, | ||||
| 	{ XK_KP_Decimal,    XK_ANY_MOD,     "\033On",       +2,    0}, | ||||
| 	{ XK_KP_Divide,     XK_ANY_MOD,     "\033Oo",       +2,    0}, | ||||
| 	{ XK_KP_0,          XK_ANY_MOD,     "\033Op",       +2,    0}, | ||||
| 	{ XK_KP_1,          XK_ANY_MOD,     "\033Oq",       +2,    0}, | ||||
| 	{ XK_KP_2,          XK_ANY_MOD,     "\033Or",       +2,    0}, | ||||
| 	{ XK_KP_3,          XK_ANY_MOD,     "\033Os",       +2,    0}, | ||||
| 	{ XK_KP_4,          XK_ANY_MOD,     "\033Ot",       +2,    0}, | ||||
| 	{ XK_KP_5,          XK_ANY_MOD,     "\033Ou",       +2,    0}, | ||||
| 	{ XK_KP_6,          XK_ANY_MOD,     "\033Ov",       +2,    0}, | ||||
| 	{ XK_KP_7,          XK_ANY_MOD,     "\033Ow",       +2,    0}, | ||||
| 	{ XK_KP_8,          XK_ANY_MOD,     "\033Ox",       +2,    0}, | ||||
| 	{ XK_KP_9,          XK_ANY_MOD,     "\033Oy",       +2,    0}, | ||||
| 	{ XK_Up,            ShiftMask,      "\033[1;2A",     0,    0}, | ||||
| 	{ XK_Up,            Mod1Mask,       "\033[1;3A",     0,    0}, | ||||
| 	{ XK_Up,         ShiftMask|Mod1Mask,"\033[1;4A",     0,    0}, | ||||
| 	{ XK_Up,            ControlMask,    "\033[1;5A",     0,    0}, | ||||
| 	{ XK_Up,      ShiftMask|ControlMask,"\033[1;6A",     0,    0}, | ||||
| 	{ XK_Up,       ControlMask|Mod1Mask,"\033[1;7A",     0,    0}, | ||||
| 	{ XK_Up,ShiftMask|ControlMask|Mod1Mask,"\033[1;8A",  0,    0}, | ||||
| 	{ XK_Up,            XK_ANY_MOD,     "\033[A",        0,   -1}, | ||||
| 	{ XK_Up,            XK_ANY_MOD,     "\033OA",        0,   +1}, | ||||
| 	{ XK_Down,          ShiftMask,      "\033[1;2B",     0,    0}, | ||||
| 	{ XK_Down,          Mod1Mask,       "\033[1;3B",     0,    0}, | ||||
| 	{ XK_Down,       ShiftMask|Mod1Mask,"\033[1;4B",     0,    0}, | ||||
| 	{ XK_Down,          ControlMask,    "\033[1;5B",     0,    0}, | ||||
| 	{ XK_Down,    ShiftMask|ControlMask,"\033[1;6B",     0,    0}, | ||||
| 	{ XK_Down,     ControlMask|Mod1Mask,"\033[1;7B",     0,    0}, | ||||
| 	{ XK_Down,ShiftMask|ControlMask|Mod1Mask,"\033[1;8B",0,    0}, | ||||
| 	{ XK_Down,          XK_ANY_MOD,     "\033[B",        0,   -1}, | ||||
| 	{ XK_Down,          XK_ANY_MOD,     "\033OB",        0,   +1}, | ||||
| 	{ XK_Left,          ShiftMask,      "\033[1;2D",     0,    0}, | ||||
| 	{ XK_Left,          Mod1Mask,       "\033[1;3D",     0,    0}, | ||||
| 	{ XK_Left,       ShiftMask|Mod1Mask,"\033[1;4D",     0,    0}, | ||||
| 	{ XK_Left,          ControlMask,    "\033[1;5D",     0,    0}, | ||||
| 	{ XK_Left,    ShiftMask|ControlMask,"\033[1;6D",     0,    0}, | ||||
| 	{ XK_Left,     ControlMask|Mod1Mask,"\033[1;7D",     0,    0}, | ||||
| 	{ XK_Left,ShiftMask|ControlMask|Mod1Mask,"\033[1;8D",0,    0}, | ||||
| 	{ XK_Left,          XK_ANY_MOD,     "\033[D",        0,   -1}, | ||||
| 	{ XK_Left,          XK_ANY_MOD,     "\033OD",        0,   +1}, | ||||
| 	{ XK_Right,         ShiftMask,      "\033[1;2C",     0,    0}, | ||||
| 	{ XK_Right,         Mod1Mask,       "\033[1;3C",     0,    0}, | ||||
| 	{ XK_Right,      ShiftMask|Mod1Mask,"\033[1;4C",     0,    0}, | ||||
| 	{ XK_Right,         ControlMask,    "\033[1;5C",     0,    0}, | ||||
| 	{ XK_Right,   ShiftMask|ControlMask,"\033[1;6C",     0,    0}, | ||||
| 	{ XK_Right,    ControlMask|Mod1Mask,"\033[1;7C",     0,    0}, | ||||
| 	{ XK_Right,ShiftMask|ControlMask|Mod1Mask,"\033[1;8C",0,   0}, | ||||
| 	{ XK_Right,         XK_ANY_MOD,     "\033[C",        0,   -1}, | ||||
| 	{ XK_Right,         XK_ANY_MOD,     "\033OC",        0,   +1}, | ||||
| 	{ XK_ISO_Left_Tab,  ShiftMask,      "\033[Z",        0,    0}, | ||||
| 	{ XK_Return,        Mod1Mask,       "\033\r",        0,    0}, | ||||
| 	{ XK_Return,        XK_ANY_MOD,     "\r",            0,    0}, | ||||
| 	{ XK_Insert,        ShiftMask,      "\033[4l",      -1,    0}, | ||||
| 	{ XK_Insert,        ShiftMask,      "\033[2;2~",    +1,    0}, | ||||
| 	{ XK_Insert,        ControlMask,    "\033[L",       -1,    0}, | ||||
| 	{ XK_Insert,        ControlMask,    "\033[2;5~",    +1,    0}, | ||||
| 	{ XK_Insert,        XK_ANY_MOD,     "\033[4h",      -1,    0}, | ||||
| 	{ XK_Insert,        XK_ANY_MOD,     "\033[2~",      +1,    0}, | ||||
| 	{ XK_Delete,        ControlMask,    "\033[M",       -1,    0}, | ||||
| 	{ XK_Delete,        ControlMask,    "\033[3;5~",    +1,    0}, | ||||
| 	{ XK_Delete,        ShiftMask,      "\033[2K",      -1,    0}, | ||||
| 	{ XK_Delete,        ShiftMask,      "\033[3;2~",    +1,    0}, | ||||
| 	{ XK_Delete,        XK_ANY_MOD,     "\033[P",       -1,    0}, | ||||
| 	{ XK_Delete,        XK_ANY_MOD,     "\033[3~",      +1,    0}, | ||||
| 	{ XK_BackSpace,     XK_NO_MOD,      "\177",          0,    0}, | ||||
| 	{ XK_BackSpace,     Mod1Mask,       "\033\177",      0,    0}, | ||||
| 	{ XK_Home,          ShiftMask,      "\033[2J",       0,   -1}, | ||||
| 	{ XK_Home,          ShiftMask,      "\033[1;2H",     0,   +1}, | ||||
| 	{ XK_Home,          XK_ANY_MOD,     "\033[H",        0,   -1}, | ||||
| 	{ XK_Home,          XK_ANY_MOD,     "\033[1~",       0,   +1}, | ||||
| 	{ XK_End,           ControlMask,    "\033[J",       -1,    0}, | ||||
| 	{ XK_End,           ControlMask,    "\033[1;5F",    +1,    0}, | ||||
| 	{ XK_End,           ShiftMask,      "\033[K",       -1,    0}, | ||||
| 	{ XK_End,           ShiftMask,      "\033[1;2F",    +1,    0}, | ||||
| 	{ XK_End,           XK_ANY_MOD,     "\033[4~",       0,    0}, | ||||
| 	{ XK_Prior,         ControlMask,    "\033[5;5~",     0,    0}, | ||||
| 	{ XK_Prior,         ShiftMask,      "\033[5;2~",     0,    0}, | ||||
| 	{ XK_Prior,         XK_ANY_MOD,     "\033[5~",       0,    0}, | ||||
| 	{ XK_Next,          ControlMask,    "\033[6;5~",     0,    0}, | ||||
| 	{ XK_Next,          ShiftMask,      "\033[6;2~",     0,    0}, | ||||
| 	{ XK_Next,          XK_ANY_MOD,     "\033[6~",       0,    0}, | ||||
| 	{ XK_F1,            XK_NO_MOD,      "\033OP" ,       0,    0}, | ||||
| 	{ XK_F1, /* F13 */  ShiftMask,      "\033[1;2P",     0,    0}, | ||||
| 	{ XK_F1, /* F25 */  ControlMask,    "\033[1;5P",     0,    0}, | ||||
| 	{ XK_F1, /* F37 */  Mod4Mask,       "\033[1;6P",     0,    0}, | ||||
| 	{ XK_F1, /* F49 */  Mod1Mask,       "\033[1;3P",     0,    0}, | ||||
| 	{ XK_F1, /* F61 */  Mod3Mask,       "\033[1;4P",     0,    0}, | ||||
| 	{ XK_F2,            XK_NO_MOD,      "\033OQ" ,       0,    0}, | ||||
| 	{ XK_F2, /* F14 */  ShiftMask,      "\033[1;2Q",     0,    0}, | ||||
| 	{ XK_F2, /* F26 */  ControlMask,    "\033[1;5Q",     0,    0}, | ||||
| 	{ XK_F2, /* F38 */  Mod4Mask,       "\033[1;6Q",     0,    0}, | ||||
| 	{ XK_F2, /* F50 */  Mod1Mask,       "\033[1;3Q",     0,    0}, | ||||
| 	{ XK_F2, /* F62 */  Mod3Mask,       "\033[1;4Q",     0,    0}, | ||||
| 	{ XK_F3,            XK_NO_MOD,      "\033OR" ,       0,    0}, | ||||
| 	{ XK_F3, /* F15 */  ShiftMask,      "\033[1;2R",     0,    0}, | ||||
| 	{ XK_F3, /* F27 */  ControlMask,    "\033[1;5R",     0,    0}, | ||||
| 	{ XK_F3, /* F39 */  Mod4Mask,       "\033[1;6R",     0,    0}, | ||||
| 	{ XK_F3, /* F51 */  Mod1Mask,       "\033[1;3R",     0,    0}, | ||||
| 	{ XK_F3, /* F63 */  Mod3Mask,       "\033[1;4R",     0,    0}, | ||||
| 	{ XK_F4,            XK_NO_MOD,      "\033OS" ,       0,    0}, | ||||
| 	{ XK_F4, /* F16 */  ShiftMask,      "\033[1;2S",     0,    0}, | ||||
| 	{ XK_F4, /* F28 */  ControlMask,    "\033[1;5S",     0,    0}, | ||||
| 	{ XK_F4, /* F40 */  Mod4Mask,       "\033[1;6S",     0,    0}, | ||||
| 	{ XK_F4, /* F52 */  Mod1Mask,       "\033[1;3S",     0,    0}, | ||||
| 	{ XK_F5,            XK_NO_MOD,      "\033[15~",      0,    0}, | ||||
| 	{ XK_F5, /* F17 */  ShiftMask,      "\033[15;2~",    0,    0}, | ||||
| 	{ XK_F5, /* F29 */  ControlMask,    "\033[15;5~",    0,    0}, | ||||
| 	{ XK_F5, /* F41 */  Mod4Mask,       "\033[15;6~",    0,    0}, | ||||
| 	{ XK_F5, /* F53 */  Mod1Mask,       "\033[15;3~",    0,    0}, | ||||
| 	{ XK_F6,            XK_NO_MOD,      "\033[17~",      0,    0}, | ||||
| 	{ XK_F6, /* F18 */  ShiftMask,      "\033[17;2~",    0,    0}, | ||||
| 	{ XK_F6, /* F30 */  ControlMask,    "\033[17;5~",    0,    0}, | ||||
| 	{ XK_F6, /* F42 */  Mod4Mask,       "\033[17;6~",    0,    0}, | ||||
| 	{ XK_F6, /* F54 */  Mod1Mask,       "\033[17;3~",    0,    0}, | ||||
| 	{ XK_F7,            XK_NO_MOD,      "\033[18~",      0,    0}, | ||||
| 	{ XK_F7, /* F19 */  ShiftMask,      "\033[18;2~",    0,    0}, | ||||
| 	{ XK_F7, /* F31 */  ControlMask,    "\033[18;5~",    0,    0}, | ||||
| 	{ XK_F7, /* F43 */  Mod4Mask,       "\033[18;6~",    0,    0}, | ||||
| 	{ XK_F7, /* F55 */  Mod1Mask,       "\033[18;3~",    0,    0}, | ||||
| 	{ XK_F8,            XK_NO_MOD,      "\033[19~",      0,    0}, | ||||
| 	{ XK_F8, /* F20 */  ShiftMask,      "\033[19;2~",    0,    0}, | ||||
| 	{ XK_F8, /* F32 */  ControlMask,    "\033[19;5~",    0,    0}, | ||||
| 	{ XK_F8, /* F44 */  Mod4Mask,       "\033[19;6~",    0,    0}, | ||||
| 	{ XK_F8, /* F56 */  Mod1Mask,       "\033[19;3~",    0,    0}, | ||||
| 	{ XK_F9,            XK_NO_MOD,      "\033[20~",      0,    0}, | ||||
| 	{ XK_F9, /* F21 */  ShiftMask,      "\033[20;2~",    0,    0}, | ||||
| 	{ XK_F9, /* F33 */  ControlMask,    "\033[20;5~",    0,    0}, | ||||
| 	{ XK_F9, /* F45 */  Mod4Mask,       "\033[20;6~",    0,    0}, | ||||
| 	{ XK_F9, /* F57 */  Mod1Mask,       "\033[20;3~",    0,    0}, | ||||
| 	{ XK_F10,           XK_NO_MOD,      "\033[21~",      0,    0}, | ||||
| 	{ XK_F10, /* F22 */ ShiftMask,      "\033[21;2~",    0,    0}, | ||||
| 	{ XK_F10, /* F34 */ ControlMask,    "\033[21;5~",    0,    0}, | ||||
| 	{ XK_F10, /* F46 */ Mod4Mask,       "\033[21;6~",    0,    0}, | ||||
| 	{ XK_F10, /* F58 */ Mod1Mask,       "\033[21;3~",    0,    0}, | ||||
| 	{ XK_F11,           XK_NO_MOD,      "\033[23~",      0,    0}, | ||||
| 	{ XK_F11, /* F23 */ ShiftMask,      "\033[23;2~",    0,    0}, | ||||
| 	{ XK_F11, /* F35 */ ControlMask,    "\033[23;5~",    0,    0}, | ||||
| 	{ XK_F11, /* F47 */ Mod4Mask,       "\033[23;6~",    0,    0}, | ||||
| 	{ XK_F11, /* F59 */ Mod1Mask,       "\033[23;3~",    0,    0}, | ||||
| 	{ XK_F12,           XK_NO_MOD,      "\033[24~",      0,    0}, | ||||
| 	{ XK_F12, /* F24 */ ShiftMask,      "\033[24;2~",    0,    0}, | ||||
| 	{ XK_F12, /* F36 */ ControlMask,    "\033[24;5~",    0,    0}, | ||||
| 	{ XK_F12, /* F48 */ Mod4Mask,       "\033[24;6~",    0,    0}, | ||||
| 	{ XK_F12, /* F60 */ Mod1Mask,       "\033[24;3~",    0,    0}, | ||||
| 	{ XK_F13,           XK_NO_MOD,      "\033[1;2P",     0,    0}, | ||||
| 	{ XK_F14,           XK_NO_MOD,      "\033[1;2Q",     0,    0}, | ||||
| 	{ XK_F15,           XK_NO_MOD,      "\033[1;2R",     0,    0}, | ||||
| 	{ XK_F16,           XK_NO_MOD,      "\033[1;2S",     0,    0}, | ||||
| 	{ XK_F17,           XK_NO_MOD,      "\033[15;2~",    0,    0}, | ||||
| 	{ XK_F18,           XK_NO_MOD,      "\033[17;2~",    0,    0}, | ||||
| 	{ XK_F19,           XK_NO_MOD,      "\033[18;2~",    0,    0}, | ||||
| 	{ XK_F20,           XK_NO_MOD,      "\033[19;2~",    0,    0}, | ||||
| 	{ XK_F21,           XK_NO_MOD,      "\033[20;2~",    0,    0}, | ||||
| 	{ XK_F22,           XK_NO_MOD,      "\033[21;2~",    0,    0}, | ||||
| 	{ XK_F23,           XK_NO_MOD,      "\033[23;2~",    0,    0}, | ||||
| 	{ XK_F24,           XK_NO_MOD,      "\033[24;2~",    0,    0}, | ||||
| 	{ XK_F25,           XK_NO_MOD,      "\033[1;5P",     0,    0}, | ||||
| 	{ XK_F26,           XK_NO_MOD,      "\033[1;5Q",     0,    0}, | ||||
| 	{ XK_F27,           XK_NO_MOD,      "\033[1;5R",     0,    0}, | ||||
| 	{ XK_F28,           XK_NO_MOD,      "\033[1;5S",     0,    0}, | ||||
| 	{ XK_F29,           XK_NO_MOD,      "\033[15;5~",    0,    0}, | ||||
| 	{ XK_F30,           XK_NO_MOD,      "\033[17;5~",    0,    0}, | ||||
| 	{ XK_F31,           XK_NO_MOD,      "\033[18;5~",    0,    0}, | ||||
| 	{ XK_F32,           XK_NO_MOD,      "\033[19;5~",    0,    0}, | ||||
| 	{ XK_F33,           XK_NO_MOD,      "\033[20;5~",    0,    0}, | ||||
| 	{ XK_F34,           XK_NO_MOD,      "\033[21;5~",    0,    0}, | ||||
| 	{ XK_F35,           XK_NO_MOD,      "\033[23;5~",    0,    0}, | ||||
| }; | ||||
|  | ||||
| /* | ||||
|  * Selection types' masks. | ||||
|  * Use the same masks as usual. | ||||
|  * Button1Mask is always unset, to make masks match between ButtonPress. | ||||
|  * ButtonRelease and MotionNotify. | ||||
|  * If no match is found, regular selection is used. | ||||
|  */ | ||||
| static uint selmasks[] = { | ||||
| 	[SEL_RECTANGULAR] = Mod1Mask, | ||||
| }; | ||||
|  | ||||
| /* | ||||
|  * Printable characters in ASCII, used to estimate the advance width | ||||
|  * of single wide characters. | ||||
|  */ | ||||
| static char ascii_printable[] = | ||||
| 	" !\"#$%&'()*+,-./0123456789:;<=>?" | ||||
| 	"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_" | ||||
| 	"`abcdefghijklmnopqrstuvwxyz{|}~"; | ||||
							
								
								
									
										12
									
								
								config.mk
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								config.mk
									
									
									
									
									
								
							| @@ -1,5 +1,5 @@ | ||||
| # st version | ||||
| VERSION = 0.8.4 | ||||
| VERSION = 0.9.2 | ||||
|  | ||||
| # Customize below to fit your system | ||||
|  | ||||
| @@ -12,11 +12,14 @@ X11LIB = /usr/X11R6/lib | ||||
|  | ||||
| PKG_CONFIG = pkg-config | ||||
|  | ||||
| SIXEL_C = sixel.c sixel_hls.c | ||||
| SIXEL_LIBS = `$(PKG_CONFIG) --libs imlib2` | ||||
|  | ||||
| # includes and libs | ||||
| INCS = -I$(X11INC) \ | ||||
|        `$(PKG_CONFIG) --cflags fontconfig` \ | ||||
|        `$(PKG_CONFIG) --cflags freetype2` | ||||
| LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft \ | ||||
| LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft ${SIXEL_LIBS}\ | ||||
|        `$(PKG_CONFIG) --libs fontconfig` \ | ||||
|        `$(PKG_CONFIG) --libs freetype2` | ||||
|  | ||||
| @@ -28,8 +31,9 @@ STLDFLAGS = $(LIBS) $(LDFLAGS) | ||||
| # OpenBSD: | ||||
| #CPPFLAGS = -DVERSION=\"$(VERSION)\" -D_XOPEN_SOURCE=600 -D_BSD_SOURCE | ||||
| #LIBS = -L$(X11LIB) -lm -lX11 -lutil -lXft \ | ||||
| #       `$(PKG_CONFIG) --libs fontconfig` \ | ||||
| #       `$(PKG_CONFIG) --libs freetype2` | ||||
| #       `pkg-config --libs fontconfig` \ | ||||
| #       `pkg-config --libs freetype2` | ||||
| #MANPREFIX = ${PREFIX}/man | ||||
|  | ||||
| # compiler and linker | ||||
| # CC = c99 | ||||
|   | ||||
							
								
								
									
										690
									
								
								sixel.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										690
									
								
								sixel.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,690 @@ | ||||
| // sixel.c (part of mintty) | ||||
| // originally written by kmiya@cluti (https://github.com/saitoha/sixel/blob/master/fromsixel.c) | ||||
| // Licensed under the terms of the GNU General Public License v3 or later. | ||||
|  | ||||
| #include <stdlib.h> | ||||
| #include <string.h>  /* memcpy */ | ||||
|  | ||||
| #include "st.h" | ||||
| #include "win.h" | ||||
| #include "sixel.h" | ||||
| #include "sixel_hls.h" | ||||
|  | ||||
| #define SIXEL_RGB(r, g, b) ((255 << 24) + ((r) << 16) + ((g) << 8) +  (b)) | ||||
| #define SIXEL_PALVAL(n,a,m) (((n) * (a) + ((m) / 2)) / (m)) | ||||
| #define SIXEL_XRGB(r,g,b) SIXEL_RGB(SIXEL_PALVAL(r, 255, 100), SIXEL_PALVAL(g, 255, 100), SIXEL_PALVAL(b, 255, 100)) | ||||
|  | ||||
| static sixel_color_t const sixel_default_color_table[] = { | ||||
| 	SIXEL_XRGB( 0,  0,  0),  /*  0 Black    */ | ||||
| 	SIXEL_XRGB(20, 20, 80),  /*  1 Blue     */ | ||||
| 	SIXEL_XRGB(80, 13, 13),  /*  2 Red      */ | ||||
| 	SIXEL_XRGB(20, 80, 20),  /*  3 Green    */ | ||||
| 	SIXEL_XRGB(80, 20, 80),  /*  4 Magenta  */ | ||||
| 	SIXEL_XRGB(20, 80, 80),  /*  5 Cyan     */ | ||||
| 	SIXEL_XRGB(80, 80, 20),  /*  6 Yellow   */ | ||||
| 	SIXEL_XRGB(53, 53, 53),  /*  7 Gray 50% */ | ||||
| 	SIXEL_XRGB(26, 26, 26),  /*  8 Gray 25% */ | ||||
| 	SIXEL_XRGB(33, 33, 60),  /*  9 Blue*    */ | ||||
| 	SIXEL_XRGB(60, 26, 26),  /* 10 Red*     */ | ||||
| 	SIXEL_XRGB(33, 60, 33),  /* 11 Green*   */ | ||||
| 	SIXEL_XRGB(60, 33, 60),  /* 12 Magenta* */ | ||||
| 	SIXEL_XRGB(33, 60, 60),  /* 13 Cyan*    */ | ||||
| 	SIXEL_XRGB(60, 60, 33),  /* 14 Yellow*  */ | ||||
| 	SIXEL_XRGB(80, 80, 80),  /* 15 Gray 75% */ | ||||
| }; | ||||
|  | ||||
| void | ||||
| scroll_images(int n) { | ||||
| 	ImageList *im, *next; | ||||
| 	int top = 0; | ||||
|  | ||||
| 	for (im = term.images; im; im = next) { | ||||
| 		next = im->next; | ||||
| 		im->y += n; | ||||
|  | ||||
| 		/* check if the current sixel has exceeded the maximum | ||||
| 		 * draw distance, and should therefore be deleted */ | ||||
| 		if (im->y < top) { | ||||
| 			//fprintf(stderr, "im@0x%08x exceeded maximum distance\n"); | ||||
| 			delete_image(im); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  | ||||
| void | ||||
| delete_image(ImageList *im) | ||||
| { | ||||
| 	if (im->prev) | ||||
| 		im->prev->next = im->next; | ||||
| 	else | ||||
| 		term.images = im->next; | ||||
| 	if (im->next) | ||||
| 		im->next->prev = im->prev; | ||||
| 	if (im->pixmap) | ||||
| 		XFreePixmap(xw.dpy, (Drawable)im->pixmap); | ||||
| 	if (im->clipmask) | ||||
| 		XFreePixmap(xw.dpy, (Drawable)im->clipmask); | ||||
| 	free(im->pixels); | ||||
| 	free(im); | ||||
| } | ||||
|  | ||||
| static int | ||||
| set_default_color(sixel_image_t *image) | ||||
| { | ||||
| 	int i; | ||||
| 	int n; | ||||
| 	int r; | ||||
| 	int g; | ||||
| 	int b; | ||||
|  | ||||
| 	/* palette initialization */ | ||||
| 	for (n = 1; n < 17; n++) { | ||||
| 		image->palette[n] = sixel_default_color_table[n - 1]; | ||||
| 	} | ||||
|  | ||||
| 	/* colors 17-232 are a 6x6x6 color cube */ | ||||
| 	for (r = 0; r < 6; r++) { | ||||
| 		for (g = 0; g < 6; g++) { | ||||
| 			for (b = 0; b < 6; b++) { | ||||
| 				image->palette[n++] = SIXEL_RGB(r * 51, g * 51, b * 51); | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	/* colors 233-256 are a grayscale ramp, intentionally leaving out */ | ||||
| 	for (i = 0; i < 24; i++) { | ||||
| 		image->palette[n++] = SIXEL_RGB(i * 11, i * 11, i * 11); | ||||
| 	} | ||||
|  | ||||
| 	for (; n < DECSIXEL_PALETTE_MAX; n++) { | ||||
| 		image->palette[n] = SIXEL_RGB(255, 255, 255); | ||||
| 	} | ||||
|  | ||||
| 	return (0); | ||||
| } | ||||
|  | ||||
| static int | ||||
| sixel_image_init( | ||||
|     sixel_image_t    *image, | ||||
|     int              width, | ||||
|     int              height, | ||||
|     int              fgcolor, | ||||
|     int              bgcolor, | ||||
|     int              use_private_register) | ||||
| { | ||||
| 	int status = (-1); | ||||
| 	size_t size; | ||||
|  | ||||
| 	size = (size_t)(width * height) * sizeof(sixel_color_no_t); | ||||
| 	image->width = width; | ||||
| 	image->height = height; | ||||
| 	image->data = (sixel_color_no_t *)malloc(size); | ||||
| 	image->ncolors = 2; | ||||
| 	image->use_private_register = use_private_register; | ||||
|  | ||||
| 	if (image->data == NULL) { | ||||
| 		status = (-1); | ||||
| 		goto end; | ||||
| 	} | ||||
| 	memset(image->data, 0, size); | ||||
|  | ||||
| 	image->palette[0] = bgcolor; | ||||
|  | ||||
| 	if (image->use_private_register) | ||||
| 		image->palette[1] = fgcolor; | ||||
|  | ||||
| 	image->palette_modified = 0; | ||||
|  | ||||
| 	status = (0); | ||||
|  | ||||
| end: | ||||
| 	return status; | ||||
| } | ||||
|  | ||||
| static int | ||||
| image_buffer_resize( | ||||
|     sixel_image_t   *image, | ||||
|     int              width, | ||||
|     int              height) | ||||
| { | ||||
| 	int status = (-1); | ||||
| 	size_t size; | ||||
| 	sixel_color_no_t *alt_buffer; | ||||
| 	int n; | ||||
| 	int min_height; | ||||
|  | ||||
| 	size = (size_t)(width * height) * sizeof(sixel_color_no_t); | ||||
| 	alt_buffer = (sixel_color_no_t *)malloc(size); | ||||
| 	if (alt_buffer == NULL) { | ||||
| 		/* free source image */ | ||||
| 		free(image->data); | ||||
| 		image->data = NULL; | ||||
| 		status = (-1); | ||||
| 		goto end; | ||||
| 	} | ||||
|  | ||||
| 	min_height = height > image->height ? image->height: height; | ||||
| 	if (width > image->width) {  /* if width is extended */ | ||||
| 		for (n = 0; n < min_height; ++n) { | ||||
| 			/* copy from source image */ | ||||
| 			memcpy(alt_buffer + width * n, | ||||
| 			       image->data + image->width * n, | ||||
| 			       (size_t)image->width * sizeof(sixel_color_no_t)); | ||||
| 			/* fill extended area with background color */ | ||||
| 			memset(alt_buffer + width * n + image->width, | ||||
| 			       0, | ||||
| 			       (size_t)(width - image->width) * sizeof(sixel_color_no_t)); | ||||
| 		} | ||||
| 	} else { | ||||
| 		for (n = 0; n < min_height; ++n) { | ||||
| 			/* copy from source image */ | ||||
| 			memcpy(alt_buffer + width * n, | ||||
| 			       image->data + image->width * n, | ||||
| 			       (size_t)width * sizeof(sixel_color_no_t)); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	if (height > image->height) {  /* if height is extended */ | ||||
| 		/* fill extended area with background color */ | ||||
| 		memset(alt_buffer + width * image->height, | ||||
| 		       0, | ||||
| 		       (size_t)(width * (height - image->height)) * sizeof(sixel_color_no_t)); | ||||
| 	} | ||||
|  | ||||
| 	/* free source image */ | ||||
| 	free(image->data); | ||||
|  | ||||
| 	image->data = alt_buffer; | ||||
| 	image->width = width; | ||||
| 	image->height = height; | ||||
|  | ||||
| 	status = (0); | ||||
|  | ||||
| end: | ||||
| 	return status; | ||||
| } | ||||
|  | ||||
| static void | ||||
| sixel_image_deinit(sixel_image_t *image) | ||||
| { | ||||
| 	if (image->data) | ||||
| 		free(image->data); | ||||
| 	image->data = NULL; | ||||
| } | ||||
|  | ||||
| int | ||||
| sixel_parser_init(sixel_state_t *st, | ||||
|                   int transparent, | ||||
|                   sixel_color_t fgcolor, sixel_color_t bgcolor, | ||||
|                   unsigned char use_private_register, | ||||
|                   int cell_width, int cell_height) | ||||
| { | ||||
| 	int status = (-1); | ||||
|  | ||||
| 	st->state = PS_DECSIXEL; | ||||
| 	st->pos_x = 0; | ||||
| 	st->pos_y = 0; | ||||
| 	st->max_x = 0; | ||||
| 	st->max_y = 0; | ||||
| 	st->attributed_pan = 2; | ||||
| 	st->attributed_pad = 1; | ||||
| 	st->attributed_ph = 0; | ||||
| 	st->attributed_pv = 0; | ||||
| 	st->transparent = transparent; | ||||
| 	st->repeat_count = 1; | ||||
| 	st->color_index = 16; | ||||
| 	st->grid_width = cell_width; | ||||
| 	st->grid_height = cell_height; | ||||
| 	st->nparams = 0; | ||||
| 	st->param = 0; | ||||
|  | ||||
| 	/* buffer initialization */ | ||||
| 	status = sixel_image_init(&st->image, 1, 1, fgcolor, transparent ? 0 : bgcolor, use_private_register); | ||||
|  | ||||
| 	return status; | ||||
| } | ||||
|  | ||||
| int | ||||
| sixel_parser_set_default_color(sixel_state_t *st) | ||||
| { | ||||
| 	return set_default_color(&st->image); | ||||
| } | ||||
|  | ||||
| int | ||||
| sixel_parser_finalize(sixel_state_t *st, ImageList **newimages, int cx, int cy, int cw, int ch) | ||||
| { | ||||
| 	sixel_image_t *image = &st->image; | ||||
| 	int x, y; | ||||
| 	sixel_color_no_t *src; | ||||
| 	sixel_color_t *dst, color; | ||||
| 	int w, h; | ||||
| 	int i, j, cols, numimages; | ||||
| 	char trans; | ||||
| 	ImageList *im, *next, *tail; | ||||
|  | ||||
| 	if (!image->data) | ||||
| 		return -1; | ||||
|  | ||||
| 	if (++st->max_x < st->attributed_ph) | ||||
| 		st->max_x = st->attributed_ph; | ||||
|  | ||||
| 	if (++st->max_y < st->attributed_pv) | ||||
| 		st->max_y = st->attributed_pv; | ||||
|  | ||||
| 	if (image->use_private_register && image->ncolors > 2 && !image->palette_modified) { | ||||
| 		if (set_default_color(image) < 0) | ||||
| 			return -1; | ||||
| 	} | ||||
|  | ||||
| 	w = MIN(st->max_x, image->width); | ||||
| 	h = MIN(st->max_y, image->height); | ||||
|  | ||||
| 	if ((numimages = (h + ch-1) / ch) <= 0) | ||||
| 		return -1; | ||||
|  | ||||
| 	cols = (w + cw-1) / cw; | ||||
|  | ||||
| 	*newimages = NULL, tail = NULL; | ||||
| 	for (y = 0, i = 0; i < numimages; i++) { | ||||
| 		if ((im = malloc(sizeof(ImageList)))) { | ||||
| 			if (!tail) { | ||||
| 				*newimages = tail = im; | ||||
| 				im->prev = im->next = NULL; | ||||
| 			} else { | ||||
| 				tail->next = im; | ||||
| 				im->prev = tail; | ||||
| 				im->next = NULL; | ||||
| 				tail = im; | ||||
| 			} | ||||
| 			im->x = cx; | ||||
| 			im->y = cy + i; | ||||
| 			im->cols = cols; | ||||
| 			im->width = w; | ||||
| 			im->height = MIN(h - ch * i, ch); | ||||
| 			im->pixels = malloc(im->width * im->height * 4); | ||||
| 			im->pixmap = NULL; | ||||
| 			im->clipmask = NULL; | ||||
| 			im->cw = cw; | ||||
| 			im->ch = ch; | ||||
| 		} | ||||
| 		if (!im || !im->pixels) { | ||||
| 			for (im = *newimages; im; im = next) { | ||||
| 				next = im->next; | ||||
| 				if (im->pixels) | ||||
| 					free(im->pixels); | ||||
| 				free(im); | ||||
| 			} | ||||
| 			*newimages = NULL; | ||||
| 			return -1; | ||||
| 		} | ||||
| 		dst = (sixel_color_t *)im->pixels; | ||||
| 		for (trans = 0, j = 0; j < im->height && y < h; j++, y++) { | ||||
| 			src = st->image.data + image->width * y; | ||||
| 			for (x = 0; x < w; x++) { | ||||
| 				color = st->image.palette[*src++]; | ||||
| 				trans |= (color == 0); | ||||
| 				*dst++ = color; | ||||
| 			} | ||||
| 		} | ||||
| 		im->transparent = (st->transparent && trans); | ||||
| 	} | ||||
|  | ||||
| 	return numimages; | ||||
| } | ||||
|  | ||||
| /* convert sixel data into indexed pixel bytes and palette data */ | ||||
| int | ||||
| sixel_parser_parse(sixel_state_t *st, const unsigned char *p, size_t len) | ||||
| { | ||||
| 	int n = 0; | ||||
| 	int i; | ||||
| 	int x; | ||||
| 	int y; | ||||
| 	int bits; | ||||
| 	int sx; | ||||
| 	int sy; | ||||
| 	int c; | ||||
| 	int pos; | ||||
| 	int width; | ||||
| 	const unsigned char *p0 = p, *p2 = p + len; | ||||
| 	sixel_image_t *image = &st->image; | ||||
| 	sixel_color_no_t *data, color_index; | ||||
|  | ||||
| 	if (!image->data) | ||||
| 		st->state = PS_ERROR; | ||||
|  | ||||
| 	while (p < p2) { | ||||
| 		switch (st->state) { | ||||
| 		case PS_ESC: | ||||
| 			goto end; | ||||
|  | ||||
| 		case PS_DECSIXEL: | ||||
| 			switch (*p) { | ||||
| 			case '\x1b': | ||||
| 				st->state = PS_ESC; | ||||
| 				break; | ||||
| 			case '"': | ||||
| 				st->param = 0; | ||||
| 				st->nparams = 0; | ||||
| 				st->state = PS_DECGRA; | ||||
| 				p++; | ||||
| 				break; | ||||
| 			case '!': | ||||
| 				st->param = 0; | ||||
| 				st->nparams = 0; | ||||
| 				st->state = PS_DECGRI; | ||||
| 				p++; | ||||
| 				break; | ||||
| 			case '#': | ||||
| 				st->param = 0; | ||||
| 				st->nparams = 0; | ||||
| 				st->state = PS_DECGCI; | ||||
| 				p++; | ||||
| 				break; | ||||
| 			case '$': | ||||
| 				/* DECGCR Graphics Carriage Return */ | ||||
| 				st->pos_x = 0; | ||||
| 				p++; | ||||
| 				break; | ||||
| 			case '-': | ||||
| 				/* DECGNL Graphics Next Line */ | ||||
| 				st->pos_x = 0; | ||||
| 				if (st->pos_y < DECSIXEL_HEIGHT_MAX - 5 - 6) | ||||
| 					st->pos_y += 6; | ||||
| 				else | ||||
| 					st->pos_y = DECSIXEL_HEIGHT_MAX + 1; | ||||
| 				p++; | ||||
| 				break; | ||||
| 			default: | ||||
| 				if (*p >= '?' && *p <= '~') {  /* sixel characters */ | ||||
| 					if ((image->width < (st->pos_x + st->repeat_count) || image->height < (st->pos_y + 6)) | ||||
| 					        && image->width < DECSIXEL_WIDTH_MAX && image->height < DECSIXEL_HEIGHT_MAX) { | ||||
| 						sx = image->width * 2; | ||||
| 						sy = image->height * 2; | ||||
| 						while (sx < (st->pos_x + st->repeat_count) || sy < (st->pos_y + 6)) { | ||||
| 							sx *= 2; | ||||
| 							sy *= 2; | ||||
| 						} | ||||
|  | ||||
| 						sx = MIN(sx, DECSIXEL_WIDTH_MAX); | ||||
| 						sy = MIN(sy, DECSIXEL_HEIGHT_MAX); | ||||
|  | ||||
| 						if (image_buffer_resize(image, sx, sy) < 0) { | ||||
| 							perror("sixel_parser_parse() failed"); | ||||
| 							st->state = PS_ERROR; | ||||
| 							p++; | ||||
| 							break; | ||||
| 						} | ||||
| 					} | ||||
|  | ||||
| 					if (st->color_index > image->ncolors) | ||||
| 						image->ncolors = st->color_index; | ||||
|  | ||||
| 					if (st->pos_x + st->repeat_count > image->width) | ||||
| 						st->repeat_count = image->width - st->pos_x; | ||||
|  | ||||
| 					if (st->repeat_count > 0 && st->pos_y + 5 < image->height) { | ||||
| 						bits = *p - '?'; | ||||
| 						if (bits != 0) { | ||||
| 							data = image->data + image->width * st->pos_y + st->pos_x; | ||||
| 							width = image->width; | ||||
| 							color_index = st->color_index; | ||||
| 							if (st->repeat_count <= 1) { | ||||
| 								if (bits & 0x01) | ||||
| 									*data = color_index, n = 0; | ||||
| 								data += width; | ||||
| 								if (bits & 0x02) | ||||
| 									*data = color_index, n = 1; | ||||
| 								data += width; | ||||
| 								if (bits & 0x04) | ||||
| 									*data = color_index, n = 2; | ||||
| 								data += width; | ||||
| 								if (bits & 0x08) | ||||
| 									*data = color_index, n = 3; | ||||
| 								data += width; | ||||
| 								if (bits & 0x10) | ||||
| 									*data = color_index, n = 4; | ||||
| 								if (bits & 0x20) | ||||
| 									data[width] = color_index, n = 5; | ||||
| 								if (st->max_x < st->pos_x) | ||||
| 									st->max_x = st->pos_x; | ||||
| 							} else { | ||||
| 								/* st->repeat_count > 1 */ | ||||
| 								for (i = 0; bits; bits >>= 1, i++, data += width) { | ||||
| 									if (bits & 1) { | ||||
| 										data[0] = color_index; | ||||
| 										data[1] = color_index; | ||||
| 										for (x = 2; x < st->repeat_count; x++) | ||||
| 											data[x] = color_index; | ||||
| 										n = i; | ||||
| 									} | ||||
| 								} | ||||
| 								if (st->max_x < (st->pos_x + st->repeat_count - 1)) | ||||
| 									st->max_x = st->pos_x + st->repeat_count - 1; | ||||
| 							} | ||||
| 							if (st->max_y < (st->pos_y + n)) | ||||
| 								st->max_y = st->pos_y + n; | ||||
| 						} | ||||
| 					} | ||||
| 					if (st->repeat_count > 0) | ||||
| 						st->pos_x += st->repeat_count; | ||||
| 					st->repeat_count = 1; | ||||
| 				} | ||||
| 				p++; | ||||
| 				break; | ||||
| 			} | ||||
| 			break; | ||||
|  | ||||
| 		case PS_DECGRA: | ||||
| 			/* DECGRA Set Raster Attributes " Pan; Pad; Ph; Pv */ | ||||
| 			switch (*p) { | ||||
| 			case '\x1b': | ||||
| 				st->state = PS_ESC; | ||||
| 				break; | ||||
| 			case '0': | ||||
| 			case '1': | ||||
| 			case '2': | ||||
| 			case '3': | ||||
| 			case '4': | ||||
| 			case '5': | ||||
| 			case '6': | ||||
| 			case '7': | ||||
| 			case '8': | ||||
| 			case '9': | ||||
| 				st->param = st->param * 10 + *p - '0'; | ||||
| 				st->param = MIN(st->param, DECSIXEL_PARAMVALUE_MAX); | ||||
| 				p++; | ||||
| 				break; | ||||
| 			case ';': | ||||
| 				if (st->nparams < DECSIXEL_PARAMS_MAX) | ||||
| 					st->params[st->nparams++] = st->param; | ||||
| 				st->param = 0; | ||||
| 				p++; | ||||
| 				break; | ||||
| 			default: | ||||
| 				if (st->nparams < DECSIXEL_PARAMS_MAX) | ||||
| 					st->params[st->nparams++] = st->param; | ||||
| 				if (st->nparams > 0) | ||||
| 					st->attributed_pad = st->params[0]; | ||||
| 				if (st->nparams > 1) | ||||
| 					st->attributed_pan = st->params[1]; | ||||
| 				if (st->nparams > 2 && st->params[2] > 0) | ||||
| 					st->attributed_ph = st->params[2]; | ||||
| 				if (st->nparams > 3 && st->params[3] > 0) | ||||
| 					st->attributed_pv = st->params[3]; | ||||
|  | ||||
| 				if (st->attributed_pan <= 0) | ||||
| 					st->attributed_pan = 1; | ||||
| 				if (st->attributed_pad <= 0) | ||||
| 					st->attributed_pad = 1; | ||||
|  | ||||
| 				if (image->width < st->attributed_ph || | ||||
| 				        image->height < st->attributed_pv) { | ||||
| 					sx = MAX(image->width, st->attributed_ph); | ||||
| 					sy = MAX(image->height, st->attributed_pv); | ||||
|  | ||||
| 					/* the height of the image buffer must be divisible by 6 | ||||
| 					 * to avoid unnecessary resizing of the image buffer when | ||||
| 					 * parsing the last sixel line */ | ||||
| 					sy = (sy + 5) / 6 * 6; | ||||
|  | ||||
| 					sx = MIN(sx, DECSIXEL_WIDTH_MAX); | ||||
| 					sy = MIN(sy, DECSIXEL_HEIGHT_MAX); | ||||
|  | ||||
| 					if (image_buffer_resize(image, sx, sy) < 0) { | ||||
| 						perror("sixel_parser_parse() failed"); | ||||
| 						st->state = PS_ERROR; | ||||
| 						break; | ||||
| 					} | ||||
| 				} | ||||
| 				st->state = PS_DECSIXEL; | ||||
| 				st->param = 0; | ||||
| 				st->nparams = 0; | ||||
| 			} | ||||
| 			break; | ||||
|  | ||||
| 		case PS_DECGRI: | ||||
| 			/* DECGRI Graphics Repeat Introducer ! Pn Ch */ | ||||
| 			switch (*p) { | ||||
| 			case '\x1b': | ||||
| 				st->state = PS_ESC; | ||||
| 				break; | ||||
| 			case '0': | ||||
| 			case '1': | ||||
| 			case '2': | ||||
| 			case '3': | ||||
| 			case '4': | ||||
| 			case '5': | ||||
| 			case '6': | ||||
| 			case '7': | ||||
| 			case '8': | ||||
| 			case '9': | ||||
| 				st->param = st->param * 10 + *p - '0'; | ||||
| 				st->param = MIN(st->param, DECSIXEL_PARAMVALUE_MAX); | ||||
| 				p++; | ||||
| 				break; | ||||
| 			default: | ||||
| 				st->repeat_count = MAX(st->param, 1); | ||||
| 				st->state = PS_DECSIXEL; | ||||
| 				st->param = 0; | ||||
| 				st->nparams = 0; | ||||
| 				break; | ||||
| 			} | ||||
| 			break; | ||||
|  | ||||
| 		case PS_DECGCI: | ||||
| 			/* DECGCI Graphics Color Introducer # Pc; Pu; Px; Py; Pz */ | ||||
| 			switch (*p) { | ||||
| 			case '\x1b': | ||||
| 				st->state = PS_ESC; | ||||
| 				break; | ||||
| 			case '0': | ||||
| 			case '1': | ||||
| 			case '2': | ||||
| 			case '3': | ||||
| 			case '4': | ||||
| 			case '5': | ||||
| 			case '6': | ||||
| 			case '7': | ||||
| 			case '8': | ||||
| 			case '9': | ||||
| 				st->param = st->param * 10 + *p - '0'; | ||||
| 				st->param = MIN(st->param, DECSIXEL_PARAMVALUE_MAX); | ||||
| 				p++; | ||||
| 				break; | ||||
| 			case ';': | ||||
| 				if (st->nparams < DECSIXEL_PARAMS_MAX) | ||||
| 					st->params[st->nparams++] = st->param; | ||||
| 				st->param = 0; | ||||
| 				p++; | ||||
| 				break; | ||||
| 			default: | ||||
| 				st->state = PS_DECSIXEL; | ||||
| 				if (st->nparams < DECSIXEL_PARAMS_MAX) | ||||
| 					st->params[st->nparams++] = st->param; | ||||
| 				st->param = 0; | ||||
|  | ||||
| 				if (st->nparams > 0) { | ||||
| 					st->color_index = 1 + st->params[0];  /* offset 1(background color) added */ | ||||
| 					if (st->color_index < 0) | ||||
| 						st->color_index = 0; | ||||
| 					else if (st->color_index >= DECSIXEL_PALETTE_MAX) | ||||
| 						st->color_index = DECSIXEL_PALETTE_MAX - 1; | ||||
| 				} | ||||
|  | ||||
| 				if (st->nparams > 4) { | ||||
| 					st->image.palette_modified = 1; | ||||
| 					if (st->params[1] == 1) { | ||||
| 						/* HLS */ | ||||
| 						st->params[2] = MIN(st->params[2], 360); | ||||
| 						st->params[3] = MIN(st->params[3], 100); | ||||
| 						st->params[4] = MIN(st->params[4], 100); | ||||
| 						image->palette[st->color_index] | ||||
| 						    = hls_to_rgb(st->params[2], st->params[3], st->params[4]); | ||||
| 					} else if (st->params[1] == 2) { | ||||
| 						/* RGB */ | ||||
| 						st->params[2] = MIN(st->params[2], 100); | ||||
| 						st->params[3] = MIN(st->params[3], 100); | ||||
| 						st->params[4] = MIN(st->params[4], 100); | ||||
| 						image->palette[st->color_index] | ||||
| 						    = SIXEL_XRGB(st->params[2], st->params[3], st->params[4]); | ||||
| 					} | ||||
| 				} | ||||
| 				break; | ||||
| 			} | ||||
| 			break; | ||||
|  | ||||
| 		case PS_ERROR: | ||||
| 			if (*p == '\x1b') { | ||||
| 				st->state = PS_ESC; | ||||
| 				goto end; | ||||
| 			} | ||||
| 			p++; | ||||
| 			break; | ||||
| 		default: | ||||
| 			break; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| end: | ||||
| 	return p - p0; | ||||
| } | ||||
|  | ||||
| void | ||||
| sixel_parser_deinit(sixel_state_t *st) | ||||
| { | ||||
| 	if (st) | ||||
| 		sixel_image_deinit(&st->image); | ||||
| } | ||||
|  | ||||
| Pixmap | ||||
| sixel_create_clipmask(char *pixels, int width, int height) | ||||
| { | ||||
| 	char c, *clipdata, *dst; | ||||
| 	int b, i, n, y, w; | ||||
| 	int msb = (XBitmapBitOrder(xw.dpy) == MSBFirst); | ||||
| 	sixel_color_t *src = (sixel_color_t *)pixels; | ||||
| 	Pixmap clipmask; | ||||
|  | ||||
| 	clipdata = dst = malloc((width+7)/8 * height); | ||||
| 	if (!clipdata) | ||||
| 		return (Pixmap)None; | ||||
|  | ||||
| 	for (y = 0; y < height; y++) { | ||||
| 		for (w = width; w > 0; w -= n) { | ||||
| 			n = MIN(w, 8); | ||||
| 			if (msb) { | ||||
| 				for (b = 0x80, c = 0, i = 0; i < n; i++, b >>= 1) | ||||
| 					c |= (*src++) ? b : 0; | ||||
| 			} else { | ||||
| 				for (b = 0x01, c = 0, i = 0; i < n; i++, b <<= 1) | ||||
| 					c |= (*src++) ? b : 0; | ||||
| 			} | ||||
| 			*dst++ = c; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	clipmask = XCreateBitmapFromData(xw.dpy, xw.win, clipdata, width, height); | ||||
| 	free(clipdata); | ||||
| 	return clipmask; | ||||
| } | ||||
							
								
								
									
										63
									
								
								sixel.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										63
									
								
								sixel.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,63 @@ | ||||
| #ifndef SIXEL_H | ||||
| #define SIXEL_H | ||||
|  | ||||
| #define DECSIXEL_PARAMS_MAX 16 | ||||
| #define DECSIXEL_PALETTE_MAX 1024 | ||||
| #define DECSIXEL_PARAMVALUE_MAX 65535 | ||||
| #define DECSIXEL_WIDTH_MAX 4096 | ||||
| #define DECSIXEL_HEIGHT_MAX 4096 | ||||
|  | ||||
| typedef unsigned short sixel_color_no_t; | ||||
| typedef unsigned int sixel_color_t; | ||||
|  | ||||
| typedef struct sixel_image_buffer { | ||||
| 	sixel_color_no_t *data; | ||||
| 	int width; | ||||
| 	int height; | ||||
| 	sixel_color_t palette[DECSIXEL_PALETTE_MAX]; | ||||
| 	sixel_color_no_t ncolors; | ||||
| 	int palette_modified; | ||||
| 	int use_private_register; | ||||
| } sixel_image_t; | ||||
|  | ||||
| typedef enum parse_state { | ||||
| 	PS_ESC        = 1,  /* ESC */ | ||||
| 	PS_DECSIXEL   = 2,  /* DECSIXEL body part ", $, -, ? ... ~ */ | ||||
| 	PS_DECGRA     = 3,  /* DECGRA Set Raster Attributes " Pan; Pad; Ph; Pv */ | ||||
| 	PS_DECGRI     = 4,  /* DECGRI Graphics Repeat Introducer ! Pn Ch */ | ||||
| 	PS_DECGCI     = 5,  /* DECGCI Graphics Color Introducer # Pc; Pu; Px; Py; Pz */ | ||||
| 	PS_ERROR      = 6, | ||||
| } parse_state_t; | ||||
|  | ||||
| typedef struct parser_context { | ||||
| 	parse_state_t state; | ||||
| 	int pos_x; | ||||
| 	int pos_y; | ||||
| 	int max_x; | ||||
| 	int max_y; | ||||
| 	int attributed_pan; | ||||
| 	int attributed_pad; | ||||
| 	int attributed_ph; | ||||
| 	int attributed_pv; | ||||
| 	int transparent; | ||||
| 	int repeat_count; | ||||
| 	int color_index; | ||||
| 	int bgindex; | ||||
| 	int grid_width; | ||||
| 	int grid_height; | ||||
| 	int param; | ||||
| 	int nparams; | ||||
| 	int params[DECSIXEL_PARAMS_MAX]; | ||||
| 	sixel_image_t image; | ||||
| } sixel_state_t; | ||||
|  | ||||
| void scroll_images(int n); | ||||
| void delete_image(ImageList *im); | ||||
| int sixel_parser_init(sixel_state_t *st, int transparent, sixel_color_t fgcolor, sixel_color_t bgcolor, unsigned char use_private_register, int cell_width, int cell_height); | ||||
| int sixel_parser_parse(sixel_state_t *st, const unsigned char *p, size_t len); | ||||
| int sixel_parser_set_default_color(sixel_state_t *st); | ||||
| int sixel_parser_finalize(sixel_state_t *st, ImageList **newimages, int cx, int cy, int cw, int ch); | ||||
| void sixel_parser_deinit(sixel_state_t *st); | ||||
| Pixmap sixel_create_clipmask(char *pixels, int width, int height); | ||||
|  | ||||
| #endif | ||||
							
								
								
									
										115
									
								
								sixel_hls.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										115
									
								
								sixel_hls.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,115 @@ | ||||
| // sixel.c (part of mintty) | ||||
| // this function is derived from a part of graphics.c | ||||
| // in Xterm pl#310 originally written by Ross Combs. | ||||
| // | ||||
| // Copyright 2013,2014 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. | ||||
|  | ||||
| #define SIXEL_RGB(r, g, b) ((r) + ((g) << 8) + ((b) << 16) + (255 << 24)) | ||||
|  | ||||
| int | ||||
| hls_to_rgb(int hue, int lum, int sat) | ||||
| { | ||||
|   double hs = (hue + 240) % 360; | ||||
|   double hv = hs / 360.0; | ||||
|   double lv = lum / 100.0; | ||||
|   double sv = sat / 100.0; | ||||
|   double c, x, m, c2; | ||||
|   double r1, g1, b1; | ||||
|   int r, g, b; | ||||
|   int hpi; | ||||
|  | ||||
|   if (sat == 0) { | ||||
|     r = g = b = lum * 255 / 100; | ||||
|     return SIXEL_RGB(r, g, b); | ||||
|   } | ||||
|  | ||||
|   if ((c2 = ((2.0 * lv) - 1.0)) < 0.0) { | ||||
|     c2 = -c2; | ||||
|   } | ||||
|   c = (1.0 - c2) * sv; | ||||
|   hpi = (int) (hv * 6.0); | ||||
|   x = (hpi & 1) ? c : 0.0; | ||||
|   m = lv - 0.5 * c; | ||||
|  | ||||
|   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: | ||||
|     return SIXEL_RGB(255, 255, 255); | ||||
|   } | ||||
|  | ||||
|   r = (int) ((r1 + m) * 100.0 + 0.5); | ||||
|   g = (int) ((g1 + m) * 100.0 + 0.5); | ||||
|   b = (int) ((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; | ||||
|   } | ||||
|   return SIXEL_RGB(r * 255 / 100, g * 255 / 100, b * 255 / 100); | ||||
| } | ||||
							
								
								
									
										7
									
								
								sixel_hls.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								sixel_hls.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | ||||
| /* | ||||
|  * Primary color hues: | ||||
|  *  blue:  0 degrees | ||||
|  *  red:   120 degrees | ||||
|  *  green: 240 degrees | ||||
|  */ | ||||
| int hls_to_rgb(int hue, int lum, int sat); | ||||
							
								
								
									
										203
									
								
								st.h
									
									
									
									
									
								
							
							
						
						
									
										203
									
								
								st.h
									
									
									
									
									
								
							| @@ -1,7 +1,14 @@ | ||||
| /* See LICENSE for license details. */ | ||||
|  | ||||
| #include <stdint.h> | ||||
| #include <time.h> | ||||
| #include <sys/types.h> | ||||
| #include <X11/Xatom.h> | ||||
| #include <X11/Xlib.h> | ||||
| #include <X11/cursorfont.h> | ||||
| #include <X11/keysym.h> | ||||
| #include <X11/Xft/Xft.h> | ||||
| #include <X11/XKBlib.h> | ||||
|  | ||||
| /* macros */ | ||||
| #define MIN(a, b)		((a) < (b) ? (a) : (b)) | ||||
| @@ -21,21 +28,45 @@ | ||||
| #define IS_TRUECOL(x)		(1 << 24 & (x)) | ||||
|  | ||||
| enum glyph_attribute { | ||||
| 	ATTR_NULL       = 0, | ||||
| 	ATTR_BOLD       = 1 << 0, | ||||
| 	ATTR_FAINT      = 1 << 1, | ||||
| 	ATTR_ITALIC     = 1 << 2, | ||||
| 	ATTR_UNDERLINE  = 1 << 3, | ||||
| 	ATTR_BLINK      = 1 << 4, | ||||
| 	ATTR_REVERSE    = 1 << 5, | ||||
| 	ATTR_INVISIBLE  = 1 << 6, | ||||
| 	ATTR_STRUCK     = 1 << 7, | ||||
| 	ATTR_WRAP       = 1 << 8, | ||||
| 	ATTR_WIDE       = 1 << 9, | ||||
| 	ATTR_WDUMMY     = 1 << 10, | ||||
| 	ATTR_NULL           = 0, | ||||
| 	ATTR_SET            = 1 << 0, | ||||
| 	ATTR_BOLD           = 1 << 1, | ||||
| 	ATTR_FAINT          = 1 << 2, | ||||
| 	ATTR_ITALIC         = 1 << 3, | ||||
| 	ATTR_UNDERLINE      = 1 << 4, | ||||
| 	ATTR_BLINK          = 1 << 5, | ||||
| 	ATTR_REVERSE        = 1 << 6, | ||||
| 	ATTR_INVISIBLE      = 1 << 7, | ||||
| 	ATTR_STRUCK         = 1 << 8, | ||||
| 	ATTR_WRAP           = 1 << 9, | ||||
| 	ATTR_WIDE           = 1 << 10, | ||||
| 	ATTR_WDUMMY         = 1 << 11, | ||||
| 	ATTR_SIXEL          = 1 << 16, | ||||
| 	ATTR_BOLD_FAINT = ATTR_BOLD | ATTR_FAINT, | ||||
| }; | ||||
|  | ||||
| typedef struct _ImageList { | ||||
| 	struct _ImageList *next, *prev; | ||||
| 	unsigned char *pixels; | ||||
| 	void *pixmap; | ||||
| 	void *clipmask; | ||||
| 	int width; | ||||
| 	int height; | ||||
| 	int x; | ||||
| 	int y; | ||||
| 	int cols; | ||||
| 	int cw; | ||||
| 	int ch; | ||||
| 	int transparent; | ||||
| } ImageList; | ||||
|  | ||||
| /* Used to control which screen(s) keybindings and mouse shortcuts apply to. */ | ||||
| enum screen { | ||||
| 	S_PRI = -1, /* primary screen */ | ||||
| 	S_ALL = 0,  /* both primary and alt screen */ | ||||
| 	S_ALT = 1   /* alternate screen */ | ||||
| }; | ||||
|  | ||||
| enum selection_mode { | ||||
| 	SEL_IDLE = 0, | ||||
| 	SEL_EMPTY = 1, | ||||
| @@ -59,16 +90,50 @@ typedef unsigned short ushort; | ||||
|  | ||||
| typedef uint_least32_t Rune; | ||||
|  | ||||
| typedef XftDraw *Draw; | ||||
| typedef XftColor Color; | ||||
| typedef XftGlyphFontSpec GlyphFontSpec; | ||||
|  | ||||
| #define Glyph Glyph_ | ||||
| typedef struct { | ||||
| 	Rune u;           /* character code */ | ||||
| 	ushort mode;      /* attribute flags */ | ||||
| 	uint32_t mode;    /* attribute flags */ | ||||
| 	uint32_t fg;      /* foreground  */ | ||||
| 	uint32_t bg;      /* background  */ | ||||
| } Glyph; | ||||
|  | ||||
| typedef Glyph *Line; | ||||
|  | ||||
| typedef struct { | ||||
| 	Glyph attr; /* current char attributes */ | ||||
| 	int x; | ||||
| 	int y; | ||||
| 	char state; | ||||
| } TCursor; | ||||
|  | ||||
| /* Internal representation of the screen */ | ||||
| typedef struct { | ||||
| 	int row;      /* nb row */ | ||||
| 	int col;      /* nb col */ | ||||
| 	Line *line;   /* screen */ | ||||
| 	Line *alt;    /* alternate screen */ | ||||
| 	int *dirty;   /* dirtyness of lines */ | ||||
| 	TCursor c;    /* cursor */ | ||||
| 	int ocx;      /* old cursor col */ | ||||
| 	int ocy;      /* old cursor row */ | ||||
| 	int top;      /* top    scroll limit */ | ||||
| 	int bot;      /* bottom scroll limit */ | ||||
| 	int mode;     /* terminal mode flags */ | ||||
| 	int esc;      /* escape state flags */ | ||||
| 	char trantbl[4]; /* charset table translation */ | ||||
| 	int charset;  /* current charset */ | ||||
| 	int icharset; /* selected charset for sequence */ | ||||
| 	int *tabs; | ||||
| 	ImageList *images;     /* sixel images */ | ||||
| 	ImageList *images_alt; /* sixel images for alternate screen */ | ||||
| 	Rune lastc;   /* last printed char outside of sequence, 0 if control */ | ||||
| } Term; | ||||
|  | ||||
| typedef union { | ||||
| 	int i; | ||||
| 	uint ui; | ||||
| @@ -77,9 +142,106 @@ typedef union { | ||||
| 	const char *s; | ||||
| } Arg; | ||||
|  | ||||
| /* Purely graphic info */ | ||||
| typedef struct { | ||||
| 	int tw, th; /* tty width and height */ | ||||
| 	int w, h; /* window width and height */ | ||||
| 	int ch; /* char height */ | ||||
| 	int cw; /* char width  */ | ||||
| 	int mode; /* window state/mode flags */ | ||||
| 	int cursor; /* cursor style */ | ||||
| } TermWindow; | ||||
|  | ||||
| typedef struct { | ||||
| 	Display *dpy; | ||||
| 	Colormap cmap; | ||||
| 	Window win; | ||||
| 	Drawable buf; | ||||
| 	GlyphFontSpec *specbuf; /* font spec buffer used for rendering */ | ||||
| 	Atom xembed, wmdeletewin, netwmname, netwmiconname, netwmpid; | ||||
| 	struct { | ||||
| 		XIM xim; | ||||
| 		XIC xic; | ||||
| 		XPoint spot; | ||||
| 		XVaNestedList spotlist; | ||||
| 	} ime; | ||||
| 	Draw draw; | ||||
| 	Visual *vis; | ||||
| 	XSetWindowAttributes attrs; | ||||
| 	/* Here, we use the term *pointer* to differentiate the cursor | ||||
| 	 * one sees when hovering the mouse over the terminal from, e.g., | ||||
| 	 * a green rectangle where text would be entered. */ | ||||
| 	Cursor vpointer, bpointer; /* visible and hidden pointers */ | ||||
| 	int pointerisvisible; | ||||
| 	int scr; | ||||
| 	int isfixed; /* is fixed geometry? */ | ||||
| 	int l, t; /* left and top offset */ | ||||
| 	int gm; /* geometry mask */ | ||||
| } XWindow; | ||||
|  | ||||
| typedef struct { | ||||
| 	Atom xtarget; | ||||
| 	char *primary, *clipboard; | ||||
| 	struct timespec tclick1; | ||||
| 	struct timespec tclick2; | ||||
| } XSelection; | ||||
|  | ||||
| /* types used in config.h */ | ||||
| typedef struct { | ||||
| 	uint mod; | ||||
| 	KeySym keysym; | ||||
| 	void (*func)(const Arg *); | ||||
| 	const Arg arg; | ||||
| 	int screen; | ||||
| } Shortcut; | ||||
|  | ||||
| typedef struct { | ||||
| 	uint mod; | ||||
| 	uint button; | ||||
| 	void (*func)(const Arg *); | ||||
| 	const Arg arg; | ||||
| 	uint release; | ||||
| 	int screen; | ||||
| } MouseShortcut; | ||||
|  | ||||
| typedef struct { | ||||
| 	KeySym k; | ||||
| 	uint mask; | ||||
| 	char *s; | ||||
| 	/* three-valued logic variables: 0 indifferent, 1 on, -1 off */ | ||||
| 	signed char appkey;    /* application keypad */ | ||||
| 	signed char appcursor; /* application cursor */ | ||||
| } Key; | ||||
|  | ||||
| /* Font structure */ | ||||
| #define Font Font_ | ||||
| typedef struct { | ||||
| 	int height; | ||||
| 	int width; | ||||
| 	int ascent; | ||||
| 	int descent; | ||||
| 	int badslant; | ||||
| 	int badweight; | ||||
| 	short lbearing; | ||||
| 	short rbearing; | ||||
| 	XftFont *match; | ||||
| 	FcFontSet *set; | ||||
| 	FcPattern *pattern; | ||||
| } Font; | ||||
|  | ||||
| /* Drawing Context */ | ||||
| typedef struct { | ||||
| 	Color *col; | ||||
| 	size_t collen; | ||||
| 	Font font, bfont, ifont, ibfont; | ||||
| 	GC gc; | ||||
| } DC; | ||||
|  | ||||
| void die(const char *, ...); | ||||
| void redraw(void); | ||||
| void draw(void); | ||||
| void drawregion(int, int, int, int); | ||||
| void tfulldirt(void); | ||||
|  | ||||
| void printscreen(const Arg *); | ||||
| void printsel(const Arg *); | ||||
| @@ -87,11 +249,12 @@ void sendbreak(const Arg *); | ||||
| void toggleprinter(const Arg *); | ||||
|  | ||||
| int tattrset(int); | ||||
| int tisaltscr(void); | ||||
| void tnew(int, int); | ||||
| void tresize(int, int); | ||||
| void tsetdirtattr(int); | ||||
| void ttyhangup(void); | ||||
| int ttynew(char *, char *, char *, char **); | ||||
| int ttynew(const char *, char *, const char *, char **); | ||||
| size_t ttyread(void); | ||||
| void ttyresize(int, int); | ||||
| void ttywrite(const char *, size_t, int); | ||||
| @@ -100,6 +263,7 @@ void resettitle(void); | ||||
|  | ||||
| void selclear(void); | ||||
| void selinit(void); | ||||
| void selremove(void); | ||||
| void selstart(int, int, int); | ||||
| void selextend(int, int, int, int); | ||||
| int selected(int, int); | ||||
| @@ -109,7 +273,9 @@ size_t utf8encode(Rune, char *); | ||||
|  | ||||
| void *xmalloc(size_t); | ||||
| void *xrealloc(void *, size_t); | ||||
| char *xstrdup(char *); | ||||
| char *xstrdup(const char *); | ||||
|  | ||||
| int xgetcolor(int x, unsigned char *r, unsigned char *g, unsigned char *b); | ||||
|  | ||||
| /* config.h globals */ | ||||
| extern char *utmp; | ||||
| @@ -123,3 +289,10 @@ extern char *termname; | ||||
| extern unsigned int tabspaces; | ||||
| extern unsigned int defaultfg; | ||||
| extern unsigned int defaultbg; | ||||
| extern unsigned int defaultcs; | ||||
|  | ||||
| extern DC dc; | ||||
| extern XWindow xw; | ||||
| extern XSelection xsel; | ||||
| extern TermWindow win; | ||||
| extern Term term; | ||||
|   | ||||
							
								
								
									
										4
									
								
								st.info
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								st.info
									
									
									
									
									
								
							| @@ -184,6 +184,10 @@ st-mono| simpleterm monocolor, | ||||
| # XTerm extensions | ||||
| 	rmxx=\E[29m, | ||||
| 	smxx=\E[9m, | ||||
| 	BE=\E[?2004h, | ||||
| 	BD=\E[?2004l, | ||||
| 	PS=\E[200~, | ||||
| 	PE=\E[201~, | ||||
| # disabled rep for now: causes some issues with older ncurses versions. | ||||
| #	rep=%p1%c\E[%p2%{1}%-%db, | ||||
| # tmux extensions, see TERMINFO EXTENSIONS in tmux(1) | ||||
|   | ||||
							
								
								
									
										2
									
								
								win.h
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								win.h
									
									
									
									
									
								
							| @@ -30,6 +30,8 @@ void xdrawline(Line, int, int, int); | ||||
| void xfinishdraw(void); | ||||
| void xloadcols(void); | ||||
| int xsetcolorname(int, const char *); | ||||
| int xgetcolor(int, unsigned char *, unsigned char *, unsigned char *); | ||||
| void xseticontitle(char *); | ||||
| void xsettitle(char *); | ||||
| int xsetcursor(int); | ||||
| void xsetmode(int, unsigned int); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user