diff options
-rw-r--r-- | config.def.h | 2 | ||||
-rw-r--r-- | st.c | 56 |
2 files changed, 28 insertions, 30 deletions
diff --git a/config.def.h b/config.def.h index 64e75b8..e246e3c 100644 --- a/config.def.h +++ b/config.def.h | |||
@@ -30,7 +30,7 @@ static unsigned int doubleclicktimeout = 300; | |||
30 | static unsigned int tripleclicktimeout = 600; | 30 | static unsigned int tripleclicktimeout = 600; |
31 | 31 | ||
32 | /* alt screens */ | 32 | /* alt screens */ |
33 | static bool allowaltscreen = true; | 33 | static int allowaltscreen = 1; |
34 | 34 | ||
35 | /* frames per second st should at maximum draw to the screen */ | 35 | /* frames per second st should at maximum draw to the screen */ |
36 | static unsigned int xfps = 120; | 36 | static unsigned int xfps = 120; |
@@ -6,7 +6,6 @@ | |||
6 | #include <locale.h> | 6 | #include <locale.h> |
7 | #include <pwd.h> | 7 | #include <pwd.h> |
8 | #include <stdarg.h> | 8 | #include <stdarg.h> |
9 | #include <stdbool.h> | ||
10 | #include <stdio.h> | 9 | #include <stdio.h> |
11 | #include <stdlib.h> | 10 | #include <stdlib.h> |
12 | #include <string.h> | 11 | #include <string.h> |
@@ -231,7 +230,7 @@ typedef struct { | |||
231 | int col; /* nb col */ | 230 | int col; /* nb col */ |
232 | Line *line; /* screen */ | 231 | Line *line; /* screen */ |
233 | Line *alt; /* alternate screen */ | 232 | Line *alt; /* alternate screen */ |
234 | bool *dirty; /* dirtyness of lines */ | 233 | int *dirty; /* dirtyness of lines */ |
235 | XftGlyphFontSpec *specbuf; /* font spec buffer used for rendering */ | 234 | XftGlyphFontSpec *specbuf; /* font spec buffer used for rendering */ |
236 | TCursor c; /* cursor */ | 235 | TCursor c; /* cursor */ |
237 | int top; /* top scroll limit */ | 236 | int top; /* top scroll limit */ |
@@ -241,8 +240,8 @@ typedef struct { | |||
241 | char trantbl[4]; /* charset table translation */ | 240 | char trantbl[4]; /* charset table translation */ |
242 | int charset; /* current charset */ | 241 | int charset; /* current charset */ |
243 | int icharset; /* selected charset for sequence */ | 242 | int icharset; /* selected charset for sequence */ |
244 | bool numlock; /* lock numbers in keyboard */ | 243 | int numlock; /* lock numbers in keyboard */ |
245 | bool *tabs; | 244 | int *tabs; |
246 | } Term; | 245 | } Term; |
247 | 246 | ||
248 | /* Purely graphic info */ | 247 | /* Purely graphic info */ |
@@ -258,7 +257,7 @@ typedef struct { | |||
258 | Visual *vis; | 257 | Visual *vis; |
259 | XSetWindowAttributes attrs; | 258 | XSetWindowAttributes attrs; |
260 | int scr; | 259 | int scr; |
261 | bool isfixed; /* is fixed geometry? */ | 260 | int isfixed; /* is fixed geometry? */ |
262 | int l, t; /* left and top offset */ | 261 | int l, t; /* left and top offset */ |
263 | int gm; /* geometry mask */ | 262 | int gm; /* geometry mask */ |
264 | int tw, th; /* tty width and height */ | 263 | int tw, th; /* tty width and height */ |
@@ -302,7 +301,7 @@ typedef struct { | |||
302 | 301 | ||
303 | char *primary, *clipboard; | 302 | char *primary, *clipboard; |
304 | Atom xtarget; | 303 | Atom xtarget; |
305 | bool alt; | 304 | int alt; |
306 | struct timespec tclick1; | 305 | struct timespec tclick1; |
307 | struct timespec tclick2; | 306 | struct timespec tclick2; |
308 | } Selection; | 307 | } Selection; |
@@ -403,14 +402,14 @@ static void tsetscroll(int, int); | |||
403 | static void tswapscreen(void); | 402 | static void tswapscreen(void); |
404 | static void tsetdirt(int, int); | 403 | static void tsetdirt(int, int); |
405 | static void tsetdirtattr(int); | 404 | static void tsetdirtattr(int); |
406 | static void tsetmode(bool, bool, int *, int); | 405 | static void tsetmode(int, int, int *, int); |
407 | static void tfulldirt(void); | 406 | static void tfulldirt(void); |
408 | static void techo(Rune); | 407 | static void techo(Rune); |
409 | static void tcontrolcode(uchar ); | 408 | static void tcontrolcode(uchar ); |
410 | static void tdectest(char ); | 409 | static void tdectest(char ); |
411 | static int32_t tdefcolor(int *, int *, int); | 410 | static int32_t tdefcolor(int *, int *, int); |
412 | static void tdeftran(char); | 411 | static void tdeftran(char); |
413 | static inline bool match(uint, uint); | 412 | static inline int match(uint, uint); |
414 | static void ttynew(void); | 413 | static void ttynew(void); |
415 | static void ttyread(void); | 414 | static void ttyread(void); |
416 | static void ttyresize(void); | 415 | static void ttyresize(void); |
@@ -459,7 +458,7 @@ static void selrequest(XEvent *); | |||
459 | 458 | ||
460 | static void selinit(void); | 459 | static void selinit(void); |
461 | static void selnormalize(void); | 460 | static void selnormalize(void); |
462 | static inline bool selected(int, int); | 461 | static inline int selected(int, int); |
463 | static char *getsel(void); | 462 | static char *getsel(void); |
464 | static void selcopy(Time); | 463 | static void selcopy(Time); |
465 | static void selscroll(int, int); | 464 | static void selscroll(int, int); |
@@ -734,10 +733,10 @@ selnormalize(void) { | |||
734 | sel.ne.x = term.col - 1; | 733 | sel.ne.x = term.col - 1; |
735 | } | 734 | } |
736 | 735 | ||
737 | bool | 736 | int |
738 | selected(int x, int y) { | 737 | selected(int x, int y) { |
739 | if(sel.mode == SEL_EMPTY) | 738 | if(sel.mode == SEL_EMPTY) |
740 | return false; | 739 | return 0; |
741 | 740 | ||
742 | if(sel.type == SEL_RECTANGULAR) | 741 | if(sel.type == SEL_RECTANGULAR) |
743 | return BETWEEN(y, sel.nb.y, sel.ne.y) | 742 | return BETWEEN(y, sel.nb.y, sel.ne.y) |
@@ -751,7 +750,7 @@ selected(int x, int y) { | |||
751 | void | 750 | void |
752 | selsnap(int *x, int *y, int direction) { | 751 | selsnap(int *x, int *y, int direction) { |
753 | int newx, newy, xt, yt; | 752 | int newx, newy, xt, yt; |
754 | bool delim, prevdelim; | 753 | int delim, prevdelim; |
755 | Glyph *gp, *prevgp; | 754 | Glyph *gp, *prevgp; |
756 | 755 | ||
757 | switch(sel.snap) { | 756 | switch(sel.snap) { |
@@ -1143,7 +1142,7 @@ selrequest(XEvent *e) { | |||
1143 | } | 1142 | } |
1144 | 1143 | ||
1145 | /* all done, send a notification to the listener */ | 1144 | /* all done, send a notification to the listener */ |
1146 | if(!XSendEvent(xsre->display, xsre->requestor, True, 0, (XEvent *) &xev)) | 1145 | if(!XSendEvent(xsre->display, xsre->requestor, 1, 0, (XEvent *) &xev)) |
1147 | fprintf(stderr, "Error sending SelectionNotify event\n"); | 1146 | fprintf(stderr, "Error sending SelectionNotify event\n"); |
1148 | } | 1147 | } |
1149 | 1148 | ||
@@ -1457,7 +1456,7 @@ tfulldirt(void) { | |||
1457 | void | 1456 | void |
1458 | tcursor(int mode) { | 1457 | tcursor(int mode) { |
1459 | static TCursor c[2]; | 1458 | static TCursor c[2]; |
1460 | bool alt = IS_SET(MODE_ALTSCREEN); | 1459 | int alt = IS_SET(MODE_ALTSCREEN); |
1461 | 1460 | ||
1462 | if(mode == CURSOR_SAVE) { | 1461 | if(mode == CURSOR_SAVE) { |
1463 | c[alt] = term.c; | 1462 | c[alt] = term.c; |
@@ -1916,9 +1915,9 @@ tsetscroll(int t, int b) { | |||
1916 | } | 1915 | } |
1917 | 1916 | ||
1918 | void | 1917 | void |
1919 | tsetmode(bool priv, bool set, int *args, int narg) { | 1918 | tsetmode(int priv, int set, int *args, int narg) { |
1920 | int *lim, mode; | 1919 | int *lim, mode; |
1921 | bool alt; | 1920 | int alt; |
1922 | 1921 | ||
1923 | for(lim = args + narg; args < lim; ++args) { | 1922 | for(lim = args + narg; args < lim; ++args) { |
1924 | if(priv) { | 1923 | if(priv) { |
@@ -2684,7 +2683,7 @@ eschandle(uchar ascii) { | |||
2684 | void | 2683 | void |
2685 | tputc(Rune u) { | 2684 | tputc(Rune u) { |
2686 | char c[UTF_SIZ]; | 2685 | char c[UTF_SIZ]; |
2687 | bool control; | 2686 | int control; |
2688 | int width, len; | 2687 | int width, len; |
2689 | Glyph *gp; | 2688 | Glyph *gp; |
2690 | 2689 | ||
@@ -2808,7 +2807,7 @@ tresize(int col, int row) { | |||
2808 | int i; | 2807 | int i; |
2809 | int minrow = MIN(row, term.row); | 2808 | int minrow = MIN(row, term.row); |
2810 | int mincol = MIN(col, term.col); | 2809 | int mincol = MIN(col, term.col); |
2811 | bool *bp; | 2810 | int *bp; |
2812 | TCursor c; | 2811 | TCursor c; |
2813 | 2812 | ||
2814 | if(col < 1 || row < 1) { | 2813 | if(col < 1 || row < 1) { |
@@ -2904,7 +2903,7 @@ sixd_to_16bit(int x) { | |||
2904 | return x == 0 ? 0 : 0x3737 + 0x2828 * x; | 2903 | return x == 0 ? 0 : 0x3737 + 0x2828 * x; |
2905 | } | 2904 | } |
2906 | 2905 | ||
2907 | bool | 2906 | int |
2908 | xloadcolor(int i, const char *name, Color *ncolor) { | 2907 | xloadcolor(int i, const char *name, Color *ncolor) { |
2909 | XRenderColor color = { .alpha = 0xffff }; | 2908 | XRenderColor color = { .alpha = 0xffff }; |
2910 | 2909 | ||
@@ -2929,7 +2928,7 @@ xloadcolor(int i, const char *name, Color *ncolor) { | |||
2929 | void | 2928 | void |
2930 | xloadcols(void) { | 2929 | xloadcols(void) { |
2931 | int i; | 2930 | int i; |
2932 | static bool loaded; | 2931 | static int loaded; |
2933 | Color *cp; | 2932 | Color *cp; |
2934 | 2933 | ||
2935 | if(loaded) { | 2934 | if(loaded) { |
@@ -2944,7 +2943,7 @@ xloadcols(void) { | |||
2944 | else | 2943 | else |
2945 | die("Could not allocate color %d\n", i); | 2944 | die("Could not allocate color %d\n", i); |
2946 | } | 2945 | } |
2947 | loaded = true; | 2946 | loaded = 1; |
2948 | } | 2947 | } |
2949 | 2948 | ||
2950 | int | 2949 | int |
@@ -2998,7 +2997,7 @@ xhints(void) { | |||
2998 | sizeh->width_inc = xw.cw; | 2997 | sizeh->width_inc = xw.cw; |
2999 | sizeh->base_height = 2 * borderpx; | 2998 | sizeh->base_height = 2 * borderpx; |
3000 | sizeh->base_width = 2 * borderpx; | 2999 | sizeh->base_width = 2 * borderpx; |
3001 | if(xw.isfixed == True) { | 3000 | if(xw.isfixed) { |
3002 | sizeh->flags |= PMaxSize | PMinSize; | 3001 | sizeh->flags |= PMaxSize | PMinSize; |
3003 | sizeh->min_width = sizeh->max_width = xw.w; | 3002 | sizeh->min_width = sizeh->max_width = xw.w; |
3004 | sizeh->min_height = sizeh->max_height = xw.h; | 3003 | sizeh->min_height = sizeh->max_height = xw.h; |
@@ -3349,7 +3348,7 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x | |||
3349 | if(f >= frclen) { | 3348 | if(f >= frclen) { |
3350 | if(!font->set) | 3349 | if(!font->set) |
3351 | font->set = FcFontSort(0, font->pattern, | 3350 | font->set = FcFontSort(0, font->pattern, |
3352 | FcTrue, 0, &fcres); | 3351 | 1, 0, &fcres); |
3353 | fcsets[0] = font->set; | 3352 | fcsets[0] = font->set; |
3354 | 3353 | ||
3355 | /* | 3354 | /* |
@@ -3365,8 +3364,7 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x | |||
3365 | FcCharSetAddChar(fccharset, rune); | 3364 | FcCharSetAddChar(fccharset, rune); |
3366 | FcPatternAddCharSet(fcpattern, FC_CHARSET, | 3365 | FcPatternAddCharSet(fcpattern, FC_CHARSET, |
3367 | fccharset); | 3366 | fccharset); |
3368 | FcPatternAddBool(fcpattern, FC_SCALABLE, | 3367 | FcPatternAddBool(fcpattern, FC_SCALABLE, 1); |
3369 | FcTrue); | ||
3370 | 3368 | ||
3371 | FcConfigSubstitute(0, fcpattern, | 3369 | FcConfigSubstitute(0, fcpattern, |
3372 | FcMatchPattern); | 3370 | FcMatchPattern); |
@@ -3664,7 +3662,7 @@ drawregion(int x1, int y1, int x2, int y2) { | |||
3664 | int i, x, y, ox, numspecs; | 3662 | int i, x, y, ox, numspecs; |
3665 | Glyph base, new; | 3663 | Glyph base, new; |
3666 | XftGlyphFontSpec* specs; | 3664 | XftGlyphFontSpec* specs; |
3667 | bool ena_sel = sel.ob.x != -1 && sel.alt == IS_SET(MODE_ALTSCREEN); | 3665 | int ena_sel = sel.ob.x != -1 && sel.alt == IS_SET(MODE_ALTSCREEN); |
3668 | 3666 | ||
3669 | if(!(xw.state & WIN_VISIBLE)) | 3667 | if(!(xw.state & WIN_VISIBLE)) |
3670 | return; | 3668 | return; |
@@ -3757,7 +3755,7 @@ focus(XEvent *ev) { | |||
3757 | } | 3755 | } |
3758 | } | 3756 | } |
3759 | 3757 | ||
3760 | bool | 3758 | int |
3761 | match(uint mask, uint state) { | 3759 | match(uint mask, uint state) { |
3762 | return mask == XK_ANY_MOD || mask == (state & ~ignoremod); | 3760 | return mask == XK_ANY_MOD || mask == (state & ~ignoremod); |
3763 | } | 3761 | } |
@@ -4025,7 +4023,7 @@ main(int argc, char *argv[]) { | |||
4025 | 4023 | ||
4026 | ARGBEGIN { | 4024 | ARGBEGIN { |
4027 | case 'a': | 4025 | case 'a': |
4028 | allowaltscreen = false; | 4026 | allowaltscreen = 0; |
4029 | break; | 4027 | break; |
4030 | case 'c': | 4028 | case 'c': |
4031 | opt_class = EARGF(usage()); | 4029 | opt_class = EARGF(usage()); |
@@ -4042,7 +4040,7 @@ main(int argc, char *argv[]) { | |||
4042 | &xw.l, &xw.t, &cols, &rows); | 4040 | &xw.l, &xw.t, &cols, &rows); |
4043 | break; | 4041 | break; |
4044 | case 'i': | 4042 | case 'i': |
4045 | xw.isfixed = True; | 4043 | xw.isfixed = 1; |
4046 | break; | 4044 | break; |
4047 | case 'o': | 4045 | case 'o': |
4048 | opt_io = EARGF(usage()); | 4046 | opt_io = EARGF(usage()); |