Make Outline a KWIN_SINGLETON

Given that Outline is now a QObject hold by Workspace, but not used in
Workspace, it can also be a KWIN_SINGLETON.

REVIEW: 110146
This commit is contained in:
Martin Gräßlin 2013-04-25 08:14:34 +02:00
parent 1a3bc3f60c
commit cd025c7526
6 changed files with 17 additions and 17 deletions

View file

@ -2629,7 +2629,7 @@ void Client::finishMoveResize(bool cancel)
if (isElectricBorderMaximizing()) { if (isElectricBorderMaximizing()) {
setQuickTileMode(electricMode); setQuickTileMode(electricMode);
electricMaximizing = false; electricMaximizing = false;
workspace()->outline()->hide(); outline()->hide();
} else if (!cancel) { } else if (!cancel) {
if (!(maximizeMode() & MaximizeHorizontal)) { if (!(maximizeMode() & MaximizeHorizontal)) {
geom_restore.setX(geometry().x()); geom_restore.setX(geometry().x());
@ -3088,9 +3088,9 @@ void Client::setElectricBorderMaximizing(bool maximizing)
{ {
electricMaximizing = maximizing; electricMaximizing = maximizing;
if (maximizing) if (maximizing)
workspace()->outline()->show(electricBorderMaximizeGeometry(cursorPos(), desktop())); outline()->show(electricBorderMaximizeGeometry(cursorPos(), desktop()));
else else
workspace()->outline()->hide(); outline()->hide();
} }
QRect Client::electricBorderMaximizeGeometry(QPoint pos, int desktop) QRect Client::electricBorderMaximizeGeometry(QPoint pos, int desktop)

View file

@ -33,6 +33,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace KWin { namespace KWin {
KWIN_SINGLETON_FACTORY(Outline)
Outline::Outline(QObject *parent) Outline::Outline(QObject *parent)
: QObject(parent) : QObject(parent)
, m_active(false) , m_active(false)

View file

@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef KWIN_OUTLINE_H #ifndef KWIN_OUTLINE_H
#define KWIN_OUTLINE_H #define KWIN_OUTLINE_H
#include "xcbutils.h" #include "xcbutils.h"
#include <kwinglobals.h>
#include <QRect> #include <QRect>
namespace Plasma { namespace Plasma {
@ -44,7 +45,6 @@ class OutlineVisual;
class Outline : public QObject { class Outline : public QObject {
Q_OBJECT Q_OBJECT
public: public:
Outline(QObject *parent);
~Outline(); ~Outline();
/** /**
@ -87,6 +87,7 @@ private:
QScopedPointer<OutlineVisual> m_visual; QScopedPointer<OutlineVisual> m_visual;
QRect m_outlineGeometry; QRect m_outlineGeometry;
bool m_active; bool m_active;
KWIN_SINGLETON(Outline)
}; };
class OutlineVisual class OutlineVisual
@ -163,6 +164,12 @@ void NonCompositedOutlineVisual::forEachWindow(T method)
(m_leftOutline.*method)(); (m_leftOutline.*method)();
} }
inline
Outline *outline()
{
return Outline::self();
}
} }
#endif #endif

View file

@ -242,17 +242,17 @@ void WorkspaceWrapper::setupClientConnections(KWin::Client *client)
void WorkspaceWrapper::showOutline(const QRect &geometry) void WorkspaceWrapper::showOutline(const QRect &geometry)
{ {
Workspace::self()->outline()->show(geometry); outline()->show(geometry);
} }
void WorkspaceWrapper::showOutline(int x, int y, int width, int height) void WorkspaceWrapper::showOutline(int x, int y, int width, int height)
{ {
Workspace::self()->outline()->show(QRect(x, y, width, height)); outline()->show(QRect(x, y, width, height));
} }
void WorkspaceWrapper::hideOutline() void WorkspaceWrapper::hideOutline()
{ {
Workspace::self()->outline()->hide(); outline()->hide();
} }
Client *WorkspaceWrapper::getClient(qulonglong windowId) Client *WorkspaceWrapper::getClient(qulonglong windowId)

View file

@ -231,7 +231,7 @@ Workspace::Workspace(bool restore)
client_keys = new KActionCollection(this); client_keys = new KActionCollection(this);
m_outline = new Outline(this); Outline::create(this);
initShortcuts(); initShortcuts();
@ -1530,11 +1530,6 @@ void Workspace::slotBlockShortcuts(int data)
(*it)->updateMouseGrab(); (*it)->updateMouseGrab();
} }
Outline* Workspace::outline()
{
return m_outline;
}
QString Workspace::supportInformation() const QString Workspace::supportInformation() const
{ {
QString support; QString support;

View file

@ -56,7 +56,6 @@ namespace KWin
class Client; class Client;
class KillWindow; class KillWindow;
class Outline;
class RootInfo; class RootInfo;
class Rules; class Rules;
class UserActionsMenu; class UserActionsMenu;
@ -172,8 +171,6 @@ public:
return deleted; return deleted;
} }
Outline* outline();
#ifdef KWIN_BUILD_SCREENEDGES #ifdef KWIN_BUILD_SCREENEDGES
void stackScreenEdgesUnderOverrideRedirect(); void stackScreenEdgesUnderOverrideRedirect();
#endif #endif
@ -182,7 +179,6 @@ public:
QPoint cascadeOffset(const Client *c) const; QPoint cascadeOffset(const Client *c) const;
private: private:
Outline* m_outline;
Compositor *m_compositor; Compositor *m_compositor;
//------------------------------------------------- //-------------------------------------------------