Zakero's C++ Header Libraries
A collection of reusable C++ libraries
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
zakero::Yetani Class Reference

A wrapper class for Wayland. More...

Inherits buffer_listener, frame_callback_listener, keyboard_listener, output_listener, pointer_listener, registry_listener, seat_listener, shm_listener, surface_listener, xdg_wm_base_listener, xdg_surface_listener, xdg_toplevel_listener, and xdg_toplevel_decoration_listener.

Classes

struct  CursorConfig
 Cursor configuration. More...
 
struct  Key
 Key event information. More...
 
struct  KeyModifier
 A collection modifier flags. More...
 
struct  Output
 Information about a output device. More...
 
struct  PointerAxis
 Information about an Axis event. More...
 
struct  PointerButton
 Information about a pointer button event. More...
 
struct  PointMm
 A location that uses millimeters. More...
 
struct  PointPercent
 A location that uses percentages. More...
 
struct  PointPixel
 A location that uses pixels. More...
 
struct  SizeMm
 Size measured in millimeters. More...
 
struct  SizePercent
 Size measured as a percentage of the Output (Monitor) resolution. More...
 
struct  SizePixel
 Size measured in pixels. More...
 
class  Window
 A Window. More...
 

Public Types

enum class  KeyState
 Keyboard key state More...
 
enum class  PointerAxisSource
 Where the axis information came from.
 
enum class  PointerAxisType
 The direction of the axis movement.
 
enum class  PointerButtonState
 Mouse button state.
 
enum class  WindowDecorations
 Who is responsible for rendering the decorations.
 
enum class  WindowMode
 

Public Member Functions

virtual ZAKERO_YETANI__ERROR_DATA ~Yetani () noexcept
 Destructor. More...
 
std::error_code cursorCreate (const std::string &, const Yetani::CursorConfig &) noexcept
 Create a cursor. More...
 
std::error_code cursorDestroy (const std::string &) noexcept
 Destroy a cursor. More...
 
int32_t keyRepeatDelay () const noexcept
 The key repeat delay. More...
 
int32_t keyRepeatRate () const noexcept
 The key repeat rate. More...
 
Yetani::Output output (const Yetani::OutputId) const noexcept
 Get a copy of the Output information. More...
 
Yetani::PointMm outputConvertToMm (const Yetani::OutputId, const Yetani::PointPixel &) const noexcept
 Convert Pixel to Millimeter. More...
 
Yetani::SizeMm outputConvertToMm (const Yetani::OutputId, const Yetani::SizePixel &) const noexcept
 Convert Pixel to Millimeter. More...
 
Yetani::PointPercent outputConvertToPercent (const Yetani::OutputId, const Yetani::PointPixel &) const noexcept
 Convert Pixel to a Percentage. More...
 
Yetani::SizePercent outputConvertToPercent (const Yetani::OutputId, const Yetani::SizePixel &) const noexcept
 Convert Pixel to a Percentage. More...
 
Yetani::PointPixel outputConvertToPixel (const Yetani::OutputId, const Yetani::PointMm &) const noexcept
 Convert Millimeter to Pixel. More...
 
Yetani::PointPixel outputConvertToPixel (const Yetani::OutputId, const Yetani::PointPercent &) const noexcept
 Convert Percentage to Pixel. More...
 
Yetani::SizePixel outputConvertToPixel (const Yetani::OutputId, const Yetani::SizeMm &) const noexcept
 Convert Millimeter to Pixel. More...
 
Yetani::SizePixel outputConvertToPixel (const Yetani::OutputId, const Yetani::SizePercent &) const noexcept
 Convert Percentage to Pixel. More...
 
void outputOnAdd (Yetani::LambdaOutputId) noexcept
 Notification of adding an Output device. More...
 
void outputOnChange (Yetani::LambdaOutputId) noexcept
 Notification that an Output device has changed. More...
 
void outputOnRemove (Yetani::LambdaOutputId) noexcept
 Notification of removing an Output device. More...
 
