---
name: "wayland_server_buffer_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_buffer_t"
---

# wayland\_server\_buffer\_t(3)

content for a wl\_surface

## NAME

wayland::server::buffer\_t - content for a wl\_surface

## SYNOPSIS

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

Inherits wayland::server::resource\_t.

### Public Member Functions

std::function\< void()\> & **on\_destroy** ()\
 destroy a buffer  void **release** (bool post=true)\
 compositor releases buffer  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 **release\_since\_version** = 1\
 Minimum protocol version required for the **release** function.

## Detailed Description

content for a wl\_surface

A buffer provides the content for a wl\_surface. Buffers are created through factory interfaces such as wl\_shm, wp\_linux\_buffer\_params (from the linux-dmabuf protocol extension) or similar. It has a width and a height and can be attached to a wl\_surface, but the mechanism by which a client provides and updates the contents is defined by the buffer factory interface.

If the buffer uses a format that has an alpha channel, the alpha channel is assumed to be premultiplied in the color channels unless otherwise specified.

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

## Member Function Documentation

### 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()\> & buffer\_t::on\_destroy ()

destroy a buffer Destroy a buffer. If and how you need to release the backing storage is defined by the buffer factory interface.

For possible side-effects to a surface, see wl\_surface.attach.

Definition at line **1806** 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

### void buffer\_t::release (bool post = `true`)

compositor releases buffer Sent when this wl\_buffer is no longer used by the compositor. The client is now free to reuse or destroy this buffer and its backing storage.

If a client receives a release event before the frame callback requested in the same wl\_surface.commit that attaches this wl\_buffer to a surface, then the client is immediately free to reuse the buffer and its backing storage, and does not need a second buffer for the next surface content update. Typically this is possible, when the compositor maintains a copy of the wl\_surface contents, e.g. as a GL texture. This is an important optimization for GL(ES) compositors with wl\_shm clients.

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

## Member Data Documentation

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

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

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

## Author

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