mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-14 05:33:59 -04:00
render: use a timer instead of relying on the frame callback for title update throttling
Using the frame callback works most of the time, but e.g. Sway doesn’t call it while the window is hidden, and thus prevents us from updating the title in e.g. stacked views. This patch uses a timer FD instead. We store a timestamp from when the title was last updated. When the application wants to update the title, we first check if we already have a timer running, and if so, does nothing. If no timer is running, check the timestamp. If enough time has passed, update the title immediately. If not, instantiate a timer and wait for it to trigger. Set the minimum time between two updates to ~8ms (twice per frame, for a 60Hz output, and ~once per frame on a 120Hz output). Closes #591
This commit is contained in:
parent
b77dbc341b
commit
535c82d628
4 changed files with 64 additions and 18 deletions
|
|
@ -474,7 +474,6 @@ struct terminal {
|
|||
bool grid;
|
||||
bool csd;
|
||||
bool search;
|
||||
bool title;
|
||||
bool urls;
|
||||
} refresh;
|
||||
|
||||
|
|
@ -483,13 +482,17 @@ struct terminal {
|
|||
bool grid;
|
||||
bool csd;
|
||||
bool search;
|
||||
bool title;
|
||||
bool urls;
|
||||
} pending;
|
||||
|
||||
bool margins; /* Someone explicitly requested a refresh of the margins */
|
||||
bool urgency; /* Signal 'urgency' (paint borders red) */
|
||||
|
||||
struct {
|
||||
struct timeval last_update;
|
||||
int timer_fd;
|
||||
} title;
|
||||
|
||||
int scrollback_lines; /* Number of scrollback lines, from conf (TODO: move out from render struct?) */
|
||||
|
||||
struct {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue