mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-07 01:49:47 +00:00
wait a little bit
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@593 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
10
src/core.c
10
src/core.c
@@ -296,10 +296,12 @@ void MwLoop(MwWidget handle) {
|
|||||||
long tick = MwLLGetTick();
|
long tick = MwLLGetTick();
|
||||||
int i;
|
int i;
|
||||||
long wait = MwGetInteger(handle, MwNwaitMS);
|
long wait = MwGetInteger(handle, MwNwaitMS);
|
||||||
|
long over = 0;
|
||||||
if(wait == MwDEFAULT) wait = MwWaitMS;
|
if(wait == MwDEFAULT) wait = MwWaitMS;
|
||||||
while(!handle->close) {
|
while(!handle->close) {
|
||||||
int v = 0;
|
int v = 0;
|
||||||
long t, t2;
|
long t, t2;
|
||||||
|
long more;
|
||||||
while(MwPending(handle)) {
|
while(MwPending(handle)) {
|
||||||
if((v = MwStep(handle)) != 0) break;
|
if((v = MwStep(handle)) != 0) break;
|
||||||
}
|
}
|
||||||
@@ -310,12 +312,16 @@ void MwLoop(MwWidget handle) {
|
|||||||
MwDispatchUserHandler(handle->tick_list[i], MwNtickHandler, NULL);
|
MwDispatchUserHandler(handle->tick_list[i], MwNtickHandler, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
t = (tick + wait) - (t2 = MwLLGetTick());
|
more = over % wait;
|
||||||
|
t = (tick + wait - more) - (t2 = MwLLGetTick());
|
||||||
if(t > 0) {
|
if(t > 0) {
|
||||||
MwLLSleep(t);
|
MwLLSleep(t);
|
||||||
tick += wait;
|
tick = MwLLGetTick();
|
||||||
|
over -= more;
|
||||||
} else {
|
} else {
|
||||||
tick = t2;
|
tick = t2;
|
||||||
|
over += -t;
|
||||||
|
printf("%d\n", over);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user