2018-09-27 10:39:29 +00:00
|
|
|
/*
|
|
|
|
* This an unstable interface of wlroots. No guarantees are made regarding the
|
|
|
|
* future consistency of this API.
|
|
|
|
*/
|
|
|
|
#ifndef WLR_USE_UNSTABLE
|
|
|
|
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
|
|
|
|
#endif
|
|
|
|
|
2018-08-10 16:19:16 +00:00
|
|
|
#ifndef WLR_TYPES_WLR_POINTER_CONSTRAINTS_V1_H
|
|
|
|
#define WLR_TYPES_WLR_POINTER_CONSTRAINTS_V1_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
2019-07-27 08:53:54 +00:00
|
|
|
#include <wayland-server-core.h>
|
2018-08-10 16:19:16 +00:00
|
|
|
#include <pixman.h>
|
|
|
|
#include <wlr/types/wlr_seat.h>
|
|
|
|
#include "pointer-constraints-unstable-v1-protocol.h"
|
|
|
|
|
|
|
|
struct wlr_seat;
|
|
|
|
|
|
|
|
enum wlr_pointer_constraint_v1_type {
|
|
|
|
WLR_POINTER_CONSTRAINT_V1_LOCKED,
|
|
|
|
WLR_POINTER_CONSTRAINT_V1_CONFINED,
|
|
|
|
};
|
|
|
|
|
2018-09-26 21:08:52 +00:00
|
|
|
enum wlr_pointer_constraint_v1_state_field {
|
|
|
|
WLR_POINTER_CONSTRAINT_V1_STATE_REGION = 1 << 0,
|
|
|
|
WLR_POINTER_CONSTRAINT_V1_STATE_CURSOR_HINT = 1 << 1,
|
|
|
|
};
|
|
|
|
|
2018-08-10 16:19:16 +00:00
|
|
|
struct wlr_pointer_constraint_v1_state {
|
2018-09-26 21:08:52 +00:00
|
|
|
uint32_t committed; // enum wlr_pointer_constraint_v1_state_field
|
|
|
|
pixman_region32_t region;
|
2018-08-10 16:19:16 +00:00
|
|
|
|
|
|
|
// only valid for locked_pointer
|
|
|
|
struct {
|
|
|
|
double x, y;
|
|
|
|
} cursor_hint;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct wlr_pointer_constraint_v1 {
|
|
|
|
struct wlr_pointer_constraints_v1 *pointer_constraints;
|
|
|
|
|
|
|
|
struct wl_resource *resource;
|
|
|
|
struct wlr_surface *surface;
|
|
|
|
struct wlr_seat *seat;
|
|
|
|
enum zwp_pointer_constraints_v1_lifetime lifetime;
|
|
|
|
enum wlr_pointer_constraint_v1_type type;
|
|
|
|
pixman_region32_t region;
|
|
|
|
|
|
|
|
struct wlr_pointer_constraint_v1_state current, pending;
|
|
|
|
|
|
|
|
struct wl_listener surface_commit;
|
|
|
|
struct wl_listener surface_destroy;
|
|
|
|
struct wl_listener seat_destroy;
|
|
|
|
|
|
|
|
struct wl_list link; // wlr_pointer_constraints_v1::constraints
|
|
|
|
|
2018-09-27 08:25:59 +00:00
|
|
|
struct {
|
2020-05-12 20:34:32 +00:00
|
|
|
/**
|
|
|
|
* Called when a pointer constraint's region is updated,
|
|
|
|
* post-surface-commit.
|
|
|
|
*/
|
|
|
|
struct wl_signal set_region;
|
2018-09-27 08:25:59 +00:00
|
|
|
struct wl_signal destroy;
|
|
|
|
} events;
|
|
|
|
|
2018-08-10 16:19:16 +00:00
|
|
|
void *data;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct wlr_pointer_constraints_v1 {
|
2018-09-26 15:38:41 +00:00
|
|
|
struct wl_global *global;
|
2019-11-16 17:31:33 +00:00
|
|
|
struct wl_list constraints; // wlr_pointer_constraint_v1::link
|
2018-08-10 16:19:16 +00:00
|
|
|
|
|
|
|
struct {
|
|
|
|
/**
|
|
|
|
* Called when a new pointer constraint is created.
|
|
|
|
*
|
2018-09-27 08:25:59 +00:00
|
|
|
* data: struct wlr_pointer_constraint_v1 *
|
2018-08-10 16:19:16 +00:00
|
|
|
*/
|
2018-09-27 08:25:59 +00:00
|
|
|
struct wl_signal new_constraint;
|
2018-08-10 16:19:16 +00:00
|
|
|
} events;
|
|
|
|
|
2019-11-16 17:31:33 +00:00
|
|
|
struct wl_listener display_destroy;
|
2018-08-10 16:19:16 +00:00
|
|
|
|
|
|
|
void *data;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct wlr_pointer_constraints_v1 *wlr_pointer_constraints_v1_create(
|
|
|
|
struct wl_display *display);
|
|
|
|
|
2018-09-27 08:25:59 +00:00
|
|
|
struct wlr_pointer_constraint_v1 *
|
|
|
|
wlr_pointer_constraints_v1_constraint_for_surface(
|
|
|
|
struct wlr_pointer_constraints_v1 *pointer_constraints,
|
2018-08-10 16:19:16 +00:00
|
|
|
struct wlr_surface *surface, struct wlr_seat *seat);
|
|
|
|
|
|
|
|
void wlr_pointer_constraint_v1_send_activated(
|
|
|
|
struct wlr_pointer_constraint_v1 *constraint);
|
2018-09-27 08:53:11 +00:00
|
|
|
/**
|
|
|
|
* Deactivate the constraint. May destroy the constraint.
|
|
|
|
*/
|
2018-08-10 16:19:16 +00:00
|
|
|
void wlr_pointer_constraint_v1_send_deactivated(
|
|
|
|
struct wlr_pointer_constraint_v1 *constraint);
|
|
|
|
|
|
|
|
#endif
|