From ec9c4de564286d3795dd204e2c0a69b10f7572be Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Tue, 11 Sep 2018 17:17:19 +1000 Subject: Introduce tiling_drag directive --- include/sway/commands.h | 1 + include/sway/config.h | 1 + sway/commands.c | 1 + sway/commands/tiling_drag.c | 13 +++++++++++++ sway/config.c | 1 + sway/meson.build | 1 + 6 files changed, 18 insertions(+) create mode 100644 sway/commands/tiling_drag.c diff --git a/include/sway/commands.h b/include/sway/commands.h index b0b5ed0f..e51b12fd 100644 --- a/include/sway/commands.h +++ b/include/sway/commands.h @@ -161,6 +161,7 @@ sway_cmd cmd_sticky; sway_cmd cmd_swaybg_command; sway_cmd cmd_swaynag_command; sway_cmd cmd_swap; +sway_cmd cmd_tiling_drag; sway_cmd cmd_title_format; sway_cmd cmd_unmark; sway_cmd cmd_urgent; diff --git a/include/sway/config.h b/include/sway/config.h index b52bb681..b53c1f1f 100644 --- a/include/sway/config.h +++ b/include/sway/config.h @@ -365,6 +365,7 @@ struct sway_config { bool validating; bool auto_back_and_forth; bool show_marks; + bool tiling_drag; bool edge_gaps; bool smart_gaps; diff --git a/sway/commands.c b/sway/commands.c index b32628cd..41e1c653 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -127,6 +127,7 @@ static struct cmd_handler handlers[] = { { "set", cmd_set }, { "show_marks", cmd_show_marks }, { "smart_gaps", cmd_smart_gaps }, + { "tiling_drag", cmd_tiling_drag }, { "workspace", cmd_workspace }, { "workspace_auto_back_and_forth", cmd_ws_auto_back_and_forth }, }; diff --git a/sway/commands/tiling_drag.c b/sway/commands/tiling_drag.c new file mode 100644 index 00000000..92fbde7c --- /dev/null +++ b/sway/commands/tiling_drag.c @@ -0,0 +1,13 @@ +#include "sway/commands.h" +#include "util.h" + +struct cmd_results *cmd_tiling_drag(int argc, char **argv) { + struct cmd_results *error = NULL; + if ((error = checkarg(argc, "tiling_drag", EXPECTED_EQUAL_TO, 1))) { + return error; + } + + config->tiling_drag = parse_boolean(argv[0], config->tiling_drag); + + return cmd_results_new(CMD_SUCCESS, NULL, NULL); +} diff --git a/sway/config.c b/sway/config.c index 6ff4da03..830fb65f 100644 --- a/sway/config.c +++ b/sway/config.c @@ -225,6 +225,7 @@ static void config_defaults(struct sway_config *config) { config->auto_back_and_forth = false; config->reading = false; config->show_marks = true; + config->tiling_drag = true; config->edge_gaps = true; config->smart_gaps = false; diff --git a/sway/meson.build b/sway/meson.build index 8891ebc0..01c83a33 100644 --- a/sway/meson.build +++ b/sway/meson.build @@ -83,6 +83,7 @@ sway_sources = files( 'commands/swaybg_command.c', 'commands/swaynag_command.c', 'commands/swap.c', + 'commands/tiling_drag.c', 'commands/title_format.c', 'commands/unmark.c', 'commands/urgent.c', -- cgit v1.2.3-54-g00ecf