From a65d77ae2dc648a4791d771203cd7e6857ffd106 Mon Sep 17 00:00:00 2001 From: NishiOwO Date: Tue, 30 Sep 2025 03:14:02 +0000 Subject: [PATCH] evil git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@73 b9cfdab3-6d41-4d17-bbe4-086880011989 --- include/Mw/Core.h | 2 ++ include/Mw/MachDep.h | 1 + include/Mw/TypeDefs.h | 5 +++-- src/core.c | 6 ++++++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/include/Mw/Core.h b/include/Mw/Core.h index 00d0007..b5e4095 100644 --- a/include/Mw/Core.h +++ b/include/Mw/Core.h @@ -37,6 +37,8 @@ MWDECL void MwDispatchUserHandler(MwWidget handle, const char* key, void* handle MWDECL void MwSetErrorHandler(MwErrorHandler handler, void* user_data); MWDECL void MwDispatchError(int code, const char* message); +MWDECL jmp_buf MwGetBeforeStep(MwWidget handle); + #ifdef __cplusplus } #endif diff --git a/include/Mw/MachDep.h b/include/Mw/MachDep.h index 5b05ddf..d9004a2 100644 --- a/include/Mw/MachDep.h +++ b/include/Mw/MachDep.h @@ -6,6 +6,7 @@ #include #include #include +#include #ifdef _WIN32 #include #else diff --git a/include/Mw/TypeDefs.h b/include/Mw/TypeDefs.h index 93829c8..9d231a1 100644 --- a/include/Mw/TypeDefs.h +++ b/include/Mw/TypeDefs.h @@ -61,8 +61,9 @@ struct _MwWidget { MwWidget* children; MwClass widget_class; - int pressed; - int close; + int pressed; + int close; + jmp_buf before_step; void* internal; diff --git a/src/core.c b/src/core.c index a6a1281..7287619 100644 --- a/src/core.c +++ b/src/core.c @@ -142,6 +142,8 @@ int MwPending(MwWidget handle) { void MwLoop(MwWidget handle) { while(!handle->close) { + setjmp(handle->before_step); + MwStep(handle); MwDispatchUserHandler(handle, MwNtickHandler, NULL); @@ -273,3 +275,7 @@ void MwDispatchError(int code, const char* message) { exit(1); } } + +jmp_buf MwGetBeforeStep(MwWidget handle) { + return handle->before_step; +}