Skip to content

Commit bdc2e99

Browse files
committed
Fix #26 Bad total size calculation
1 parent 570992d commit bdc2e99

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/environment.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ void Environment::refreshMonitors()
125125

126126
minX = qMin(minX, wpSize.left());
127127
minY = qMin(minY, wpSize.top());
128-
maxX = qMax(maxX, wpSize.right());
129-
maxY = qMax(maxY, wpSize.bottom());
128+
maxX = qMax(maxX, wpSize.left() + wpSize.width());
129+
maxY = qMax(maxY, wpSize.top() + wpSize.height());
130130
}
131131

132132
// store whole desktop size with its top-left-most position

src/gui/customlayoutdialog.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,9 @@ void CustomLayoutDialog::renderPreview()
257257
{
258258
QRect newBlock = UM::scaledRect(block, wRatio, hRatio);
259259

260-
if (qAbs(newBlock.left() - size.width()) <= 3)
260+
if (qAbs(newBlock.right() - size.width()) <= 3)
261261
{
262-
newBlock.setLeft(size.width()-1);
262+
newBlock.setRight(size.width()-1);
263263
}
264264

265265
if (qAbs(newBlock.bottom() - size.height()) <= 3)

src/wallpapergenerator.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -451,9 +451,9 @@ QString WallpaperGenerator::generateCustomFile(int _idx, WallpaperGenerator::Res
451451
QRect newBlock = UM::scaledRect(block, wRatio, hRatio);
452452

453453
// make sure the rect touch the border of the screen
454-
if (qAbs(newBlock.left() - scrRect.width()) <= 3)
454+
if (qAbs(newBlock.right() - scrRect.width()) <= 3)
455455
{
456-
newBlock.setLeft(scrRect.width()-1);
456+
newBlock.setRight(scrRect.width()-1);
457457
}
458458

459459
if (qAbs(newBlock.bottom() - scrRect.height()) <= 3)
@@ -902,8 +902,8 @@ QRect WallpaperGenerator::getDesktopEnabledRect()
902902

903903
minX = qMin(minX, rect.left());
904904
minY = qMin(minY, rect.top());
905-
maxX = qMax(maxX, rect.left()+rect.width());
906-
maxY = qMax(maxY, rect.top()+rect.height());
905+
maxX = qMax(maxX, rect.left() + rect.width());
906+
maxY = qMax(maxY, rect.top() + rect.height());
907907
}
908908

909909
return QRect(minX, minY, maxX-minX, maxY-minY);

0 commit comments

Comments
 (0)