summaryrefslogtreecommitdiff
path: root/src/ui/util.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-11-06 09:47:03 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-11-06 09:47:03 +0200
commit3bbbd1399373755cec95e9685d18ecebec3b9c24 (patch)
treefe987e205dd7b40f4dab61074a98e143d0ca4e46 /src/ui/util.c
parent9df0c10c915b504a9f6dcca88608d702e4548bb6 (diff)
Fixed issues with tall popup menus
A tall popup menu needs to use overflow scrolling, but the size of the display wasn't considered. Now a popup window is fit to the usable bounds of the display.
Diffstat (limited to 'src/ui/util.c')
-rw-r--r--src/ui/util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ui/util.c b/src/ui/util.c
index 760bf48f..88348ff8 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -1038,7 +1038,7 @@ void openMenuFlags_Widget(iWidget *d, iInt2 windowCoord, int menuOpenFlags) {
1038 iRect displayRect = zero_Rect(); 1038 iRect displayRect = zero_Rect();
1039 for (int i = 0; i < SDL_GetNumVideoDisplays(); i++) { 1039 for (int i = 0; i < SDL_GetNumVideoDisplays(); i++) {
1040 SDL_Rect dispBounds; 1040 SDL_Rect dispBounds;
1041 SDL_GetDisplayBounds(i, &dispBounds); 1041 SDL_GetDisplayUsableBounds(i, &dispBounds);
1042 displayRect = union_Rect( 1042 displayRect = union_Rect(
1043 displayRect, init_Rect(dispBounds.x, dispBounds.y, dispBounds.w, dispBounds.h)); 1043 displayRect, init_Rect(dispBounds.x, dispBounds.y, dispBounds.w, dispBounds.h));
1044 } 1044 }
@@ -1070,7 +1070,7 @@ void openMenuFlags_Widget(iWidget *d, iInt2 windowCoord, int menuOpenFlags) {
1070 iInt2 menuPos = add_I2(winPos, 1070 iInt2 menuPos = add_I2(winPos,
1071 divf_I2(sub_I2(windowCoord, divi_I2(gap2_UI, 2)), pixelRatio)); 1071 divf_I2(sub_I2(windowCoord, divi_I2(gap2_UI, 2)), pixelRatio));
1072 /* Check display bounds. */ { 1072 /* Check display bounds. */ {
1073 const iInt2 menuSize = divf_I2(d->rect.size, pixelRatio); 1073 iInt2 menuSize = divf_I2(d->rect.size, pixelRatio);
1074 if (menuOpenFlags & center_MenuOpenFlags) { 1074 if (menuOpenFlags & center_MenuOpenFlags) {
1075 iInt2 winSize; 1075 iInt2 winSize;
1076 SDL_GetWindowSize(sdlWin, &winSize.x, &winSize.y); 1076 SDL_GetWindowSize(sdlWin, &winSize.x, &winSize.y);