[awesome bugs] #1296 - Updated signal causes total relayout (Attachment added)
awesome <julien <at> danjou.info>
2014-12-06 19:19:28 GMT
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
The following task has a new comment added:
FS#1296 - Updated signal causes total relayout
User who did this - Uli Schlachter (psychon)
TL;DR: I'd be interested in suggestions for the API.
Once again, here is a new version (mostly bugfixes). And once again, here is the API that a widget can implement:
- widget:fit(width, height): As before, given a space of width x height, this widget should return its
desired width and height
- widget:draw(wibox, cr, width, height): As before, the widget should draw itself on the cairo context cr
in the are from (0, 0) having size (width, height)
- widget:before_draw_children(wibox, cr, width, height) and widget:after_draw_children(wibox, cr,
width, height): These are called before/after children are painted. before_draw_children is
basically the same thing as draw and exists just for consistency. Here the widget can e.g. call
cr:set_source_rgb(0,1,0) to influence its children. And after_draw_children() could be used for...
things. Someone will come up with a use!
- widget:layout(width, height): This returns the layout of the children of the widget. This should return
a list of widget placements. Such a placement can be generated via base.place_widget(widget, matrix,
width, height) where Matrix is a cairo matrix that describes placement and rotation of the widget inside
of its parent's area. Most commonly such a matrix should come from
require("lgi").cairo.Matrix.create_translate(x, y) to place a widget at (x, y).
In contrast to the current area, none of these callbacks are recursive / should call other widgets. The
wibox code does all of that for us.
If a widget needs to be redrawn, but neither its :fit() nor :layout() changed, then it should emit widget::redraw_needed.