refactor(behaviors): use ZMK_BEHAVIOR_OPAQUE and ZMK_BEHAVIOR_TRANSPARENT

Use these instead of the magic return values 0 and 1 for
behavior_driver_api return values.
This commit is contained in:
Okke Formsma
2020-12-18 14:24:28 +01:00
committed by Pete Johanson
parent caa285852a
commit fa07ba9d32
10 changed files with 21 additions and 18 deletions

View File

@@ -138,12 +138,12 @@ static int on_sticky_key_binding_pressed(struct zmk_behavior_binding *binding,
if (sticky_key == NULL) {
LOG_ERR("unable to store sticky key, did you press more than %d sticky_key?",
ZMK_BHV_STICKY_KEY_MAX_HELD);
return 0;
return ZMK_BEHAVIOR_OPAQUE;
}
press_sticky_key_behavior(sticky_key, event.timestamp);
LOG_DBG("%d new sticky_key", event.position);
return 0;
return ZMK_BEHAVIOR_OPAQUE;
}
static int on_sticky_key_binding_released(struct zmk_behavior_binding *binding,
@@ -151,7 +151,7 @@ static int on_sticky_key_binding_released(struct zmk_behavior_binding *binding,
struct active_sticky_key *sticky_key = find_sticky_key(event.position);
if (sticky_key == NULL) {
LOG_ERR("ACTIVE STICKY KEY CLEARED TOO EARLY");
return 0;
return ZMK_BEHAVIOR_OPAQUE;
}
if (sticky_key->modified_key_usage_page != 0 && sticky_key->modified_key_keycode != 0) {
@@ -167,7 +167,7 @@ static int on_sticky_key_binding_released(struct zmk_behavior_binding *binding,
if (ms_left > 0) {
k_delayed_work_submit(&sticky_key->release_timer, K_MSEC(ms_left));
}
return 0;
return ZMK_BEHAVIOR_OPAQUE;
}
static const struct behavior_driver_api behavior_sticky_key_driver_api = {