Commit 001761ce authored by Roman Gilg's avatar Roman Gilg Committed by Aleix Pol Gonzalez
Browse files

fix(space): check edges for nearly complete screen overlap

When two outputs are positioned on top of each other in a way that one covers
most of the height or width of the onter one with exception of a small gap this
gap might be too small to later on substract the orner offset and stay
positive. In this case do not create the edge at all.

The screen edges test passes again.
parent 8303a4cd
......@@ -1068,7 +1068,10 @@ void ScreenEdges::createVerticalEdge(ElectricBorder border, const QRect &screen,
const ElectricBorder edge = (border == ElectricLeft) ? ElectricBottomLeft : ElectricBottomRight;
m_edges << createEdge(edge, x, screen.y() + screen.height() -1, 1, 1);
}
// create border
if (height <= m_cornerOffset) {
// An overlap with another output is near complete. We ignore this border.
return;
}
m_edges << createEdge(border, x, y, 1, height);
}
......@@ -1088,6 +1091,10 @@ void ScreenEdges::createHorizontalEdge(ElectricBorder border, const QRect &scree
// also right most edge
width -= m_cornerOffset;
}
if (width <= m_cornerOffset) {
// An overlap with another output is near complete. We ignore this border.
return;
}
const int y = (border == ElectricTop) ? screen.y() : screen.y() + screen.height() - 1;
m_edges << createEdge(border, x, y, width, 1);
}
......@@ -1099,6 +1106,10 @@ Edge *ScreenEdges::createEdge(ElectricBorder border, int x, int y, int width, in
#else
Edge *edge = kwinApp()->platform()->createScreenEdge(this);
#endif
// Edges can not have negative size.
Q_ASSERT(width >= 0);
Q_ASSERT(height >= 0);
edge->setBorder(border);
edge->setGeometry(QRect(x, y, width, height));
if (createAction) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment