From 793918f86fc8c79e071bd49c3a7a5a4a62ce9a19 Mon Sep 17 00:00:00 2001 From: hippoz <10706925-hippoz@users.noreply.gitlab.com> Date: Thu, 13 Apr 2023 04:11:15 +0300 Subject: [PATCH] fix animation timeout --- Makefile | 2 +- src/main.c | 4 ++-- src/window.c | 6 ++---- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index a338d3d..9fff823 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ CC=clang LIBS:=`pkg-config --libs xcb cairo pangocairo` -lm -CFLAGS:=$(CFLAGS) -pipe -Wall -Wextra -Wshadow -std=c99 -pedantic `pkg-config --cflags xcb cairo pangocairo` +CFLAGS:=$(CFLAGS) -pipe -Wall -Wextra -Wshadow -std=gnu99 -pedantic `pkg-config --cflags xcb cairo pangocairo` BUILD=build OBJ=$(BUILD) diff --git a/src/main.c b/src/main.c index a6c6e3a..3562b6e 100644 --- a/src/main.c +++ b/src/main.c @@ -104,7 +104,7 @@ int app_handle(struct UINode *node, void *data, int event_type, size_t d, void * state->sidebar_animate_start_w = state->sidebar_node->rect.w; state->sidebar_animate_target_w = state->sidebar_node->rect.w == 0 ? 200 : 0; state->sidebar_animate_time_ms = 0.0; - window_sched_timer(node->window, state->sidebar_node, 16); + window_sched_timer(node->window, state->sidebar_node, 8); break; } case SIDEBAR_ANIAMTE: { @@ -124,7 +124,7 @@ int app_handle(struct UINode *node, void *data, int event_type, size_t d, void * return 0; } - window_sched_timer(node->window, state->sidebar_node, 10); + window_sched_timer(node->window, state->sidebar_node, 8); return 1; } diff --git a/src/window.c b/src/window.c index 507fea3..2ca3393 100644 --- a/src/window.c +++ b/src/window.c @@ -5,6 +5,7 @@ //#define PROF #include "prof.c" #include "time.h" +#include #include #include #include @@ -295,7 +296,7 @@ int window_turn(UIWindow *window) /* compute `poll_timeout` based on active timers */ { int64_t now = time_current_ms(); - int64_t lowest = 0; + int64_t lowest = INT64_MAX; bool has_timer = false; for (int i = 0; i < UI_WINDOW_MAX_TIMERS; i++) { UIWindowTimer *timer = &window->timers[i]; @@ -307,9 +308,6 @@ int window_turn(UIWindow *window) } } } - if (lowest < 0) { - lowest = 0; - } poll_timeout = has_timer ? lowest : -1; if (!has_looped_once) {