Update st to 0.9.

This commit is contained in:
Bartek Stalewski 2022-10-18 23:19:32 +02:00
parent 5e26689677
commit 49b1440524
9 changed files with 4223 additions and 4222 deletions

View file

@ -4,7 +4,7 @@
These patches from suckless.org were applied from the newest versions, in order:
1. `st-font2-20190416-ba72400.diff`
1. `st-font2-0.8.5.diff`
1. `st-hidecursor-0.8.3.diff`
1. `st-scrollback-0.8.5.diff`
1. `st-externalpipe-0.8.4.diff`

View file

@ -31,7 +31,7 @@ extern char *argv0;
switch (argc_)
#define ARGEND }\
}
}
#define ARGC() argc_

View file

@ -8,8 +8,8 @@
static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
/* Spare fonts */
static char *font2[] = {
/* "Inconsolata for Powerline:pixelsize=12:antialias=true:autohint=true", */
"Hack Nerd Font Mono:pixelsize=11:antialias=true:autohint=true",
/* "Inconsolata for Powerline:pixelsize=12:antialias=true:autohint=true", */
/* "Hack Nerd Font Mono:pixelsize=11:antialias=true:autohint=true", */
};
static int borderpx = 2;
@ -477,6 +477,6 @@ static uint selmasks[] = {
* of single wide characters.
*/
static char ascii_printable[] =
" !\"#$%&'()*+,-./0123456789:;<=>?"
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
"`abcdefghijklmnopqrstuvwxyz{|}~";
" !\"#$%&'()*+,-./0123456789:;<=>?"
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
"`abcdefghijklmnopqrstuvwxyz{|}~";

View file

@ -190,6 +190,7 @@ static MouseShortcut mshortcuts[] = {
static char *openurlcmd[] = {"/bin/sh", "-c", "xurls | dmenu -c -l 20 -i | xargs -r $BROWSER",
"externalpipe", NULL};
static Shortcut shortcuts[] = {
/* mask keysym function argument */
{ MODKEY, XK_equal, zoom, {.f = +2} },
@ -469,6 +470,6 @@ static uint selmasks[] = {
* of single wide characters.
*/
static char ascii_printable[] =
" !\"#$%&'()*+,-./0123456789:;<=>?"
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
"`abcdefghijklmnopqrstuvwxyz{|}~";
" !\"#$%&'()*+,-./0123456789:;<=>?"
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
"`abcdefghijklmnopqrstuvwxyz{|}~";

View file

@ -1,5 +1,5 @@
# st version
VERSION = 0.8.5
VERSION = 0.9
# Customize below to fit your system

View file

@ -21,11 +21,11 @@
#include "win.h"
#if defined(__linux)
#include <pty.h>
#include <pty.h>
#elif defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__)
#include <util.h>
#include <util.h>
#elif defined(__FreeBSD__) || defined(__DragonFly__)
#include <libutil.h>
#include <libutil.h>
#endif
/* Arbitrary sizes */
@ -239,7 +239,7 @@ 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};
ssize_t
ssize_t
xwrite(int fd, const char *s, size_t len)
{
size_t aux = len;
@ -256,7 +256,7 @@ xwrite(int fd, const char *s, size_t len)
return aux;
}
void *
void *
xmalloc(size_t len)
{
void *p;
@ -267,7 +267,7 @@ xmalloc(size_t len)
return p;
}
void *
void *
xrealloc(void *p, size_t len)
{
if ((p = realloc(p, len)) == NULL)
@ -276,7 +276,7 @@ xrealloc(void *p, size_t len)
return p;
}
char *
char *
xstrdup(const char *s)
{
char *p;
@ -287,7 +287,7 @@ xstrdup(const char *s)
return p;
}
size_t
size_t
utf8decode(const char *c, Rune *u, size_t clen)
{
size_t i, j, len, type;
@ -312,7 +312,7 @@ utf8decode(const char *c, Rune *u, size_t clen)
return len;
}
Rune
Rune
utf8decodebyte(char c, size_t *i)
{
for (*i = 0; *i < LEN(utfmask); ++(*i))
@ -322,7 +322,7 @@ utf8decodebyte(char c, size_t *i)
return 0;
}
size_t
size_t
utf8encode(Rune u, char *c)
{
size_t len, i;
@ -340,13 +340,13 @@ utf8encode(Rune u, char *c)
return len;
}
char
char
utf8encodebyte(Rune u, size_t i)
{
return utfbyte[i] | (u & ~utfmask[i]);
}
size_t
size_t
utf8validate(Rune *u, size_t i)
{
if (!BETWEEN(*u, utfmin[i], utfmax[i]) || BETWEEN(*u, 0xD800, 0xDFFF))
@ -357,7 +357,7 @@ utf8validate(Rune *u, size_t i)
return i;
}
char
char
base64dec_getc(const char **src)
{
while (**src && !isprint((unsigned char)**src))
@ -365,7 +365,7 @@ base64dec_getc(const char **src)
return **src ? *((*src)++) : '='; /* emulate padding if string ends */
}
char *
char *
base64dec(const char *src)
{
size_t in_len = strlen(src);
@ -403,7 +403,7 @@ base64dec(const char *src)
return result;
}
void
void
selinit(void)
{
sel.mode = SEL_IDLE;
@ -411,7 +411,7 @@ selinit(void)
sel.ob.x = -1;
}
int
int
tlinelen(int y)
{
int i = term.col;
@ -425,7 +425,7 @@ tlinelen(int y)
return i;
}
void
void
selstart(int col, int row, int snap)
{
selclear();
@ -442,7 +442,7 @@ selstart(int col, int row, int snap)
tsetdirt(sel.nb.y, sel.ne.y);
}
void
void
selextend(int col, int row, int type, int done)
{
int oldey, oldex, oldsby, oldsey, oldtype;
@ -471,7 +471,7 @@ selextend(int col, int row, int type, int done)
sel.mode = done ? SEL_IDLE : SEL_READY;
}
void
void
selnormalize(void)
{
int i;
@ -499,7 +499,7 @@ selnormalize(void)
sel.ne.x = term.col - 1;
}
int
int
selected(int x, int y)
{
if (sel.mode == SEL_EMPTY || sel.ob.x == -1 ||
@ -515,7 +515,7 @@ selected(int x, int y)
&& (y != sel.ne.y || x <= sel.ne.x);
}
void
void
selsnap(int *x, int *y, int direction)
{
int newx, newy, xt, yt;
@ -588,7 +588,7 @@ selsnap(int *x, int *y, int direction)
}
}
char *
char *
getsel(void)
{
char *str, *ptr;
@ -643,7 +643,7 @@ getsel(void)
return str;
}
void
void
selclear(void)
{
if (sel.ob.x == -1)
@ -653,7 +653,7 @@ selclear(void)
tsetdirt(sel.nb.y, sel.ne.y);
}
void
void
die(const char *errstr, ...)
{
va_list ap;
@ -664,7 +664,7 @@ die(const char *errstr, ...)
exit(1);
}
void
void
execsh(char *cmd, char **args)
{
char *sh, *prog, *arg;
@ -716,7 +716,7 @@ execsh(char *cmd, char **args)
_exit(1);
}
void
void
sigchld(int a)
{
int stat;
@ -741,7 +741,7 @@ sigchld(int a)
_exit(0);
}
void
void
stty(char **args)
{
char cmd[_POSIX_ARG_MAX], **p, *q, *s;
@ -765,7 +765,7 @@ stty(char **args)
perror("Couldn't call stty");
}
int
int
ttynew(const char *line, char *cmd, const char *out, char **args)
{
int m, s;
@ -827,7 +827,7 @@ ttynew(const char *line, char *cmd, const char *out, char **args)
return cmdfd;
}
size_t
size_t
ttyread(void)
{
static char buf[BUFSIZ];
@ -853,7 +853,7 @@ ttyread(void)
}
}
void
void
ttywrite(const char *s, size_t n, int may_echo)
{
const char *next;
@ -884,7 +884,7 @@ ttywrite(const char *s, size_t n, int may_echo)
}
}
void
void
ttywriteraw(const char *s, size_t n)
{
fd_set wfd, rfd;
@ -941,7 +941,7 @@ write_error:
die("write error on tty: %s\n", strerror(errno));
}
void
void
ttyresize(int tw, int th)
{
struct winsize w;
@ -954,14 +954,14 @@ ttyresize(int tw, int th)
fprintf(stderr, "Couldn't set window size: %s\n", strerror(errno));
}
void
ttyhangup()
void
ttyhangup(void)
{
/* Send SIGHUP to shell */
kill(pid, SIGHUP);
}
int
int
tattrset(int attr)
{
int i, j;
@ -976,7 +976,7 @@ tattrset(int attr)
return 0;
}
void
void
tsetdirt(int top, int bot)
{
int i;
@ -988,7 +988,7 @@ tsetdirt(int top, int bot)
term.dirty[i] = 1;
}
void
void
tsetdirtattr(int attr)
{
int i, j;
@ -1003,13 +1003,13 @@ tsetdirtattr(int attr)
}
}
void
void
tfulldirt(void)
{
tsetdirt(0, term.row-1);
}
void
void
tcursor(int mode)
{
static TCursor c[2];
@ -1023,7 +1023,7 @@ tcursor(int mode)
}
}
void
void
treset(void)
{
uint i;
@ -1051,7 +1051,7 @@ treset(void)
}
}
void
void
tnew(int col, int row)
{
term = (Term){ .c = { .attr = { .fg = defaultfg, .bg = defaultbg } } };
@ -1059,7 +1059,7 @@ tnew(int col, int row)
treset();
}
void
void
tswapscreen(void)
{
Line *tmp = term.line;
@ -1070,7 +1070,7 @@ tswapscreen(void)
tfulldirt();
}
void
void
kscrolldown(const Arg* a)
{
int n = a->i;
@ -1088,7 +1088,7 @@ kscrolldown(const Arg* a)
}
}
void
void
kscrollup(const Arg* a)
{
int n = a->i;
@ -1103,7 +1103,7 @@ kscrollup(const Arg* a)
}
}
void
void
tscrolldown(int orig, int n, int copyhist)
{
int i;
@ -1131,7 +1131,7 @@ tscrolldown(int orig, int n, int copyhist)
selscroll(orig, n);
}
void
void
tscrollup(int orig, int n, int copyhist)
{
int i;
@ -1162,7 +1162,7 @@ tscrollup(int orig, int n, int copyhist)
selscroll(orig, -n);
}
void
void
selscroll(int orig, int n)
{
if (sel.ob.x == -1)
@ -1182,7 +1182,7 @@ selscroll(int orig, int n)
}
}
void
void
tnewline(int first_col)
{
int y = term.c.y;
@ -1195,7 +1195,7 @@ tnewline(int first_col)
tmoveto(first_col ? 0 : term.c.x, y);
}
void
void
csiparse(void)
{
char *p = csiescseq.buf, *np;
@ -1226,13 +1226,13 @@ csiparse(void)
}
/* for absolute user moves, when decom is set */
void
void
tmoveato(int x, int y)
{
tmoveto(x, y + ((term.c.state & CURSOR_ORIGIN) ? term.top: 0));
}
void
void
tmoveto(int x, int y)
{
int miny, maxy;
@ -1249,7 +1249,7 @@ tmoveto(int x, int y)
term.c.y = LIMIT(y, miny, maxy);
}
void
void
tsetchar(Rune u, const Glyph *attr, int x, int y)
{
static const char *vt100_0[62] = { /* 0x41 - 0x7e */
@ -1285,7 +1285,7 @@ tsetchar(Rune u, const Glyph *attr, int x, int y)
term.line[y][x].u = u;
}
void
void
tclearregion(int x1, int y1, int x2, int y2)
{
int x, y, temp;
@ -1315,7 +1315,7 @@ tclearregion(int x1, int y1, int x2, int y2)
}
}
void
void
tdeletechar(int n)
{
int dst, src, size;
@ -1332,7 +1332,7 @@ tdeletechar(int n)
tclearregion(term.col-n, term.c.y, term.col-1, term.c.y);
}
void
void
tinsertblank(int n)
{
int dst, src, size;
@ -1349,21 +1349,21 @@ tinsertblank(int n)
tclearregion(src, term.c.y, dst - 1, term.c.y);
}
void
void
tinsertblankline(int n)
{
if (BETWEEN(term.c.y, term.top, term.bot))
tscrolldown(term.c.y, n, 0);
}
void
void
tdeleteline(int n)
{
if (BETWEEN(term.c.y, term.top, term.bot))
tscrollup(term.c.y, n, 0);
}
int32_t
int32_t
tdefcolor(const int *attr, int *npar, int l)
{
int32_t idx = -1;
@ -1413,7 +1413,7 @@ tdefcolor(const int *attr, int *npar, int l)
return idx;
}
void
void
tsetattr(const int *attr, int l)
{
int i;
@ -1515,7 +1515,7 @@ tsetattr(const int *attr, int l)
}
}
void
void
tsetscroll(int t, int b)
{
int temp;
@ -1531,7 +1531,7 @@ tsetscroll(int t, int b)
term.bot = b;
}
void
void
tsetmode(int priv, int set, const int *args, int narg)
{
int alt; const int *lim;
@ -1661,7 +1661,7 @@ tsetmode(int priv, int set, const int *args, int narg)
}
}
void
void
csihandle(void)
{
char buf[40];
@ -1669,7 +1669,7 @@ csihandle(void)
switch (csiescseq.mode[0]) {
default:
unknown:
unknown:
fprintf(stderr, "erresc: unknown csi ");
csidump();
/* die(""); */
@ -1873,7 +1873,7 @@ unknown:
}
}
void
void
csidump(void)
{
size_t i;
@ -1897,13 +1897,13 @@ csidump(void)
putc('\n', stderr);
}
void
void
csireset(void)
{
memset(&csiescseq, 0, sizeof(csiescseq));
}
void
void
osc_color_response(int num, int index, int is_osc4)
{
int n;
@ -1928,7 +1928,7 @@ osc_color_response(int num, int index, int is_osc4)
}
}
void
void
strhandle(void)
{
char *p = NULL, *dec;
@ -2027,7 +2027,7 @@ strhandle(void)
strdump();
}
void
void
strparse(void)
{
int c;
@ -2049,7 +2049,7 @@ strparse(void)
}
}
void
void
externalpipe(const Arg *arg)
{
int to[2];
@ -2102,7 +2102,7 @@ externalpipe(const Arg *arg)
signal(SIGPIPE, oldsigpipe);
}
void
void
strdump(void)
{
size_t i;
@ -2129,7 +2129,7 @@ strdump(void)
fprintf(stderr, "ESC\\\n");
}
void
void
strreset(void)
{
strescseq = (STREscape){
@ -2138,14 +2138,14 @@ strreset(void)
};
}
void
void
sendbreak(const Arg *arg)
{
if (tcsendbreak(cmdfd, 0))
perror("Error sending break");
}
void
void
tprinter(char *s, size_t len)
{
if (iofd != -1 && xwrite(iofd, s, len) < 0) {
@ -2155,25 +2155,25 @@ tprinter(char *s, size_t len)
}
}
void
void
toggleprinter(const Arg *arg)
{
term.mode ^= MODE_PRINT;
}
void
void
printscreen(const Arg *arg)
{
tdump();
}
void
void
printsel(const Arg *arg)
{
tdumpsel();
}
void
void
tdumpsel(void)
{
char *ptr;
@ -2184,7 +2184,7 @@ tdumpsel(void)
}
}
void
void
tdumpline(int n)
{
char buf[UTF_SIZ];
@ -2199,7 +2199,7 @@ tdumpline(int n)
tprinter("\n", 1);
}
void
void
tdump(void)
{
int i;
@ -2208,7 +2208,7 @@ tdump(void)
tdumpline(i);
}
void
void
tputtab(int n)
{
uint x = term.c.x;
@ -2225,7 +2225,7 @@ tputtab(int n)
term.c.x = LIMIT(x, 0, term.col-1);
}
void
void
tdefutf8(char ascii)
{
if (ascii == 'G')
@ -2234,7 +2234,7 @@ tdefutf8(char ascii)
term.mode &= ~MODE_UTF8;
}
void
void
tdeftran(char ascii)
{
static char cs[] = "0B";
@ -2248,7 +2248,7 @@ tdeftran(char ascii)
}
}
void
void
tdectest(char c)
{
int x, y;
@ -2261,7 +2261,7 @@ tdectest(char c)
}
}
void
void
tstrsequence(uchar c)
{
switch (c) {
@ -2283,7 +2283,7 @@ tstrsequence(uchar c)
term.esc |= ESC_STR;
}
void
void
tcontrolcode(uchar ascii)
{
switch (ascii) {
@ -2384,7 +2384,7 @@ tcontrolcode(uchar ascii)
* returns 1 when the sequence is finished and it hasn't to read
* more characters for this sequence, otherwise 0
*/
int
int
eschandle(uchar ascii)
{
switch (ascii) {
@ -2467,7 +2467,7 @@ eschandle(uchar ascii)
return 1;
}
void
void
tputc(Rune u)
{
char c[UTF_SIZ];
@ -2609,7 +2609,7 @@ check_control_code:
}
}
int
int
twrite(const char *buf, int buflen, int show_ctrl)
{
int charsize;
@ -2641,7 +2641,7 @@ twrite(const char *buf, int buflen, int show_ctrl)
return n;
}
void
void
tresize(int col, int row)
{
int i, j;
@ -2731,13 +2731,13 @@ tresize(int col, int row)
term.c = c;
}
void
void
resettitle(void)
{
xsettitle(NULL);
}
void
void
drawregion(int x1, int y1, int x2, int y2)
{
int y;
@ -2751,7 +2751,7 @@ drawregion(int x1, int y1, int x2, int y2)
}
}
void
void
draw(void)
{
int cx = term.c.x, ocx = term.ocx, ocy = term.ocy;
@ -2778,7 +2778,7 @@ draw(void)
xximspot(term.ocx, term.ocy);
}
void
void
redraw(void)
{
tfulldirt();

View file

@ -87,9 +87,9 @@ void die(const char *, ...);
void redraw(void);
void draw(void);
void externalpipe(const Arg *);
void kscrolldown(const Arg *);
void kscrollup(const Arg *);
void externalpipe(const Arg *);
void printscreen(const Arg *);
void printsel(const Arg *);
void sendbreak(const Arg *);

View file

@ -208,13 +208,13 @@ static void (*handler[LASTEvent])(XEvent *) = {
[MotionNotify] = bmotion,
[ButtonPress] = bpress,
[ButtonRelease] = brelease,
/*
/*
* Uncomment if you want the selection to disappear when you select something
* different in another window.
*/
/* [SelectionClear] = selclear_, */
/* [SelectionClear] = selclear_, */
[SelectionNotify] = selnotify,
/*
/*
* PropertyNotify is only turned on when there is some INCR transfer happening
* for the selection retrieval.
*/
@ -261,7 +261,7 @@ static char *opt_title = NULL;
static uint buttons; /* bit field of pressed buttons */
void
void
clipcopy(const Arg *dummy)
{
Atom clipboard;
@ -276,7 +276,7 @@ clipcopy(const Arg *dummy)
}
}
void
void
clippaste(const Arg *dummy)
{
Atom clipboard;
@ -286,20 +286,20 @@ clippaste(const Arg *dummy)
xw.win, CurrentTime);
}
void
void
selpaste(const Arg *dummy)
{
XConvertSelection(xw.dpy, XA_PRIMARY, xsel.xtarget, XA_PRIMARY,
xw.win, CurrentTime);
}
void
void
numlock(const Arg *dummy)
{
win.mode ^= MODE_NUMLOCK;
}
void
void
zoom(const Arg *arg)
{
Arg larg;
@ -308,7 +308,7 @@ zoom(const Arg *arg)
zoomabs(&larg);
}
void
void
zoomabs(const Arg *arg)
{
xunloadfonts();
@ -319,7 +319,7 @@ zoomabs(const Arg *arg)
xhints();
}
void
void
zoomreset(const Arg *arg)
{
Arg larg;
@ -330,13 +330,13 @@ zoomreset(const Arg *arg)
}
}
void
void
ttysend(const Arg *arg)
{
ttywrite(arg->s, strlen(arg->s), 1);
}
int
int
evcol(XEvent *e)
{
int x = e->xbutton.x - borderpx;
@ -344,7 +344,7 @@ evcol(XEvent *e)
return x / win.cw;
}
int
int
evrow(XEvent *e)
{
int y = e->xbutton.y - borderpx;
@ -352,7 +352,7 @@ evrow(XEvent *e)
return y / win.ch;
}
void
void
mousesel(XEvent *e, int done)
{
int type, seltype = SEL_REGULAR;
@ -369,7 +369,7 @@ mousesel(XEvent *e, int done)
setsel(getsel(), e->xbutton.time);
}
void
void
mousereport(XEvent *e)
{
int len, btn, code;
@ -441,7 +441,7 @@ mousereport(XEvent *e)
ttywrite(buf, len, 0);
}
uint
uint
buttonmask(uint button)
{
return button == Button1 ? Button1Mask
@ -452,7 +452,7 @@ buttonmask(uint button)
: 0;
}
int
int
mouseaction(XEvent *e, uint release)
{
MouseShortcut *ms;
@ -473,7 +473,7 @@ mouseaction(XEvent *e, uint release)
return 0;
}
void
void
bpress(XEvent *e)
{
int btn = e->xbutton.button;
@ -511,7 +511,7 @@ bpress(XEvent *e)
}
}
void
void
propnotify(XEvent *e)
{
XPropertyEvent *xpev;
@ -525,7 +525,7 @@ propnotify(XEvent *e)
}
}
void
void
selnotify(XEvent *e)
{
ulong nitems, ofs, rem;
@ -612,19 +612,19 @@ selnotify(XEvent *e)
XDeleteProperty(xw.dpy, xw.win, (int)property);
}
void
void
xclipcopy(void)
{
clipcopy(NULL);
}
void
void
selclear_(XEvent *e)
{
selclear();
}
void
void
selrequest(XEvent *e)
{
XSelectionRequestEvent *xsre;
@ -682,7 +682,7 @@ selrequest(XEvent *e)
fprintf(stderr, "Error sending SelectionNotify event\n");
}
void
void
setsel(char *str, Time t)
{
if (!str)
@ -696,13 +696,13 @@ setsel(char *str, Time t)
selclear();
}
void
void
xsetsel(char *str)
{
setsel(str, CurrentTime);
}
void
void
brelease(XEvent *e)
{
int btn = e->xbutton.button;
@ -721,7 +721,7 @@ brelease(XEvent *e)
mousesel(e, 1);
}
void
void
bmotion(XEvent *e)
{
if (!xw.pointerisvisible) {
@ -739,7 +739,7 @@ bmotion(XEvent *e)
mousesel(e, 0);
}
void
void
cresize(int width, int height)
{
int col, row;
@ -759,7 +759,7 @@ cresize(int width, int height)
ttyresize(win.tw, win.th);
}
void
void
xresize(int col, int row)
{
win.tw = col * win.cw;
@ -775,13 +775,13 @@ xresize(int col, int row)
xw.specbuf = xrealloc(xw.specbuf, col * sizeof(GlyphFontSpec));
}
ushort
ushort
sixd_to_16bit(int x)
{
return x == 0 ? 0 : 0x3737 + 0x2828 * x;
}
int
int
xloadcolor(int i, const char *name, Color *ncolor)
{
XRenderColor color = { .alpha = 0xffff };
@ -805,7 +805,7 @@ xloadcolor(int i, const char *name, Color *ncolor)
return XftColorAllocName(xw.dpy, xw.vis, xw.cmap, name, ncolor);
}
void
void
xloadcols(void)
{
int i;
@ -830,7 +830,7 @@ xloadcols(void)
loaded = 1;
}
int
int
xgetcolor(int x, unsigned char *r, unsigned char *g, unsigned char *b)
{
if (!BETWEEN(x, 0, dc.collen))
@ -843,7 +843,7 @@ xgetcolor(int x, unsigned char *r, unsigned char *g, unsigned char *b)
return 0;
}
int
int
xsetcolorname(int x, const char *name)
{
Color ncolor;
@ -863,7 +863,7 @@ xsetcolorname(int x, const char *name)
/*
* Absolute coordinates.
*/
void
void
xclear(int x1, int y1, int x2, int y2)
{
XftDrawRect(xw.draw,
@ -871,7 +871,7 @@ xclear(int x1, int y1, int x2, int y2)
x1, y1, x2-x1, y2-y1);
}
void
void
xhints(void)
{
XClassHint class = {opt_name ? opt_name : termname,
@ -907,7 +907,7 @@ xhints(void)
XFree(sizeh);
}
int
int
xgeommasktogravity(int mask)
{
switch (mask & (XNegative|YNegative)) {
@ -922,7 +922,7 @@ xgeommasktogravity(int mask)
return SouthEastGravity;
}
int
int
xloadfont(Font *f, FcPattern *pattern)
{
FcPattern *configured;
@ -995,7 +995,7 @@ xloadfont(Font *f, FcPattern *pattern)
return 0;
}
void
void
xloadfonts(const char *fontstr, double fontsize)
{
FcPattern *pattern;
@ -1065,7 +1065,7 @@ xloadfonts(const char *fontstr, double fontsize)
FcPatternDestroy(pattern);
}
int
int
xloadsparefont(FcPattern *pattern, int flags)
{
FcPattern *match;
@ -1089,7 +1089,7 @@ xloadsparefont(FcPattern *pattern, int flags)
return 0;
}
void
void
xloadsparefonts(void)
{
FcPattern *pattern;
@ -1160,7 +1160,7 @@ xloadsparefonts(void)
}
}
void
void
xunloadfont(Font *f)
{
XftFontClose(xw.dpy, f->match);
@ -1169,7 +1169,7 @@ xunloadfont(Font *f)
FcFontSetDestroy(f->set);
}
void
void
xunloadfonts(void)
{
/* Free the loaded fonts in the font cache. */
@ -1182,7 +1182,7 @@ xunloadfonts(void)
xunloadfont(&dc.ibfont);
}
int
int
ximopen(Display *dpy)
{
XIMCallback imdestroy = { .client_data = NULL, .callback = ximdestroy };
@ -1212,7 +1212,7 @@ ximopen(Display *dpy)
return 1;
}
void
void
ximinstantiate(Display *dpy, XPointer client, XPointer call)
{
if (ximopen(dpy))
@ -1220,7 +1220,7 @@ ximinstantiate(Display *dpy, XPointer client, XPointer call)
ximinstantiate, NULL);
}
void
void
ximdestroy(XIM xim, XPointer client, XPointer call)
{
xw.ime.xim = NULL;
@ -1229,14 +1229,14 @@ ximdestroy(XIM xim, XPointer client, XPointer call)
XFree(xw.ime.spotlist);
}
int
int
xicdestroy(XIC xim, XPointer client, XPointer call)
{
xw.ime.xic = NULL;
return 1;
}
void
void
xinit(int cols, int rows)
{
XGCValues gcvalues;
@ -1356,7 +1356,7 @@ xinit(int cols, int rows)
xsel.xtarget = XA_STRING;
}
int
int
xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x, int y)
{
float winx = borderpx + x * win.cw, winy = borderpx + y * win.ch, xp, yp;
@ -1488,7 +1488,7 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
return numspecs;
}
void
void
xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, int y, int dmode)
{
int charlen = len * ((base.mode & ATTR_WIDE) ? 2 : 1);
@ -1616,7 +1616,7 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
}
}
void
void
xdrawglyph(Glyph g, int x, int y)
{
int numspecs;
@ -1626,7 +1626,7 @@ xdrawglyph(Glyph g, int x, int y)
xdrawglyphfontspecs(&spec, g, numspecs, x, y, DRAW_BG | DRAW_FG);
}
void
void
xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og)
{
Color drawcol;
@ -1712,7 +1712,7 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og)
}
}
void
void
xsetenv(void)
{
char buf[sizeof(long) * 8 + 1];
@ -1721,7 +1721,7 @@ xsetenv(void)
setenv("WINDOWID", buf, 1);
}
void
void
xseticontitle(char *p)
{
XTextProperty prop;
@ -1735,7 +1735,7 @@ xseticontitle(char *p)
XFree(prop.value);
}
void
void
xsettitle(char *p)
{
XTextProperty prop;
@ -1749,13 +1749,13 @@ xsettitle(char *p)
XFree(prop.value);
}
int
int
xstartdraw(void)
{
return IS_SET(MODE_VISIBLE);
}
void
void
xdrawline(Line line, int x1, int y1, int x2)
{
int i, x, ox, numspecs, numspecs_cached;
@ -1793,7 +1793,7 @@ xdrawline(Line line, int x1, int y1, int x2)
}
}
void
void
xfinishdraw(void)
{
XCopyArea(xw.dpy, xw.buf, xw.win, dc.gc, 0, 0, win.w,
@ -1803,7 +1803,7 @@ xfinishdraw(void)
defaultfg : defaultbg].pixel);
}
void
void
xximspot(int x, int y)
{
if (xw.ime.xic == NULL)
@ -1815,13 +1815,13 @@ xximspot(int x, int y)
XSetICValues(xw.ime.xic, XNPreeditAttributes, xw.ime.spotlist, NULL);
}
void
void
expose(XEvent *ev)
{
redraw();
}
void
void
visibility(XEvent *ev)
{
XVisibilityEvent *e = &ev->xvisibility;
@ -1829,13 +1829,13 @@ visibility(XEvent *ev)
MODBIT(win.mode, e->state != VisibilityFullyObscured, MODE_VISIBLE);
}
void
void
unmap(XEvent *ev)
{
win.mode &= ~MODE_VISIBLE;
}
void
void
xsetpointermotion(int set)
{
if (!set && !xw.pointerisvisible)
@ -1844,7 +1844,7 @@ xsetpointermotion(int set)
XChangeWindowAttributes(xw.dpy, xw.win, CWEventMask, &xw.attrs);
}
void
void
xsetmode(int set, unsigned int flags)
{
int mode = win.mode;
@ -1853,7 +1853,7 @@ xsetmode(int set, unsigned int flags)
redraw();
}
int
int
xsetcursor(int cursor)
{
if (!BETWEEN(cursor, 0, 7)) /* 7: st extension */
@ -1862,7 +1862,7 @@ xsetcursor(int cursor)
return 0;
}
void
void
xseturgency(int add)
{
XWMHints *h = XGetWMHints(xw.dpy, xw.win);
@ -1872,7 +1872,7 @@ xseturgency(int add)
XFree(h);
}
void
void
xbell(void)
{
if (!(IS_SET(MODE_FOCUSED)))
@ -1881,7 +1881,7 @@ xbell(void)
XkbBell(xw.dpy, xw.win, bellvolume, (Atom)NULL);
}
void
void
focus(XEvent *ev)
{
XFocusChangeEvent *e = &ev->xfocus;
@ -1905,13 +1905,13 @@ focus(XEvent *ev)
}
}
int
int
match(uint mask, uint state)
{
return mask == XK_ANY_MOD || mask == (state & ~ignoremod);
}
char*
char*
kmap(KeySym k, uint state)
{
Key *kp;
@ -1948,7 +1948,7 @@ kmap(KeySym k, uint state)
return NULL;
}
void
void
kpress(XEvent *ev)
{
XKeyEvent *e = &ev->xkey;
@ -2004,7 +2004,7 @@ kpress(XEvent *ev)
ttywrite(buf, len, 1);
}
void
void
cmessage(XEvent *e)
{
/*
@ -2024,7 +2024,7 @@ cmessage(XEvent *e)
}
}
void
void
resize(XEvent *e)
{
if (e->xconfigure.width == win.w && e->xconfigure.height == win.h)
@ -2033,7 +2033,7 @@ resize(XEvent *e)
cresize(e->xconfigure.width, e->xconfigure.height);
}
void
void
run(void)
{
XEvent ev;
@ -2136,7 +2136,7 @@ run(void)
}
}
void
void
usage(void)
{
die("usage: %s [-aiv] [-c class] [-f font] [-g geometry]"
@ -2149,7 +2149,7 @@ usage(void)
" [stty_args ...]\n", argv0, argv0);
}
int
int
main(int argc, char *argv[])
{
xw.l = xw.t = 0;