diff options
Diffstat (limited to 'include/wlr')
-rw-r--r-- | include/wlr/backend.h | 8 | ||||
-rw-r--r-- | include/wlr/backend/libinput.h | 15 | ||||
-rw-r--r-- | include/wlr/backend/multi.h | 10 | ||||
-rw-r--r-- | include/wlr/render.h | 10 | ||||
-rw-r--r-- | include/wlr/render/interface.h | 4 | ||||
-rw-r--r-- | include/wlr/session.h | 2 | ||||
-rw-r--r-- | include/wlr/session/interface.h | 2 | ||||
-rw-r--r-- | include/wlr/types.h | 237 |
8 files changed, 280 insertions, 8 deletions
diff --git a/include/wlr/backend.h b/include/wlr/backend.h index 32d96a8d..db85c169 100644 --- a/include/wlr/backend.h +++ b/include/wlr/backend.h @@ -12,14 +12,10 @@ struct wlr_backend { struct wlr_backend_state *state; struct { + struct wl_signal input_add; + struct wl_signal input_remove; struct wl_signal output_add; struct wl_signal output_remove; - struct wl_signal keyboard_add; - struct wl_signal keyboard_remove; - struct wl_signal pointer_add; - struct wl_signal pointer_remove; - struct wl_signal touch_add; - struct wl_signal touch_remove; } events; }; diff --git a/include/wlr/backend/libinput.h b/include/wlr/backend/libinput.h new file mode 100644 index 00000000..7108f42c --- /dev/null +++ b/include/wlr/backend/libinput.h @@ -0,0 +1,15 @@ +#ifndef WLR_BACKEND_LIBINPUT_H +#define WLR_BACKEND_LIBINPUT_H + +#include <libinput.h> +#include <wayland-server.h> +#include <wlr/session.h> +#include <wlr/backend.h> +#include <wlr/backend/udev.h> +#include <wlr/types.h> + +struct wlr_backend *wlr_libinput_backend_create(struct wl_display *display, + struct wlr_session *session, struct wlr_udev *udev); +struct libinput_device *wlr_libinput_get_device_handle(struct wlr_input_device *dev); + +#endif diff --git a/include/wlr/backend/multi.h b/include/wlr/backend/multi.h new file mode 100644 index 00000000..a07ca770 --- /dev/null +++ b/include/wlr/backend/multi.h @@ -0,0 +1,10 @@ +#ifndef _WLR_BACKEND_MULTI_H +#define _WLR_BACKEND_MULTI_H + +#include <wlr/backend.h> + +struct wlr_backend *wlr_multi_backend_create(); +void wlr_multi_backend_add(struct wlr_backend *multi, + struct wlr_backend *backend); + +#endif diff --git a/include/wlr/render.h b/include/wlr/render.h index 88aa615e..3c0bd04b 100644 --- a/include/wlr/render.h +++ b/include/wlr/render.h @@ -29,6 +29,16 @@ struct wlr_surface *wlr_render_surface_init(struct wlr_renderer *r); bool wlr_render_with_matrix(struct wlr_renderer *r, struct wlr_surface *surface, const float (*matrix)[16]); /** + * Renders a solid quad in the specified color. + */ +void wlr_render_colored_quad(struct wlr_renderer *r, + const float (*color)[4], const float (*matrix)[16]); +/** + * Renders a solid ellipse in the specified color. + */ +void wlr_render_colored_ellipse(struct wlr_renderer *r, + const float (*color)[4], const float (*matrix)[16]); +/** * Destroys this wlr_renderer. Surfaces must be destroyed separately. */ void wlr_renderer_destroy(struct wlr_renderer *renderer); diff --git a/include/wlr/render/interface.h b/include/wlr/render/interface.h index 80471ac8..a934f49e 100644 --- a/include/wlr/render/interface.h +++ b/include/wlr/render/interface.h @@ -19,6 +19,10 @@ struct wlr_renderer_impl { struct wlr_surface *(*surface_init)(struct wlr_renderer_state *state); bool (*render_with_matrix)(struct wlr_renderer_state *state, struct wlr_surface *surface, const float (*matrix)[16]); + void (*render_quad)(struct wlr_renderer_state *state, + const float (*color)[4], const float (*matrix)[16]); + void (*render_ellipse)(struct wlr_renderer_state *state, + const float (*color)[4], const float (*matrix)[16]); void (*destroy)(struct wlr_renderer_state *state); }; diff --git a/include/wlr/session.h b/include/wlr/session.h index bd5a96c0..28ccb526 100644 --- a/include/wlr/session.h +++ b/include/wlr/session.h @@ -22,7 +22,7 @@ struct wlr_session { struct wlr_session *wlr_session_start(struct wl_display *disp); void wlr_session_finish(struct wlr_session *session); int wlr_session_open_file(struct wlr_session *restrict session, - const char *restrict path); + const char *restrict path); void wlr_session_close_file(struct wlr_session *session, int fd); bool wlr_session_change_vt(struct wlr_session *session, int vt); diff --git a/include/wlr/session/interface.h b/include/wlr/session/interface.h index 78256dd6..f75acfa4 100644 --- a/include/wlr/session/interface.h +++ b/include/wlr/session/interface.h @@ -7,7 +7,7 @@ struct session_impl { struct wlr_session *(*start)(struct wl_display *disp); void (*finish)(struct wlr_session *session); int (*open)(struct wlr_session *restrict session, - const char *restrict path); + const char *restrict path); void (*close)(struct wlr_session *session, int fd); bool (*change_vt)(struct wlr_session *session, int vt); }; diff --git a/include/wlr/types.h b/include/wlr/types.h index 51ea45cf..3afc361e 100644 --- a/include/wlr/types.h +++ b/include/wlr/types.h @@ -46,8 +46,245 @@ 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); +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; +}; + +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; +}; + +// TODO: tablet pad +// TODO: switch + +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; + }; +}; + #endif |