Try to incorporate touch in config

This commit is contained in:
grahnen 2019-01-16 19:15:39 +01:00 committed by Samuel Grahn
parent 79f3cf88a7
commit cb94176e27
6 changed files with 45 additions and 2 deletions

View file

@ -185,6 +185,7 @@ sway_cmd cmd_titlebar_padding;
sway_cmd cmd_unbindcode; sway_cmd cmd_unbindcode;
sway_cmd cmd_unbindswitch; sway_cmd cmd_unbindswitch;
sway_cmd cmd_unbindsym; sway_cmd cmd_unbindsym;
sway_cmd cmd_touch;
sway_cmd cmd_unmark; sway_cmd cmd_unmark;
sway_cmd cmd_urgent; sway_cmd cmd_urgent;
sway_cmd cmd_workspace; sway_cmd cmd_workspace;

View file

@ -54,6 +54,11 @@ struct sway_binding {
char *command; char *command;
}; };
struct sway_gesture_binding {
struct libtouch_gesture *gesture;
char *command;
};
/** /**
* A mouse binding and an associated command. * A mouse binding and an associated command.
*/ */
@ -91,6 +96,7 @@ struct sway_mode {
list_t *keycode_bindings; list_t *keycode_bindings;
list_t *mouse_bindings; list_t *mouse_bindings;
list_t *switch_bindings; list_t *switch_bindings;
list_t *gesture_bindings;
bool pango; bool pango;
}; };

View file

@ -93,6 +93,7 @@ static struct cmd_handler handlers[] = {
{ "title_align", cmd_title_align }, { "title_align", cmd_title_align },
{ "titlebar_border_thickness", cmd_titlebar_border_thickness }, { "titlebar_border_thickness", cmd_titlebar_border_thickness },
{ "titlebar_padding", cmd_titlebar_padding }, { "titlebar_padding", cmd_titlebar_padding },
{ "touch", cmd_touch },
{ "unbindcode", cmd_unbindcode }, { "unbindcode", cmd_unbindcode },
{ "unbindswitch", cmd_unbindswitch }, { "unbindswitch", cmd_unbindswitch },
{ "unbindsym", cmd_unbindsym }, { "unbindsym", cmd_unbindsym },

View file

@ -8,7 +8,41 @@
#include "list.h" #include "list.h"
#include "log.h" #include "log.h"
#include "stringop.h" #include "stringop.h"
#include <libtouch.h>
struct cmd_results *cmd_gesture(int argc, char **argv) {
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; return NULL;
} }
struct cmd_results *cmd_gesture(int argc, char **argv) {
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;
}

View file

@ -28,7 +28,7 @@
#include "sway/tree/view.h" #include "sway/tree/view.h"
#include "sway/tree/workspace.h" #include "sway/tree/workspace.h"
#include "wlr-layer-shell-unstable-v1-protocol.h" #include "wlr-layer-shell-unstable-v1-protocol.h"
#include "<libtouch.h>" #include <libtouch.h>
static uint32_t get_current_time_msec(void) { static uint32_t get_current_time_msec(void) {
struct timespec now; struct timespec now;

View file

@ -62,6 +62,7 @@ sway_sources = files(
'commands/force_focus_wrapping.c', 'commands/force_focus_wrapping.c',
'commands/fullscreen.c', 'commands/fullscreen.c',
'commands/gaps.c', 'commands/gaps.c',
'commands/gesture.c',
'commands/hide_edge_borders.c', 'commands/hide_edge_borders.c',
'commands/inhibit_idle.c', 'commands/inhibit_idle.c',
'commands/kill.c', 'commands/kill.c',