SDL 2.0
The zwp_pointer_constraints_v1 interface

Macros

#define ZWP_POINTER_CONSTRAINTS_V1_DESTROY_SINCE_VERSION   1
 
#define ZWP_POINTER_CONSTRAINTS_V1_LOCK_POINTER_SINCE_VERSION   1
 
#define ZWP_POINTER_CONSTRAINTS_V1_CONFINE_POINTER_SINCE_VERSION   1
 

Enumerations

enum  zwp_pointer_constraints_v1_error { ZWP_POINTER_CONSTRAINTS_V1_ERROR_ALREADY_CONSTRAINED = 1 }
 
enum  zwp_pointer_constraints_v1_lifetime {
  ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ONESHOT = 1 ,
  ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT = 2
}
 

Functions

static void zwp_pointer_constraints_v1_set_user_data (struct zwp_pointer_constraints_v1 *zwp_pointer_constraints_v1, void *user_data)
 
static voidzwp_pointer_constraints_v1_get_user_data (struct zwp_pointer_constraints_v1 *zwp_pointer_constraints_v1)
 
static void zwp_pointer_constraints_v1_destroy (struct zwp_pointer_constraints_v1 *zwp_pointer_constraints_v1)
 
static struct zwp_locked_pointer_v1 * zwp_pointer_constraints_v1_lock_pointer (struct zwp_pointer_constraints_v1 *zwp_pointer_constraints_v1, struct wl_surface *surface, struct wl_pointer *pointer, struct wl_region *region, uint32_t lifetime)
 
static struct zwp_confined_pointer_v1 * zwp_pointer_constraints_v1_confine_pointer (struct zwp_pointer_constraints_v1 *zwp_pointer_constraints_v1, struct wl_surface *surface, struct wl_pointer *pointer, struct wl_region *region, uint32_t lifetime)
 

Detailed Description

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.

Macro Definition Documentation

◆ ZWP_POINTER_CONSTRAINTS_V1_CONFINE_POINTER_SINCE_VERSION

#define ZWP_POINTER_CONSTRAINTS_V1_CONFINE_POINTER_SINCE_VERSION   1

◆ ZWP_POINTER_CONSTRAINTS_V1_DESTROY_SINCE_VERSION

#define ZWP_POINTER_CONSTRAINTS_V1_DESTROY_SINCE_VERSION   1

◆ ZWP_POINTER_CONSTRAINTS_V1_LOCK_POINTER_SINCE_VERSION

#define ZWP_POINTER_CONSTRAINTS_V1_LOCK_POINTER_SINCE_VERSION   1

Enumeration Type Documentation

◆ zwp_pointer_constraints_v1_error

wp_pointer_constraints error values

These errors can be emitted in response to wp_pointer_constraints requests.

Enumerator
ZWP_POINTER_CONSTRAINTS_V1_ERROR_ALREADY_CONSTRAINED 

pointer constraint already requested on that surface

Definition at line 235 of file pointer-constraints-unstable-v1-client-protocol.h.

235 {
236 /**
237 * pointer constraint already requested on that surface
238 */
240};

◆ zwp_pointer_constraints_v1_lifetime

constraint lifetime

These values represent different lifetime semantics. They are passed as arguments to the factory requests to specify how the constraint lifetimes should be managed.

Enumerator
ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ONESHOT 

the pointer constraint is defunct once deactivated

A oneshot pointer constraint will never reactivate once it has been deactivated. See the corresponding deactivation event (wp_locked_pointer.unlocked and wp_confined_pointer.unconfined) for details.

ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT 

the pointer constraint may reactivate

A persistent pointer constraint may again reactivate once it has been deactivated. See the corresponding deactivation event (wp_locked_pointer.unlocked and wp_confined_pointer.unconfined) for details.

Definition at line 253 of file pointer-constraints-unstable-v1-client-protocol.h.

253 {
254 /**
255 * the pointer constraint is defunct once deactivated
256 *
257 * A oneshot pointer constraint will never reactivate once it has
258 * been deactivated. See the corresponding deactivation event
259 * (wp_locked_pointer.unlocked and wp_confined_pointer.unconfined)
260 * for details.
261 */
263 /**
264 * the pointer constraint may reactivate
265 *
266 * A persistent pointer constraint may again reactivate once it
267 * has been deactivated. See the corresponding deactivation event
268 * (wp_locked_pointer.unlocked and wp_confined_pointer.unconfined)
269 * for details.
270 */
272};

