From d7315c45d86e514935d671a87fcfced175ff7909 Mon Sep 17 00:00:00 2001 From: Oshgnacknak Date: Fri, 9 Sep 2022 12:49:43 +0200 Subject: [PATCH] Rebase suckless version --- config.def.h | 5 +---- config.h | 61 ++++++++++++++++++++++++++++++++++------------------ x.c | 6 +++--- 3 files changed, 44 insertions(+), 28 deletions(-) diff --git a/config.def.h b/config.def.h index 6ed56bd..17c966c 100644 --- a/config.def.h +++ b/config.def.h @@ -136,10 +136,7 @@ static const char *colorname[] = { unsigned int defaultfg = 258; unsigned int defaultbg = 259; unsigned int defaultcs = 256; -unsigned int defaultfg = 7; -unsigned int defaultbg = 258; -static unsigned int defaultcs = 256; -static unsigned int defaultrcs = 257; +unsigned int defaultrcs = 257; /* * Default shape of cursor diff --git a/config.h b/config.h index 31c1cd3..7e748a1 100644 --- a/config.h +++ b/config.h @@ -11,13 +11,15 @@ static int borderpx = 2; /* * What program is execed by st depends of these precedence rules: * 1: program passed with -e - * 2: utmp option + * 2: scroll and/or utmp * 3: SHELL environment variable * 4: value of shell in /etc/passwd * 5: value of shell in config.h */ static char *shell = "/bin/sh"; char *utmp = NULL; +/* scroll program: to enable use a string like "scroll" */ +char *scroll = NULL; char *stty_args = "stty raw pass8 nl -echo -iexten -cstopb 38400"; /* identification sequence returned in DA and DECID */ @@ -41,9 +43,18 @@ static unsigned int tripleclicktimeout = 600; /* alt screens */ int allowaltscreen = 1; -/* frames per second st should at maximum draw to the screen */ -static unsigned int xfps = 120; -static unsigned int actionfps = 30; +/* allow certain non-interactive (insecure) window operations such as: + setting the clipboard text */ +int allowwindowops = 0; + +/* + * draw latency range in ms - from new content/keypress/etc until drawing. + * within this range, st draws when content stops arriving (idle). mostly it's + * near minlatency, but it waits longer for slow updates to avoid partial draw. + * low minlatency will tear/flicker more, as it can "detect" idle too early. + */ +static double minlatency = 8; +static double maxlatency = 33; /* * blinking timeout (set to 0 to disable blinking) for the terminal blinking @@ -112,6 +123,9 @@ static const char *colorname[] = { /* more colors can be added after 255 to use with DefaultXX */ "#cccccc", "#555555", + "gray90", /* default foreground colour */ + "black", /* default background colour */ + "black", }; @@ -119,10 +133,10 @@ static const char *colorname[] = { * Default colors (colorname index) * foreground, background, cursor, reverse cursor */ -unsigned int defaultfg = 7; -unsigned int defaultbg = 0; -static unsigned int defaultcs = 256; -static unsigned int defaultrcs = 257; +unsigned int defaultfg = 258; +unsigned int defaultbg = 259; +unsigned int defaultcs = 256; +unsigned int defaultrcs = 257; /* * Default shape of cursor @@ -153,14 +167,24 @@ static unsigned int mousebg = 0; */ static unsigned int defaultattr = 11; +/* + * Force mouse select/shortcuts while mask is active (when MODE_MOUSE is set). + * Note that if you want to use ShiftMask with selmasks, set this to an other + * modifier, set to 0 to not use it. + */ +static uint forcemousemod = ShiftMask; + /* * Internal mouse shortcuts. * Beware that overloading Button1 will disable the selection. */ static MouseShortcut mshortcuts[] = { - /* button mask string */ - { Button4, XK_NO_MOD, "\031" }, - { Button5, XK_NO_MOD, "\005" }, + /* mask button function argument release */ + { XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 }, + { ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} }, + { XK_ANY_MOD, Button4, ttysend, {.s = "\031"} }, + { ShiftMask, Button5, ttysend, {.s = "\033[6;2~"} }, + { XK_ANY_MOD, Button5, ttysend, {.s = "\005"} }, }; MouseKey mkeys[] = { @@ -187,10 +211,12 @@ static Shortcut shortcuts[] = { { TERMMOD, XK_Y, selpaste, {.i = 0} }, { ShiftMask, XK_Insert, selpaste, {.i = 0} }, { TERMMOD, XK_Num_Lock, numlock, {.i = 0} }, - { XK_ANY_MOD, XK_Page_Up, kscrollup, {.i = -1} }, - { XK_ANY_MOD, XK_Page_Down, kscrolldown, {.i = -1} }, + { XK_ANY_MOD, XK_Page_Up, kscrollup, {.i = -1} }, + { XK_ANY_MOD, XK_Page_Down, kscrolldown, {.i = -1} }, { TERMMOD, XK_J, kscrolldown, {.i = 5} }, - { TERMMOD, XK_K, kscrollup, {.i = 5} } + { TERMMOD, XK_K, kscrollup, {.i = 5} }, + { ShiftMask, XK_Page_Up, kscrollup, {.i = -1} }, + { ShiftMask, XK_Page_Down, kscrolldown, {.i = -1} }, }; /* @@ -226,13 +252,6 @@ static KeySym mappedkeys[] = { -1 }; */ static uint ignoremod = Mod2Mask|XK_SWITCH_MOD; -/* - * Override mouse-select while mask is active (when MODE_MOUSE is set). - * Note that if you want to use ShiftMask with selmasks, set this to an other - * modifier, set to 0 to not use it. - */ -static uint forceselmod = ShiftMask; - /* * This is the huge key array which defines all compatibility to the Linux * world. Please decide about changes wisely. diff --git a/x.c b/x.c index 96e2ff4..1c3cf64 100644 --- a/x.c +++ b/x.c @@ -488,9 +488,9 @@ bpress(XEvent *e) return; if (tisaltscr()) { for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) { - if (e->xbutton.button == ms->b - && match(ms->mask, e->xbutton.state)) { - ttywrite(ms->s, strlen(ms->s), 1); + if (e->xbutton.button == ms->button + && match(ms->mod, e->xbutton.state)) { + ms->func(&ms->arg); return; } }