summaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2020-03-11 09:43:27 -0400
committerGitHub <noreply@github.com>2020-03-11 09:43:27 -0400
commit6725a2fde0127694176901ebf6217024b832fd8e (patch)
treecffce4fba9f9fbdeaa36457b056409196085fa02 /st.c
parente2a59d5521775042eda2fa64bfc847fc388df6c2 (diff)
parenta96c33e81ef8918743b47511a0488be0d585460a (diff)
Merge pull request #85 from jbenden/xim_interval
Add interval timer to XIM spot updates
Diffstat (limited to 'st.c')
-rw-r--r--st.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/st.c b/st.c
index 21c6739..e4df60c 100644
--- a/st.c
+++ b/st.c
@@ -14,6 +14,7 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <termios.h>
+#include <time.h>
#include <unistd.h>
#include <wchar.h>
@@ -142,6 +143,7 @@ typedef struct {
int charset; /* current charset */
int icharset; /* selected charset for sequence */
int *tabs;
+ struct timespec last_ximspot_update;
} Term;
/* CSI Escape sequence structs */
@@ -1056,6 +1058,7 @@ void
tnew(int col, int row)
{
term = (Term){ .c = { .attr = { .fg = defaultfg, .bg = defaultbg } } };
+ clock_gettime(CLOCK_MONOTONIC, &term.last_ximspot_update);
tresize(col, row);
treset();
}
@@ -2744,7 +2747,13 @@ 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);
+
+ struct timespec now;
+ clock_gettime(CLOCK_MONOTONIC, &now);
+ if (ximspot_update_interval && TIMEDIFF(now, term.last_ximspot_update) > ximspot_update_interval) {
+ xximspot(term.ocx, term.ocy);
+ term.last_ximspot_update = now;
+ }
}
void