mirror of
https://github.com/aseprite/aseprite.git
synced 2024-11-20 14:21:45 +00:00
Limit centering windows to workarea when we use multiple displays
This commit is contained in:
parent
bcaa12be11
commit
4c712af45d
@ -14,6 +14,7 @@
|
||||
#include "gfx/size.h"
|
||||
#include "ui/button.h"
|
||||
#include "ui/display.h"
|
||||
#include "ui/fit_bounds.h"
|
||||
#include "ui/graphics.h"
|
||||
#include "ui/intern.h"
|
||||
#include "ui/label.h"
|
||||
@ -323,9 +324,19 @@ void Window::centerWindow(Display* parentDisplay)
|
||||
if (!parentDisplay)
|
||||
parentDisplay = manager()->getDefault()->display();
|
||||
|
||||
gfx::Size displaySize = parentDisplay->size();
|
||||
positionWindow(displaySize.w/2 - bounds().w/2,
|
||||
displaySize.h/2 - bounds().h/2);
|
||||
ASSERT(parentDisplay);
|
||||
|
||||
if (m_isAutoRemap)
|
||||
remapWindow();
|
||||
|
||||
const gfx::Size displaySize = parentDisplay->size();
|
||||
const gfx::Size windowSize = bounds().size();
|
||||
|
||||
fit_bounds(parentDisplay,
|
||||
this,
|
||||
gfx::Rect(displaySize.w/2 - windowSize.w/2,
|
||||
displaySize.h/2 - windowSize.h/2,
|
||||
windowSize.w, windowSize.h));
|
||||
}
|
||||
|
||||
void Window::positionWindow(int x, int y)
|
||||
|
Loading…
Reference in New Issue
Block a user