summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/core/action.h10
-rw-r--r--src/action.cpp30
2 files changed, 25 insertions, 15 deletions
diff --git a/include/core/action.h b/include/core/action.h
index b7e36db..a7e18fd 100644
--- a/include/core/action.h
+++ b/include/core/action.h
@@ -88,7 +88,7 @@ class CompAction {
unsigned int modifiers ();
int keycode ();
- bool fromString (const CompString str);
+ bool fromString (const CompString &str);
CompString toString ();
private:
@@ -104,7 +104,7 @@ class CompAction {
unsigned int modifiers ();
int button ();
- bool fromString (const CompString str);
+ bool fromString (const CompString &str);
CompString toString ();
private:
@@ -146,9 +146,9 @@ class CompAction {
bool operator== (const CompAction& val);
CompAction & operator= (const CompAction &action);
- void keyFromString (const CompString str);
- void buttonFromString (const CompString str);
- void edgeMaskFromString (const CompString str);
+ bool keyFromString (const CompString &str);
+ bool buttonFromString (const CompString &str);
+ bool edgeMaskFromString (const CompString &str);
CompString keyToString ();
CompString buttonToString ();
diff --git a/src/action.cpp b/src/action.cpp
index ea94e48..fc672ff 100644
--- a/src/action.cpp
+++ b/src/action.cpp
@@ -147,7 +147,7 @@ CompAction::KeyBinding::keycode ()
}
bool
-CompAction::KeyBinding::fromString (const CompString str)
+CompAction::KeyBinding::fromString (const CompString &str)
{
CompString sStr;
unsigned int mods;
@@ -262,7 +262,7 @@ CompAction::ButtonBinding::button ()
}
bool
-CompAction::ButtonBinding::fromString (const CompString str)
+CompAction::ButtonBinding::fromString (const CompString &str)
{
unsigned int mods;
size_t pos;
@@ -442,19 +442,25 @@ CompAction::operator= (const CompAction &action)
return *this;
}
-void
-CompAction::keyFromString (const CompString str)
+bool
+CompAction::keyFromString (const CompString &str)
{
- if (priv->key.fromString (str))
+ bool retval = priv->key.fromString (str);
+
+ if (retval)
priv->type = CompAction::BindingTypeKey;
else
priv->type = CompAction::BindingTypeNone;
+
+ return retval;
}
-void
-CompAction::buttonFromString (const CompString str)
+bool
+CompAction::buttonFromString (const CompString &str)
{
- if (priv->button.fromString (str))
+ bool retval = priv->button.fromString (str);
+
+ if (retval)
{
priv->edgeMask = bindingStringToEdgeMask (str);
if (priv->edgeMask)
@@ -466,10 +472,12 @@ CompAction::buttonFromString (const CompString str)
{
priv->type = CompAction::BindingTypeNone;
}
+
+ return retval;
}
-void
-CompAction::edgeMaskFromString (const CompString str)
+bool
+CompAction::edgeMaskFromString (const CompString &str)
{
unsigned int edgeMask = 0;
size_t pos;
@@ -495,6 +503,8 @@ CompAction::edgeMaskFromString (const CompString str)
}
priv->edgeMask = edgeMask;
+
+ return (edgeMask != 0 || str.empty ());
}
CompString