summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSam Spilsbury <sam.spilsbury@canonical.com>2010-11-08 21:55:32 +0800
committerSam Spilsbury <sam.spilsbury@canonical.com>2010-11-08 21:55:32 +0800
commite9784868c65bf0cf7c1f7e354fcbe00d8da4edfe (patch)
treee78b9f435445b1066fce203ef3af2144fbfdf2f6 /src
parent86d92fd7eb95c24d0f99e9c8f17d3f07d66c4468 (diff)
downloadunity-window-decorator-e9784868c65bf0cf7c1f7e354fcbe00d8da4edfe.tar.gz
unity-window-decorator-e9784868c65bf0cf7c1f7e354fcbe00d8da4edfe.tar.bz2
Don't increase core action register reference counts if the same action was already registered
Diffstat (limited to 'src')
-rw-r--r--src/action.cpp9
-rw-r--r--src/privateaction.h2
-rw-r--r--src/screen.cpp16
3 files changed, 23 insertions, 4 deletions
diff --git a/src/action.cpp b/src/action.cpp
index ab8cfb5..2c97244 100644
--- a/src/action.cpp
+++ b/src/action.cpp
@@ -620,6 +620,12 @@ CompAction::edgeToString (unsigned int edge)
return edges[edge].name;
}
+bool
+CompAction::active ()
+{
+ return priv->active;
+}
+
PrivateAction::PrivateAction () :
initiate (),
terminate (),
@@ -628,7 +634,8 @@ PrivateAction::PrivateAction () :
key (),
button (),
bell (false),
- edgeMask (0)
+ edgeMask (0),
+ active (false)
{
memset (&priv, 0, sizeof (CompPrivate));
}
diff --git a/src/privateaction.h b/src/privateaction.h
index 9c972ec..0bf35b5 100644
--- a/src/privateaction.h
+++ b/src/privateaction.h
@@ -47,6 +47,8 @@ class PrivateAction {
unsigned int edgeMask;
+ bool active;
+
CompPrivate priv;
};
diff --git a/src/screen.cpp b/src/screen.cpp
index 4e5fc2e..c0e9bee 100644
--- a/src/screen.cpp
+++ b/src/screen.cpp
@@ -60,6 +60,7 @@
#include <core/atoms.h>
#include "privatescreen.h"
#include "privatewindow.h"
+#include "privateaction.h"
bool inHandleEvent = false;
@@ -1842,7 +1843,7 @@ PrivateScreen::updateOutputDevices ()
foreach (CompWindow *w, windows)
if (w->priv->fullscreenMonitorsSet)
w->priv->setFullscreenMonitors (NULL);
-
+
for (unsigned int i = 0; i < nOutput - 1; i++)
for (unsigned int j = i + 1; j < nOutput; j++)
if (outputDevs[i].intersects (outputDevs[j]))
@@ -3006,6 +3007,9 @@ CompScreen::addAction (CompAction *action)
if (!screenInitalized || !priv->initialized)
return false;
+ if (action->active ())
+ return false;
+
if (action->type () & CompAction::BindingTypeKey)
{
if (!priv->addPassiveKeyGrab (action->key ()))
@@ -3032,6 +3036,8 @@ CompScreen::addAction (CompAction *action)
priv->enableEdge (i);
}
+ action->priv->active = true;
+
return true;
}
@@ -3041,6 +3047,9 @@ CompScreen::removeAction (CompAction *action)
if (!priv->initialized)
return;
+ if (!action->active ())
+ return;
+
if (action->type () & CompAction::BindingTypeKey)
priv->removePassiveKeyGrab (action->key ());
@@ -3055,6 +3064,8 @@ CompScreen::removeAction (CompAction *action)
if (action->edgeMask () & (1 << i))
priv->disableEdge (i);
}
+
+ action->priv->active = false;
}
CompRect
@@ -3861,7 +3872,7 @@ ScreenInterface::leaveShowDesktopMode (CompWindow *window)
void
ScreenInterface::outputChangeNotify ()
WRAPABLE_DEF (outputChangeNotify)
-
+
void
ScreenInterface::addSupportedAtoms (std::vector<Atom>& atoms)
WRAPABLE_DEF (addSupportedAtoms, atoms)
@@ -4576,7 +4587,6 @@ PrivateScreen::PrivateScreen (CompScreen *screen) :
boost::bind (&PrivateScreen::handleStartupSequenceTimeout, this));
startupSequenceTimer.setTimes (1000, 1500);
-
optionSetCloseWindowKeyInitiate (CompScreen::closeWin);
optionSetCloseWindowButtonInitiate (CompScreen::closeWin);
optionSetRaiseWindowKeyInitiate (CompScreen::raiseWin);