---
name: "wayland_server_pointer_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_pointer_t"
---

# wayland\_server\_pointer\_t(3)

pointer input device

## NAME

wayland::server::pointer\_t - pointer input device

## SYNOPSIS

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

Inherits wayland::server::resource\_t.

### Public Member Functions

std::function\< void(uint32\_t, **surface\_t**, int32\_t, int32\_t)\> & **on\_set\_cursor** ()\
 set the pointer surface  std::function\< void()\> & **on\_release** ()\
 release the pointer object  void **enter** (uint32\_t serial, **surface\_t** const &surface, double surface\_x, double surface\_y, bool post=true)\
 enter event  void **leave** (uint32\_t serial, **surface\_t** const &surface, bool post=true)\
 leave event  void **motion** (uint32\_t time, double surface\_x, double surface\_y, bool post=true)\
 pointer motion event  void **button** (uint32\_t serial, uint32\_t time, uint32\_t button, pointer\_button\_state const &state, bool post=true)\
 pointer button event  void **axis** (uint32\_t time, pointer\_axis const &axis, double value, bool post=true)\
 axis event  void **frame** (bool post=true)\
 end of a pointer event sequence  bool **can\_frame** () const\
 Check whether the **frame** function is available with the currently bound version of the protocol.  void **axis\_source** (pointer\_axis\_source const &axis\_source, bool post=true)\
 axis source event  bool **can\_axis\_source** () const\
 Check whether the **axis\_source** function is available with the currently bound version of the protocol.  void **axis\_stop** (uint32\_t time, pointer\_axis const &**axis**, bool post=true)\
 axis stop event  bool **can\_axis\_stop** () const\
 Check whether the **axis\_stop** function is available with the currently bound version of the protocol.  void **axis\_discrete** (pointer\_axis const &**axis**, int32\_t discrete, bool post=true)\
 axis click event  bool **can\_axis\_discrete** () const\
 Check whether the **axis\_discrete** function is available with the currently bound version of the protocol.  void **axis\_value120** (pointer\_axis const &**axis**, int32\_t value120, bool post=true)\
 axis high-resolution scroll event  bool **can\_axis\_value120** () const\
 Check whether the **axis\_value120** function is available with the currently bound version of the protocol.  void **post\_role** (std::string const &msg)\
 Post error: given wl\_surface has another role.  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 **enter\_since\_version** = 1\
 Minimum protocol version required for the **enter** function.  static constexpr std::uint32\_t **leave\_since\_version** = 1\
 Minimum protocol version required for the **leave** function.  static constexpr std::uint32\_t **motion\_since\_version** = 1\
 Minimum protocol version required for the **motion** function.  static constexpr std::uint32\_t **button\_since\_version** = 1\
 Minimum protocol version required for the **button** function.  static constexpr std::uint32\_t **axis\_since\_version** = 1\
 Minimum protocol version required for the **axis** function.  static constexpr std::uint32\_t **frame\_since\_version** = 5\
 Minimum protocol version required for the **frame** function.  static constexpr std::uint32\_t **axis\_source\_since\_version** = 5\
 Minimum protocol version required for the **axis\_source** function.  static constexpr std::uint32\_t **axis\_stop\_since\_version** = 5\
 Minimum protocol version required for the **axis\_stop** function.  static constexpr std::uint32\_t **axis\_discrete\_since\_version** = 5\
 Minimum protocol version required for the **axis\_discrete** function.  static constexpr std::uint32\_t **axis\_value120\_since\_version** = 8\
 Minimum protocol version required for the **axis\_value120** function.

## Detailed Description

pointer input device

The wl\_pointer interface represents one or more input devices, such as mice, which control the pointer location and pointer\_focus of a seat.

The wl\_pointer interface generates motion, enter and leave events for the surfaces that the pointer is located over, and button and axis events for button presses, button releases and scrolling.

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

## Member Function Documentation

### void pointer\_t::axis (uint32\_t time, pointer\_axis const & axis, double value, bool post = `true`)

