diff options
Diffstat (limited to 'include/wlr')
-rw-r--r-- | include/wlr/types/meson.build | 1 | ||||
-rw-r--r-- | include/wlr/types/wlr_cursor.h | 6 | ||||
-rw-r--r-- | include/wlr/types/wlr_pointer.h | 52 | ||||
-rw-r--r-- | include/wlr/types/wlr_pointer_gestures_v1.h | 73 |
4 files changed, 132 insertions, 0 deletions
diff --git a/include/wlr/types/meson.build b/include/wlr/types/meson.build index 86f128b6..82715ad1 100644 --- a/include/wlr/types/meson.build +++ b/include/wlr/types/meson.build @@ -25,6 +25,7 @@ install_headers( 'wlr_output_layout.h', 'wlr_output.h', 'wlr_pointer_constraints_v1.h', + 'wlr_pointer_gestures_v1.h', 'wlr_pointer.h', 'wlr_presentation_time.h', 'wlr_primary_selection.h', diff --git a/include/wlr/types/wlr_cursor.h b/include/wlr/types/wlr_cursor.h index 6475669c..192ba8a0 100644 --- a/include/wlr/types/wlr_cursor.h +++ b/include/wlr/types/wlr_cursor.h @@ -52,6 +52,12 @@ struct wlr_cursor { struct wl_signal button; struct wl_signal axis; struct wl_signal frame; + struct wl_signal swipe_begin; + struct wl_signal swipe_update; + struct wl_signal swipe_end; + struct wl_signal pinch_begin; + struct wl_signal pinch_update; + struct wl_signal pinch_end; struct wl_signal touch_up; struct wl_signal touch_down; diff --git a/include/wlr/types/wlr_pointer.h b/include/wlr/types/wlr_pointer.h index 9dfe7aaa..486e1bc9 100644 --- a/include/wlr/types/wlr_pointer.h +++ b/include/wlr/types/wlr_pointer.h @@ -24,6 +24,12 @@ struct wlr_pointer { struct wl_signal button; struct wl_signal axis; struct wl_signal frame; + struct wl_signal swipe_begin; + struct wl_signal swipe_update; + struct wl_signal swipe_end; + struct wl_signal pinch_begin; + struct wl_signal pinch_update; + struct wl_signal pinch_end; } events; void *data; @@ -71,4 +77,50 @@ struct wlr_event_pointer_axis { int32_t delta_discrete; }; +struct wlr_event_pointer_swipe_begin { + struct wlr_input_device *device; + uint32_t time_msec; + uint32_t fingers; +}; + +struct wlr_event_pointer_swipe_update { + struct wlr_input_device *device; + uint32_t time_msec; + uint32_t fingers; + // Relative coordinates of the logical center of the gesture + // compared to the previous event. + double dx, dy; +}; + +struct wlr_event_pointer_swipe_end { + struct wlr_input_device *device; + uint32_t time_msec; + bool cancelled; +}; + +struct wlr_event_pointer_pinch_begin { + struct wlr_input_device *device; + uint32_t time_msec; + uint32_t fingers; +}; + +struct wlr_event_pointer_pinch_update { + struct wlr_input_device *device; + uint32_t time_msec; + uint32_t fingers; + // Relative coordinates of the logical center of the gesture + // compared to the previous event. + double dx, dy; + // Absolute scale compared to the begin event + double scale; + // Relative angle in degrees clockwise compared to the previous event. + double rotation; +}; + +struct wlr_event_pointer_pinch_end { + struct wlr_input_device *device; + uint32_t time_msec; + bool cancelled; +}; + #endif diff --git a/include/wlr/types/wlr_pointer_gestures_v1.h b/include/wlr/types/wlr_pointer_gestures_v1.h new file mode 100644 index 00000000..7caf0f53 --- /dev/null +++ b/include/wlr/types/wlr_pointer_gestures_v1.h @@ -0,0 +1,73 @@ +/* + * 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 + +#ifndef WLR_TYPES_WLR_POINTER_GESTURES_V1_H +#define WLR_TYPES_WLR_POINTER_GESTURES_V1_H + +#include <wayland-server.h> +#include <wlr/types/wlr_seat.h> +#include <wlr/types/wlr_surface.h> + +struct wlr_pointer_gestures_v1 { + struct wl_global *global; + struct wl_list resources; // wl_resource_get_link + struct wl_list swipes; // wl_resource_get_link + struct wl_list pinches; // wl_resource_get_link + + struct wl_listener display_destroy; + + struct { + struct wl_signal destroy; + } events; + + void *data; +}; + +struct wlr_pointer_gestures_v1 *wlr_pointer_gestures_v1_create( + struct wl_display *display); + +void wlr_pointer_gestures_v1_send_swipe_begin( + struct wlr_pointer_gestures_v1 *gestures, + struct wlr_seat *seat, + uint32_t time_msec, + uint32_t fingers); +void wlr_pointer_gestures_v1_send_swipe_update( + struct wlr_pointer_gestures_v1 *gestures, + struct wlr_seat *seat, + uint32_t time_msec, + double dx, + double dy); +void wlr_pointer_gestures_v1_send_swipe_end( + struct wlr_pointer_gestures_v1 *gestures, + struct wlr_seat *seat, + uint32_t time_msec, + bool cancelled); + +void wlr_pointer_gestures_v1_send_pinch_begin( + struct wlr_pointer_gestures_v1 *gestures, + struct wlr_seat *seat, + uint32_t time_msec, + uint32_t fingers); +void wlr_pointer_gestures_v1_send_pinch_update( + struct wlr_pointer_gestures_v1 *gestures, + struct wlr_seat *seat, + uint32_t time_msec, + double dx, + double dy, + double scale, + double rotation); +void wlr_pointer_gestures_v1_send_pinch_end( + struct wlr_pointer_gestures_v1 *gestures, + struct wlr_seat *seat, + uint32_t time_msec, + bool cancelled); + +void wlr_pointer_gestures_v1_destroy( + struct wlr_pointer_gestures_v1 *pointer_gestures_v1); + +#endif |