diff options
author | Pavel Labath <pavelo@centrum.sk> | 2011-05-01 14:47:53 (GMT) |
---|---|---|
committer | Pavel Labath <pavelo@centrum.sk> | 2011-05-10 11:00:45 (GMT) |
commit | 4b47675441b76620519b0204497686b09113daaa (patch) | |
tree | c3494c61a82b84418761000d5fc7fc5d12188204 /src/Keys.cc | |
parent | fa15400cc24ddcfd6e361bd068ae1986b9f9e561 (diff) | |
download | fluxbox_paul-4b47675441b76620519b0204497686b09113daaa.zip fluxbox_paul-4b47675441b76620519b0204497686b09113daaa.tar.bz2 |
Make RefCount<> more sensible
the previous version of operator*() made no sense. E.g., it violated the invariant
(*ptr).foo <=> ptr->foo. The dereferencing operator now returns a reference to the pointed-to
object, rather than a pointer to it.
I also added a bool conversion operator, which can be used in testing the NULL-ness of the
pointer. Anyone wondering if that could be done in a simpler way is encouraged to read
<http://www.artima.com/cppsource/safebool.html>.
And, finally, I removed the mutable flag from the m_data member, since it does not need it.
Diffstat (limited to 'src/Keys.cc')
-rw-r--r-- | src/Keys.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Keys.cc b/src/Keys.cc index d3b82e9..79c273b 100644 --- a/src/Keys.cc +++ b/src/Keys.cc | |||
@@ -487,7 +487,7 @@ bool Keys::addBinding(const string &linebuffer) { | |||
487 | first_new_key = new t_key(type, mod, key, context, | 487 | first_new_key = new t_key(type, mod, key, context, |
488 | isdouble); | 488 | isdouble); |
489 | current_key = first_new_key; | 489 | current_key = first_new_key; |
490 | } else if (*current_key->m_command) // already being used | 490 | } else if (current_key->m_command) // already being used |
491 | return false; | 491 | return false; |
492 | } else { | 492 | } else { |
493 | t_key *temp_key = new t_key(type, mod, key, context, | 493 | t_key *temp_key = new t_key(type, mod, key, context, |
@@ -511,7 +511,7 @@ bool Keys::addBinding(const string &linebuffer) { | |||
511 | if (str) // +1 to skip ':' | 511 | if (str) // +1 to skip ':' |
512 | current_key->m_command = FbTk::CommandParser<void>::instance().parse(str + 1); | 512 | current_key->m_command = FbTk::CommandParser<void>::instance().parse(str + 1); |
513 | 513 | ||
514 | if (!str || *current_key->m_command == 0 || mod) { | 514 | if (!str || current_key->m_command == 0 || mod) { |
515 | delete first_new_key; | 515 | delete first_new_key; |
516 | return false; | 516 | return false; |
517 | } | 517 | } |
@@ -572,7 +572,7 @@ bool Keys::doAction(int type, unsigned int mods, unsigned int key, | |||
572 | setKeyMode(next_key); | 572 | setKeyMode(next_key); |
573 | return true; | 573 | return true; |
574 | } | 574 | } |
575 | if (!temp_key || *temp_key->m_command == 0) { | 575 | if (!temp_key || temp_key->m_command == 0) { |
576 | if (type == KeyPress && | 576 | if (type == KeyPress && |
577 | !FbTk::KeyUtil::instance().keycodeToModmask(key)) { | 577 | !FbTk::KeyUtil::instance().keycodeToModmask(key)) { |
578 | // if we're in the middle of an emacs-style keychain, exit it | 578 | // if we're in the middle of an emacs-style keychain, exit it |