git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@73 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-09-30 03:14:02 +00:00
parent b39742be52
commit a65d77ae2d
4 changed files with 12 additions and 2 deletions

View File

@@ -37,6 +37,8 @@ MWDECL void MwDispatchUserHandler(MwWidget handle, const char* key, void* handle
MWDECL void MwSetErrorHandler(MwErrorHandler handler, void* user_data); MWDECL void MwSetErrorHandler(MwErrorHandler handler, void* user_data);
MWDECL void MwDispatchError(int code, const char* message); MWDECL void MwDispatchError(int code, const char* message);
MWDECL jmp_buf MwGetBeforeStep(MwWidget handle);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@@ -6,6 +6,7 @@
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include <setjmp.h>
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#else #else

View File

@@ -61,8 +61,9 @@ struct _MwWidget {
MwWidget* children; MwWidget* children;
MwClass widget_class; MwClass widget_class;
int pressed; int pressed;
int close; int close;
jmp_buf before_step;
void* internal; void* internal;

View File

@@ -142,6 +142,8 @@ int MwPending(MwWidget handle) {
void MwLoop(MwWidget handle) { void MwLoop(MwWidget handle) {
while(!handle->close) { while(!handle->close) {
setjmp(handle->before_step);
MwStep(handle); MwStep(handle);
MwDispatchUserHandler(handle, MwNtickHandler, NULL); MwDispatchUserHandler(handle, MwNtickHandler, NULL);
@@ -273,3 +275,7 @@ void MwDispatchError(int code, const char* message) {
exit(1); exit(1);
} }
} }
jmp_buf MwGetBeforeStep(MwWidget handle) {
return handle->before_step;
}