diff --git a/src/widget/submenu.c b/src/widget/submenu.c index 09a0274..3172084 100644 --- a/src/widget/submenu.c +++ b/src/widget/submenu.c @@ -160,14 +160,14 @@ static void click(MwWidget handle) { } static void mwSubMenuAppearImpl(MwWidget handle, MwMenu menu, MwPoint* point) { - int i, w = 0, h = 0; + int i, w = 0, h = 0; + MwRect rc; + MwPoint p = *point; + + MwGetScreenSize(handle, &rc); handle->internal = menu; - MwLLMakeToolWindow(handle->lowlevel); - MwLLDetach(handle->lowlevel, point); - MwLLEndStateChange(handle->lowlevel); - for(i = 0; i < arrlen(menu->sub); i++) { if(strcmp(menu->sub[i]->name, "----") == 0) { h += MwDefaultBorderWidth(handle) * 2 + 2; @@ -183,6 +183,16 @@ static void mwSubMenuAppearImpl(MwWidget handle, MwMenu menu, MwPoint* point) { w += 10 + 15; h += 3; + MwLLMakeToolWindow(handle->lowlevel); + MwLLDetach(handle->lowlevel, &p); + + if(MwGetInteger(handle, MwNy) + h > rc.height) { + MwVaApply(handle, + MwNy, rc.height - h, + NULL); + } + MwLLEndStateChange(handle->lowlevel); + MwVaApply(handle, MwNwidth, w, MwNheight, h,