diff options
| author | Christoph Lohmann <20h@r-36.net> | 2013-04-13 09:44:00 +0200 |
|---|---|---|
| committer | Christoph Lohmann <20h@r-36.net> | 2013-04-13 09:44:00 +0200 |
| commit | 1e7816c2023f48728e15cc4128ad8be163986902 (patch) | |
| tree | 7e02805529326cc235ade1c2e139d98d621eaf74 | |
| parent | 5dc48af29e9972527767977be3bbc9c072cf1c13 (diff) | |
| download | st-1e7816c2023f48728e15cc4128ad8be163986902.tar.gz st-1e7816c2023f48728e15cc4128ad8be163986902.zip | |
Drawing a more visible rectangle as cursor on unfocus.
To have a more visible cursor on unfocused windows this patch makes st draw a
rectangle around the terminal cell.
Thanks Mark Hills <mark@xwax.org> for the suggestion!
| -rw-r--r-- | config.def.h | 4 | ||||
| -rw-r--r-- | st.c | 33 |
2 files changed, 27 insertions, 10 deletions
diff --git a/config.def.h b/config.def.h index 2c97266..d1c20bd 100644 --- a/config.def.h +++ b/config.def.h | |||
| @@ -52,18 +52,16 @@ static const char *colorname[] = { | |||
| 52 | 52 | ||
| 53 | /* more colors can be added after 255 to use with DefaultXX */ | 53 | /* more colors can be added after 255 to use with DefaultXX */ |
| 54 | "#cccccc", | 54 | "#cccccc", |
| 55 | "#333333", | ||
| 56 | }; | 55 | }; |
| 57 | 56 | ||
| 58 | 57 | ||
| 59 | /* | 58 | /* |
| 60 | * Default colors (colorname index) | 59 | * Default colors (colorname index) |
| 61 | * foreground, background, cursor, unfocused cursor | 60 | * foreground, background, cursor |
| 62 | */ | 61 | */ |
| 63 | static unsigned int defaultfg = 7; | 62 | static unsigned int defaultfg = 7; |
| 64 | static unsigned int defaultbg = 0; | 63 | static unsigned int defaultbg = 0; |
| 65 | static unsigned int defaultcs = 256; | 64 | static unsigned int defaultcs = 256; |
| 66 | static unsigned int defaultucs = 257; | ||
| 67 | 65 | ||
| 68 | /* | 66 | /* |
| 69 | * Colors used, when the specific fg == defaultfg. So in reverse mode this | 67 | * Colors used, when the specific fg == defaultfg. So in reverse mode this |
| @@ -2968,14 +2968,33 @@ xdrawcursor(void) { | |||
| 2968 | 2968 | ||
| 2969 | /* draw the new one */ | 2969 | /* draw the new one */ |
| 2970 | if(!(IS_SET(MODE_HIDE))) { | 2970 | if(!(IS_SET(MODE_HIDE))) { |
| 2971 | if(!(xw.state & WIN_FOCUSED)) | 2971 | if(xw.state & WIN_FOCUSED) { |
| 2972 | g.bg = defaultucs; | 2972 | if(IS_SET(MODE_REVERSE)) { |
| 2973 | 2973 | g.mode |= ATTR_REVERSE; | |
| 2974 | if(IS_SET(MODE_REVERSE)) | 2974 | g.fg = defaultcs; |
| 2975 | g.mode |= ATTR_REVERSE, g.fg = defaultcs, g.bg = defaultfg; | 2975 | g.bg = defaultfg; |
| 2976 | } | ||
| 2976 | 2977 | ||
| 2977 | sl = utf8size(g.c); | 2978 | sl = utf8size(g.c); |
| 2978 | xdraws(g.c, g, term.c.x, term.c.y, 1, sl); | 2979 | xdraws(g.c, g, term.c.x, term.c.y, 1, sl); |
| 2980 | } else { | ||
| 2981 | XftDrawRect(xw.draw, &dc.col[defaultcs], | ||
| 2982 | borderpx + term.c.x * xw.cw, | ||
| 2983 | borderpx + term.c.y * xw.ch, | ||
| 2984 | xw.cw - 1, 1); | ||
| 2985 | XftDrawRect(xw.draw, &dc.col[defaultcs], | ||
| 2986 | borderpx + term.c.x * xw.cw, | ||
| 2987 | borderpx + term.c.y * xw.ch, | ||
| 2988 | 1, xw.ch - 1); | ||
| 2989 | XftDrawRect(xw.draw, &dc.col[defaultcs], | ||
| 2990 | borderpx + (term.c.x + 1) * xw.cw - 1, | ||
| 2991 | borderpx + term.c.y * xw.ch, | ||
| 2992 | 1, xw.ch - 1); | ||
| 2993 | XftDrawRect(xw.draw, &dc.col[defaultcs], | ||
| 2994 | borderpx + term.c.x * xw.cw, | ||
| 2995 | borderpx + (term.c.y + 1) * xw.ch - 1, | ||
| 2996 | xw.cw, 1); | ||
| 2997 | } | ||
| 2979 | oldx = term.c.x, oldy = term.c.y; | 2998 | oldx = term.c.x, oldy = term.c.y; |
| 2980 | } | 2999 | } |
| 2981 | } | 3000 | } |
