From 7873a0f13c4d2c1f89e44adc261fe6d5082ffd80 Mon Sep 17 00:00:00 2001 From: Samuel Grahn Date: Sun, 3 Feb 2019 03:38:44 +0100 Subject: [PATCH] Implement remaining actions, split touch for different seats --- include/sway/commands.h | 6 +++ include/sway/config.h | 12 ++++++ include/sway/input/cursor.h | 2 +- sway/commands/touch.c | 1 + sway/commands/touch/binding.c | 2 + sway/commands/touch/gesture.c | 5 +++ sway/commands/touch/gesture/delay.c | 33 ++++++++++++++++ sway/commands/touch/gesture/pinch.c | 40 ++++++++++++++++++++ sway/commands/touch/gesture/rotate.c | 40 ++++++++++++++++++++ sway/commands/touch/gesture/swipe.c | 45 ++++++++++++++++++++++ sway/commands/touch/gesture/target.c | 38 +++++++++++++++++++ sway/commands/touch/gesture/threshold.c | 1 + sway/commands/touch/gesture/touch.c | 4 +- sway/commands/touch/target.c | 50 +++++++++++++++++++++++++ sway/config.c | 5 ++- sway/config/gesture.c | 5 ++- sway/config/target.c | 41 ++++++++++++++++++++ sway/input/cursor.c | 49 +++++++++++++++++------- sway/input/seat.c | 15 +++++++- sway/meson.build | 11 +++++- 20 files changed, 385 insertions(+), 20 deletions(-) create mode 100644 sway/commands/touch/gesture/delay.c create mode 100644 sway/commands/touch/gesture/pinch.c create mode 100644 sway/commands/touch/gesture/rotate.c create mode 100644 sway/commands/touch/gesture/swipe.c create mode 100644 sway/commands/touch/gesture/target.c create mode 100644 sway/commands/touch/target.c create mode 100644 sway/config/target.c diff --git a/include/sway/commands.h b/include/sway/commands.h index 3e7a03eb3..5883fa925 100644 --- a/include/sway/commands.h +++ b/include/sway/commands.h @@ -282,9 +282,15 @@ sway_cmd seat_cmd_pointer_constraint; sway_cmd touch_cmd_gesture; sway_cmd touch_cmd_binding; +sway_cmd touch_cmd_target; sway_cmd touch_gesture_cmd_touch; sway_cmd touch_gesture_cmd_threshold; +sway_cmd touch_gesture_cmd_target; +sway_cmd touch_gesture_cmd_swipe; +sway_cmd touch_gesture_cmd_pinch; +sway_cmd touch_gesture_cmd_rotate; +sway_cmd touch_gesture_cmd_delay; sway_cmd cmd_ipc_cmd; sway_cmd cmd_ipc_events; diff --git a/include/sway/config.h b/include/sway/config.h index d8f8189d3..abaf7439c 100644 --- a/include/sway/config.h +++ b/include/sway/config.h @@ -106,6 +106,11 @@ struct gesture_config { char *command; }; +struct gesture_target_config { + char *identifier; + struct libtouch_target *target; +}; + /** * options for input devices @@ -428,6 +433,7 @@ struct sway_config { list_t *input_configs; list_t *input_type_configs; list_t *gesture_configs; + list_t *gesture_target_configs; list_t *seat_configs; list_t *criteria; list_t *no_focus; @@ -658,10 +664,16 @@ int gesture_identifier_cmp(const void *item, const void *data); int gesture_libtouch_cmp(const void *item, const void *data); +int gesture_target_identifier_cmp(const void *item, const void *data); + struct gesture_config *get_gesture_config(const char *identifier); struct gesture_config *new_gesture_config(const char *identifier); +struct gesture_target_config *get_gesture_target_config(const char* identifier); + +struct gesture_target_config *create_gesture_target_config(const char* identifier); + /** * Updates the value of config->font_height based on the max title height * reported by each container. If recalculate is true, the containers will diff --git a/include/sway/input/cursor.h b/include/sway/input/cursor.h index 1e06c4c31..2185bc601 100644 --- a/include/sway/input/cursor.h +++ b/include/sway/input/cursor.h @@ -36,7 +36,7 @@ struct sway_cursor { struct wl_listener axis; struct wl_listener frame; - struct libtouch_engine *gesture_engine; + struct libtouch_progress_tracker *gesture_tracker; struct wl_listener touch_down; struct wl_listener touch_up; struct wl_listener touch_motion; diff --git a/sway/commands/touch.c b/sway/commands/touch.c index 0b08aa09b..b0df71f3a 100644 --- a/sway/commands/touch.c +++ b/sway/commands/touch.c @@ -14,6 +14,7 @@ static struct cmd_handler touch_handlers[] = { { "binding", touch_cmd_binding }, { "gesture", touch_cmd_gesture }, + { "target", touch_cmd_target }, }; diff --git a/sway/commands/touch/binding.c b/sway/commands/touch/binding.c index dacd26601..3ff92dda6 100644 --- a/sway/commands/touch/binding.c +++ b/sway/commands/touch/binding.c @@ -23,6 +23,8 @@ struct cmd_results *touch_cmd_binding(int argc, char **argv) { return cmd_results_new(CMD_FAILURE, "Unable to bind gesture %s", argv[0]); } + sway_log(SWAY_DEBUG, "libtouch: Bound gesture %s", argv[0]); + config->command = join_args(argv + 1, argc - 1); return cmd_results_new(CMD_SUCCESS, NULL); diff --git a/sway/commands/touch/gesture.c b/sway/commands/touch/gesture.c index 4450a2764..b2f44c3f6 100644 --- a/sway/commands/touch/gesture.c +++ b/sway/commands/touch/gesture.c @@ -11,6 +11,11 @@ #include static struct cmd_handler gesture_handlers[] = { + { "delay", touch_gesture_cmd_delay }, + { "pinch", touch_gesture_cmd_pinch }, + { "rotate", touch_gesture_cmd_rotate }, + { "swipe", touch_gesture_cmd_swipe }, + { "target", touch_gesture_cmd_target }, { "threshold", touch_gesture_cmd_threshold }, { "touch", touch_gesture_cmd_touch }, }; diff --git a/sway/commands/touch/gesture/delay.c b/sway/commands/touch/gesture/delay.c new file mode 100644 index 000000000..9487ad9cc --- /dev/null +++ b/sway/commands/touch/gesture/delay.c @@ -0,0 +1,33 @@ +#define _POSIX_C_SOURCE 200809L +#include +#include +#include +#include "sway/commands.h" +#include "sway/config.h" +#include "sway/ipc-server.h" +#include "list.h" +#include "log.h" +#include "stringop.h" +#include + +struct cmd_results *touch_gesture_cmd_delay(int argc, char **argv) { + struct cmd_results *error = NULL; + if((error = checkarg(argc, "touch", EXPECTED_EQUAL_TO, 1))) { + return error; + } + + uint32_t mode = atoi(argv[0]); + + if(!config->handler_context.current_gesture) { + return cmd_results_new(CMD_FAILURE, "No current gesture"); + } else if (!config->handler_context.current_gesture->gesture) { + return cmd_results_new(CMD_FAILURE, "No gesture in gesture config"); + } + struct libtouch_gesture *gesture = config->handler_context.current_gesture->gesture; + + struct libtouch_action *action = libtouch_gesture_add_delay(gesture, mode); + + config->handler_context.current_gesture_action = action; + + return cmd_results_new(CMD_SUCCESS, "Created new delay"); +}; diff --git a/sway/commands/touch/gesture/pinch.c b/sway/commands/touch/gesture/pinch.c new file mode 100644 index 000000000..eecad421a --- /dev/null +++ b/sway/commands/touch/gesture/pinch.c @@ -0,0 +1,40 @@ +#define _POSIX_C_SOURCE 200809L +#include +#include +#include +#include "sway/commands.h" +#include "sway/config.h" +#include "sway/ipc-server.h" +#include "list.h" +#include "log.h" +#include "stringop.h" +#include + +struct cmd_results *touch_gesture_cmd_pinch(int argc, char **argv) { + struct cmd_results *error = NULL; + if((error = checkarg(argc, "pinch", EXPECTED_EQUAL_TO, 1))) { + return error; + } + + uint32_t mode; + if(strcmp(argv[0],"in") == 0) { + mode = LIBTOUCH_PINCH_IN; + } else if (strcmp(argv[0],"out") == 0) { + mode = LIBTOUCH_PINCH_OUT; + } else { + return cmd_results_new(CMD_FAILURE, "pinch: %s is not in or out", argv[0]); + } + + if(!config->handler_context.current_gesture) { + return cmd_results_new(CMD_FAILURE, "No current gesture"); + } else if (!config->handler_context.current_gesture->gesture) { + return cmd_results_new(CMD_FAILURE, "No gesture in gesture config"); + } + struct libtouch_gesture *gesture = config->handler_context.current_gesture->gesture; + + struct libtouch_action *action = libtouch_gesture_add_pinch(gesture, mode); + + config->handler_context.current_gesture_action = action; + + return cmd_results_new(CMD_SUCCESS, "Created new touch"); +}; diff --git a/sway/commands/touch/gesture/rotate.c b/sway/commands/touch/gesture/rotate.c new file mode 100644 index 000000000..0efabdda8 --- /dev/null +++ b/sway/commands/touch/gesture/rotate.c @@ -0,0 +1,40 @@ +#define _POSIX_C_SOURCE 200809L +#include +#include +#include +#include "sway/commands.h" +#include "sway/config.h" +#include "sway/ipc-server.h" +#include "list.h" +#include "log.h" +#include "stringop.h" +#include + +struct cmd_results *touch_gesture_cmd_rotate(int argc, char **argv) { + struct cmd_results *error = NULL; + if((error = checkarg(argc, "rotate", EXPECTED_EQUAL_TO, 1))) { + return error; + } + + uint32_t mode; + if(strcmp(argv[0],"clockwise") == 0) { + mode = LIBTOUCH_ROTATE_CLOCKWISE; + } else if (strcmp(argv[0],"counterclockwise") == 0) { + mode = LIBTOUCH_ROTATE_ANTICLOCKWISE; + } else { + return cmd_results_new(CMD_FAILURE, "rotate %s is not (anti)clockwise", argv[0]); + } + + if(!config->handler_context.current_gesture) { + return cmd_results_new(CMD_FAILURE, "No current gesture"); + } else if (!config->handler_context.current_gesture->gesture) { + return cmd_results_new(CMD_FAILURE, "No gesture in gesture config"); + } + struct libtouch_gesture *gesture = config->handler_context.current_gesture->gesture; + + struct libtouch_action *action = libtouch_gesture_add_rotate(gesture, mode); + + config->handler_context.current_gesture_action = action; + + return cmd_results_new(CMD_SUCCESS, "Created new rotation"); +}; diff --git a/sway/commands/touch/gesture/swipe.c b/sway/commands/touch/gesture/swipe.c new file mode 100644 index 000000000..4d5e61574 --- /dev/null +++ b/sway/commands/touch/gesture/swipe.c @@ -0,0 +1,45 @@ +#define _POSIX_C_SOURCE 200809L +#include +#include +#include +#include "sway/commands.h" +#include "sway/config.h" +#include "sway/ipc-server.h" +#include "list.h" +#include "log.h" +#include "stringop.h" +#include + +struct cmd_results *touch_gesture_cmd_swipe(int argc, char **argv) { + struct cmd_results *error = NULL; + if((error = checkarg(argc, "swipe", EXPECTED_EQUAL_TO, 1))) { + return error; + } + + uint32_t direction = 0; + if (strstr(argv[0], "west")) { + direction |= LIBTOUCH_MOVE_NEGATIVE_X; + } + if (strstr(argv[0], "east")) { + direction |= LIBTOUCH_MOVE_POSITIVE_X; + } + if (strstr(argv[0], "north")) { + direction |= LIBTOUCH_MOVE_POSITIVE_Y; + } + if (strstr(argv[0], "south")) { + direction |= LIBTOUCH_MOVE_NEGATIVE_Y; + } + + sway_log(SWAY_DEBUG, "Direction: %d", direction); + if (direction == 0) { + return cmd_results_new(CMD_FAILURE, "Direction %s invalid", argv[0]); + } + + struct libtouch_gesture *gesture = config->handler_context.current_gesture->gesture; + + struct libtouch_action *action = libtouch_gesture_add_move(gesture, direction); + + config->handler_context.current_gesture_action = action; + + return cmd_results_new(CMD_SUCCESS, "Created new swipe"); +} diff --git a/sway/commands/touch/gesture/target.c b/sway/commands/touch/gesture/target.c new file mode 100644 index 000000000..3262e25ee --- /dev/null +++ b/sway/commands/touch/gesture/target.c @@ -0,0 +1,38 @@ +#define _POSIX_C_SOURCE 200809L +#include +#include +#include +#include "sway/commands.h" +#include "sway/config.h" +#include "sway/ipc-server.h" +#include "list.h" +#include "log.h" +#include "stringop.h" +#include + +struct cmd_results *touch_gesture_cmd_target(int argc, char **argv) { + struct cmd_results *error = NULL; + if((error = checkarg(argc, "target", EXPECTED_AT_LEAST, 1))) { + return error; + } + + struct gesture_target_config *target = get_gesture_target_config(argv[0]); + + if(!target) { + return cmd_results_new(CMD_FAILURE, "Could not find gesture target %s", argv[0]); + } + + if(!config->handler_context.current_gesture_action) { + return cmd_results_new(CMD_FAILURE, + "No action created for target %s", argv[0]); + + } + + libtouch_action_set_target( + config->handler_context.current_gesture_action, + target->target); + + return cmd_results_new(CMD_SUCCESS, "Bound target %s to action", argv[0]); + + +} diff --git a/sway/commands/touch/gesture/threshold.c b/sway/commands/touch/gesture/threshold.c index c0510e147..912302194 100644 --- a/sway/commands/touch/gesture/threshold.c +++ b/sway/commands/touch/gesture/threshold.c @@ -25,6 +25,7 @@ struct cmd_results *touch_gesture_cmd_threshold(int argc, char **argv) { return cmd_results_new(CMD_INVALID, "Invalid threshold: %s", argv[0]); } + sway_log(SWAY_DEBUG, "Set threshold %d", threshold); libtouch_action_set_threshold(current, threshold); return cmd_results_new(CMD_SUCCESS, "Set threshold"); diff --git a/sway/commands/touch/gesture/touch.c b/sway/commands/touch/gesture/touch.c index 546d1f443..447f4a9b6 100644 --- a/sway/commands/touch/gesture/touch.c +++ b/sway/commands/touch/gesture/touch.c @@ -33,8 +33,8 @@ struct cmd_results *touch_gesture_cmd_touch(int argc, char **argv) { struct libtouch_gesture *gesture = config->handler_context.current_gesture->gesture; struct libtouch_action *action = libtouch_gesture_add_touch(gesture, mode); - + config->handler_context.current_gesture_action = action; - return cmd_results_new(CMD_SUCCESS, "Created new action"); + return cmd_results_new(CMD_SUCCESS, "Created new touch"); }; diff --git a/sway/commands/touch/target.c b/sway/commands/touch/target.c new file mode 100644 index 000000000..bdbdfd0c2 --- /dev/null +++ b/sway/commands/touch/target.c @@ -0,0 +1,50 @@ +#define _POSIX_C_SOURCE 200809L +#include +#include +#include +#include "sway/commands.h" +#include "sway/config.h" +#include "sway/ipc-server.h" +#include "list.h" +#include "log.h" +#include "stringop.h" +#include + +struct cmd_results *touch_cmd_target(int argc, char **argv) { + struct cmd_results *error = NULL; + if ((error = checkarg(argc, "target", EXPECTED_EQUAL_TO, 5))) { + return error; + } + sway_log(SWAY_DEBUG, "Trying to convert"); + double x = atoi(argv[1]); + double y = atoi(argv[2]); + double w = atoi(argv[3]); + double h = atoi(argv[4]); + sway_log(SWAY_DEBUG, "Converted: %f, %f, %f, %f", x,y,w,h); + + if(!config->gesture_engine) { + return cmd_results_new(CMD_FAILURE, "No engine exists!"); + } + + struct gesture_target_config *conf = get_gesture_target_config(argv[0]); + + if(!conf) { + return cmd_results_new(CMD_FAILURE, "Could not create target: %s", argv[0]); + } + + if(conf->target != NULL) { + return cmd_results_new(CMD_FAILURE, "target %s already bound", argv[0]); + } + + struct libtouch_target *target = libtouch_target_create(config->gesture_engine, x,y,w,h); + + if(!target) { + return cmd_results_new(CMD_FAILURE, "Could not create target"); + } + + conf->target = target; + + + return cmd_results_new(CMD_SUCCESS, "Created target: %s", argv[0]); + +}; diff --git a/sway/config.c b/sway/config.c index e14ea83a8..4ae828c40 100644 --- a/sway/config.c +++ b/sway/config.c @@ -30,6 +30,7 @@ #include "stringop.h" #include "list.h" #include "log.h" +#include struct sway_config *config = NULL; @@ -188,7 +189,8 @@ static void config_defaults(struct sway_config *config) { "--button-no-terminal 'Exit sway' 'swaymsg exit' " "--button-no-terminal 'Reload sway' 'swaymsg reload'"; config->swaynag_config_errors.detailed = true; - + if (!(config->gesture_configs = create_list())) goto cleanup; + if (!(config->gesture_target_configs = create_list())) goto cleanup; if (!(config->symbols = create_list())) goto cleanup; if (!(config->modes = create_list())) goto cleanup; if (!(config->bars = create_list())) goto cleanup; @@ -312,6 +314,7 @@ static void config_defaults(struct sway_config *config) { set_color(config->border_colors.background, 0xFFFFFF); + config->gesture_engine = libtouch_engine_create(); // Security if (!(config->command_policies = create_list())) goto cleanup; if (!(config->feature_policies = create_list())) goto cleanup; diff --git a/sway/config/gesture.c b/sway/config/gesture.c index 5514098c5..ddcdf23c5 100644 --- a/sway/config/gesture.c +++ b/sway/config/gesture.c @@ -40,5 +40,8 @@ int gesture_identifier_cmp(const void *item, const void *data) { int gesture_libtouch_cmp(const void *item, const void *data) { const struct gesture_config *gc = item; const struct libtouch_gesture *g = data; - return gc->gesture == g; + if(gc->gesture == g) + return 0; + else + return -1; } diff --git a/sway/config/target.c b/sway/config/target.c new file mode 100644 index 000000000..5e2c33737 --- /dev/null +++ b/sway/config/target.c @@ -0,0 +1,41 @@ +#define _POSIX_C_SOURCE 200809L +#include +#include +#include +#include "sway/config.h" +#include "log.h" +#include + +struct gesture_target_config *get_gesture_target_config(const char* identifier) { + int i = list_seq_find(config->gesture_target_configs, gesture_target_identifier_cmp, identifier); + struct gesture_target_config *cfg = NULL; + if(i >= 0) { + cfg = config->gesture_target_configs->items[i]; + } else { + cfg = create_gesture_target_config(identifier); + list_add(config->gesture_target_configs, cfg); + } + + return cfg; +} + +struct gesture_target_config *create_gesture_target_config(const char* identifier) { + int i = list_seq_find(config->gesture_target_configs, gesture_target_identifier_cmp, identifier); + if(i >= 0) { + sway_log(SWAY_DEBUG, "Gesture target %s already created", identifier); + return NULL; + } + + struct gesture_target_config *cfg = calloc(sizeof(struct gesture_target_config), 1); + cfg->identifier = strdup(identifier); + + return cfg; +} + + +int gesture_target_identifier_cmp(const void *item, const void *data) { + const struct gesture_target_config *tc = item; + const char* identifier = data; + + return strcmp(identifier, tc->identifier); +} diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 376891e60..0e79398d0 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -332,19 +332,32 @@ static void handle_cursor_frame(struct wl_listener *listener, void *data) { wlr_seat_pointer_notify_frame(cursor->seat->wlr_seat); } -static void handle_gestures(struct libtouch_engine *engine, struct sway_seat *seat) { +static void handle_gestures(struct libtouch_progress_tracker *tracker, struct sway_seat *seat) { struct libtouch_gesture *complete; struct gesture_config *cfg; int idx; - while((complete = libtouch_handle_finished_gesture(engine))){ + cfg = (struct gesture_config*) config->gesture_configs->items[0]; + sway_log(SWAY_DEBUG, "Tracking %d gestures", libtouch_progress_tracker_n_gestures(tracker)); + for(uint32_t i = 0; i < libtouch_progress_tracker_n_gestures(tracker); i++) { + sway_log(SWAY_DEBUG, "Progress %d: %f", i, libtouch_gesture_progress_get_progress(libtouch_gesture_get_progress(tracker, i))); + } + while((complete = libtouch_handle_finished_gesture(tracker)) != NULL){ + + idx = list_seq_find(config->gesture_configs, gesture_libtouch_cmp, complete); if(idx >= 0) { + sway_log(SWAY_DEBUG, "Completed gesture %s", cfg->identifier); cfg = config->gesture_configs->items[idx]; + if(cfg->command) { - execute_command(cfg->command, seat, seat_get_focused_container(seat)); + execute_command(cfg->command, seat, NULL); } + } else { + sway_log(SWAY_DEBUG, "Gesture unbound!"); } } + + } static void handle_touch_down(struct wl_listener *listener, void *data) { @@ -365,6 +378,13 @@ static void handle_touch_down(struct wl_listener *listener, void *data) { seat->touch_x = lx; seat->touch_y = ly; + + sway_log(SWAY_DEBUG, "Touch pos: (%f, %f)", lx,ly); + libtouch_progress_register_touch(cursor->gesture_tracker, event->time_msec, + event->touch_id, LIBTOUCH_TOUCH_DOWN, + lx, ly); + handle_gestures(cursor->gesture_tracker, seat); + if (!surface) { return; } @@ -375,10 +395,7 @@ static void handle_touch_down(struct wl_listener *listener, void *data) { event->touch_id, sx, sy); cursor_set_image(cursor, NULL, NULL); } - libtouch_engine_register_touch(cursor->gesture_engine, event->time_msec, - event->touch_id, LIBTOUCH_TOUCH_DOWN, - event->x, event->y); - handle_gestures(cursor->gesture_engine, seat); + } @@ -389,9 +406,10 @@ static void handle_touch_up(struct wl_listener *listener, void *data) { struct wlr_seat *seat = cursor->seat->wlr_seat; // TODO: fall back to cursor simulation if client has not bound to touch wlr_seat_touch_notify_up(seat, event->time_msec, event->touch_id); - libtouch_engine_register_touch(cursor->gesture_engine, event->time_msec, + + libtouch_progress_register_touch(cursor->gesture_tracker, event->time_msec, event->touch_id, LIBTOUCH_TOUCH_UP, 0, 0); - handle_gestures(cursor->gesture_engine, cursor->seat); + handle_gestures(cursor->gesture_tracker, cursor->seat); } static void handle_touch_motion(struct wl_listener *listener, void *data) { @@ -403,12 +421,20 @@ static void handle_touch_motion(struct wl_listener *listener, void *data) { struct wlr_seat *wlr_seat = seat->wlr_seat; struct wlr_surface *surface = NULL; + double lx, ly; wlr_cursor_absolute_to_layout_coords(cursor->cursor, event->device, event->x, event->y, &lx, &ly); double sx, sy; node_at_coords(cursor->seat, lx, ly, &surface, &sx, &sy); + + sway_log(SWAY_DEBUG, "move gesture"); + libtouch_progress_register_move(cursor->gesture_tracker, event->time_msec, + event->touch_id, lx,ly); + + handle_gestures(cursor->gesture_tracker, seat); + if (seat->touch_id == event->touch_id) { seat->touch_x = lx; seat->touch_y = ly; @@ -430,10 +456,7 @@ static void handle_touch_motion(struct wl_listener *listener, void *data) { wlr_seat_touch_notify_motion(wlr_seat, event->time_msec, event->touch_id, sx, sy); } - libtouch_engine_register_move(cursor->gesture_engine, event->time_msec, - event->touch_id, event->x, event->y); - - handle_gestures(cursor->gesture_engine, seat); + } diff --git a/sway/input/seat.c b/sway/input/seat.c index ce009d7e4..de2352c8a 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -24,6 +24,7 @@ #include "sway/tree/root.h" #include "sway/tree/view.h" #include "sway/tree/workspace.h" +#include static void seat_device_destroy(struct sway_seat_device *seat_device) { if (!seat_device) { @@ -599,8 +600,11 @@ static void seat_configure_touch(struct sway_seat *seat, wlr_cursor_attach_input_device(seat->cursor->cursor, sway_device->input_device->wlr_device); seat_apply_input_config(seat, sway_device); + + } + static void seat_configure_tablet_tool(struct sway_seat *seat, struct sway_seat_device *sway_device) { seat_configure_xcursor(seat); @@ -1189,7 +1193,16 @@ void seat_apply_config(struct sway_seat *seat, wl_list_for_each(seat_device, &seat->devices, link) { seat_configure_device(seat, seat_device->input_device); } - + if(config->gesture_engine) { + sway_log(SWAY_DEBUG, "gesture engine exists"); + if(seat->cursor->gesture_tracker) { + free(seat->cursor->gesture_tracker); + } + sway_log(SWAY_DEBUG, "Gesture progress tracker created"); + seat->cursor->gesture_tracker = libtouch_progress_tracker_create( + config->gesture_engine); + + } cursor_handle_activity(seat->cursor); } diff --git a/sway/meson.build b/sway/meson.build index 3c6ce0385..f4e2cb8ec 100644 --- a/sway/meson.build +++ b/sway/meson.build @@ -37,7 +37,8 @@ sway_sources = files( 'config/seat.c', 'config/input.c', 'config/gesture.c', - + 'config/target.c', + 'commands/assign.c', 'commands/bar.c', 'commands/bind.c', @@ -179,8 +180,16 @@ sway_sources = files( 'commands/touch/binding.c', 'commands/touch/gesture.c', + 'commands/touch/target.c', 'commands/touch/gesture/touch.c', 'commands/touch/gesture/threshold.c', + 'commands/touch/gesture/target.c', + 'commands/touch/gesture/swipe.c', + 'commands/touch/gesture/rotate.c', + 'commands/touch/gesture/pinch.c', + 'commands/touch/gesture/delay.c', + + 'tree/arrange.c', 'tree/container.c',