summaryrefslogtreecommitdiff
path: root/src/option.cpp
diff options
context:
space:
mode:
authorDennis Kasprzyk <onestone@compiz-fusion.org>2008-08-20 18:11:09 +0200
committerDennis kasprzyk <onestone@compiz-fusion.org>2008-08-20 18:11:09 +0200
commit5c7a3b43ea2f387754d182a2eb6b64cad918ed16 (patch)
tree85ab76c199d9b4cac1782bbe6ce77e4b301049b8 /src/option.cpp
parent29762204b911f983b05acbcc77a3363a3b66012e (diff)
downloadunity-window-decorator-5c7a3b43ea2f387754d182a2eb6b64cad918ed16.tar.gz
unity-window-decorator-5c7a3b43ea2f387754d182a2eb6b64cad918ed16.tar.bz2
Store Screens in a STL list.
Diffstat (limited to 'src/option.cpp')
-rw-r--r--src/option.cpp26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/option.cpp b/src/option.cpp
index bfda243..c8d5a80 100644
--- a/src/option.cpp
+++ b/src/option.cpp
@@ -764,25 +764,31 @@ CompOption::setDisplayOption (CompDisplay *d,
if (o.isAction () &&
o.value ().action ().state () & CompAction::StateAutoGrab)
{
- CompScreen *s;
+ CompScreen *s = NULL;
- for (s = d->screens (); s; s = s->next)
- if (!s->addAction (&value.action ()))
+ foreach (CompScreen *ss, d->screens ())
+ if (!ss->addAction (&value.action ()))
+ {
+ s = ss;
break;
+ }
if (s)
{
- CompScreen *failed = s;
- for (s = d->screens (); s && s != failed; s = s->next)
- s->removeAction (&value.action ());
+ foreach (CompScreen *ss, d->screens ())
+ {
+ if (s == ss)
+ break;
+ ss->removeAction (&value.action ());
+ }
return false;
}
else
{
- for (s = d->screens (); s; s = s->next)
- s->removeAction (&o.value ().action ());
+ foreach (CompScreen *ss, d->screens ())
+ ss->removeAction (&o.value ().action ());
}
return o.set (value);
@@ -818,8 +824,6 @@ finiDisplayOptionValue (CompDisplay *d,
CompOption::Value &v,
CompOption::Type type)
{
- CompScreen *s;
-
switch (type) {
case CompOption::TypeAction:
case CompOption::TypeKey:
@@ -827,7 +831,7 @@ finiDisplayOptionValue (CompDisplay *d,
case CompOption::TypeEdge:
case CompOption::TypeBell:
if (v.action ().state () & CompAction::StateAutoGrab)
- for (s = d->screens (); s; s = s->next)
+ foreach (CompScreen *s, d->screens ())
s->removeAction (&v.action ());
break;
case CompOption::TypeList: