mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-20 18:40:57 +00:00
Fix popup menu positions when we are not in the main screen
This commit is contained in:
parent
dead710213
commit
0396e80fce
@ -22,6 +22,16 @@
|
|||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
|
static gfx::Region get_workarea_region()
|
||||||
|
{
|
||||||
|
gfx::Region wa;
|
||||||
|
os::ScreenList screens;
|
||||||
|
os::instance()->listScreens(screens);
|
||||||
|
for (const auto& screen : screens)
|
||||||
|
wa |= gfx::Region(screen->workarea());
|
||||||
|
return wa;
|
||||||
|
}
|
||||||
|
|
||||||
int fit_bounds(Display* display, int arrowAlign, const gfx::Rect& target, gfx::Rect& bounds)
|
int fit_bounds(Display* display, int arrowAlign, const gfx::Rect& target, gfx::Rect& bounds)
|
||||||
{
|
{
|
||||||
bounds.x = target.x;
|
bounds.x = target.x;
|
||||||
@ -101,7 +111,7 @@ void fit_bounds(Display* parentDisplay,
|
|||||||
|
|
||||||
if (get_multiple_displays() && window->shouldCreateNativeWindow()) {
|
if (get_multiple_displays() && window->shouldCreateNativeWindow()) {
|
||||||
const os::Window* nativeWindow = parentDisplay->nativeWindow();
|
const os::Window* nativeWindow = parentDisplay->nativeWindow();
|
||||||
const gfx::Rect workarea = nativeWindow->screen()->workarea();
|
const gfx::Rect workarea = get_workarea_region().bounds();
|
||||||
const int scale = nativeWindow->scale();
|
const int scale = nativeWindow->scale();
|
||||||
|
|
||||||
// Screen frame bounds
|
// Screen frame bounds
|
||||||
@ -147,11 +157,7 @@ void limit_with_workarea(gfx::Rect& frame)
|
|||||||
if (!get_multiple_displays())
|
if (!get_multiple_displays())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gfx::Region wa;
|
gfx::Region wa = get_workarea_region();
|
||||||
os::ScreenList screens;
|
|
||||||
os::instance()->listScreens(screens);
|
|
||||||
for (const auto& screen : screens)
|
|
||||||
wa |= gfx::Region(screen->workarea());
|
|
||||||
|
|
||||||
// TODO use a "visibleFrameRegion = frame & wa" to check the
|
// TODO use a "visibleFrameRegion = frame & wa" to check the
|
||||||
// visible regions and calculate if we should move the frame
|
// visible regions and calculate if we should move the frame
|
||||||
|
Loading…
x
Reference in New Issue
Block a user