diff options
Diffstat (limited to 'src/action.cpp')
-rw-r--r-- | src/action.cpp | 30 |
1 files changed, 20 insertions, 10 deletions
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 |