Yetani::VectorOutputId outputVector () const noexcept
 Get a list of the Output Id's. More...
 
const Yetani::VectorShmFormat & shmFormatAvailable () const noexcept
 Get all the support color formats. More...
 
Yetani::WindowwindowCreate (const Yetani::SizeMm &, const wl_shm_format, std::error_code &) noexcept
 Create a window. More...
 
Yetani::WindowwindowCreate (const Yetani::SizeMm &, const wl_shm_format=SHM_FORMAT_DEFAULT) noexcept
 Create a window. More...
 
Yetani::WindowwindowCreate (const Yetani::SizeMm &, std::error_code &) noexcept
 Create a window. More...
 
Yetani::WindowwindowCreate (const Yetani::SizePercent &, const wl_shm_format, std::error_code &) noexcept
 Create a window. More...
 
Yetani::WindowwindowCreate (const Yetani::SizePercent &, const wl_shm_format=SHM_FORMAT_DEFAULT) noexcept
 Create a window. More...
 
Yetani::WindowwindowCreate (const Yetani::SizePercent &, std::error_code &) noexcept
 Create a window. More...
 
Yetani::WindowwindowCreate (const Yetani::SizePixel &, const wl_shm_format, std::error_code &) noexcept
 Create a window. More...
 
Yetani::WindowwindowCreate (const Yetani::SizePixel &, const wl_shm_format=SHM_FORMAT_DEFAULT) noexcept
 Create a window. More...
 
Yetani::WindowwindowCreate (const Yetani::SizePixel &, std::error_code &) noexcept
 Create a window. More...
 

Static Public Member Functions

static Yetaniconnect () noexcept
 Establish a connection with the Wayland Compositor. More...
 
static Yetaniconnect (const std::string &) noexcept
 Establish a connection with the Wayland Compositor. More...
 
static Yetaniconnect (const std::string &, std::error_code &) noexcept
 Establish a connection with the Wayland Compositor. More...
 
static Yetaniconnect (std::error_code &) noexcept
 Establish a connection with the Wayland Compositor. More...
 
static std::string outputSubpixelName (int32_t) noexcept
 Get a human readable string. More...
 
static std::string outputTransformName (int32_t) noexcept
 Get a human readable string. More...
 
static uint8_t shmFormatBytesPerPixel (const wl_shm_format) noexcept
 Determine bytes-per-pixel. More...
 
static std::string shmFormatDescription (const wl_shm_format) noexcept
 Get a description of the format. More...
 
static std::string shmFormatName (const wl_shm_format) noexcept
 Get the name of the format. More...
 

Static Public Attributes

static constexpr uint32_t KeyModifier_Alt
 Key Modifier flag.
 
static constexpr uint32_t KeyModifier_CapsLock
 Key Modifier flag.
 
static constexpr uint32_t KeyModifier_Control
 Key Modifier flag.
 
static constexpr uint32_t KeyModifier_Meta
 Key Modifier flag.
 
static constexpr uint32_t KeyModifier_Shift
 Key Modifier flag.
 
static constexpr wl_shm_format SHM_FORMAT_DEFAULT
 The default pixel format.
 

Lambdas

using Lambda = std::function< void()>
 A Lambda that has no parameters.
 
using LambdaKey = std::function< void(const Yetani::Key &, const Yetani::KeyModifier &)>
 A Lambda that has parameters: Key and KeyModifier.
 
using LambdaAxis = std::function< void(const Yetani::PointerAxis &, const Yetani::KeyModifier &)>
 A Lambda that has parameters: PointerAxis and KeyModifier.
 
using LambdaButtonMm = std::function< void(const Yetani::PointerButton &, const Yetani::PointMm &, const Yetani::KeyModifier &)>
 A Lambda that has parameters: PointerButton, PointMm and KeyModifier.
 
using LambdaButtonPercent = std::function< void(const Yetani::PointerButton &, const Yetani::PointPercent &, const Yetani::KeyModifier &)>
 A Lambda that has parameters: PointerButton, PointPercent and KeyModifier.
 
