[osx] Fix showing the native window back when the app is hidden (fix #4857)

This commit is contained in:
David Capello 2024-12-03 22:25:12 -03:00
parent 2b97e44dfd
commit 97dc9c8988
2 changed files with 21 additions and 15 deletions

2
laf

@ -1 +1 @@
Subproject commit c6cd70ad9743197a05c7af5b5dd4c71ea61926f3
Subproject commit 947155e44ee4626c6490a7864d308a42231ed556

View File

@ -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)