axis event

**Parameters**

*time* timestamp with millisecond granularity \
 *axis* axis type \
 *value* length of vector in surface-local coordinate space

Scroll and other axis notifications.

For scroll events (vertical and horizontal scroll axes), the value parameter is the length of a vector along the specified axis in a coordinate space identical to those of motion events, representing a relative movement along the specified axis.

For devices that support movements non-parallel to axes multiple axis events will be emitted.

When applicable, for example for touch pads, the server can choose to emit scroll events where the motion vector is equivalent to a motion event vector.

When applicable, a client can transform its content relative to the scroll distance.

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

### void pointer\_t::axis\_discrete (pointer\_axis const & axis, int32\_t discrete, bool post = `true`)

axis click event

**Parameters**

*axis* axis type \
 *discrete* number of steps

Discrete step information for scroll and other axes.

This event carries the axis value of the wl\_pointer.axis event in discrete steps (e.g. mouse wheel clicks).

This event is deprecated with wl\_pointer version 8 - this event is not sent to clients supporting version 8 or later.

This event does not occur on its own, it is coupled with a wl\_pointer.axis event that represents this axis value on a continuous scale. The protocol guarantees that each axis\_discrete event is always followed by exactly one axis event with the same axis number within the same wl\_pointer.frame. Note that the protocol allows for other events to occur between the axis\_discrete and its coupled axis event, including other axis\_discrete or axis events.

This event is optional; continuous scrolling devices like two-finger scrolling on touchpads do not have discrete steps and do not generate this event.

The discrete value carries the directional information. e.g. a value of -2 is two steps towards the negative direction of this axis.

The axis number is identical to the axis number in the associated axis event.

The order of wl\_pointer.axis\_discrete and wl\_pointer.axis\_source is not guaranteed.

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

### void pointer\_t::axis\_source (pointer\_axis\_source const & axis\_source, bool post = `true`)

axis source event

**Parameters**

*axis\_source* source of the axis event

Source information for scroll and other axes.

This event does not occur on its own. It is sent before a wl\_pointer.frame event and carries the source information for all events within that frame.

The source specifies how this event was generated. If the source is wl\_pointer.axis\_source.finger, a wl\_pointer.axis\_stop event will be sent when the user lifts the finger off the device.

If the source is wl\_pointer.axis\_source.wheel, wl\_pointer.axis\_source.wheel\_tilt or wl\_pointer.axis\_source.continuous, a wl\_pointer.axis\_stop event may or may not be sent. Whether a compositor sends an axis\_stop event for these sources is hardware-specific and implementation-dependent; clients must not rely on receiving an axis\_stop event for these scroll sources and should treat scroll sequences from these scroll sources as unterminated by default.

This event is optional. If the source is unknown for a particular axis event sequence, no event is sent. Only one wl\_pointer.axis\_source event is permitted per frame.

The order of wl\_pointer.axis\_discrete and wl\_pointer.axis\_source is not guaranteed.

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

### void pointer\_t::axis\_stop (uint32\_t time, pointer\_axis const & axis, bool post = `true`)

axis stop event

**Parameters**

*time* timestamp with millisecond granularity \
 *axis* the axis stopped with this event

Stop notification for scroll and other axes.

For some wl\_pointer.axis\_source types, a wl\_pointer.axis\_stop event is sent to notify a client that the axis sequence has terminated. This enables the client to implement kinetic scrolling. See the wl\_pointer.axis\_source documentation for information on when this event may be generated.

Any wl\_pointer.axis events with the same axis\_source after this event should be considered as the start of a new axis motion.

The timestamp is to be interpreted identical to the timestamp in the wl\_pointer.axis event. The timestamp value may be the same as a preceding wl\_pointer.axis event.

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

### void pointer\_t::axis\_value120 (pointer\_axis const & axis, int32\_t value120, bool post = `true`)

axis high-resolution scroll event

**Parameters**

*axis* axis type \
 *value120* scroll distance as fraction of 120

Discrete high-resolution scroll information.

