This table contains the drawable, wibox and titlebar that we are drawing on, but
also includes the screen and the DPI of that screen. This allows widgets to
depend on the DPI in their rendering.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This way "that other widget" doesn't prevent the current widget from being
garbage collected.
Please note that this in all of these cases the widget under consideration does
have a strong reference to the callback function. This means that the callback
cannot be garbage collected until "this widget" itself is collected. Thanks to
this, this change is safe.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This made it easier to figure out where a file causing an error was
coming from, but I could imagine that this could become too noisy, and
that there is/should probably be a more streamlined way to enable more
verbose logging / error output.
The old code transformed the top-left and bottom-right corner of the rectangle
to device space and calculated a rectangle based on these two points. However,
if you rotate a rectangle by 45°, these two points will be directly above each
other and thus the old code would calculate a width of 0.
Fix this by transforming all four corners of the rectangle into device space and
calculating a rectangle based on this.
Signed-off-by: Uli Schlachter <psychon@znc.in>
When an imagebox was drawn with width or height zero, it tried to calculate the
needed scale factor for making the image fit. Sadly, this would be a division by
zero aka infinite in this case.
Fix this by just not drawing anything if there is no space available.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Previously, odd things could happen if a widget was getting fitted into a
negative width or, even worse, width being NaN (not a number)!
This can e.g. happen due to a margin layout which doesn't get enough space to
even draw the margin that it is supposed to add.
Fix this by enforcing a minimum value of 0 for the width and height that a
widget gets fitted into.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Given an imagebox i with i.resize_forbidden = false and a valid image set, the
call t:fit(0, 0) would return two times "not a number".
This is because the code first does some calculations to get the input image
into the available space and then tried to do some calculations needed for
scaling images up.
The first calculation already gave us h == 0 == w, the second calculation would
then calculate 0/0. This results in NaNs.
This was only noticed because NaN is not a valid table index in lua.
Fix this by returning 0,0 if we have an image of width or height 0 after the
first calculation. Since 0x0 images are valid in cairo, this also fixes the same
bug with such images.
Signed-off-by: Uli Schlachter <psychon@znc.in>
If a drawable has an opaque background, we don't need pseudo transparency and
thus its content don't change when it is moved. However, when we need pseudo
transparency, then we have to redraw the drawable to apply the new background.
Previously we just always did the redraw. This commit adds a helper function
gears.color.create_opaque_pattern() that analyzes a cairo pattern for
transparency. We use this new function to only redraw-on-move when there is
actual pseudo transparency in effect. Otherwise, this redraw can be skipped.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Added set_expand function with options of "none" "outside" or "inside" modes.
The "inside" mode is the default and will result in the original behavior. The
main benefit is being able to actually center a widget in the available space
with options of how to draw the outside widgets (expand to take the space,
or not.) Further functionality can be had by ommiting one of the outside
widgets. Set default layout mode in the constructor.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This changes the align layout fit function so that align:fit will not return
more space than is actually needed by its sub-widgets. Changes to align:draw
were also required so that any widget assigned to the middle slot will expand
to fill the remaining space.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commits adds awesome.register_xproperty(). This allows lua code to register
arbitrary X11 properties with awesome which will then watch these properties.
Whenever such a property is changed on a client or drawin, we will emit the
xproperty::name signal.
This also adds window:get_xproperty(name) and window:set_xproperty(name, value)
which allows to mess with properties.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This makes the drawable paint the wallpaper in the background
(i.e. pseudo transparency) only if there is not a composite manager running,
as reported by the value of awesome.composite_manager_running.
In other words: drawables can now make use of true transparency.
Signed-off-by: Björn Åström <bjoast@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>