remove unnecessary menu check in submenu.c
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good

This commit is contained in:
IoIxD 2026-09-26 15:45:54 -07:00
commit 4e3d0aba3a

View file

@ -117,9 +117,8 @@ static void click(MwWidget handle) {
if(MwGetInteger(handle, MwNleftPadding) <= handle->mouse_point.x && rc.y <= handle->mouse_point.y && handle->mouse_point.y <= (int)(rc.y + rc.height)) { if(MwGetInteger(handle, MwNleftPadding) <= handle->mouse_point.x && rc.y <= handle->mouse_point.y && handle->mouse_point.y <= (int)(rc.y + rc.height)) {
if(menu->sub[i]->wsub == NULL && arrlen(menu->sub[i]->sub) > 0) { if(menu->sub[i]->wsub == NULL && arrlen(menu->sub[i]->sub) > 0) {
MwPoint p; MwPoint p;
MwWidget sw; int j;
int j;
for(j = 0; j < arrlen(menu->sub); j++) { for(j = 0; j < arrlen(menu->sub); j++) {
if(menu->sub[j]->wsub != NULL) MwDestroyWidget(menu->sub[j]->wsub); if(menu->sub[j]->wsub != NULL) MwDestroyWidget(menu->sub[j]->wsub);
@ -129,14 +128,8 @@ static void click(MwWidget handle) {
p.x = MwGetInteger(handle, MwNwidth); p.x = MwGetInteger(handle, MwNwidth);
p.y = rc.y - 3; p.y = rc.y - 3;
/* some backends (e.g. Wayland) dispatch input while creating a widget, which can re-enter this handler */ menu->sub[i]->wsub = MwCreateWidget(MwSubMenuClass, "submenu", handle, 0, 0, 0, 0);
sw = MwCreateWidget(MwSubMenuClass, "submenu", handle, 0, 0, 0, 0); MwSubMenuAppear(menu->sub[i]->wsub, menu->sub[i], &p, 0);
if(sw != NULL && (menu->sub[i]->wsub != NULL || handle->destroyed)) {
MwDestroyWidget(sw);
} else if(sw != NULL) {
menu->sub[i]->wsub = sw;
MwSubMenuAppear(sw, menu->sub[i], &p, 0);
}
i = -1; i = -1;
} else if(menu->sub[i]->wsub != NULL && arrlen(menu->sub[i]->sub) > 0) { } else if(menu->sub[i]->wsub != NULL && arrlen(menu->sub[i]->sub) > 0) {
while(w->parent->widget_class == MwSubMenuClass) w = w->parent; while(w->parent->widget_class == MwSubMenuClass) w = w->parent;