diff options
Diffstat (limited to 'src/ui/util.c')
-rw-r--r-- | src/ui/util.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/ui/util.c b/src/ui/util.c index 72a973a6..adee2ee5 100644 --- a/src/ui/util.c +++ b/src/ui/util.c | |||
@@ -1023,6 +1023,14 @@ void openMenuFlags_Widget(iWidget *d, iInt2 windowCoord, int menuOpenFlags) { | |||
1023 | setFlags_Widget(d, commandOnMouseMiss_WidgetFlag, iTrue); | 1023 | setFlags_Widget(d, commandOnMouseMiss_WidgetFlag, iTrue); |
1024 | setFlags_Widget(findChild_Widget(d, "menu.cancel"), disabled_WidgetFlag, iFalse); | 1024 | setFlags_Widget(findChild_Widget(d, "menu.cancel"), disabled_WidgetFlag, iFalse); |
1025 | arrange_Widget(d); /* need to know the height */ | 1025 | arrange_Widget(d); /* need to know the height */ |
1026 | /* A vertical offset determined by a possible selected label in the menu. */ { | ||
1027 | iConstForEach(ObjectList, child, children_Widget(d)) { | ||
1028 | const iWidget *item = constAs_Widget(child.object); | ||
1029 | if (flags_Widget(item) & selected_WidgetFlag) { | ||
1030 | windowCoord.y -= item->rect.pos.y; | ||
1031 | } | ||
1032 | } | ||
1033 | } | ||
1026 | #if defined (LAGRANGE_ENABLE_POPUP_MENUS) | 1034 | #if defined (LAGRANGE_ENABLE_POPUP_MENUS) |
1027 | /* Determine total display bounds where the popup may appear. */ | 1035 | /* Determine total display bounds where the popup may appear. */ |
1028 | iRect displayRect = zero_Rect(); | 1036 | iRect displayRect = zero_Rect(); |
@@ -1045,7 +1053,7 @@ void openMenuFlags_Widget(iWidget *d, iInt2 windowCoord, int menuOpenFlags) { | |||
1045 | addv_I2(&winRect.pos, winPos); | 1053 | addv_I2(&winRect.pos, winPos); |
1046 | iRect visibleWinRect = intersect_Rect(winRect, displayRect); | 1054 | iRect visibleWinRect = intersect_Rect(winRect, displayRect); |
1047 | /* Only use a popup window if the menu can't fit inside the main window. */ | 1055 | /* Only use a popup window if the menu can't fit inside the main window. */ |
1048 | if (height_Widget(d) * pixelRatio > visibleWinRect.size.y && isUsingMenuPopupWindows_()) { | 1056 | if (height_Widget(d) / pixelRatio > visibleWinRect.size.y && isUsingMenuPopupWindows_()) { |
1049 | if (postCommands) { | 1057 | if (postCommands) { |
1050 | postCommand_Widget(d, "menu.opened"); | 1058 | postCommand_Widget(d, "menu.opened"); |
1051 | } | 1059 | } |