aboutsummaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
authorChristoph Lohmann <20h@r-36.net>2013-04-13 09:44:00 +0200
committerChristoph Lohmann <20h@r-36.net>2013-04-13 09:44:00 +0200
commit1e7816c2023f48728e15cc4128ad8be163986902 (patch)
tree7e02805529326cc235ade1c2e139d98d621eaf74 /st.c
parent5dc48af29e9972527767977be3bbc9c072cf1c13 (diff)
downloadst-1e7816c2023f48728e15cc4128ad8be163986902.tar.gz
st-1e7816c2023f48728e15cc4128ad8be163986902.tar.bz2
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!
Diffstat (limited to 'st.c')
-rw-r--r--st.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/st.c b/st.c
index 23a43c1..c4eafa0 100644
--- a/st.c
+++ b/st.c
@@ -2968,14 +2968,33 @@ xdrawcursor(void) {
/* draw the new one */
if(!(IS_SET(MODE_HIDE))) {
- if(!(xw.state & WIN_FOCUSED))
- g.bg = defaultucs;
-
- if(IS_SET(MODE_REVERSE))
- g.mode |= ATTR_REVERSE, g.fg = defaultcs, g.bg = defaultfg;
+ if(xw.state & WIN_FOCUSED) {
+ if(IS_SET(MODE_REVERSE)) {
+ g.mode |= ATTR_REVERSE;
+ g.fg = defaultcs;
+ g.bg = defaultfg;
+ }
- sl = utf8size(g.c);
- xdraws(g.c, g, term.c.x, term.c.y, 1, sl);
+ sl = utf8size(g.c);
+ xdraws(g.c, g, term.c.x, term.c.y, 1, sl);
+ } else {
+ XftDrawRect(xw.draw, &dc.col[defaultcs],
+ borderpx + term.c.x * xw.cw,
+ borderpx + term.c.y * xw.ch,
+ xw.cw - 1, 1);
+ XftDrawRect(xw.draw, &dc.col[defaultcs],
+ borderpx + term.c.x * xw.cw,
+ borderpx + term.c.y * xw.ch,
+ 1, xw.ch - 1);
+ XftDrawRect(xw.draw, &dc.col[defaultcs],
+ borderpx + (term.c.x + 1) * xw.cw - 1,
+ borderpx + term.c.y * xw.ch,
+ 1, xw.ch - 1);
+ XftDrawRect(xw.draw, &dc.col[defaultcs],
+ borderpx + term.c.x * xw.cw,
+ borderpx + (term.c.y + 1) * xw.ch - 1,
+ xw.cw, 1);
+ }
oldx = term.c.x, oldy = term.c.y;
}
}