On 06.05.2012 04:20, Anurag Priyam wrote:
> [+CC: Uli]
>
> On Sun, May 6, 2012 at 6:35 AM, Anurag Priyam <[email protected]>
> wrote:
>> On Sun, May 6, 2012 at 4:25 AM, Gerald Klein <[email protected]> wrote:
>>> /usr/share/awesome/lib/wibox/init.lua:136 attempt to index local 'c' (a nil
>>> value)
>>
>> Do you have bg_focus and bg_normal keys in your theme file?
>
> Even otherwise there is something fishy about `set_bg` function. The
> doc says the color can be nil, but it fails to use a default if no
> color argument was given.
>
> Uli, what's with the `colstr` variable? It doesn't seem to be used
> anywhere. Same for the `if c:get_type()` block. Doesn't look like
> anything is being done with the rgba values that it computes. I
> wonder if this (attached patch) is the right approach:
This was added in commit 07bbe14d02. The problem was that whenever the wibox
needed to be drawn, the X server first filled that area with black and only
later did awesome paint the right background to it. That's why there was code to
make it tell the X server which color is the correct one.
However, then came 20cafb48. The idea now is to tell the X server not to fill
that area with any color, so there wouldn't be any flickering due to a short
"flash" of black appearing. Apparently, I left quite some code behind in wibox'
set_bg() function when I added this.
> function set_bg(wibox, c)
> - local c = c
> - local colstr = "#000000" -- Default if we can't figure out the color
> + local c = c or "#000000"
> if type(c) == "string" or type(c) == "table" then
> c = color(c)
> end
> @@ -137,7 +136,7 @@ function set_bg(wibox, c)
> local r, g, b, a = c:get_rgba()
> r, g, b, a = r * 255, g * 255, b * 255, a * 255
> -- Alpha isn't supported for backgrounds
> - colstr = string_format("#%02x%02x%02x", r, g, b)
> + c = string_format("#%02x%02x%02x", r, g, b)
> end
> wibox.background_color = c
> wibox.draw()
This patch is wrong. wibox.background_color must always be a cairo pattern
object and not a string. If it really gets set to "#000000", everytime a wibox
gets redrawn, oocairo will throw a lua error about "cr:set_source() needs a
Cairo pattern or surface object as argument 2".
> Is that `if c:get_type()` block even necessary now that wiboxes
> support pseudo-transparency (SHA:
> 5c7a3501d01a22f6cf4637bc057b46598e41e69a)?
No, this block is no longer needed, however this is due to commit 20cafb48 which
I mentioned above. This has nothing to do with pseudo-transparency.
Could you send (to awesome-devel) two new patches? First one will be
- local c = c
- local colstr = "#000000" -- Default if we can't figure out the color
+ local c = c or "#000000"
(which makes the default bg color work again) and the second patch removes the
whole c:get_type() block which sets the unused variable colstr.
Oh for the first patch: set_fg() also says that it accepts nil as an argument
but doesn't. I only took a quick look and found that already...
Uli
--
- Buck, when, exactly, did you lose your mind?
- Three months ago. I woke up one morning married to a pineapple.
An ugly pineapple... But I loved her.
--
To unsubscribe, send mail to [email protected].