When i test the key.repeated option for the left-side modifiers, there doesn’t seem to be support for those.
When i do the same for the rightside modifier, keyrepeat works. I only have a right shift key though, so i can’t tell for the control and alt key.
lalt alt false
lshift shift false
lcontrol shift + control false
rshift false
rshift true
rshift true
rshift true
rshift true
rshift true
rshift true
rshift true
rshift true
rshift true
rshift true
rshift true
rshift true
rshift true
rshift true
rshift true
rshift true
rshift true
rshift true
rshift true
rshift true
rshift true
rshift true
rshift true
Is this a platform specific thing or is this something that is limited in Renoise?
Modifier keys do not generate repeat events because they are not used as “regular” keys but only as, well, modifiers for other keys.
Right side modifiers are depending on the option in Renoise’s Keyboard preferences either true modifiers (should not generate repeats then either) or regular keys (which do generate repeats).
Aha, i forgot to mention this logic first, yet having these supported with repeat has some hidden benefit:
I currently have developed a method to use modifier keys in conjunction with mousclicks on buttons. So i can for example control-click a button and make it do something completely different than when i just click the button.
I for sure do not hope you remove the key-repeat for the right side modifiers, else you ruin my plan quite a bit (I can do another compromise using a time out of one second for the left-side modifiers, but it isn’t really smoothly controled)
Globals:
--Keyboard modifier keystates
LCMD = 1
LCAP = 2
LALT = 4
RCMD = 8
RCAP = 16
RALT = 32
key_state = 0
key_repeat_time_out = 0
--Keyhandler
function key_control(dialog, key)
if (key.modifiers == "" and key.name == "esc") then
dialog:close()
elseif (key.modifiers == "control" and key.repeated == true) or
(key.modifiers == "command" and key.repeated == true) then
key_state = bit.bor(LCMD,key_state)
key_repeat_time_out = os.clock()
elseif (key.name == "rcontrol" and key.repeated == true) or
(key.name == "rcommand" and key.repeated == true) then
key_state = bit.bor(RCMD,key_state)
key_repeat_time_out = os.clock()
elseif (key.modifiers == "shift" and key.repeated == true) then
key_state = bit.bor(LCAP,key_state)
key_repeat_time_out = os.clock()
elseif (key.name == "rshift" and key.repeated == true) then
key_state = bit.bor(RCAP,key_state)
key_repeat_time_out = os.clock()
elseif (key.modifiers == "alt" and key.repeated == true) then
key_state = bit.bor(LALT,key_state)
key_repeat_time_out = os.clock()
elseif (key.name == "ralt" and key.repeated == true) then
key_state = bit.bor(RALT,key_state)
key_repeat_time_out = os.clock()
end
end
--App idle notifier, a function called every 10msecs.
--Perform actions or checks here that require frequent polling but not overloading
--the script-engine.
if not renoise.tool().app_idle_observable:has_notifier(idle_handler) then
renoise.tool().app_idle_observable:add_notifier(idle_handler)
end
function idle_handler()
--Reset key-state of the modifier keys.
--This is to prevent mouseclicks being intepreted as
--"modifier + mouseclick" when no modifier is pressed
if os.clock() - key_repeat_time_out > .15 and key_state > 0 then
key_state = 0
end
end
Control example:
vb:button {
id='button',
text='click or shift click me',
notifier=function()
if key_state == LCAP or key_state == RCAP then
print('button got clicked with either left or right shift modifier')
else
print('button just got clicked')
end
end
}