From 4d618359882db958898dfb04387e75dc5ece82ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 3 Dec 2015 14:07:32 +0100 Subject: [PATCH] Move implementation of mousePosition to AbstractClient Also method does not need to be virtual any more. --- abstract_client.cpp | 22 ++++++++++++++++++++++ abstract_client.h | 5 +++-- client.cpp | 27 --------------------------- client.h | 2 -- 4 files changed, 25 insertions(+), 31 deletions(-) diff --git a/abstract_client.cpp b/abstract_client.cpp index 5264eb09cf..78d522532b 100644 --- a/abstract_client.cpp +++ b/abstract_client.cpp @@ -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; } diff --git a/abstract_client.h b/abstract_client.h index 733aff9000..d542573bf7 100644 --- a/abstract_client.h +++ b/abstract_client.h @@ -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; diff --git a/client.cpp b/client.cpp index a9e83abec9..596971810a 100644 --- a/client.cpp +++ b/client.cpp @@ -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) diff --git a/client.h b/client.h index b9868ccf67..1788bdbdeb 100644 --- a/client.h +++ b/client.h @@ -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);