Up to now, we always asked the X11 server for color allocation ("which
pixel value corresponds to (r,g,b)?", an AllocCollor request).
This commit adds direct support for TrueColor and DirectColor visuals.
In such a visual, the X11 server gives tells us where the red, green,
and blue color components are in a pixel value and we can then just
directly compute the pixel value.
Additionally, this commit adds code that assumes that in a depth=32
visual, the remaining values (after handling red, green, blue) is the
alpha channel for colors. Thus, this adds support for transparent client
borders.
This commit also touches code for the systray. However, the systray must
always use the X11 server's default visual and that one always(?) has
depth=24, i.e. does not support an alpha channel. Thus, the systray
background still cannot be transparent.
Also, in theory this commit should support visuals where some color
component does not have 8 bits, for example RGB565. However, this is
just theoretic and I have no idea how to actually test this (without
jumping through too many hoops).
Fixes: https://github.com/awesomeWM/awesome/issues/162
Signed-off-by: Uli Schlachter <psychon@znc.in>
* Add support for resizing notification icon with respect to aspect
Previously, if an icon was not exactly square, an icon size set in configuration
would cause the notification to pad the icon with empty space so dimensions are
equal.
Now behaviour is different: the bigger dimension of the icon is scaled to fit
the icon_size value, while smaller is scaled same amount to preserve aspect.
Also, ImageSurface is now not created as fixed size square, but it's dimensions
are computed in similar way.
* Round the computed dimensions of ImageSurface
Even one pixel off is still off.
This is a nice utility function that actually does what most callers
want, instead of signal_array_getbyid() which requires callers to come
up with the signal id.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This now does directly what previously awesome.load_image() did. Also,
this commit removes the only caller of awesome.load_image(), so that
function could (in theory) be removed now.
Fixes: https://github.com/awesomeWM/awesome/issues/1235
Signed-off-by: Uli Schlachter <psychon@znc.in>
Adds unit tests for menubar.utils.lookup_icon_uncached.
Tests that icons and themes are found in the icon base directories, and
icons are resolved with the correct priority.
Creates directories and symlinks in spec/menubar/{home,usr} as test
data.
Before this, running "env -i ./awesome" resulted in a segfault. This was
because xdgInitHandle() failed and the following
xdgSearchableConfigDirectories() followed a NULL pointer.
After this commit, awesome fails with an error message.
Signed-off-by: Uli Schlachter <psychon@znc.in>
The code here has things like "if cache.bgb" which suggests that "bgb"
(great name, by the way) is supposed to be optional. However,
31b8623ff6 made this thing definitely not optional by making it
*the* widget that is displayed. That feels wrong.
Also, after the above commit, the ".primary" entry is no longer used,
which is at least surprising for something which is called "primary".
None of this is explicitly documented (I didn't find anything when
looking for "primary" in common.lua nor tasklist.lua; I know that there
are examples for using this, but still that doesn't say how this is
supposed to work), so I'm not quite sure how this was intended to work.
Instead, I am just proposing this commit as a better fix with the above
rational and see what feedback I get...
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit allow user defined delegates to be used as list elements.
This put an end to the endless attempt to cram more features into this
code.
A widget template (non-instantiated) is passed to the arguments and
is created by the common code. It also supports "roles" where some
user defined widgets can replace the old textbox or imagebox.