get rid of transparent keys as part of the coming sticky cleanup
parent
a812590707
commit
61a8817f2e
|
@ -18,17 +18,16 @@ class Key
|
||||||
Layers = [ :basic, :punc, :nav, :func ]
|
Layers = [ :basic, :punc, :nav, :func ]
|
||||||
|
|
||||||
Functions = {
|
Functions = {
|
||||||
# down up
|
# down up
|
||||||
"basic" => [ "&kbfun_press_release", ],
|
"basic" => [ "&kbfun_press_release", ],
|
||||||
"media" => [ "&kbfun_mediakey_press_release", ],
|
"media" => [ "&kbfun_mediakey_press_release", ],
|
||||||
"transparent" => [ "&kbfun_transparent", ],
|
# down up
|
||||||
# down up
|
"layer" => [ "&kbfun_layer_enable", "&kbfun_layer_disable" ],
|
||||||
"layer" => [ "&kbfun_layer_enable", "&kbfun_layer_disable" ],
|
"latch" => [ "&kbfun_layer_sticky", ],
|
||||||
"latch" => [ "&kbfun_layer_sticky", ],
|
# down up
|
||||||
# down up
|
"shifted" => [ "&kbfun_shift_press_release", ],
|
||||||
"shifted" => [ "&kbfun_shift_press_release", ],
|
"ctrled" => [ "&kbfun_control_press_release", ],
|
||||||
"ctrled" => [ "&kbfun_control_press_release", ],
|
"capslock" => [ "&kbfun_2_keys_capslock_press_release", ],
|
||||||
"capslock" => [ "&kbfun_2_keys_capslock_press_release", ],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys = {
|
Keys = {
|
||||||
|
@ -187,18 +186,25 @@ class Key
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize layers
|
def initialize layers
|
||||||
@layers = layers.map do |key, type|
|
@layers = Array.new(layers.size)
|
||||||
raise "key not found: #{key}" if not Keys.include? key and not key.nil?
|
|
||||||
raise "type not found: #{type}" if not Functions.include? type and not type.nil?
|
|
||||||
|
|
||||||
# just fall through by default
|
layers.each.with_index do |(key, type), i|
|
||||||
type = "transparent" if type.nil? and key.nil?
|
if type.nil? and key.nil?
|
||||||
key = Keys[key] || "KEY_NULL"
|
@layers[i] = @layers[i-1]
|
||||||
|
next
|
||||||
|
end
|
||||||
|
|
||||||
|
keycode = Keys[key]
|
||||||
up, down = Functions[type] || Functions["basic"]
|
up, down = Functions[type] || Functions["basic"]
|
||||||
down ||= up
|
down ||= up
|
||||||
|
|
||||||
Layer.new key, down, up
|
raise "key not found: #{key}" if keycode.nil?
|
||||||
|
raise "type not found: #{type}" if up.nil? or down.nil?
|
||||||
|
|
||||||
|
@layers[i] = Layer.new(keycode, down, up)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
raise "transparency error: #{layers}" if @layers.any?(&:nil?)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -240,7 +246,7 @@ end
|
||||||
|
|
||||||
keys = [
|
keys = [
|
||||||
# letter type punc type nav type func type
|
# letter type punc type nav type func type
|
||||||
%w{ }, %w{ }, %w{ }, %w{ }, # dummy key
|
%w{ NULL }, %w{ }, %w{ }, %w{ }, # dummy key
|
||||||
#
|
#
|
||||||
# left hand
|
# left hand
|
||||||
# number
|
# number
|
||||||
|
@ -313,7 +319,7 @@ keys = [
|
||||||
%w{ 0 }, %w{ f12 }, %w{ f12 }, %w{ f12 },
|
%w{ 0 }, %w{ f12 }, %w{ f12 }, %w{ f12 },
|
||||||
# top
|
# top
|
||||||
# letter type punc type nav type func type
|
# letter type punc type nav type func type
|
||||||
%w{ }, %w{ }, %w{ }, %w{ }, # 1.5
|
%w{ NULL }, %w{ }, %w{ }, %w{ }, # 1.5
|
||||||
%w{ k }, %w{ = }, %w{ 9 }, %w{ f9 },
|
%w{ k }, %w{ = }, %w{ 9 }, %w{ f9 },
|
||||||
%w{ h }, %w{ > shifted }, %w{ 5 }, %w{ f5 },
|
%w{ h }, %w{ > shifted }, %w{ 5 }, %w{ f5 },
|
||||||
%w{ g }, %w{ " shifted }, %w{ 6 }, %w{ f6 },
|
%w{ g }, %w{ " shifted }, %w{ 6 }, %w{ f6 },
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
14
src/main.c
14
src/main.c
|
@ -375,20 +375,6 @@ void kbfun_press_release_preserve_sticky() {
|
||||||
_kbfun_press_release(current_is_pressed, keycode);
|
_kbfun_press_release(current_is_pressed, keycode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Execute the key that would have been executed if the current layer was not
|
|
||||||
* active
|
|
||||||
*/
|
|
||||||
void kbfun_transparent(void) {
|
|
||||||
// TODO maybe re-implement this cleaner?
|
|
||||||
trans_key_pressed = true;
|
|
||||||
layer_offset++;
|
|
||||||
current_layer = layer_peek(layer_offset);
|
|
||||||
layers_pressed[current_row][current_col] = current_layer;
|
|
||||||
exec_key();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// layer helper functions
|
// layer helper functions
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
|
@ -6,7 +6,6 @@ void kbfun_shift_press_release(void);
|
||||||
void kbfun_layer_disable();
|
void kbfun_layer_disable();
|
||||||
void kbfun_layer_sticky();
|
void kbfun_layer_sticky();
|
||||||
void kbfun_layer_enable();
|
void kbfun_layer_enable();
|
||||||
void kbfun_transparent(void);
|
|
||||||
void kbfun_press_release_preserve_sticky();
|
void kbfun_press_release_preserve_sticky();
|
||||||
void kbfun_press_release();
|
void kbfun_press_release();
|
||||||
uint8_t _kbfun_get_keycode();
|
uint8_t _kbfun_get_keycode();
|
||||||
|
|
Loading…
Reference in New Issue