Everything is pretty clear now. Thanks Can for a detailed answer,
especially the part of writing the full detailed thinking process. You have
been of great help. :)

2012/4/12 Can Altıparmak <[email protected]>

> I had a typo, it should be  "awful/widget/common.lua".
>
> > So far so good. I can see that in source code that a signal is added.
> >
> >          if press then
> >             ret[#ret]:add_signal("press", function(bobj, ...) press(...)
> > end)
> >
> > To my understanding, a table with all created buttons is returned.
>
> Yes, "new" function creates a new button, connects it to signals and
> returns a table of buttons. But return value is not really important.
> We only care about, to which signal it is connected. Here "press". So,
> search where it is emitted for something like `emit_signal("press"`.
>
> > I still couldn't find as to how would I know what is passed to the `press
> > callback`. Your answer definitely helped but I still couldn't get the
> actual
> > way of finding the parameters.
>
> In awful/widget/common.lua "list_update", done for every button:
>                    -- Create a proxy button object: it will receive the
> real
>                    -- press and release events, and will propagate them
> the the
>                    -- button object the user provided, but with the object
> as
>                    -- argument.
>                    local btn = capi.button { modifiers = b.modifiers,
> button = b.button }
>                    btn:add_signal("press", function ()
> b:emit_signal("press", o) end)
>
> Then all "btn"s inserted to widgets (imagebox and textbox) in this list.
>            w[k]:buttons(btns)
>            w[k + 1]:buttons(btns)
> From reference:
> -buttons (buttons_table)
>    Set the widget buttons. It will receive a press or release event
> when of this buttons is pressed.
>
> You may ask how or where widget gets this event, I also don't know.
> However what is only important is argument of "press" signal emitted
> from real press event. This "o" comes from "objects" table which is an
> argument to list_update. And in awful/widget/tasklist.lua
> "tasklist_update", shownclients passed as "objects" to list_update. So
> "o" is a client object.
>
> I also don't know much about awesome codebase. I tried to relate
> connected signal to emitted for tasklist and it is a little bit
> cumbersome, but hopefully helped.
>
> --
> Can Altıparmak
>



-- 
Regards,
Abhijeet Rastogi (shadyabhi)
https://plus.google.com/107316377741966576356/

Reply via email to