aboutsummaryrefslogtreecommitdiff
path: root/common/action.c
diff options
context:
space:
mode:
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 28d9a95f5..eb8fc2ce2 100644
--- a/common/action.c
+++ b/common/action.c
@@ -452,9 +452,9 @@ static void process_action(keyrecord_t *record)
452 switch (action.layer.code) { 452 switch (action.layer.code) {
453 case 0x00: 453 case 0x00:
454 if (event.pressed) { 454 if (event.pressed) {
455 layer_switch(current_layer | action.layer.opt); 455 layer_switch(current_layer ^ action.layer.opt);
456 } else { 456 } else {
457 layer_switch(current_layer & ~action.layer.opt); 457 layer_switch(current_layer ^ action.layer.opt);
458 } 458 }
459 break; 459 break;
460 case 0xF0: 460 case 0xF0:
@@ -462,25 +462,22 @@ static void process_action(keyrecord_t *record)
462 if (event.pressed) { 462 if (event.pressed) {
463 if (tap_count < TAPPING_TOGGLE) { 463 if (tap_count < TAPPING_TOGGLE) {
464 debug("LAYER_BIT: tap toggle(press).\n"); 464 debug("LAYER_BIT: tap toggle(press).\n");
465 layer_switch(current_layer | action.layer.opt); 465 layer_switch(current_layer ^ action.layer.opt);
466 } 466 }
467 } else { 467 } else {
468 if (tap_count < TAPPING_TOGGLE) { 468 if (tap_count <= TAPPING_TOGGLE) {
469 debug("LAYER_BIT: tap toggle(release).\n"); 469 debug("LAYER_BIT: tap toggle(release).\n");
470 layer_switch(current_layer & ~action.layer.opt); 470 layer_switch(current_layer ^ action.layer.opt);
471 } else {
472 debug("LAYER_BIT: tap toggle.\n");
473 layer_switch(current_layer | action.layer.opt);
474 } 471 }
475 } 472 }
476 break; 473 break;
477 case 0xFF: 474 case 0xFF:
478 // change default layer 475 // change default layer
479 if (event.pressed) { 476 if (event.pressed) {
480 default_layer = current_layer | action.layer.opt; 477 default_layer = current_layer ^ action.layer.opt;
481 layer_switch(default_layer); 478 layer_switch(default_layer);
482 } else { 479 } else {
483 default_layer = current_layer & ~action.layer.opt; 480 default_layer = current_layer ^ action.layer.opt;
484 layer_switch(default_layer); 481 layer_switch(default_layer);
485 } 482 }
486 break; 483 break;
@@ -492,7 +489,7 @@ static void process_action(keyrecord_t *record)
492 register_code(action.layer.code); 489 register_code(action.layer.code);
493 } else { 490 } else {
494 debug("LAYER_BIT: No tap: layer_switch(bit on)\n"); 491 debug("LAYER_BIT: No tap: layer_switch(bit on)\n");
495 layer_switch(current_layer | action.layer.opt); 492 layer_switch(current_layer ^ action.layer.opt);
496 } 493 }
497 } else { 494 } else {
498 if (IS_TAPPING_KEY(event.key) && tap_count > 0) { 495 if (IS_TAPPING_KEY(event.key) && tap_count > 0) {
@@ -500,7 +497,7 @@ static void process_action(keyrecord_t *record)
500 unregister_code(action.layer.code); 497 unregister_code(action.layer.code);
501 } else { 498 } else {
502 debug("LAYER_BIT: No tap: layer_switch(bit off)\n"); 499 debug("LAYER_BIT: No tap: layer_switch(bit off)\n");
503 layer_switch(current_layer & ~action.layer.opt); 500 layer_switch(current_layer ^ action.layer.opt);
504 } 501 }
505 } 502 }
506 break; 503 break;