using LambdaButtonPixel = std::function< void(const Yetani::PointerButton &, const Yetani::PointPixel &, const Yetani::KeyModifier &)>
 A Lambda that has parameters: PointerButton, PointPixel and KeyModifier.
 
using LambdaPointMm = std::function< void(const Yetani::PointMm &, const Yetani::KeyModifier &)>
 A Lambda that has parameters: PointMm and KeyModifier.
 
using LambdaPointPercent = std::function< void(const Yetani::PointPercent &, const Yetani::KeyModifier &)>
 A Lambda that has parameters: PointPercent and KeyModifier.
 
using LambdaPointPixel = std::function< void(const Yetani::PointPixel &, const Yetani::KeyModifier &)>
 A Lambda that has parameters: PointPixel and KeyModifier.
 
using LambdaBool = std::function< void(bool)>
 A Lambda that has a parameter: bool.
 
using LambdaWindowDecorations = std::function< void(Yetani::WindowDecorations)>
 A Lambda that has a parameter: WindowDecorations.
 
using LambdaWindowMode = std::function< void(Yetani::WindowMode)>
 A Lambda that has a parameter: WindowMode.
 
using LambdaSizeMm = std::function< void(const Yetani::SizeMm &)>
 A Lambda that has a parameter: SizeMm.
 
using LambdaSizePercent = std::function< void(const Yetani::SizePercent &)>
 A Lambda that has a parameter: SizePercent.
 
using LambdaSizePixel = std::function< void(const Yetani::SizePixel &)>
 A Lambda that has a parameter: SizePixel.
 

Detailed Description

Refer to Zakero_Yetani.h to learn how to include this library.

The intent of this class is to make creating programs that interface directly with Wayland easier. While there are toolkits out there that do this (GTK, Qt, SDL, etc.), they also come with a lot of overhead. This class will abstract much of Wayland and provide a simple event driven interface.

As soon as a connection to the Wayland server has been established, a thread will be created to move all the communications to the background. This means that there is no "main loop" in the Yetani object to hook into. The benefit to this is that Window contents/graphics will not block event handling.

Refer to How To Use It? for a simple example.

Window

Using Yetani to connect to a Wayland Compositor is just the first step. The next step is to create a Window that can display something. This is done using one of the windowCreate() methods. There are 3 sets of methods:

Why three? The traditional pixels for size has many problems in today's display technology. A resolution of 1024x768 may sound consistent in that you know exactly how many pixels will be used on every display. However, 1024x768 may be OK on some displays, it may be too small on 4k laptop screens. And what about the 8k displays?

The easy answer is to find the maximum resolution and use all of it, or just half for a windowed app. Instead of doing that work, why not just use percentages like 1.00x1.00 or 0.50x0.50 that will work on all display resolutions? That is why Yetani has the SizePercent object.

What about millimeters? Using millimeters gives the developer more confidence that size of an area will be physically consistent across devices. To illustrate this consider defining a 300x150 button. This button may be easily clickable on most monitors but may be too small on a 4k display. Defining a button to be 20mm x 10mm, it will be the same physical size on all monitors.

What's wrong with DPI? DPI has become a mess in the computer world and is resolution, not a size.

Thread (not) Safe

The main Wayland event loop runs in a dedicated thread. Because of this, there are race-conditions where execution uses the same data. The most likely thread conflict is the resizing of a surface:

  • User Thread: Calling one of the window's "size" methods
  • Wayland Thread: Maximizing/Fullscreen/resizing the window

While the above is mostly protected via mutexs' there is still a chance.

There are other potential problems such as the User Thread deleting a window while the Wayland Thread is resizing the same window. To resolve this issue will require a complete evaluation of data and thread activities.

Or take the easy way out and rewrite Yetani to be single-threaded...

Todo:

XDGOutput Support

Client-Side Border

Mouse-Look Support

Touch Input Support

Clipboard Support

cursorAliasAdd() (maybe)

cursorAliasRemove() (maybe)

cursorAvailableNames() (maybe)

cursorXDGLoad() (maybe)

