diff options
| author | Greg V <greg@unrelenting.technology> | 2019-01-26 01:51:38 +0300 | 
|---|---|---|
| committer | emersion <contact@emersion.fr> | 2019-01-28 22:06:36 +0100 | 
| commit | 9fe8e379613c42338920e913c6ffd6d1c273da67 (patch) | |
| tree | 51937a7d4827b20ffe27783e9b4ae26bdf7175f0 /rootston | |
| parent | 018727b1fc41dcd739ab464c84581c44dd1497ca (diff) | |
| download | wlroots-9fe8e379613c42338920e913c6ffd6d1c273da67.tar.xz | |
Implement the pointer-gestures-unstable-v1 protocol
This protocol relays touchpad gesture events produced by libinput to
supporting clients (e.g. Evince, Eye of GNOME).
Diffstat (limited to 'rootston')
| -rw-r--r-- | rootston/desktop.c | 2 | ||||
| -rw-r--r-- | rootston/seat.c | 79 | 
2 files changed, 81 insertions, 0 deletions
diff --git a/rootston/desktop.c b/rootston/desktop.c index d65266e5..fcb530cf 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -1084,6 +1084,8 @@ struct roots_desktop *desktop_create(struct roots_server *server,  		wlr_foreign_toplevel_manager_v1_create(server->wl_display);  	desktop->relative_pointer_manager =  		wlr_relative_pointer_manager_v1_create(server->wl_display); +	desktop->pointer_gestures = +		wlr_pointer_gestures_v1_create(server->wl_display);  	wlr_data_control_manager_v1_create(server->wl_display); diff --git a/rootston/seat.c b/rootston/seat.c index c69be8ab..a6281f50 100644 --- a/rootston/seat.c +++ b/rootston/seat.c @@ -85,6 +85,67 @@ static void handle_cursor_frame(struct wl_listener *listener, void *data) {  	roots_cursor_handle_frame(cursor);  } +static void handle_swipe_begin(struct wl_listener *listener, void *data) { +	struct roots_cursor *cursor = +		wl_container_of(listener, cursor, swipe_begin); +	struct wlr_pointer_gestures_v1 *gestures = +		cursor->seat->input->server->desktop->pointer_gestures; +	struct wlr_event_pointer_swipe_begin *event = data; +	wlr_pointer_gestures_v1_send_swipe_begin(gestures, cursor->seat->seat, +			event->time_msec, event->fingers); +} + +static void handle_swipe_update(struct wl_listener *listener, void *data) { +	struct roots_cursor *cursor = +		wl_container_of(listener, cursor, swipe_update); +	struct wlr_pointer_gestures_v1 *gestures = +		cursor->seat->input->server->desktop->pointer_gestures; +	struct wlr_event_pointer_swipe_update *event = data; +	wlr_pointer_gestures_v1_send_swipe_update(gestures, cursor->seat->seat, +			event->time_msec, event->dx, event->dy); +} + +static void handle_swipe_end(struct wl_listener *listener, void *data) { +	struct roots_cursor *cursor = +		wl_container_of(listener, cursor, swipe_end); +	struct wlr_pointer_gestures_v1 *gestures = +		cursor->seat->input->server->desktop->pointer_gestures; +	struct wlr_event_pointer_swipe_end *event = data; +	wlr_pointer_gestures_v1_send_swipe_end(gestures, cursor->seat->seat, +			event->time_msec, event->cancelled); +} + +static void handle_pinch_begin(struct wl_listener *listener, void *data) { +	struct roots_cursor *cursor = +		wl_container_of(listener, cursor, pinch_begin); +	struct wlr_pointer_gestures_v1 *gestures = +		cursor->seat->input->server->desktop->pointer_gestures; +	struct wlr_event_pointer_pinch_begin *event = data; +	wlr_pointer_gestures_v1_send_pinch_begin(gestures, cursor->seat->seat, +			event->time_msec, event->fingers); +} + +static void handle_pinch_update(struct wl_listener *listener, void *data) { +	struct roots_cursor *cursor = +		wl_container_of(listener, cursor, pinch_update); +	struct wlr_pointer_gestures_v1 *gestures = +		cursor->seat->input->server->desktop->pointer_gestures; +	struct wlr_event_pointer_pinch_update *event = data; +	wlr_pointer_gestures_v1_send_pinch_update(gestures, cursor->seat->seat, +			event->time_msec, event->dx, event->dy, +			event->scale, event->rotation); +} + +static void handle_pinch_end(struct wl_listener *listener, void *data) { +	struct roots_cursor *cursor = +		wl_container_of(listener, cursor, pinch_end); +	struct wlr_pointer_gestures_v1 *gestures = +		cursor->seat->input->server->desktop->pointer_gestures; +	struct wlr_event_pointer_pinch_end *event = data; +	wlr_pointer_gestures_v1_send_pinch_end(gestures, cursor->seat->seat, +			event->time_msec, event->cancelled); +} +  static void handle_switch_toggle(struct wl_listener *listener, void *data) {  	struct roots_switch *lid_switch =  		wl_container_of(listener, lid_switch, toggle); @@ -454,6 +515,24 @@ static void roots_seat_init_cursor(struct roots_seat *seat) {  	wl_signal_add(&wlr_cursor->events.frame, &seat->cursor->frame);  	seat->cursor->frame.notify = handle_cursor_frame; +	wl_signal_add(&wlr_cursor->events.swipe_begin, &seat->cursor->swipe_begin); +	seat->cursor->swipe_begin.notify = handle_swipe_begin; + +	wl_signal_add(&wlr_cursor->events.swipe_update, &seat->cursor->swipe_update); +	seat->cursor->swipe_update.notify = handle_swipe_update; + +	wl_signal_add(&wlr_cursor->events.swipe_end, &seat->cursor->swipe_end); +	seat->cursor->swipe_end.notify = handle_swipe_end; + +	wl_signal_add(&wlr_cursor->events.pinch_begin, &seat->cursor->pinch_begin); +	seat->cursor->pinch_begin.notify = handle_pinch_begin; + +	wl_signal_add(&wlr_cursor->events.pinch_update, &seat->cursor->pinch_update); +	seat->cursor->pinch_update.notify = handle_pinch_update; + +	wl_signal_add(&wlr_cursor->events.pinch_end, &seat->cursor->pinch_end); +	seat->cursor->pinch_end.notify = handle_pinch_end; +  	wl_signal_add(&wlr_cursor->events.touch_down, &seat->cursor->touch_down);  	seat->cursor->touch_down.notify = handle_touch_down;  | 
