mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-14 04:19:12 +00:00
Fix hidden initial window position in certain cases
Reports: https://community.aseprite.org/t/9327 https://igarastudio.zendesk.com/agent/tickets/2295
This commit is contained in:
parent
fffca9e969
commit
0b33d15462
@ -167,8 +167,20 @@ void limit_with_workarea(Display* parentDisplay, gfx::Rect& frame)
|
||||
gfx::Rect waBounds = parentDisplay->nativeWindow()->screen()->workarea();
|
||||
if (frame.x < waBounds.x) frame.x = waBounds.x;
|
||||
if (frame.y < waBounds.y) frame.y = waBounds.y;
|
||||
if (frame.x2() > waBounds.x2()) frame.w -= frame.x2() - waBounds.x2();
|
||||
if (frame.y2() > waBounds.y2()) frame.h -= frame.y2() - waBounds.y2();
|
||||
if (frame.x2() > waBounds.x2()) {
|
||||
frame.x -= frame.x2() - waBounds.x2();
|
||||
if (frame.x < waBounds.x) {
|
||||
frame.x = waBounds.x;
|
||||
frame.w = waBounds.w;
|
||||
}
|
||||
}
|
||||
if (frame.y2() > waBounds.y2()) {
|
||||
frame.y -= frame.y2() - waBounds.y2();
|
||||
if (frame.y < waBounds.y) {
|
||||
frame.y = waBounds.y;
|
||||
frame.h = waBounds.h;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "ui/message_loop.h"
|
||||
#include "ui/move_region.h"
|
||||
#include "ui/resize_event.h"
|
||||
#include "ui/scale.h"
|
||||
#include "ui/size_hint_event.h"
|
||||
#include "ui/system.h"
|
||||
#include "ui/theme.h"
|
||||
@ -191,6 +192,21 @@ HitTest Window::hitTest(const gfx::Point& point)
|
||||
return ev.hit();
|
||||
}
|
||||
|
||||
void Window::loadNativeFrame(const gfx::Rect& frame)
|
||||
{
|
||||
m_lastFrame = frame;
|
||||
|
||||
// Just in case the saved value is too small, we can take the value
|
||||
// as invalid.
|
||||
gfx::Size sz = sizeHint() * guiscale();
|
||||
if (display())
|
||||
sz *= display()->scale();
|
||||
if (m_lastFrame.w < sz.w/5 ||
|
||||
m_lastFrame.h < sz.h/5) {
|
||||
m_lastFrame.setSize(sz);
|
||||
}
|
||||
}
|
||||
|
||||
void Window::onClose(CloseEvent& ev)
|
||||
{
|
||||
// Fire Close signal
|
||||
@ -654,6 +670,9 @@ void Window::onSizeHint(SizeHintEvent& ev)
|
||||
Size maxSize(0, 0);
|
||||
Size reqSize;
|
||||
|
||||
if (m_titleLabel)
|
||||
maxSize.w = maxSize.h = 40*guiscale();
|
||||
|
||||
for (auto child : children()) {
|
||||
if (!child->isDecorative()) {
|
||||
reqSize = child->sizeHint();
|
||||
|
@ -72,7 +72,7 @@ namespace ui {
|
||||
// native window so we can save this information in the
|
||||
// configuration file.
|
||||
gfx::Rect lastNativeFrame() const { return m_lastFrame; }
|
||||
void loadNativeFrame(const gfx::Rect& frame) { m_lastFrame = frame; }
|
||||
void loadNativeFrame(const gfx::Rect& frame);
|
||||
|
||||
// Signals
|
||||
obs::signal<void (Event&)> Open;
|
||||
|
Loading…
x
Reference in New Issue
Block a user