From 97b4cc57bb8f741b49c02901d1356b119738b67a Mon Sep 17 00:00:00 2001 From: kvj Date: Mon, 11 Dec 2023 19:15:23 +0100 Subject: [PATCH] Some changes --- Makefile | 5 +- config.def.h | 474 ------------ config.h | 476 +----------- patch/alpha.c | 11 - patch/alpha.h | 3 - patch/fixkeyboardinput.c | 2 +- patch/font2.c | 8 +- patch/font2.h | 2 +- patch/scrollback.c | 14 - patch/scrollback.h | 2 - patch/st_embedder_x.h | 2 +- patch/st_include.c | 29 - patch/st_include.h | 29 - patch/utils.h | 2 +- patch/x_include.c | 38 - patch/x_include.h | 36 - st | Bin 143800 -> 143800 bytes st.c | 829 --------------------- st.h | 107 --- win.h | 18 +- x.c | 1525 -------------------------------------- x.o | Bin 118848 -> 118848 bytes 22 files changed, 8 insertions(+), 3604 deletions(-) diff --git a/Makefile b/Makefile index 2b3859a..3dc6258 100644 --- a/Makefile +++ b/Makefile @@ -12,16 +12,13 @@ all: st config.h: cp config.def.h config.h -patches.h: - cp patches.def.h patches.h - .c.o: $(CC) $(STCFLAGS) -c $< st.o: config.h st.h win.h x.o: arg.h config.h st.h win.h $(LIGATURES_H) -$(OBJ): config.h config.mk patches.h +$(OBJ): config.h config.mk st: $(OBJ) $(CC) -o $@ $(OBJ) $(STLDFLAGS) diff --git a/config.def.h b/config.def.h index 93d352e..cc51fa7 100644 --- a/config.def.h +++ b/config.def.h @@ -6,37 +6,15 @@ * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html */ static char *font = "Iosevka Nerd Font:pixelsize=20:antialias=true:autohint=true"; -#if FONT2_PATCH /* Spare fonts */ static char *font2[] = { /* "Inconsolata for Powerline:pixelsize=12:antialias=true:autohint=true", */ /* "Hack Nerd Font Mono:pixelsize=11:antialias=true:autohint=true", */ }; -#endif // FONT2_PATCH -#if BACKGROUND_IMAGE_PATCH -/* - * background image - * expects farbfeld format - * pseudo transparency fixes coordinates to the screen origin - */ -static const char *bgfile = "/path/to/image.ff"; -static const int pseudotransparency = 0; -#endif // BACKGROUND_IMAGE_PATCH -#if RELATIVEBORDER_PATCH -/* borderperc: percentage of cell width to use as a border - * 0 = no border, 100 = border width is same as cell width */ -int borderperc = 20; -#else static int borderpx = 2; -#endif // RELATIVEBORDER_PATCH -#if OPENURLONCLICK_PATCH -/* modkey options: ControlMask, ShiftMask or XK_ANY_MOD */ -static uint url_opener_modkey = XK_ANY_MOD; -static char *url_opener = "xdg-open"; -#endif // OPENURLONCLICK_PATCH /* * What program is execed by st depends of these precedence rules: @@ -53,11 +31,7 @@ char *scroll = NULL; char *stty_args = "stty raw pass8 nl -echo -iexten -cstopb 38400"; /* identification sequence returned in DA and DECID */ -#if SIXEL_PATCH -char *vtiden = "\033[?12;4c"; -#else char *vtiden = "\033[?6c"; -#endif /* Kerning / character bounding-box multipliers */ static float cwscale = 1.0; @@ -90,13 +64,6 @@ int allowwindowops = 0; static double minlatency = 8; static double maxlatency = 33; -#if SYNC_PATCH -/* - * Synchronized-Update timeout in ms - * https://gitlab.com/gnachman/iterm2/-/wikis/synchronized-updates-spec - */ -static uint su_timeout = 200; -#endif // SYNC_PATCH /* * blinking timeout (set to 0 to disable blinking) for the terminal blinking @@ -109,19 +76,6 @@ static unsigned int blinktimeout = 800; */ static unsigned int cursorthickness = 2; -#if BOXDRAW_PATCH -/* - * 1: render most of the lines/blocks characters without using the font for - * perfect alignment between cells (U2500 - U259F except dashes/diagonals). - * Bold affects lines thickness if boxdraw_bold is not 0. Italic is ignored. - * 0: disable (render all U25XX glyphs normally from the font). - */ -const int boxdraw = 0; -const int boxdraw_bold = 0; - -/* braille (U28XX): 1: render as adjacent "pixels", 0: use font */ -const int boxdraw_braille = 0; -#endif // BOXDRAW_PATCH /* * bell volume. It must be a value between -100 and 100. Use 0 for disabling @@ -149,17 +103,8 @@ char *termname = "xterm"; */ unsigned int tabspaces = 8; -#if ALPHA_PATCH /* bg opacity */ float alpha = 0.8; -#if ALPHA_GRADIENT_PATCH -float grad_alpha = 0.54; //alpha value that'll change -float stat_alpha = 0.46; //constant alpha value that'll get added to grad_alpha -#endif // ALPHA_GRADIENT_PATCH -#if ALPHA_FOCUS_HIGHLIGHT_PATCH -float alphaUnfocused = 0.6; -#endif // ALPHA_FOCUS_HIGHLIGHT_PATCH -#endif // ALPHA_PATCH /* Terminal colors (16 first used in escape sequence) */ static const char *colorname[] = { @@ -198,35 +143,12 @@ static const char *colorname[] = { * Default colors (colorname index) * foreground, background, cursor, reverse cursor */ -#if ALPHA_PATCH && ALPHA_FOCUS_HIGHLIGHT_PATCH -unsigned int defaultbg = 0; -unsigned int bg = 17, bgUnfocused = 16; -#else unsigned int defaultbg = 258; -#endif // ALPHA_FOCUS_HIGHLIGHT_PATCH unsigned int defaultfg = 259; unsigned int defaultcs = 256; unsigned int defaultrcs = 257; -#if VIM_BROWSE_PATCH -unsigned int const currentBg = 6, buffSize = 2048; -/// Enable double / triple click yanking / selection of word / line. -int const mouseYank = 1, mouseSelect = 0; -/// [Vim Browse] Colors for search results currently on screen. -unsigned int const highlightBg = 160, highlightFg = 15; -char const wDelS[] = "!\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~", wDelL[] = " \t"; -char *nmKeys [] = { ///< Shortcusts executed in normal mode - "R/Building\nN", "r/Building\n", "X/juli@machine\nN", "x/juli@machine\n", - "Q?[Leaving vim, starting execution]\n","F/: error:\nN", "f/: error:\n", "DQf" -}; -unsigned int const amountNmKeys = sizeof(nmKeys) / sizeof(*nmKeys); -/// Style of the {command, search} string shown in the right corner (y,v,V,/) -Glyph styleSearch = {' ', ATTR_ITALIC | ATTR_BOLD_FAINT, 7, 16}; -Glyph style[] = {{' ',ATTR_ITALIC|ATTR_FAINT,15,16}, {' ',ATTR_ITALIC,232,11}, - {' ', ATTR_ITALIC, 232, 4}, {' ', ATTR_ITALIC, 232, 12}}; -#endif // VIM_BROWSE_PATCH -#if BLINKING_CURSOR_PATCH /* * https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h4-Functions-using-CSI-_-ordered-by-the-final-character-lparen-s-rparen:CSI-Ps-SP-q.1D81 * Default style of cursor @@ -242,16 +164,6 @@ Glyph style[] = {{' ',ATTR_ITALIC|ATTR_FAINT,15,16}, {' ',ATTR_ITALIC,232,11}, */ static unsigned int cursorstyle = 1; static Rune stcursor = 0x2603; /* snowman (U+2603) */ -#else -/* - * Default shape of cursor - * 2: Block ("█") - * 4: Underline ("_") - * 6: Bar ("|") - * 7: Snowman ("☃") - */ -static unsigned int cursorshape = 2; -#endif // BLINKING_CURSOR_PATCH /* * Default columns and rows numbers @@ -260,19 +172,12 @@ static unsigned int cursorshape = 2; static unsigned int cols = 80; static unsigned int rows = 24; -#if THEMED_CURSOR_PATCH -/* - * Default shape of the mouse cursor - */ -static char* mouseshape = "xterm"; -#else /* * Default colour and shape of the mouse cursor */ static unsigned int mouseshape = XC_xterm; static unsigned int mousefg = 7; static unsigned int mousebg = 0; -#endif // THEMED_CURSOR_PATCH /* * Color used to display font attributes when fontconfig selected a font which @@ -280,53 +185,6 @@ static unsigned int mousebg = 0; */ static unsigned int defaultattr = 11; -#if XRESOURCES_PATCH -/* - * Xresources preferences to load at startup - */ -ResourcePref resources[] = { - { "font", STRING, &font }, - { "color0", STRING, &colorname[0] }, - { "color1", STRING, &colorname[1] }, - { "color2", STRING, &colorname[2] }, - { "color3", STRING, &colorname[3] }, - { "color4", STRING, &colorname[4] }, - { "color5", STRING, &colorname[5] }, - { "color6", STRING, &colorname[6] }, - { "color7", STRING, &colorname[7] }, - { "color8", STRING, &colorname[8] }, - { "color9", STRING, &colorname[9] }, - { "color10", STRING, &colorname[10] }, - { "color11", STRING, &colorname[11] }, - { "color12", STRING, &colorname[12] }, - { "color13", STRING, &colorname[13] }, - { "color14", STRING, &colorname[14] }, - { "color15", STRING, &colorname[15] }, - { "background", STRING, &colorname[258] }, - { "foreground", STRING, &colorname[259] }, - { "cursorColor", STRING, &colorname[256] }, - { "termname", STRING, &termname }, - { "shell", STRING, &shell }, - { "minlatency", INTEGER, &minlatency }, - { "maxlatency", INTEGER, &maxlatency }, - { "blinktimeout", INTEGER, &blinktimeout }, - { "bellvolume", INTEGER, &bellvolume }, - { "tabspaces", INTEGER, &tabspaces }, - #if RELATIVEBORDER_PATCH - { "borderperc", INTEGER, &borderperc }, - #else - { "borderpx", INTEGER, &borderpx }, - #endif // RELATIVEBORDER_PATCH - { "cwscale", FLOAT, &cwscale }, - { "chscale", FLOAT, &chscale }, - #if ALPHA_PATCH - { "alpha", FLOAT, &alpha }, - #endif // ALPHA_PATCH - #if ALPHA_FOCUS_HIGHLIGHT_PATCH - { "alphaUnfocused",FLOAT, &alphaUnfocused }, - #endif // ALPHA_FOCUS_HIGHLIGHT_PATCH -}; -#endif // XRESOURCES_PATCH /* * Force mouse select/shortcuts while mask is active (when MODE_MOUSE is set). @@ -341,47 +199,24 @@ static uint forcemousemod = ShiftMask; */ static MouseShortcut mshortcuts[] = { /* mask button function argument release screen */ - #if CLIPBOARD_PATCH - { XK_ANY_MOD, Button2, clippaste, {.i = 0}, 1 }, - #else { XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 }, - #endif // CLIPBOARD_PATCH - #if SCROLLBACK_MOUSE_PATCH { ShiftMask, Button4, kscrollup, {.i = 1}, 0, S_PRI}, { ShiftMask, Button5, kscrolldown, {.i = 1}, 0, S_PRI}, - #elif UNIVERSCROLL_PATCH - { XK_ANY_MOD, Button4, ttysend, {.s = "\033[5;2~"}, 0, S_PRI }, - { XK_ANY_MOD, Button5, ttysend, {.s = "\033[6;2~"}, 0, S_PRI }, - #else - { ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} }, - { ShiftMask, Button5, ttysend, {.s = "\033[6;2~"} }, - #endif // SCROLLBACK_MOUSE_PATCH - #if SCROLLBACK_MOUSE_ALTSCREEN_PATCH - { XK_NO_MOD, Button4, kscrollup, {.i = 1}, 0, S_PRI }, - { XK_NO_MOD, Button5, kscrolldown, {.i = 1}, 0, S_PRI }, - { XK_ANY_MOD, Button4, ttysend, {.s = "\031"}, 0, S_ALT }, - { XK_ANY_MOD, Button5, ttysend, {.s = "\005"}, 0, S_ALT }, - #else { XK_ANY_MOD, Button4, ttysend, {.s = "\031"} }, { XK_ANY_MOD, Button5, ttysend, {.s = "\005"} }, - #endif // SCROLLBACK_MOUSE_ALTSCREEN_PATCH }; /* Internal keyboard shortcuts. */ #define MODKEY Mod1Mask #define TERMMOD (ControlMask|ShiftMask) -#if EXTERNALPIPE_PATCH // example command static char *openurlcmd[] = { "/bin/sh", "-c", "xurls | dmenu -l 10 -w $WINDOWID | xargs -r open", "externalpipe", NULL }; -#if EXTERNALPIPEIN_PATCH // example command static char *setbgcolorcmd[] = { "/bin/sh", "-c", "printf '\033]11;#008000\007'", "externalpipein", NULL }; -#endif // EXTERNALPIPEIN_PATCH -#endif // EXTERNALPIPE_PATCH static Shortcut shortcuts[] = { /* mask keysym function argument screen */ @@ -394,57 +229,13 @@ static Shortcut shortcuts[] = { { TERMMOD, XK_Home, zoomreset, {.f = 0} }, { TERMMOD, XK_C, clipcopy, {.i = 0} }, { TERMMOD, XK_V, clippaste, {.i = 0} }, - #if ALPHA_PATCH { TERMMOD, XK_O, changealpha, {.f = +0.05} }, { TERMMOD, XK_P, changealpha, {.f = -0.05} }, - #if ALPHA_FOCUS_HIGHLIGHT_PATCH - //{ TERMMOD, XK_, changealphaunfocused, {.f = +0.05} }, - //{ TERMMOD, XK_, changealphaunfocused, {.f = -0.05} }, - #endif // ALPHA_FOCUS_HIGHLIGHT_PATCH - #endif // ALPHA_PATCH - #if FULLSCREEN_PATCH - { XK_NO_MOD, XK_F11, fullscreen, {.i = 0} }, - { MODKEY, XK_Return, fullscreen, {.i = 0} }, - #endif // FULLSCREEN_PATCH - #if SCROLLBACK_PATCH { ShiftMask, XK_Page_Up, kscrollup, {.i = -1}, S_PRI }, { ShiftMask, XK_Page_Down, kscrolldown, {.i = -1}, S_PRI }, - #endif // SCROLLBACK_PATCH - #if CLIPBOARD_PATCH - { TERMMOD, XK_Y, clippaste, {.i = 0} }, - { ShiftMask, XK_Insert, clippaste, {.i = 0} }, - #else { TERMMOD, XK_Y, selpaste, {.i = 0} }, { ShiftMask, XK_Insert, selpaste, {.i = 0} }, - #endif // CLIPBOARD_PATCH { TERMMOD, XK_Num_Lock, numlock, {.i = 0} }, - #if COPYURL_PATCH || COPYURL_HIGHLIGHT_SELECTED_URLS_PATCH - { MODKEY, XK_l, copyurl, {.i = 0} }, - #endif // COPYURL_PATCH - #if OPENCOPIED_PATCH - { MODKEY, XK_o, opencopied, {.v = "xdg-open"} }, - #endif // OPENCOPIED_PATCH - #if NEWTERM_PATCH - { TERMMOD, XK_Return, newterm, {.i = 0} }, - #endif // NEWTERM_PATCH - #if EXTERNALPIPE_PATCH - { TERMMOD, XK_U, externalpipe, { .v = openurlcmd } }, - #if EXTERNALPIPEIN_PATCH - { TERMMOD, XK_M, externalpipein, { .v = setbgcolorcmd } }, - #endif // EXTERNALPIPEIN_PATCH - #endif // EXTERNALPIPE_PATCH - #if KEYBOARDSELECT_PATCH - { TERMMOD, XK_Escape, keyboard_select, { 0 } }, - #endif // KEYBOARDSELECT_PATCH - #if ISO14755_PATCH - { TERMMOD, XK_I, iso14755, {.i = 0} }, - #endif // ISO14755_PATCH - #if INVERT_PATCH - { TERMMOD, XK_X, invert, { 0 } }, - #endif // INVERT_PATCH - #if VIM_BROWSE_PATCH - { MODKEY, XK_c, normalMode, {.i = 0} }, - #endif // VIM_BROWSE_PATCH }; /* @@ -468,13 +259,6 @@ static Shortcut shortcuts[] = { * position for a key. */ -#if !FIXKEYBOARDINPUT_PATCH -/* - * 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 }; -#endif // FIXKEYBOARDINPUT_PATCH /* * State bits to ignore when matching key or button events. By default, @@ -482,232 +266,6 @@ static KeySym mappedkeys[] = { -1 }; */ static uint ignoremod = Mod2Mask|XK_SWITCH_MOD; -#if !FIXKEYBOARDINPUT_PATCH -/* - * 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}, - #if DELKEY_PATCH - { XK_KP_Delete, XK_ANY_MOD, "\033[3~", -1, 0}, - #else - { XK_KP_Delete, XK_ANY_MOD, "\033[P", -1, 0}, - #endif // DELKEY_PATCH - { 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}, - #if DELKEY_PATCH - { XK_Delete, XK_ANY_MOD, "\033[3~", -1, 0}, - #else - { XK_Delete, XK_ANY_MOD, "\033[P", -1, 0}, - #endif // DELKEY_PATCH - { 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}, -}; -#endif // FIXKEYBOARDINPUT_PATCH /* * Selection types' masks. @@ -729,36 +287,4 @@ static char ascii_printable[] = "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_" "`abcdefghijklmnopqrstuvwxyz{|}~"; -#if RIGHTCLICKTOPLUMB_PATCH -/* - * plumb_cmd is run on mouse button 3 click, with argument set to - * current selection and with cwd set to the cwd of the active shell - */ -static char *plumb_cmd = "plumb"; -#endif // RIGHTCLICKTOPLUMB_PATCH -#if UNDERCURL_PATCH -/** - * Undercurl style. Set UNDERCURL_STYLE to one of the available styles. - * - * Curly: Dunno how to draw it *shrug* - * _ _ _ _ - * ( ) ( ) ( ) ( ) - * (_) (_) (_) (_) - * - * Spiky: - * /\ /\ /\ /\ - * \/ \/ \/ - * - * Capped: - * _ _ _ - * / \ / \ / \ - * \_/ \_/ - */ -// Available styles -#define UNDERCURL_CURLY 0 -#define UNDERCURL_SPIKY 1 -#define UNDERCURL_CAPPED 2 -// Active style -#define UNDERCURL_STYLE UNDERCURL_SPIKY -#endif // UNDERCURL_PATCH diff --git a/config.h b/config.h index 09fc32b..5865704 100644 --- a/config.h +++ b/config.h @@ -6,37 +6,15 @@ * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html */ static char *font = "Iosevka Nerd Font:pixelsize=20:antialias=true:autohint=true"; -#if FONT2_PATCH /* Spare fonts */ static char *font2[] = { "Noto Color Emoji:pixelsize=20:antialias=true:autohint=true", "Material Design Icons Desktop:pixelsize=19", }; -#endif // FONT2_PATCH -#if BACKGROUND_IMAGE_PATCH -/* - * background image - * expects farbfeld format - * pseudo transparency fixes coordinates to the screen origin - */ -static const char *bgfile = "/path/to/image.ff"; -static const int pseudotransparency = 0; -#endif // BACKGROUND_IMAGE_PATCH -#if RELATIVEBORDER_PATCH -/* borderperc: percentage of cell width to use as a border - * 0 = no border, 100 = border width is same as cell width */ -int borderperc = 20; -#else -static int borderpx = 2; -#endif // RELATIVEBORDER_PATCH +static int borderpx = 20; -#if OPENURLONCLICK_PATCH -/* modkey options: ControlMask, ShiftMask or XK_ANY_MOD */ -static uint url_opener_modkey = XK_ANY_MOD; -static char *url_opener = "xdg-open"; -#endif // OPENURLONCLICK_PATCH /* * What program is execed by st depends of these precedence rules: @@ -53,11 +31,7 @@ char *scroll = NULL; char *stty_args = "stty raw pass8 nl -echo -iexten -cstopb 38400"; /* identification sequence returned in DA and DECID */ -#if SIXEL_PATCH -char *vtiden = "\033[?12;4c"; -#else char *vtiden = "\033[?6c"; -#endif /* Kerning / character bounding-box multipliers */ static float cwscale = 1.0; @@ -90,13 +64,6 @@ int allowwindowops = 0; static double minlatency = 8; static double maxlatency = 33; -#if SYNC_PATCH -/* - * Synchronized-Update timeout in ms - * https://gitlab.com/gnachman/iterm2/-/wikis/synchronized-updates-spec - */ -static uint su_timeout = 200; -#endif // SYNC_PATCH /* * blinking timeout (set to 0 to disable blinking) for the terminal blinking @@ -109,19 +76,6 @@ static unsigned int blinktimeout = 800; */ static unsigned int cursorthickness = 2; -#if BOXDRAW_PATCH -/* - * 1: render most of the lines/blocks characters without using the font for - * perfect alignment between cells (U2500 - U259F except dashes/diagonals). - * Bold affects lines thickness if boxdraw_bold is not 0. Italic is ignored. - * 0: disable (render all U25XX glyphs normally from the font). - */ -const int boxdraw = 0; -const int boxdraw_bold = 0; - -/* braille (U28XX): 1: render as adjacent "pixels", 0: use font */ -const int boxdraw_braille = 0; -#endif // BOXDRAW_PATCH /* * bell volume. It must be a value between -100 and 100. Use 0 for disabling @@ -149,17 +103,8 @@ char *termname = "xterm"; */ unsigned int tabspaces = 8; -#if ALPHA_PATCH /* bg opacity */ float alpha = 0.93; -#if ALPHA_GRADIENT_PATCH -float grad_alpha = 0.54; //alpha value that'll change -float stat_alpha = 0.46; //constant alpha value that'll get added to grad_alpha -#endif // ALPHA_GRADIENT_PATCH -#if ALPHA_FOCUS_HIGHLIGHT_PATCH -float alphaUnfocused = 0.6; -#endif // ALPHA_FOCUS_HIGHLIGHT_PATCH -#endif // ALPHA_PATCH /* Terminal colors (16 first used in escape sequence) */ static const char *colorname[] = { @@ -196,35 +141,12 @@ static const char *colorname[] = { * Default colors (colorname index) * foreground, background, cursor, reverse cursor */ -#if ALPHA_PATCH && ALPHA_FOCUS_HIGHLIGHT_PATCH -unsigned int defaultbg = 0; -unsigned int bg = 17, bgUnfocused = 16; -#else unsigned int defaultbg = 258; -#endif // ALPHA_FOCUS_HIGHLIGHT_PATCH unsigned int defaultfg = 259; unsigned int defaultcs = 256; unsigned int defaultrcs = 257; -#if VIM_BROWSE_PATCH -unsigned int const currentBg = 6, buffSize = 2048; -/// Enable double / triple click yanking / selection of word / line. -int const mouseYank = 1, mouseSelect = 0; -/// [Vim Browse] Colors for search results currently on screen. -unsigned int const highlightBg = 160, highlightFg = 15; -char const wDelS[] = "!\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~", wDelL[] = " \t"; -char *nmKeys [] = { ///< Shortcusts executed in normal mode - "R/Building\nN", "r/Building\n", "X/juli@machine\nN", "x/juli@machine\n", - "Q?[Leaving vim, starting execution]\n","F/: error:\nN", "f/: error:\n", "DQf" -}; -unsigned int const amountNmKeys = sizeof(nmKeys) / sizeof(*nmKeys); -/// Style of the {command, search} string shown in the right corner (y,v,V,/) -Glyph styleSearch = {' ', ATTR_ITALIC | ATTR_BOLD_FAINT, 7, 16}; -Glyph style[] = {{' ',ATTR_ITALIC|ATTR_FAINT,15,16}, {' ',ATTR_ITALIC,232,11}, - {' ', ATTR_ITALIC, 232, 4}, {' ', ATTR_ITALIC, 232, 12}}; -#endif // VIM_BROWSE_PATCH -#if BLINKING_CURSOR_PATCH /* * https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h4-Functions-using-CSI-_-ordered-by-the-final-character-lparen-s-rparen:CSI-Ps-SP-q.1D81 * Default style of cursor @@ -240,16 +162,6 @@ Glyph style[] = {{' ',ATTR_ITALIC|ATTR_FAINT,15,16}, {' ',ATTR_ITALIC,232,11}, */ static unsigned int cursorstyle = 1; static Rune stcursor = 0x2603; /* snowman (U+2603) */ -#else -/* - * Default shape of cursor - * 2: Block ("█") - * 4: Underline ("_") - * 6: Bar ("|") - * 7: Snowman ("☃") - */ -static unsigned int cursorshape = 2; -#endif // BLINKING_CURSOR_PATCH /* * Default columns and rows numbers @@ -258,19 +170,12 @@ static unsigned int cursorshape = 2; static unsigned int cols = 80; static unsigned int rows = 24; -#if THEMED_CURSOR_PATCH -/* - * Default shape of the mouse cursor - */ -static char* mouseshape = "xterm"; -#else /* * Default colour and shape of the mouse cursor */ static unsigned int mouseshape = XC_xterm; static unsigned int mousefg = 7; static unsigned int mousebg = 0; -#endif // THEMED_CURSOR_PATCH /* * Color used to display font attributes when fontconfig selected a font which @@ -278,53 +183,6 @@ static unsigned int mousebg = 0; */ static unsigned int defaultattr = 11; -#if XRESOURCES_PATCH -/* - * Xresources preferences to load at startup - */ -ResourcePref resources[] = { - { "font", STRING, &font }, - { "color0", STRING, &colorname[0] }, - { "color1", STRING, &colorname[1] }, - { "color2", STRING, &colorname[2] }, - { "color3", STRING, &colorname[3] }, - { "color4", STRING, &colorname[4] }, - { "color5", STRING, &colorname[5] }, - { "color6", STRING, &colorname[6] }, - { "color7", STRING, &colorname[7] }, - { "color8", STRING, &colorname[8] }, - { "color9", STRING, &colorname[9] }, - { "color10", STRING, &colorname[10] }, - { "color11", STRING, &colorname[11] }, - { "color12", STRING, &colorname[12] }, - { "color13", STRING, &colorname[13] }, - { "color14", STRING, &colorname[14] }, - { "color15", STRING, &colorname[15] }, - { "background", STRING, &colorname[258] }, - { "foreground", STRING, &colorname[259] }, - { "cursorColor", STRING, &colorname[256] }, - { "termname", STRING, &termname }, - { "shell", STRING, &shell }, - { "minlatency", INTEGER, &minlatency }, - { "maxlatency", INTEGER, &maxlatency }, - { "blinktimeout", INTEGER, &blinktimeout }, - { "bellvolume", INTEGER, &bellvolume }, - { "tabspaces", INTEGER, &tabspaces }, - #if RELATIVEBORDER_PATCH - { "borderperc", INTEGER, &borderperc }, - #else - { "borderpx", INTEGER, &borderpx }, - #endif // RELATIVEBORDER_PATCH - { "cwscale", FLOAT, &cwscale }, - { "chscale", FLOAT, &chscale }, - #if ALPHA_PATCH - { "alpha", FLOAT, &alpha }, - #endif // ALPHA_PATCH - #if ALPHA_FOCUS_HIGHLIGHT_PATCH - { "alphaUnfocused",FLOAT, &alphaUnfocused }, - #endif // ALPHA_FOCUS_HIGHLIGHT_PATCH -}; -#endif // XRESOURCES_PATCH /* * Force mouse select/shortcuts while mask is active (when MODE_MOUSE is set). @@ -339,47 +197,24 @@ static uint forcemousemod = ShiftMask; */ static MouseShortcut mshortcuts[] = { /* mask button function argument release screen */ - #if CLIPBOARD_PATCH - { XK_ANY_MOD, Button2, clippaste, {.i = 0}, 1 }, - #else { XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 }, - #endif // CLIPBOARD_PATCH - #if SCROLLBACK_MOUSE_PATCH { ShiftMask, Button4, kscrollup, {.i = 1}, 0, S_PRI}, { ShiftMask, Button5, kscrolldown, {.i = 1}, 0, S_PRI}, - #elif UNIVERSCROLL_PATCH - { XK_ANY_MOD, Button4, ttysend, {.s = "\033[5;2~"}, 0, S_PRI }, - { XK_ANY_MOD, Button5, ttysend, {.s = "\033[6;2~"}, 0, S_PRI }, - #else - { ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} }, - { ShiftMask, Button5, ttysend, {.s = "\033[6;2~"} }, - #endif // SCROLLBACK_MOUSE_PATCH - #if SCROLLBACK_MOUSE_ALTSCREEN_PATCH - { XK_NO_MOD, Button4, kscrollup, {.i = 1}, 0, S_PRI }, - { XK_NO_MOD, Button5, kscrolldown, {.i = 1}, 0, S_PRI }, - { XK_ANY_MOD, Button4, ttysend, {.s = "\031"}, 0, S_ALT }, - { XK_ANY_MOD, Button5, ttysend, {.s = "\005"}, 0, S_ALT }, - #else { XK_ANY_MOD, Button4, ttysend, {.s = "\031"} }, { XK_ANY_MOD, Button5, ttysend, {.s = "\005"} }, - #endif // SCROLLBACK_MOUSE_ALTSCREEN_PATCH }; /* Internal keyboard shortcuts. */ #define MODKEY Mod1Mask #define TERMMOD (ControlMask|ShiftMask) -#if EXTERNALPIPE_PATCH // example command static char *openurlcmd[] = { "/bin/sh", "-c", "xurls | dmenu -l 10 -w $WINDOWID | xargs -r open", "externalpipe", NULL }; -#if EXTERNALPIPEIN_PATCH // example command static char *setbgcolorcmd[] = { "/bin/sh", "-c", "printf '\033]11;#008000\007'", "externalpipein", NULL }; -#endif // EXTERNALPIPEIN_PATCH -#endif // EXTERNALPIPE_PATCH static Shortcut shortcuts[] = { /* mask keysym function argument screen */ @@ -392,57 +227,13 @@ static Shortcut shortcuts[] = { { TERMMOD, XK_Home, zoomreset, {.f = 0} }, { TERMMOD, XK_C, clipcopy, {.i = 0} }, { TERMMOD, XK_V, clippaste, {.i = 0} }, - #if ALPHA_PATCH { TERMMOD, XK_O, changealpha, {.f = +0.05} }, { TERMMOD, XK_P, changealpha, {.f = -0.05} }, - #if ALPHA_FOCUS_HIGHLIGHT_PATCH - //{ TERMMOD, XK_, changealphaunfocused, {.f = +0.05} }, - //{ TERMMOD, XK_, changealphaunfocused, {.f = -0.05} }, - #endif // ALPHA_FOCUS_HIGHLIGHT_PATCH - #endif // ALPHA_PATCH - #if FULLSCREEN_PATCH - { XK_NO_MOD, XK_F11, fullscreen, {.i = 0} }, - { MODKEY, XK_Return, fullscreen, {.i = 0} }, - #endif // FULLSCREEN_PATCH - #if SCROLLBACK_PATCH { ShiftMask, XK_Page_Up, kscrollup, {.i = -1}, S_PRI }, { ShiftMask, XK_Page_Down, kscrolldown, {.i = -1}, S_PRI }, - #endif // SCROLLBACK_PATCH - #if CLIPBOARD_PATCH - { TERMMOD, XK_Y, clippaste, {.i = 0} }, - { ShiftMask, XK_Insert, clippaste, {.i = 0} }, - #else { TERMMOD, XK_Y, selpaste, {.i = 0} }, { ShiftMask, XK_Insert, selpaste, {.i = 0} }, - #endif // CLIPBOARD_PATCH { TERMMOD, XK_Num_Lock, numlock, {.i = 0} }, - #if COPYURL_PATCH || COPYURL_HIGHLIGHT_SELECTED_URLS_PATCH - { MODKEY, XK_l, copyurl, {.i = 0} }, - #endif // COPYURL_PATCH - #if OPENCOPIED_PATCH - { MODKEY, XK_o, opencopied, {.v = "xdg-open"} }, - #endif // OPENCOPIED_PATCH - #if NEWTERM_PATCH - { TERMMOD, XK_Return, newterm, {.i = 0} }, - #endif // NEWTERM_PATCH - #if EXTERNALPIPE_PATCH - { TERMMOD, XK_U, externalpipe, { .v = openurlcmd } }, - #if EXTERNALPIPEIN_PATCH - { TERMMOD, XK_M, externalpipein, { .v = setbgcolorcmd } }, - #endif // EXTERNALPIPEIN_PATCH - #endif // EXTERNALPIPE_PATCH - #if KEYBOARDSELECT_PATCH - { TERMMOD, XK_Escape, keyboard_select, { 0 } }, - #endif // KEYBOARDSELECT_PATCH - #if ISO14755_PATCH - { TERMMOD, XK_I, iso14755, {.i = 0} }, - #endif // ISO14755_PATCH - #if INVERT_PATCH - { TERMMOD, XK_X, invert, { 0 } }, - #endif // INVERT_PATCH - #if VIM_BROWSE_PATCH - { MODKEY, XK_c, normalMode, {.i = 0} }, - #endif // VIM_BROWSE_PATCH }; /* @@ -466,13 +257,6 @@ static Shortcut shortcuts[] = { * position for a key. */ -#if !FIXKEYBOARDINPUT_PATCH -/* - * 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 }; -#endif // FIXKEYBOARDINPUT_PATCH /* * State bits to ignore when matching key or button events. By default, @@ -480,232 +264,6 @@ static KeySym mappedkeys[] = { -1 }; */ static uint ignoremod = Mod2Mask|XK_SWITCH_MOD; -#if !FIXKEYBOARDINPUT_PATCH -/* - * 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}, - #if DELKEY_PATCH - { XK_KP_Delete, XK_ANY_MOD, "\033[3~", -1, 0}, - #else - { XK_KP_Delete, XK_ANY_MOD, "\033[P", -1, 0}, - #endif // DELKEY_PATCH - { 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}, - #if DELKEY_PATCH - { XK_Delete, XK_ANY_MOD, "\033[3~", -1, 0}, - #else - { XK_Delete, XK_ANY_MOD, "\033[P", -1, 0}, - #endif // DELKEY_PATCH - { 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}, -}; -#endif // FIXKEYBOARDINPUT_PATCH /* * Selection types' masks. @@ -727,36 +285,4 @@ static char ascii_printable[] = "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_" "`abcdefghijklmnopqrstuvwxyz{|}~"; -#if RIGHTCLICKTOPLUMB_PATCH -/* - * plumb_cmd is run on mouse button 3 click, with argument set to - * current selection and with cwd set to the cwd of the active shell - */ -static char *plumb_cmd = "plumb"; -#endif // RIGHTCLICKTOPLUMB_PATCH -#if UNDERCURL_PATCH -/** - * Undercurl style. Set UNDERCURL_STYLE to one of the available styles. - * - * Curly: Dunno how to draw it *shrug* - * _ _ _ _ - * ( ) ( ) ( ) ( ) - * (_) (_) (_) (_) - * - * Spiky: - * /\ /\ /\ /\ - * \/ \/ \/ - * - * Capped: - * _ _ _ - * / \ / \ / \ - * \_/ \_/ - */ -// Available styles -#define UNDERCURL_CURLY 0 -#define UNDERCURL_SPIKY 1 -#define UNDERCURL_CAPPED 2 -// Active style -#define UNDERCURL_STYLE UNDERCURL_SPIKY -#endif // UNDERCURL_PATCH diff --git a/patch/alpha.c b/patch/alpha.c index 146bf4b..eb71702 100644 --- a/patch/alpha.c +++ b/patch/alpha.c @@ -17,14 +17,3 @@ changealpha(const Arg *arg) redraw(); } -#if ALPHA_FOCUS_HIGHLIGHT_PATCH -void -changealphaunfocused(const Arg *arg) -{ - if ((alphaUnfocused > 0 && arg->f < 0) || (alphaUnfocused < 1 && arg->f > 0)) - alphaUnfocused += arg->f; - alphaUnfocused = clamp(alphaUnfocused, 0.0, 1.0); - xloadcols(); - redraw(); -} -#endif // ALPHA_FOCUS_HIGHLIGHT_PATCH diff --git a/patch/alpha.h b/patch/alpha.h index 2d01830..8381349 100644 --- a/patch/alpha.h +++ b/patch/alpha.h @@ -1,5 +1,2 @@ static float clamp(float value, float lower, float upper); static void changealpha(const Arg *); -#if ALPHA_FOCUS_HIGHLIGHT_PATCH -static void changealphaunfocused(const Arg *arg); -#endif // ALPHA_FOCUS_HIGHLIGHT_PATCH diff --git a/patch/fixkeyboardinput.c b/patch/fixkeyboardinput.c index 75f8f40..073cddb 100644 --- a/patch/fixkeyboardinput.c +++ b/patch/fixkeyboardinput.c @@ -808,4 +808,4 @@ static Key key[] = { { XK_underscore, Mod1Mask|ControlMask, "\033[95;7u", 0, 0}, { XK_underscore, Mod1Mask|ControlMask|ShiftMask, "\033[95;8u", 0, 0}, { XK_underscore, Mod1Mask|ShiftMask, "\033[95;4u", 0, 0}, -}; \ No newline at end of file +}; diff --git a/patch/font2.c b/patch/font2.c index 9fc0e2d..ea4a26b 100644 --- a/patch/font2.c +++ b/patch/font2.c @@ -4,11 +4,7 @@ xloadsparefont(FcPattern *pattern, int flags) FcPattern *match; FcResult result; - #if USE_XFTFONTMATCH_PATCH - match = XftFontMatch(xw.dpy, xw.scr, pattern, &result); - #else match = FcFontMatch(NULL, pattern, &result); - #endif // USE_XFTFONTMATCH_PATCH if (!match) { return 1; } @@ -76,10 +72,8 @@ xloadsparefonts(void) FcPatternAddBool(pattern, FC_SCALABLE, 1); - #if !USE_XFTFONTMATCH_PATCH FcConfigSubstitute(NULL, pattern, FcMatchPattern); XftDefaultSubstitute(xw.dpy, xw.scr, pattern); - #endif // USE_XFTFONTMATCH_PATCH if (xloadsparefont(pattern, FRC_NORMAL)) die("can't open spare font %s\n", *fp); @@ -101,4 +95,4 @@ xloadsparefonts(void) FcPatternDestroy(pattern); } -} \ No newline at end of file +} diff --git a/patch/font2.h b/patch/font2.h index c0f9ff5..69df588 100644 --- a/patch/font2.h +++ b/patch/font2.h @@ -1,2 +1,2 @@ static int xloadsparefont(FcPattern *, int); -static void xloadsparefonts(void); \ No newline at end of file +static void xloadsparefonts(void); diff --git a/patch/scrollback.c b/patch/scrollback.c index 2644cfe..63333eb 100644 --- a/patch/scrollback.c +++ b/patch/scrollback.c @@ -15,14 +15,7 @@ kscrolldown(const Arg* a) tfulldirt(); } - #if SIXEL_PATCH - scroll_images(-1*n); - #endif // SIXEL_PATCH - #if OPENURLONCLICK_PATCH - if (n > 0) - restoremousecursor(); - #endif // OPENURLONCLICK_PATCH } void @@ -44,12 +37,5 @@ kscrollup(const Arg* a) tfulldirt(); } - #if SIXEL_PATCH - scroll_images(n); - #endif // SIXEL_PATCH - #if OPENURLONCLICK_PATCH - if (n > 0) - restoremousecursor(); - #endif // OPENURLONCLICK_PATCH } diff --git a/patch/scrollback.h b/patch/scrollback.h index 08940f0..a602db2 100644 --- a/patch/scrollback.h +++ b/patch/scrollback.h @@ -5,7 +5,6 @@ void kscrolldown(const Arg *); void kscrollup(const Arg *); -#if SCROLLBACK_MOUSE_PATCH || SCROLLBACK_MOUSE_ALTSCREEN_PATCH typedef struct { uint b; uint mask; @@ -14,4 +13,3 @@ typedef struct { } MouseKey; extern MouseKey mkeys[]; -#endif // SCROLLBACK_MOUSE_PATCH / SCROLLBACK_MOUSE_ALTSCREEN_PATCH diff --git a/patch/st_embedder_x.h b/patch/st_embedder_x.h index 6910fb9..f7ec67f 100644 --- a/patch/st_embedder_x.h +++ b/patch/st_embedder_x.h @@ -4,4 +4,4 @@ static void createnotify(XEvent *e); static void destroynotify(XEvent *e); -static void sendxembed(long msg, long detail, long d1, long d2); \ No newline at end of file +static void sendxembed(long msg, long detail, long d1, long d2); diff --git a/patch/st_include.c b/patch/st_include.c index 6772a6e..2b3960f 100644 --- a/patch/st_include.c +++ b/patch/st_include.c @@ -1,31 +1,2 @@ /* Patches */ -#if COPYURL_PATCH || COPYURL_HIGHLIGHT_SELECTED_URLS_PATCH -#include "copyurl.c" -#endif -#if EXTERNALPIPE_PATCH -#include "externalpipe.c" -#endif -#if ISO14755_PATCH -#include "iso14755.c" -#endif -#if KEYBOARDSELECT_PATCH -#include "keyboardselect_st.c" -#endif -#if RIGHTCLICKTOPLUMB_PATCH -#include "rightclicktoplumb_st.c" -#endif -#if NEWTERM_PATCH -#include "newterm.c" -#endif -#if SCROLLBACK_PATCH || SCROLLBACK_MOUSE_PATCH || SCROLLBACK_MOUSE_ALTSCREEN_PATCH #include "scrollback.c" -#endif -#if SIXEL_PATCH -#include "sixel_st.c" -#endif -#if SYNC_PATCH -#include "sync.c" -#endif -#if VIM_BROWSE_PATCH -#include "normalMode.c" -#endif \ No newline at end of file diff --git a/patch/st_include.h b/patch/st_include.h index c30a752..866ecc5 100644 --- a/patch/st_include.h +++ b/patch/st_include.h @@ -1,34 +1,5 @@ /* Patches */ -#if COPYURL_PATCH || COPYURL_HIGHLIGHT_SELECTED_URLS_PATCH -#include "copyurl.h" -#endif -#if EXTERNALPIPE_PATCH -#include "externalpipe.h" -#endif -#if ISO14755_PATCH -#include "iso14755.h" -#endif -#if KEYBOARDSELECT_PATCH -#include "keyboardselect_st.h" -#endif -#if OPENURLONCLICK_PATCH -#include "openurlonclick.h" -#endif -#if RIGHTCLICKTOPLUMB_PATCH -#include "rightclicktoplumb_st.h" -#endif -#if NEWTERM_PATCH -#include "newterm.h" -#endif -#if SCROLLBACK_PATCH || SCROLLBACK_MOUSE_PATCH || SCROLLBACK_MOUSE_ALTSCREEN_PATCH #include "scrollback.h" -#endif -#if SIXEL_PATCH -#include "sixel_st.h" -#endif -#if SYNC_PATCH -#include "sync.h" -#endif // #if VIM_BROWSE_PATCH // #include "normalMode.h" // #endif diff --git a/patch/utils.h b/patch/utils.h index 5ecea0d..6cfca3e 100644 --- a/patch/utils.h +++ b/patch/utils.h @@ -20,4 +20,4 @@ static inline void empty(DynamicArray* s) { s->init = 0; } static inline int size(DynamicArray const * s) { return s->init / s->elSize; } static inline void assign(DynamicArray* s, DynamicArray const *o) { if (p_alloc(s, size(o))) memcpy(s->content, o->content, (s->init=o->init)); -} \ No newline at end of file +} diff --git a/patch/x_include.c b/patch/x_include.c index cbea418..5b08893 100644 --- a/patch/x_include.c +++ b/patch/x_include.c @@ -1,43 +1,5 @@ /* Patches */ -#if ALPHA_PATCH #include "alpha.c" -#endif -#if BACKGROUND_IMAGE_PATCH -#include "background_image_x.c" -#endif -#if BOXDRAW_PATCH -#include "boxdraw.c" -#endif -#if OPENCOPIED_PATCH -#include "opencopied.c" -#endif -#if FIXKEYBOARDINPUT_PATCH #include "fixkeyboardinput.c" -#endif -#if FONT2_PATCH #include "font2.c" -#endif -#if FULLSCREEN_PATCH -#include "fullscreen_x.c" -#endif -#if INVERT_PATCH -#include "invert.c" -#endif -#if KEYBOARDSELECT_PATCH -#include "keyboardselect_x.c" -#endif -#if OPENURLONCLICK_PATCH -#include "openurlonclick.c" -#endif -#if RIGHTCLICKTOPLUMB_PATCH -#include "rightclicktoplumb_x.c" -#endif -#if SIXEL_PATCH -#include "sixel_x.c" -#endif -#if ST_EMBEDDER_PATCH #include "st_embedder_x.c" -#endif -#if XRESOURCES_PATCH -#include "xresources.c" -#endif \ No newline at end of file diff --git a/patch/x_include.h b/patch/x_include.h index 6505909..6d64ce7 100644 --- a/patch/x_include.h +++ b/patch/x_include.h @@ -1,40 +1,4 @@ /* Patches */ -#if ALPHA_PATCH #include "alpha.h" -#endif -#if BACKGROUND_IMAGE_PATCH -#include "background_image_x.h" -#endif -#if BOXDRAW_PATCH -#include "boxdraw.h" -#endif -#if OPENCOPIED_PATCH -#include "opencopied.h" -#endif -#if FONT2_PATCH #include "font2.h" -#endif -#if FULLSCREEN_PATCH -#include "fullscreen_x.h" -#endif -#if INVERT_PATCH -#include "invert.h" -#endif -#if KEYBOARDSELECT_PATCH -#include "keyboardselect_x.h" -#endif -#if NETWMICON_PATCH -#include "netwmicon.h" -#endif -#if RIGHTCLICKTOPLUMB_PATCH -#include "rightclicktoplumb_x.h" -#endif -#if ST_EMBEDDER_PATCH #include "st_embedder_x.h" -#endif -#if XRESOURCES_PATCH -#include "xresources.h" -#endif -#if VIM_BROWSE_PATCH -#include "normalMode.h" -#endif diff --git a/st b/st index 120a28475cf27c7f94401309ce9d8901c7fb45d3..b45c15f698ef535b3ef51257fc7689656ad4cf1b 100755 GIT binary patch delta 111 zcmdn-m}AFdjt!;X6*L$a7>+wTfT(WPP4bKk%?C6(on^XNS3%gDr+%L-Bypqj#!ScW zKRXY1^M2)FWazg24J3OVZ)|tqVl+wTfT(WPP4bKk%?DUIon^XNS3%gDr+%L-B=M*7#!ScW zKRXY1^M2)FWazg24J3OV|7>^QVl%}M@ diff --git a/st.c b/st.c index 7e9ea5a..fca5846 100644 --- a/st.c +++ b/st.c @@ -20,18 +20,8 @@ #include "st.h" #include "win.h" -#if VIM_BROWSE_PATCH -#include -#endif // VIM_BROWSE_PATCH -#if KEYBOARDSELECT_PATCH -#include -#include -#endif // KEYBOARDSELECT_PATCH -#if SIXEL_PATCH -#include "sixel.h" -#endif // SIXEL_PATCH #if defined(__linux) #include @@ -46,9 +36,6 @@ #define UTF_SIZ 4 #define ESC_BUF_SIZ (128*UTF_SIZ) #define ESC_ARG_SIZ 16 -#if UNDERCURL_PATCH -#define CAR_PER_ARG 4 -#endif // UNDERCURL_PATCH #define STR_BUF_SIZ ESC_BUF_SIZ #define STR_ARG_SIZ ESC_ARG_SIZ @@ -58,10 +45,6 @@ #define ISCONTROLC1(c) (BETWEEN(c, 0x80, 0x9f)) #define ISCONTROL(c) (ISCONTROLC0(c) || ISCONTROLC1(c)) #define ISDELIM(u) (u && wcschr(worddelimiters, u)) -#if VIM_BROWSE_PATCH -static inline int max(int a, int b) { return a > b ? a : b; } -static inline int min(int a, int b) { return a < b ? a : b; } -#endif // VIM_BROWSE_PATCH enum term_mode { MODE_WRAP = 1 << 0, @@ -71,9 +54,6 @@ enum term_mode { MODE_ECHO = 1 << 4, MODE_PRINT = 1 << 5, MODE_UTF8 = 1 << 6, - #if SIXEL_PATCH - MODE_SIXEL = 1 << 7, - #endif // SIXEL_PATCH }; enum cursor_movement { @@ -105,18 +85,12 @@ enum escape_state { ESC_STR_END = 16, /* a final string was encountered */ ESC_TEST = 32, /* Enter in test mode */ ESC_UTF8 = 64, - #if SIXEL_PATCH - ESC_DCS =128, - #endif // SIXEL_PATCH }; typedef struct { int mode; int type; int snap; - #if VIM_BROWSE_PATCH - int swap; - #endif // VIM_BROWSE_PATCH /* * Selection variables: * nb – normalized coordinates of the beginning of the selection @@ -140,9 +114,6 @@ typedef struct { int arg[ESC_ARG_SIZ]; int narg; /* nb of args */ char mode[2]; - #if UNDERCURL_PATCH - int carg[ESC_ARG_SIZ][CAR_PER_ARG]; /* colon args */ - #endif // UNDERCURL_PATCH } CSIEscape; /* STR Escape sequence structs */ @@ -163,9 +134,6 @@ static void ttywriteraw(const char *, size_t); static void csidump(void); static void csihandle(void); -#if UNDERCURL_PATCH -static void readcolonargs(char **, int, int[][CAR_PER_ARG]); -#endif // UNDERCURL_PATCH static void csiparse(void); static void csireset(void); static void osc4_color_response(int num); @@ -187,19 +155,13 @@ static void tdeleteline(int); static void tinsertblank(int); static void tinsertblankline(int); static int tlinelen(int); -#if !VIM_BROWSE_PATCH static void tmoveto(int, int); -#endif // VIM_BROWSE_PATCH static void tmoveato(int, int); static void tnewline(int); static void tputtab(int); static void tputc(Rune); static void treset(void); -#if SCROLLBACK_PATCH static void tscrollup(int, int, int); -#else -static void tscrollup(int, int); -#endif // SCROLLBACK_PATCH static void tscrolldown(int, int); static void tsetattr(const int *, int); static void tsetchar(Rune, const Glyph *, int, int); @@ -216,9 +178,7 @@ static void tdeftran(char); static void tstrsequence(uchar); static void selnormalize(void); static void selscroll(int, int); -#if !VIM_BROWSE_PATCH static void selsnap(int *, int *, int); -#endif // VIM_BROWSE_PATCH static size_t utf8decode(const char *, Rune *, size_t); static Rune utf8decodebyte(char, size_t *); @@ -236,28 +196,13 @@ static CSIEscape csiescseq; static STREscape strescseq; static int iofd = 1; static int cmdfd; -#if EXTERNALPIPEIN_PATCH && EXTERNALPIPE_PATCH -static int csdfd; -#endif // EXTERNALPIPEIN_PATCH static pid_t pid; -#if SIXEL_PATCH -sixel_state_t sixel_st; -#endif // SIXEL_PATCH static const uchar utfbyte[UTF_SIZ + 1] = {0x80, 0, 0xC0, 0xE0, 0xF0}; static const uchar utfmask[UTF_SIZ + 1] = {0xC0, 0x80, 0xE0, 0xF0, 0xF8}; static const Rune utfmin[UTF_SIZ + 1] = { 0, 0, 0x80, 0x800, 0x10000}; static const Rune utfmax[UTF_SIZ + 1] = {0x10FFFF, 0x7F, 0x7FF, 0xFFFF, 0x10FFFF}; -#if VIM_BROWSE_PATCH -int buffCols; -extern int const buffSize; -int histOp, histMode, histOff, insertOff, altToggle, *mark; -Line *buf = NULL; -static TCursor c[3]; -static inline int rows() { return IS_SET(MODE_ALTSCREEN) ? term.row : buffSize;} -static inline int rangeY(int i) { while (i < 0) i += rows(); return i % rows();} -#endif // VIM_BROWSE_PATCH #include "patch/st_include.h" @@ -437,134 +382,15 @@ tlinelen(int y) { int i = term.col; - #if SCROLLBACK_PATCH if (TLINE(y)[i - 1].mode & ATTR_WRAP) return i; while (i > 0 && TLINE(y)[i - 1].u == ' ') --i; - #else - if (term.line[y][i - 1].mode & ATTR_WRAP) - return i; - - while (i > 0 && term.line[y][i - 1].u == ' ') - --i; - #endif // SCROLLBACK_PATCH return i; } -#if VIM_BROWSE_PATCH -void historyOpToggle(int start, int paint) { - if ((!histOp == !(histOp + start)) && ((histOp += start) || 1)) return; - if (histMode && paint && (!IS_SET(MODE_ALTSCREEN) || altToggle)) draw(); - tcursor(CURSOR_SAVE); - histOp += start; - if (histMode && altToggle) { - tswapscreen(); - memset(term.dirty,0,sizeof(*term.dirty)*term.row); - } - tcursor(CURSOR_LOAD); - *(!IS_SET(MODE_ALTSCREEN)?&term.line:&term.alt)=&buf[histOp?histOff:insertOff]; -} - -void historyModeToggle(int start) { - if (!(histMode = (histOp = !!start))) { - selnormalize(); - tfulldirt(); - } else { - tcursor(CURSOR_SAVE); - histOp = 0; - histOff = insertOff; - } -} - -int historyBufferScroll(int n) { - if (IS_SET(MODE_ALTSCREEN) || !n) return histOp; - int p=abs(n=(n<0) ? max(n,-term.row) : min(n,term.row)), r=term.row-p, - s=sizeof(*term.dirty), *ptr=histOp?&histOff:&insertOff; - if (!histMode || histOp) tfulldirt(); else { - memmove(&term.dirty[-min(n,0)], &term.dirty[max(n,0)], s*r); - memset(&term.dirty[n>0 ? r : 0], 0, s * p); - } - term.line = &buf[*ptr = (buffSize+*ptr+n) % buffSize]; - // Cut part of selection removed from buffer, and update sel.ne/b. - int const prevOffBuf = sel.alt ? 0 : insertOff + term.row; - if (sel.ob.x != -1 && !histOp && n) { - int const offBuf = sel.alt ? 0 : insertOff + term.row, - pb = rangeY(sel.ob.y - prevOffBuf), - pe = rangeY(sel.oe.y - prevOffBuf); - int const b = rangeY(sel.ob.y - offBuf), nln = n < 0, - e = rangeY(sel.oe.y - offBuf), last = offBuf - nln; - if (pb != b && ((pb < b) != nln)) sel.ob.y = last; - if (pe != e && ((pe < e) != nln)) sel.oe.y = last; - if (sel.oe.y == last && sel.ob.y == last) selclear(); - } - selnormalize(); - // Clear the new region exposed by the shift. - if (!histOp) tclearregion(0, n>0?r+1:0, buffCols-1, n>0?term.row:p-1); - return 1; -} - -int historyMove(int x, int y, int ly) { - historyOpToggle(1, 1); - y += ((term.c.x += x) < 0 ?term.c.x-term.col :term.c.x) / term.col;//< x - if ((term.c.x %= term.col) < 0) term.c.x += term.col; - if ((term.c.y += y) >= term.row) ly += term.c.y - term.row + 1; //< y - else if (term.c.y < 0) ly += term.c.y; - term.c.y = MIN(MAX(term.c.y, 0), term.row - 1); - // Check if scroll is necessary / arrived at top / bottom of terminal history - int t = 0, b = 0, finTop = ly < 0, finBot = ly > 0; - if (!IS_SET(MODE_ALTSCREEN)) { - b=rangeY(insertOff-histOff), t=-rangeY(-term.row-(insertOff-histOff)); - finBot = ly > b, finTop=histMode&&((-ly>-t)); - } - if ((finTop || finBot) && (x||y)) term.c.x = finBot ? term.col-1 : 0; - historyBufferScroll(finBot ? b : (finTop ? t : ly)); - historyOpToggle(-1, 1); - return finTop || finBot; -} - -void selnormalize(void) { - historyOpToggle(1, 1); - - int const oldb = sel.nb.y, olde = sel.ne.y; - if (sel.ob.x == -1) { - sel.ne.y = sel.nb.y = -1; - } else { - int const offsetBuffer = sel.alt ? 0 : insertOff + term.row; - int const off = sel.alt ? 0 : (histMode ? histOff : insertOff); - int const nby = rangeY(sel.ob.y - off), - ney = rangeY(sel.oe.y - off); - sel.swap = rangeY(sel.ob.y - offsetBuffer) - > rangeY(sel.oe.y - offsetBuffer); - sel.nb.y = sel.swap ? ney : nby; - sel.ne.y = !sel.swap ? ney : nby; - int const cnb = sel.nb.y < term.row, cne = sel.ne.y < term.row; - if (sel.type == SEL_REGULAR && sel.ob.y != sel.oe.y) { - if (cnb) sel.nb.x = (!sel.swap) ? sel.ob.x : sel.oe.x; - if (cne) sel.ne.x = (!sel.swap) ? sel.oe.x : sel.ob.x; - } else { - if (cnb) sel.nb.x = MIN(sel.ob.x, sel.oe.x); - if (cne) sel.ne.x = MAX(sel.ob.x, sel.oe.x); - } - } - int const nBet=sel.nb.y<=sel.ne.y, oBet=oldb<=olde; - for (int i = 0; i < term.row; ++i) { - int const n = nBet ? BETWEEN(i, sel.nb.y, sel.ne.y) - : OUT(i, sel.nb.y, sel.ne.y); - term.dirty[i] |= (sel.type == SEL_RECTANGULAR && n) || - (n != (oBet ? BETWEEN(i,oldb,olde) : OUT(i,oldb,olde))); - - } - if (BETWEEN(oldb, 0, term.row - 1)) term.dirty[oldb] = 1; - if (BETWEEN(olde, 0, term.row - 1)) term.dirty[olde] = 1; - if (BETWEEN(sel.nb.y, 0, term.row - 1)) term.dirty[sel.nb.y] = 1; - if (BETWEEN(sel.ne.y, 0, term.row - 1)) term.dirty[sel.ne.y] = 1; - - historyOpToggle(-1, 1); -} -#endif // VIM_BROWSE_PATCH void selstart(int col, int row, int snap) @@ -575,27 +401,18 @@ selstart(int col, int row, int snap) sel.alt = IS_SET(MODE_ALTSCREEN); sel.snap = snap; sel.oe.x = sel.ob.x = col; - #if VIM_BROWSE_PATCH - sel.oe.y = sel.ob.y = row + !sel.alt * (histMode ? histOff : insertOff); - if (sel.snap != 0) sel.mode = SEL_READY; - #else sel.oe.y = sel.ob.y = row; - #endif // VIM_BROWSE_PATCH selnormalize(); - #if !VIM_BROWSE_PATCH if (sel.snap != 0) sel.mode = SEL_READY; tsetdirt(sel.nb.y, sel.ne.y); - #endif // VIM_BROWSE_PATCH } void selextend(int col, int row, int type, int done) { - #if !VIM_BROWSE_PATCH int oldey, oldex, oldsby, oldsey, oldtype; - #endif // VIM_BROWSE_PATCH if (sel.mode == SEL_IDLE) return; @@ -604,32 +421,23 @@ selextend(int col, int row, int type, int done) return; } - #if !VIM_BROWSE_PATCH oldey = sel.oe.y; oldex = sel.oe.x; oldsby = sel.nb.y; oldsey = sel.ne.y; oldtype = sel.type; - #endif // VIM_BROWSE_PATCH sel.oe.x = col; - #if VIM_BROWSE_PATCH - sel.oe.y = row + (sel.alt ? 0 : (histMode ? histOff : insertOff)); - #else sel.oe.y = row; - #endif // VIM_BROWSE_PATCH selnormalize(); sel.type = type; - #if !VIM_BROWSE_PATCH if (oldey != sel.oe.y || oldex != sel.oe.x || oldtype != sel.type || sel.mode == SEL_EMPTY) tsetdirt(MIN(sel.nb.y, oldsby), MAX(sel.ne.y, oldsey)); - #endif // VIM_BROWSE_PATCH sel.mode = done ? SEL_IDLE : SEL_READY; } -#if !VIM_BROWSE_PATCH void selnormalize(void) { @@ -657,7 +465,6 @@ selnormalize(void) if (tlinelen(sel.ne.y) <= sel.ne.x) sel.ne.x = term.col - 1; } -#endif // VIM_BROWSE_PATCH int selected(int x, int y) @@ -670,19 +477,11 @@ selected(int x, int y) return BETWEEN(y, sel.nb.y, sel.ne.y) && BETWEEN(x, sel.nb.x, sel.ne.x); - #if VIM_BROWSE_PATCH - return ((sel.nb.y > sel.ne.y) ? OUT(y, sel.nb.y, sel.ne.y) - : BETWEEN(y, sel.nb.y, sel.ne.y)) && - (y != sel.nb.y || x >= sel.nb.x) && - (y != sel.ne.y || x <= sel.ne.x); - #else return BETWEEN(y, sel.nb.y, sel.ne.y) && (y != sel.nb.y || x >= sel.nb.x) && (y != sel.ne.y || x <= sel.ne.x); - #endif // VIM_BROWSE_PATCH } -#if !VIM_BROWSE_PATCH void selsnap(int *x, int *y, int direction) { @@ -696,11 +495,7 @@ selsnap(int *x, int *y, int direction) * Snap around if the word wraps around at the end or * beginning of a line. */ - #if SCROLLBACK_PATCH prevgp = &TLINE(*y)[*x]; - #else - prevgp = &term.line[*y][*x]; - #endif // SCROLLBACK_PATCH prevdelim = ISDELIM(prevgp->u); for (;;) { newx = *x + direction; @@ -715,22 +510,14 @@ selsnap(int *x, int *y, int direction) yt = *y, xt = *x; else yt = newy, xt = newx; - #if SCROLLBACK_PATCH if (!(TLINE(yt)[xt].mode & ATTR_WRAP)) - #else - if (!(term.line[yt][xt].mode & ATTR_WRAP)) - #endif // SCROLLBACK_PATCH break; } if (newx >= tlinelen(newy)) break; - #if SCROLLBACK_PATCH gp = &TLINE(newy)[newx]; - #else - gp = &term.line[newy][newx]; - #endif // SCROLLBACK_PATCH delim = ISDELIM(gp->u); if (!(gp->mode & ATTR_WDUMMY) && (delim != prevdelim || (delim && gp->u != prevgp->u))) @@ -751,22 +538,14 @@ selsnap(int *x, int *y, int direction) *x = (direction < 0) ? 0 : term.col - 1; if (direction < 0) { for (; *y > 0; *y += direction) { - #if SCROLLBACK_PATCH if (!(TLINE(*y-1)[term.col-1].mode & ATTR_WRAP)) - #else - if (!(term.line[*y-1][term.col-1].mode & ATTR_WRAP)) - #endif // SCROLLBACK_PATCH { break; } } } else if (direction > 0) { for (; *y < term.row-1; *y += direction) { - #if SCROLLBACK_PATCH if (!(TLINE(*y)[term.col-1].mode & ATTR_WRAP)) - #else - if (!(term.line[*y][term.col-1].mode & ATTR_WRAP)) - #endif // SCROLLBACK_PATCH { break; } @@ -775,87 +554,38 @@ selsnap(int *x, int *y, int direction) break; } } -#endif // VIM_BROWSE_PATCH char * getsel(void) { char *str, *ptr; - #if VIM_BROWSE_PATCH - int y, yy, bufsize, lastx; - #else int y, bufsize, lastx, linelen; - #endif // VIM_BROWSE_PATCH const Glyph *gp, *last; if (sel.ob.x == -1) return NULL; - #if VIM_BROWSE_PATCH - int const start = sel.swap ? sel.oe.y : sel.ob.y, h = rows(); - int endy = (sel.swap ? sel.ob.y : sel.oe.y); - for (; endy < start; endy += h); - Line * const cbuf = IS_SET(MODE_ALTSCREEN) ? term.line : buf; - bufsize = (term.col+1) * (endy-start+1 ) * UTF_SIZ; - assert(bufsize > 0); - #else bufsize = (term.col+1) * (sel.ne.y-sel.nb.y+1) * UTF_SIZ; - #endif // VIM_BROWSE_PATCH ptr = str = xmalloc(bufsize); /* append every set & selected glyph to the selection */ - #if VIM_BROWSE_PATCH - for (y = start; y <= endy; y++) - #else for (y = sel.nb.y; y <= sel.ne.y; y++) - #endif // VIM_BROWSE_PATCH { - #if VIM_BROWSE_PATCH - yy = y % h; - #else if ((linelen = tlinelen(y)) == 0) { *ptr++ = '\n'; continue; } - #endif // VIM_BROWSE_PATCH if (sel.type == SEL_RECTANGULAR) { - #if VIM_BROWSE_PATCH - gp = &cbuf[yy][sel.nb.x]; - #elif SCROLLBACK_PATCH gp = &TLINE(y)[sel.nb.x]; - #else - gp = &term.line[y][sel.nb.x]; - #endif // SCROLLBACK_PATCH lastx = sel.ne.x; } else { - #if VIM_BROWSE_PATCH - gp = &cbuf[yy][start == y ? sel.nb.x : 0]; - #elif SCROLLBACK_PATCH gp = &TLINE(y)[sel.nb.y == y ? sel.nb.x : 0]; - #else - gp = &term.line[y][sel.nb.y == y ? sel.nb.x : 0]; - #endif // SCROLLBACK_PATCH - #if VIM_BROWSE_PATCH - lastx = (endy == y) ? sel.ne.x : term.col-1; - #else lastx = (sel.ne.y == y) ? sel.ne.x : term.col-1; - #endif // VIM_BROWSE_PATCH } - #if VIM_BROWSE_PATCH - last = &cbuf[yy][lastx]; - #elif SCROLLBACK_PATCH last = &TLINE(y)[MIN(lastx, linelen-1)]; - #else - last = &term.line[y][MIN(lastx, linelen-1)]; - #endif // SCROLLBACK_PATCH - #if VIM_BROWSE_PATCH - if (!(cbuf[yy][term.col - 1].mode & ATTR_WRAP)) - while (last > gp && last->u == ' ') --last; - #else while (last >= gp && last->u == ' ') --last; - #endif // VIM_BROWSE_PATCH for ( ; gp <= last; ++gp) { if (gp->mode & ATTR_WDUMMY) @@ -874,11 +604,7 @@ getsel(void) * FIXME: Fix the computer world. */ if ( - #if VIM_BROWSE_PATCH - (y < endy || lastx == term.col - 1) - #else (y < sel.ne.y || lastx >= linelen) - #endif // && (!(last->mode & ATTR_WRAP) || sel.type == SEL_RECTANGULAR)) *ptr++ = '\n'; } @@ -893,11 +619,7 @@ selclear(void) return; sel.mode = SEL_IDLE; sel.ob.x = -1; - #if VIM_BROWSE_PATCH - selnormalize(); - #else tsetdirt(sel.nb.y, sel.ne.y); - #endif // VIM_BROWSE_PATCH } void @@ -970,34 +692,12 @@ sigchld(int a) int stat; pid_t p; - #if EXTERNALPIPEIN_PATCH && EXTERNALPIPE_PATCH - if ((p = waitpid((extpipeactive ? -1 : pid), &stat, WNOHANG)) < 0) - #else if ((p = waitpid(pid, &stat, WNOHANG)) < 0) - #endif // EXTERNALPIPEIN_PATCH die("waiting for pid %hd failed: %s\n", pid, strerror(errno)); - #if EXTERNALPIPE_PATCH - if (pid != p) { - if (!extpipeactive) - return; - - if (p == 0 && wait(&stat) < 0) - die("wait: %s\n", strerror(errno)); - - /* reinstall sigchld handler */ - signal(SIGCHLD, sigchld); - extpipeactive = 0; - return; - } - #else if (pid != p) return; - #endif // EXTERNALPIPE_PATCH - #if EXTERNALPIPEIN_PATCH && EXTERNALPIPE_PATCH - close(csdfd); - #endif // EXTERNALPIPEIN_PATCH if (WIFEXITED(stat) && WEXITSTATUS(stat)) die("child exited with status %d\n", WEXITSTATUS(stat)); @@ -1034,9 +734,6 @@ int ttynew(const char *line, char *cmd, const char *out, char **args) { int m, s; - #if EXTERNALPIPEIN_PATCH && EXTERNALPIPE_PATCH - struct sigaction sa; - #endif // EXTERNALPIPEIN_PATCH if (out) { term.mode |= MODE_PRINT; @@ -1084,25 +781,12 @@ ttynew(const char *line, char *cmd, const char *out, char **args) break; default: #ifdef __OpenBSD__ - #if RIGHTCLICKTOPLUMB_PATCH || OPENCOPIED_PATCH - if (pledge("stdio rpath tty proc ps exec", NULL) == -1) - #else if (pledge("stdio rpath tty proc", NULL) == -1) - #endif // RIGHTCLICKTOPLUMB_PATCH die("pledge\n"); #endif - #if EXTERNALPIPEIN_PATCH && EXTERNALPIPE_PATCH - csdfd = s; - cmdfd = m; - memset(&sa, 0, sizeof(sa)); - sigemptyset(&sa.sa_mask); - sa.sa_handler = sigchld; - sigaction(SIGCHLD, &sa, NULL); - #else close(s); cmdfd = m; signal(SIGCHLD, sigchld); - #endif // EXTERNALPIPEIN_PATCH break; } return cmdfd; @@ -1116,11 +800,7 @@ ttyread(void) int ret, written; /* append read bytes to unprocessed bytes */ - #if SYNC_PATCH - ret = twrite_aborted ? 1 : read(cmdfd, buf+buflen, LEN(buf)-buflen); - #else ret = read(cmdfd, buf+buflen, LEN(buf)-buflen); - #endif // SYNC_PATCH switch (ret) { case 0: @@ -1128,11 +808,7 @@ ttyread(void) case -1: die("couldn't read from shell: %s\n", strerror(errno)); default: - #if SYNC_PATCH - buflen += twrite_aborted ? 0 : ret; - #else buflen += ret; - #endif // SYNC_PATCH written = twrite(buf, buflen, 0); buflen -= written; /* keep any incomplete UTF-8 byte sequence for the next call */ @@ -1146,11 +822,9 @@ void ttywrite(const char *s, size_t n, int may_echo) { const char *next; - #if SCROLLBACK_PATCH Arg arg = (Arg) { .i = term.scr }; kscrolldown(&arg); - #endif // SCROLLBACK_PATCH if (may_echo && IS_SET(MODE_ECHO)) twrite(s, n, 1); @@ -1303,21 +977,14 @@ tsetdirtattr(int attr) void tfulldirt(void) { - #if SYNC_PATCH - tsync_end(); - #endif // SYNC_PATCH tsetdirt(0, term.row-1); } void tcursor(int mode) { - #if VIM_BROWSE_PATCH - int alt = (histOp) ? 0 : (IS_SET(MODE_ALTSCREEN) + 1); - #else static TCursor c[2]; int alt = IS_SET(MODE_ALTSCREEN); - #endif // VIM_BROWSE_PATCH if (mode == CURSOR_SAVE) { c[alt] = term.c; @@ -1331,9 +998,6 @@ void treset(void) { uint i; - #if SIXEL_PATCH - ImageList *im; - #endif // SIXEL_PATCH term.c = (TCursor){{ .mode = ATTR_NULL, @@ -1353,17 +1017,9 @@ treset(void) for (i = 0; i < 2; i++) { tmoveto(0, 0); tcursor(CURSOR_SAVE); - #if COLUMNS_PATCH && !VIM_BROWSE_PATCH tclearregion(0, 0, term.maxcol-1, term.row-1); - #else - tclearregion(0, 0, term.col-1, term.row-1); - #endif // COLUMNS_PATCH tswapscreen(); } - #if SIXEL_PATCH - for (im = term.images; im; im = im->next) - im->should_delete = 1; - #endif // SIXEL_PATCH } void @@ -1378,16 +1034,9 @@ void tswapscreen(void) { Line *tmp = term.line; - #if SIXEL_PATCH - ImageList *im = term.images; - #endif // SIXEL_PATCH term.line = term.alt; term.alt = tmp; - #if SIXEL_PATCH - term.images = term.images_alt; - term.images_alt = im; - #endif // SIXEL_PATCH term.mode ^= MODE_ALTSCREEN; tfulldirt(); } @@ -1395,25 +1044,14 @@ tswapscreen(void) void tscrolldown(int orig, int n) { - #if OPENURLONCLICK_PATCH - restoremousecursor(); - #endif //OPENURLONCLICK_PATCH - #if VIM_BROWSE_PATCH - if (!orig && historyBufferScroll(-n)) - return; - #endif // VIM_BROWSE_PATCH int i; Line temp; LIMIT(n, 0, term.bot-orig+1); tsetdirt(orig, term.bot-n); - #if COLUMNS_PATCH && !VIM_BROWSE_PATCH tclearregion(0, term.bot-n+1, term.maxcol-1, term.bot); - #else - tclearregion(0, term.bot-n+1, term.col-1, term.bot); - #endif // COLUMNS_PATCH for (i = term.bot; i >= orig+n; i--) { temp = term.line[i]; @@ -1421,46 +1059,20 @@ tscrolldown(int orig, int n) term.line[i-n] = temp; } - #if SIXEL_PATCH - /* move images, if they are inside the scrolling region */ - ImageList *im; - for (im = term.images; im; im = im->next) { - if (im->y * win.ch + im->height > orig * win.ch && im->y <= term.bot) { - im->y += n; - im->should_delete |= (im->y >= term.row); - } - } - #endif // SIXEL_PATCH - #if SCROLLBACK_PATCH if (term.scr == 0) selscroll(orig, n); - #else - selscroll(orig, n); - #endif // SCROLLBACK_PATCH } void -#if SCROLLBACK_PATCH tscrollup(int orig, int n, int copyhist) -#else -tscrollup(int orig, int n) -#endif // SCROLLBACK_PATCH { - #if OPENURLONCLICK_PATCH - restoremousecursor(); - #endif //OPENURLONCLICK_PATCH - #if VIM_BROWSE_PATCH - if (!orig && historyBufferScroll(n)) - return; - #endif // VIM_BROWSE_PATCH int i; Line temp; LIMIT(n, 0, term.bot-orig+1); - #if SCROLLBACK_PATCH if (copyhist && !IS_SET(MODE_ALTSCREEN)) { for (i = 0; i < n; i++) { term.histi = (term.histi + 1) % HISTSIZE; @@ -1473,13 +1085,8 @@ tscrollup(int orig, int n) if (term.scr > 0 && term.scr < HISTSIZE) term.scr = MIN(term.scr + n, HISTSIZE-1); } - #endif // SCROLLBACK_PATCH - #if COLUMNS_PATCH && !VIM_BROWSE_PATCH tclearregion(0, orig, term.maxcol-1, orig+n-1); - #else - tclearregion(0, orig, term.col-1, orig+n-1); - #endif // COLUMNS_PATCH tsetdirt(orig+n, term.bot); for (i = orig; i <= term.bot-n; i++) { @@ -1488,21 +1095,9 @@ tscrollup(int orig, int n) term.line[i+n] = temp; } - #if SIXEL_PATCH - #if SCROLLBACK_PATCH - if (term.scr == 0) - scroll_images(-1 * n); - #else - scroll_images(-1 * n); - #endif - #endif // SIXEL_PATCH - #if SCROLLBACK_PATCH if (term.scr == 0) selscroll(orig, -n); - #else - selscroll(orig, -n); - #endif // SCROLLBACK_PATCH } void @@ -1531,40 +1126,13 @@ tnewline(int first_col) int y = term.c.y; if (y == term.bot) { - #if SCROLLBACK_PATCH tscrollup(term.top, 1, 1); - #else - tscrollup(term.top, 1); - #endif // SCROLLBACK_PATCH } else { y++; } tmoveto(first_col ? 0 : term.c.x, y); } -#if UNDERCURL_PATCH -void -readcolonargs(char **p, int cursor, int params[][CAR_PER_ARG]) -{ - int i = 0; - for (; i < CAR_PER_ARG; i++) - params[cursor][i] = -1; - - if (**p != ':') - return; - - char *np = NULL; - i = 0; - - while (**p == ':' && i < CAR_PER_ARG) { - while (**p == ':') - (*p)++; - params[cursor][i] = strtol(*p, &np, 10); - *p = np; - i++; - } -} -#endif // UNDERCURL_PATCH void csiparse(void) @@ -1588,9 +1156,6 @@ csiparse(void) v = -1; csiescseq.arg[csiescseq.narg++] = v; p = np; - #if UNDERCURL_PATCH - readcolonargs(&p, csiescseq.narg-1, csiescseq.carg); - #endif // UNDERCURL_PATCH if (*p != ';' || csiescseq.narg == ESC_ARG_SIZ) break; p++; @@ -1658,10 +1223,6 @@ tsetchar(Rune u, const Glyph *attr, int x, int y) term.line[y][x] = *attr; term.line[y][x].u = u; - #if BOXDRAW_PATCH - if (isboxdraw(u)) - term.line[y][x].mode |= ATTR_BOXDRAW; - #endif // BOXDRAW_PATCH } void @@ -1675,16 +1236,8 @@ tclearregion(int x1, int y1, int x2, int y2) if (y1 > y2) temp = y1, y1 = y2, y2 = temp; - #if VIM_BROWSE_PATCH - LIMIT(x1, 0, buffCols-1); - LIMIT(x2, 0, buffCols-1); - #elif COLUMNS_PATCH LIMIT(x1, 0, term.maxcol-1); LIMIT(x2, 0, term.maxcol-1); - #else - LIMIT(x1, 0, term.col-1); - LIMIT(x2, 0, term.col-1); - #endif // VIM_BROWSE_PATCH LIMIT(y1, 0, term.row-1); LIMIT(y2, 0, term.row-1); @@ -1747,11 +1300,7 @@ void tdeleteline(int n) { if (BETWEEN(term.c.y, term.top, term.bot)) - #if SCROLLBACK_PATCH tscrollup(term.c.y, n, 0); - #else - tscrollup(term.c.y, n); - #endif // SCROLLBACK_PATCH } int32_t @@ -1824,12 +1373,6 @@ tsetattr(const int *attr, int l) ATTR_STRUCK ); term.c.attr.fg = defaultfg; term.c.attr.bg = defaultbg; - #if UNDERCURL_PATCH - term.c.attr.ustyle = -1; - term.c.attr.ucolor[0] = -1; - term.c.attr.ucolor[1] = -1; - term.c.attr.ucolor[2] = -1; - #endif // UNDERCURL_PATCH break; case 1: term.c.attr.mode |= ATTR_BOLD; @@ -1841,18 +1384,7 @@ tsetattr(const int *attr, int l) term.c.attr.mode |= ATTR_ITALIC; break; case 4: - #if UNDERCURL_PATCH - term.c.attr.ustyle = csiescseq.carg[i][0]; - - if (term.c.attr.ustyle != 0) - term.c.attr.mode |= ATTR_UNDERLINE; - else - term.c.attr.mode &= ~ATTR_UNDERLINE; - - term.c.attr.mode ^= ATTR_DIRTYUNDERLINE; - #else term.c.attr.mode |= ATTR_UNDERLINE; - #endif // UNDERCURL_PATCH break; case 5: /* slow blink */ /* FALLTHROUGH */ @@ -1891,65 +1423,27 @@ tsetattr(const int *attr, int l) break; case 38: if ((idx = tdefcolor(attr, &i, l)) >= 0) - #if MONOCHROME_PATCH - term.c.attr.fg = defaultfg; - #else term.c.attr.fg = idx; - #endif // MONOCHROME_PATCH break; case 39: term.c.attr.fg = defaultfg; break; case 48: if ((idx = tdefcolor(attr, &i, l)) >= 0) - #if MONOCHROME_PATCH - term.c.attr.bg = 0; - #else term.c.attr.bg = idx; - #endif // MONOCHROME_PATCH break; case 49: term.c.attr.bg = defaultbg; break; - #if UNDERCURL_PATCH - case 58: - term.c.attr.ucolor[0] = csiescseq.carg[i][1]; - term.c.attr.ucolor[1] = csiescseq.carg[i][2]; - term.c.attr.ucolor[2] = csiescseq.carg[i][3]; - term.c.attr.mode ^= ATTR_DIRTYUNDERLINE; - break; - case 59: - term.c.attr.ucolor[0] = -1; - term.c.attr.ucolor[1] = -1; - term.c.attr.ucolor[2] = -1; - term.c.attr.mode ^= ATTR_DIRTYUNDERLINE; - break; - #endif // UNDERCURL_PATCH default: if (BETWEEN(attr[i], 30, 37)) { - #if MONOCHROME_PATCH - term.c.attr.fg = defaultfg; - #else term.c.attr.fg = attr[i] - 30; - #endif // MONOCHROME_PATCH } else if (BETWEEN(attr[i], 40, 47)) { - #if MONOCHROME_PATCH - term.c.attr.bg = 0; - #else term.c.attr.bg = attr[i] - 40; - #endif // MONOCHROME_PATCH } else if (BETWEEN(attr[i], 90, 97)) { - #if MONOCHROME_PATCH - term.c.attr.fg = defaultfg; - #else term.c.attr.fg = attr[i] - 90 + 8; - #endif // MONOCHROME_PATCH } else if (BETWEEN(attr[i], 100, 107)) { - #if MONOCHROME_PATCH - term.c.attr.bg = 0; - #else term.c.attr.bg = attr[i] - 100 + 8; - #endif // MONOCHROME_PATCH } else { fprintf(stderr, "erresc(default): gfx attr %d unknown\n", @@ -2052,11 +1546,7 @@ tsetmode(int priv, int set, const int *args, int narg) break; alt = IS_SET(MODE_ALTSCREEN); if (alt) { - #if COLUMNS_PATCH && !VIM_BROWSE_PATCH tclearregion(0, 0, term.maxcol-1, term.row-1); - #else - tclearregion(0, 0, term.col-1, term.row-1); - #endif // COLUMNS_PATCH } if (set ^ alt) /* set is always 1 or 0 */ tswapscreen(); @@ -2116,14 +1606,7 @@ csihandle(void) { char buffer[40]; int len; - #if SIXEL_PATCH - ImageList *im; - #endif // SIXEL_PATCH - #if COLUMNS_PATCH && !VIM_BROWSE_PATCH int maxcol = term.maxcol; - #else - int maxcol = term.col; - #endif // COLUMNS_PATCH switch (csiescseq.mode[0]) { default: @@ -2233,21 +1716,14 @@ csihandle(void) tclearregion(0, term.c.y, term.c.x, term.c.y); break; case 2: /* screen */ - #if SCROLLBACK_PATCH || VIM_BROWSE_PATCH if (!IS_SET(MODE_ALTSCREEN)) { - #if SCROLLBACK_PATCH kscrolldown(&((Arg){ .i = term.scr })); - #endif int n, m, bot = term.bot; term.bot = term.row-1; for (n = term.row-1; n >= 0; n--) { for (m = 0; m < maxcol && term.line[n][m].u == ' ' && !term.line[n][m].mode; m++); if (m < maxcol) { - #if SCROLLBACK_PATCH tscrollup(0, n+1, 1); - #else - tscrollup(0, n+1); - #endif break; } } @@ -2256,29 +1732,11 @@ csihandle(void) term.bot = bot; break; } - #endif // SCROLLBACK_PATCH tclearregion(0, 0, maxcol-1, term.row-1); - #if SIXEL_PATCH - for (im = term.images; im; im = im->next) - im->should_delete = 1; - #endif // SIXEL_PATCH break; case 3: /* scrollback */ - #if VIM_BROWSE_PATCH - if (!IS_SET(MODE_ALTSCREEN)) { - Glyph g=(Glyph){.bg=term.c.attr.bg, .fg=term.c.attr.fg, .u=' ', .mode=0}; - for (int i = 0; i < buffSize; ++i) { - if (!BETWEEN(i, insertOff, insertOff + term.row - 1) && - !(insertOff + term.row > buffSize && - BETWEEN(i, 0, (insertOff + term.row - 1) % buffSize))) { - for (int j = 0; j < term.col; ++j) - buf[i][j] = g; - } - } - } - #elif SCROLLBACK_PATCH if (!IS_SET(MODE_ALTSCREEN)) { term.scr = 0; term.histi = 0; @@ -2289,20 +1747,7 @@ csihandle(void) term.hist[i][j] = g; } } - #endif // SCROLLBACK_PATCH - #if SIXEL_PATCH - if (!IS_SET(MODE_ALTSCREEN)) { - for (im = term.images; im; im = im->next) - im->should_delete |= (im->y * win.ch + im->height <= 0); - } - #endif // SIXEL_PATCH break; - #if SIXEL_PATCH - case 6: /* sixels */ - for (im = term.images; im; im = im->next) - im->should_delete = 1; - break; - #endif // SIXEL_PATCH default: goto unknown; } @@ -2323,13 +1768,7 @@ csihandle(void) break; case 'S': /* SU -- Scroll line up */ DEFAULT(csiescseq.arg[0], 1); - #if SIXEL_PATCH && SCROLLBACK_PATCH - tscrollup(term.top, csiescseq.arg[0], 1); - #elif SCROLLBACK_PATCH tscrollup(term.top, csiescseq.arg[0], 0); - #else - tscrollup(term.top, csiescseq.arg[0]); - #endif // SCROLLBACK_PATCH break; case 'T': /* SD -- Scroll line down */ DEFAULT(csiescseq.arg[0], 1); @@ -2341,12 +1780,6 @@ csihandle(void) break; case 'l': /* RM -- Reset Mode */ tsetmode(csiescseq.priv, 0, csiescseq.arg, csiescseq.narg); - #if SIXEL_PATCH - if (IS_SET(MODE_ALTSCREEN)) { - for (im = term.images; im; im = im->next) - im->should_delete = 1; - } - #endif // SIXEL_PATCH break; case 'M': /* DL -- Delete lines */ DEFAULT(csiescseq.arg[0], 1); @@ -2402,36 +1835,6 @@ csihandle(void) case 's': /* DECSC -- Save cursor position (ANSI.SYS) */ tcursor(CURSOR_SAVE); break; - #if CSI_22_23_PATCH - case 't': /* title stack operations */ - switch (csiescseq.arg[0]) { - case 22: /* pust current title on stack */ - switch (csiescseq.arg[1]) { - case 0: - case 1: - case 2: - xpushtitle(); - break; - default: - goto unknown; - } - break; - case 23: /* pop last title from stack */ - switch (csiescseq.arg[1]) { - case 0: - case 1: - case 2: - xsettitle(NULL, 1); - break; - default: - goto unknown; - } - break; - default: - goto unknown; - } - break; - #endif // CSI_22_23_PATCH case 'u': /* DECRC -- Restore cursor position (ANSI.SYS) */ tcursor(CURSOR_LOAD); break; @@ -2519,10 +1922,6 @@ strhandle(void) { char *p = NULL, *dec; int j, narg, par; - #if SIXEL_PATCH - ImageList *new_image; - int i; - #endif // SIXEL_PATCH term.esc &= ~(ESC_STR_END|ESC_STR); strparse(); @@ -2533,11 +1932,7 @@ strhandle(void) switch (par) { case 0: if (narg > 1) { - #if CSI_22_23_PATCH - xsettitle(strescseq.args[1], 0); - #else xsettitle(strescseq.args[1]); - #endif // CSI_22_23_PATCH xseticontitle(strescseq.args[1]); } return; @@ -2547,11 +1942,7 @@ strhandle(void) return; case 2: if (narg > 1) - #if CSI_22_23_PATCH - xsettitle(strescseq.args[1], 0); - #else xsettitle(strescseq.args[1]); - #endif // CSI_22_23_PATCH return; case 52: if (narg > 2 && allowwindowops) { @@ -2638,57 +2029,9 @@ strhandle(void) } break; case 'k': /* old title set compatibility */ - #if CSI_22_23_PATCH - xsettitle(strescseq.args[0], 0); - #else xsettitle(strescseq.args[0]); - #endif // CSI_22_23_PATCH return; case 'P': /* DCS -- Device Control String */ - #if SIXEL_PATCH - if (IS_SET(MODE_SIXEL)) { - term.mode &= ~MODE_SIXEL; - new_image = malloc(sizeof(ImageList)); - memset(new_image, 0, sizeof(ImageList)); - new_image->x = term.c.x; - new_image->y = term.c.y; - new_image->width = sixel_st.image.width; - new_image->height = sixel_st.image.height; - new_image->pixels = malloc(new_image->width * new_image->height * 4); - if (sixel_parser_finalize(&sixel_st, new_image->pixels) != 0) { - perror("sixel_parser_finalize() failed"); - sixel_parser_deinit(&sixel_st); - return; - } - sixel_parser_deinit(&sixel_st); - if (term.images) { - ImageList *im; - for (im = term.images; im->next;) - im = im->next; - im->next = new_image; - new_image->prev = im; - } else { - term.images = new_image; - } - for (i = 0; i < (sixel_st.image.height + win.ch-1)/win.ch; ++i) { - int x; - tclearregion(term.c.x, term.c.y, term.c.x+(sixel_st.image.width+win.cw-1)/win.cw-1, term.c.y); - for (x = term.c.x; x < MIN(term.col, term.c.x+(sixel_st.image.width+win.cw-1)/win.cw); x++) - term.line[term.c.y][x].mode |= ATTR_SIXEL; - tnewline(0); - } - } - #endif // SIXEL_PATCH - #if SYNC_PATCH - /* https://gitlab.com/gnachman/iterm2/-/wikis/synchronized-updates-spec */ - if (strstr(strescseq.buf, "=1s") == strescseq.buf) - tsync_begin(); /* BSU */ - else if (strstr(strescseq.buf, "=2s") == strescseq.buf) - tsync_end(); /* ESU */ - #endif // SYNC_PATCH - #if SIXEL_PATCH || SYNC_PATCH - return; - #endif // SIXEL_PATCH | SYNC_PATCH case '_': /* APC -- Application Program Command */ case '^': /* PM -- Privacy Message */ return; @@ -2882,16 +2225,10 @@ tdectest(char c) void tstrsequence(uchar c) { - #if SIXEL_PATCH - strreset(); - #endif // SIXEL_PATCH switch (c) { case 0x90: /* DCS -- Device Control String */ c = 'P'; - #if SIXEL_PATCH - term.esc |= ESC_DCS; - #endif // SIXEL_PATCH break; case 0x9f: /* APC -- Application Program Command */ c = '_'; @@ -2903,9 +2240,7 @@ tstrsequence(uchar c) c = ']'; break; } - #if !SIXEL_PATCH strreset(); - #endif // SIXEL_PATCH strescseq.type = c; term.esc |= ESC_STR; } @@ -3025,9 +2360,6 @@ eschandle(uchar ascii) term.esc |= ESC_UTF8; return 0; case 'P': /* DCS -- Device Control String */ - #if SIXEL_PATCH - term.esc |= ESC_DCS; - #endif // SIXEL_PATCH case '_': /* APC -- Application Program Command */ case '^': /* PM -- Privacy Message */ case ']': /* OSC -- Operating System Command */ @@ -3047,11 +2379,7 @@ eschandle(uchar ascii) return 0; case 'D': /* IND -- Linefeed */ if (term.c.y == term.bot) { - #if SCROLLBACK_PATCH tscrollup(term.top, 1, 1); - #else - tscrollup(term.top, 1); - #endif // SCROLLBACK_PATCH } else { tmoveto(term.c.x, term.c.y+1); } @@ -3074,19 +2402,14 @@ eschandle(uchar ascii) break; case 'c': /* RIS -- Reset to initial state */ treset(); - #if CSI_22_23_PATCH - xfreetitlestack(); - #endif // CSI_22_23_PATCH resettitle(); xloadcols(); xsetmode(0, MODE_HIDE); - #if SCROLLBACK_PATCH if (!IS_SET(MODE_ALTSCREEN)) { term.scr = 0; term.histi = 0; term.histn = 0; } - #endif // SCROLLBACK_PATCH break; case '=': /* DECPAM -- Application keypad */ xsetmode(1, MODE_APPKEYPAD); @@ -3121,11 +2444,7 @@ tputc(Rune u) Glyph *gp; control = ISCONTROL(u); - #if SIXEL_PATCH - if (u < 127 || !IS_SET(MODE_UTF8 | MODE_SIXEL)) - #else if (u < 127 || !IS_SET(MODE_UTF8)) - #endif // SIXEL_PATCH { c[0] = u; width = len = 1; @@ -3147,24 +2466,11 @@ tputc(Rune u) if (term.esc & ESC_STR) { if (u == '\a' || u == 030 || u == 032 || u == 033 || ISCONTROLC1(u)) { - #if SIXEL_PATCH - term.esc &= ~(ESC_START|ESC_STR|ESC_DCS); - #else term.esc &= ~(ESC_START|ESC_STR); - #endif // SIXEL_PATCH term.esc |= ESC_STR_END; goto check_control_code; } - #if SIXEL_PATCH - if (IS_SET(MODE_SIXEL)) { - if (sixel_parser_parse(&sixel_st, (unsigned char *)&u, 1) != 0) - perror("sixel_parser_parse() failed"); - return; - } - if (term.esc & ESC_DCS) - goto check_control_code; - #endif // SIXEL_PATCH if (strescseq.len+len >= strescseq.siz) { /* @@ -3219,17 +2525,6 @@ check_control_code: csihandle(); } return; - #if SIXEL_PATCH - } else if (term.esc & ESC_DCS) { - csiescseq.buf[csiescseq.len++] = u; - if (BETWEEN(u, 0x40, 0x7E) - || csiescseq.len >= \ - sizeof(csiescseq.buf)-1) { - csiparse(); - dcshandle(); - } - return; - #endif // SIXEL_PATCH } else if (term.esc & ESC_UTF8) { tdefutf8(u); } else if (term.esc & ESC_ALTCHARSET) { @@ -3248,10 +2543,8 @@ check_control_code: */ return; } - #if !VIM_BROWSE_PATCH if (selected(term.c.x, term.c.y)) selclear(); - #endif // VIM_BROWSE_PATCH gp = &term.line[term.c.y][term.c.x]; if (IS_SET(MODE_WRAP) && (term.c.state & CURSOR_WRAPNEXT)) { @@ -3301,17 +2594,9 @@ twrite(const char *buf, int buflen, int show_ctrl) Rune u; int n; - #if SYNC_PATCH - int su0 = su; - twrite_aborted = 0; - #endif // SYNC_PATCH for (n = 0; n < buflen; n += charsize) { - #if SIXEL_PATCH - if (IS_SET(MODE_UTF8) && !IS_SET(MODE_SIXEL)) - #else if (IS_SET(MODE_UTF8)) - #endif // SIXEL_PATCH { /* process a complete utf8 char */ charsize = utf8decode(buf + n, &u, buflen - n); @@ -3321,12 +2606,6 @@ twrite(const char *buf, int buflen, int show_ctrl) u = buf[n] & 0xFF; charsize = 1; } - #if SYNC_PATCH - if (su0 && !su) { - twrite_aborted = 1; - break; // ESU - allow rendering before a new BSU - } - #endif // SYNC_PATCH if (show_ctrl && ISCONTROL(u)) { if (u & 0x80) { u &= 0x7f; @@ -3346,15 +2625,7 @@ void tresize(int col, int row) { int i; - #if SCROLLBACK_PATCH int j; - #endif // SCROLLBACK_PATCH - #if VIM_BROWSE_PATCH - int const colSet = col, alt = IS_SET(MODE_ALTSCREEN), ini = buf == NULL; - col = MAX(col, buffCols); - row = MIN(row, buffSize); - int const minrow = MIN(row, term.row), mincol = MIN(col, buffCols); - #elif COLUMNS_PATCH int tmp = col; int minrow, mincol; @@ -3363,17 +2634,9 @@ tresize(int col, int row) col = MAX(col, term.maxcol); minrow = MIN(row, term.row); mincol = MIN(col, term.maxcol); - #else - int minrow = MIN(row, term.row); - int mincol = MIN(col, term.col); - #endif // VIM_BROWSE_PATCH int *bp; TCursor c; - #if KEYBOARDSELECT_PATCH - if ( row < term.row || col < term.col ) - toggle_winmode(trt_kbdselect(XK_Escape, NULL, 0)); - #endif // KEYBOARDSELECT_PATCH if (col < 1 || row < 1) { fprintf(stderr, @@ -3381,10 +2644,6 @@ tresize(int col, int row) return; } - #if VIM_BROWSE_PATCH - if (alt) - tswapscreen(); - #endif // VIM_BROWSE_PATCH /* * slide screen to keep cursor where we expect it - @@ -3392,109 +2651,57 @@ tresize(int col, int row) * memmove because we're freeing the earlier lines */ for (i = 0; i <= term.c.y - row; i++) { - #if !VIM_BROWSE_PATCH free(term.line[i]); - #endif // VIM_BROWSE_PATCH free(term.alt[i]); } /* ensure that both src and dst are not NULL */ if (i > 0) { - #if !VIM_BROWSE_PATCH memmove(term.line, term.line + i, row * sizeof(Line)); - #endif // VIM_BROWSE_PATCH memmove(term.alt, term.alt + i, row * sizeof(Line)); } for (i += row; i < term.row; i++) { - #if !VIM_BROWSE_PATCH free(term.line[i]); - #endif // VIM_BROWSE_PATCH free(term.alt[i]); } /* resize to new height */ - #if VIM_BROWSE_PATCH - buf = xrealloc(buf, (buffSize + row) * sizeof(Line)); - mark = xrealloc(mark, col * row * sizeof(*mark)); - #else term.line = xrealloc(term.line, row * sizeof(Line)); - #endif // VIM_BROWSE_PATCH term.alt = xrealloc(term.alt, row * sizeof(Line)); term.dirty = xrealloc(term.dirty, row * sizeof(*term.dirty)); term.tabs = xrealloc(term.tabs, col * sizeof(*term.tabs)); - #if SCROLLBACK_PATCH Glyph gc=(Glyph){.bg=term.c.attr.bg, .fg=term.c.attr.fg, .u=' ', .mode=0}; for (i = 0; i < HISTSIZE; i++) { term.hist[i] = xrealloc(term.hist[i], col * sizeof(Glyph)); for (j = mincol; j < col; j++) term.hist[i][j] = gc; } - #endif // SCROLLBACK_PATCH /* resize each row to new width, zero-pad if needed */ for (i = 0; i < minrow; i++) { - #if !VIM_BROWSE_PATCH term.line[i] = xrealloc(term.line[i], col * sizeof(Glyph)); - #endif // VIM_BROWSE_PATCH term.alt[i] = xrealloc(term.alt[i], col * sizeof(Glyph)); } /* allocate any new rows */ for (/* i = minrow */; i < row; i++) { - #if !VIM_BROWSE_PATCH term.line[i] = xmalloc(col * sizeof(Glyph)); - #endif // VIM_BROWSE_PATCH term.alt[i] = xmalloc(col * sizeof(Glyph)); } - #if VIM_BROWSE_PATCH - if (col > buffCols) - #elif COLUMNS_PATCH if (col > term.maxcol) - #else - if (col > term.col) - #endif // VIM_BROWSE_PATCH { - #if VIM_BROWSE_PATCH - bp = term.tabs + buffCols; - memset(bp, 0, sizeof(*term.tabs) * (col - buffCols)); - #elif COLUMNS_PATCH bp = term.tabs + term.maxcol; memset(bp, 0, sizeof(*term.tabs) * (col - term.maxcol)); - #else - bp = term.tabs + term.col; - memset(bp, 0, sizeof(*term.tabs) * (col - term.col)); - #endif // VIM_BROWSE_PATCH while (--bp > term.tabs && !*bp) /* nothing */ ; for (bp += tabspaces; bp < term.tabs + col; bp += tabspaces) *bp = 1; } - #if VIM_BROWSE_PATCH - Glyph g=(Glyph){.bg=term.c.attr.bg, .fg=term.c.attr.fg, .u=' ', .mode=0}; - for (i = 0; i < buffSize; ++i) { - buf[i] = xrealloc(ini ? NULL : buf[i], col*sizeof(Glyph)); - for (int j = ini ? 0 : buffCols; j < col; ++j) buf[i][j] = g; - } - for (i = 0; i < row; ++i) buf[buffSize + i] = buf[i]; - term.line = &buf[*(histOp?&histOff:&insertOff) +=MAX(term.c.y-row+1,0)]; - memset(mark, 0, col * row * sizeof(*mark)); - #endif // VIM_BROWSE_PATCH /* update terminal size */ - #if VIM_BROWSE_PATCH - term.col = colSet; - buffCols = col; - #elif COLUMNS_PATCH term.col = tmp; term.maxcol = col; - #else - term.col = col; - #endif // VIM_BROWSE_PATCH term.row = row; - #if VIM_BROWSE_PATCH - if (alt) - tswapscreen(); - #endif // VIM_BROWSE_PATCH /* reset scrolling region */ tsetscroll(0, row-1); /* make use of the LIMIT in tmoveto */ @@ -3517,43 +2724,21 @@ tresize(int col, int row) void resettitle(void) { - #if CSI_22_23_PATCH - xsettitle(NULL, 0); - #else xsettitle(NULL); - #endif // CSI_22_23_PATCH } void drawregion(int x1, int y1, int x2, int y2) { - #if VIM_BROWSE_PATCH - if (altToggle && histMode && !histOp) - memset(term.dirty, 0, sizeof(*term.dirty) * term.row); - int const o = !IS_SET(MODE_ALTSCREEN) && histMode && !histOp, h =rows(); - #endif // VIM_BROWSE_PATCH int y; for (y = y1; y < y2; y++) { - #if VIM_BROWSE_PATCH - int const oy = o ? (y + insertOff - histOff + h) % h : y; - if (!BETWEEN(oy, 0, term.row-1) || !term.dirty[y]) continue; - xdrawline(term.line[y], x1, oy, x2); - #else if (!term.dirty[y]) continue; term.dirty[y] = 0; - #if SCROLLBACK_PATCH xdrawline(TLINE(y), x1, y, x2); - #else - xdrawline(term.line[y], x1, y, x2); - #endif // SCROLLBACK_PATCH - #endif // VIM_BROWSE_PATCH } - #if VIM_BROWSE_PATCH - memset(&term.dirty[y1], 0, sizeof(*term.dirty) * (y2 - y1)); - #endif // VIM_BROWSE_PATCH } #include "patch/st_include.c" @@ -3574,26 +2759,12 @@ draw(void) if (term.line[term.c.y][cx].mode & ATTR_WDUMMY) cx--; - #if VIM_BROWSE_PATCH - if (histMode) - historyPreDraw(); - #endif // VIM_BROWSE_PATCH drawregion(0, 0, term.col, term.row); - #if VIM_BROWSE_PATCH - if (!histMode) - #elif SCROLLBACK_PATCH if (term.scr == 0) - #endif // SCROLLBACK_PATCH - #if LIGATURES_PATCH - xdrawcursor(cx, term.c.y, term.line[term.c.y][cx], - term.ocx, term.ocy, term.line[term.ocy][term.ocx], - term.line[term.ocy], term.col); - #else xdrawcursor(cx, term.c.y, term.line[term.c.y][cx], term.ocx, term.ocy, term.line[term.ocy][term.ocx]); - #endif // LIGATURES_PATCH term.ocx = cx; term.ocy = term.c.y; xfinishdraw(); diff --git a/st.h b/st.h index 41af307..15c6845 100644 --- a/st.h +++ b/st.h @@ -8,36 +8,24 @@ #include #include #include -#include "patches.h" /* macros */ #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define MAX(a, b) ((a) < (b) ? (b) : (a)) #define LEN(a) (sizeof(a) / sizeof(a)[0]) #define BETWEEN(x, a, b) ((a) <= (x) && (x) <= (b)) -#if VIM_BROWSE_PATCH -#define OUT(x, a, b) ((a) <= (x) || (x) <= (b)) -#endif // VIM_BROWSE_PATCH #define DIVCEIL(n, d) (((n) + ((d) - 1)) / (d)) #define DEFAULT(a, b) (a) = (a) ? (a) : (b) #define LIMIT(x, a, b) (x) = (x) < (a) ? (a) : (x) > (b) ? (b) : (x) -#if LIGATURES_PATCH -#define ATTRCMP(a, b) (((a).mode & (~ATTR_WRAP) & (~ATTR_LIGA)) != ((b).mode & (~ATTR_WRAP) & (~ATTR_LIGA)) || \ - (a).fg != (b).fg || \ - (a).bg != (b).bg) -#else #define ATTRCMP(a, b) ((a).mode != (b).mode || (a).fg != (b).fg || \ (a).bg != (b).bg) -#endif // LIGATURES_PATCH #define TIMEDIFF(t1, t2) ((t1.tv_sec-t2.tv_sec)*1000 + \ (t1.tv_nsec-t2.tv_nsec)/1E6) #define MODBIT(x, set, bit) ((set) ? ((x) |= (bit)) : ((x) &= ~(bit))) #define TRUECOLOR(r,g,b) (1 << 24 | (r) << 16 | (g) << 8 | (b)) #define IS_TRUECOL(x) (1 << 24 & (x)) -#if SCROLLBACK_PATCH #define HISTSIZE 2000 -#endif // SCROLLBACK_PATCH enum glyph_attribute { ATTR_NULL = 0, @@ -52,41 +40,10 @@ enum glyph_attribute { ATTR_WRAP = 1 << 8, ATTR_WIDE = 1 << 9, ATTR_WDUMMY = 1 << 10, - #if BOXDRAW_PATCH - ATTR_BOXDRAW = 1 << 11, - #endif // BOXDRAW_PATCH - #if LIGATURES_PATCH - ATTR_LIGA = 1 << 12, - #endif // LIGATURES_PATCH - #if SIXEL_PATCH - ATTR_SIXEL = 1 << 13, - #endif // SIXEL_PATCH ATTR_BOLD_FAINT = ATTR_BOLD | ATTR_FAINT, - #if UNDERCURL_PATCH - ATTR_DIRTYUNDERLINE = 1 << 15, - #endif // UNDERCURL_PATCH }; -#if SIXEL_PATCH -typedef struct _ImageList { - struct _ImageList *next, *prev; - unsigned char *pixels; - void *pixmap; - int width; - int height; - int x; - int y; - int should_delete; -} ImageList; -#endif // SIXEL_PATCH -#if WIDE_GLYPHS_PATCH -enum drawing_mode { - DRAW_NONE = 0, - DRAW_BG = 1 << 0, - DRAW_FG = 1 << 1, -}; -#endif // WIDE_GLYPHS_PATCH /* Used to control which screen(s) keybindings and mouse shortcuts apply to. */ enum screen { @@ -128,10 +85,6 @@ typedef struct { ushort mode; /* attribute flags */ uint32_t fg; /* foreground */ uint32_t bg; /* background */ - #if UNDERCURL_PATCH - int ustyle; /* underline style */ - int ucolor[3]; /* underline color */ - #endif // UNDERCURL_PATCH } Glyph; typedef Glyph *Line; @@ -147,17 +100,13 @@ typedef struct { typedef struct { int row; /* nb row */ int col; /* nb col */ - #if COLUMNS_PATCH && !VIM_BROWSE_PATCH int maxcol; - #endif // COLUMNS_PATCH Line *line; /* screen */ Line *alt; /* alternate screen */ - #if SCROLLBACK_PATCH Line hist[HISTSIZE]; /* history buffer */ int histi; /* history index */ int histn; /* number of history entries */ int scr; /* scroll back */ - #endif // SCROLLBACK_PATCH int *dirty; /* dirtyness of lines */ TCursor c; /* cursor */ int ocx; /* old cursor col */ @@ -170,10 +119,6 @@ typedef struct { int charset; /* current charset */ int icharset; /* selected charset for sequence */ int *tabs; - #if SIXEL_PATCH - ImageList *images; /* sixel images */ - ImageList *images_alt; /* sixel images for alternate screen */ - #endif // SIXEL_PATCH Rune lastc; /* last printed char outside of sequence, 0 if control */ } Term; @@ -189,17 +134,9 @@ typedef union { typedef struct { int tw, th; /* tty width and height */ int w, h; /* window width and height */ - #if BACKGROUND_IMAGE_PATCH - int x, y; /* window location */ - #endif // BACKGROUND_IMAGE_PATCH - #if ANYSIZE_PATCH int hborderpx, vborderpx; - #endif // ANYSIZE_PATCH int ch; /* char height */ int cw; /* char width */ - #if VERTCENTER_PATCH - int cyo; /* char y offset */ - #endif // VERTCENTER_PATCH int mode; /* window state/mode flags */ int cursor; /* cursor style */ } TermWindow; @@ -211,12 +148,6 @@ typedef struct { Drawable buf; GlyphFontSpec *specbuf; /* font spec buffer used for rendering */ Atom xembed, wmdeletewin, netwmname, netwmiconname, netwmpid; - #if FULLSCREEN_PATCH - Atom netwmstate, netwmfullscreen; - #endif // FULLSCREEN_PATCH - #if NETWMICON_PATCH - Atom netwmicon; - #endif // NETWMICON_PATCH struct { XIM xim; XIC xic; @@ -224,26 +155,11 @@ typedef struct { XVaNestedList spotlist; } ime; Draw draw; - #if BACKGROUND_IMAGE_PATCH - GC bggc; /* Graphics Context for background */ - #endif // BACKGROUND_IMAGE_PATCH Visual *vis; XSetWindowAttributes attrs; - #if HIDECURSOR_PATCH || OPENURLONCLICK_PATCH - /* 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; - #endif // HIDECURSOR_PATCH - #if OPENURLONCLICK_PATCH - Cursor upointer; - #endif // OPENURLONCLICK_PATCH int scr; int isfixed; /* is fixed geometry? */ - #if ALPHA_PATCH int depth; /* bit depth */ - #endif // ALPHA_PATCH int l, t; /* left and top offset */ int gm; /* geometry mask */ } XWindow; @@ -321,9 +237,6 @@ int tattrset(int); int tisaltscr(void); void tnew(int, int); void tresize(int, int); -#if VIM_BROWSE_PATCH -void tmoveto(int x, int y); -#endif // VIM_BROWSE_PATCH void tsetdirtattr(int); void ttyhangup(void); int ttynew(const char *, char *, const char *, char **); @@ -348,15 +261,6 @@ char *xstrdup(const char *); int xgetcolor(int x, unsigned char *r, unsigned char *g, unsigned char *b); -#if BOXDRAW_PATCH -int isboxdraw(Rune); -ushort boxdrawindex(const Glyph *); -#ifdef XFT_VERSION -/* only exposed to x.c, otherwise we'll need Xft.h for the types */ -void boxdraw_xinit(Display *, Colormap, XftDraw *, Visual *); -void drawboxes(int, int, int, int, XftColor *, XftColor *, const XftGlyphFontSpec *, int); -#endif // XFT_VERSION -#endif // BOXDRAW_PATCH /* config.h globals */ extern char *utmp; @@ -371,19 +275,8 @@ extern unsigned int tabspaces; extern unsigned int defaultfg; extern unsigned int defaultbg; extern unsigned int defaultcs; -#if EXTERNALPIPE_PATCH -extern int extpipeactive; -#endif // EXTERNALPIPE_PATCH -#if BOXDRAW_PATCH -extern const int boxdraw, boxdraw_bold, boxdraw_braille; -#endif // BOXDRAW_PATCH -#if ALPHA_PATCH extern float alpha; -#if ALPHA_FOCUS_HIGHLIGHT_PATCH -extern float alphaUnfocused; -#endif // ALPHA_FOCUS_HIGHLIGHT_PATCH -#endif // ALPHA_PATCH extern DC dc; extern XWindow xw; diff --git a/win.h b/win.h index 55bd990..323dfae 100644 --- a/win.h +++ b/win.h @@ -21,37 +21,21 @@ enum win_mode { MODE_NUMLOCK = 1 << 17, MODE_MOUSE = MODE_MOUSEBTN|MODE_MOUSEMOTION|MODE_MOUSEX10\ |MODE_MOUSEMANY, - #if VIM_BROWSE_PATCH - MODE_NORMAL = 1 << 18, - #endif // VIM_BROWSE_PATCH - #if KEYBOARDSELECT_PATCH - MODE_KBDSELECT = 1 << 19, - #endif // KEYBOARDSELECT_PATCH }; void xbell(void); void xclipcopy(void); -#if LIGATURES_PATCH -void xdrawcursor(int, int, Glyph, int, int, Glyph, Line, int); -#else void xdrawcursor(int, int, Glyph, int, int, Glyph); -#endif // LIGATURES_PATCH void xdrawline(Line, int, int, int); void xfinishdraw(void); void xloadcols(void); int xsetcolorname(int, const char *); void xseticontitle(char *); -#if CSI_22_23_PATCH -void xfreetitlestack(void); -void xsettitle(char *, int); -void xpushtitle(void); -#else void xsettitle(char *); -#endif // CSI_22_23_PATCH int xsetcursor(int); void xsetmode(int, unsigned int); void xsetpointermotion(int); void xsetsel(char *); int xstartdraw(void); void xximspot(int, int); -void xclearwin(void); \ No newline at end of file +void xclearwin(void); diff --git a/x.c b/x.c index e7f993d..11f25bc 100644 --- a/x.c +++ b/x.c @@ -19,23 +19,8 @@ char *argv0; #include "arg.h" #include "st.h" #include "win.h" -#if LIGATURES_PATCH -#include "hb.h" -#endif // LIGATURES_PATCH -#if THEMED_CURSOR_PATCH -#include -#endif // THEMED_CURSOR_PATCH -#if UNDERCURL_PATCH -/* Undercurl slope types */ -enum undercurl_slope_type { - UNDERCURL_SLOPE_ASCENDING = 0, - UNDERCURL_SLOPE_TOP_CAP = 1, - UNDERCURL_SLOPE_DESCENDING = 2, - UNDERCURL_SLOPE_BOTTOM_CAP = 3 -}; -#endif // UNDERCURL_PATCH /* X modifiers */ #define XK_ANY_MOD UINT_MAX @@ -58,10 +43,6 @@ static void zoomreset(const Arg *); /* config.h for applying patches and the configuration. */ #include "config.h" -#if CSI_22_23_PATCH -/* size of title stack */ -#define TITLESTACKSIZE 8 -#endif // CSI_22_23_PATCH /* XEMBED messages */ #define XEMBED_FOCUS_IN 4 @@ -75,14 +56,7 @@ static void zoomreset(const Arg *); static inline ushort sixd_to_16bit(int); static int xmakeglyphfontspecs(XftGlyphFontSpec *, const Glyph *, int, int, int); -#if WIDE_GLYPHS_PATCH -static void xdrawglyphfontspecs(const XftGlyphFontSpec *, Glyph, int, int, int, int); -#else static void xdrawglyphfontspecs(const XftGlyphFontSpec *, Glyph, int, int, int); -#endif // WIDE_GLYPHS_PATCH -#if LIGATURES_PATCH -static void xresetfontsettings(ushort mode, Font **font, int *frcflags); -#endif // LIGATURES_PATCH static void xdrawglyph(Glyph, int, int); static void xclear(int, int, int, int); static int xgeommasktogravity(int); @@ -120,9 +94,6 @@ static void selnotify(XEvent *); static void selclear_(XEvent *); static void selrequest(XEvent *); static void setsel(char *, Time); -#if XRESOURCES_PATCH && XRESOURCES_RELOAD_PATCH || BACKGROUND_IMAGE_PATCH && BACKGROUND_IMAGE_RELOAD_PATCH -static void sigusr1_reload(int sig); -#endif // XRESOURCES_RELOAD_PATCH | BACKGROUND_IMAGE_RELOAD_PATCH static int mouseaction(XEvent *, uint); static void mousesel(XEvent *, int); static void mousereport(XEvent *); @@ -156,10 +127,8 @@ static void (*handler[LASTEvent])(XEvent *) = { */ [PropertyNotify] = propnotify, [SelectionRequest] = selrequest, - #if ST_EMBEDDER_PATCH [CreateNotify] = createnotify, [DestroyNotify] = destroynotify, - #endif // ST_EMBEDDER_PATCH }; /* Globals */ @@ -169,10 +138,6 @@ XWindow xw; XSelection xsel; TermWindow win; -#if CSI_22_23_PATCH -static int tstki; /* title stack index */ -static char *titlestack[TITLESTACKSIZE]; /* title stack */ -#endif // CSI_22_23_PATCH /* Font Ring Cache */ enum { @@ -196,9 +161,7 @@ static char *usedfont = NULL; static double usedfontsize = 0; static double defaultfontsize = 0; -#if ALPHA_PATCH static char *opt_alpha = NULL; -#endif // ALPHA_PATCH static char *opt_class = NULL; static char **opt_cmd = NULL; static char *opt_embed = NULL; @@ -207,28 +170,10 @@ static char *opt_io = NULL; static char *opt_line = NULL; static char *opt_name = NULL; static char *opt_title = NULL; -#if WORKINGDIR_PATCH -static char *opt_dir = NULL; -#endif // WORKINGDIR_PATCH -#if ALPHA_PATCH && ALPHA_FOCUS_HIGHLIGHT_PATCH -static int focused = 0; -#endif // ALPHA_FOCUS_HIGHLIGHT_PATCH static uint buttons; /* bit field of pressed buttons */ -#if BLINKING_CURSOR_PATCH static int cursorblinks = 0; -#endif // BLINKING_CURSOR_PATCH -#if VISUALBELL_1_PATCH -static int bellon = 0; /* visual bell status */ -#endif // VISUALBELL_1_PATCH -#if RELATIVEBORDER_PATCH -int borderpx; -#endif // RELATIVEBORDER_PATCH -#if SWAPMOUSE_PATCH -static Cursor cursor; -static XColor xmousefg, xmousebg; -#endif // SWAPMOUSE_PATCH #include "patch/x_include.c" @@ -290,9 +235,7 @@ zoomabs(const Arg *arg) { xunloadfonts(); xloadfonts(usedfont, arg->f); - #if FONT2_PATCH xloadsparefonts(); - #endif // FONT2_PATCH cresize(0, 0); redraw(); xhints(); @@ -312,11 +255,7 @@ zoomreset(const Arg *arg) int evcol(XEvent *e) { - #if ANYSIZE_PATCH int x = e->xbutton.x - win.hborderpx; - #else - int x = e->xbutton.x - borderpx; - #endif // ANYSIZE_PATCH LIMIT(x, 0, win.tw - 1); return x / win.cw; } @@ -324,11 +263,7 @@ evcol(XEvent *e) int evrow(XEvent *e) { - #if ANYSIZE_PATCH int y = e->xbutton.y - win.vborderpx; - #else - int y = e->xbutton.y - borderpx; - #endif // ANYSIZE_PATCH LIMIT(y, 0, win.th - 1); return y / win.ch; } @@ -462,9 +397,7 @@ bpress(XEvent *e) { int btn = e->xbutton.button; struct timespec now; - #if !VIM_BROWSE_PATCH int snap; - #endif // VIM_BROWSE_PATCH if (1 <= btn && btn <= 11) buttons |= 1 << (btn-1); @@ -483,34 +416,6 @@ bpress(XEvent *e) * snapping behaviour is exposed. */ clock_gettime(CLOCK_MONOTONIC, &now); - #if VIM_BROWSE_PATCH - int const tripleClick = TIMEDIFF(now, xsel.tclick2) <= tripleclicktimeout, - doubleClick = TIMEDIFF(now, xsel.tclick1) <= doubleclicktimeout; - if ((mouseYank || mouseSelect) && (tripleClick || doubleClick)) { - if (!IS_SET(MODE_NORMAL)) normalMode(); - historyOpToggle(1, 1); - tmoveto(evcol(e), evrow(e)); - if (tripleClick) { - if (mouseYank) pressKeys("dVy", 3); - if (mouseSelect) pressKeys("dV", 2); - } else if (doubleClick) { - if (mouseYank) pressKeys("dyiW", 4); - if (mouseSelect) { - tmoveto(evcol(e), evrow(e)); - pressKeys("viW", 3); - } - } - historyOpToggle(-1, 1); - } else { - if (!IS_SET(MODE_NORMAL)) selstart(evcol(e), evrow(e), 0); - else { - historyOpToggle(1, 1); - tmoveto(evcol(e), evrow(e)); - pressKeys("v", 1); - historyOpToggle(-1, 1); - } - } - #else if (TIMEDIFF(now, xsel.tclick2) <= tripleclicktimeout) { snap = SNAP_LINE; } else if (TIMEDIFF(now, xsel.tclick1) <= doubleclicktimeout) { @@ -518,18 +423,11 @@ bpress(XEvent *e) } else { snap = 0; } - #endif // VIM_BROWSE_PATCH xsel.tclick2 = xsel.tclick1; xsel.tclick1 = now; - #if !VIM_BROWSE_PATCH selstart(evcol(e), evrow(e), snap); - #endif // VIM_BROWSE_PATCH - #if OPENURLONCLICK_PATCH - clearurl(); - url_click = 1; - #endif // OPENURLONCLICK_PATCH } } @@ -546,13 +444,6 @@ propnotify(XEvent *e) selnotify(e); } - #if BACKGROUND_IMAGE_PATCH - if (pseudotransparency && - !strncmp(XGetAtomName(xw.dpy, e->xproperty.atom), "_NET_WM_STATE", 13)) { - updatexy(); - redraw(); - } - #endif // BACKGROUND_IMAGE_PATCH } void @@ -583,11 +474,7 @@ selnotify(XEvent *e) return; } - #if BACKGROUND_IMAGE_PATCH - if (e->type == PropertyNotify && nitems == 0 && rem == 0 && !pseudotransparency) - #else if (e->type == PropertyNotify && nitems == 0 && rem == 0) - #endif // BACKGROUND_IMAGE_PATCH { /* * If there is some PropertyNotify with no data, then @@ -606,15 +493,9 @@ selnotify(XEvent *e) * when the selection owner does send us the next * chunk of data. */ - #if BACKGROUND_IMAGE_PATCH - if (!pseudotransparency) { - #endif // BACKGROUND_IMAGE_PATCH MODBIT(xw.attrs.event_mask, 1, PropertyChangeMask); XChangeWindowAttributes(xw.dpy, xw.win, CWEventMask, &xw.attrs); - #if BACKGROUND_IMAGE_PATCH - } - #endif // BACKGROUND_IMAGE_PATCH /* * Deleting the property is the transfer start signal. @@ -736,24 +617,8 @@ setsel(char *str, Time t) if (XGetSelectionOwner(xw.dpy, XA_PRIMARY) != xw.win) selclear(); - #if CLIPBOARD_PATCH - clipcopy(NULL); - #endif // CLIPBOARD_PATCH } -#if XRESOURCES_PATCH && XRESOURCES_RELOAD_PATCH || BACKGROUND_IMAGE_PATCH && BACKGROUND_IMAGE_RELOAD_PATCH -void -sigusr1_reload(int sig) -{ - #if XRESOURCES_PATCH && XRESOURCES_RELOAD_PATCH - reload_config(sig); - #endif // XRESOURCES_RELOAD_PATCH - #if BACKGROUND_IMAGE_PATCH && BACKGROUND_IMAGE_RELOAD_PATCH - reload_image(); - #endif // BACKGROUND_IMAGE_RELOAD_PATCH - signal(SIGUSR1, sigusr1_reload); -} -#endif // XRESOURCES_RELOAD_PATCH | BACKGROUND_IMAGE_RELOAD_PATCH void xsetsel(char *str) @@ -776,59 +641,14 @@ brelease(XEvent *e) if (mouseaction(e, 1)) return; - #if VIM_BROWSE_PATCH - if (btn == Button1 && !IS_SET(MODE_NORMAL)) { - mousesel(e, 1); - #if OPENURLONCLICK_PATCH - if (url_click && e->xkey.state & url_opener_modkey) - openUrlOnClick(evcol(e), evrow(e), url_opener); - #endif // OPENURLONCLICK_PATCH - } - #else if (btn == Button1) { mousesel(e, 1); - #if OPENURLONCLICK_PATCH - if (url_click && e->xkey.state & url_opener_modkey) - openUrlOnClick(evcol(e), evrow(e), url_opener); - #endif // OPENURLONCLICK_PATCH } - #endif // VIM_BROWSE_PATCH - #if RIGHTCLICKTOPLUMB_PATCH - else if (btn == Button3) - plumb(xsel.primary); - #endif // RIGHTCLICKTOPLUMB_PATCH } void bmotion(XEvent *e) { - #if HIDECURSOR_PATCH - if (!xw.pointerisvisible) { - #if SWAPMOUSE_PATCH - if (win.mode & MODE_MOUSE) - XUndefineCursor(xw.dpy, xw.win); - else - XDefineCursor(xw.dpy, xw.win, xw.vpointer); - #else - XDefineCursor(xw.dpy, xw.win, xw.vpointer); - #endif // SWAPMOUSE_PATCH - xw.pointerisvisible = 1; - if (!IS_SET(MODE_MOUSEMANY)) - xsetpointermotion(0); - } - #endif // HIDECURSOR_PATCH - #if OPENURLONCLICK_PATCH - #if VIM_BROWSE_PATCH - if (!IS_SET(MODE_NORMAL)) - #endif // VIM_BROWSE_PATCH - if (!IS_SET(MODE_MOUSE)) { - if (!(e->xbutton.state & Button1Mask) && detecturl(evcol(e), evrow(e), 1)) - XDefineCursor(xw.dpy, xw.win, xw.upointer); - else - XDefineCursor(xw.dpy, xw.win, xw.vpointer); - } - url_click = 0; - #endif // OPENURLONCLICK_PATCH if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forcemousemod)) { mousereport(e); @@ -853,10 +673,8 @@ cresize(int width, int height) col = MAX(1, col); row = MAX(1, row); - #if ANYSIZE_PATCH win.hborderpx = (win.w - col * win.cw) / 2; win.vborderpx = (win.h - row * win.ch) / 2; - #endif // ANYSIZE_PATCH tresize(col, row); xresize(col, row); @@ -869,17 +687,11 @@ xresize(int col, int row) win.tw = col * win.cw; win.th = row * win.ch; - #if !SINGLE_DRAWABLE_BUFFER_PATCH XFreePixmap(xw.dpy, xw.buf); xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, - #if ALPHA_PATCH xw.depth - #else - DefaultDepth(xw.dpy, xw.scr) - #endif // ALPHA_PATCH ); XftDrawChange(xw.draw, xw.buf); - #endif // SINGLE_DRAWABLE_BUFFER_PATCH xclear(0, 0, win.w, win.h); /* resize to new width */ @@ -916,55 +728,8 @@ xloadcolor(int i, const char *name, Color *ncolor) return XftColorAllocName(xw.dpy, xw.vis, xw.cmap, name, ncolor); } -#if VIM_BROWSE_PATCH -void normalMode() -{ - #if OPENURLONCLICK_PATCH - clearurl(); - restoremousecursor(); - #endif // OPENURLONCLICK_PATCH - historyModeToggle((win.mode ^=MODE_NORMAL) & MODE_NORMAL); -} -#endif // VIM_BROWSE_PATCH -#if ALPHA_PATCH && ALPHA_FOCUS_HIGHLIGHT_PATCH -void -xloadalpha(void) -{ - float const usedAlpha = focused ? alpha : alphaUnfocused; - if (opt_alpha) alpha = strtof(opt_alpha, NULL); - dc.col[defaultbg].color.alpha = (unsigned short)(0xffff * usedAlpha); - dc.col[defaultbg].pixel &= 0x00FFFFFF; - dc.col[defaultbg].pixel |= (unsigned char)(0xff * usedAlpha) << 24; -} -#endif // ALPHA_FOCUS_HIGHLIGHT_PATCH -#if ALPHA_PATCH && ALPHA_FOCUS_HIGHLIGHT_PATCH -void -xloadcols(void) -{ - static int loaded; - Color *cp; - - if (!loaded) { - dc.collen = 1 + (defaultbg = MAX(LEN(colorname), 256)); - dc.col = xmalloc((dc.collen) * sizeof(Color)); - } - - for (int i = 0; i+1 < dc.collen; ++i) - if (!xloadcolor(i, NULL, &dc.col[i])) { - if (colorname[i]) - die("could not allocate color '%s'\n", colorname[i]); - else - die("could not allocate color %d\n", i); - } - if (dc.collen) // cannot die, as the color is already loaded. - xloadcolor(focused ? bg : bgUnfocused, NULL, &dc.col[defaultbg]); - - xloadalpha(); - loaded = 1; -} -#else void xloadcols(void) { @@ -987,17 +752,14 @@ xloadcols(void) else die("could not allocate color %d\n", i); } - #if ALPHA_PATCH /* set alpha value of bg color */ if (opt_alpha) alpha = strtof(opt_alpha, NULL); dc.col[defaultbg].color.alpha = (unsigned short)(0xffff * alpha); dc.col[defaultbg].pixel &= 0x00FFFFFF; dc.col[defaultbg].pixel |= (unsigned char)(0xff * alpha) << 24; - #endif // ALPHA_PATCH loaded = 1; } -#endif // ALPHA_FOCUS_HIGHLIGHT_PATCH int xgetcolor(int x, unsigned char *r, unsigned char *g, unsigned char *b) @@ -1026,7 +788,6 @@ xsetcolorname(int x, const char *name) XftColorFree(xw.dpy, xw.vis, xw.cmap, &dc.col[x]); dc.col[x] = ncolor; - #if ALPHA_PATCH /* set alpha value of bg color */ if (x == defaultbg) { if (opt_alpha) @@ -1035,7 +796,6 @@ xsetcolorname(int x, const char *name) dc.col[defaultbg].pixel &= 0x00FFFFFF; dc.col[defaultbg].pixel |= (unsigned char)(0xff * alpha) << 24; } - #endif // ALPHA_PATCH return 0; } @@ -1045,22 +805,9 @@ xsetcolorname(int x, const char *name) void xclear(int x1, int y1, int x2, int y2) { - #if BACKGROUND_IMAGE_PATCH - if (pseudotransparency) - XSetTSOrigin(xw.dpy, xw.bggc, -win.x, -win.y); - XFillRectangle(xw.dpy, xw.buf, xw.bggc, x1, y1, x2-x1, y2-y1); - #elif INVERT_PATCH - Color c; - c = dc.col[IS_SET(MODE_REVERSE)? defaultfg : defaultbg]; - if (invertcolors) { - c = invertedcolor(&c); - } - XftDrawRect(xw.draw, &c, x1, y1, x2-x1, y2-y1); - #else XftDrawRect(xw.draw, &dc.col[IS_SET(MODE_REVERSE)? defaultfg : defaultbg], x1, y1, x2-x1, y2-y1); - #endif // INVERT_PATCH } void @@ -1072,13 +819,8 @@ xclearwin(void) void xhints(void) { - #if XRESOURCES_PATCH - XClassHint class = {opt_name ? opt_name : "st", - opt_class ? opt_class : "St"}; - #else XClassHint class = {opt_name ? opt_name : termname, opt_class ? opt_class : termname}; - #endif // XRESOURCES_PATCH XWMHints wm = {.flags = InputHint, .input = 1}; XSizeHints *sizeh; @@ -1087,13 +829,8 @@ xhints(void) sizeh->flags = PSize | PResizeInc | PBaseSize | PMinSize; sizeh->height = win.h; sizeh->width = win.w; - #if ANYSIZE_PATCH || ANYSIZE_SIMPLE_PATCH sizeh->height_inc = 1; sizeh->width_inc = 1; - #else - sizeh->height_inc = win.ch; - sizeh->width_inc = win.cw; - #endif // ANYSIZE_PATCH sizeh->base_height = 2 * borderpx; sizeh->base_width = 2 * borderpx; sizeh->min_height = win.ch + 2 * borderpx; @@ -1205,11 +942,7 @@ xloadfont(Font *f, FcPattern *pattern) FcConfigSubstitute(NULL, configured, FcMatchPattern); XftDefaultSubstitute(xw.dpy, xw.scr, configured); - #if USE_XFTFONTMATCH_PATCH - match = XftFontMatch(xw.dpy, xw.scr, pattern, &result); - #else match = FcFontMatch(NULL, configured, &result); - #endif // USE_XFTFONTMATCH_PATCH if (!match) { FcPatternDestroy(configured); return 1; @@ -1256,11 +989,7 @@ xloadfont(Font *f, FcPattern *pattern) f->rbearing = f->match->max_advance_width; f->height = f->ascent + f->descent; - #if WIDE_GLYPH_SPACING_PATCH - f->width = DIVCEIL(extents.xOff > 18 ? extents.xOff / 3 : extents.xOff, strlen(ascii_printable)); - #else f->width = DIVCEIL(extents.xOff, strlen(ascii_printable)); - #endif // WIDE_GLYPH_SPACING_PATCH return 0; } @@ -1316,31 +1045,19 @@ xloadfonts(const char *fontstr, double fontsize) /* Setting character width and height. */ win.cw = ceilf(dc.font.width * cwscale); win.ch = ceilf(dc.font.height * chscale); - #if VERTCENTER_PATCH - win.cyo = ceilf(dc.font.height * (chscale - 1) / 2); - #endif // VERTCENTER_PATCH - #if RELATIVEBORDER_PATCH - borderpx = (int) ceilf(((float)borderperc / 100) * win.cw); - #endif // RELATIVEBORDER_PATCH FcPatternDel(pattern, FC_SLANT); - #if !DISABLE_ITALIC_FONTS_PATCH FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC); - #endif // DISABLE_ITALIC_FONTS_PATCH if (xloadfont(&dc.ifont, pattern)) die("can't open font %s\n", fontstr); FcPatternDel(pattern, FC_WEIGHT); - #if !DISABLE_BOLD_FONTS_PATCH FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD); - #endif // DISABLE_BOLD_FONTS_PATCH if (xloadfont(&dc.ibfont, pattern)) die("can't open font %s\n", fontstr); FcPatternDel(pattern, FC_SLANT); - #if !DISABLE_ROMAN_FONTS_PATCH FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ROMAN); - #endif // DISABLE_ROMAN_FONTS_PATCH if (xloadfont(&dc.bfont, pattern)) die("can't open font %s\n", fontstr); @@ -1359,10 +1076,6 @@ xunloadfont(Font *f) void xunloadfonts(void) { - #if LIGATURES_PATCH - /* Clear Harfbuzz font cache. */ - hbunloadfonts(); - #endif // LIGATURES_PATCH /* Free the loaded fonts in the font cache. */ while (frclen > 0) @@ -1378,28 +1091,17 @@ void xinit(int cols, int rows) { XGCValues gcvalues; - #if HIDECURSOR_PATCH - Pixmap blankpm; - #elif !SWAPMOUSE_PATCH Cursor cursor; - #endif // HIDECURSOR_PATCH Window parent; pid_t thispid = getpid(); - #if !SWAPMOUSE_PATCH XColor xmousefg, xmousebg; - #endif // SWAPMOUSE_PATCH - #if ALPHA_PATCH XWindowAttributes attr; XVisualInfo vis; - #endif // ALPHA_PATCH - #if !XRESOURCES_PATCH if (!(xw.dpy = XOpenDisplay(NULL))) die("can't open display\n"); - #endif // XRESOURCES_PATCH xw.scr = XDefaultScreen(xw.dpy); - #if ALPHA_PATCH if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0)))) { parent = XRootWindow(xw.dpy, xw.scr); xw.depth = 32; @@ -1410,9 +1112,6 @@ xinit(int cols, int rows) XMatchVisualInfo(xw.dpy, xw.scr, xw.depth, TrueColor, &vis); xw.vis = vis.visual; - #else - xw.vis = XDefaultVisual(xw.dpy, xw.scr); - #endif // ALPHA_PATCH /* font */ if (!FcInit()) @@ -1421,27 +1120,16 @@ xinit(int cols, int rows) usedfont = (opt_font == NULL)? font : opt_font; xloadfonts(usedfont, 0); - #if FONT2_PATCH /* spare fonts */ xloadsparefonts(); - #endif // FONT2_PATCH /* colors */ - #if ALPHA_PATCH xw.cmap = XCreateColormap(xw.dpy, parent, xw.vis, None); - #else - xw.cmap = XDefaultColormap(xw.dpy, xw.scr); - #endif // ALPHA_PATCH xloadcols(); /* adjust fixed window geometry */ - #if ANYSIZE_PATCH win.w = 2 * win.hborderpx + cols * win.cw; win.h = 2 * win.vborderpx + rows * win.ch; - #else - win.w = 2 * borderpx + cols * win.cw; - win.h = 2 * borderpx + rows * win.ch; - #endif // ANYSIZE_PATCH if (xw.gm & XNegative) xw.l += DisplayWidth(xw.dpy, xw.scr) - win.w - 2; if (xw.gm & YNegative) @@ -1454,48 +1142,20 @@ xinit(int cols, int rows) xw.attrs.event_mask = FocusChangeMask | KeyPressMask | KeyReleaseMask | ExposureMask | VisibilityChangeMask | StructureNotifyMask | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask - #if ST_EMBEDDER_PATCH | SubstructureNotifyMask | SubstructureRedirectMask - #endif // ST_EMBEDDER_PATCH ; xw.attrs.colormap = xw.cmap; - #if OPENURLONCLICK_PATCH - xw.attrs.event_mask |= PointerMotionMask; - #endif // OPENURLONCLICK_PATCH - #if !ALPHA_PATCH - if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0)))) - parent = XRootWindow(xw.dpy, xw.scr); - #endif // ALPHA_PATCH xw.win = XCreateWindow(xw.dpy, parent, xw.l, xw.t, - #if ALPHA_PATCH win.w, win.h, 0, xw.depth, InputOutput, - #else - win.w, win.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput, - #endif // ALPHA_PATCH xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity | CWEventMask | CWColormap, &xw.attrs); memset(&gcvalues, 0, sizeof(gcvalues)); gcvalues.graphics_exposures = False; - #if ALPHA_PATCH - #if SINGLE_DRAWABLE_BUFFER_PATCH - xw.buf = xw.win; - #else xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, xw.depth); - #endif // SINGLE_DRAWABLE_BUFFER_PATCH dc.gc = XCreateGC(xw.dpy, xw.buf, GCGraphicsExposures, &gcvalues); - #else - dc.gc = XCreateGC(xw.dpy, parent, GCGraphicsExposures, - &gcvalues); - #if SINGLE_DRAWABLE_BUFFER_PATCH - xw.buf = xw.win; - #else - xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, - DefaultDepth(xw.dpy, xw.scr)); - #endif // SINGLE_DRAWABLE_BUFFER_PATCH - #endif // ALPHA_PATCH XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel); XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, win.w, win.h); @@ -1512,23 +1172,9 @@ xinit(int cols, int rows) } /* white cursor, black outline */ - #if HIDECURSOR_PATCH - xw.pointerisvisible = 1; - #if THEMED_CURSOR_PATCH - xw.vpointer = XcursorLibraryLoadCursor(xw.dpy, mouseshape); - #else - xw.vpointer = XCreateFontCursor(xw.dpy, mouseshape); - #endif // THEMED_CURSOR_PATCH - XDefineCursor(xw.dpy, xw.win, xw.vpointer); - #elif THEMED_CURSOR_PATCH - cursor = XcursorLibraryLoadCursor(xw.dpy, mouseshape); - XDefineCursor(xw.dpy, xw.win, cursor); - #else cursor = XCreateFontCursor(xw.dpy, mouseshape); XDefineCursor(xw.dpy, xw.win, cursor); - #endif // HIDECURSOR_PATCH - #if !THEMED_CURSOR_PATCH if (XParseColor(xw.dpy, xw.cmap, colorname[mousefg], &xmousefg) == 0) { xmousefg.red = 0xffff; xmousefg.green = 0xffff; @@ -1540,26 +1186,9 @@ xinit(int cols, int rows) xmousebg.green = 0x0000; xmousebg.blue = 0x0000; } - #endif // THEMED_CURSOR_PATCH - #if HIDECURSOR_PATCH - #if !THEMED_CURSOR_PATCH - XRecolorCursor(xw.dpy, xw.vpointer, &xmousefg, &xmousebg); - #endif // THEMED_CURSOR_PATCH - blankpm = XCreateBitmapFromData(xw.dpy, xw.win, &(char){0}, 1, 1); - xw.bpointer = XCreatePixmapCursor(xw.dpy, blankpm, blankpm, - &xmousefg, &xmousebg, 0, 0); - #elif !THEMED_CURSOR_PATCH XRecolorCursor(xw.dpy, cursor, &xmousefg, &xmousebg); - #endif // HIDECURSOR_PATCH - #if OPENURLONCLICK_PATCH - xw.upointer = XCreateFontCursor(xw.dpy, XC_hand2); - #if !HIDECURSOR_PATCH - xw.vpointer = cursor; - xw.pointerisvisible = 1; - #endif // HIDECURSOR_PATCH - #endif // OPENURLONCLICK_PATCH xw.xembed = XInternAtom(xw.dpy, "_XEMBED", False); xw.wmdeletewin = XInternAtom(xw.dpy, "WM_DELETE_WINDOW", False); @@ -1567,27 +1196,12 @@ xinit(int cols, int rows) xw.netwmiconname = XInternAtom(xw.dpy, "_NET_WM_ICON_NAME", False); XSetWMProtocols(xw.dpy, xw.win, &xw.wmdeletewin, 1); - #if NETWMICON_PATCH - xw.netwmicon = XInternAtom(xw.dpy, "_NET_WM_ICON", False); - XChangeProperty(xw.dpy, xw.win, xw.netwmicon, XA_CARDINAL, 32, - PropModeReplace, (uchar *)&icon, LEN(icon)); - #endif //NETWMICON_PATCH - #if NO_WINDOW_DECORATIONS_PATCH - Atom motifwmhints = XInternAtom(xw.dpy, "_MOTIF_WM_HINTS", False); - unsigned int data[] = { 0x2, 0x0, 0x0, 0x0, 0x0 }; - XChangeProperty(xw.dpy, xw.win, motifwmhints, motifwmhints, 16, - PropModeReplace, (unsigned char *)data, 5); - #endif // NO_WINDOW_DECORATIONS_PATCH xw.netwmpid = XInternAtom(xw.dpy, "_NET_WM_PID", False); XChangeProperty(xw.dpy, xw.win, xw.netwmpid, XA_CARDINAL, 32, PropModeReplace, (uchar *)&thispid, 1); - #if FULLSCREEN_PATCH - xw.netwmstate = XInternAtom(xw.dpy, "_NET_WM_STATE", False); - xw.netwmfullscreen = XInternAtom(xw.dpy, "_NET_WM_STATE_FULLSCREEN", False); - #endif // FULLSCREEN_PATCH win.mode = MODE_NUMLOCK; resettitle(); @@ -1603,37 +1217,13 @@ xinit(int cols, int rows) if (xsel.xtarget == None) xsel.xtarget = XA_STRING; - #if BOXDRAW_PATCH - boxdraw_xinit(xw.dpy, xw.cmap, xw.draw, xw.vis); - #endif // BOXDRAW_PATCH } -#if LIGATURES_PATCH -void -xresetfontsettings(ushort mode, Font **font, int *frcflags) -{ - *font = &dc.font; - if ((mode & ATTR_ITALIC) && (mode & ATTR_BOLD)) { - *font = &dc.ibfont; - *frcflags = FRC_ITALICBOLD; - } else if (mode & ATTR_ITALIC) { - *font = &dc.ifont; - *frcflags = FRC_ITALIC; - } else if (mode & ATTR_BOLD) { - *font = &dc.bfont; - *frcflags = FRC_BOLD; - } -} -#endif // LIGATURES_PATCH int xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x, int y) { - #if ANYSIZE_PATCH float winx = win.hborderpx + x * win.cw, winy = win.vborderpx + y * win.ch, xp, yp; - #else - float winx = borderpx + x * win.cw, winy = borderpx + y * win.ch, xp, yp; - #endif // ANYSIZE_PATCH ushort mode, prevmode = USHRT_MAX; Font *font = &dc.font; int frcflags = FRC_NORMAL; @@ -1645,163 +1235,14 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x FcFontSet *fcsets[] = { NULL }; FcCharSet *fccharset; int i, f, numspecs = 0; - #if LIGATURES_PATCH - int length = 0, start = 0; - HbTransformData shaped = { 0 }; - /* Initial values. */ - mode = prevmode = glyphs[0].mode; - xresetfontsettings(mode, &font, &frcflags); - #endif // LIGATURES_PATCH - - #if VERTCENTER_PATCH - for (i = 0, xp = winx, yp = winy + font->ascent + win.cyo; i < len; ++i) - #else for (i = 0, xp = winx, yp = winy + font->ascent; i < len; ++i) - #endif // VERTCENTER_PATCH { /* Fetch rune and mode for current glyph. */ - #if VIM_BROWSE_PATCH - Glyph g = glyphs[i]; - historyOverlay(x+i, y, &g); - rune = g.u; - mode = g.mode; - #elif LIGATURES_PATCH - mode = glyphs[i].mode; - #else rune = glyphs[i].u; mode = glyphs[i].mode; - #endif // VIM_BROWSE_PATCH | LIGATURES_PATCH /* Skip dummy wide-character spacing. */ - #if LIGATURES_PATCH - if (mode & ATTR_WDUMMY) - continue; - - if ( - prevmode != mode - || ATTRCMP(glyphs[start], glyphs[i]) - || selected(x + i, y) != selected(x + start, y) - || i == (len - 1) - ) { - /* Handle 1-character wide segments and end of line */ - length = i - start; - if (i == start) { - length = 1; - } else if (i == (len - 1)) { - length = (i - start + 1); - } - - /* Shape the segment. */ - hbtransform(&shaped, font->match, glyphs, start, length); - for (int code_idx = 0; code_idx < shaped.count; code_idx++) { - rune = glyphs[start + code_idx].u; - runewidth = win.cw * ((glyphs[start + code_idx].mode & ATTR_WIDE) ? 2.0f : 1.0f); - - if (glyphs[start + code_idx].mode & ATTR_WDUMMY) - continue; - - #if BOXDRAW_PATCH - if (glyphs[start + code_idx].mode & ATTR_BOXDRAW) { - /* minor shoehorning: boxdraw uses only this ushort */ - specs[numspecs].font = font->match; - specs[numspecs].glyph = boxdrawindex(&glyphs[start + code_idx]); - specs[numspecs].x = xp; - specs[numspecs].y = yp; - xp += runewidth; - numspecs++; - } else - #endif // BOXDRAW_PATCH - if (shaped.glyphs[code_idx].codepoint != 0) { - /* If symbol is found, put it into the specs. */ - specs[numspecs].font = font->match; - specs[numspecs].glyph = shaped.glyphs[code_idx].codepoint; - specs[numspecs].x = xp + (short)shaped.positions[code_idx].x_offset; - specs[numspecs].y = yp + (short)shaped.positions[code_idx].y_offset; - xp += runewidth; - numspecs++; - } else { - /* If it's not found, try to fetch it through the font cache. */ - for (f = 0; f < frclen; f++) { - glyphidx = XftCharIndex(xw.dpy, frc[f].font, rune); - /* Everything correct. */ - if (glyphidx && frc[f].flags == frcflags) - break; - /* We got a default font for a not found glyph. */ - if (!glyphidx && frc[f].flags == frcflags - && frc[f].unicodep == rune) { - break; - } - } - - /* Nothing was found. Use fontconfig to find matching font. */ - if (f >= frclen) { - if (!font->set) - font->set = FcFontSort(0, font->pattern, 1, 0, &fcres); - fcsets[0] = font->set; - - /* - * Nothing was found in the cache. Now use - * some dozen of Fontconfig calls to get the - * font for one single character. - * - * Xft and fontconfig are design failures. - */ - fcpattern = FcPatternDuplicate(font->pattern); - fccharset = FcCharSetCreate(); - - FcCharSetAddChar(fccharset, rune); - FcPatternAddCharSet(fcpattern, FC_CHARSET, fccharset); - FcPatternAddBool(fcpattern, FC_SCALABLE, 1); - - FcConfigSubstitute(0, fcpattern, FcMatchPattern); - FcDefaultSubstitute(fcpattern); - - fontpattern = FcFontSetMatch(0, fcsets, 1, fcpattern, &fcres); - - /* Allocate memory for the new cache entry. */ - if (frclen >= frccap) { - frccap += 16; - frc = xrealloc(frc, frccap * sizeof(Fontcache)); - } - - frc[frclen].font = XftFontOpenPattern(xw.dpy, fontpattern); - if (!frc[frclen].font) - die("XftFontOpenPattern failed seeking fallback font: %s\n", - strerror(errno)); - frc[frclen].flags = frcflags; - frc[frclen].unicodep = rune; - - glyphidx = XftCharIndex(xw.dpy, frc[frclen].font, rune); - - f = frclen; - frclen++; - - FcPatternDestroy(fcpattern); - FcCharSetDestroy(fccharset); - } - - specs[numspecs].font = frc[f].font; - specs[numspecs].glyph = glyphidx; - specs[numspecs].x = (short)xp; - specs[numspecs].y = (short)yp; - xp += runewidth; - numspecs++; - } - } - - /* Cleanup and get ready for next segment. */ - hbcleanup(&shaped); - start = i; - - /* Determine font for glyph if different from previous glyph. */ - if (prevmode != mode) { - prevmode = mode; - xresetfontsettings(mode, &font, &frcflags); - yp = winy + font->ascent; - } - } - #else // !LIGATURES_PATCH if (mode == ATTR_WDUMMY) continue; @@ -1821,25 +1262,11 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x font = &dc.bfont; frcflags = FRC_BOLD; } - #if VERTCENTER_PATCH - yp = winy + font->ascent + win.cyo; - #else yp = winy + font->ascent; - #endif // VERTCENTER_PATCH } - #if BOXDRAW_PATCH - if (mode & ATTR_BOXDRAW) { - /* minor shoehorning: boxdraw uses only this ushort */ - glyphidx = boxdrawindex(&glyphs[i]); - } else { - /* Lookup character index with default font. */ - glyphidx = XftCharIndex(xw.dpy, font->match, rune); - } - #else /* Lookup character index with default font. */ glyphidx = XftCharIndex(xw.dpy, font->match, rune); - #endif // BOXDRAW_PATCH if (glyphidx) { specs[numspecs].font = font->match; specs[numspecs].glyph = glyphidx; @@ -1883,10 +1310,8 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x FcPatternAddCharSet(fcpattern, FC_CHARSET, fccharset); FcPatternAddBool(fcpattern, FC_SCALABLE, 1); - #if !USE_XFTFONTMATCH_PATCH FcConfigSubstitute(0, fcpattern, FcMatchPattern); FcDefaultSubstitute(fcpattern); - #endif // USE_XFTFONTMATCH_PATCH fontpattern = FcFontSetMatch(0, fcsets, 1, fcpattern, &fcres); @@ -1918,72 +1343,17 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x specs[numspecs].y = (short)yp; xp += runewidth; numspecs++; - #endif // LIGATURES_PATCH } return numspecs; } -#if UNDERCURL_PATCH -static int isSlopeRising (int x, int iPoint, int waveWidth) -{ - // . . . . - // / \ / \ / \ / \ - // / \ / \ / \ / \ - // . . . . . - - // Find absolute `x` of point - x += iPoint * (waveWidth/2); - - // Find index of absolute wave - int absSlope = x / ((float)waveWidth/2); - - return (absSlope % 2); -} - -static int getSlope (int x, int iPoint, int waveWidth) -{ - // Sizes: Caps are half width of slopes - // 1_2 1_2 1_2 1_2 - // / \ / \ / \ / \ - // / \ / \ / \ / \ - // 0 3_0 3_0 3_0 3_ - // <2-> <1> <---6----> - - // Find type of first point - int firstType; - x -= (x / waveWidth) * waveWidth; - if (x < (waveWidth * (2.f/6.f))) - firstType = UNDERCURL_SLOPE_ASCENDING; - else if (x < (waveWidth * (3.f/6.f))) - firstType = UNDERCURL_SLOPE_TOP_CAP; - else if (x < (waveWidth * (5.f/6.f))) - firstType = UNDERCURL_SLOPE_DESCENDING; - else - firstType = UNDERCURL_SLOPE_BOTTOM_CAP; - - // Find type of given point - int pointType = (iPoint % 4); - pointType += firstType; - pointType %= 4; - - return pointType; -} -#endif // UNDERCURL_PATCH void -#if WIDE_GLYPHS_PATCH -xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, int y, int dmode) -#else xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, int y) -#endif // WIDE_GLYPHS_PATCH { int charlen = len * ((base.mode & ATTR_WIDE) ? 2 : 1); - #if ANYSIZE_PATCH int winx = win.hborderpx + x * win.cw, winy = win.vborderpx + y * win.ch; - #else - int winx = borderpx + x * win.cw, winy = borderpx + y * win.ch; - #endif // ANYSIZE_PATCH int width = charlen * win.cw; Color *fg, *bg, *temp, revfg, revbg, truefg, truebg; XRenderColor colfg, colbg; @@ -2020,11 +1390,9 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i bg = &dc.col[base.bg]; } - #if !BOLD_IS_NOT_BRIGHT_PATCH /* Change basic system colors [0-7] to bright system colors [8-15] */ if ((base.mode & ATTR_BOLD_FAINT) == ATTR_BOLD && BETWEEN(base.fg, 0, 7)) fg = &dc.col[base.fg + 8]; - #endif // BOLD_IS_NOT_BRIGHT_PATCH if (IS_SET(MODE_REVERSE)) { if (fg == &dc.col[defaultfg]) { @@ -2062,20 +1430,9 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i } if (base.mode & ATTR_REVERSE) { - #if SPOILER_PATCH - if (bg == fg) { - bg = &dc.col[defaultfg]; - fg = &dc.col[defaultbg]; - } else { - temp = fg; - fg = bg; - bg = temp; - } - #else temp = fg; fg = bg; bg = temp; - #endif // SPOILER_PATCH } if (base.mode & ATTR_BLINK && win.mode & MODE_BLINK) @@ -2084,27 +1441,9 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i if (base.mode & ATTR_INVISIBLE) fg = bg; - #if INVERT_PATCH - if (invertcolors) { - revfg = invertedcolor(fg); - revbg = invertedcolor(bg); - fg = &revfg; - bg = &revbg; - } - #endif // INVERT_PATCH - #if ALPHA_PATCH && ALPHA_GRADIENT_PATCH - // gradient - bg->color.alpha = grad_alpha * 0xffff * (win.h - y*win.ch) / win.h + stat_alpha * 0xffff; - // uncomment to invert the gradient - // bg->color.alpha = grad_alpha * 0xffff * (y*win.ch) / win.h + stat_alpha * 0xffff; - #endif // ALPHA_PATCH | ALPHA_GRADIENT_PATCH - #if WIDE_GLYPHS_PATCH - if (dmode & DRAW_BG) { - #endif // WIDE_GLYPHS_PATCH /* Intelligent cleaning up of the borders. */ - #if ANYSIZE_PATCH if (x == 0) { xclear(0, (y == 0)? 0 : winy, win.hborderpx, winy + win.ch + @@ -2118,32 +1457,10 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i xclear(winx, 0, winx + width, win.vborderpx); if (winy + win.ch >= win.vborderpx + win.th) xclear(winx, winy + win.ch, winx + width, win.h); - #else - if (x == 0) { - xclear(0, (y == 0)? 0 : winy, borderpx, - winy + win.ch + - ((winy + win.ch >= borderpx + win.th)? win.h : 0)); - } - if (winx + width >= borderpx + win.tw) { - xclear(winx + width, (y == 0)? 0 : winy, win.w, - ((winy + win.ch >= borderpx + win.th)? win.h : (winy + win.ch))); - } - if (y == 0) - xclear(winx, 0, winx + width, borderpx); - if (winy + win.ch >= borderpx + win.th) - xclear(winx, winy + win.ch, winx + width, win.h); - #endif // ANYSIZE_PATCH /* Clean up the region we want to draw to. */ - #if BACKGROUND_IMAGE_PATCH - if (bg == &dc.col[defaultbg]) - xclear(winx, winy, winx + width, winy + win.ch); - else - #endif // BACKGROUND_IMAGE_PATCH - #if !WIDE_GLYPHS_PATCH XftDrawRect(xw.draw, bg, winx, winy, width, win.ch); - #endif // WIDE_GLYPHS_PATCH /* Set the clip region because Xft is sometimes dirty. */ r.x = 0; @@ -2152,426 +1469,21 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i r.width = width; XftDrawSetClipRectangles(xw.draw, winx, winy, &r, 1); - #if WIDE_GLYPHS_PATCH - /* Fill the background */ - XftDrawRect(xw.draw, bg, winx, winy, width, win.ch); - } - #endif // WIDE_GLYPHS_PATCH - #if WIDE_GLYPHS_PATCH - if (dmode & DRAW_FG) { - #endif // WIDE_GLYPHS_PATCH - #if BOXDRAW_PATCH - if (base.mode & ATTR_BOXDRAW) { - drawboxes(winx, winy, width / len, win.ch, fg, bg, specs, len); - } else { - /* Render the glyphs. */ - XftDrawGlyphFontSpec(xw.draw, fg, specs, len); - } - #else /* Render the glyphs. */ XftDrawGlyphFontSpec(xw.draw, fg, specs, len); - #endif // BOXDRAW_PATCH /* Render underline and strikethrough. */ if (base.mode & ATTR_UNDERLINE) { - #if UNDERCURL_PATCH - // Underline Color - const int widthThreshold = 28; // +1 width every widthThreshold px of font - int wlw = (win.ch / widthThreshold) + 1; // Wave Line Width - int linecolor; - if ((base.ucolor[0] >= 0) && - !(base.mode & ATTR_BLINK && win.mode & MODE_BLINK) && - !(base.mode & ATTR_INVISIBLE) - ) { - // Special color for underline - // Index - if (base.ucolor[1] < 0) { - linecolor = dc.col[base.ucolor[0]].pixel; - } - // RGB - else { - XColor lcolor; - lcolor.red = base.ucolor[0] * 257; - lcolor.green = base.ucolor[1] * 257; - lcolor.blue = base.ucolor[2] * 257; - lcolor.flags = DoRed | DoGreen | DoBlue; - XAllocColor(xw.dpy, xw.cmap, &lcolor); - linecolor = lcolor.pixel; - } - } else { - // Foreground color for underline - linecolor = fg->pixel; - } - - XGCValues ugcv = { - .foreground = linecolor, - .line_width = wlw, - .line_style = LineSolid, - .cap_style = CapNotLast - }; - - GC ugc = XCreateGC(xw.dpy, XftDrawDrawable(xw.draw), - GCForeground | GCLineWidth | GCLineStyle | GCCapStyle, - &ugcv); - - // Underline Style - if (base.ustyle != 3) { - XFillRectangle(xw.dpy, XftDrawDrawable(xw.draw), ugc, winx, - winy + dc.font.ascent * chscale + 1, width, wlw); - } else if (base.ustyle == 3) { - int ww = win.cw;//width; - int wh = dc.font.descent - wlw/2 - 1;//r.height/7; - int wx = winx; - int wy = winy + win.ch - dc.font.descent; - #if VERTCENTER_PATCH - wy -= win.cyo; - #endif // VERTCENTER_PATCH - -#if UNDERCURL_STYLE == UNDERCURL_CURLY - // Draw waves - int narcs = charlen * 2 + 1; - XArc *arcs = xmalloc(sizeof(XArc) * narcs); - - int i = 0; - for (i = 0; i < charlen-1; i++) { - arcs[i*2] = (XArc) { - .x = wx + win.cw * i + ww / 4, - .y = wy, - .width = win.cw / 2, - .height = wh, - .angle1 = 0, - .angle2 = 180 * 64 - }; - arcs[i*2+1] = (XArc) { - .x = wx + win.cw * i + ww * 0.75, - .y = wy, - .width = win.cw/2, - .height = wh, - .angle1 = 180 * 64, - .angle2 = 180 * 64 - }; - } - // Last wave - arcs[i*2] = (XArc) {wx + ww * i + ww / 4, wy, ww / 2, wh, - 0, 180 * 64 }; - // Last wave tail - arcs[i*2+1] = (XArc) {wx + ww * i + ww * 0.75, wy, ceil(ww / 2.), - wh, 180 * 64, 90 * 64}; - // First wave tail - i++; - arcs[i*2] = (XArc) {wx - ww/4 - 1, wy, ceil(ww / 2.), wh, 270 * 64, - 90 * 64 }; - - XDrawArcs(xw.dpy, XftDrawDrawable(xw.draw), ugc, arcs, narcs); - - free(arcs); -#elif UNDERCURL_STYLE == UNDERCURL_SPIKY - // Make the underline corridor larger - /* - wy -= wh; - */ - wh *= 2; - - // Set the angle of the slope to 45° - ww = wh; - - // Position of wave is independent of word, it's absolute - wx = (wx / (ww/2)) * (ww/2); - - int marginStart = winx - wx; - - // Calculate number of points with floating precision - float n = width; // Width of word in pixels - n = (n / ww) * 2; // Number of slopes (/ or \) - n += 2; // Add two last points - int npoints = n; // Convert to int - - // Total length of underline - float waveLength = 0; - - if (npoints >= 3) { - // We add an aditional slot in case we use a bonus point - XPoint *points = xmalloc(sizeof(XPoint) * (npoints + 1)); - - // First point (Starts with the word bounds) - points[0] = (XPoint) { - .x = wx + marginStart, - .y = (isSlopeRising(wx, 0, ww)) - ? (wy - marginStart + ww/2.f) - : (wy + marginStart) - }; - - // Second point (Goes back to the absolute point coordinates) - points[1] = (XPoint) { - .x = (ww/2.f) - marginStart, - .y = (isSlopeRising(wx, 1, ww)) - ? (ww/2.f - marginStart) - : (-ww/2.f + marginStart) - }; - waveLength += (ww/2.f) - marginStart; - - // The rest of the points - for (int i = 2; i < npoints-1; i++) { - points[i] = (XPoint) { - .x = ww/2, - .y = (isSlopeRising(wx, i, ww)) - ? wh/2 - : -wh/2 - }; - waveLength += ww/2; - } - - // Last point - points[npoints-1] = (XPoint) { - .x = ww/2, - .y = (isSlopeRising(wx, npoints-1, ww)) - ? wh/2 - : -wh/2 - }; - waveLength += ww/2; - - // End - if (waveLength < width) { // Add a bonus point? - int marginEnd = width - waveLength; - points[npoints] = (XPoint) { - .x = marginEnd, - .y = (isSlopeRising(wx, npoints, ww)) - ? (marginEnd) - : (-marginEnd) - }; - - npoints++; - } else if (waveLength > width) { // Is last point too far? - int marginEnd = waveLength - width; - points[npoints-1].x -= marginEnd; - if (isSlopeRising(wx, npoints-1, ww)) - points[npoints-1].y -= (marginEnd); - else - points[npoints-1].y += (marginEnd); - } - - // Draw the lines - XDrawLines(xw.dpy, XftDrawDrawable(xw.draw), ugc, points, npoints, - CoordModePrevious); - - // Draw a second underline with an offset of 1 pixel - if ( ((win.ch / (widthThreshold/2)) % 2)) { - points[0].x++; - - XDrawLines(xw.dpy, XftDrawDrawable(xw.draw), ugc, points, - npoints, CoordModePrevious); - } - - // Free resources - free(points); - } -#else // UNDERCURL_CAPPED - // Cap is half of wave width - float capRatio = 0.5f; - - // Make the underline corridor larger - wh *= 2; - - // Set the angle of the slope to 45° - ww = wh; - ww *= 1 + capRatio; // Add a bit of width for the cap - - // Position of wave is independent of word, it's absolute - wx = (wx / ww) * ww; - - float marginStart; - switch(getSlope(winx, 0, ww)) { - case UNDERCURL_SLOPE_ASCENDING: - marginStart = winx - wx; - break; - case UNDERCURL_SLOPE_TOP_CAP: - marginStart = winx - (wx + (ww * (2.f/6.f))); - break; - case UNDERCURL_SLOPE_DESCENDING: - marginStart = winx - (wx + (ww * (3.f/6.f))); - break; - case UNDERCURL_SLOPE_BOTTOM_CAP: - marginStart = winx - (wx + (ww * (5.f/6.f))); - break; - } - - // Calculate number of points with floating precision - float n = width; // Width of word in pixels - // ._. - n = (n / ww) * 4; // Number of points (./ \.) - n += 2; // Add two last points - int npoints = n; // Convert to int - - // Position of the pen to draw the lines - float penX = 0; - float penY = 0; - - if (npoints >= 3) { - XPoint *points = xmalloc(sizeof(XPoint) * (npoints + 1)); - - // First point (Starts with the word bounds) - penX = winx; - switch (getSlope(winx, 0, ww)) { - case UNDERCURL_SLOPE_ASCENDING: - penY = wy + wh/2.f - marginStart; - break; - case UNDERCURL_SLOPE_TOP_CAP: - penY = wy; - break; - case UNDERCURL_SLOPE_DESCENDING: - penY = wy + marginStart; - break; - case UNDERCURL_SLOPE_BOTTOM_CAP: - penY = wy + wh/2.f; - break; - } - points[0].x = penX; - points[0].y = penY; - - // Second point (Goes back to the absolute point coordinates) - switch (getSlope(winx, 1, ww)) { - case UNDERCURL_SLOPE_ASCENDING: - penX += ww * (1.f/6.f) - marginStart; - penY += 0; - break; - case UNDERCURL_SLOPE_TOP_CAP: - penX += ww * (2.f/6.f) - marginStart; - penY += -wh/2.f + marginStart; - break; - case UNDERCURL_SLOPE_DESCENDING: - penX += ww * (1.f/6.f) - marginStart; - penY += 0; - break; - case UNDERCURL_SLOPE_BOTTOM_CAP: - penX += ww * (2.f/6.f) - marginStart; - penY += -marginStart + wh/2.f; - break; - } - points[1].x = penX; - points[1].y = penY; - - // The rest of the points - for (int i = 2; i < npoints; i++) { - switch (getSlope(winx, i, ww)) { - case UNDERCURL_SLOPE_ASCENDING: - case UNDERCURL_SLOPE_DESCENDING: - penX += ww * (1.f/6.f); - penY += 0; - break; - case UNDERCURL_SLOPE_TOP_CAP: - penX += ww * (2.f/6.f); - penY += -wh / 2.f; - break; - case UNDERCURL_SLOPE_BOTTOM_CAP: - penX += ww * (2.f/6.f); - penY += wh / 2.f; - break; - } - points[i].x = penX; - points[i].y = penY; - } - - // End - float waveLength = penX - winx; - if (waveLength < width) { // Add a bonus point? - int marginEnd = width - waveLength; - penX += marginEnd; - switch(getSlope(winx, npoints, ww)) { - case UNDERCURL_SLOPE_ASCENDING: - case UNDERCURL_SLOPE_DESCENDING: - //penY += 0; - break; - case UNDERCURL_SLOPE_TOP_CAP: - penY += -marginEnd; - break; - case UNDERCURL_SLOPE_BOTTOM_CAP: - penY += marginEnd; - break; - } - - points[npoints].x = penX; - points[npoints].y = penY; - - npoints++; - } else if (waveLength > width) { // Is last point too far? - int marginEnd = waveLength - width; - points[npoints-1].x -= marginEnd; - switch(getSlope(winx, npoints-1, ww)) { - case UNDERCURL_SLOPE_TOP_CAP: - points[npoints-1].y += marginEnd; - break; - case UNDERCURL_SLOPE_BOTTOM_CAP: - points[npoints-1].y -= marginEnd; - break; - default: - break; - } - } - - // Draw the lines - XDrawLines(xw.dpy, XftDrawDrawable(xw.draw), ugc, points, npoints, - CoordModeOrigin); - - // Draw a second underline with an offset of 1 pixel - if ( ((win.ch / (widthThreshold/2)) % 2)) { - for (int i = 0; i < npoints; i++) - points[i].x++; - - XDrawLines(xw.dpy, XftDrawDrawable(xw.draw), ugc, points, - npoints, CoordModeOrigin); - } - - // Free resources - free(points); - } -#endif - } - - XFreeGC(xw.dpy, ugc); - #elif VERTCENTER_PATCH - XftDrawRect(xw.draw, fg, winx, winy + win.cyo + dc.font.ascent * chscale + 1, - width, 1); - #else XftDrawRect(xw.draw, fg, winx, winy + dc.font.ascent * chscale + 1, width, 1); - #endif // UNDERCURL_PATCH | VERTCENTER_PATCH } if (base.mode & ATTR_STRUCK) { - #if VERTCENTER_PATCH - XftDrawRect(xw.draw, fg, winx, winy + win.cyo + 2 * dc.font.ascent * chscale / 3, - width, 1); - #else XftDrawRect(xw.draw, fg, winx, winy + 2 * dc.font.ascent * chscale / 3, width, 1); - #endif // VERTCENTER_PATCH } - #if WIDE_GLYPHS_PATCH - } - #endif // WIDE_GLYPHS_PATCH - #if OPENURLONCLICK_PATCH - if (url_draw && y >= url_y1 && y <= url_y2) { - int x1 = (y == url_y1) ? url_x1 : 0; - int x2 = (y == url_y2) ? MIN(url_x2, term.col-1) : url_maxcol; - if (x + charlen > x1 && x <= x2) { - int xu = MAX(x, x1); - int wu = (x2 - xu + 1) * win.cw; - #if ANYSIZE_PATCH - xu = win.hborderpx + xu * win.cw; - #else - xu = borderpx + xu * win.cw; - #endif // ANYSIZE_PATCH - #if VERTCENTER_PATCH - XftDrawRect(xw.draw, fg, xu, winy + win.cyo + dc.font.ascent * chscale + 2, wu, 1); - #else - XftDrawRect(xw.draw, fg, xu, winy + dc.font.ascent * chscale + 2, wu, 1); - #endif // VERTCENTER_PATCH - url_draw = (y != url_y2 || x + charlen <= x2); - } - } - #endif // OPENURLONCLICK_PATCH /* Reset clip to none. */ XftDrawSetClip(xw.draw, 0); @@ -2584,52 +1496,26 @@ xdrawglyph(Glyph g, int x, int y) XftGlyphFontSpec spec; numspecs = xmakeglyphfontspecs(&spec, &g, 1, x, y); - #if WIDE_GLYPHS_PATCH - xdrawglyphfontspecs(&spec, g, numspecs, x, y, DRAW_BG | DRAW_FG); - #else xdrawglyphfontspecs(&spec, g, numspecs, x, y); - #endif // WIDE_GLYPHS_PATCH } void -#if LIGATURES_PATCH -xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og, Line line, int len) -#else xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og) -#endif // LIGATURES_PATCH { Color drawcol; - #if DYNAMIC_CURSOR_COLOR_PATCH - XRenderColor colbg; - #endif // DYNAMIC_CURSOR_COLOR_PATCH /* remove the old cursor */ if (selected(ox, oy)) og.mode ^= ATTR_REVERSE; - #if LIGATURES_PATCH - /* Redraw the line where cursor was previously. - * It will restore the ligatures broken by the cursor. */ - xdrawline(line, 0, oy, len); - #else xdrawglyph(og, ox, oy); - #endif // LIGATURES_PATCH - #if HIDE_TERMINAL_CURSOR_PATCH if (IS_SET(MODE_HIDE) || !IS_SET(MODE_FOCUSED)) return; - #else - if (IS_SET(MODE_HIDE)) - return; - #endif // HIDE_TERMINAL_CURSOR_PATCH /* * Select the right color for the right mode. */ - #if BOXDRAW_PATCH - g.mode &= ATTR_BOLD|ATTR_ITALIC|ATTR_UNDERLINE|ATTR_STRUCK|ATTR_WIDE|ATTR_BOXDRAW; - #else g.mode &= ATTR_BOLD|ATTR_ITALIC|ATTR_UNDERLINE|ATTR_STRUCK|ATTR_WIDE; - #endif // BOXDRAW_PATCH if (IS_SET(MODE_REVERSE)) { g.mode |= ATTR_REVERSE; @@ -2646,88 +1532,46 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og) g.fg = defaultfg; g.bg = defaultrcs; } - #if !DYNAMIC_CURSOR_COLOR_PATCH else { g.fg = defaultbg; g.bg = defaultcs; } drawcol = dc.col[g.bg]; - #else - else if (!(og.mode & ATTR_REVERSE)) { - unsigned int tmpcol = g.bg; - g.bg = g.fg; - g.fg = tmpcol; - } - - if (IS_TRUECOL(g.bg)) { - colbg.alpha = 0xffff; - colbg.red = TRUERED(g.bg); - colbg.green = TRUEGREEN(g.bg); - colbg.blue = TRUEBLUE(g.bg); - XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &colbg, &drawcol); - } else - drawcol = dc.col[g.bg]; - #endif // DYNAMIC_CURSOR_COLOR_PATCH } /* draw the new one */ if (IS_SET(MODE_FOCUSED)) { switch (win.cursor) { - #if !BLINKING_CURSOR_PATCH - case 7: /* st extension */ - g.u = 0x2603; /* snowman (U+2603) */ - /* FALLTHROUGH */ - #endif // BLINKING_CURSOR_PATCH case 0: /* Blinking block */ case 1: /* Blinking block (default) */ - #if BLINKING_CURSOR_PATCH if (IS_SET(MODE_BLINK)) break; /* FALLTHROUGH */ - #endif // BLINKING_CURSOR_PATCH case 2: /* Steady block */ xdrawglyph(g, cx, cy); break; case 3: /* Blinking underline */ - #if BLINKING_CURSOR_PATCH if (IS_SET(MODE_BLINK)) break; /* FALLTHROUGH */ - #endif // BLINKING_CURSOR_PATCH case 4: /* Steady underline */ - #if ANYSIZE_PATCH XftDrawRect(xw.draw, &drawcol, win.hborderpx + cx * win.cw, win.vborderpx + (cy + 1) * win.ch - \ cursorthickness, win.cw, cursorthickness); - #else - XftDrawRect(xw.draw, &drawcol, - borderpx + cx * win.cw, - borderpx + (cy + 1) * win.ch - \ - cursorthickness, - win.cw, cursorthickness); - #endif // ANYSIZE_PATCH break; case 5: /* Blinking bar */ - #if BLINKING_CURSOR_PATCH if (IS_SET(MODE_BLINK)) break; /* FALLTHROUGH */ - #endif // BLINKING_CURSOR_PATCH case 6: /* Steady bar */ XftDrawRect(xw.draw, &drawcol, - #if ANYSIZE_PATCH win.hborderpx + cx * win.cw, win.vborderpx + cy * win.ch, - #else - borderpx + cx * win.cw, - borderpx + cy * win.ch, - #endif // ANYSIZE_PATCH cursorthickness, win.ch); break; - #if BLINKING_CURSOR_PATCH case 7: /* Blinking st cursor */ if (IS_SET(MODE_BLINK)) break; @@ -2736,44 +1580,23 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og) g.u = stcursor; xdrawglyph(g, cx, cy); break; - #endif // BLINKING_CURSOR_PATCH } } else { XftDrawRect(xw.draw, &drawcol, - #if ANYSIZE_PATCH win.hborderpx + cx * win.cw, win.vborderpx + cy * win.ch, - #else - borderpx + cx * win.cw, - borderpx + cy * win.ch, - #endif // ANYSIZE_PATCH win.cw - 1, 1); XftDrawRect(xw.draw, &drawcol, - #if ANYSIZE_PATCH win.hborderpx + cx * win.cw, win.vborderpx + cy * win.ch, - #else - borderpx + cx * win.cw, - borderpx + cy * win.ch, - #endif // ANYSIZE_PATCH 1, win.ch - 1); XftDrawRect(xw.draw, &drawcol, - #if ANYSIZE_PATCH win.hborderpx + (cx + 1) * win.cw - 1, win.vborderpx + cy * win.ch, - #else - borderpx + (cx + 1) * win.cw - 1, - borderpx + cy * win.ch, - #endif // ANYSIZE_PATCH 1, win.ch - 1); XftDrawRect(xw.draw, &drawcol, - #if ANYSIZE_PATCH win.hborderpx + cx * win.cw, win.vborderpx + (cy + 1) * win.ch - 1, - #else - borderpx + cx * win.cw, - borderpx + (cy + 1) * win.ch - 1, - #endif // ANYSIZE_PATCH win.cw, 1); } } @@ -2801,51 +1624,6 @@ xseticontitle(char *p) XFree(prop.value); } -#if CSI_22_23_PATCH -void -xsettitle(char *p, int pop) -{ - XTextProperty prop; - - free(titlestack[tstki]); - if (pop) { - titlestack[tstki] = NULL; - tstki = (tstki - 1 + TITLESTACKSIZE) % TITLESTACKSIZE; - p = titlestack[tstki] ? titlestack[tstki] : opt_title; - } else if (p) { - titlestack[tstki] = xstrdup(p); - } else { - titlestack[tstki] = NULL; - p = opt_title; - } - - if (Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle, - &prop) != Success) - return; - XSetWMName(xw.dpy, xw.win, &prop); - XSetTextProperty(xw.dpy, xw.win, &prop, xw.netwmname); - XFree(prop.value); -} - -void -xpushtitle(void) -{ - int tstkin = (tstki + 1) % TITLESTACKSIZE; - - free(titlestack[tstkin]); - titlestack[tstkin] = titlestack[tstki] ? xstrdup(titlestack[tstki]) : NULL; - tstki = tstkin; -} - -void -xfreetitlestack(void) -{ - for (int i = 0; i < LEN(titlestack); i++) { - free(titlestack[i]); - titlestack[i] = NULL; - } -} -#else void xsettitle(char *p) { @@ -2859,15 +1637,10 @@ xsettitle(char *p) XSetTextProperty(xw.dpy, xw.win, &prop, xw.netwmname); XFree(prop.value); } -#endif // CSI_22_23_PATCH int xstartdraw(void) { - #if W3M_PATCH - if (IS_SET(MODE_VISIBLE)) - XCopyArea(xw.dpy, xw.win, xw.buf, dc.gc, 0, 0, win.w, win.h, 0, 0); - #endif // W3M_PATCH return IS_SET(MODE_VISIBLE); } @@ -2875,55 +1648,13 @@ void xdrawline(Line line, int x1, int y1, int x2) { int i, x, ox, numspecs; - #if WIDE_GLYPHS_PATCH - int numspecs_cached; - #endif // WIDE_GLYPHS_PATCH Glyph base, new; - #if WIDE_GLYPHS_PATCH - XftGlyphFontSpec *specs; - - numspecs_cached = xmakeglyphfontspecs(xw.specbuf, &line[x1], x2 - x1, x1, y1); - - /* Draw line in 2 passes: background and foreground. This way wide glyphs - won't get truncated (#223) */ - for (int dmode = DRAW_BG; dmode <= DRAW_FG; dmode <<= 1) { - specs = xw.specbuf; - numspecs = numspecs_cached; - i = ox = 0; - for (x = x1; x < x2 && i < numspecs; x++) { - new = line[x]; - #if VIM_BROWSE_PATCH - historyOverlay(x, y1, &new); - #endif // VIM_BROWSE_PATCH - if (new.mode == ATTR_WDUMMY) - continue; - if (selected(x, y1)) - new.mode ^= ATTR_REVERSE; - if (i > 0 && ATTRCMP(base, new)) { - xdrawglyphfontspecs(specs, base, i, ox, y1, dmode); - specs += i; - numspecs -= i; - i = 0; - } - if (i == 0) { - ox = x; - base = new; - } - i++; - } - if (i > 0) - xdrawglyphfontspecs(specs, base, i, ox, y1, dmode); - } - #else XftGlyphFontSpec *specs = xw.specbuf; numspecs = xmakeglyphfontspecs(specs, &line[x1], x2 - x1, x1, y1); i = ox = 0; for (x = x1; x < x2 && i < numspecs; x++) { new = line[x]; - #if VIM_BROWSE_PATCH - historyOverlay(x, y1, &new); - #endif // VIM_BROWSE_PATCH if (new.mode == ATTR_WDUMMY) continue; if (selected(x, y1)) @@ -2942,76 +1673,14 @@ xdrawline(Line line, int x1, int y1, int x2) } if (i > 0) xdrawglyphfontspecs(specs, base, i, ox, y1); - #endif // WIDE_GLYPHS_PATCH } void xfinishdraw(void) { - #if SIXEL_PATCH - ImageList *im, *next; - XGCValues gcvalues; - GC gc; - #endif // SIXEL_PATCH - #if SIXEL_PATCH - for (im = term.images; im; im = next) { - /* get the next image here, because delete_image() will delete the current image */ - next = im->next; - if (im->should_delete) { - delete_image(im); - continue; - } - - if (!im->pixmap) { - im->pixmap = (void *)XCreatePixmap(xw.dpy, xw.win, im->width, im->height, - #if ALPHA_PATCH - xw.depth - #else - DefaultDepth(xw.dpy, xw.scr) - #endif // ALPHA_PATCH - ); - XImage ximage = { - .format = ZPixmap, - .data = (char *)im->pixels, - .width = im->width, - .height = im->height, - .xoffset = 0, - .byte_order = LSBFirst, - .bitmap_bit_order = MSBFirst, - .bits_per_pixel = 32, - .bytes_per_line = im->width * 4, - .bitmap_unit = 32, - .bitmap_pad = 32, - #if ALPHA_PATCH - .depth = xw.depth - #else - .depth = 24 - #endif // ALPHA_PATCH - }; - XPutImage(xw.dpy, (Drawable)im->pixmap, dc.gc, &ximage, 0, 0, 0, 0, im->width, im->height); - free(im->pixels); - im->pixels = NULL; - } - - memset(&gcvalues, 0, sizeof(gcvalues)); - gcvalues.graphics_exposures = False; - gc = XCreateGC(xw.dpy, xw.win, GCGraphicsExposures, &gcvalues); - - #if ANYSIZE_PATCH - XCopyArea(xw.dpy, (Drawable)im->pixmap, xw.buf, gc, 0, 0, im->width, im->height, win.hborderpx + im->x * win.cw, win.vborderpx + im->y * win.ch); - #else - XCopyArea(xw.dpy, (Drawable)im->pixmap, xw.buf, gc, 0, 0, im->width, im->height, borderpx + im->x * win.cw, borderpx + im->y * win.ch); - #endif // ANYSIZE_PATCH - XFreeGC(xw.dpy, gc); - - } - #endif // SIXEL_PATCH - - #if !SINGLE_DRAWABLE_BUFFER_PATCH XCopyArea(xw.dpy, xw.buf, xw.win, dc.gc, 0, 0, win.w, win.h, 0, 0); - #endif // SINGLE_DRAWABLE_BUFFER_PATCH XSetForeground(xw.dpy, dc.gc, dc.col[IS_SET(MODE_REVERSE)? defaultfg : defaultbg].pixel); @@ -3046,26 +1715,17 @@ visibility(XEvent *ev) void unmap(XEvent *ev) { - #if ST_EMBEDDER_PATCH if (embed == ev->xunmap.window) { embed = 0; XRaiseWindow(xw.dpy, xw.win); XSetInputFocus(xw.dpy, xw.win, RevertToParent, CurrentTime); } - #endif // ST_EMBEDDER_PATCH win.mode &= ~MODE_VISIBLE; } void xsetpointermotion(int set) { - #if HIDECURSOR_PATCH - if (!set && !xw.pointerisvisible) - return; - #endif // HIDECURSOR_PATCH - #if OPENURLONCLICK_PATCH - set = 1; /* keep MotionNotify event enabled */ - #endif // OPENURLONCLICK_PATCH MODBIT(xw.attrs.event_mask, set, PointerMotionMask); XChangeWindowAttributes(xw.dpy, xw.win, CWEventMask, &xw.attrs); } @@ -3075,25 +1735,6 @@ xsetmode(int set, unsigned int flags) { int mode = win.mode; MODBIT(win.mode, set, flags); - #if SWAPMOUSE_PATCH - if ((flags & MODE_MOUSE) - #if HIDECURSOR_PATCH - && xw.pointerisvisible - #endif // HIDECURSOR_PATCH - ) { - if (win.mode & MODE_MOUSE) - XUndefineCursor(xw.dpy, xw.win); - else - #if HIDECURSOR_PATCH - XDefineCursor(xw.dpy, xw.win, xw.vpointer); - #else - XDefineCursor(xw.dpy, xw.win, cursor); - #endif // HIDECURSOR_PATCH - } - #elif OPENURLONCLICK_PATCH - if (win.mode & MODE_MOUSE && xw.pointerisvisible) - XDefineCursor(xw.dpy, xw.win, xw.vpointer); - #endif // SWAPMOUSE_PATCH if ((win.mode & MODE_REVERSE) != (mode & MODE_REVERSE)) redraw(); } @@ -3101,26 +1742,12 @@ xsetmode(int set, unsigned int flags) int xsetcursor(int cursor) { - #if BLINKING_CURSOR_PATCH if (!BETWEEN(cursor, 0, 8)) /* 7-8: st extensions */ - #else - if (!BETWEEN(cursor, 0, 7)) /* 7: st extension */ - #endif // BLINKING_CURSOR_PATCH return 1; - #if DEFAULT_CURSOR_PATCH - #if BLINKING_CURSOR_PATCH win.cursor = (cursor ? cursor : cursorstyle); - #else - win.cursor = (cursor ? cursor : cursorshape); - #endif // BLINKING_CURSOR_PATCH - #else - win.cursor = cursor; - #endif // DEFAULT_CURSOR_PATCH - #if BLINKING_CURSOR_PATCH cursorblinks = win.cursor == 0 || win.cursor == 1 || win.cursor == 3 || win.cursor == 5 || win.cursor == 7; - #endif // BLINKING_CURSOR_PATCH return 0; } @@ -3141,10 +1768,6 @@ xbell(void) xseturgency(1); if (bellvolume) XkbBell(xw.dpy, xw.win, bellvolume, (Atom)NULL); - #if VISUALBELL_1_PATCH - if (!bellon) /* turn visual bell on */ - bellon = 1; - #endif // VISUALBELL_1_PATCH } void @@ -3152,14 +1775,12 @@ focus(XEvent *ev) { XFocusChangeEvent *e = &ev->xfocus; - #if ST_EMBEDDER_PATCH if (embed && ev->type == FocusIn) { XRaiseWindow(xw.dpy, embed); XSetInputFocus(xw.dpy, embed, RevertToParent, CurrentTime); sendxembed(XEMBED_FOCUS_IN, XEMBED_FOCUS_CURRENT, 0, 0); sendxembed(XEMBED_WINDOW_ACTIVATE, 0, 0, 0); } - #endif // ST_EMBEDDER_PATCH if (e->mode == NotifyGrab) return; @@ -3171,26 +1792,12 @@ focus(XEvent *ev) xseturgency(0); if (IS_SET(MODE_FOCUS)) ttywrite("\033[I", 3, 0); - #if ALPHA_PATCH && ALPHA_FOCUS_HIGHLIGHT_PATCH - if (!focused) { - focused = 1; - xloadcols(); - tfulldirt(); - } - #endif // ALPHA_FOCUS_HIGHLIGHT_PATCH } else { if (xw.ime.xic) XUnsetICFocus(xw.ime.xic); win.mode &= ~MODE_FOCUSED; if (IS_SET(MODE_FOCUS)) ttywrite("\033[O", 3, 0); - #if ALPHA_PATCH && ALPHA_FOCUS_HIGHLIGHT_PATCH - if (focused) { - focused = 0; - xloadcols(); - tfulldirt(); - } - #endif // ALPHA_FOCUS_HIGHLIGHT_PATCH } } @@ -3248,30 +1855,6 @@ kpress(XEvent *ev) Status status; Shortcut *bp; - #if HIDECURSOR_PATCH - if (xw.pointerisvisible) { - #if OPENURLONCLICK_PATCH - #if ANYSIZE_PATCH - int x = e->x - win.hborderpx; - int y = e->y - win.vborderpx; - #else - int x = e->x - borderpx; - int y = e->y - borderpx; - #endif // ANYSIZE_PATCH - LIMIT(x, 0, win.tw - 1); - LIMIT(y, 0, win.th - 1); - if (!detecturl(x / win.cw, y / win.ch, 0)) { - XDefineCursor(xw.dpy, xw.win, xw.bpointer); - xsetpointermotion(1); - xw.pointerisvisible = 0; - } - #else - XDefineCursor(xw.dpy, xw.win, xw.bpointer); - xsetpointermotion(1); - xw.pointerisvisible = 0; - #endif // OPENURLONCLICK_PATCH - } - #endif // HIDECURSOR_PATCH if (IS_SET(MODE_KBDLOCK)) return; @@ -3283,21 +1866,6 @@ kpress(XEvent *ev) } else { len = XLookupString(e, buf, sizeof buf, &ksym, NULL); } - #if KEYBOARDSELECT_PATCH - if ( IS_SET(MODE_KBDSELECT) ) { - if ( match(XK_NO_MOD, e->state) || - (XK_Shift_L | XK_Shift_R) & e->state ) - win.mode ^= trt_kbdselect(ksym, buf, len); - return; - } - #endif // KEYBOARDSELECT_PATCH - #if VIM_BROWSE_PATCH - if (IS_SET(MODE_NORMAL)) { - if (kPressHist(buf, len, match(ControlMask, e->state), &ksym) - == finish) normalMode(); - return; - } - #endif // VIM_BROWSE_PATCH screen = tisaltscr() ? S_ALT : S_PRI; @@ -3358,29 +1926,16 @@ cmessage(XEvent *e) void resize(XEvent *e) { - #if ST_EMBEDDER_PATCH XWindowChanges wc; - #endif // ST_EMBEDDER_PATCH - #if BACKGROUND_IMAGE_PATCH - if (pseudotransparency) { - if (e->xconfigure.width == win.w && - e->xconfigure.height == win.h && - e->xconfigure.x == win.x && e->xconfigure.y == win.y) - return; - updatexy(); - } else - #endif // BACKGROUND_IMAGE_PATCH if (e->xconfigure.width == win.w && e->xconfigure.height == win.h) return; - #if ST_EMBEDDER_PATCH if (embed) { wc.width = e->xconfigure.width; wc.height = e->xconfigure.height; XConfigureWindow(xw.dpy, embed, CWWidth | CWHeight, &wc); } - #endif // ST_EMBEDDER_PATCH cresize(e->xconfigure.width, e->xconfigure.height); } @@ -3419,11 +1974,7 @@ run(void) FD_SET(ttyfd, &rfd); FD_SET(xfd, &rfd); - #if SYNC_PATCH - if (XPending(xw.dpy) || ttyread_pending()) - #else if (XPending(xw.dpy)) - #endif // SYNC_PATCH timeout = 0; /* existing events might not set xfd */ seltv.tv_sec = timeout / 1E3; @@ -3437,14 +1988,8 @@ run(void) } clock_gettime(CLOCK_MONOTONIC, &now); - #if SYNC_PATCH - int ttyin = FD_ISSET(ttyfd, &rfd) || ttyread_pending(); - if (ttyin) - ttyread(); - #else if (FD_ISSET(ttyfd, &rfd)) ttyread(); - #endif // SYNC_PATCH xev = 0; while (XPending(xw.dpy)) { @@ -3467,20 +2012,14 @@ run(void) * maximum latency intervals during `cat huge.txt`, and perfect * sync with periodic updates from animations/key-repeats/etc. */ - #if SYNC_PATCH - if (ttyin || xev) - #else if (FD_ISSET(ttyfd, &rfd) || xev) - #endif // SYNC_PATCH { if (!drawing) { trigger = now; - #if BLINKING_CURSOR_PATCH if (IS_SET(MODE_BLINK)) { win.mode ^= MODE_BLINK; } lastblink = now; - #endif // BLINKING_CURSOR_PATCH drawing = 1; } timeout = (maxlatency - TIMEDIFF(now, trigger)) \ @@ -3489,27 +2028,10 @@ run(void) continue; /* we have time, try to find idle */ } - #if SYNC_PATCH - if (tinsync(su_timeout)) { - /* - * on synchronized-update draw-suspension: don't reset - * drawing so that we draw ASAP once we can (just after - * ESU). it won't be too soon because we already can - * draw now but we skip. we set timeout > 0 to draw on - * SU-timeout even without new content. - */ - timeout = minlatency; - continue; - } - #endif // SYNC_PATCH /* idle detected or maxlatency exhausted -> draw */ timeout = -1; - #if BLINKING_CURSOR_PATCH if (blinktimeout && (cursorblinks || tattrset(ATTR_BLINK))) - #else - if (blinktimeout && tattrset(ATTR_BLINK)) - #endif // BLINKING_CURSOR_PATCH { timeout = blinktimeout - TIMEDIFF(now, lastblink); if (timeout <= 0) { @@ -3522,18 +2044,7 @@ run(void) } } - #if VISUALBELL_1_PATCH - if (bellon) { - bellon++; - bellon %= 3; - MODBIT(win.mode, !IS_SET(MODE_REVERSE), MODE_REVERSE); - redraw(); - } - else - draw(); - #else draw(); - #endif // VISUALBELL_1_PATCH XFlush(xw.dpy); drawing = 0; } @@ -3543,17 +2054,11 @@ void usage(void) { die("usage: %s [-aiv] [-c class]" - #if WORKINGDIR_PATCH - " [-d path]" - #endif // WORKINGDIR_PATCH " [-f font] [-g geometry]" " [-n name] [-o file]\n" " [-T title] [-t title] [-w windowid]" " [[-e] command [args ...]]\n" " %s [-aiv] [-c class]" - #if WORKINGDIR_PATCH - " [-d path]" - #endif // WORKINGDIR_PATCH " [-f font] [-g geometry]" " [-n name] [-o file]\n" " [-T title] [-t title] [-w windowid] -l line" @@ -3565,29 +2070,18 @@ main(int argc, char *argv[]) { xw.l = xw.t = 0; xw.isfixed = False; - #if BLINKING_CURSOR_PATCH xsetcursor(cursorstyle); - #else - xsetcursor(cursorshape); - #endif // BLINKING_CURSOR_PATCH ARGBEGIN { case 'a': allowaltscreen = 0; break; - #if ALPHA_PATCH case 'A': opt_alpha = EARGF(usage()); break; - #endif // ALPHA_PATCH case 'c': opt_class = EARGF(usage()); break; - #if WORKINGDIR_PATCH - case 'd': - opt_dir = EARGF(usage()); - break; - #endif // WORKINGDIR_PATCH case 'e': if (argc > 0) --argc, ++argv; @@ -3634,31 +2128,12 @@ run: setlocale(LC_CTYPE, ""); XSetLocaleModifiers(""); - #if XRESOURCES_PATCH && XRESOURCES_RELOAD_PATCH || BACKGROUND_IMAGE_PATCH && BACKGROUND_IMAGE_RELOAD_PATCH - signal(SIGUSR1, sigusr1_reload); - #endif // XRESOURCES_RELOAD_PATCH | BACKGROUND_IMAGE_RELOAD_PATCH - #if XRESOURCES_PATCH - if (!(xw.dpy = XOpenDisplay(NULL))) - die("Can't open display\n"); - - config_init(xw.dpy); - #endif // XRESOURCES_PATCH cols = MAX(cols, 1); rows = MAX(rows, 1); - #if ALPHA_PATCH && ALPHA_FOCUS_HIGHLIGHT_PATCH - defaultbg = MAX(LEN(colorname), 256); - #endif // ALPHA_FOCUS_HIGHLIGHT_PATCH tnew(cols, rows); xinit(cols, rows); - #if BACKGROUND_IMAGE_PATCH - bginit(); - #endif // BACKGROUND_IMAGE_PATCH xsetenv(); selinit(); - #if WORKINGDIR_PATCH - if (opt_dir && chdir(opt_dir)) - die("Can't change to working directory %s\n", opt_dir); - #endif // WORKINGDIR_PATCH run(); return 0; diff --git a/x.o b/x.o index 8448d7061afc11ce70753181d87efed9ce7a7039..3babbf55d3f419c27158542b4e6d4cdecb033603 100644 GIT binary patch delta 92 zcmX@Gfc?M%_6o^49A@vKvXv?kYH#&z|!d~17~lplAbKY_-8Voo*3hw&8m8a fl44A0owi_=#~9Q2*PB9^OwBp&+jHC*uXF$aW=k1I