From b2cfcebef61087f819b55d2f815e62aa4a6f1a52 Mon Sep 17 00:00:00 2001 From: Connor E <38229097+c-edw@users.noreply.github.com> Date: Mon, 15 Apr 2019 01:16:35 +0100 Subject: [PATCH] Add deprecation warnings for new_float, new_window, and force_focus_wrapping. --- include/sway/commands.h | 2 ++ sway/commands.c | 4 ++-- sway/commands/force_focus_wrapping.c | 9 ++++++++- sway/commands/new_float.c | 13 +++++++++++++ sway/commands/new_window.c | 13 +++++++++++++ sway/meson.build | 2 ++ sway/sway.5.scd | 6 ------ 7 files changed, 40 insertions(+), 9 deletions(-) create mode 100644 sway/commands/new_float.c create mode 100644 sway/commands/new_window.c diff --git a/include/sway/commands.h b/include/sway/commands.h index 9bd0f1cb5..2b66904c6 100644 --- a/include/sway/commands.h +++ b/include/sway/commands.h @@ -147,6 +147,8 @@ sway_cmd cmd_mark; sway_cmd cmd_mode; sway_cmd cmd_mouse_warping; sway_cmd cmd_move; +sway_cmd cmd_new_float; +sway_cmd cmd_new_window; sway_cmd cmd_nop; sway_cmd cmd_opacity; sway_cmd cmd_new_float; diff --git a/sway/commands.c b/sway/commands.c index abdaa3b87..d0bf402bd 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -77,8 +77,8 @@ static struct cmd_handler handlers[] = { { "input", cmd_input }, { "mode", cmd_mode }, { "mouse_warping", cmd_mouse_warping }, - { "new_float", cmd_default_floating_border }, - { "new_window", cmd_default_border }, + { "new_float", cmd_new_float }, + { "new_window", cmd_new_window }, { "no_focus", cmd_no_focus }, { "output", cmd_output }, { "popup_during_fullscreen", cmd_popup_during_fullscreen }, diff --git a/sway/commands/force_focus_wrapping.c b/sway/commands/force_focus_wrapping.c index e646ae9b7..fafc1c3ef 100644 --- a/sway/commands/force_focus_wrapping.c +++ b/sway/commands/force_focus_wrapping.c @@ -1,9 +1,16 @@ -#include #include "sway/commands.h" #include "sway/config.h" +#include "log.h" #include "util.h" struct cmd_results *cmd_force_focus_wrapping(int argc, char **argv) { + sway_log(SWAY_INFO, "Warning: force_focus_wrapping is deprecated. " + "Use focus_wrapping instead."); + if (config->reading) { + config_add_swaynag_warning("force_focus_wrapping is deprecated. " + "Use focus_wrapping instead."); + } + struct cmd_results *error = checkarg(argc, "force_focus_wrapping", EXPECTED_EQUAL_TO, 1); if (error) { diff --git a/sway/commands/new_float.c b/sway/commands/new_float.c new file mode 100644 index 000000000..4fedb4cb8 --- /dev/null +++ b/sway/commands/new_float.c @@ -0,0 +1,13 @@ +#include "log.h" +#include "sway/commands.h" +#include "sway/config.h" + +struct cmd_results *cmd_new_float(int argc, char **argv) { + sway_log(SWAY_INFO, "Warning: new_float is deprecated. " + "Use default_floating_border instead."); + if (config->reading) { + config_add_swaynag_warning("new_float is deprecated. " + "Use default_floating_border instead."); + } + return cmd_default_floating_border(argc, argv); +} diff --git a/sway/commands/new_window.c b/sway/commands/new_window.c new file mode 100644 index 000000000..e8caa4873 --- /dev/null +++ b/sway/commands/new_window.c @@ -0,0 +1,13 @@ +#include "log.h" +#include "sway/commands.h" +#include "sway/config.h" + +struct cmd_results *cmd_new_window(int argc, char **argv) { + sway_log(SWAY_INFO, "Warning: new_window is deprecated. " + "Use default_border instead."); + if (config->reading) { + config_add_swaynag_warning("new_window is deprecated. " + "Use default_border instead."); + } + return cmd_default_border(argc, argv); +} diff --git a/sway/meson.build b/sway/meson.build index 12b86efb8..8254fb5c3 100644 --- a/sway/meson.build +++ b/sway/meson.build @@ -73,6 +73,8 @@ sway_sources = files( 'commands/mode.c', 'commands/mouse_warping.c', 'commands/move.c', + 'commands/new_float.c', + 'commands/new_window.c', 'commands/no_focus.c', 'commands/nop.c', 'commands/output.c', diff --git a/sway/sway.5.scd b/sway/sway.5.scd index 1650cd60c..b484607a2 100644 --- a/sway/sway.5.scd +++ b/sway/sway.5.scd @@ -529,12 +529,6 @@ The default colors are: Whenever a window that matches _criteria_ appears, run list of commands. See *CRITERIA* for more details. -*force_focus_wrapping* yes|no - This option is a wrapper to support i3's legacy syntax. _no_ is equivalent - to _focus_wrapping yes_ and _yes_ is equivalent to - _focus_wrapping force_. This is only available for convenience. Please - use _focus_wrapping_ instead when possible. - *gaps* inner|outer|horizontal|vertical|top|right|bottom|left Sets default _amount_ pixels of _inner_ or _outer_ gap, where the inner affects spacing around each view and outer affects the spacing around each