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 ]
|
||||
|
||||
Functions = {
|
||||
# down up
|
||||
"basic" => [ "&kbfun_press_release", ],
|
||||
"media" => [ "&kbfun_mediakey_press_release", ],
|
||||
"transparent" => [ "&kbfun_transparent", ],
|
||||
# down up
|
||||
"layer" => [ "&kbfun_layer_enable", "&kbfun_layer_disable" ],
|
||||
"latch" => [ "&kbfun_layer_sticky", ],
|
||||
# down up
|
||||
"shifted" => [ "&kbfun_shift_press_release", ],
|
||||
"ctrled" => [ "&kbfun_control_press_release", ],
|
||||
"capslock" => [ "&kbfun_2_keys_capslock_press_release", ],
|
||||
# down up
|
||||
"basic" => [ "&kbfun_press_release", ],
|
||||
"media" => [ "&kbfun_mediakey_press_release", ],
|
||||
# down up
|
||||
"layer" => [ "&kbfun_layer_enable", "&kbfun_layer_disable" ],
|
||||
"latch" => [ "&kbfun_layer_sticky", ],
|
||||
# down up
|
||||
"shifted" => [ "&kbfun_shift_press_release", ],
|
||||
"ctrled" => [ "&kbfun_control_press_release", ],
|
||||
"capslock" => [ "&kbfun_2_keys_capslock_press_release", ],
|
||||
}
|
||||
|
||||
Keys = {
|
||||
|
@ -187,18 +186,25 @@ class Key
|
|||
end
|
||||
|
||||
def initialize layers
|
||||
@layers = layers.map do |key, type|
|
||||
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?
|
||||
@layers = Array.new(layers.size)
|
||||
|
||||
# just fall through by default
|
||||
type = "transparent" if type.nil? and key.nil?
|
||||
key = Keys[key] || "KEY_NULL"
|
||||
layers.each.with_index do |(key, type), i|
|
||||
if type.nil? and key.nil?
|
||||
@layers[i] = @layers[i-1]
|
||||
next
|
||||
end
|
||||
|
||||
keycode = Keys[key]
|
||||
up, down = Functions[type] || Functions["basic"]
|
||||
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
|
||||
|
||||
raise "transparency error: #{layers}" if @layers.any?(&:nil?)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -240,7 +246,7 @@ end
|
|||
|
||||
keys = [
|
||||
# letter type punc type nav type func type
|
||||
%w{ }, %w{ }, %w{ }, %w{ }, # dummy key
|
||||
%w{ NULL }, %w{ }, %w{ }, %w{ }, # dummy key
|
||||
#
|
||||
# left hand
|
||||
# number
|
||||
|
@ -313,7 +319,7 @@ keys = [
|
|||
%w{ 0 }, %w{ f12 }, %w{ f12 }, %w{ f12 },
|
||||
# top
|
||||
# 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{ h }, %w{ > shifted }, %w{ 5 }, %w{ f5 },
|
||||
%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);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
|
@ -6,7 +6,6 @@ void kbfun_shift_press_release(void);
|
|||
void kbfun_layer_disable();
|
||||
void kbfun_layer_sticky();
|
||||
void kbfun_layer_enable();
|
||||
void kbfun_transparent(void);
|
||||
void kbfun_press_release_preserve_sticky();
|
||||
void kbfun_press_release();
|
||||
uint8_t _kbfun_get_keycode();
|
||||
|
|
Loading…
Reference in New Issue