diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-09-21 22:17:53 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-09-21 22:17:53 +0300 |
commit | c113930a66efb7a2a8a1bab62e110dafb5b21209 (patch) | |
tree | 785adc1f0953756a5d2c8120c592d5b9d795bce5 /src/ui | |
parent | 2bf206181e8e3ce6d1b7e899de7c4cc04778a087 (diff) |
Added build options for popup/macOS menus
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/util.c | 6 | ||||
-rw-r--r-- | src/ui/window.c | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/ui/util.c b/src/ui/util.c index c75d7698..2b6ff929 100644 --- a/src/ui/util.c +++ b/src/ui/util.c | |||
@@ -975,7 +975,11 @@ void unselectAllNativeMenuItems_Widget(iWidget *menu) { | |||
975 | } | 975 | } |
976 | 976 | ||
977 | iLocalDef iBool isUsingMenuPopupWindows_(void) { | 977 | iLocalDef iBool isUsingMenuPopupWindows_(void) { |
978 | #if defined (LAGRANGE_ENABLE_POPUP_MENUS) | ||
978 | return deviceType_App() == desktop_AppDeviceType; | 979 | return deviceType_App() == desktop_AppDeviceType; |
980 | #else | ||
981 | return iFalse; | ||
982 | #endif | ||
979 | } | 983 | } |
980 | 984 | ||
981 | void releaseNativeMenu_Widget(iWidget *d) { | 985 | void releaseNativeMenu_Widget(iWidget *d) { |
@@ -1019,7 +1023,7 @@ void openMenuFlags_Widget(iWidget *d, iInt2 windowCoord, iBool postCommands) { | |||
1019 | removeChild_Widget(parent_Widget(d), d); /* we'll borrow the widget for a while */ | 1023 | removeChild_Widget(parent_Widget(d), d); /* we'll borrow the widget for a while */ |
1020 | const float pixelRatio = get_Window()->pixelRatio; | 1024 | const float pixelRatio = get_Window()->pixelRatio; |
1021 | iInt2 menuPos = add_I2(get_MainWindow()->place.normalRect.pos, | 1025 | iInt2 menuPos = add_I2(get_MainWindow()->place.normalRect.pos, |
1022 | divf_I2(windowCoord, pixelRatio)); | 1026 | divf_I2(sub_I2(windowCoord, divi_I2(gap2_UI, 2)), pixelRatio)); |
1023 | arrange_Widget(d); | 1027 | arrange_Widget(d); |
1024 | /* Check display bounds. */ { | 1028 | /* Check display bounds. */ { |
1025 | const iInt2 menuSize = divf_I2(d->rect.size, pixelRatio); | 1029 | const iInt2 menuSize = divf_I2(d->rect.size, pixelRatio); |
diff --git a/src/ui/window.c b/src/ui/window.c index 3f8faaea..8197afd4 100644 --- a/src/ui/window.c +++ b/src/ui/window.c | |||
@@ -913,7 +913,7 @@ iBool processEvent_Window(iWindow *d, const SDL_Event *ev) { | |||
913 | } | 913 | } |
914 | default: { | 914 | default: { |
915 | SDL_Event event = *ev; | 915 | SDL_Event event = *ev; |
916 | if (event.type == SDL_USEREVENT && isCommand_UserEvent(ev, "window.unfreeze")) { | 916 | if (event.type == SDL_USEREVENT && isCommand_UserEvent(ev, "window.unfreeze") && mw) { |
917 | mw->isDrawFrozen = iFalse; | 917 | mw->isDrawFrozen = iFalse; |
918 | if (SDL_GetWindowFlags(d->win) & SDL_WINDOW_HIDDEN) { | 918 | if (SDL_GetWindowFlags(d->win) & SDL_WINDOW_HIDDEN) { |
919 | SDL_ShowWindow(d->win); | 919 | SDL_ShowWindow(d->win); |