summaryrefslogtreecommitdiff
path: root/src/actions.cc
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-01-11 11:16:36 +0000
committerDana Jansens <danakj@orodu.net>2003-01-11 11:16:36 +0000
commite8f5cf2940667a60698d28fe0cae208792357676 (patch)
tree2dc2879b9c6e1e6c303ac0595d3eb6cfcbc113b5 /src/actions.cc
parentbc88d310fea71823fb2c61d071ff499579bffaba (diff)
valgrind fixes, and fixes for writing shit all over the environment. yay~!!!!!!!
Diffstat (limited to 'src/actions.cc')
-rw-r--r--src/actions.cc20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/actions.cc b/src/actions.cc
index 15a3e6c2..96290bdd 100644
--- a/src/actions.cc
+++ b/src/actions.cc
@@ -37,8 +37,10 @@ OBActions::~OBActions()
void OBActions::insertPress(const XButtonEvent &e)
{
ButtonPressAction *a = _posqueue[BUTTONS - 1];
- for (int i=BUTTONS-1; i>0;)
- _posqueue[i] = _posqueue[--i];
+ // rm'd the last one, shift them all down one
+ for (int i = BUTTONS-1; i > 0; --i) {
+ _posqueue[i] = _posqueue[i-1];
+ }
_posqueue[0] = a;
a->button = e.button;
a->pos.setPoint(e.x_root, e.y_root);
@@ -49,17 +51,19 @@ void OBActions::insertPress(const XButtonEvent &e)
void OBActions::removePress(const XButtonEvent &e)
{
+ int i;
ButtonPressAction *a = 0;
- for (int i=0; i<BUTTONS; ++i) {
- if (_posqueue[i]->button == e.button)
+ for (i=0; i<BUTTONS-1; ++i)
+ if (_posqueue[i]->button == e.button) {
a = _posqueue[i];
- if (a) // found one and removed it
+ break;
+ }
+ if (a) { // found one, remove it and shift the rest up one
+ for (; i < BUTTONS-1; ++i)
_posqueue[i] = _posqueue[i+1];
- }
- if (a) { // found one
_posqueue[BUTTONS-1] = a;
- a->button = 0;
}
+ _posqueue[BUTTONS-1]->button = 0;
}
void OBActions::buttonPressHandler(const XButtonEvent &e)