diff --git a/include/sway/commands.h b/include/sway/commands.h index 599665bcf..815889eb4 100644 --- a/include/sway/commands.h +++ b/include/sway/commands.h @@ -185,6 +185,7 @@ sway_cmd cmd_titlebar_padding; sway_cmd cmd_unbindcode; sway_cmd cmd_unbindswitch; sway_cmd cmd_unbindsym; +sway_cmd cmd_touch; sway_cmd cmd_unmark; sway_cmd cmd_urgent; sway_cmd cmd_workspace; diff --git a/include/sway/config.h b/include/sway/config.h index 864105442..e285f2863 100644 --- a/include/sway/config.h +++ b/include/sway/config.h @@ -54,6 +54,11 @@ struct sway_binding { char *command; }; +struct sway_gesture_binding { + struct libtouch_gesture *gesture; + char *command; +}; + /** * A mouse binding and an associated command. */ @@ -91,6 +96,7 @@ struct sway_mode { list_t *keycode_bindings; list_t *mouse_bindings; list_t *switch_bindings; + list_t *gesture_bindings; bool pango; }; diff --git a/sway/commands.c b/sway/commands.c index c5d70242d..fffaf7bc8 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -93,6 +93,7 @@ static struct cmd_handler handlers[] = { { "title_align", cmd_title_align }, { "titlebar_border_thickness", cmd_titlebar_border_thickness }, { "titlebar_padding", cmd_titlebar_padding }, + { "touch", cmd_touch }, { "unbindcode", cmd_unbindcode }, { "unbindswitch", cmd_unbindswitch }, { "unbindsym", cmd_unbindsym }, diff --git a/sway/commands/gesture.c b/sway/commands/gesture.c index 23f431f92..e0075ae36 100644 --- a/sway/commands/gesture.c +++ b/sway/commands/gesture.c @@ -8,7 +8,41 @@ #include "list.h" #include "log.h" #include "stringop.h" +#include + + +void free_sway_gesture_binding(struct sway_gesture_binding *binding) { + if(!binding) { + return; + } + free(binding->command); + free(binding); +} + + +struct cmd_results *cmd_touch(int argc, char **argv) { + return NULL; +} struct cmd_results *cmd_gesture(int argc, char **argv) { - return NULL; + struct cmd_results *error = NULL; + + struct sway_gesture_binding *binding = calloc(1, sizeof(struct sway_gesture_binding)); + if(!binding) { + return cmd_results_new(CMD_FAILURE, "Unable to allocate binding"); + } + + if(argc < 2) { + free_sway_gesture_binding(binding); + return cmd_results_new(CMD_FAILURE, "Invalid gesture command " + "(expected at least 2 arguments, got %d)", argc); + } + + + binding->command = join_args(argv+1, argc -1); + //list_t *bindings = config->current_mode->gesture_bindings; + + + + return error; } diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 098470289..5bc67de08 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -28,7 +28,7 @@ #include "sway/tree/view.h" #include "sway/tree/workspace.h" #include "wlr-layer-shell-unstable-v1-protocol.h" -#include "" +#include static uint32_t get_current_time_msec(void) { struct timespec now; diff --git a/sway/meson.build b/sway/meson.build index d1742b7a5..14fe1f130 100644 --- a/sway/meson.build +++ b/sway/meson.build @@ -62,6 +62,7 @@ sway_sources = files( 'commands/force_focus_wrapping.c', 'commands/fullscreen.c', 'commands/gaps.c', + 'commands/gesture.c', 'commands/hide_edge_borders.c', 'commands/inhibit_idle.c', 'commands/kill.c',