mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-31 22:25:21 -04:00
Initialize keyboards from libinput
This commit is contained in:
parent
019fff06be
commit
0e75d157f5
12 changed files with 338 additions and 51 deletions
|
|
@ -15,10 +15,14 @@ struct wlr_backend_state {
|
|||
struct libinput *libinput;
|
||||
struct wl_event_source *input_event;
|
||||
|
||||
list_t *devices;
|
||||
list_t *keyboards;
|
||||
};
|
||||
|
||||
void wlr_libinput_event(struct wlr_backend_state *state,
|
||||
struct libinput_event *event);
|
||||
|
||||
struct wlr_keyboard_state {
|
||||
struct libinput_device *handle;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -18,4 +18,25 @@ struct wlr_output *wlr_output_create(struct wlr_output_impl *impl,
|
|||
struct wlr_output_state *state);
|
||||
void wlr_output_free(struct wlr_output *output);
|
||||
|
||||
struct wlr_keyboard_impl {
|
||||
void (*destroy)(struct wlr_keyboard_state *state);
|
||||
};
|
||||
|
||||
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_input_device *wlr_input_device_create(
|
||||
enum wlr_input_device_type type, const char *name,
|
||||
int vendor, int product);
|
||||
void wlr_input_device_destroy(struct wlr_input_device *dev);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -50,4 +50,97 @@ void wlr_output_destroy(struct wlr_output *output);
|
|||
void wlr_output_effective_resolution(struct wlr_output *output,
|
||||
int *width, int *height);
|
||||
|
||||
// TODO: keymaps
|
||||
|
||||
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;
|
||||
struct wl_signal mods;
|
||||
} events;
|
||||
};
|
||||
|
||||
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 {
|
||||
double delta_x, delta_y;
|
||||
};
|
||||
|
||||
struct wlr_pointer_motion_absolute {
|
||||
double x_mm, y_mm;
|
||||
double width_mm, height_mm;
|
||||
};
|
||||
|
||||
enum wlr_button_state {
|
||||
WLR_BUTTON_DEPRESSED,
|
||||
WLR_BUTTON_RELEASED
|
||||
};
|
||||
|
||||
struct wlr_pointer_button {
|
||||
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 {
|
||||
enum wlr_axis_source source;
|
||||
enum wlr_axis_orientation orientation;
|
||||
double delta;
|
||||
};
|
||||
|
||||
// TODO: touch
|
||||
// TODO: tablet & tablet tool
|
||||
// TODO: gestures
|
||||
// TODO: switch
|
||||
|
||||
enum wlr_input_device_type {
|
||||
WLR_INPUT_DEVICE_KEYBOARD,
|
||||
WLR_INPUT_DEVICE_POINTER,
|
||||
WLR_INPUT_DEVICE_TOUCH,
|
||||
WLR_INPUT_DEVICE_TABLET_PEN,
|
||||
WLR_INPUT_DEVICE_TABLET_PAD,
|
||||
WLR_INPUT_DEVICE_GESTURE,
|
||||
WLR_INPUT_DEVICE_SWITCH,
|
||||
};
|
||||
|
||||
struct wlr_input_device {
|
||||
enum wlr_input_device_type type;
|
||||
int vendor, product;
|
||||
char *name;
|
||||
union {
|
||||
void *_device;
|
||||
struct wlr_keyboard *keyboard;
|
||||
struct wlr_pointer *pointer;
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue