From 0304c15ff66b0f5d44c9a3973dc8ba0f662bb08f Mon Sep 17 00:00:00 2001 From: Le Philousophe Date: Sun, 1 Jun 2025 10:32:19 +0200 Subject: [PATCH] GUI: Handle safe area in updates dialog --- gui/updates-dialog.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gui/updates-dialog.cpp b/gui/updates-dialog.cpp index b63310e9b83..3f3430db7d7 100644 --- a/gui/updates-dialog.cpp +++ b/gui/updates-dialog.cpp @@ -37,9 +37,8 @@ enum { UpdatesDialog::UpdatesDialog() : Dialog(30, 20, 260, 124) { - - const int screenW = g_system->getOverlayWidth(); - const int screenH = g_system->getOverlayHeight(); + int16 screenW, screenH; + const Common::Rect safeArea = g_system->getSafeOverlayArea(&screenW, &screenH); int buttonWidth = g_gui.xmlEval()->getVar("Globals.Button.Width", 0); int buttonHeight = g_gui.xmlEval()->getVar("Globals.Button.Height", 0); @@ -56,8 +55,8 @@ UpdatesDialog::UpdatesDialog() : Dialog(30, 20, 260, 124) { // Using this, and accounting for the space the button(s) need, we can set // the real size of the dialog Common::Array lines, lines2; - int maxlineWidth = g_gui.getFont().wordWrapText(message, screenW - 2 * 20, lines); - int maxlineWidth2 = g_gui.getFont().wordWrapText(message2, screenW - 2 * 20, lines2); + int maxlineWidth = g_gui.getFont().wordWrapText(message, safeArea.width() - 2 * 20, lines); + int maxlineWidth2 = g_gui.getFont().wordWrapText(message2, safeArea.width() - 2 * 20, lines2); _w = MAX(MAX(maxlineWidth, maxlineWidth2), (2 * buttonWidth) + 10) + 20; @@ -72,6 +71,9 @@ UpdatesDialog::UpdatesDialog() : Dialog(30, 20, 260, 124) { _x = (screenW - _w) / 2; _y = (screenH - _h) / 2; + // Make it fit inside the safe area + safeArea.constrain(_x, _y, _w, _h); + // Each line is represented by one static text item. uint y = 10; for (uint i = 0; i < lines.size(); i++) {