aboutsummaryrefslogtreecommitdiff
path: root/src/state.c
diff options
context:
space:
mode:
authorFederico Angelilli <code@fedang.net>2023-11-25 11:11:15 +0100
committerFederico Angelilli <code@fedang.net>2023-11-25 11:11:15 +0100
commit61f65a2e24fb7ac9739db934baa6e9fa53641c5f (patch)
tree7a33aa962e60e3c8a9e96162105cf9832b54bd31 /src/state.c
parent710672df7e0d1e65b6253efb7af714c326a777db (diff)
Change redraw scheduling and use posix timer in date_update
Diffstat (limited to 'src/state.c')
-rw-r--r--src/state.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/state.c b/src/state.c
index c2f2a4a..64c479b 100644
--- a/src/state.c
+++ b/src/state.c
@@ -19,6 +19,19 @@ void state_add_button(State *state, Button *btn)
state->btns = g_list_append(state->btns, btn);
}
+static gboolean redraw(gpointer data)
+{
+ State *state = data;
+ draw_compute_layout(state->draw, state->win, state->btns);
+ draw_paint(state->draw, state->win);
+ return G_SOURCE_REMOVE;
+}
+
+void state_redraw(State *state)
+{
+ g_idle_add_full(G_PRIORITY_HIGH_IDLE, redraw, state, NULL);
+}
+
void state_destroy(State *state)
{
g_list_free_full(state->btns, (void *)button_destroy);