diff --git a/kcontrol/randr/layoutmanager.cpp b/kcontrol/randr/layoutmanager.cpp index 7f3a49bf..8c887584 100644 --- a/kcontrol/randr/layoutmanager.cpp +++ b/kcontrol/randr/layoutmanager.cpp @@ -23,8 +23,7 @@ #include "outputgraphicsitem.h" #include -#include -#include +#include LayoutManager::LayoutManager(RandRScreen *screen, QGraphicsScene *scene) : QObject(screen) @@ -40,7 +39,7 @@ LayoutManager::~LayoutManager() void LayoutManager::slotAdjustOutput(OutputGraphicsItem *output) { QPointF p = output->pos(); - float nearest = m_scene->width() * m_scene->height(); + qreal nearest = m_scene->width() * m_scene->height(); OutputGraphicsItem *selected = NULL; OutputGraphicsItem *mouseGrabber = dynamic_cast(m_scene->mouseGrabberItem()); @@ -54,7 +53,7 @@ void LayoutManager::slotAdjustOutput(OutputGraphicsItem *output) } QPointF pos = cur->pos(); - float distance = (p.x() - pos.x())*(p.x()-pos.x()) + (p.y() - pos.y())*(p.y() - pos.y()); + qreal distance = (p.x() - pos.x())*(p.x()-pos.x()) + (p.y() - pos.y())*(p.y() - pos.y()); if (distance <=nearest) { nearest = distance; selected = cur; @@ -70,10 +69,10 @@ void LayoutManager::slotAdjustOutput(OutputGraphicsItem *output) i.translate(output->scenePos()); // calculate the distances - float top = fabsf(i.top() - s.bottom()); - float bottom = fabsf(i.bottom() - s.top()); - float left = fabsf(i.left() - s.right()); - float right = fabsf(i.right() - s.left()); + qreal top = qAbs(i.top() - s.bottom()); + qreal bottom = qAbs(i.bottom() - s.top()); + qreal left = qAbs(i.left() - s.right()); + qreal right = qAbs(i.right() - s.left()); // choose top if (top <= bottom && top <= left && top <= right) { diff --git a/kcontrol/randr/randrconfig.cpp b/kcontrol/randr/randrconfig.cpp index 915e4964..ec4c2481 100644 --- a/kcontrol/randr/randrconfig.cpp +++ b/kcontrol/randr/randrconfig.cpp @@ -353,9 +353,9 @@ void RandRConfig::slotDelayedUpdateView() } // scale the total bounding rectangle for all outputs to fit // 80% of the containing QGraphicsView - float scaleX = (float)screenView->width() / r.width(); - float scaleY = (float)screenView->height() / r.height(); - float scale = (scaleX < scaleY) ? scaleX : scaleY; + qreal scaleX = qreal(screenView->width()) / r.width(); + qreal scaleY = qreal(screenView->height()) / r.height(); + qreal scale = (scaleX < scaleY) ? scaleX : scaleY; scale *= 0.80f; screenView->resetMatrix(); diff --git a/kcontrol/randr/randrscreen.cpp b/kcontrol/randr/randrscreen.cpp index 110418a4..d9bdcc0b 100644 --- a/kcontrol/randr/randrscreen.cpp +++ b/kcontrol/randr/randrscreen.cpp @@ -313,13 +313,10 @@ bool RandRScreen::setSize(const QSize &s) return false; } - int widthMM, heightMM; - float dpi; - /* values taken from xrandr */ - dpi = (25.4 * DisplayHeight(QX11Info::display(), m_index)) / DisplayHeightMM(QX11Info::display(), m_index); - widthMM = (int) ((25.4 * s.width()) / dpi); - heightMM = (int) ((25.4 * s.height()) / dpi); + float dpi = (25.4 * DisplayHeight(QX11Info::display(), m_index)) / DisplayHeightMM(QX11Info::display(), m_index); + int widthMM = (int) ((25.4 * s.width()) / dpi); + int heightMM = (int) ((25.4 * s.height()) / dpi); XRRSetScreenSize(QX11Info::display(), rootWindow(), s.width(), s.height(), widthMM, heightMM); m_rect.setSize(s);