wlr-seat: basic touch

This commit is contained in:
Tony Crisci 2017-11-12 11:43:50 -05:00
parent 0fe51b66e4
commit e5a31ae870
8 changed files with 217 additions and 43 deletions

View file

@ -39,7 +39,6 @@ struct roots_cursor {
uint32_t resize_edges;
// Ring buffer of input events that could trigger move/resize/rotate
int input_events_idx;
struct wl_list touch_points;
struct roots_input_event input_events[16];
struct wl_listener motion;

View file

@ -43,13 +43,6 @@ struct roots_touch {
struct wl_list link;
};
struct roots_touch_point {
struct roots_touch *device;
int32_t slot;
double x, y;
struct wl_list link;
};
struct roots_tablet_tool {
struct roots_seat *seat;
struct wlr_input_device *device;

View file

@ -126,4 +126,11 @@ void wlr_cursor_map_to_region(struct wlr_cursor *cur, struct wlr_box *box);
void wlr_cursor_map_input_to_region(struct wlr_cursor *cur,
struct wlr_input_device *dev, struct wlr_box *box);
/**
* Convert absolute coordinates to layout coordinates for the device.
*/
bool wlr_cursor_absolute_to_layout_coords(struct wlr_cursor *cur,
struct wlr_input_device *device, double x_mm, double y_mm,
double width_mm, double height_mm, double *lx, double *ly);
#endif

View file

@ -103,6 +103,23 @@ struct wlr_seat_keyboard_state {
struct wlr_seat_keyboard_grab *default_grab;
};
struct wlr_touch_point {
int32_t touch_id;
struct wlr_surface *surface;
struct wlr_seat_client *client;
double sx, sy;
struct wl_listener surface_destroy;
struct wl_listener resource_destroy;
struct wl_list link;
};
struct wlr_seat_touch_state {
struct wlr_seat *seat;
struct wl_list touch_points; // wlr_touch_point::link
};
struct wlr_seat {
struct wl_global *wl_global;
struct wl_display *display;
@ -117,6 +134,7 @@ struct wlr_seat {
struct wlr_seat_pointer_state pointer_state;
struct wlr_seat_keyboard_state keyboard_state;
struct wlr_seat_touch_state touch_state;
struct wl_listener selection_data_source_destroy;
@ -328,4 +346,17 @@ void wlr_seat_keyboard_clear_focus(struct wlr_seat *wlr_seat);
// TODO: May be useful to be able to simulate keyboard input events
struct wlr_touch_point *wlr_seat_touch_get_point(struct wlr_seat *seat,
int32_t touch_id);
void wlr_seat_touch_notify_down(struct wlr_seat *seat,
struct wlr_surface *surface, uint32_t time, int32_t touch_id, double sx,
double sy);
void wlr_seat_touch_notify_up(struct wlr_seat *seat, uint32_t time,
int32_t touch_id);
void wlr_seat_touch_notify_motion(struct wlr_seat *seat, uint32_t time,
int32_t touch_id, double sx, double sy);
#endif