This event carries high-resolution wheel scroll information, with each multiple of 120 representing one logical scroll step (a wheel detent). For example, an axis\_value120 of 30 is one quarter of a logical scroll step in the positive direction, a value120 of -240 are two logical scroll steps in the negative direction within the same hardware event. Clients that rely on discrete scrolling should accumulate the value120 to multiples of 120 before processing the event.

The value120 must not be zero.

This event replaces the wl\_pointer.axis\_discrete event in clients supporting wl\_pointer version 8 or later.

Where a wl\_pointer.axis\_source event occurs in the same wl\_pointer.frame, the axis source applies to this event.

The order of wl\_pointer.axis\_value120 and wl\_pointer.axis\_source is not guaranteed.

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

### void pointer\_t::button (uint32\_t serial, uint32\_t time, uint32\_t button, pointer\_button\_state const & state, bool post = `true`)

pointer button event

**Parameters**

*serial* serial number of the button event \
 *time* timestamp with millisecond granularity \
 *button* button that produced the event \
 *state* physical state of the button

Mouse button click and release notifications.

The location of the click is given by the last motion or enter event. The time argument is a timestamp with millisecond granularity, with an undefined base.

The button is a button code as defined in the Linux kernel's linux/input-event-codes.h header file, e.g. BTN\_LEFT.

Any 16-bit button code value is reserved for future additions to the kernel's event code list. All other button codes above 0xFFFF are currently undefined but may be used in future versions of this protocol.

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

### bool pointer\_t::can\_axis\_discrete () const

Check whether the **axis\_discrete** function is available with the currently bound version of the protocol.

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

### bool pointer\_t::can\_axis\_source () const

Check whether the **axis\_source** function is available with the currently bound version of the protocol.

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

### bool pointer\_t::can\_axis\_stop () const

Check whether the **axis\_stop** function is available with the currently bound version of the protocol.

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

### bool pointer\_t::can\_axis\_value120 () const

Check whether the **axis\_value120** function is available with the currently bound version of the protocol.

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

### bool pointer\_t::can\_frame () const

Check whether the **frame** function is available with the currently bound version of the protocol.

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

### void pointer\_t::enter (uint32\_t serial, surface\_t const & surface, double surface\_x, double surface\_y, bool post = `true`)

enter event

**Parameters**

*serial* serial number of the enter event \
 *surface* surface entered by the pointer \
 *surface\_x* surface-local x coordinate \
 *surface\_y* surface-local y coordinate

Notification that this seat's pointer is focused on a certain surface.

When a seat's focus enters a surface, the pointer image is undefined and a client should respond to this event by setting an appropriate pointer image with the set\_cursor request.

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

### void pointer\_t::frame (bool post = `true`)

end of a pointer event sequence Indicates the end of a set of events that logically belong together. A client is expected to accumulate the data in all events within the frame before proceeding.

All wl\_pointer events before a wl\_pointer.frame event belong logically together. For example, in a diagonal scroll motion the compositor will send an optional wl\_pointer.axis\_source event, two wl\_pointer.axis events (horizontal and vertical) and finally a wl\_pointer.frame event. The client may use this information to calculate a diagonal vector for scrolling.

When multiple wl\_pointer.axis events occur within the same frame, the motion vector is the combined motion of all events. When a wl\_pointer.axis and a wl\_pointer.axis\_stop event occur within the same frame, this indicates that axis movement in one axis has stopped but continues in the other axis. When multiple wl\_pointer.axis\_stop events occur within the same frame, this indicates that these axes stopped in the same instance.

A wl\_pointer.frame event is sent for every logical event group, even if the group only contains a single wl\_pointer event. Specifically, a client may get a sequence: motion, frame, button, frame, axis, frame, axis\_stop, frame.

