diff options
| author | noname <noname@inventati.org> | 2014-04-23 23:12:29 +0400 |
|---|---|---|
| committer | Roberto E. Vargas Caballero <k0ga@shike2.com> | 2014-04-25 23:57:43 +0200 |
| commit | 99d2d6007ace1d5558ee349224af275722fcc701 (patch) | |
| tree | e244f5442241b7e1c3f07174ac24ecf3e33707ef /st.c | |
| parent | Conformity in the -g geometry handling. (diff) | |
| download | st-99d2d6007ace1d5558ee349224af275722fcc701.tar.gz st-99d2d6007ace1d5558ee349224af275722fcc701.zip | |
Use BETWEEN macro in xsetcolorname and fix style.
Diffstat (limited to 'st.c')
| -rw-r--r-- | st.c | 6 |
1 files changed, 3 insertions, 3 deletions
| @@ -2751,10 +2751,10 @@ int | |||
| 2751 | xsetcolorname(int x, const char *name) { | 2751 | xsetcolorname(int x, const char *name) { |
| 2752 | XRenderColor color = { .alpha = 0xffff }; | 2752 | XRenderColor color = { .alpha = 0xffff }; |
| 2753 | Colour colour; | 2753 | Colour colour; |
| 2754 | if (x < 0 || x > LEN(colorname)) | 2754 | if(!BETWEEN(x, 0, LEN(colorname))) |
| 2755 | return -1; | 2755 | return -1; |
| 2756 | if(!name) { | 2756 | if(!name) { |
| 2757 | if(16 <= x && x < 16 + 216) { | 2757 | if(BETWEEN(x, 16, 16 + 215)) { |
| 2758 | int r = (x - 16) / 36, g = ((x - 16) % 36) / 6, b = (x - 16) % 6; | 2758 | int r = (x - 16) / 36, g = ((x - 16) % 36) / 6, b = (x - 16) % 6; |
| 2759 | color.red = sixd_to_16bit(r); | 2759 | color.red = sixd_to_16bit(r); |
| 2760 | color.green = sixd_to_16bit(g); | 2760 | color.green = sixd_to_16bit(g); |
| @@ -2763,7 +2763,7 @@ xsetcolorname(int x, const char *name) { | |||
| 2763 | return 0; /* something went wrong */ | 2763 | return 0; /* something went wrong */ |
| 2764 | dc.col[x] = colour; | 2764 | dc.col[x] = colour; |
| 2765 | return 1; | 2765 | return 1; |
| 2766 | } else if (16 + 216 <= x && x < 256) { | 2766 | } else if(BETWEEN(x, 16 + 216, 255)) { |
| 2767 | color.red = color.green = color.blue = 0x0808 + 0x0a0a * (x - (16 + 216)); | 2767 | color.red = color.green = color.blue = 0x0808 + 0x0a0a * (x - (16 + 216)); |
| 2768 | if(!XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &color, &colour)) | 2768 | if(!XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &color, &colour)) |
| 2769 | return 0; /* something went wrong */ | 2769 | return 0; /* something went wrong */ |
