fix bugs
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@500 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
parent
603997c082
commit
6a9b2bc614
2 changed files with 11 additions and 4 deletions
|
|
@ -116,8 +116,9 @@ MWDECL void MwLoop(MwWidget handle);
|
||||||
/*!
|
/*!
|
||||||
* @brief Runs the single step
|
* @brief Runs the single step
|
||||||
* @param handle Widget
|
* @param handle Widget
|
||||||
|
* @return `0` if successful
|
||||||
*/
|
*/
|
||||||
MWDECL void MwStep(MwWidget handle);
|
MWDECL int MwStep(MwWidget handle);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Check if any event is pending
|
* @brief Check if any event is pending
|
||||||
|
|
|
||||||
12
src/core.c
12
src/core.c
|
|
@ -263,9 +263,9 @@ static void clean_destroy_queue(MwWidget handle) {
|
||||||
arrfree(handle->destroy_queue);
|
arrfree(handle->destroy_queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MwStep(MwWidget handle) {
|
int MwStep(MwWidget handle) {
|
||||||
int i;
|
int i;
|
||||||
if(setjmp(handle->before_step)) return;
|
if(setjmp(handle->before_step)) return 0;
|
||||||
for(i = 0; i < arrlen(handle->children); i++) MwStep(handle->children[i]);
|
for(i = 0; i < arrlen(handle->children); i++) MwStep(handle->children[i]);
|
||||||
|
|
||||||
handle->prop_event = 0;
|
handle->prop_event = 0;
|
||||||
|
|
@ -273,6 +273,8 @@ void MwStep(MwWidget handle) {
|
||||||
handle->prop_event = 1;
|
handle->prop_event = 1;
|
||||||
|
|
||||||
clean_destroy_queue(handle);
|
clean_destroy_queue(handle);
|
||||||
|
if(handle->parent == NULL && handle->destroyed) return 1;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MwPending(MwWidget handle) {
|
int MwPending(MwWidget handle) {
|
||||||
|
|
@ -287,7 +289,11 @@ void MwLoop(MwWidget handle) {
|
||||||
long tick = MwLLGetTick();
|
long tick = MwLLGetTick();
|
||||||
int i;
|
int i;
|
||||||
while(!handle->close) {
|
while(!handle->close) {
|
||||||
while(MwPending(handle)) MwStep(handle);
|
int v = 0;
|
||||||
|
while(MwPending(handle)) {
|
||||||
|
if((v = MwStep(handle)) != 0) break;
|
||||||
|
}
|
||||||
|
if(v != 0) break;
|
||||||
|
|
||||||
for(i = 0; i < arrlen(handle->tick_list); i++) {
|
for(i = 0; i < arrlen(handle->tick_list); i++) {
|
||||||
MwDispatchUserHandler(handle->tick_list[i], MwNtickHandler, NULL);
|
MwDispatchUserHandler(handle->tick_list[i], MwNtickHandler, NULL);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue