On 30.04.2012 17:55, dodo wrote:
> On 21 April 2012 10:36, Anurag Priyam <[email protected]> wrote:
>> On Sat, Apr 21, 2012 at 1:19 PM, Uli Schlachter <[email protected]> wrote:
>>> On 21.04.2012 09:09, Anurag Priyam wrote:
>>>> Say I run two grabbers one after the other.  If the second grabber
>>>> returns false, the event will be dispatched to the first one without
>>>> removing the second one from the stack.  This doesn't sound like what
>>>> you previously said "...if someone after you asks for keys as well he
>>>> will get it until he leaves it and you're back in key control again."
>>>
>>> Uhm, I think this "table stack" works the other way around than you think it
>>> works. The newest entry has index 1 in the table.
>> [...]
>>> Keygrabber can thus not only ask for old events, but can also pass on some 
>>> of
>>> them to "older" keygrabbers. E.g. a menu which can only be navigated with 
>>> arrow
>>> keys and ignores/passes on all other keys.
>>
>> Right, I got that.  So my question was "Is being able to bubble up
>> events to the older grabbers intended (given the use of 'stack') and
>> whether it is safe?", which you answered below.
>>
>>> Does this make sense? Do you agree that this makes sense?
>>>
>>> (I take your response as a NACK to the patch and will now wait for an ACK 
>>> or a
>>> timeout ;-) )
>>
>> Yep, except the docs could do with some improvement:
>>
>> +--- The global key grabber
>> +-- that distributes the key events to the last grabber in history
>> +local function grabber(mod, key, event)
>> +    for i, g in ipairs(grabbers) do
>> +        -- continue if the grabber returns explicitly false
>>
>> It should be "continue unless the grabber explicitly returns false".
> 
> no. because the iteration continues only when the grabber returns
> false, else it will stop the for loop.
> (in my definition 'unless' is the same like 'if not')
> 
>> Perhaps the luadoc for the module should describe the event bubbling
>> behavior too.
> 
> i hope you're pleased with the doc :)

Whoops, I totally forgot about this thread, sorry.
Merged & pushed.

Uli
-- 
"Do you know that books smell like nutmeg or some spice from a foreign land?"
                                                  -- Faber in Fahrenheit 451

-- 
To unsubscribe, send mail to [email protected].

Reply via email to