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

226  {
227  /**
228  * pointer constraint already requested on that surface
229  */
231 };

◆ zwp_pointer_constraints_v1_lifetime

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.

Enumerator
ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ONESHOT 
ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT 

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

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 
)
static

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

References NULL, zwp_confined_pointer_v1_interface, and ZWP_POINTER_CONSTRAINTS_V1_CONFINE_POINTER.

376 {
377  struct wl_proxy *id;
378 
379  id = wl_proxy_marshal_constructor((struct wl_proxy *) zwp_pointer_constraints_v1,
381 
382  return (struct zwp_confined_pointer_v1 *) id;
383 }
GLuint id
const struct wl_interface zwp_confined_pointer_v1_interface
EGLSurface surface
Definition: eglext.h:248
GLsizei const void * pointer
#define NULL
Definition: begin_code.h:164

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

References ZWP_POINTER_CONSTRAINTS_V1_DESTROY.

297 {
298  wl_proxy_marshal((struct wl_proxy *) zwp_pointer_constraints_v1,
300 
301  wl_proxy_destroy((struct wl_proxy *) zwp_pointer_constraints_v1);
302 }

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

279 {
280  return wl_proxy_get_user_data((struct wl_proxy *) zwp_pointer_constraints_v1);
281 }

◆ 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 
)
static

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

References NULL, zwp_locked_pointer_v1_interface, and ZWP_POINTER_CONSTRAINTS_V1_LOCK_POINTER.

344 {
345  struct wl_proxy *id;
346 
347  id = wl_proxy_marshal_constructor((struct wl_proxy *) zwp_pointer_constraints_v1,
349 
350  return (struct zwp_locked_pointer_v1 *) id;
351 }
GLuint id
EGLSurface surface
Definition: eglext.h:248
const struct wl_interface zwp_locked_pointer_v1_interface
GLsizei const void * pointer
#define NULL
Definition: begin_code.h:164

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

272 {
273  wl_proxy_set_user_data((struct wl_proxy *) zwp_pointer_constraints_v1, user_data);
274 }