commit 24655590511877ace0775883b89b2e9bc4c5dddf
parent f7b0d77a03a2b39b96d05e91928df0ad8df0f49f
Author: bakkeby <bakkeby@gmail.com>
Date: Thu, 16 Apr 2020 11:19:33 +0200
[st][PATCH] Update XIM cursor position only if changed
Updating XIM cursor position is expensive, so only update it when cursor
position changed.
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/st.c b/st.c
@@ -2735,7 +2735,7 @@ drawregion(int x1, int y1, int x2, int y2)
void
draw(void)
{
- int cx = term.c.x;
+ int cx = term.c.x, ocx = term.ocx, ocy = term.ocy;
if (!xstartdraw())
return;
@@ -2757,7 +2757,8 @@ draw(void)
term.ocx, term.ocy, term.line[term.ocy][term.ocx]);
term.ocx = cx, term.ocy = term.c.y;
xfinishdraw();
- xximspot(term.ocx, term.ocy);
+ if (ocx != term.ocx || ocy != term.ocy)
+ xximspot(term.ocx, term.ocy);
}
void