Fix several problems w/multiple screens

* Limit dialogs to the current screen workarea correctly
* Fixed several issues on macOS
This commit is contained in:
David Capello 2021-04-20 17:55:49 -03:00
parent 47434ee8f1
commit 0d7fea3111
5 changed files with 10 additions and 8 deletions

2
laf

@ -1 +1 @@
Subproject commit 9a93eeb4557a37232e5f062dfc9effa797ea2e2b
Subproject commit 5325bc040d1a99dedfbe258f05a01064261c89ac

View File

@ -355,9 +355,9 @@ void ColorButton::openPopup(const bool forcePinned)
winBounds.x = base::clamp(bounds.x, workarea.x, workarea.x2()-winBounds.w);
if (bounds.y2()+winBounds.h <= workarea.y2())
winBounds.y = std::max(0, bounds.y2());
winBounds.y = std::max(workarea.y, bounds.y2());
else
winBounds.y = std::max(0, bounds.y-winBounds.h);
winBounds.y = std::max(workarea.y, bounds.y-winBounds.h);
}
else if (forcePinned) {
winBounds = convertBounds(m_hiddenPopupBounds);

View File

@ -716,7 +716,7 @@ void ComboBox::updateListBoxPos()
[this](const gfx::Rect& workarea,
gfx::Rect& bounds,
std::function<gfx::Rect(Widget*)> getWidgetBounds) {
if (bounds.y2() > workarea.h)
if (bounds.y2() > workarea.y2())
bounds.offset(0, -(bounds.h + getWidgetBounds(m_entry).h));
});
}

View File

@ -111,7 +111,9 @@ void fit_bounds(Display* parentDisplay,
if (get_multiple_displays() && window->shouldCreateNativeWindow()) {
const os::Window* nativeWindow = parentDisplay->nativeWindow();
const gfx::Rect workarea = get_workarea_region().bounds();
// Limit to the current screen workarea (instead of using all the
// available workarea between all monitors, get_workarea_region())
const gfx::Rect workarea = nativeWindow->screen()->workarea();
const int scale = nativeWindow->scale();
// Screen frame bounds

View File

@ -840,9 +840,9 @@ bool MenuItem::onProcessMessage(Message* msg)
Rect r1(0, 0, pos.w, pos.h);
Rect r2(0, 0, pos.w, pos.h);
r1.x = x_left = base::clamp(x_left, 0, workarea.w-pos.w);
r2.x = x_right = base::clamp(x_right, 0, workarea.w-pos.w);
r1.y = r2.y = y = base::clamp(y, 0, workarea.h-pos.h);
r1.x = x_left = base::clamp(x_left, workarea.x, workarea.w-pos.w);
r2.x = x_right = base::clamp(x_right, workarea.x, workarea.w-pos.w);
r1.y = r2.y = y = base::clamp(y, workarea.y, workarea.h-pos.h);
// Calculate both intersections
const gfx::Rect s1 = r1.createIntersection(parentPos);