remove MwMessageBoxDestroy, introduce destroy_inject
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good

This commit is contained in:
Nishi 2026-04-20 02:04:43 +09:00
commit a59154d5f1
Signed by: nishi
GPG key ID: 27EF69B208EB9343
9 changed files with 22 additions and 22 deletions

View file

@ -7,7 +7,7 @@ MwWidget wmain;
void destroy(MwWidget handle, void* user, void* call) {
(void)handle;
(void)call;
MwMessageBoxDestroy(user);
MwDestroyWidget(user);
}
void activate(MwWidget handle, void* user, void* call) {

View file

@ -3,7 +3,7 @@
void ok(MwWidget handle, void* user, void* call) {
(void)handle;
(void)call;
MwMessageBoxDestroy(user);
MwDestroyWidget(user);
}
void spawn(MwWidget handle, void* user, void* call) {

View file

@ -5,7 +5,7 @@ MwWidget wmain;
void destroy(MwWidget handle, void* user, void* call) {
(void)handle;
(void)call;
MwMessageBoxDestroy(user);
MwDestroyWidget(user);
}
void activate(MwWidget handle, void* user, void* call) {

View file

@ -29,12 +29,6 @@ MWDECL MwWidget MwMessageBox(MwWidget handle, const char* text, const char* titl
*/
MWDECL MwWidget MwMessageBoxGetChild(MwWidget handle, int child);
/*!
* @brief Destroys the message box
* @param handle Widget
*/
MWDECL void MwMessageBoxDestroy(MwWidget handle);
#ifdef __cplusplus
}
#endif

View file

@ -91,6 +91,7 @@ struct _MwWidget {
void* internal;
void* opaque;
void (*draw_inject)(MwWidget handle);
void (*destroy_inject)(MwWidget handle);
MwIntegerKeyValue* integer;
MwTextKeyValue* text;

View file

@ -554,11 +554,6 @@
<integer name="child" />
</arguments>
</function>
<function name="MwMessageBoxDestroy">
<arguments>
<widget name="handle" type="Window" />
</arguments>
</function>
</functions>
</header>

View file

@ -200,6 +200,7 @@ MwWidget MwCreateWidget(MwClass widget_class, const char* name, MwWidget parent,
h->destroy_queue = NULL;
h->prop_event = 1;
h->draw_inject = NULL;
h->destroy_inject = NULL;
h->tick_list = NULL;
h->destroyed = 0;
h->bgcolor = NULL;
@ -317,6 +318,7 @@ static void MwFreeWidget(MwWidget handle) {
handle->destroyed = 0;
MwDispatch(handle, destroy);
if(handle->destroy_inject != NULL) handle->destroy_inject(handle);
for(i = 0; i < arrlen(handle->children); i++) {
MwFreeWidget(handle->children[i]);

View file

@ -78,7 +78,7 @@ static void msgbox_okay(MwWidget handle, void* user, void* call) {
(void)user;
(void)call;
MwMessageBoxDestroy(handle->parent);
MwDestroyWidget(handle->parent);
}
static void files_activate(MwWidget handle, void* user, void* call) {

View file

@ -18,6 +18,18 @@ static void spawn_button(MwWidget handle, int x, int y, int id, const char* text
handle->opaque = mb;
}
static void messagebox_destroy_inject(MwWidget handle) {
void* px;
if((px = MwGetVoid(handle, MwNpixmap)) != NULL) MwLLDestroyPixmap(px);
}
static void messagebox_close(MwWidget handle, void* user, void* call) {
(void)user;
(void)call;
MwDestroyWidget(handle);
}
MwWidget MwMessageBox(MwWidget handle, const char* text, const char* title, unsigned int flag) {
MwWidget window;
int w, h;
@ -106,6 +118,9 @@ MwWidget MwMessageBox(MwWidget handle, const char* text, const char* title, unsi
MwLLMakePopup(window->lowlevel, handle == NULL ? NULL : handle->lowlevel);
MwLLEndStateChange(window->lowlevel);
MwAddUserHandler(window, MwNcloseHandler, messagebox_close, NULL);
window->destroy_inject = messagebox_destroy_inject;
return window;
}
@ -114,10 +129,3 @@ MwWidget MwMessageBoxGetChild(MwWidget handle, int child) {
return hmget(mb, child);
}
void MwMessageBoxDestroy(MwWidget handle) {
void* px;
if((px = MwGetVoid(handle, MwNpixmap)) != NULL) MwLLDestroyPixmap(px);
MwDestroyWidget(handle);
}