Use ZAKERO_DELETE() where it makes sense


Class Documentation

◆ zakero::Yetani::CursorConfig

struct zakero::Yetani::CursorConfig
Class Members
wl_shm_format format The pixel format.
int32_t hotspot_x The X location of the hotspot.
int32_t hotspot_y The Y location of the hotspot.
const vector< void * > & image_data A collection of image data.
SizePixel size The size of the cursor.
milliseconds time_per_frame How long to display each frame of animation.

◆ zakero::Yetani::Key

struct zakero::Yetani::Key

Time is based on the "steady clock" and not system time.

Class Members
uint32_t code The key code of the event.
KeyState state The state of the key.
uint32_t time When the key event happened.

◆ zakero::Yetani::KeyModifier

struct zakero::Yetani::KeyModifier

The meaning of the modifiers are:

  • pressed
    This is the easiest to understand type of modifier. A modifier such as "Control" is pressed.
  • locked
    The best example of a "locked" modifier is the "Caps Lock" key.
  • latched
    This modifer can occur with "Sticky Keys".
Class Members
uint32_t group The keyboard layout.
uint32_t latched A collection of latched modifiers.
uint32_t locked A collection of locked modifiers.
uint32_t pressed A collection of pressed modifiers.

◆ zakero::Yetani::Output

struct zakero::Yetani::Output

All the Wayland information about an output device in a single structure.

Class Members
uint32_t flags wl_output_mode bitfield properties.
int32_t height The height of the device in hardware units.
string make Description of the manufacturer.
string model Description of the model.
uint32_t physical_height_mm The height of the device in millimeters.
uint32_t physical_width_mm The width of the device in millimeters.
float pixels_per_mm_horizontal A pre-calculated value.
float pixels_per_mm_vertical A pre-calculated value.
int32_t refresh_mHz The current refresh rate of the device.
int32_t scale_factor The scaling factor between the device and compositor.
int32_t subpixel The device's subpixel orientation.
int32_t transform Transform that maps framebuffer to output.
int32_t width The width of the device in hardware units.
int32_t x The X position within the global compositor.
int32_t y The Y position within the global compositor.

◆ zakero::Yetani::PointerAxis

struct zakero::Yetani::PointerAxis
Class Members
float distance The distance traveled.
PointerAxisSource source The source of the event.
int32_t steps The number of rotation steps.
uint32_t time When the event occurred.
PointerAxisType type The type of Axis.

◆ zakero::Yetani::PointerButton

struct zakero::Yetani::PointerButton
Class Members
uint32_t code The event code.
PointerButtonState state The button state.

Member Enumeration Documentation

◆ KeyState

When using a keyboard, a key will emit one of these states.

◆ WindowMode

All the available window modes.

Constructor & Destructor Documentation

◆ ~Yetani()

zakero::Yetani::~Yetani ( )
virtualnoexcept

Deleting the Yetani object will automatically disconnect from the Wayland server.

Because Yetani is multithreaded, this method will block until all connections to Wayland have been closed.

Member Function Documentation

◆ connect() [1/4]

Yetani * zakero::Yetani::connect ( )
staticnoexcept

Establish a connection with the Wayland Compositor. The following values will be used to determine which Wayland Compositor to connect to:

  1. WAYLAND_DISPLAY
    Use the value of this environment variable.
  2. "wayland-0"
    This is the default display name used by Wayland.

If a connection was successful, then a pointer to a new Yetani instance will be returned. This pointer will need to be deleted by the caller. If there was an error connecting to the Wayland Compositor, nullptr will be returned.

Note
A connection to the Wayland Compositor must be made before any windows are created.
Returns
A pointer to a Yetani instance or a nullptr.

◆ connect() [2/4]

Yetani * zakero::Yetani::connect ( const std::string &  display)
staticnoexcept

Establish a connection with the Wayland Compositor. The following values will be used to determine which Wayland Compositor to connect to:

  1. display
    If the value in not empty, this display name will be used.
  2. WAYLAND_DISPLAY
    Use the value of this environment variable.
  3. "wayland-0"
    This is the default display name used by Wayland.

