Move implementation of mousePosition to AbstractClient

Also method does not need to be virtual any more.
This commit is contained in:
Martin Gräßlin 2015-12-03 14:07:32 +01:00
parent ad6ead1928
commit 4d61835988
4 changed files with 25 additions and 31 deletions

View file

@ -1285,6 +1285,28 @@ QSize AbstractClient::resizeIncrements() const
AbstractClient::Position AbstractClient::mousePosition() const
{
if (isDecorated()) {
switch (decoration()->sectionUnderMouse()) {
case Qt::BottomLeftSection:
return PositionBottomLeft;
case Qt::BottomRightSection:
return PositionBottomRight;
case Qt::BottomSection:
return PositionBottom;
case Qt::LeftSection:
return PositionLeft;
case Qt::RightSection:
return PositionRight;
case Qt::TopSection:
return PositionTop;
case Qt::TopLeftSection:
return PositionTopLeft;
case Qt::TopRightSection:
return PositionTopRight;
default:
return PositionCenter;
}
}
return PositionCenter;
}

View file

@ -794,9 +794,10 @@ protected:
virtual QSize resizeIncrements() const;
/**
* Default implementation returns PositionCenter
* Returns the position depending on the Decoration's section under mouse.
* If no decoration it returns PositionCenter.
**/
virtual Position mousePosition() const;
Position mousePosition() const;
static bool haveResizeEffect() {
return s_haveResizeEffect;

View file

@ -1835,33 +1835,6 @@ void Client::setBlockingCompositing(bool block)
}
}
Client::Position Client::mousePosition() const
{
if (isDecorated()) {
switch (decoration()->sectionUnderMouse()) {
case Qt::BottomLeftSection:
return PositionBottomLeft;
case Qt::BottomRightSection:
return PositionBottomRight;
case Qt::BottomSection:
return PositionBottom;
case Qt::LeftSection:
return PositionLeft;
case Qt::RightSection:
return PositionRight;
case Qt::TopSection:
return PositionTop;
case Qt::TopLeftSection:
return PositionTopLeft;
case Qt::TopRightSection:
return PositionTopRight;
default:
return PositionCenter;
}
}
return PositionCenter;
}
void Client::updateAllowedActions(bool force)
{
if (!isManaged() && !force)

View file

@ -386,8 +386,6 @@ private:
// Use Workspace::createClient()
virtual ~Client(); ///< Use destroyClient() or releaseWindow()
Position mousePosition() const override;
// Handlers for X11 events
bool mapRequestEvent(xcb_map_request_event_t *e);
void unmapNotifyEvent(xcb_unmap_notify_event_t *e);