pack: st better scrolling

master
phga 3 years ago
parent 316f7d36ee
commit 395dd886eb
Signed by: phga
GPG Key ID: 5249548AA705F019

@ -5,8 +5,8 @@
* *
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
*/ */
static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true"; static char *font = "-UNKN-Ttyp0-normal-normal-normal-*-17-*-*-*-m-*-iso10646-1";
static int borderpx = 2; static int borderpx = 8;
/* /*
* What program is execed by st depends of these precedence rules: * What program is execed by st depends of these precedence rules:
@ -63,7 +63,7 @@ static unsigned int cursorthickness = 2;
static int bellvolume = 0; static int bellvolume = 0;
/* default TERM value */ /* default TERM value */
char *termname = "st-256color"; char *termname = "xterm-256color";
/* /*
* spaces per tab * spaces per tab
@ -85,41 +85,46 @@ unsigned int tabspaces = 8;
/* Terminal colors (16 first used in escape sequence) */ /* Terminal colors (16 first used in escape sequence) */
static const char *colorname[] = { static const char *colorname[] = {
/* 8 normal colors */ /* 8 normal colors */
"black", [0] = "#1d1f21", /* black */
"red3", [1] = "#cc6666", /* red */
"green3", [2] = "#b5bd68", /* green */
"yellow3", [3] = "#f0c674", /* yellow */
"blue2", [4] = "#81a2be", /* blue */
"magenta3", [5] = "#b294bb", /* magenta */
"cyan3", [6] = "#8abeb7", /* cyan */
"gray90", [7] = "#c5c8c6", /* white */
/* 8 bright colors */ /* 8 bright colors */
"gray50", [8] = "#969896", /* black */
"red", [9] = "#cc6666", /* red */
"green", [10] = "#b5bd68", /* green */
"yellow", [11] = "#f0c674", /* yellow */
"#5c5cff", [12] = "#81a2be", /* blue */
"magenta", [13] = "#b294bb", /* magenta */
"cyan", [14] = "#8abeb7", /* cyan */
"white", [15] = "#ffffff", /* white */
[255] = 0, /* special colors */
[256] = "#1d1f21", /* background */
/* more colors can be added after 255 to use with DefaultXX */ [257] = "#c5c8c6", /* foreground */
"#cccccc",
"#555555",
}; };
/* /*
* Default colors (colorname index) * Default colors (colorname index)
* foreground, background, cursor, reverse cursor * foreground, background, cursor
*/
unsigned int defaultfg = 257;
unsigned int defaultbg = 256;
static unsigned int defaultcs = 257;
static unsigned int defaultrcs = 256;
/*
* Colors used, when the specific fg == defaultfg. So in reverse mode this
* will reverse too. Another logic would only make the simple feature too
* complex.
*/ */
unsigned int defaultfg = 7; static unsigned int defaultitalic = 7;
unsigned int defaultbg = 0; static unsigned int defaultunderline = 7;
static unsigned int defaultcs = 256;
static unsigned int defaultrcs = 257;
/* /*
* Default shape of cursor * Default shape of cursor
@ -157,14 +162,51 @@ static unsigned int defaultattr = 11;
*/ */
static uint forcemousemod = ShiftMask; static uint forcemousemod = ShiftMask;
/*
* Xresources preferences to load at startup
*/
ResourcePref resources[] = {
{ "font", STRING, &font },
{ "black", STRING, &colorname[0] },
{ "red", STRING, &colorname[1] },
{ "green", STRING, &colorname[2] },
{ "yellow", STRING, &colorname[3] },
{ "blue", STRING, &colorname[4] },
{ "magenta", STRING, &colorname[5] },
{ "cyan", STRING, &colorname[6] },
{ "white", STRING, &colorname[7] },
{ "b_black", STRING, &colorname[8] },
{ "b_red", STRING, &colorname[9] },
{ "b_green", STRING, &colorname[10] },
{ "b_yellow", STRING, &colorname[11] },
{ "b_blue", STRING, &colorname[12] },
{ "b_magenta", STRING, &colorname[13] },
{ "b_cyan", STRING, &colorname[14] },
{ "b_white", STRING, &colorname[15] },
{ "background", STRING, &colorname[256] },
{ "foreground", STRING, &colorname[257] },
{ "cursorColor", STRING, &colorname[258] },
{ "termname", STRING, &termname },
{ "shell", STRING, &shell },
{ "xfps", INTEGER, &xfps },
{ "actionfps", INTEGER, &actionfps },
{ "blinktimeout", INTEGER, &blinktimeout },
{ "bellvolume", INTEGER, &bellvolume },
{ "tabspaces", INTEGER, &tabspaces },
{ "borderpx", INTEGER, &borderpx },
{ "cwscale", FLOAT, &cwscale },
{ "chscale", FLOAT, &chscale },
};
/* /*
* Internal mouse shortcuts. * Internal mouse shortcuts.
* Beware that overloading Button1 will disable the selection. * Beware that overloading Button1 will disable the selection.
*/ */
const unsigned int mousescrollincrement = 3;
static MouseShortcut mshortcuts[] = { static MouseShortcut mshortcuts[] = {
/* mask button function argument release */ /* mask button function argument release */
{ ShiftMask, Button4, kscrollup, {.i = 1} }, { XK_ANY_MOD, Button4, kscrollup, {.i = mousescrollincrement}, 0, /* !alt */ -1 },
{ ShiftMask, Button5, kscrolldown, {.i = 1} }, { XK_ANY_MOD, Button5, kscrolldown, {.i = mousescrollincrement}, 0, /* !alt */ -1 },
{ XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 }, { XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 },
{ XK_ANY_MOD, Button4, ttysend, {.s = "\031"} }, { XK_ANY_MOD, Button4, ttysend, {.s = "\031"} },
{ XK_ANY_MOD, Button5, ttysend, {.s = "\005"} }, { XK_ANY_MOD, Button5, ttysend, {.s = "\005"} },

@ -202,10 +202,11 @@ ResourcePref resources[] = {
* Internal mouse shortcuts. * Internal mouse shortcuts.
* Beware that overloading Button1 will disable the selection. * Beware that overloading Button1 will disable the selection.
*/ */
const unsigned int mousescrollincrement = 3;
static MouseShortcut mshortcuts[] = { static MouseShortcut mshortcuts[] = {
/* mask button function argument release */ /* mask button function argument release */
{ Mod1Mask, Button4, kscrollup, {.i = 1} }, { XK_ANY_MOD, Button4, kscrollup, {.i = mousescrollincrement}, 0, /* !alt */ -1 },
{ Mod1Mask, Button5, kscrolldown, {.i = 1} }, { XK_ANY_MOD, Button5, kscrolldown, {.i = mousescrollincrement}, 0, /* !alt */ -1 },
{ XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 }, { XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 },
{ XK_ANY_MOD, Button4, ttysend, {.s = "\031"} }, { XK_ANY_MOD, Button4, ttysend, {.s = "\031"} },
{ XK_ANY_MOD, Button5, ttysend, {.s = "\005"} }, { XK_ANY_MOD, Button5, ttysend, {.s = "\005"} },

@ -1045,6 +1045,11 @@ tnew(int col, int row)
treset(); treset();
} }
int tisaltscr(void)
{
return IS_SET(MODE_ALTSCREEN);
}
void void
tswapscreen(void) tswapscreen(void)
{ {

@ -89,6 +89,7 @@ void sendbreak(const Arg *);
void toggleprinter(const Arg *); void toggleprinter(const Arg *);
int tattrset(int); int tattrset(int);
int tisaltscr(void);
void tnew(int, int); void tnew(int, int);
void tresize(int, int); void tresize(int, int);
void tsetdirtattr(int); void tsetdirtattr(int);

@ -35,6 +35,7 @@ typedef struct {
void (*func)(const Arg *); void (*func)(const Arg *);
const Arg arg; const Arg arg;
uint release; uint release;
int altscrn; /* 0: don't care, -1: not alt screen, 1: alt screen */
} MouseShortcut; } MouseShortcut;
typedef struct { typedef struct {
@ -460,6 +461,7 @@ mouseaction(XEvent *e, uint release)
for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) { for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) {
if (ms->release == release && if (ms->release == release &&
ms->button == e->xbutton.button && ms->button == e->xbutton.button &&
(!ms->altscrn || (ms->altscrn == (tisaltscr() ? 1 : -1))) &&
(match(ms->mod, state) || /* exact or forced */ (match(ms->mod, state) || /* exact or forced */
match(ms->mod, state & ~forcemousemod))) { match(ms->mod, state & ~forcemousemod))) {
ms->func(&(ms->arg)); ms->func(&(ms->arg));

Loading…
Cancel
Save