On 21 April 2012 10:36, Anurag Priyam <anurag08pri...@gmail.com> wrote:
> On Sat, Apr 21, 2012 at 1:19 PM, Uli Schlachter <psyc...@znc.in> 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 :)


-- dodo

Attachment: 0001-awful.keygrabber-capi.keygrabber-stack.patch
Description: Binary data

Attachment: 0002-use-awful.keygrabber-in-awful.menu.patch
Description: Binary data

Attachment: 0003-use-awful.keygrabber-in-awful.prompt.patch
Description: Binary data

Attachment: 0004-no-keygrabber-in-menubar-needed.patch
Description: Binary data

Reply via email to