Handle the CSDs and the search box the same way we handle the main
grid; when we need to redraw them, call
render_refresh_{csd,search}(). This sets a flag that is checked after
each FDM iteration. All actual rendering is done here.
This also ties the commits of the Wayland sub-surfaces to the commit
of the main surface.
* minimize: a downward triangle
* maximize (window): an upward triangle
* maximize (already maximized): a hollow square
* close: a filled square
The glyphs are now rendered using the default background color instead
of hardcoded to black.
Applications may temporarily change the foreground color. Don't use
this when rendering the CSD title bar - use the default
foreground (i.e the default default one, or the one configured by the
user in footrc).
But it *does* include the title bar. This simplifies the 'adjustment'
needed to be done to the configured window size.
It also fixes a number of issues:
* the compositor will now properly snap the window to screen
edges (before, there was an empty space between the edge and the
window - the CSD border).
* This also removes the need for the mutter 'commit' workaround. We
must be doing something right now.
The user can now configure the following:
* Whether to prefer CSDs or SSDs. But note that this is only a hint to
the compositor - it may deny our request. Furthermore, not all
compositors implement the decoration manager protocol, meaning CSDs
will be used regardless of the user configuration (GNOME/mutter
being the most prominent one).
* Title bar size and color, including transparency
* Border size and color, including transparency
Also drop support for rendering the CSDs inside the main surface.
When the compositor wants us to decide the size (it sends a configure
event with width/height == 0), then use the last unmaximized size, if
there is one.
If there isn't one, use the size from the user configuration.
Up until now, we've centered the grid on the main surface. Meaning, we
calculated the unusable area, added the user configured padding and
then centered the grid.
This may look nice at first, but doesn't anymore when you start
resizing the window. Resizing the window will cause the top+left
margins to change, which makes the text "jump" or "wobble".
So, now we fix the grid in the upper left corner defined by the user
configured padding (plus CSDs if they aren't positioned outside the
main surface).
For now, this behavior is controlled with an ifdef. At least kwin
seems very buggy when the decorations are positioned like this (but
normally you'd use server-side decorations with kwin anyway).
This commit also changes 'use_csd' to be a tri-state variable;
when instantiating a window it is set to 'unknown'.
If there's no decoration manager available (e.g. weston), we
immediately set it to 'yes' (use CSDs).
Otherwise, we wait for the decoration manager callback to indicate
whether we should use CSDs or not.