Fix mouse position calculation in Aurorae with decorations on left/right/bottom.

svn path=/trunk/KDE/kdebase/workspace/; revision=1119717
This commit is contained in:
Martin Gräßlin 2010-04-27 17:50:13 +00:00
parent 2301deb8d5
commit 2f0a542e06
3 changed files with 27 additions and 4 deletions

View file

@ -256,18 +256,34 @@ KDecorationDefines::Position AuroraeClient::mousePosition(const QPoint &point) c
borders(borderLeft, borderRight, borderTop, borderBottom);
int paddingLeft, paddingTop, paddingRight, paddingBottom;
padding(paddingLeft, paddingRight, paddingTop, paddingBottom);
const bool maximized = maximizeMode() == MaximizeFull && !options()->moveResizeMaximizedWindows();
int titleEdgeLeft, titleEdgeRight, titleEdgeTop, titleEdgeBottom;
AuroraeFactory::instance()->theme()->titleEdges(titleEdgeLeft, titleEdgeTop, titleEdgeRight, titleEdgeBottom, maximized);
switch (AuroraeFactory::instance()->theme()->decorationPosition()) {
case DecorationTop:
borderTop = titleEdgeTop;
break;
case DecorationLeft:
borderLeft = titleEdgeLeft;
break;
case DecorationRight:
borderRight = titleEdgeRight;
break;
case DecorationBottom:
borderBottom = titleEdgeBottom;
break;
default:
break; // nothing
}
if (point.x() >= (m_view->width() - borderRight - paddingRight)) {
pos |= PositionRight;
} else if (point.x() <= borderLeft + paddingLeft) {
pos |= PositionLeft;
}
const bool maximized = maximizeMode() == MaximizeFull && !options()->moveResizeMaximizedWindows();
int titleEdgeLeft, titleEdgeRight, titleEdgeTop, titleEdgeBottom;
AuroraeFactory::instance()->theme()->titleEdges(titleEdgeLeft, titleEdgeTop, titleEdgeRight, titleEdgeBottom, maximized);
if (point.y() >= m_view->height() - borderBottom - paddingBottom) {
pos |= PositionBottom;
} else if (point.y() <= titleEdgeTop + paddingTop ) {
} else if (point.y() <= borderTop + paddingTop ) {
pos |= PositionTop;
}

View file

@ -450,4 +450,9 @@ qreal AuroraeTheme::buttonSizeFactor() const
}
}
DecorationPosition AuroraeTheme::decorationPosition() const
{
return (DecorationPosition)d->themeConfig.decorationPosition();
}
} // namespace

View file

@ -119,6 +119,8 @@ public:
void setButtonSize(KDecorationDefines::BorderSize size);
qreal buttonSizeFactor() const;
DecorationPosition decorationPosition() const;
// TODO: move to namespace
static QLatin1String mapButtonToName(AuroraeButtonType type);
static char mapButtonToChar(AuroraeButtonType type);