git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@500 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-10-28 21:04:37 +00:00
parent 603997c082
commit 6a9b2bc614
2 changed files with 11 additions and 4 deletions

View File

@@ -116,8 +116,9 @@ MWDECL void MwLoop(MwWidget handle);
/*!
* @brief Runs the single step
* @param handle Widget
* @return `0` if successful
*/
MWDECL void MwStep(MwWidget handle);
MWDECL int MwStep(MwWidget handle);
/*!
* @brief Check if any event is pending

View File

@@ -263,9 +263,9 @@ static void clean_destroy_queue(MwWidget handle) {
arrfree(handle->destroy_queue);
}
void MwStep(MwWidget handle) {
int MwStep(MwWidget handle) {
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]);
handle->prop_event = 0;
@@ -273,6 +273,8 @@ void MwStep(MwWidget handle) {
handle->prop_event = 1;
clean_destroy_queue(handle);
if(handle->parent == NULL && handle->destroyed) return 1;
return 0;
}
int MwPending(MwWidget handle) {
@@ -287,7 +289,11 @@ void MwLoop(MwWidget handle) {
long tick = MwLLGetTick();
int i;
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++) {
MwDispatchUserHandler(handle->tick_list[i], MwNtickHandler, NULL);