diff --git a/laf b/laf index c6cd70ad9..947155e44 160000 --- a/laf +++ b/laf @@ -1 +1 @@ -Subproject commit c6cd70ad9743197a05c7af5b5dd4c71ea61926f3 +Subproject commit 947155e44ee4626c6490a7864d308a42231ed556 diff --git a/src/ui/display.cpp b/src/ui/display.cpp index b5d1d15a1..b451caf09 100644 --- a/src/ui/display.cpp +++ b/src/ui/display.cpp @@ -1,5 +1,5 @@ // Aseprite UI Library -// Copyright (C) 2019-2022 Igara Studio S.A. +// Copyright (C) 2019-2024 Igara Studio S.A. // // This file is released under the terms of the MIT license. // Read LICENSE.txt for more information. @@ -59,22 +59,28 @@ void Display::dirtyRect(const gfx::Rect& bounds) void Display::flipDisplay() { - if (!m_dirtyRegion.isEmpty()) { - // Limit the region to the bounds of the window - m_dirtyRegion &= gfx::Region(bounds()); + if (m_dirtyRegion.isEmpty()) + return; - if (!m_dirtyRegion.isEmpty()) { - // Invalidate the dirty region in the os::Window - if (m_nativeWindow->isVisible()) - m_nativeWindow->invalidateRegion(m_dirtyRegion); - else - m_nativeWindow->setVisible(true); + // Limit the region to the bounds of the window + m_dirtyRegion &= gfx::Region(bounds()); + if (m_dirtyRegion.isEmpty()) + return; - m_nativeWindow->swapBuffers(); - - m_dirtyRegion.clear(); - } + // Invalidate the dirty region in the os::Window only if the window + // is visible (e.g. if the window is hidden or minimized, we don't + // need to do this). + if (m_nativeWindow->isVisible()) { + m_nativeWindow->invalidateRegion(m_dirtyRegion); + m_nativeWindow->swapBuffers(); } + // If the native window is not minimized/hidden by the user, make it + // visible (e.g. when we flipDisplay() for the first time). + else if (!m_nativeWindow->isMinimized()) { + m_nativeWindow->setVisible(true); + } + + m_dirtyRegion.clear(); } void Display::invalidateRect(const gfx::Rect& rect)