Merge pull request #85 from jbenden/xim_interval
Add interval timer to XIM spot updates
This commit is contained in:
commit
6725a2fde0
8
config.h
8
config.h
@ -52,6 +52,13 @@ static unsigned int actionfps = 30;
|
|||||||
*/
|
*/
|
||||||
static unsigned int blinktimeout = 800;
|
static unsigned int blinktimeout = 800;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* interval (in milliseconds) between each successive call to ximspot. This
|
||||||
|
* improves terminal performance while not reducing functionality to those
|
||||||
|
* whom need XIM support.
|
||||||
|
*/
|
||||||
|
int ximspot_update_interval = 1000;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* thickness of underline and bar cursors
|
* thickness of underline and bar cursors
|
||||||
*/
|
*/
|
||||||
@ -187,6 +194,7 @@ ResourcePref resources[] = {
|
|||||||
{ "cwscale", FLOAT, &cwscale },
|
{ "cwscale", FLOAT, &cwscale },
|
||||||
{ "chscale", FLOAT, &chscale },
|
{ "chscale", FLOAT, &chscale },
|
||||||
{ "alpha", FLOAT, &alpha },
|
{ "alpha", FLOAT, &alpha },
|
||||||
|
{ "ximspot_update_interval", INTEGER, &ximspot_update_interval },
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
11
st.c
11
st.c
@ -14,6 +14,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
|
||||||
@ -142,6 +143,7 @@ typedef struct {
|
|||||||
int charset; /* current charset */
|
int charset; /* current charset */
|
||||||
int icharset; /* selected charset for sequence */
|
int icharset; /* selected charset for sequence */
|
||||||
int *tabs;
|
int *tabs;
|
||||||
|
struct timespec last_ximspot_update;
|
||||||
} Term;
|
} Term;
|
||||||
|
|
||||||
/* CSI Escape sequence structs */
|
/* CSI Escape sequence structs */
|
||||||
@ -1056,6 +1058,7 @@ void
|
|||||||
tnew(int col, int row)
|
tnew(int col, int row)
|
||||||
{
|
{
|
||||||
term = (Term){ .c = { .attr = { .fg = defaultfg, .bg = defaultbg } } };
|
term = (Term){ .c = { .attr = { .fg = defaultfg, .bg = defaultbg } } };
|
||||||
|
clock_gettime(CLOCK_MONOTONIC, &term.last_ximspot_update);
|
||||||
tresize(col, row);
|
tresize(col, row);
|
||||||
treset();
|
treset();
|
||||||
}
|
}
|
||||||
@ -2744,7 +2747,13 @@ draw(void)
|
|||||||
term.ocx, term.ocy, term.line[term.ocy][term.ocx]);
|
term.ocx, term.ocy, term.line[term.ocy][term.ocx]);
|
||||||
term.ocx = cx, term.ocy = term.c.y;
|
term.ocx = cx, term.ocy = term.c.y;
|
||||||
xfinishdraw();
|
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
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user