fix animation timeout

This commit is contained in:
hippoz 2023-04-13 04:11:15 +03:00
parent 7b75cdb768
commit 793918f86f
Signed by: hippoz
GPG key ID: 56C4E02A85F2FBED
3 changed files with 5 additions and 7 deletions

View file

@ -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)

View file

@ -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;
}

View file

@ -5,6 +5,7 @@
//#define PROF
#include "prof.c"
#include "time.h"
#include <stdint.h>
#include <stdlib.h>
#include <sys/poll.h>
#include <time.h>
@ -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) {