make sure the coordinates are containment relative
Change-Id: I82d3d6dded9701cd674a861a339cd60d6d12c962 Corona::availableScreenRegion has absolute coordinates, we need relative ones
This commit is contained in:
parent
22796e978d
commit
b9efa292b0
@ -313,12 +313,20 @@ QPointF ContainmentInterface::mapToApplet(AppletInterface *applet, int x, int y)
|
||||
|
||||
QPointF ContainmentInterface::adjustToAvailableScreenRegion(int x, int y, int w, int h) const
|
||||
{
|
||||
QRegion reg = QRect(0, 0, width(), height());
|
||||
QRegion reg;
|
||||
int screenId = screen();
|
||||
if (screenId > -1 && m_containment->corona()) {
|
||||
reg = m_containment->corona()->availableScreenRegion(screenId);
|
||||
}
|
||||
|
||||
if (!reg.isEmpty()) {
|
||||
//make it relative
|
||||
QRect geometry = m_containment->corona()->screenGeometry(screenId);
|
||||
reg.translate(- geometry.topLeft());
|
||||
} else {
|
||||
reg = QRect(0, 0, width(), height());
|
||||
}
|
||||
|
||||
const QRect rect(qBound(reg.boundingRect().left(), x, reg.boundingRect().right() - w),
|
||||
qBound(reg.boundingRect().top(), y, reg.boundingRect().bottom() - h), w, h);
|
||||
const QRectF ar = availableScreenRect();
|
||||
|
Loading…
Reference in New Issue
Block a user