mirror of
https://github.com/alrayyes/st.git
synced 2024-11-26 04:46:22 +00:00
Unboolify st
This practice proved itself in sbase, ubase and a couple of other projects. Also remove the True and False defined in X11 and FcTrue and FcFalse defined in Fontconfig. Signed-off-by: Christoph Lohmann <20h@r-36.net>
This commit is contained in:
parent
abfad4c4fc
commit
9de853a98d
2 changed files with 28 additions and 30 deletions
|
@ -30,7 +30,7 @@ static unsigned int doubleclicktimeout = 300;
|
||||||
static unsigned int tripleclicktimeout = 600;
|
static unsigned int tripleclicktimeout = 600;
|
||||||
|
|
||||||
/* alt screens */
|
/* alt screens */
|
||||||
static bool allowaltscreen = true;
|
static int allowaltscreen = 1;
|
||||||
|
|
||||||
/* frames per second st should at maximum draw to the screen */
|
/* frames per second st should at maximum draw to the screen */
|
||||||
static unsigned int xfps = 120;
|
static unsigned int xfps = 120;
|
||||||
|
|
56
st.c
56
st.c
|
@ -6,7 +6,6 @@
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -231,7 +230,7 @@ typedef struct {
|
||||||
int col; /* nb col */
|
int col; /* nb col */
|
||||||
Line *line; /* screen */
|
Line *line; /* screen */
|
||||||
Line *alt; /* alternate screen */
|
Line *alt; /* alternate screen */
|
||||||
bool *dirty; /* dirtyness of lines */
|
int *dirty; /* dirtyness of lines */
|
||||||
XftGlyphFontSpec *specbuf; /* font spec buffer used for rendering */
|
XftGlyphFontSpec *specbuf; /* font spec buffer used for rendering */
|
||||||
TCursor c; /* cursor */
|
TCursor c; /* cursor */
|
||||||
int top; /* top scroll limit */
|
int top; /* top scroll limit */
|
||||||
|
@ -241,8 +240,8 @@ typedef struct {
|
||||||
char trantbl[4]; /* charset table translation */
|
char trantbl[4]; /* charset table translation */
|
||||||
int charset; /* current charset */
|
int charset; /* current charset */
|
||||||
int icharset; /* selected charset for sequence */
|
int icharset; /* selected charset for sequence */
|
||||||
bool numlock; /* lock numbers in keyboard */
|
int numlock; /* lock numbers in keyboard */
|
||||||
bool *tabs;
|
int *tabs;
|
||||||
} Term;
|
} Term;
|
||||||
|
|
||||||
/* Purely graphic info */
|
/* Purely graphic info */
|
||||||
|
@ -258,7 +257,7 @@ typedef struct {
|
||||||
Visual *vis;
|
Visual *vis;
|
||||||
XSetWindowAttributes attrs;
|
XSetWindowAttributes attrs;
|
||||||
int scr;
|
int scr;
|
||||||
bool isfixed; /* is fixed geometry? */
|
int isfixed; /* is fixed geometry? */
|
||||||
int l, t; /* left and top offset */
|
int l, t; /* left and top offset */
|
||||||
int gm; /* geometry mask */
|
int gm; /* geometry mask */
|
||||||
int tw, th; /* tty width and height */
|
int tw, th; /* tty width and height */
|
||||||
|
@ -302,7 +301,7 @@ typedef struct {
|
||||||
|
|
||||||
char *primary, *clipboard;
|
char *primary, *clipboard;
|
||||||
Atom xtarget;
|
Atom xtarget;
|
||||||
bool alt;
|
int alt;
|
||||||
struct timespec tclick1;
|
struct timespec tclick1;
|
||||||
struct timespec tclick2;
|
struct timespec tclick2;
|
||||||
} Selection;
|
} Selection;
|
||||||
|
@ -403,14 +402,14 @@ static void tsetscroll(int, int);
|
||||||
static void tswapscreen(void);
|
static void tswapscreen(void);
|
||||||
static void tsetdirt(int, int);
|
static void tsetdirt(int, int);
|
||||||
static void tsetdirtattr(int);
|
static void tsetdirtattr(int);
|
||||||
static void tsetmode(bool, bool, int *, int);
|
static void tsetmode(int, int, int *, int);
|
||||||
static void tfulldirt(void);
|
static void tfulldirt(void);
|
||||||
static void techo(Rune);
|
static void techo(Rune);
|
||||||
static void tcontrolcode(uchar );
|
static void tcontrolcode(uchar );
|
||||||
static void tdectest(char );
|
static void tdectest(char );
|
||||||
static int32_t tdefcolor(int *, int *, int);
|
static int32_t tdefcolor(int *, int *, int);
|
||||||
static void tdeftran(char);
|
static void tdeftran(char);
|
||||||
static inline bool match(uint, uint);
|
static inline int match(uint, uint);
|
||||||
static void ttynew(void);
|
static void ttynew(void);
|
||||||
static void ttyread(void);
|
static void ttyread(void);
|
||||||
static void ttyresize(void);
|
static void ttyresize(void);
|
||||||
|
@ -459,7 +458,7 @@ static void selrequest(XEvent *);
|
||||||
|
|
||||||
static void selinit(void);
|
static void selinit(void);
|
||||||
static void selnormalize(void);
|
static void selnormalize(void);
|
||||||
static inline bool selected(int, int);
|
static inline int selected(int, int);
|
||||||
static char *getsel(void);
|
static char *getsel(void);
|
||||||
static void selcopy(Time);
|
static void selcopy(Time);
|
||||||
static void selscroll(int, int);
|
static void selscroll(int, int);
|
||||||
|
@ -734,10 +733,10 @@ selnormalize(void) {
|
||||||
sel.ne.x = term.col - 1;
|
sel.ne.x = term.col - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
int
|
||||||
selected(int x, int y) {
|
selected(int x, int y) {
|
||||||
if(sel.mode == SEL_EMPTY)
|
if(sel.mode == SEL_EMPTY)
|
||||||
return false;
|
return 0;
|
||||||
|
|
||||||
if(sel.type == SEL_RECTANGULAR)
|
if(sel.type == SEL_RECTANGULAR)
|
||||||
return BETWEEN(y, sel.nb.y, sel.ne.y)
|
return BETWEEN(y, sel.nb.y, sel.ne.y)
|
||||||
|
@ -751,7 +750,7 @@ selected(int x, int y) {
|
||||||
void
|
void
|
||||||
selsnap(int *x, int *y, int direction) {
|
selsnap(int *x, int *y, int direction) {
|
||||||
int newx, newy, xt, yt;
|
int newx, newy, xt, yt;
|
||||||
bool delim, prevdelim;
|
int delim, prevdelim;
|
||||||
Glyph *gp, *prevgp;
|
Glyph *gp, *prevgp;
|
||||||
|
|
||||||
switch(sel.snap) {
|
switch(sel.snap) {
|
||||||
|
@ -1143,7 +1142,7 @@ selrequest(XEvent *e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* all done, send a notification to the listener */
|
/* all done, send a notification to the listener */
|
||||||
if(!XSendEvent(xsre->display, xsre->requestor, True, 0, (XEvent *) &xev))
|
if(!XSendEvent(xsre->display, xsre->requestor, 1, 0, (XEvent *) &xev))
|
||||||
fprintf(stderr, "Error sending SelectionNotify event\n");
|
fprintf(stderr, "Error sending SelectionNotify event\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1457,7 +1456,7 @@ tfulldirt(void) {
|
||||||
void
|
void
|
||||||
tcursor(int mode) {
|
tcursor(int mode) {
|
||||||
static TCursor c[2];
|
static TCursor c[2];
|
||||||
bool alt = IS_SET(MODE_ALTSCREEN);
|
int alt = IS_SET(MODE_ALTSCREEN);
|
||||||
|
|
||||||
if(mode == CURSOR_SAVE) {
|
if(mode == CURSOR_SAVE) {
|
||||||
c[alt] = term.c;
|
c[alt] = term.c;
|
||||||
|
@ -1916,9 +1915,9 @@ tsetscroll(int t, int b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tsetmode(bool priv, bool set, int *args, int narg) {
|
tsetmode(int priv, int set, int *args, int narg) {
|
||||||
int *lim, mode;
|
int *lim, mode;
|
||||||
bool alt;
|
int alt;
|
||||||
|
|
||||||
for(lim = args + narg; args < lim; ++args) {
|
for(lim = args + narg; args < lim; ++args) {
|
||||||
if(priv) {
|
if(priv) {
|
||||||
|
@ -2684,7 +2683,7 @@ eschandle(uchar ascii) {
|
||||||
void
|
void
|
||||||
tputc(Rune u) {
|
tputc(Rune u) {
|
||||||
char c[UTF_SIZ];
|
char c[UTF_SIZ];
|
||||||
bool control;
|
int control;
|
||||||
int width, len;
|
int width, len;
|
||||||
Glyph *gp;
|
Glyph *gp;
|
||||||
|
|
||||||
|
@ -2808,7 +2807,7 @@ tresize(int col, int row) {
|
||||||
int i;
|
int i;
|
||||||
int minrow = MIN(row, term.row);
|
int minrow = MIN(row, term.row);
|
||||||
int mincol = MIN(col, term.col);
|
int mincol = MIN(col, term.col);
|
||||||
bool *bp;
|
int *bp;
|
||||||
TCursor c;
|
TCursor c;
|
||||||
|
|
||||||
if(col < 1 || row < 1) {
|
if(col < 1 || row < 1) {
|
||||||
|
@ -2904,7 +2903,7 @@ sixd_to_16bit(int x) {
|
||||||
return x == 0 ? 0 : 0x3737 + 0x2828 * x;
|
return x == 0 ? 0 : 0x3737 + 0x2828 * x;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
int
|
||||||
xloadcolor(int i, const char *name, Color *ncolor) {
|
xloadcolor(int i, const char *name, Color *ncolor) {
|
||||||
XRenderColor color = { .alpha = 0xffff };
|
XRenderColor color = { .alpha = 0xffff };
|
||||||
|
|
||||||
|
@ -2929,7 +2928,7 @@ xloadcolor(int i, const char *name, Color *ncolor) {
|
||||||
void
|
void
|
||||||
xloadcols(void) {
|
xloadcols(void) {
|
||||||
int i;
|
int i;
|
||||||
static bool loaded;
|
static int loaded;
|
||||||
Color *cp;
|
Color *cp;
|
||||||
|
|
||||||
if(loaded) {
|
if(loaded) {
|
||||||
|
@ -2944,7 +2943,7 @@ xloadcols(void) {
|
||||||
else
|
else
|
||||||
die("Could not allocate color %d\n", i);
|
die("Could not allocate color %d\n", i);
|
||||||
}
|
}
|
||||||
loaded = true;
|
loaded = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -2998,7 +2997,7 @@ xhints(void) {
|
||||||
sizeh->width_inc = xw.cw;
|
sizeh->width_inc = xw.cw;
|
||||||
sizeh->base_height = 2 * borderpx;
|
sizeh->base_height = 2 * borderpx;
|
||||||
sizeh->base_width = 2 * borderpx;
|
sizeh->base_width = 2 * borderpx;
|
||||||
if(xw.isfixed == True) {
|
if(xw.isfixed) {
|
||||||
sizeh->flags |= PMaxSize | PMinSize;
|
sizeh->flags |= PMaxSize | PMinSize;
|
||||||
sizeh->min_width = sizeh->max_width = xw.w;
|
sizeh->min_width = sizeh->max_width = xw.w;
|
||||||
sizeh->min_height = sizeh->max_height = xw.h;
|
sizeh->min_height = sizeh->max_height = xw.h;
|
||||||
|
@ -3349,7 +3348,7 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
|
||||||
if(f >= frclen) {
|
if(f >= frclen) {
|
||||||
if(!font->set)
|
if(!font->set)
|
||||||
font->set = FcFontSort(0, font->pattern,
|
font->set = FcFontSort(0, font->pattern,
|
||||||
FcTrue, 0, &fcres);
|
1, 0, &fcres);
|
||||||
fcsets[0] = font->set;
|
fcsets[0] = font->set;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -3365,8 +3364,7 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
|
||||||
FcCharSetAddChar(fccharset, rune);
|
FcCharSetAddChar(fccharset, rune);
|
||||||
FcPatternAddCharSet(fcpattern, FC_CHARSET,
|
FcPatternAddCharSet(fcpattern, FC_CHARSET,
|
||||||
fccharset);
|
fccharset);
|
||||||
FcPatternAddBool(fcpattern, FC_SCALABLE,
|
FcPatternAddBool(fcpattern, FC_SCALABLE, 1);
|
||||||
FcTrue);
|
|
||||||
|
|
||||||
FcConfigSubstitute(0, fcpattern,
|
FcConfigSubstitute(0, fcpattern,
|
||||||
FcMatchPattern);
|
FcMatchPattern);
|
||||||
|
@ -3664,7 +3662,7 @@ drawregion(int x1, int y1, int x2, int y2) {
|
||||||
int i, x, y, ox, numspecs;
|
int i, x, y, ox, numspecs;
|
||||||
Glyph base, new;
|
Glyph base, new;
|
||||||
XftGlyphFontSpec* specs;
|
XftGlyphFontSpec* specs;
|
||||||
bool ena_sel = sel.ob.x != -1 && sel.alt == IS_SET(MODE_ALTSCREEN);
|
int ena_sel = sel.ob.x != -1 && sel.alt == IS_SET(MODE_ALTSCREEN);
|
||||||
|
|
||||||
if(!(xw.state & WIN_VISIBLE))
|
if(!(xw.state & WIN_VISIBLE))
|
||||||
return;
|
return;
|
||||||
|
@ -3757,7 +3755,7 @@ focus(XEvent *ev) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
int
|
||||||
match(uint mask, uint state) {
|
match(uint mask, uint state) {
|
||||||
return mask == XK_ANY_MOD || mask == (state & ~ignoremod);
|
return mask == XK_ANY_MOD || mask == (state & ~ignoremod);
|
||||||
}
|
}
|
||||||
|
@ -4025,7 +4023,7 @@ main(int argc, char *argv[]) {
|
||||||
|
|
||||||
ARGBEGIN {
|
ARGBEGIN {
|
||||||
case 'a':
|
case 'a':
|
||||||
allowaltscreen = false;
|
allowaltscreen = 0;
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
opt_class = EARGF(usage());
|
opt_class = EARGF(usage());
|
||||||
|
@ -4042,7 +4040,7 @@ main(int argc, char *argv[]) {
|
||||||
&xw.l, &xw.t, &cols, &rows);
|
&xw.l, &xw.t, &cols, &rows);
|
||||||
break;
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
xw.isfixed = True;
|
xw.isfixed = 1;
|
||||||
break;
|
break;
|
||||||
case 'o':
|
case 'o':
|
||||||
opt_io = EARGF(usage());
|
opt_io = EARGF(usage());
|
||||||
|
|
Loading…
Reference in a new issue