2017-09-23 02:24:32 +02:00
|
|
|
#ifndef _ROOTSTON_INPUT_H
|
|
|
|
#define _ROOTSTON_INPUT_H
|
|
|
|
#include <xkbcommon/xkbcommon.h>
|
|
|
|
#include <wayland-server.h>
|
|
|
|
#include <wlr/types/wlr_input_device.h>
|
|
|
|
#include <wlr/types/wlr_cursor.h>
|
|
|
|
#include <wlr/types/wlr_seat.h>
|
|
|
|
#include <wlr/xcursor.h>
|
2017-09-23 16:13:05 +02:00
|
|
|
#include "rootston/config.h"
|
2017-09-23 02:24:32 +02:00
|
|
|
#include "rootston/view.h"
|
2017-09-23 16:36:32 +02:00
|
|
|
#include "rootston/server.h"
|
2017-09-23 02:24:32 +02:00
|
|
|
|
|
|
|
struct roots_keyboard {
|
|
|
|
struct roots_input *input;
|
|
|
|
struct wlr_input_device *device;
|
|
|
|
struct wl_listener key;
|
|
|
|
struct wl_list link;
|
|
|
|
struct xkb_keymap *keymap;
|
|
|
|
struct xkb_state *xkb_state;
|
|
|
|
xkb_led_index_t leds[WLR_LED_LAST];
|
|
|
|
int keymap_fd;
|
|
|
|
size_t keymap_size;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct roots_pointer {
|
|
|
|
struct roots_input *input;
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct roots_touch {
|
|
|
|
struct roots_input *input;
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
|
|
|
// TODO: tablet pad
|
|
|
|
struct roots_tablet_tool {
|
|
|
|
struct roots_input *input;
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum roots_cursor_mode {
|
2017-09-23 16:13:05 +02:00
|
|
|
ROOTS_CURSOR_PASSTHROUGH = 0,
|
|
|
|
ROOTS_CURSOR_MOVE = 1,
|
|
|
|
ROOTS_CURSOR_RESIZE = 2,
|
|
|
|
ROOTS_CURSOR_ROTATE = 3,
|
2017-09-23 02:24:32 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct roots_input_event {
|
|
|
|
uint32_t serial;
|
|
|
|
struct wlr_cursor *cursor;
|
|
|
|
struct wlr_input_device *device;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct roots_input {
|
2017-09-23 16:13:05 +02:00
|
|
|
struct roots_config *config;
|
|
|
|
|
2017-09-23 02:24:32 +02:00
|
|
|
// TODO: multiseat, multicursor
|
|
|
|
struct wlr_cursor *cursor;
|
|
|
|
struct wlr_xcursor *xcursor;
|
|
|
|
struct wlr_seat *wl_seat;
|
|
|
|
|
|
|
|
enum roots_cursor_mode mode;
|
2017-09-23 16:13:05 +02:00
|
|
|
struct roots_view *active_view;
|
2017-09-23 02:24:32 +02:00
|
|
|
int offs_x, offs_y;
|
|
|
|
|
|
|
|
// Ring buffer of input events that could trigger move/resize/rotate
|
|
|
|
int input_events_idx;
|
|
|
|
struct roots_input_event input_events[16];
|
|
|
|
|
|
|
|
struct wl_list keyboards;
|
|
|
|
struct wl_list pointers;
|
|
|
|
struct wl_list touch;
|
|
|
|
struct wl_list tablet_tools;
|
2017-09-23 16:13:05 +02:00
|
|
|
|
|
|
|
struct wl_listener input_add;
|
|
|
|
struct wl_listener input_remove;
|
2017-09-23 02:24:32 +02:00
|
|
|
};
|
|
|
|
|
2017-09-23 16:13:05 +02:00
|
|
|
struct roots_input *input_create(struct roots_server *server,
|
|
|
|
struct roots_config *config);
|
|
|
|
void input_destroy(struct roots_input *input);
|
|
|
|
|
2017-09-23 16:36:32 +02:00
|
|
|
void pointer_add(struct wlr_input_device *device, struct roots_input *input);
|
|
|
|
|
2017-09-23 02:24:32 +02:00
|
|
|
#endif
|