A couple of minor patches to st: fix a bug, and mimic xterm cursor when 
window is not focused.

-- 
Mark
From 5f16c44199580b672d31eb0e9e1a49a59bd0b1b0 Mon Sep 17 00:00:00 2001
From: Mark Hills <[email protected]>
Date: Fri, 6 Apr 2012 01:04:17 +0100
Subject: [PATCH 1/2] Display cursor even when window is not focused

Mimic the behaviour of xterm, and show a hollow cursor.
---
 st.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/st.c b/st.c
index abaa7bf..0ee9a67 100644
--- a/st.c
+++ b/st.c
@@ -1833,6 +1833,10 @@ xdrawcursor(void) {
                        g.mode |= ATTR_REVERSE, g.fg = DefaultCS, g.bg = 
DefaultFG;
                xdraws(g.c, g, term.c.x, term.c.y, 1, sl);
                oldx = term.c.x, oldy = term.c.y;
+       } else {
+               XSetForeground(xw.dpy, dc.gc, dc.col[DefaultCS]);
+               XDrawRectangle(xw.dpy, xw.buf, dc.gc, term.c.x * xw.cw, 
term.c.y * xw.ch,
+                       xw.cw - 1, xw.ch - 1);
        }
 
        xcopy(term.c.x, term.c.y, 1, 1);
-- 
1.7.4.4

From c6591fa8569c68e6a7d3490ef00f05ec8d8b4b50 Mon Sep 17 00:00:00 2001
From: Mark Hills <[email protected]>
Date: Fri, 6 Apr 2012 01:17:20 +0100
Subject: [PATCH 2/2] Consider a redraw on visibility change

Ensure that a change in visibility redraws the terminal. This is most
notable on startup, when it is possible for ttyread() to read the shell
prompt before the window is visible.
---
 st.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/st.c b/st.c
index 0ee9a67..b3ad904 100644
--- a/st.c
+++ b/st.c
@@ -1912,6 +1912,7 @@ visibility(XEvent *ev) {
        else if(!(xw.state & WIN_VISIBLE))
                /* need a full redraw for next Expose, not just a buf copy */
                xw.state |= WIN_VISIBLE | WIN_REDRAW;
+               draw();
 }
 
 void
-- 
1.7.4.4

Reply via email to