From 7ac651b7366c1d27a9e7b7e2fc83567739cc2988 Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Wed, 15 Feb 2023 11:37:00 +0300 Subject: [PATCH] Adjust modal dialogs position --- src/dbox.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/dbox.cc b/src/dbox.cc index 8ca5d02..eee9345 100644 --- a/src/dbox.cc +++ b/src/dbox.cc @@ -206,8 +206,8 @@ int showDialogBox(const char* title, const char** body, int bodyLength, int x, i } // Maintain original position in original resolution, otherwise center it. - if (screenGetWidth() != 640) x = (screenGetWidth() - backgroundFrmImage.getWidth()) / 2; - if (screenGetHeight() != 480) y = (screenGetHeight() - backgroundFrmImage.getHeight()) / 2; + x += (screenGetWidth() - 640) / 2; + y += (screenGetHeight() - 480) / 2; int win = windowCreate(x, y, backgroundFrmImage.getWidth(), @@ -596,8 +596,8 @@ int showLoadFileDialog(char* title, char** fileList, char* dest, int fileListLen int backgroundHeight = frmImages[FILE_DIALOG_FRM_BACKGROUND].getHeight(); // Maintain original position in original resolution, otherwise center it. - if (screenGetWidth() != 640) x = (screenGetWidth() - backgroundWidth) / 2; - if (screenGetHeight() != 480) y = (screenGetHeight() - backgroundHeight) / 2; + x += (screenGetWidth() - 640) / 2; + y += (screenGetHeight() - 480) / 2; int win = windowCreate(x, y, backgroundWidth, backgroundHeight, 256, WINDOW_MODAL | WINDOW_MOVE_ON_TOP); if (win == -1) { return -1; @@ -962,8 +962,8 @@ int showSaveFileDialog(char* title, char** fileList, char* dest, int fileListLen int backgroundHeight = frmImages[FILE_DIALOG_FRM_BACKGROUND].getHeight(); // Maintain original position in original resolution, otherwise center it. - if (screenGetWidth() != 640) x = (screenGetWidth() - backgroundWidth) / 2; - if (screenGetHeight() != 480) y = (screenGetHeight() - backgroundHeight) / 2; + x += (screenGetWidth() - 640) / 2; + y += (screenGetHeight() - 480) / 2; int win = windowCreate(x, y, backgroundWidth, backgroundHeight, 256, WINDOW_MODAL | WINDOW_MOVE_ON_TOP); if (win == -1) { return -1;