summaryrefslogtreecommitdiff
path: root/common/action.c
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2013-01-30 22:47:16 +0900
committertmk <nobody@nowhere>2013-01-30 22:47:16 +0900
commit7e1093b70f424ed012a4122a91ba6bb1784b9eb8 (patch)
treecb123f0a0997c752c2f749baf2edb30e8092efbe /common/action.c
parent10b9237fa613f90008fc2cc5469f42ac50477383 (diff)
Fix: action LAYER_BIT uses xor now instead of and/or.
Diffstat (limited to 'common/action.c')
-rw-r--r--common/action.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/common/action.c b/common/action.c
index 28d9a95f5d..eb8fc2ce24 100644
--- a/common/action.c
+++ b/common/action.c
@@ -452,9 +452,9 @@ static void process_action(keyrecord_t *record)
switch (action.layer.code) {
case 0x00:
if (event.pressed) {
- layer_switch(current_layer | action.layer.opt);
+ layer_switch(current_layer ^ action.layer.opt);
} else {
- layer_switch(current_layer & ~action.layer.opt);
+ layer_switch(current_layer ^ action.layer.opt);
}
break;
case 0xF0:
@@ -462,25 +462,22 @@ static void process_action(keyrecord_t *record)
if (event.pressed) {
if (tap_count < TAPPING_TOGGLE) {
debug("LAYER_BIT: tap toggle(press).\n");
- layer_switch(current_layer | action.layer.opt);
+ layer_switch(current_layer ^ action.layer.opt);
}
} else {
- if (tap_count < TAPPING_TOGGLE) {
+ if (tap_count <= TAPPING_TOGGLE) {
debug("LAYER_BIT: tap toggle(release).\n");
- layer_switch(current_layer & ~action.layer.opt);
- } else {
- debug("LAYER_BIT: tap toggle.\n");
- layer_switch(current_layer | action.layer.opt);
+ layer_switch(current_layer ^ action.layer.opt);
}
}
break;
case 0xFF:
// change default layer
if (event.pressed) {
- default_layer = current_layer | action.layer.opt;
+ default_layer = current_layer ^ action.layer.opt;
layer_switch(default_layer);
} else {
- default_layer = current_layer & ~action.layer.opt;
+ default_layer = current_layer ^ action.layer.opt;
layer_switch(default_layer);
}
break;
@@ -492,7 +489,7 @@ static void process_action(keyrecord_t *record)
register_code(action.layer.code);
} else {
debug("LAYER_BIT: No tap: layer_switch(bit on)\n");
- layer_switch(current_layer | action.layer.opt);
+ layer_switch(current_layer ^ action.layer.opt);
}
} else {
if (IS_TAPPING_KEY(event.key) && tap_count > 0) {
@@ -500,7 +497,7 @@ static void process_action(keyrecord_t *record)
unregister_code(action.layer.code);
} else {
debug("LAYER_BIT: No tap: layer_switch(bit off)\n");
- layer_switch(current_layer & ~action.layer.opt);
+ layer_switch(current_layer ^ action.layer.opt);
}
}
break;