---
name: "wayland_server_shm_t"
section: "3"
platform: "linux"
package: "waylandpp-dev"
version: "1.0.0-6+b2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/wayland_server_shm_t"
---

# wayland\_server\_shm\_t(3)

shared memory support

## NAME

wayland::server::shm\_t - shared memory support

## SYNOPSIS

`#include <wayland-server-protocol.hpp>`

Inherits wayland::server::resource\_t.

### Public Member Functions

std::function\< void(**shm\_pool\_t**, int, int32\_t)\> & **on\_create\_pool** ()\
 create a shm pool  void **format** (shm\_format const &format, bool post=true)\
 pixel format description  void **post\_invalid\_format** (std::string const &msg)\
 Post error: buffer format is not known.  void **post\_invalid\_stride** (std::string const &msg)\
 Post error: invalid size or stride during pool or buffer creation.  void **post\_invalid\_fd** (std::string const &msg)\
 Post error: mmapping the file descriptor failed.  bool **proxy\_has\_object** () const\
 Check whether this wrapper actually wraps an object.  void **post\_no\_memory** () const\
 uint32\_t **get\_id** () const\
 client\_t **get\_client** () const\
 unsigned int **get\_version** () const\
 std::string **get\_class** ()\

### Static Public Attributes

static constexpr std::uint32\_t **format\_since\_version** = 1\
 Minimum protocol version required for the **format** function.

## Detailed Description

shared memory support

A singleton global object that provides support for shared memory.

Clients can create wl\_shm\_pool objects using the create\_pool request.

On binding the wl\_shm object one or more format events are emitted to inform clients about the valid pixel formats that can be used for buffers.

Definition at line **424** of file **wayland-server-protocol.hpp**.

## Member Function Documentation

### void shm\_t::format (shm\_format const & format, bool post = `true`)

pixel format description

**Parameters**

*format* buffer pixel format

Informs the client about a valid pixel format that can be used for buffers. Known formats include argb8888 and xrgb8888.

Definition at line **1753** of file **wayland-server-protocol.cpp**.

### std::string wayland::server::resource\_t::get\_class ()` [inherited]`

Retrieve the interface name (class) of a resource object.

**Returns**

Interface name of the resource object.

### client\_t wayland::server::resource\_t::get\_client () const` [inherited]`

Get the associated client

**Returns**

the client that owns the resource.

### uint32\_t wayland::server::resource\_t::get\_id () const` [inherited]`

Get the internal ID of the resource

**Returns**

the internal ID of the resource

### unsigned int wayland::server::resource\_t::get\_version () const` [inherited]`

Get interface version

**Returns**

Interface version this resource has been constructed with.

### std::function\< void(shm\_pool\_t, int, int32\_t)\> & shm\_t::on\_create\_pool ()

create a shm pool

**Parameters**

*id* pool to create \
 *fd* file descriptor for the pool \
 *size* pool size, in bytes

Create a new wl\_shm\_pool object.

The pool can be used to create shared memory based buffer objects. The server will mmap size bytes of the passed file descriptor, to use as backing memory for the pool.

Definition at line **1747** of file **wayland-server-protocol.cpp**.

### void shm\_t::post\_invalid\_fd (std::string const & msg)

Post error: mmapping the file descriptor failed.

Definition at line **1768** of file **wayland-server-protocol.cpp**.

### void shm\_t::post\_invalid\_format (std::string const & msg)

Post error: buffer format is not known.

Definition at line **1758** of file **wayland-server-protocol.cpp**.

### void shm\_t::post\_invalid\_stride (std::string const & msg)

Post error: invalid size or stride during pool or buffer creation.

Definition at line **1763** of file **wayland-server-protocol.cpp**.

### void wayland::server::resource\_t::post\_no\_memory () const` [inherited]`

Post 'not enough memory' error to the client

If the compositor has not enough memory to fulfill a certail request of the client, this function can be called to notify the client of this circumstance.

### bool wayland::server::resource\_t::proxy\_has\_object () const` [inherited]`

Check whether this wrapper actually wraps an object.

**Returns**

true if there is an underlying object, false if this wrapper is empty

## Member Data Documentation

### constexpr std::uint32\_t wayland::server::shm\_t::format\_since\_version = 1` [static]`, ` [constexpr]`

Minimum protocol version required for the **format** function.

Definition at line **476** of file **wayland-server-protocol.hpp**.

## Author

Generated automatically by Doxygen for Wayland++ from the source code.
