wlroots/include/wlr/types.h

349 lines
7.0 KiB
C
Raw Normal View History

#ifndef _WLR_WAYLAND_H
#define _WLR_WAYLAND_H
#include <wayland-server.h>
#include <wlr/common/list.h>
2017-05-07 16:26:48 +00:00
#include <stdbool.h>
2017-05-07 16:26:48 +00:00
struct wlr_output_mode_state;
2017-05-07 16:26:48 +00:00
struct wlr_output_mode {
struct wlr_output_mode_state *state;
2017-04-25 23:19:21 +00:00
uint32_t flags; // enum wl_output_mode
int32_t width, height;
int32_t refresh; // mHz
};
2017-05-07 16:26:48 +00:00
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;
2017-06-07 12:39:40 +00:00
char name[16];
char make[48];
char model[16];
uint32_t scale;
2017-06-05 10:48:51 +00:00
int32_t width, height;
2017-04-25 23:19:21 +00:00
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];
2017-05-07 16:26:48 +00:00
list_t *modes;
struct wlr_output_mode *current_mode;
2017-05-07 16:26:48 +00:00
struct {
struct wl_signal frame;
} 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);
2017-06-16 19:38:34 +00:00
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);
2017-05-31 20:17:04 +00:00
void wlr_output_destroy(struct wlr_output *output);
void wlr_output_effective_resolution(struct wlr_output *output,
int *width, int *height);
2017-06-19 19:15:37 +00:00
enum WLR_KEYBOARD_LED {
WLR_LED_NUM_LOCK = 1,
WLR_LED_CAPS_LOCK = 2,
WLR_LED_SCROLL_LOCK = 4,
WLR_LED_LAST
};
2017-06-09 21:31:21 +00:00
struct wlr_keyboard_state;
struct wlr_keyboard_impl;
struct wlr_keyboard {
struct wlr_keyboard_state *state;
struct wlr_keyboard_impl *impl;
2017-06-19 19:15:37 +00:00
uint32_t leds;
2017-06-09 21:31:21 +00:00
struct {
struct wl_signal key;
} events;
};
2017-06-19 19:15:37 +00:00
void wlr_keyboard_led_update(struct wlr_keyboard *keyboard, uint32_t leds);
2017-06-09 21:52:11 +00:00
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;
};
2017-06-09 21:31:21 +00:00
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 {
2017-06-09 21:52:11 +00:00
uint32_t time_sec;
uint64_t time_usec;
2017-06-09 21:31:21 +00:00
double delta_x, delta_y;
};
struct wlr_pointer_motion_absolute {
2017-06-09 21:52:11 +00:00
uint32_t time_sec;
uint64_t time_usec;
2017-06-09 21:31:21 +00:00
double x_mm, y_mm;
double width_mm, height_mm;
};
enum wlr_button_state {
2017-06-09 21:52:11 +00:00
WLR_BUTTON_RELEASED,
WLR_BUTTON_PRESSED,
2017-06-09 21:31:21 +00:00
};
struct wlr_pointer_button {
2017-06-09 21:52:11 +00:00
uint32_t time_sec;
uint64_t time_usec;
2017-06-09 21:31:21 +00:00
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,
2017-06-09 21:52:11 +00:00
WLR_AXIS_ORIENTATION_HORIZONTAL,
2017-06-09 21:31:21 +00:00
};
struct wlr_pointer_axis {
2017-06-09 21:52:11 +00:00
uint32_t time_sec;
uint64_t time_usec;
2017-06-09 21:31:21 +00:00
enum wlr_axis_source source;
enum wlr_axis_orientation orientation;
double delta;
};
2017-06-14 15:40:03 +00:00
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;
};
2017-06-14 18:50:09 +00:00
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;
};
2017-06-15 18:32:28 +00:00
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;
};
2017-06-19 18:49:07 +00:00
// 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;
};
2017-06-09 21:31:21 +00:00
enum wlr_input_device_type {
WLR_INPUT_DEVICE_KEYBOARD,
WLR_INPUT_DEVICE_POINTER,
WLR_INPUT_DEVICE_TOUCH,
2017-06-15 18:32:28 +00:00
WLR_INPUT_DEVICE_TABLET_TOOL,
2017-06-09 21:31:21 +00:00
WLR_INPUT_DEVICE_TABLET_PAD,
WLR_INPUT_DEVICE_GESTURE,
WLR_INPUT_DEVICE_SWITCH,
};
2017-06-10 16:21:54 +00:00
struct wlr_input_device_state;
struct wlr_input_device_impl;
2017-06-09 21:31:21 +00:00
struct wlr_input_device {
2017-06-10 16:21:54 +00:00
struct wlr_input_device_state *state;
struct wlr_input_device_impl *impl;
2017-06-09 21:31:21 +00:00
enum wlr_input_device_type type;
int vendor, product;
char *name;
2017-06-10 16:21:54 +00:00
2017-06-09 21:31:21 +00:00
union {
void *_device;
struct wlr_keyboard *keyboard;
struct wlr_pointer *pointer;
2017-06-14 15:40:03 +00:00
struct wlr_touch *touch;
2017-06-15 18:32:28 +00:00
struct wlr_tablet_tool *tablet_tool;
2017-06-19 18:49:07 +00:00
struct wlr_tablet_pad *tablet_pad;
2017-06-09 21:31:21 +00:00
};
};
#endif