diff options
author | nyorain <nyorain@gmail.com> | 2017-06-19 17:49:26 +0200 |
---|---|---|
committer | nyorain <nyorain@gmail.com> | 2017-06-19 17:49:26 +0200 |
commit | 41a477375cf5fc2cfafc97fb6d98e4e3457dfa62 (patch) | |
tree | 93e318287fb70b21dd0f5d7f90551810fa85a7dd /example/shared.h | |
parent | 904739c40596cb4e9e9d48c89b1d864051237441 (diff) | |
parent | 7e038a6110501a51e7f3d3366e8bc54a02766f22 (diff) |
Merge branch 'libinput' into wayland-backend
Diffstat (limited to 'example/shared.h')
-rw-r--r-- | example/shared.h | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/example/shared.h b/example/shared.h new file mode 100644 index 00000000..df456c91 --- /dev/null +++ b/example/shared.h @@ -0,0 +1,119 @@ +#ifndef _EXAMPLE_SHARED_H +#define _EXAMPLE_SHARED_H +#define _POSIX_C_SOURCE 199309L +#include <time.h> +#include <stdbool.h> +#include <xkbcommon/xkbcommon.h> +#include <wayland-server-protocol.h> +#include <wlr/backend.h> +#include <wlr/session.h> +#include <wlr/types.h> + +struct output_state { + struct compositor_state *compositor; + struct wlr_output *output; + struct wl_listener frame; + struct timespec last_frame; + struct wl_list link; + void *data; +}; + +struct keyboard_state { + struct compositor_state *compositor; + struct wlr_input_device *device; + struct wl_listener key; + struct wl_list link; + struct xkb_keymap *keymap; + struct xkb_state *xkb_state; + void *data; +}; + +struct pointer_state { + struct compositor_state *compositor; + struct wlr_input_device *device; + struct wl_listener motion; + struct wl_listener motion_absolute; + struct wl_listener button; + struct wl_listener axis; + struct wl_list link; + void *data; +}; + +struct touch_state { + struct compositor_state *compositor; + struct wlr_input_device *device; + struct wl_listener down; + struct wl_listener up; + struct wl_listener motion; + struct wl_listener cancel; + struct wl_list link; + void *data; +}; + +struct tablet_tool_state { + struct compositor_state *compositor; + struct wlr_input_device *device; + struct wl_listener axis; + struct wl_listener proximity; + struct wl_listener tip; + struct wl_listener button; + struct wl_list link; + void *data; +}; + +struct compositor_state { + void (*output_add_cb)(struct output_state *s); + void (*keyboard_add_cb)(struct keyboard_state *s); + void (*output_frame_cb)(struct output_state *s, struct timespec *ts); + void (*output_remove_cb)(struct output_state *s); + void (*keyboard_remove_cb)(struct keyboard_state *s); + void (*keyboard_key_cb)(struct keyboard_state *s, xkb_keysym_t sym, + enum wlr_key_state key_state); + void (*pointer_motion_cb)(struct pointer_state *s, + double d_x, double d_y); + void (*pointer_button_cb)(struct pointer_state *s, + uint32_t button, enum wlr_button_state state); + void (*pointer_axis_cb)(struct pointer_state *s, + enum wlr_axis_source source, + enum wlr_axis_orientation orientation, + double delta); + void (*touch_down_cb)(struct touch_state *s, int32_t slot, + double x, double y, double width, double height); + void (*touch_motion_cb)(struct touch_state *s, int32_t slot, + double x, double y, double width, double height); + void (*touch_up_cb)(struct touch_state *s, int32_t slot); + void (*touch_cancel_cb)(struct touch_state *s, int32_t slot); + void (*tool_axis_cb)(struct tablet_tool_state *s, + struct wlr_tablet_tool_axis *event); + void (*tool_proximity_cb)(struct tablet_tool_state *s, + enum wlr_tablet_tool_proximity_state proximity); + void (*tool_tip_cb)(struct tablet_tool_state *s, + enum wlr_tablet_tool_tip_state state); + void (*tool_button_cb)(struct tablet_tool_state *s, + uint32_t button, enum wlr_button_state state); + + struct wl_display *display; + struct wl_event_loop *event_loop; + struct wlr_backend *backend; + struct wlr_session *session; + + struct wl_list keyboards; + struct wl_list pointers; + struct wl_list touch; + struct wl_list tablet_tools; + struct wl_listener input_add; + struct wl_listener input_remove; + + struct timespec last_frame; + struct wl_listener output_add; + struct wl_listener output_remove; + struct wl_list outputs; + + bool exit; + void *data; +}; + +void compositor_init(struct compositor_state *state); +void compositor_run(struct compositor_state *state); + +#endif |