effects/overview: Pad screen borders in qml
This makes it easier to spot if the effect is activated while there is only one maximized window. Note that anchors.margins cannot be used unfortunately as it won't take effect until the ExpoLayout item is fully constructed. It may take a couple of cycles for the geometry to settle down, which makes reasoning about how the effect works difficult. BUG: 312146
This commit is contained in:
parent
028421c4d7
commit
0931e4f8cc
3 changed files with 11 additions and 6 deletions
|
@ -687,13 +687,13 @@ void ExpoLayout::calculateWindowTransformationsNatural()
|
|||
if (bounds == area) {
|
||||
scale = 1.0; // Don't add borders to the screen
|
||||
} else if (area.width() / qreal(bounds.width()) < area.height() / qreal(bounds.height())) {
|
||||
scale = (area.width() - 2 * m_spacing) / qreal(bounds.width());
|
||||
scale = area.width() / qreal(bounds.width());
|
||||
} else {
|
||||
scale = (area.height() - 2 * m_spacing) / qreal(bounds.height());
|
||||
scale = area.height() / qreal(bounds.height());
|
||||
}
|
||||
// Make bounding rect fill the screen size for later steps
|
||||
bounds = QRect((bounds.x() * scale - (area.width() - 2 * m_spacing - bounds.width() * scale) / 2 - m_spacing) / scale,
|
||||
(bounds.y() * scale - (area.height() - 2 * m_spacing - bounds.height() * scale) / 2 - m_spacing) / scale,
|
||||
bounds = QRect(bounds.x() - (area.width() / scale - bounds.width()) / 2,
|
||||
bounds.y() - (area.height() / scale - bounds.height()) / 2,
|
||||
area.width() / scale,
|
||||
area.height() / scale);
|
||||
|
||||
|
@ -711,7 +711,7 @@ void ExpoLayout::calculateWindowTransformationsNatural()
|
|||
if (m_fillGaps) {
|
||||
// Don't expand onto or over the border
|
||||
QRegion borderRegion(area.adjusted(-200, -200, 200, 200));
|
||||
borderRegion ^= area.adjusted(m_spacing / scale, m_spacing / scale, -m_spacing / scale, -m_spacing / scale);
|
||||
borderRegion ^= area;
|
||||
|
||||
bool moved;
|
||||
do {
|
||||
|
|
|
@ -85,6 +85,7 @@ FocusScope {
|
|||
y: heapArea.y
|
||||
width: heapArea.width
|
||||
height: heapArea.height
|
||||
padding: PlasmaCore.Units.largeSpacing
|
||||
focus: true
|
||||
animationEnabled: container.animationEnabled
|
||||
organized: container.organized
|
||||
|
|
|
@ -24,12 +24,16 @@ FocusScope {
|
|||
property alias model: windowsRepeater.model
|
||||
property int selectedIndex: -1
|
||||
property bool animationEnabled: false
|
||||
property real padding: 0
|
||||
|
||||
required property bool organized
|
||||
|
||||
ExpoLayout {
|
||||
id: expoLayout
|
||||
anchors.fill: parent
|
||||
x: heap.padding
|
||||
y: heap.padding
|
||||
width: parent.width - 2 * heap.padding
|
||||
height: parent.height - 2 * heap.padding
|
||||
mode: effect.layout
|
||||
focus: true
|
||||
spacing: PlasmaCore.Units.largeSpacing
|
||||
|
|
Loading…
Reference in a new issue