summaryrefslogtreecommitdiff
authorDennis Kasprzyk <onestone@compiz-fusion.org>2009-11-28 00:13:14 (GMT)
committer Dennis Kasprzyk <onestone@compiz-fusion.org>2009-11-28 00:13:14 (GMT)
commita27537199c5f68e4b3cc555b26931cca1d5c0920 (patch) (side-by-side diff)
tree37bce35a5a24b8aed1332bd35fa6d3d63f6c739e
parentafa915f7cd2c6db636c0d12a7322979de9d92b32 (diff)
downloadvpswitch-a27537199c5f68e4b3cc555b26931cca1d5c0920.tar.gz
vpswitch-a27537199c5f68e4b3cc555b26931cca1d5c0920.tar.bz2
Don't create copies of all plugin options during iteration. Uninitializing the copied action options will remove the main keybindings.
-rw-r--r--src/vpswitch.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/vpswitch.cpp b/src/vpswitch.cpp
index 2e0b7f3..16ac6c4 100644
--- a/src/vpswitch.cpp
+++ b/src/vpswitch.cpp
@@ -37,15 +37,13 @@ VPSwitchScreen::initPluginAction (CompAction *action,
{
GET_DATA;
- CompOption::Vector opts;
CompPlugin *plugin = CompPlugin::find (optionGetInitPlugin ().c_str ());
bool rv = false;
if (!plugin)
return false;
- options = plugin->vTable->getOptions ();
- foreach (CompOption opt, options)
+ foreach (CompOption &opt, plugin->vTable->getOptions ())
{
if (opt.type () == CompOption::TypeAction ||
opt.type () == CompOption::TypeKey ||
@@ -61,7 +59,7 @@ VPSwitchScreen::initPluginAction (CompAction *action,
}
if (rv)
- action->setState(CompAction::StateTermButton);
+ action->setState(action->state () | CompAction::StateTermButton);
return rv;
}
@@ -71,15 +69,13 @@ VPSwitchScreen::termPluginAction (CompAction *action,
CompAction::State state,
CompOption::Vector &options)
{
- CompOption::Vector opts;
CompPlugin *plugin = CompPlugin::find (optionGetInitPlugin ().c_str ());
bool rv = false;
if (!plugin)
return false;
- options = plugin->vTable->getOptions ();
- foreach (CompOption opt, options)
+ foreach (CompOption &opt, plugin->vTable->getOptions ())
{
if (opt.type () == CompOption::TypeAction ||
opt.type () == CompOption::TypeKey ||
@@ -260,7 +256,7 @@ VPSwitchScreen::initiateNumbered (CompAction *action,
numberedActive = true;
if (state & CompAction::StateInitKey)
- action->setState (CompAction::StateTermKey);
+ action->setState (action->state () | CompAction::StateTermKey);
return true;
}