Page 1 of 1

Handled flag?

Posted: 12 Apr 2017, 04:29
by MrAndreas
Is there any way of telling the callback that the current button/direction wasn't handled by the handler so that the button/direction doesn't get trapped but passed on? The way I'm handling it so far is as follows, but this does ignore direction and doesn't send the original button but the ASCII code of it.

lmc_set_handler('FootSwitch',function(button, direction)
_handled = 0

-- Optional code here (sets _handled to 1 if handled)

if (_handled == 0) then
print("Unassigned key: " .. button)
--lmc_send_keys(button, direction) -- Convert code to ASCII or, better still, just return the button/direction combination as unhandled!!!
end
end)

Would be nice if there was an optional flag handled that was part of function, i.e., function(button, direction, var handled = 1) defaulting to 1 to remain backwards compatible.

Re: Handled flag?

Posted: 12 Apr 2017, 07:50
by admin
There is no way.
Blocking original key is kind of windows hack when message queue for active process is in fact stopped until LuaMacros tells whether key should be passed or not. So far it's decided only by macro presence so queue is unblocked quite quickly and LUA code is executed afterwards.
I don't want to move this responsibility (possibility to block active app) to LUA code which can contain anything..