This commit is contained in:
parent
4e3d0aba3a
commit
2d992362b4
1 changed files with 11 additions and 4 deletions
|
|
@ -117,8 +117,9 @@ 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;
|
||||||
int j;
|
MwWidget sw;
|
||||||
|
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);
|
||||||
|
|
@ -128,8 +129,14 @@ 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;
|
||||||
|
|
||||||
menu->sub[i]->wsub = MwCreateWidget(MwSubMenuClass, "submenu", handle, 0, 0, 0, 0);
|
/* some backends (e.g. Wayland) dispatch input while creating a widget, which can re-enter this handler */
|
||||||
MwSubMenuAppear(menu->sub[i]->wsub, menu->sub[i], &p, 0);
|
sw = MwCreateWidget(MwSubMenuClass, "submenu", handle, 0, 0, 0, 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;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue