xbmc
|
Paint decorations around windows with subcompositing. More...
#include <WindowDecorator.h>
Classes | |
struct | Buffer |
struct | Surface |
Public Member Functions | |
CWindowDecorator (IWindowDecorationHandler &handler, CConnection &connection, wayland::surface_t const &mainSurface) | |
Construct window decorator. More... | |
void | SetState (CSizeInt size, int scale, IShellSurface::StateBitset state) |
Set decoration state and size by providing full surface size including decorations. More... | |
CSizeInt | GetMainSurfaceSize () const |
Get calculated size of main surface. | |
CRectInt | GetWindowGeometry () const |
Get full geometry of the window, including decorations if active. | |
CSizeInt | CalculateMainSurfaceSize (CSizeInt size, IShellSurface::StateBitset state) const |
Calculate size of main surface given the size of the full area including decorations and a state. | |
CSizeInt | CalculateFullSurfaceSize (CSizeInt mainSurfaceSize, IShellSurface::StateBitset state) const |
Calculate size of full surface including decorations given the size of the main surface and a state. | |
bool | IsDecorationActive () const |
void | AddSeat (CSeat *seat) |
void | RemoveSeat (CSeat *seat) |
Paint decorations around windows with subcompositing.
With Wayland, applications are responsible for drawing borders on their windows themselves (client-side decorations). To keep the impact on the overall architecture low, the Wayland platform implementation uses this very simple renderer to build ugly but fully functional decorations around the Kodi window. Since Kodi as a media center is usually not used in windowed mode anyway (except maybe for development), the impact of the visually not-so-pleasing decorations should be limited. Nice decorations would require more effort and external libraries for proper 2D drawing.
If more platforms decide that client-side decorations would be a good idea to implement, the decorations could also be integrated with the Kodi skin system. Then this class could be removed.
The decorations are positioned around the main surface automatically.
CWindowDecorator::CWindowDecorator | ( | IWindowDecorationHandler & | handler, |
CConnection & | connection, | ||
wayland::surface_t const & | mainSurface | ||
) |
Construct window decorator.
handler | handler for window decoration events |
connection | connection to get Wayland globals |
mainSurface | main surface that decorations are constructed around |
windowSize | full size of the window including decorations |
scale | scale to use for buffers |
state | surface state for adjusting decoration appearance |
void CWindowDecorator::SetState | ( | CSizeInt | size, |
int | scale, | ||
IShellSurface::StateBitset | state | ||
) |
Set decoration state and size by providing full surface size including decorations.
Calculates size of the main surface from size of all surfaces combined (including window decorations) by subtracting the decoration size
Decorations will be disabled if state includes STATE_FULLSCREEN
Call only from main thread