Skip to content

Commit

Permalink
Fix #26 Bad total size calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
mistic100 committed Feb 9, 2018
1 parent 570992d commit bdc2e99
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/environment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ void Environment::refreshMonitors()

minX = qMin(minX, wpSize.left());
minY = qMin(minY, wpSize.top());
maxX = qMax(maxX, wpSize.right());
maxY = qMax(maxY, wpSize.bottom());
maxX = qMax(maxX, wpSize.left() + wpSize.width());
maxY = qMax(maxY, wpSize.top() + wpSize.height());
}

// store whole desktop size with its top-left-most position
Expand Down
4 changes: 2 additions & 2 deletions src/gui/customlayoutdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,9 @@ void CustomLayoutDialog::renderPreview()
{
QRect newBlock = UM::scaledRect(block, wRatio, hRatio);

if (qAbs(newBlock.left() - size.width()) <= 3)
if (qAbs(newBlock.right() - size.width()) <= 3)
{
newBlock.setLeft(size.width()-1);
newBlock.setRight(size.width()-1);
}

if (qAbs(newBlock.bottom() - size.height()) <= 3)
Expand Down
8 changes: 4 additions & 4 deletions src/wallpapergenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,9 +451,9 @@ QString WallpaperGenerator::generateCustomFile(int _idx, WallpaperGenerator::Res
QRect newBlock = UM::scaledRect(block, wRatio, hRatio);

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

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

minX = qMin(minX, rect.left());
minY = qMin(minY, rect.top());
maxX = qMax(maxX, rect.left()+rect.width());
maxY = qMax(maxY, rect.top()+rect.height());
maxX = qMax(maxX, rect.left() + rect.width());
maxY = qMax(maxY, rect.top() + rect.height());
}

return QRect(minX, minY, maxX-minX, maxY-minY);
Expand Down

0 comments on commit bdc2e99

Please sign in to comment.