If a connection was successful, then a pointer to a new Yetani instance will be returned. This pointer will need to be deleted by the caller. If there was an error connecting to the Wayland Compositor, nullptr will be returned.

Note
A connection to the Wayland Compositor must be made before any windows are created.
Returns
A pointer to a Yetani instance or a nullptr.
Parameters
displayThe Display Name or ID

◆ connect() [3/4]

Yetani * zakero::Yetani::connect ( const std::string &  display,
std::error_code &  error 
)
staticnoexcept

Establish a connection with the Wayland Compositor. The following values will be used to determine which Wayland Compositor to connect to:

  1. display
    If the value in not empty, this display name will be used.
  2. WAYLAND_DISPLAY
    Use the value of this environment variable.
  3. "wayland-0"
    This is the default display name used by Wayland.

If a connection was successful, then a pointer to a new Yetani instance will be returned. This pointer will need to be deleted by the caller. If there was an error connecting to the Wayland Compositor, nullptr will be returned.

The provided error will be set to Yetani::Error_None or the reason for the connection failure. An error code of Yetani::Error_Connection_Failed or Yetani::Error_Invalid_Display_Name may indicate that there is no Wayland Compositor available.

Note
A connection to the Wayland Compositor must be made before any windows are created.
Returns
A pointer to a Yetani instance or a nullptr.
Parameters
displayThe Display Name or ID
errorThe error status

◆ connect() [4/4]

Yetani * zakero::Yetani::connect ( std::error_code &  error)
staticnoexcept

Establish a connection with the Wayland Compositor. The following values will be used to determine which Wayland Compositor to connect to:

  1. WAYLAND_DISPLAY
    Use the value of this environment variable.
  2. "wayland-0"
    This is the default display name used by Wayland.

If a connection was successful, then a pointer to a new Yetani instance will be returned. This pointer will need to be deleted by the caller. If there was an error connecting to the Wayland Compositor, nullptr will be returned.

The provided error will be set to Yetani::Error_None or the reason for the connection failure. An error code of Yetani::Error_Connection_Failed or Yetani::Error_Invalid_Display_Name may indicate that there is no Wayland Compositor available.

Note
A connection to the Wayland Compositor must be made before any windows are created.
Returns
A pointer to a Yetani instance or a nullptr.
Parameters
errorThe error code

◆ cursorCreate()

std::error_code zakero::Yetani::cursorCreate ( const std::string &  name,
const Yetani::CursorConfig config 
)
noexcept

A cursor with the given name will be created. The config data will be used to determine how the cursor will be configured.

Cursor Configuration

The CursorConfig::image_data holds the graphic image data for each frame of the cursor. If the cursor is not animated, then only one frame needs to be provided.

Each frame of the cursor (including non-animated cursors, i.e.: a single frame) must have the dimension specified by CursorConfig::size. And the data in each frame must conform to the value of CursorConfig::format. The required amount of data for each frame is: size_in_bytes = size.width * size.height * shmFormatBytesPerPixel(format)

If more than one frame is provided in CursorConfig::image_data, then the amount of time to display each frame must be placed in CursorConfig::time_per_frame.

Once the last frame of the cursor has been displayed, the first frame will be displayed next creating a continuous looping animation.

Every cursor needs to have a spot that is used to determine where the pointer is located called a hotspot. The location of the hotspot is relative to the top-left corner (0x0) and should be assigned to CursorConfig::hotspot_x and CursorConfig::hotspot_y.

If the configuration was valid and the cursor was successfully created, then Yetani::Error_None will be returned. Otherwise, another error will be returned to indicate the encountered problem.

Returns
An error code.
Parameters
nameThe name of the cursor
configThe cursor configuration

◆ cursorDestroy()

std::error_code zakero::Yetani::cursorDestroy ( const std::string &  name)
noexcept

The cursor with the specified name will be destroyed. If any windows are using the cursor, they will report an error.

Returns
An error code.
Parameters
nameThe name of the cursor

