From 53a8b4f127a370a84c81e0c91b8c6fce8b18842f Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Mon, 19 Jun 2017 18:41:02 -0400 Subject: [PATCH] Split out types.h and wlr/types.h TODO: Update the code accordingly and move other types into the same paradigm --- include/types.h | 77 ----- include/wlr/interfaces/wlr_input_device.h | 16 + include/wlr/interfaces/wlr_keyboard.h | 15 + include/wlr/interfaces/wlr_output.h | 22 ++ include/wlr/interfaces/wlr_pointer.h | 13 + include/wlr/interfaces/wlr_tablet_pad.h | 13 + include/wlr/interfaces/wlr_tablet_tool.h | 13 + include/wlr/interfaces/wlr_touch.h | 13 + include/wlr/types.h | 350 ---------------------- include/wlr/types/wlr_input_device.h | 46 +++ include/wlr/types/wlr_keyboard.h | 39 +++ include/wlr/types/wlr_output.h | 57 ++++ include/wlr/types/wlr_pointer.h | 62 ++++ include/wlr/types/wlr_tablet_pad.h | 60 ++++ include/wlr/types/wlr_tablet_tool.h | 81 +++++ include/wlr/types/wlr_touch.h | 49 +++ 16 files changed, 499 insertions(+), 427 deletions(-) delete mode 100644 include/types.h create mode 100644 include/wlr/interfaces/wlr_input_device.h create mode 100644 include/wlr/interfaces/wlr_keyboard.h create mode 100644 include/wlr/interfaces/wlr_output.h create mode 100644 include/wlr/interfaces/wlr_pointer.h create mode 100644 include/wlr/interfaces/wlr_tablet_pad.h create mode 100644 include/wlr/interfaces/wlr_tablet_tool.h create mode 100644 include/wlr/interfaces/wlr_touch.h delete mode 100644 include/wlr/types.h create mode 100644 include/wlr/types/wlr_input_device.h create mode 100644 include/wlr/types/wlr_keyboard.h create mode 100644 include/wlr/types/wlr_output.h create mode 100644 include/wlr/types/wlr_pointer.h create mode 100644 include/wlr/types/wlr_tablet_pad.h create mode 100644 include/wlr/types/wlr_tablet_tool.h create mode 100644 include/wlr/types/wlr_touch.h diff --git a/include/types.h b/include/types.h deleted file mode 100644 index f53cac02..00000000 --- a/include/types.h +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef _WLR_WAYLAND_INTERNAL_H -#define _WLR_WAYLAND_INTERNAL_H - -#include -#include -#include - -struct wlr_output_impl { - void (*enable)(struct wlr_output_state *state, bool enable); - bool (*set_mode)(struct wlr_output_state *state, - struct wlr_output_mode *mode); - void (*transform)(struct wlr_output_state *state, - enum wl_output_transform transform); - bool (*set_cursor)(struct wlr_output_state *state, - const uint8_t *buf, int32_t stride, uint32_t width, uint32_t height); - bool (*move_cursor)(struct wlr_output_state *state, int x, int y); - void (*destroy)(struct wlr_output_state *state); -}; - -struct wlr_output *wlr_output_create(struct wlr_output_impl *impl, - struct wlr_output_state *state); -void wlr_output_free(struct wlr_output *output); -void wlr_output_update_matrix(struct wlr_output *output); - -struct wlr_keyboard_impl { - void (*destroy)(struct wlr_keyboard_state *state); - void (*led_update)(struct wlr_keyboard_state *state, uint32_t leds); -}; - -struct wlr_keyboard *wlr_keyboard_create(struct wlr_keyboard_impl *impl, - struct wlr_keyboard_state *state); -void wlr_keyboard_destroy(struct wlr_keyboard *keyboard); - -struct wlr_pointer_impl { - void (*destroy)(struct wlr_pointer_state *state); -}; - -struct wlr_pointer *wlr_pointer_create(struct wlr_pointer_impl *impl, - struct wlr_pointer_state *state); -void wlr_pointer_destroy(struct wlr_pointer *pointer); - -struct wlr_touch_impl { - void (*destroy)(struct wlr_touch_state *state); -}; - -struct wlr_touch *wlr_touch_create(struct wlr_touch_impl *impl, - struct wlr_touch_state *state); -void wlr_touch_destroy(struct wlr_touch *touch); - -struct wlr_tablet_tool_impl { - void (*destroy)(struct wlr_tablet_tool_state *tool); -}; - -struct wlr_tablet_tool *wlr_tablet_tool_create(struct wlr_tablet_tool_impl *impl, - struct wlr_tablet_tool_state *state); -void wlr_tablet_tool_destroy(struct wlr_tablet_tool *tool); - -struct wlr_tablet_pad_impl { - void (*destroy)(struct wlr_tablet_pad_state *pad); -}; - -struct wlr_tablet_pad *wlr_tablet_pad_create(struct wlr_tablet_pad_impl *impl, - struct wlr_tablet_pad_state *state); -void wlr_tablet_pad_destroy(struct wlr_tablet_pad *pad); - -struct wlr_input_device_impl { - void (*destroy)(struct wlr_input_device_state *state); -}; - -struct wlr_input_device *wlr_input_device_create( - enum wlr_input_device_type type, - struct wlr_input_device_impl *impl, - struct wlr_input_device_state *state, - const char *name, int vendor, int product); -void wlr_input_device_destroy(struct wlr_input_device *dev); - -#endif diff --git a/include/wlr/interfaces/wlr_input_device.h b/include/wlr/interfaces/wlr_input_device.h new file mode 100644 index 00000000..26729c7c --- /dev/null +++ b/include/wlr/interfaces/wlr_input_device.h @@ -0,0 +1,16 @@ +#ifndef _WLR_INTERFACES_INPUT_DEVICE_H +#define _WLR_INTERFACES_INPUT_DEVICE_H +#include + +struct wlr_input_device_impl { + void (*destroy)(struct wlr_input_device_state *state); +}; + +struct wlr_input_device *wlr_input_device_create( + enum wlr_input_device_type type, + struct wlr_input_device_impl *impl, + struct wlr_input_device_state *state, + const char *name, int vendor, int product); +void wlr_input_device_destroy(struct wlr_input_device *dev); + +#endif diff --git a/include/wlr/interfaces/wlr_keyboard.h b/include/wlr/interfaces/wlr_keyboard.h new file mode 100644 index 00000000..1acc6428 --- /dev/null +++ b/include/wlr/interfaces/wlr_keyboard.h @@ -0,0 +1,15 @@ +#ifndef _WLR_INTERFACE_KEYBOARD_H +#define _WLR_INTERFACE_KEYBOARD_H +#include +#include + +struct wlr_keyboard_impl { + void (*destroy)(struct wlr_keyboard_state *state); + void (*led_update)(struct wlr_keyboard_state *state, uint32_t leds); +}; + +struct wlr_keyboard *wlr_keyboard_create(struct wlr_keyboard_impl *impl, + struct wlr_keyboard_state *state); +void wlr_keyboard_destroy(struct wlr_keyboard *keyboard); + +#endif diff --git a/include/wlr/interfaces/wlr_output.h b/include/wlr/interfaces/wlr_output.h new file mode 100644 index 00000000..24380be8 --- /dev/null +++ b/include/wlr/interfaces/wlr_output.h @@ -0,0 +1,22 @@ +#ifndef _WLR_INTERFACE_OUTPUT_H +#define _WLR_INTERFACE_OUTPUT_H +#include +#include + +struct wlr_output_impl { + void (*enable)(struct wlr_output_state *state, bool enable); + bool (*set_mode)(struct wlr_output_state *state, + struct wlr_output_mode *mode); + void (*transform)(struct wlr_output_state *state, + enum wl_output_transform transform); + bool (*set_cursor)(struct wlr_output_state *state, + const uint8_t *buf, int32_t stride, uint32_t width, uint32_t height); + bool (*move_cursor)(struct wlr_output_state *state, int x, int y); + void (*destroy)(struct wlr_output_state *state); +}; + +struct wlr_output *wlr_output_create(struct wlr_output_impl *impl, + struct wlr_output_state *state); +void wlr_output_free(struct wlr_output *output); + +#endif diff --git a/include/wlr/interfaces/wlr_pointer.h b/include/wlr/interfaces/wlr_pointer.h new file mode 100644 index 00000000..8c3f7e0d --- /dev/null +++ b/include/wlr/interfaces/wlr_pointer.h @@ -0,0 +1,13 @@ +#ifndef _WLR_INTERFACES_POINTER_H +#define _WLR_INTERFACES_POINTER_H +#include + +struct wlr_pointer_impl { + void (*destroy)(struct wlr_pointer_state *state); +}; + +struct wlr_pointer *wlr_pointer_create(struct wlr_pointer_impl *impl, + struct wlr_pointer_state *state); +void wlr_pointer_destroy(struct wlr_pointer *pointer); + +#endif diff --git a/include/wlr/interfaces/wlr_tablet_pad.h b/include/wlr/interfaces/wlr_tablet_pad.h new file mode 100644 index 00000000..09274c6c --- /dev/null +++ b/include/wlr/interfaces/wlr_tablet_pad.h @@ -0,0 +1,13 @@ +#ifndef _WLR_INTERFACES_TABLET_PAD_H +#define _WLR_INTERFACES_TABLET_PAD_H +#include + +struct wlr_tablet_pad_impl { + void (*destroy)(struct wlr_tablet_pad_state *pad); +}; + +struct wlr_tablet_pad *wlr_tablet_pad_create(struct wlr_tablet_pad_impl *impl, + struct wlr_tablet_pad_state *state); +void wlr_tablet_pad_destroy(struct wlr_tablet_pad *pad); + +#endif diff --git a/include/wlr/interfaces/wlr_tablet_tool.h b/include/wlr/interfaces/wlr_tablet_tool.h new file mode 100644 index 00000000..cd326878 --- /dev/null +++ b/include/wlr/interfaces/wlr_tablet_tool.h @@ -0,0 +1,13 @@ +#ifndef _WLR_INTERFACES_TABLET_TOOL_H +#define _WLR_INTERFACES_TABLET_TOOL_H +#include + +struct wlr_tablet_tool_impl { + void (*destroy)(struct wlr_tablet_tool_state *tool); +}; + +struct wlr_tablet_tool *wlr_tablet_tool_create(struct wlr_tablet_tool_impl *impl, + struct wlr_tablet_tool_state *state); +void wlr_tablet_tool_destroy(struct wlr_tablet_tool *tool); + +#endif diff --git a/include/wlr/interfaces/wlr_touch.h b/include/wlr/interfaces/wlr_touch.h new file mode 100644 index 00000000..d83ad558 --- /dev/null +++ b/include/wlr/interfaces/wlr_touch.h @@ -0,0 +1,13 @@ +#ifndef _WLR_INTERFACES_TOUCH_H +#define _WLR_INTERFACES_TOUCH_H +#include + +struct wlr_touch_impl { + void (*destroy)(struct wlr_touch_state *state); +}; + +struct wlr_touch *wlr_touch_create(struct wlr_touch_impl *impl, + struct wlr_touch_state *state); +void wlr_touch_destroy(struct wlr_touch *touch); + +#endif diff --git a/include/wlr/types.h b/include/wlr/types.h deleted file mode 100644 index 6b6a3389..00000000 --- a/include/wlr/types.h +++ /dev/null @@ -1,350 +0,0 @@ -#ifndef _WLR_WAYLAND_H -#define _WLR_WAYLAND_H - -#include -#include -#include - -struct wlr_output_mode_state; - -struct wlr_output_mode { - struct wlr_output_mode_state *state; - uint32_t flags; // enum wl_output_mode - int32_t width, height; - int32_t refresh; // mHz -}; - -struct wlr_output_impl; -struct wlr_output_state; - -struct wlr_output { - const struct wlr_output_impl *impl; - struct wlr_output_state *state; - - uint32_t flags; - char name[16]; - char make[48]; - char model[16]; - uint32_t scale; - int32_t width, height; - int32_t phys_width, phys_height; // mm - int32_t subpixel; // enum wl_output_subpixel - int32_t transform; // enum wl_output_transform - - float transform_matrix[16]; - - /* Note: some backends may have zero modes */ - list_t *modes; - struct wlr_output_mode *current_mode; - - struct { - struct wl_signal frame; - struct wl_signal resolution; - } events; -}; - -void wlr_output_enable(struct wlr_output *output, bool enable); -bool wlr_output_set_mode(struct wlr_output *output, - struct wlr_output_mode *mode); -void wlr_output_transform(struct wlr_output *output, - enum wl_output_transform transform); -bool wlr_output_set_cursor(struct wlr_output *output, - const uint8_t *buf, int32_t stride, uint32_t width, uint32_t height); -bool wlr_output_move_cursor(struct wlr_output *output, int x, int y); -void wlr_output_destroy(struct wlr_output *output); -void wlr_output_effective_resolution(struct wlr_output *output, - int *width, int *height); - -enum WLR_KEYBOARD_LED { - WLR_LED_NUM_LOCK = 1, - WLR_LED_CAPS_LOCK = 2, - WLR_LED_SCROLL_LOCK = 4, - WLR_LED_LAST -}; - -struct wlr_keyboard_state; -struct wlr_keyboard_impl; - -struct wlr_keyboard { - struct wlr_keyboard_state *state; - struct wlr_keyboard_impl *impl; - uint32_t leds; - - struct { - struct wl_signal key; - } events; -}; - -void wlr_keyboard_led_update(struct wlr_keyboard *keyboard, uint32_t leds); - -enum wlr_key_state { - WLR_KEY_RELEASED, - WLR_KEY_PRESSED, -}; - -struct wlr_keyboard_key { - uint32_t time_sec; - uint64_t time_usec; - uint32_t keycode; - enum wlr_key_state state; -}; - -struct wlr_pointer_state; -struct wlr_pointer_impl; - -struct wlr_pointer { - struct wlr_pointer_state *state; - struct wlr_pointer_impl *impl; - - struct { - struct wl_signal motion; - struct wl_signal motion_absolute; - struct wl_signal button; - struct wl_signal axis; - } events; -}; - -struct wlr_pointer_motion { - uint32_t time_sec; - uint64_t time_usec; - double delta_x, delta_y; -}; - -struct wlr_pointer_motion_absolute { - uint32_t time_sec; - uint64_t time_usec; - double x_mm, y_mm; - double width_mm, height_mm; -}; - -enum wlr_button_state { - WLR_BUTTON_RELEASED, - WLR_BUTTON_PRESSED, -}; - -struct wlr_pointer_button { - uint32_t time_sec; - uint64_t time_usec; - uint32_t button; - enum wlr_button_state state; -}; - -enum wlr_axis_source { - WLR_AXIS_SOURCE_WHEEL, - WLR_AXIS_SOURCE_FINGER, - WLR_AXIS_SOURCE_CONTINUOUS, - WLR_AXIS_SOURCE_WHEEL_TILT, -}; - -enum wlr_axis_orientation { - WLR_AXIS_ORIENTATION_VERTICAL, - WLR_AXIS_ORIENTATION_HORIZONTAL, -}; - -struct wlr_pointer_axis { - uint32_t time_sec; - uint64_t time_usec; - enum wlr_axis_source source; - enum wlr_axis_orientation orientation; - double delta; -}; - -struct wlr_touch_state; -struct wlr_touch_impl; - -struct wlr_touch { - struct wlr_touch_state *state; - struct wlr_touch_impl *impl; - - struct { - struct wl_signal down; - struct wl_signal up; - struct wl_signal motion; - struct wl_signal cancel; - } events; -}; - -struct wlr_touch_down { - uint32_t time_sec; - uint64_t time_usec; - int32_t slot; - double x_mm, y_mm; - double width_mm, height_mm; -}; - -struct wlr_touch_up { - uint32_t time_sec; - uint64_t time_usec; - int32_t slot; -}; - -struct wlr_touch_motion { - uint32_t time_sec; - uint64_t time_usec; - int32_t slot; - double x_mm, y_mm; - double width_mm, height_mm; -}; - -struct wlr_touch_cancel { - uint32_t time_sec; - uint64_t time_usec; - int32_t slot; -}; - -struct wlr_tablet_tool_impl; -struct wlr_tablet_tool_state; - -struct wlr_tablet_tool { - struct wlr_tablet_tool_impl *impl; - struct wlr_tablet_tool_state *state; - - struct { - struct wl_signal axis; - struct wl_signal proximity; - struct wl_signal tip; - struct wl_signal button; - } events; -}; - -enum wlr_tablet_tool_axes { - WLR_TABLET_TOOL_AXIS_X = 1, - WLR_TABLET_TOOL_AXIS_Y = 2, - WLR_TABLET_TOOL_AXIS_DISTANCE = 4, - WLR_TABLET_TOOL_AXIS_PRESSURE = 8, - WLR_TABLET_TOOL_AXIS_TILT_X = 16, - WLR_TABLET_TOOL_AXIS_TILT_Y = 32, - WLR_TABLET_TOOL_AXIS_ROTATION = 64, - WLR_TABLET_TOOL_AXIS_SLIDER = 128, - WLR_TABLET_TOOL_AXIS_WHEEL = 256, -}; - -struct wlr_tablet_tool_axis { - uint32_t time_sec; - uint64_t time_usec; - uint32_t updated_axes; - double x_mm, y_mm; - double width_mm, height_mm; - double pressure; - double distance; - double tilt_x, tilt_y; - double rotation; - double slider; - double wheel_delta; -}; - -enum wlr_tablet_tool_proximity_state { - WLR_TABLET_TOOL_PROXIMITY_OUT, - WLR_TABLET_TOOL_PROXIMITY_IN, -}; - -struct wlr_tablet_tool_proximity { - uint32_t time_sec; - uint64_t time_usec; - double x, y; - double width_mm, height_mm; - enum wlr_tablet_tool_proximity_state state; -}; - -enum wlr_tablet_tool_tip_state { - WLR_TABLET_TOOL_TIP_UP, - WLR_TABLET_TOOL_TIP_DOWN, -}; - -struct wlr_tablet_tool_tip { - uint32_t time_sec; - uint64_t time_usec; - double x, y; - double width_mm, height_mm; - enum wlr_tablet_tool_tip_state state; -}; - -struct wlr_tablet_tool_button { - uint32_t time_sec; - uint64_t time_usec; - uint32_t button; - enum wlr_button_state state; -}; - -// NOTE: the wlr tablet pad implementation does not currently support tablets -// with more than one mode. I don't own any such hardware so I cannot test it -// and it is too complicated to make a meaningful implementation of blindly. -struct wlr_tablet_pad_impl; -struct wlr_tablet_pad_state; - -struct wlr_tablet_pad { - struct wlr_tablet_pad_impl *impl; - struct wlr_tablet_pad_state *state; - - struct { - struct wl_signal button; - struct wl_signal ring; - struct wl_signal strip; - } events; -}; - -struct wlr_tablet_pad_button { - uint32_t time_sec; - uint64_t time_usec; - uint32_t button; - enum wlr_button_state state; -}; - -enum wlr_tablet_pad_ring_source { - WLR_TABLET_PAD_RING_SOURCE_UNKNOWN, - WLR_TABLET_PAD_RING_SOURCE_FINGER, -}; - -struct wlr_tablet_pad_ring { - uint32_t time_sec; - uint64_t time_usec; - enum wlr_tablet_pad_ring_source source; - uint32_t ring; - double position; -}; - -enum wlr_tablet_pad_strip_source { - WLR_TABLET_PAD_STRIP_SOURCE_UNKNOWN, - WLR_TABLET_PAD_STRIP_SOURCE_FINGER, -}; - -struct wlr_tablet_pad_strip { - uint32_t time_sec; - uint64_t time_usec; - enum wlr_tablet_pad_strip_source source; - uint32_t strip; - double position; -}; - -enum wlr_input_device_type { - WLR_INPUT_DEVICE_KEYBOARD, - WLR_INPUT_DEVICE_POINTER, - WLR_INPUT_DEVICE_TOUCH, - WLR_INPUT_DEVICE_TABLET_TOOL, - WLR_INPUT_DEVICE_TABLET_PAD, - WLR_INPUT_DEVICE_GESTURE, - WLR_INPUT_DEVICE_SWITCH, -}; - -struct wlr_input_device_state; -struct wlr_input_device_impl; - -struct wlr_input_device { - struct wlr_input_device_state *state; - struct wlr_input_device_impl *impl; - - enum wlr_input_device_type type; - int vendor, product; - char *name; - - union { - void *_device; - struct wlr_keyboard *keyboard; - struct wlr_pointer *pointer; - struct wlr_touch *touch; - struct wlr_tablet_tool *tablet_tool; - struct wlr_tablet_pad *tablet_pad; - }; -}; - -#endif diff --git a/include/wlr/types/wlr_input_device.h b/include/wlr/types/wlr_input_device.h new file mode 100644 index 00000000..57cbfaf9 --- /dev/null +++ b/include/wlr/types/wlr_input_device.h @@ -0,0 +1,46 @@ +#ifndef _WLR_TYPES_INPUT_H +#define _WLR_TYPES_INPUT_H + +enum wlr_button_state { + WLR_BUTTON_RELEASED, + WLR_BUTTON_PRESSED, +}; + +enum wlr_input_device_type { + WLR_INPUT_DEVICE_KEYBOARD, + WLR_INPUT_DEVICE_POINTER, + WLR_INPUT_DEVICE_TOUCH, + WLR_INPUT_DEVICE_TABLET_TOOL, + WLR_INPUT_DEVICE_TABLET_PAD +}; + +/* Note: these are circular dependencies */ +#include +#include +#include +#include +#include + +struct wlr_input_device_state; +struct wlr_input_device_impl; + +struct wlr_input_device { + struct wlr_input_device_state *state; + struct wlr_input_device_impl *impl; + + enum wlr_input_device_type type; + int vendor, product; + char *name; + + /* wlr_input_device.type determines which of these is valid */ + union { + void *_device; + struct wlr_keyboard *keyboard; + struct wlr_pointer *pointer; + struct wlr_touch *touch; + struct wlr_tablet_tool *tablet_tool; + struct wlr_tablet_pad *tablet_pad; + }; +}; + +#endif diff --git a/include/wlr/types/wlr_keyboard.h b/include/wlr/types/wlr_keyboard.h new file mode 100644 index 00000000..e3efc895 --- /dev/null +++ b/include/wlr/types/wlr_keyboard.h @@ -0,0 +1,39 @@ +#ifndef _WLR_TYPES_KEYBOARD_H +#define _WLR_TYPES_KEYBOARD_H +#include +#include + +enum WLR_KEYBOARD_LED { + WLR_LED_NUM_LOCK = 1, + WLR_LED_CAPS_LOCK = 2, + WLR_LED_SCROLL_LOCK = 4, + WLR_LED_LAST +}; + +struct wlr_keyboard_state; +struct wlr_keyboard_impl; + +struct wlr_keyboard { + struct wlr_keyboard_state *state; + struct wlr_keyboard_impl *impl; + + struct { + struct wl_signal key; + } events; +}; + +void wlr_keyboard_led_update(struct wlr_keyboard *keyboard, uint32_t leds); + +enum wlr_key_state { + WLR_KEY_RELEASED, + WLR_KEY_PRESSED, +}; + +struct wlr_keyboard_key { + uint32_t time_sec; + uint64_t time_usec; + uint32_t keycode; + enum wlr_key_state state; +}; + +#endif diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h new file mode 100644 index 00000000..66216d3e --- /dev/null +++ b/include/wlr/types/wlr_output.h @@ -0,0 +1,57 @@ +#ifndef _WLR_TYPES_OUTPUT_H +#define _WLR_TYPES_OUTPUT_H +#include +#include +#include + +struct wlr_output_mode_state; + +struct wlr_output_mode { + struct wlr_output_mode_state *state; + uint32_t flags; // enum wl_output_mode + int32_t width, height; + int32_t refresh; // mHz +}; + +struct wlr_output_impl; +struct wlr_output_state; + +struct wlr_output { + const struct wlr_output_impl *impl; + struct wlr_output_state *state; + + uint32_t flags; + char name[16]; + char make[48]; + char model[16]; + uint32_t scale; + int32_t width, height; + int32_t phys_width, phys_height; // mm + int32_t subpixel; // enum wl_output_subpixel + int32_t transform; // enum wl_output_transform + + float transform_matrix[16]; + + /* Note: some backends may have zero modes */ + list_t *modes; + struct wlr_output_mode *current_mode; + + struct { + struct wl_signal frame; + struct wl_signal resolution; + } events; +}; + +void wlr_output_enable(struct wlr_output *output, bool enable); +bool wlr_output_set_mode(struct wlr_output *output, + struct wlr_output_mode *mode); +void wlr_output_transform(struct wlr_output *output, + enum wl_output_transform transform); +bool wlr_output_set_cursor(struct wlr_output *output, + const uint8_t *buf, int32_t stride, uint32_t width, uint32_t height); +bool wlr_output_move_cursor(struct wlr_output *output, int x, int y); +void wlr_output_destroy(struct wlr_output *output); +void wlr_output_effective_resolution(struct wlr_output *output, + int *width, int *height); + +#endif diff --git a/include/wlr/types/wlr_pointer.h b/include/wlr/types/wlr_pointer.h new file mode 100644 index 00000000..7f5e2771 --- /dev/null +++ b/include/wlr/types/wlr_pointer.h @@ -0,0 +1,62 @@ +#ifndef _WLR_TYPES_POINTER_H +#define _WLR_TYPES_POINTER_H +#include +#include +#include + +struct wlr_pointer_state; +struct wlr_pointer_impl; + +struct wlr_pointer { + struct wlr_pointer_state *state; + struct wlr_pointer_impl *impl; + + struct { + struct wl_signal motion; + struct wl_signal motion_absolute; + struct wl_signal button; + struct wl_signal axis; + } events; +}; + +struct wlr_pointer_motion { + uint32_t time_sec; + uint64_t time_usec; + double delta_x, delta_y; +}; + +struct wlr_pointer_motion_absolute { + uint32_t time_sec; + uint64_t time_usec; + double x_mm, y_mm; + double width_mm, height_mm; +}; + +struct wlr_pointer_button { + uint32_t time_sec; + uint64_t time_usec; + uint32_t button; + enum wlr_button_state state; +}; + +enum wlr_axis_source { + WLR_AXIS_SOURCE_WHEEL, + WLR_AXIS_SOURCE_FINGER, + WLR_AXIS_SOURCE_CONTINUOUS, + WLR_AXIS_SOURCE_WHEEL_TILT, +}; + +enum wlr_axis_orientation { + WLR_AXIS_ORIENTATION_VERTICAL, + WLR_AXIS_ORIENTATION_HORIZONTAL, +}; + +struct wlr_pointer_axis { + uint32_t time_sec; + uint64_t time_usec; + enum wlr_axis_source source; + enum wlr_axis_orientation orientation; + double delta; +}; + +#endif diff --git a/include/wlr/types/wlr_tablet_pad.h b/include/wlr/types/wlr_tablet_pad.h new file mode 100644 index 00000000..7fa7bfd1 --- /dev/null +++ b/include/wlr/types/wlr_tablet_pad.h @@ -0,0 +1,60 @@ +#ifndef _WLR_TYPES_TABLET_PAD_H +#define _WLR_TYPES_TABLET_PAD_H +#include +#include +#include + +/* + * NOTE: the wlr tablet pad implementation does not currently support tablets + * with more than one mode. I don't own any such hardware so I cannot test it + * and it is too complicated to make a meaningful implementation of blindly. + */ + +struct wlr_tablet_pad_impl; +struct wlr_tablet_pad_state; + +struct wlr_tablet_pad { + struct wlr_tablet_pad_impl *impl; + struct wlr_tablet_pad_state *state; + + struct { + struct wl_signal button; + struct wl_signal ring; + struct wl_signal strip; + } events; +}; + +struct wlr_tablet_pad_button { + uint32_t time_sec; + uint64_t time_usec; + uint32_t button; + enum wlr_button_state state; +}; + +enum wlr_tablet_pad_ring_source { + WLR_TABLET_PAD_RING_SOURCE_UNKNOWN, + WLR_TABLET_PAD_RING_SOURCE_FINGER, +}; + +struct wlr_tablet_pad_ring { + uint32_t time_sec; + uint64_t time_usec; + enum wlr_tablet_pad_ring_source source; + uint32_t ring; + double position; +}; + +enum wlr_tablet_pad_strip_source { + WLR_TABLET_PAD_STRIP_SOURCE_UNKNOWN, + WLR_TABLET_PAD_STRIP_SOURCE_FINGER, +}; + +struct wlr_tablet_pad_strip { + uint32_t time_sec; + uint64_t time_usec; + enum wlr_tablet_pad_strip_source source; + uint32_t strip; + double position; +}; + +#endif diff --git a/include/wlr/types/wlr_tablet_tool.h b/include/wlr/types/wlr_tablet_tool.h new file mode 100644 index 00000000..2695914a --- /dev/null +++ b/include/wlr/types/wlr_tablet_tool.h @@ -0,0 +1,81 @@ +#ifndef _WLR_TYPES_TABLET_TOOL_H +#define _WLR_TYPES_TABLET_TOOL_H +#include +#include +#include + +struct wlr_tablet_tool_impl; +struct wlr_tablet_tool_state; + +struct wlr_tablet_tool { + struct wlr_tablet_tool_impl *impl; + struct wlr_tablet_tool_state *state; + + struct { + struct wl_signal axis; + struct wl_signal proximity; + struct wl_signal tip; + struct wl_signal button; + } events; +}; + +enum wlr_tablet_tool_axes { + WLR_TABLET_TOOL_AXIS_X = 1, + WLR_TABLET_TOOL_AXIS_Y = 2, + WLR_TABLET_TOOL_AXIS_DISTANCE = 4, + WLR_TABLET_TOOL_AXIS_PRESSURE = 8, + WLR_TABLET_TOOL_AXIS_TILT_X = 16, + WLR_TABLET_TOOL_AXIS_TILT_Y = 32, + WLR_TABLET_TOOL_AXIS_ROTATION = 64, + WLR_TABLET_TOOL_AXIS_SLIDER = 128, + WLR_TABLET_TOOL_AXIS_WHEEL = 256, +}; + +struct wlr_tablet_tool_axis { + uint32_t time_sec; + uint64_t time_usec; + uint32_t updated_axes; + double x_mm, y_mm; + double width_mm, height_mm; + double pressure; + double distance; + double tilt_x, tilt_y; + double rotation; + double slider; + double wheel_delta; +}; + +enum wlr_tablet_tool_proximity_state { + WLR_TABLET_TOOL_PROXIMITY_OUT, + WLR_TABLET_TOOL_PROXIMITY_IN, +}; + +struct wlr_tablet_tool_proximity { + uint32_t time_sec; + uint64_t time_usec; + double x, y; + double width_mm, height_mm; + enum wlr_tablet_tool_proximity_state state; +}; + +enum wlr_tablet_tool_tip_state { + WLR_TABLET_TOOL_TIP_UP, + WLR_TABLET_TOOL_TIP_DOWN, +}; + +struct wlr_tablet_tool_tip { + uint32_t time_sec; + uint64_t time_usec; + double x, y; + double width_mm, height_mm; + enum wlr_tablet_tool_tip_state state; +}; + +struct wlr_tablet_tool_button { + uint32_t time_sec; + uint64_t time_usec; + uint32_t button; + enum wlr_button_state state; +}; + +#endif diff --git a/include/wlr/types/wlr_touch.h b/include/wlr/types/wlr_touch.h new file mode 100644 index 00000000..79c51ea3 --- /dev/null +++ b/include/wlr/types/wlr_touch.h @@ -0,0 +1,49 @@ +#ifndef _WLR_TYPES_TOUCH_H +#define _WLR_TYPES_TOUCH_H +#include +#include + +struct wlr_touch_state; +struct wlr_touch_impl; + +struct wlr_touch { + struct wlr_touch_state *state; + struct wlr_touch_impl *impl; + + struct { + struct wl_signal down; + struct wl_signal up; + struct wl_signal motion; + struct wl_signal cancel; + } events; +}; + +struct wlr_touch_down { + uint32_t time_sec; + uint64_t time_usec; + int32_t slot; + double x_mm, y_mm; + double width_mm, height_mm; +}; + +struct wlr_touch_up { + uint32_t time_sec; + uint64_t time_usec; + int32_t slot; +}; + +struct wlr_touch_motion { + uint32_t time_sec; + uint64_t time_usec; + int32_t slot; + double x_mm, y_mm; + double width_mm, height_mm; +}; + +struct wlr_touch_cancel { + uint32_t time_sec; + uint64_t time_usec; + int32_t slot; +}; + +#endif