The wl\_pointer.enter and wl\_pointer.leave events are logical events generated by the compositor and not the hardware. These events are also grouped by a wl\_pointer.frame. When a pointer moves from one surface to another, a compositor should group the wl\_pointer.leave event within the same wl\_pointer.frame. However, a client must not rely on wl\_pointer.leave and wl\_pointer.enter being in the same wl\_pointer.frame. Compositor-specific policies may require the wl\_pointer.leave and wl\_pointer.enter event being split across multiple wl\_pointer.frame groups.

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

### void pointer\_t::leave (uint32\_t serial, surface\_t const & surface, bool post = `true`)

leave event

**Parameters**

*serial* serial number of the leave event \
 *surface* surface left by the pointer

Notification that this seat's pointer is no longer focused on a certain surface.

The leave notification is sent before the enter notification for the new focus.

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

### void pointer\_t::motion (uint32\_t time, double surface\_x, double surface\_y, bool post = `true`)

pointer motion event

**Parameters**

*time* timestamp with millisecond granularity \
 *surface\_x* surface-local x coordinate \
 *surface\_y* surface-local y coordinate

Notification of pointer location change. The arguments surface\_x and surface\_y are the location relative to the focused surface.

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

### std::function\< void()\> & pointer\_t::on\_release ()

release the pointer object Using this request a client can tell the server that it is not going to use the pointer object anymore.

This request destroys the pointer proxy object, so clients must not call wl\_pointer\_destroy() after using this request.

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

### std::function\< void(uint32\_t, surface\_t, int32\_t, int32\_t)\> & pointer\_t::on\_set\_cursor ()

set the pointer surface

**Parameters**

*serial* serial number of the enter event \
 *surface* pointer surface \
 *hotspot\_x* surface-local x coordinate \
 *hotspot\_y* surface-local y coordinate

Set the pointer surface, i.e., the surface that contains the pointer image (cursor). This request gives the surface the role of a cursor. If the surface already has another role, it raises a protocol error.

The cursor actually changes only if the pointer focus for this device is one of the requesting client's surfaces or the surface parameter is the current pointer surface. If there was a previous surface set with this request it is replaced. If surface is NULL, the pointer image is hidden.

The parameters hotspot\_x and hotspot\_y define the position of the pointer surface relative to the pointer location. Its top-left corner is always at (x, y) - (hotspot\_x, hotspot\_y), where (x, y) are the coordinates of the pointer location, in surface-local coordinates.

On surface.attach requests to the pointer surface, hotspot\_x and hotspot\_y are decremented by the x and y parameters passed to the request. Attach must be confirmed by wl\_surface.commit as usual.

The hotspot can also be updated by passing the currently set pointer surface to this request with new values for hotspot\_x and hotspot\_y.

The current and pending input regions of the wl\_surface are cleared, and wl\_surface.set\_input\_region is ignored until the wl\_surface is no longer used as the cursor. When the use as a cursor ends, the current and pending input regions become undefined, and the wl\_surface is unmapped.

The serial parameter must match the latest wl\_pointer.enter serial number sent to the client. Otherwise the request will be ignored.

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

### void pointer\_t::post\_role (std::string const & msg)

Post error: given wl\_surface has another role.

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

### 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::pointer\_t::axis\_discrete\_since\_version = 5` [static]`, ` [constexpr]`

Minimum protocol version required for the **axis\_discrete** function.

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

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

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

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

### constexpr std::uint32\_t wayland::server::pointer\_t::axis\_source\_since\_version = 5` [static]`, ` [constexpr]`

Minimum protocol version required for the **axis\_source** function.

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

### constexpr std::uint32\_t wayland::server::pointer\_t::axis\_stop\_since\_version = 5` [static]`, ` [constexpr]`

Minimum protocol version required for the **axis\_stop** function.

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

### constexpr std::uint32\_t wayland::server::pointer\_t::axis\_value120\_since\_version = 8` [static]`, ` [constexpr]`

Minimum protocol version required for the **axis\_value120** function.

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

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

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

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

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

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

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

### constexpr std::uint32\_t wayland::server::pointer\_t::frame\_since\_version = 5` [static]`, ` [constexpr]`

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

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

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

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

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

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

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

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

## Author

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