diff options
| author | Roberto E. Vargas Caballero <k0ga@shike2.com> | 2015-04-13 22:01:40 +0200 |
|---|---|---|
| committer | Roberto E. Vargas Caballero <k0ga@shike2.com> | 2015-04-13 22:01:40 +0200 |
| commit | 23ed12857f113603b689521d3f6e40ff954d25bb (patch) | |
| tree | 8fa6fbef7960e60bbe537bf29937bba6d0a4cd31 | |
| parent | 9eb70a2d3ecbd96a92e5f824868500baba74b688 (diff) | |
| parent | ecac5ee35ef006001b280461ed3f9812d855250c (diff) | |
| download | st-23ed12857f113603b689521d3f6e40ff954d25bb.tar.gz st-23ed12857f113603b689521d3f6e40ff954d25bb.zip | |
Merge branch 'master' of ssh://suckless.org/gitrepos/st
| -rw-r--r-- | config.def.h | 5 | ||||
| -rw-r--r-- | st.c | 48 |
2 files changed, 26 insertions, 27 deletions
diff --git a/config.def.h b/config.def.h index 56bae2d..5e7caaf 100644 --- a/config.def.h +++ b/config.def.h | |||
| @@ -42,6 +42,11 @@ static unsigned int actionfps = 30; | |||
| 42 | static unsigned int blinktimeout = 800; | 42 | static unsigned int blinktimeout = 800; |
| 43 | 43 | ||
| 44 | /* | 44 | /* |
| 45 | * thickness of underline and bar cursors | ||
| 46 | */ | ||
| 47 | static unsigned int cursorthickness = 2; | ||
| 48 | |||
| 49 | /* | ||
| 45 | * bell volume. It must be a value between -100 and 100. Use 0 for disabling | 50 | * bell volume. It must be a value between -100 and 100. Use 0 for disabling |
| 46 | * it | 51 | * it |
| 47 | */ | 52 | */ |
| @@ -359,7 +359,7 @@ static void csidump(void); | |||
| 359 | static void csihandle(void); | 359 | static void csihandle(void); |
| 360 | static void csiparse(void); | 360 | static void csiparse(void); |
| 361 | static void csireset(void); | 361 | static void csireset(void); |
| 362 | static int eschandle(uchar ascii); | 362 | static int eschandle(uchar); |
| 363 | static void strdump(void); | 363 | static void strdump(void); |
| 364 | static void strhandle(void); | 364 | static void strhandle(void); |
| 365 | static void strparse(void); | 365 | static void strparse(void); |
| @@ -406,8 +406,9 @@ static void ttyread(void); | |||
| 406 | static void ttyresize(void); | 406 | static void ttyresize(void); |
| 407 | static void ttysend(char *, size_t); | 407 | static void ttysend(char *, size_t); |
| 408 | static void ttywrite(const char *, size_t); | 408 | static void ttywrite(const char *, size_t); |
| 409 | static void tstrsequence(uchar c); | 409 | static void tstrsequence(uchar); |
| 410 | 410 | ||
| 411 | static inline ushort sixd_to_16bit(int); | ||
| 411 | static void xdraws(char *, Glyph, int, int, int, int); | 412 | static void xdraws(char *, Glyph, int, int, int, int); |
| 412 | static void xhints(void); | 413 | static void xhints(void); |
| 413 | static void xclear(int, int, int, int); | 414 | static void xclear(int, int, int, int); |
| @@ -418,7 +419,6 @@ static int xsetcolorname(int, const char *); | |||
| 418 | static int xgeommasktogravity(int); | 419 | static int xgeommasktogravity(int); |
| 419 | static int xloadfont(Font *, FcPattern *); | 420 | static int xloadfont(Font *, FcPattern *); |
| 420 | static void xloadfonts(char *, double); | 421 | static void xloadfonts(char *, double); |
| 421 | static int xloadfontset(Font *); | ||
| 422 | static void xsettitle(char *); | 422 | static void xsettitle(char *); |
| 423 | static void xresettitle(void); | 423 | static void xresettitle(void); |
| 424 | static void xsetpointermotion(int); | 424 | static void xsetpointermotion(int); |
| @@ -452,6 +452,8 @@ static char *getsel(void); | |||
| 452 | static void selcopy(void); | 452 | static void selcopy(void); |
| 453 | static void selscroll(int, int); | 453 | static void selscroll(int, int); |
| 454 | static void selsnap(int, int *, int *, int); | 454 | static void selsnap(int, int *, int *, int); |
| 455 | static int x2col(int); | ||
| 456 | static int y2row(int); | ||
| 455 | static void getbuttoninfo(XEvent *); | 457 | static void getbuttoninfo(XEvent *); |
| 456 | static void mousereport(XEvent *); | 458 | static void mousereport(XEvent *); |
| 457 | 459 | ||
| @@ -640,7 +642,7 @@ utf8validate(long *u, size_t i) { | |||
| 640 | return i; | 642 | return i; |
| 641 | } | 643 | } |
| 642 | 644 | ||
| 643 | static void | 645 | void |
| 644 | selinit(void) { | 646 | selinit(void) { |
| 645 | memset(&sel.tclick1, 0, sizeof(sel.tclick1)); | 647 | memset(&sel.tclick1, 0, sizeof(sel.tclick1)); |
| 646 | memset(&sel.tclick2, 0, sizeof(sel.tclick2)); | 648 | memset(&sel.tclick2, 0, sizeof(sel.tclick2)); |
| @@ -653,7 +655,7 @@ selinit(void) { | |||
| 653 | sel.xtarget = XA_STRING; | 655 | sel.xtarget = XA_STRING; |
| 654 | } | 656 | } |
| 655 | 657 | ||
| 656 | static int | 658 | int |
| 657 | x2col(int x) { | 659 | x2col(int x) { |
| 658 | x -= borderpx; | 660 | x -= borderpx; |
| 659 | x /= xw.cw; | 661 | x /= xw.cw; |
| @@ -661,7 +663,7 @@ x2col(int x) { | |||
| 661 | return LIMIT(x, 0, term.col-1); | 663 | return LIMIT(x, 0, term.col-1); |
| 662 | } | 664 | } |
| 663 | 665 | ||
| 664 | static int | 666 | int |
| 665 | y2row(int y) { | 667 | y2row(int y) { |
| 666 | y -= borderpx; | 668 | y -= borderpx; |
| 667 | y /= xw.ch; | 669 | y /= xw.ch; |
| @@ -669,7 +671,7 @@ y2row(int y) { | |||
| 669 | return LIMIT(y, 0, term.row-1); | 671 | return LIMIT(y, 0, term.row-1); |
| 670 | } | 672 | } |
| 671 | 673 | ||
| 672 | static int tlinelen(int y) { | 674 | int tlinelen(int y) { |
| 673 | int i = term.col; | 675 | int i = term.col; |
| 674 | 676 | ||
| 675 | if(term.line[y][i - 1].mode & ATTR_WRAP) | 677 | if(term.line[y][i - 1].mode & ATTR_WRAP) |
| @@ -681,7 +683,7 @@ static int tlinelen(int y) { | |||
| 681 | return i; | 683 | return i; |
| 682 | } | 684 | } |
| 683 | 685 | ||
| 684 | static void | 686 | void |
| 685 | selnormalize(void) { | 687 | selnormalize(void) { |
| 686 | int i; | 688 | int i; |
| 687 | 689 | ||
| @@ -708,7 +710,7 @@ selnormalize(void) { | |||
| 708 | sel.ne.x = term.col - 1; | 710 | sel.ne.x = term.col - 1; |
| 709 | } | 711 | } |
| 710 | 712 | ||
| 711 | static inline bool | 713 | bool |
| 712 | selected(int x, int y) { | 714 | selected(int x, int y) { |
| 713 | if(sel.type == SEL_RECTANGULAR) | 715 | if(sel.type == SEL_RECTANGULAR) |
| 714 | return BETWEEN(y, sel.nb.y, sel.ne.y) | 716 | return BETWEEN(y, sel.nb.y, sel.ne.y) |
| @@ -2857,7 +2859,7 @@ xresize(int col, int row) { | |||
| 2857 | xclear(0, 0, xw.w, xw.h); | 2859 | xclear(0, 0, xw.w, xw.h); |
| 2858 | } | 2860 | } |
| 2859 | 2861 | ||
| 2860 | static inline ushort | 2862 | ushort |
| 2861 | sixd_to_16bit(int x) { | 2863 | sixd_to_16bit(int x) { |
| 2862 | return x == 0 ? 0 : 0x3737 + 0x2828 * x; | 2864 | return x == 0 ? 0 : 0x3737 + 0x2828 * x; |
| 2863 | } | 2865 | } |
| @@ -3113,15 +3115,6 @@ xloadfonts(char *fontstr, double fontsize) { | |||
| 3113 | FcPatternDestroy(pattern); | 3115 | FcPatternDestroy(pattern); |
| 3114 | } | 3116 | } |
| 3115 | 3117 | ||
| 3116 | int | ||
| 3117 | xloadfontset(Font *f) { | ||
| 3118 | FcResult result; | ||
| 3119 | |||
| 3120 | if(!(f->set = FcFontSort(0, f->pattern, FcTrue, 0, &result))) | ||
| 3121 | return 1; | ||
| 3122 | return 0; | ||
| 3123 | } | ||
| 3124 | |||
| 3125 | void | 3118 | void |
| 3126 | xunloadfont(Font *f) { | 3119 | xunloadfont(Font *f) { |
| 3127 | XftFontClose(xw.dpy, f->match); | 3120 | XftFontClose(xw.dpy, f->match); |
| @@ -3469,7 +3462,8 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) { | |||
| 3469 | /* Nothing was found. */ | 3462 | /* Nothing was found. */ |
| 3470 | if(i >= frclen) { | 3463 | if(i >= frclen) { |
| 3471 | if(!font->set) | 3464 | if(!font->set) |
| 3472 | xloadfontset(font); | 3465 | font->set = FcFontSort(0, font->pattern, |
| 3466 | FcTrue, 0, &fcres); | ||
| 3473 | fcsets[0] = font->set; | 3467 | fcsets[0] = font->set; |
| 3474 | 3468 | ||
| 3475 | /* | 3469 | /* |
| @@ -3597,15 +3591,15 @@ xdrawcursor(void) { | |||
| 3597 | case 4: /* Steady Underline */ | 3591 | case 4: /* Steady Underline */ |
| 3598 | XftDrawRect(xw.draw, &dc.col[defaultcs], | 3592 | XftDrawRect(xw.draw, &dc.col[defaultcs], |
| 3599 | borderpx + curx * xw.cw, | 3593 | borderpx + curx * xw.cw, |
| 3600 | borderpx + (term.c.y + 1) * xw.ch - 1, | 3594 | borderpx + (term.c.y + 1) * xw.ch - cursorthickness, |
| 3601 | xw.cw, 1); | 3595 | xw.cw, cursorthickness); |
| 3602 | break; | 3596 | break; |
| 3603 | case 5: /* Blinking bar */ | 3597 | case 5: /* Blinking bar */ |
| 3604 | case 6: /* Steady bar */ | 3598 | case 6: /* Steady bar */ |
| 3605 | XftDrawRect(xw.draw, &dc.col[defaultcs], | 3599 | XftDrawRect(xw.draw, &dc.col[defaultcs], |
| 3606 | borderpx + curx * xw.cw, | 3600 | borderpx + curx * xw.cw, |
| 3607 | borderpx + term.c.y * xw.ch, | 3601 | borderpx + term.c.y * xw.ch, |
| 3608 | 1, xw.ch); | 3602 | cursorthickness, xw.ch); |
| 3609 | break; | 3603 | break; |
| 3610 | } | 3604 | } |
| 3611 | } else { | 3605 | } else { |
| @@ -3772,7 +3766,7 @@ focus(XEvent *ev) { | |||
| 3772 | } | 3766 | } |
| 3773 | } | 3767 | } |
| 3774 | 3768 | ||
| 3775 | static inline bool | 3769 | bool |
| 3776 | match(uint mask, uint state) { | 3770 | match(uint mask, uint state) { |
| 3777 | return mask == XK_ANY_MOD || mask == (state & ~ignoremod); | 3771 | return mask == XK_ANY_MOD || mask == (state & ~ignoremod); |
| 3778 | } | 3772 | } |
| @@ -4078,7 +4072,7 @@ main(int argc, char *argv[]) { | |||
| 4078 | run: | 4072 | run: |
| 4079 | setlocale(LC_CTYPE, ""); | 4073 | setlocale(LC_CTYPE, ""); |
| 4080 | XSetLocaleModifiers(""); | 4074 | XSetLocaleModifiers(""); |
| 4081 | tnew(cols? cols : 1, rows? rows : 1); | 4075 | tnew(MAX(cols, 1), MAX(rows, 1)); |
| 4082 | xinit(); | 4076 | xinit(); |
| 4083 | selinit(); | 4077 | selinit(); |
| 4084 | run(); | 4078 | run(); |
