---
name: "wayland_server_zwp_pointer_constraints_v1_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_zwp_pointer_constraints_v1_t"
---

# wayland\_server\_zwp\_pointer\_constraints\_v1\_t(3)

constrain the movement of a pointer

## NAME

wayland::server::zwp\_pointer\_constraints\_v1\_t - constrain the movement of a pointer

## SYNOPSIS

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

Inherits wayland::server::resource\_t.

### Public Member Functions

std::function\< void()\> & **on\_destroy** ()\
 destroy the pointer constraints manager object  std::function\< void(**zwp\_locked\_pointer\_v1\_t**, **surface\_t**, **pointer\_t**, **region\_t**, zwp\_pointer\_constraints\_v1\_lifetime)\> & **on\_lock\_pointer** ()\
 lock pointer to a position  std::function\< void(**zwp\_confined\_pointer\_v1\_t**, **surface\_t**, **pointer\_t**, **region\_t**, zwp\_pointer\_constraints\_v1\_lifetime)\> & **on\_confine\_pointer** ()\
 confine pointer to a region  void **post\_already\_constrained** (std::string const &msg)\
 Post error: pointer constraint already requested on that surface.  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** ()\

## Detailed Description

constrain the movement of a pointer

The global interface exposing pointer constraining functionality. It exposes two requests: lock\_pointer for locking the pointer to its position, and confine\_pointer for locking the pointer to a region.

The lock\_pointer and confine\_pointer requests create the objects wp\_locked\_pointer and wp\_confined\_pointer respectively, and the client can use these objects to interact with the lock.

For any surface, only one lock or confinement may be active across all wl\_pointer objects of the same seat. If a lock or confinement is requested when another lock or confinement is active or requested on the same surface and with any of the wl\_pointer objects of the same seat, an 'already\_constrained' error will be raised.

Definition at line **2710** of file **wayland-server-protocol-unstable.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(zwp\_confined\_pointer\_v1\_t, surface\_t, pointer\_t, region\_t, zwp\_pointer\_constraints\_v1\_lifetime)\> & zwp\_pointer\_constraints\_v1\_t::on\_confine\_pointer ()

confine pointer to a region

**Parameters**

*id* \
 *surface* surface to lock pointer to \
 *pointer* the pointer that should be confined \
 *region* region of surface \
 *lifetime* confinement lifetime

The confine\_pointer request lets the client request to confine the pointer cursor to a given region. This request may not take effect immediately; in the future, when the compositor deems implementation- specific constraints are satisfied, the pointer confinement will be activated and the compositor sends a confined event.

The intersection of the region passed with this request and the input region of the surface is used to determine where the pointer must be in order for the confinement to activate. It is up to the compositor whether to warp the pointer or require some kind of user interaction for the confinement to activate. If the region is null the surface input region is used.

The request will create a new object wp\_confined\_pointer which is used to interact with the confinement as well as receive updates about its state. See the the description of wp\_confined\_pointer for further information.

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

### std::function\< void()\> & zwp\_pointer\_constraints\_v1\_t::on\_destroy ()

destroy the pointer constraints manager object Used by the client to notify the server that it will no longer use this pointer constraints object.

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

### std::function\< void(zwp\_locked\_pointer\_v1\_t, surface\_t, pointer\_t, region\_t, zwp\_pointer\_constraints\_v1\_lifetime)\> & zwp\_pointer\_constraints\_v1\_t::on\_lock\_pointer ()

lock pointer to a position

**Parameters**

*id* \
 *surface* surface to lock pointer to \
 *pointer* the pointer that should be locked \
 *region* region of surface \
 *lifetime* lock lifetime

The lock\_pointer request lets the client request to disable movements of the virtual pointer (i.e. the cursor), effectively locking the pointer to a position. This request may not take effect immediately; in the future, when the compositor deems implementation-specific constraints are satisfied, the pointer lock will be activated and the compositor sends a locked event.

The protocol provides no guarantee that the constraints are ever satisfied, and does not require the compositor to send an error if the constraints cannot ever be satisfied. It is thus possible to request a lock that will never activate.

There may not be another pointer constraint of any kind requested or active on the surface for any of the wl\_pointer objects of the seat of the passed pointer when requesting a lock. If there is, an error will be raised. See general pointer lock documentation for more details.

The intersection of the region passed with this request and the input region of the surface is used to determine where the pointer must be in order for the lock to activate. It is up to the compositor whether to warp the pointer or require some kind of user interaction for the lock to activate. If the region is null the surface input region is used.

A surface may receive pointer focus without the lock being activated.

The request creates a new object wp\_locked\_pointer which is used to interact with the lock as well as receive updates about its state. See the the description of wp\_locked\_pointer for further information.

Note that while a pointer is locked, the wl\_pointer objects of the corresponding seat will not emit any wl\_pointer.motion events, but relative motion events will still be emitted via wp\_relative\_pointer objects of the same seat. wl\_pointer.axis and wl\_pointer.button events are unaffected.

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

### void zwp\_pointer\_constraints\_v1\_t::post\_already\_constrained (std::string const & msg)

Post error: pointer constraint already requested on that surface.

Definition at line **5388** of file **wayland-server-protocol-unstable.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

## Author

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