◆ keyRepeatDelay()

int32_t zakero::Yetani::keyRepeatDelay ( ) const
noexcept

The key repeat delay is the amount of time in milliseconds that must elapse from a key press event to change into a key repeat event.

Returns
The key repeat delay.

◆ keyRepeatRate()

int32_t zakero::Yetani::keyRepeatRate ( ) const
noexcept

The key repeat rate is the number of key repeat events that will be emitted per second.

Returns
The key repeat rate.

◆ output()

Yetani::Output zakero::Yetani::output ( const Yetani::OutputId  output_id) const
noexcept

All the available information about an output device will be provided. It is possible that an output device is removed after the data has been retrieved, so consider the provided data as a "snapshot in time".

If the provided output_id is not valid, then the returned data will be empty.

Returns
The Output data.
Parameters
output_idThe Output Id

◆ outputConvertToMm() [1/2]

Yetani::PointMm zakero::Yetani::outputConvertToMm ( const Yetani::OutputId  output_id,
const Yetani::PointPixel point 
) const
noexcept

Convert a pixel-based point location to millimeters using the provided output_id.

Returns
A point that uses millimeters.
Parameters
output_idThe output device for the conversion
pointThe point to convert

◆ outputConvertToMm() [2/2]

Yetani::SizeMm zakero::Yetani::outputConvertToMm ( const Yetani::OutputId  output_id,
const Yetani::SizePixel size 
) const
noexcept

Convert a pixel-based size to millimeters using the provided output_id.

Returns
A size that uses millimeters.
Parameters
output_idThe output device for the conversion
sizeThe size to convert

◆ outputConvertToPercent() [1/2]

Yetani::PointPercent zakero::Yetani::outputConvertToPercent ( const Yetani::OutputId  output_id,
const Yetani::PointPixel point 
) const
noexcept

Convert a pixel-based point location to a percentage using the provided output_id.

Returns
A point that uses a percentage.
Parameters
output_idThe output device for the conversion
pointThe point to convert

◆ outputConvertToPercent() [2/2]

Yetani::SizePercent zakero::Yetani::outputConvertToPercent ( const Yetani::OutputId  output_id,
const Yetani::SizePixel size 
) const
noexcept

Convert a pixel-based size to a percentage using the provided output_id.

Returns
A size that uses a percentage.
Parameters
output_idThe output device for the conversion
sizeThe size to convert

◆ outputConvertToPixel() [1/4]

Yetani::PointPixel zakero::Yetani::outputConvertToPixel ( const Yetani::OutputId  output_id,
const Yetani::PointMm point 
) const
noexcept

Convert a millimeter-based point location to pixel using the provided output_id.

Returns
A point that uses pixels.
Parameters
output_idThe output device for the conversion
pointThe point to convert

◆ outputConvertToPixel() [2/4]

Yetani::PointPixel zakero::Yetani::outputConvertToPixel ( const Yetani::OutputId  output_id,
const Yetani::PointPercent point 
) const
noexcept

Convert a percentage-based point location to pixel using the provided output_id.

Returns
A point that uses pixels.
Parameters
output_idThe output device for the conversion
pointThe point to convert

◆ outputConvertToPixel() [3/4]

Yetani::SizePixel zakero::Yetani::outputConvertToPixel ( const Yetani::OutputId  output_id,
const Yetani::SizeMm size 
) const
noexcept

Convert a millimeter-based size to pixel using the provided output_id.

Returns
A size that uses pixels.
Parameters
output_idThe output device for the conversion
sizeThe size to convert

◆ outputConvertToPixel() [4/4]

Yetani::SizePixel zakero::Yetani::outputConvertToPixel ( const Yetani::OutputId  output_id,
const Yetani::SizePercent size 
) const
noexcept

Convert a percentage-based size to pixel using the provided output_id.

Returns
A size that uses pixels.
Parameters
output_idThe output device for the conversion
sizeThe size to convert

◆ outputOnAdd()

void zakero::Yetani::outputOnAdd ( Yetani::LambdaOutputId  lambda)
noexcept

