Hi,

On 02.01.2014 09:25, John Kha wrote:
>> Start awesome with the default config and open any client. The tasklist entry
>> for this client will only be as wide as the name of the client. It will not
>> cover all of the align layout's middle space.
>>
>> This is because awful.widget.tasklist uses a flex layout and that layout now
>> asks for less space. The align layout centers the middle widget in the space
>> that is left (and only assigns it as much space as it asked for).
>>
>> Ideas?
> 
> Patch 0001
> If the draw function ignores the fit results for the middle widget,
> the expected behavior is back.
> 
> Patch 0002
> Makes the draw function optionally start with the middle widget and
> force the outside widgets to expand or contract to take up the
> remaining space ("outside" option) or just draw the outside widgets to
> their requested size in the remaining space ("none" option). The old
> functionality, drawing the first and last widgets, then expanding the
> middle widget to take the remaining space is still the default
> ("inside" option). The attached screenshot was made by pasting the
> attached align_test.lua into the default rc.lua.

This is the first patch that I see that also contains test code and a screenshot
for explanation. Well done!

However, this is getting complicated. And gets into "not really defined
semantics"-land again. Thanks to you I noticed that "my" align.fit function does
the following:

     for k, v in pairs{self.first, self.second, self.third} do
         local w, h = base.fit_widget(v, orig_width, orig_height)

It offers all widgets the full space, even though some of that was already used
up by other things. No idea what effects this has, but writing layout code turns
out to be complicated...

Back to your patch:
I am mainly trying to convince myself that both patches together don't change
the default behavior and old code continues to work. But things turn out to be
complicated and I don't have any good ideas on how to simplify this.

One thing I noticed is that the "centering" behavior of the old code isn't
really back. The only expand mode that centers the middle widget is "none", but
the default is "inside" which should be the same behavior as after your first
patch. I think...

Also, previously, the widget was centered in the space that was left over from
the first and third widget and now it is centered inside of the align layout.

I also have some stylistic nitpicks like trailing whitespaces and setting the
default expand mode inside of draw(). Could rename self.expand to self._expand
(marking it as something like a private variable), call
self:set_expand("inside") from the "consutrctor" and call self.emit_updated()
inside of set_expand() (this last thing ensures that a redraw gets scheduled)?

I wonder if it would make sense to split these patches up differently. One patch
would only change one layout, because the changes to the other layouts are
pretty much unrelated. However, for now I will just try to find the time to
really understand and stare at this code.

Sorry,
Uli
-- 
99 little bugs in the code
99 little bugs in the code
Take one down, patch it around
117 little bugs in the code
  -- @irqed

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.

Reply via email to