diff --git a/src/ui/ModalLayer.cpp b/src/ui/ModalLayer.cpp index 1c0feea..c5a526b 100644 --- a/src/ui/ModalLayer.cpp +++ b/src/ui/ModalLayer.cpp @@ -53,11 +53,18 @@ int ModalLayer::execute(ModalDialog& content, const QRect& anchorRect) : m_stack.back().host->geometry()); m_stack.push_back(HostedModal{ &content, host }); - updateVisibility(); + + // Placed and shown before the layer itself is, so that the frame the layer first + // paints already carries the modal. Showing the layer first put the dim on screen a + // frame before anything stood on it, which read as a black flash + // (REQ-UI-MODAL-DIM). Placing works while the layer is hidden: its geometry is the + // window's whether or not it is shown, and a child shown under a hidden parent + // appears with it. raise(); place(*host, content, anchor); host->show(); content.show(); + updateVisibility(); // The modal's own focus widget where it has one -- a name dialog puts the caret in // its line edit -- and the modal itself otherwise, so keys reach it and not the game @@ -209,8 +216,9 @@ void ModalLayer::updateVisibility() { raise(); show(); - // Force an immediate synchronous paint so the dim is up before whatever the - // caller does next; no undimmed frame flashes through. + // Painted at once rather than at the next paint event, so no undimmed frame of + // the world flashes through in between. The modal standing on the layer is + // already placed and shown by now, so this one paint puts up both (execute()). repaint(); } else