Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
|
#include <WindowDecorator.h>
Classes | |
struct | Buffer |
struct | Surface |
Public Member Functions | |
CWindowDecorator (IWindowDecorationHandler &handler, CConnection &connection, wayland::surface_t const &mainSurface) | |
void | SetState (CSizeInt size, int scale, IShellSurface::StateBitset state) |
CSizeInt | GetMainSurfaceSize () const |
CRectInt | GetWindowGeometry () const |
CSizeInt | CalculateMainSurfaceSize (CSizeInt size, IShellSurface::StateBitset state) const |
CSizeInt | CalculateFullSurfaceSize (CSizeInt mainSurfaceSize, IShellSurface::StateBitset state) const |
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 |
CSizeInt CWindowDecorator::CalculateFullSurfaceSize | ( | CSizeInt | mainSurfaceSize, |
IShellSurface::StateBitset | state ) const |
Calculate size of full surface including decorations given the size of the main surface and a state
CSizeInt CWindowDecorator::CalculateMainSurfaceSize | ( | CSizeInt | size, |
IShellSurface::StateBitset | state ) const |
Calculate size of main surface given the size of the full area including decorations and a state
|
inline |
Get calculated size of main surface
CRectInt CWindowDecorator::GetWindowGeometry | ( | ) | const |
Get full geometry of the window, including decorations if active
bool CWindowDecorator::IsDecorationActive | ( | ) | const |
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