Function Documentation

◆ zwp_pointer_constraints_v1_confine_pointer()

static struct zwp_confined_pointer_v1 * zwp_pointer_constraints_v1_confine_pointer ( struct zwp_pointer_constraints_v1 *  zwp_pointer_constraints_v1,
struct wl_surface *  surface,
struct wl_pointer *  pointer,
struct wl_region *  region,
uint32_t  lifetime 
)
inlinestatic

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 397 of file pointer-constraints-unstable-v1-client-protocol.h.

398{
399 struct wl_proxy *id;
400
401 id = wl_proxy_marshal_flags((struct wl_proxy *) zwp_pointer_constraints_v1,
402 ZWP_POINTER_CONSTRAINTS_V1_CONFINE_POINTER, &zwp_confined_pointer_v1_interface, wl_proxy_get_version((struct wl_proxy *) zwp_pointer_constraints_v1), 0, NULL, surface, pointer, region, lifetime);
403
404 return (struct zwp_confined_pointer_v1 *) id;
405}
GLsizei const void * pointer
GLuint id
#define NULL
Definition: begin_code.h:167
EGLSurface surface
Definition: eglext.h:248
const struct wl_interface zwp_confined_pointer_v1_interface

References NULL, zwp_confined_pointer_v1_interface, and ZWP_POINTER_CONSTRAINTS_V1_CONFINE_POINTER.

◆ zwp_pointer_constraints_v1_destroy()

static void zwp_pointer_constraints_v1_destroy ( struct zwp_pointer_constraints_v1 *  zwp_pointer_constraints_v1)
inlinestatic

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

Definition at line 320 of file pointer-constraints-unstable-v1-client-protocol.h.

321{
322 wl_proxy_marshal_flags((struct wl_proxy *) zwp_pointer_constraints_v1,
323 ZWP_POINTER_CONSTRAINTS_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_pointer_constraints_v1), WL_MARSHAL_FLAG_DESTROY);
324}

References NULL, and ZWP_POINTER_CONSTRAINTS_V1_DESTROY.

◆ zwp_pointer_constraints_v1_get_user_data()

static void * zwp_pointer_constraints_v1_get_user_data ( struct zwp_pointer_constraints_v1 *  zwp_pointer_constraints_v1)
inlinestatic

Definition at line 302 of file pointer-constraints-unstable-v1-client-protocol.h.

303{
304 return wl_proxy_get_user_data((struct wl_proxy *) zwp_pointer_constraints_v1);
305}

◆ zwp_pointer_constraints_v1_lock_pointer()

static struct zwp_locked_pointer_v1 * zwp_pointer_constraints_v1_lock_pointer ( struct zwp_pointer_constraints_v1 *  zwp_pointer_constraints_v1,
struct wl_surface *  surface,
struct wl_pointer *  pointer,
struct wl_region *  region,
uint32_t  lifetime 
)
inlinestatic

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 365 of file pointer-constraints-unstable-v1-client-protocol.h.

366{
367 struct wl_proxy *id;
368
369 id = wl_proxy_marshal_flags((struct wl_proxy *) zwp_pointer_constraints_v1,
370 ZWP_POINTER_CONSTRAINTS_V1_LOCK_POINTER, &zwp_locked_pointer_v1_interface, wl_proxy_get_version((struct wl_proxy *) zwp_pointer_constraints_v1), 0, NULL, surface, pointer, region, lifetime);
371
372 return (struct zwp_locked_pointer_v1 *) id;
373}
const struct wl_interface zwp_locked_pointer_v1_interface

References NULL, zwp_locked_pointer_v1_interface, and ZWP_POINTER_CONSTRAINTS_V1_LOCK_POINTER.

◆ zwp_pointer_constraints_v1_set_user_data()

static void zwp_pointer_constraints_v1_set_user_data ( struct zwp_pointer_constraints_v1 *  zwp_pointer_constraints_v1,
void user_data 
)
inlinestatic

Definition at line 295 of file pointer-constraints-unstable-v1-client-protocol.h.

296{
297 wl_proxy_set_user_data((struct wl_proxy *) zwp_pointer_constraints_v1, user_data);
298}