global if behavior name starts with 'layer'
This commit is contained in:
parent
3ff90c81a7
commit
c43c5dbcbc
1 changed files with 13 additions and 1 deletions
|
@ -182,6 +182,8 @@ int zmk_keymap_apply_position_state(uint8_t source, int layer, uint32_t position
|
||||||
LOG_DBG("layer: %d position: %d, binding name: %s", layer, position,
|
LOG_DBG("layer: %d position: %d, binding name: %s", layer, position,
|
||||||
log_strdup(binding.behavior_dev));
|
log_strdup(binding.behavior_dev));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
behavior = device_get_binding(binding.behavior_dev);
|
behavior = device_get_binding(binding.behavior_dev);
|
||||||
|
|
||||||
if (!behavior) {
|
if (!behavior) {
|
||||||
|
@ -196,12 +198,22 @@ int zmk_keymap_apply_position_state(uint8_t source, int layer, uint32_t position
|
||||||
}
|
}
|
||||||
|
|
||||||
enum behavior_locality locality = BEHAVIOR_LOCALITY_CENTRAL;
|
enum behavior_locality locality = BEHAVIOR_LOCALITY_CENTRAL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
err = behavior_get_locality(behavior, &locality);
|
err = behavior_get_locality(behavior, &locality);
|
||||||
if (err) {
|
if (err) {
|
||||||
LOG_ERR("Failed to get behavior locality %d", err);
|
LOG_ERR("Failed to get behavior locality %d", err);
|
||||||
return err;
|
return err;
|
||||||
|
}else{
|
||||||
|
LOG_DBG("got locality: BEHAVIOR_LOCALITY_CENTRAL from behavior");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strncmp(binding.behavior_dev, "layer") == 0) {
|
||||||
|
behavior_locality locality = BEHAVIOR_LOCALITY_GLOBAL;
|
||||||
|
LOG_DBG("force locality: BEHAVIOR_LOCALITY_GLOBAL because of a 'layer' behavior");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
switch (locality) {
|
switch (locality) {
|
||||||
case BEHAVIOR_LOCALITY_CENTRAL:
|
case BEHAVIOR_LOCALITY_CENTRAL:
|
||||||
|
|
Loading…
Add table
Reference in a new issue