mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-01 18:00:26 +00:00
Fix saving/loading correct frame position (mainly on macOS)
We have to save the frame position before we close the native window.
This commit is contained in:
parent
69a7faefa2
commit
d2c6abf5a7
@ -409,19 +409,19 @@ void load_window_pos(Window* window, const char* section,
|
||||
}
|
||||
}
|
||||
|
||||
void save_window_pos(Window* window, const char *section)
|
||||
void save_window_pos(Window* window, const char* section)
|
||||
{
|
||||
gfx::Rect rc;
|
||||
|
||||
if (!window->lastNativeFrame().isEmpty()) {
|
||||
os::Window* mainNativeWindow = manager->display()->nativeWindow();
|
||||
int scale = mainNativeWindow->scale();
|
||||
const os::Window* mainNativeWindow = manager->display()->nativeWindow();
|
||||
rc = window->lastNativeFrame();
|
||||
set_config_rect(section, "WindowFrame", rc);
|
||||
rc.offset(-mainNativeWindow->frame().origin());
|
||||
rc /= scale;
|
||||
rc /= mainNativeWindow->scale();
|
||||
}
|
||||
else {
|
||||
del_config_value(section, "WindowFrame");
|
||||
rc = window->bounds();
|
||||
}
|
||||
|
||||
|
@ -149,11 +149,8 @@ Display* Window::display() const
|
||||
|
||||
void Window::setDisplay(Display* display, const bool own)
|
||||
{
|
||||
if (m_display) {
|
||||
if (m_ownDisplay)
|
||||
m_lastFrame = m_display->nativeWindow()->frame();
|
||||
if (m_display)
|
||||
m_display->removeWindow(this);
|
||||
}
|
||||
|
||||
m_display = display;
|
||||
m_ownDisplay = own;
|
||||
@ -405,6 +402,8 @@ void Window::openWindowInForeground()
|
||||
void Window::closeWindow(Widget* closer)
|
||||
{
|
||||
m_closer = closer;
|
||||
if (m_ownDisplay)
|
||||
m_lastFrame = m_display->nativeWindow()->frame();
|
||||
|
||||
manager()->_closeWindow(this, true);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user