When a Wayland output device has been added, the lambda that was provided to this method will be called. To disable these notifications, pass nullptr as the value of lambda.

Parameters
lambdaThe lambda to call

◆ outputOnChange()

void zakero::Yetani::outputOnChange ( Yetani::LambdaOutputId  lambda)
noexcept

When a Wayland output device's configuration has been changed, the lambda that was provided to this method will be called. To disable these notifications, pass nullptr as the value of lambda.

Parameters
lambdaThe lambda to call

◆ outputOnRemove()

void zakero::Yetani::outputOnRemove ( Yetani::LambdaOutputId  lambda)
noexcept

When a Wayland output device has been removed, the lambda that was provided to this method will be called. To disable these notifications, pass nullptr as the value of lambda.

Parameters
lambdaThe lambda to call

◆ outputSubpixelName()

std::string zakero::Yetani::outputSubpixelName ( int32_t  subpixel_format)
staticnoexcept

The Yetani::Output::subpixel is a Wayland enum value and this method will convert that value into a descriptive name string. If an invalid value is passed, then an empty string will be returned.

Returns
The name of the subpixel format.
Parameters
subpixel_formatThe Subpixel format

◆ outputTransformName()

std::string zakero::Yetani::outputTransformName ( int32_t  transform)
staticnoexcept

The Yetani::Output::transform is a Wayland enum value and this method will convert that value into a descriptive name string. If an invalid value is passed, then an empty string will be returned.

Returns
The name of the transform.
Parameters
transformThe transform value

◆ outputVector()

Yetani::VectorOutputId zakero::Yetani::outputVector ( ) const
noexcept

All the Output IDs will be returned. It is possible that an output device is removed after the data has been retrieved, so consider the provided data as a "snapshot in time".

Returns
The Output Id's.

◆ shmFormatAvailable()

const Yetani::VectorShmFormat & zakero::Yetani::shmFormatAvailable ( ) const
noexcept

All of the supported wl_shm_format values, color formats, are provided in the returned container.

Returns
The supported formats.

◆ shmFormatBytesPerPixel()

uint8_t zakero::Yetani::shmFormatBytesPerPixel ( const wl_shm_format  shm_format)
staticnoexcept

When allocating buffers in Wayland, the number of bytes required per pixel is important so that the correct amount of memory is known. This method will determine the bytes-per-pixel based on the provided shm_format.

Returns
The number of bytes-per-pixel
Parameters
shm_formatThe format

◆ shmFormatDescription()

std::string zakero::Yetani::shmFormatDescription ( const wl_shm_format  shm_format)
staticnoexcept

In the documented code of Wayland, there are descriptions for each of the supported color formats. By providing the shm_format, the description of the format will be returned.

Returns
A description
Parameters
shm_formatThe format

◆ shmFormatName()

std::string zakero::Yetani::shmFormatName ( const wl_shm_format  shm_format)
staticnoexcept

Converts the enum name of the shm_format to a string.

Returns
The name
Parameters
shm_formatThe format

◆ windowCreate() [1/9]

Yetani::Window * zakero::Yetani::windowCreate ( const Yetani::SizeMm size,
const wl_shm_format  format,
std::error_code &  error 
)
noexcept

Create a new Window of the specified size. A pointer to the Window will be returned. If there was a problem, a nullptr will returned.

The shared memory used by the Window will use the pixel format.

The error parameter will be set to Yetani::Error_None on success or to an appropriate error if there was a problem.

Note
The size of a window must be greater than 0.
Returns
A pointer to the new Window or nullptr on error.
Parameters
sizeThe window size
formatThe pixel format
errorThe error state

◆ windowCreate() [2/9]

Yetani::Window * zakero::Yetani::windowCreate ( const Yetani::SizeMm size,
const wl_shm_format  format = SHM_FORMAT_DEFAULT 
)
noexcept

Create a new Window of the specified size. A pointer to the Window will be returned. If there was a problem, a nullptr will returned.

The shared memory used by the Window will use the pixel format.

