summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Reveman <davidr@novell.com>2007-08-14 15:49:35 -0400
committerDavid Reveman <davidr@novell.com>2007-08-14 15:49:35 -0400
commitb04e5c7e005db375518af4535ff07ff6094784b1 (patch)
tree22841286ee1d007d5457fa4755940b0b3dc88940
parentdfde2722a38cb0691d5f389bcc7b4fdfb8814af7 (diff)
Check action type properly when comparing action values.
-rw-r--r--src/option.c61
1 files changed, 40 insertions, 21 deletions
diff --git a/src/option.c b/src/option.c
index f3f562b2..b7a9b74b 100644
--- a/src/option.c
+++ b/src/option.c
@@ -240,28 +240,47 @@ compSetActionOption (CompOption *option,
v.action.terminate = action->terminate;
v.action.state = action->state;
- switch (option->type) {
- case CompOptionTypeKey:
- if (action->key.keycode == v.action.key.keycode &&
- action->key.modifiers == v.action.key.modifiers)
- return FALSE;
- break;
- case CompOptionTypeButton:
- if (action->button.button == v.action.button.button &&
- action->button.modifiers == v.action.button.modifiers &&
- action->edgeMask == v.action.edgeMask)
- return FALSE;
- break;
- case CompOptionTypeEdge:
- if (v.action.edgeMask == action->edgeMask)
- return FALSE;
- break;
- case CompOptionTypeBell:
- if (v.action.bell == action->bell)
+ if (action->type == v.action.type)
+ {
+ switch (option->type) {
+ case CompOptionTypeKey:
+ if (!(action->type & CompBindingTypeKey))
+ return FALSE;
+
+ if (action->key.keycode == v.action.key.keycode &&
+ action->key.modifiers == v.action.key.modifiers)
+ return FALSE;
+ break;
+ case CompOptionTypeButton:
+ if (!(action->type & (CompBindingTypeButton |
+ CompBindingTypeEdgeButton)))
+ return FALSE;
+
+ if (action->type & CompBindingTypeEdgeButton)
+ {
+ if (action->button.button == v.action.button.button &&
+ action->button.modifiers == v.action.button.modifiers &&
+ action->edgeMask == v.action.edgeMask)
+ return FALSE;
+ }
+ else if (action->type & CompBindingTypeButton)
+ {
+ if (action->button.button == v.action.button.button &&
+ action->button.modifiers == v.action.button.modifiers)
+ return FALSE;
+ }
+ break;
+ case CompOptionTypeEdge:
+ if (v.action.edgeMask == action->edgeMask)
+ return FALSE;
+ break;
+ case CompOptionTypeBell:
+ if (v.action.bell == action->bell)
+ return FALSE;
+ break;
+ default:
return FALSE;
- break;
- default:
- return FALSE;
+ }
}
*action = v.action;