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>
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>
Let's consider the following notification:
naughty.notify({ text = "foo", bg = "#88888888", timeout=1 })
naughty.notify({ text = "foo", bg = "#88888888", timeout=2 })
When the first notification disappears, the second one is moved and takes its
place. However, its content was not redrawn. This makes the pseudo-transparency
break and the wallpaper that is shown in the back of the notification doesn't
match the real wallpaper.
Fix this by redrawing drawables when they get moved.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Thanks to the previous commit, a drawable can no longer have a finished cairo
surface. Instead, it will now have a nil surface. This commit handles this new
possibility.
Signed-off-by: Uli Schlachter <psychon@znc.in>
The current code relied on some widget to cause a redraw when the focus changes.
Obviously, this assumption is wrong.
Instead, the code now uses the proper "focus" and "unfocus" signals for setting
titlebar colors, but it also needs to set these colors when a new titlebar is
created (v1 of this patch forgot that). For this reason, update_colors has to be
saved for when a titlebar's colors are updated.
This commit also reverts the ugly redraw_hook hack from commit a1918b8306.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Drawables could never be garbage-collected, because of the "wallpaper_changed"
signal. The callback function for this signal kept a strong reference to the
drawable.
Fix this by putting all drawable's draw() methods into a weakly keyed tabled so
that the strong reference to them disappears.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commits adds the necessary lua code so that we finally can have titlebars.
As the baseline for the needed functionality, the titlebar code in awesome 3.4
and a quick poll on the mailing list were used.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This new property is used for fixing some missing redraws that the old code had.
Those could be seen via awful.menu. Open and close a submenu repeatedly and the
submenu will appear black.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit makes it possible to add titlebars to a client. These titlebars are
drawables.
The drawin's input handling is moved to the drawable. This allows it to use the
same code for drawin and titlebar input handling, although there are lots of
differences between the two on the C side.
On the lua side, a new wibox.drawable module is created which handles all the
drawable-specific magic and which can also be used for titlebars.
Signed-off-by: Uli Schlachter <psychon@znc.in>