Note
The size of a window must be greater than 0.
Returns
A pointer to the new Window or nullptr on error.
Parameters
sizeThe window size
formatThe pixel format

◆ windowCreate() [3/9]

Yetani::Window * zakero::Yetani::windowCreate ( const Yetani::SizeMm size,
std::error_code &  error 
)
noexcept

Create a new Window of the specified size. A pointer to the Window will be returned. If there was a problem, a nullptr will returned.

The error parameter will be set to Yetani::Error_None on success or to an appropriate error if there was a problem.

Note
The size of a window must be greater than 0.
Returns
A pointer to the new Window or nullptr on error.
Parameters
sizeThe window size
errorThe error state

◆ windowCreate() [4/9]

Yetani::Window * zakero::Yetani::windowCreate ( const Yetani::SizePercent size,
const wl_shm_format  format,
std::error_code &  error 
)
noexcept

Create a new Window of the specified size. A pointer to the Window will be returned. If there was a problem, a nullptr will returned.

The shared memory used by the Window will use the pixel format.

The error parameter will be set to Yetani::Error_None on success or to an appropriate error if there was a problem.

Note
The size of a window must be greater than 0.
Returns
A pointer to the new Window or nullptr on error.
Parameters
sizeThe window size
formatThe pixel format
errorThe error state

◆ windowCreate() [5/9]

Yetani::Window * zakero::Yetani::windowCreate ( const Yetani::SizePercent size,
const wl_shm_format  format = SHM_FORMAT_DEFAULT 
)
noexcept

Create a new Window of the specified size. A pointer to the Window will be returned. If there was a problem, a nullptr will returned.

The shared memory used by the Window will use the pixel format.

Note
The size of a window must be greater than 0.
Returns
A pointer to the new Window or nullptr on error.
Parameters
sizeThe window size
formatThe pixel format

◆ windowCreate() [6/9]

Yetani::Window * zakero::Yetani::windowCreate ( const Yetani::SizePercent size,
std::error_code &  error 
)
noexcept

Create a new Window of the specified size. A pointer to the Window will be returned. If there was a problem, a nullptr will returned.

The error parameter will be set to Yetani::Error_None on success or to an appropriate error if there was a problem.

Note
The size of a window must be greater than 0.
Returns
A pointer to the new Window or nullptr on error.
Parameters
sizeThe window size
errorThe error state

◆ windowCreate() [7/9]

Yetani::Window * zakero::Yetani::windowCreate ( const Yetani::SizePixel size,
const wl_shm_format  format,
std::error_code &  error 
)
noexcept

Create a new Window of the specified size. A pointer to the Window will be returned. If there was a problem, a nullptr will returned.

The shared memory used by the Window will use the pixel format.

The error parameter will be set to Yetani::Error_None on success or to an appropriate error if there was a problem.

Note
The size of a window must be greater than 0.
Returns
A pointer to the new Window or nullptr on error.
Parameters
sizeThe window size
formatThe pixel format
errorThe error state

◆ windowCreate() [8/9]

Yetani::Window * zakero::Yetani::windowCreate ( const Yetani::SizePixel size,
const wl_shm_format  format = SHM_FORMAT_DEFAULT 
)
noexcept

Create a new Window of the specified size. A pointer to the Window will be returned. If there was a problem, a nullptr will returned.

The shared memory used by the Window will use the pixel format.

Note
The size of a window must be greater than 0.
Returns
A pointer to the new Window or nullptr on error.
Parameters
sizeThe window size
formatThe pixel format

◆ windowCreate() [9/9]

Yetani::Window * zakero::Yetani::windowCreate ( const Yetani::SizePixel size,
std::error_code &  error 
)
noexcept

Create a new Window of the specified size. A pointer to the Window will be returned. If there was a problem, a nullptr will returned.

The error parameter will be set to Yetani::Error_None on success or to an appropriate error if there was a problem.

Note
The size of a window must be greater than 0.
Returns
A pointer to the new Window or nullptr on error.
Parameters
sizeThe window size
errorThe error state

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