Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
No Matches
KODI::WINDOWING::WAYLAND::CWindowDecorator Class Referencefinal

#include <WindowDecorator.h>

Inheritance diagram for KODI::WINDOWING::WAYLAND::CWindowDecorator:


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)

Detailed Description

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.

Constructor & Destructor Documentation

◆ CWindowDecorator()

CWindowDecorator::CWindowDecorator ( IWindowDecorationHandler & handler,
CConnection & connection,
wayland::surface_t const & mainSurface )

Construct window decorator

handlerhandler for window decoration events
connectionconnection to get Wayland globals
mainSurfacemain surface that decorations are constructed around
windowSizefull size of the window including decorations
scalescale to use for buffers
statesurface state for adjusting decoration appearance

Member Function Documentation

◆ AddSeat()

void CWindowDecorator::AddSeat ( CSeat * seat)

◆ CalculateFullSurfaceSize()

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

◆ CalculateMainSurfaceSize()

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

◆ GetMainSurfaceSize()

CSizeInt KODI::WINDOWING::WAYLAND::CWindowDecorator::GetMainSurfaceSize ( ) const

Get calculated size of main surface

◆ GetWindowGeometry()

CRectInt CWindowDecorator::GetWindowGeometry ( ) const

Get full geometry of the window, including decorations if active

◆ IsDecorationActive()

bool CWindowDecorator::IsDecorationActive ( ) const

◆ RemoveSeat()

void CWindowDecorator::RemoveSeat ( CSeat * seat)

◆ SetState()

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

The documentation for this class was generated from the following files: