diff options
author | Drew DeVault <sir@cmpwn.com> | 2016-07-18 08:50:53 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-18 08:50:53 -0400 |
commit | c0e45222023e1a0ca0a37b73bb79931ac45f67aa (patch) | |
tree | 6840765daed668ac273d4296f9123547ab4bd7b4 /sway | |
parent | Merge pull request #768 from gpyh/patch-1 (diff) | |
parent | Add missing entry to list of accepted arguments for the move command (diff) | |
download | sway-c0e45222023e1a0ca0a37b73bb79931ac45f67aa.tar.gz sway-c0e45222023e1a0ca0a37b73bb79931ac45f67aa.tar.zst sway-c0e45222023e1a0ca0a37b73bb79931ac45f67aa.zip |
Merge pull request #764 from deklov/move-position-bug-02
Do not crash when handling the command 'move position'
Diffstat (limited to 'sway')
-rw-r--r-- | sway/commands.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sway/commands.c b/sway/commands.c index 73f245c1..aaacf0fc 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -1011,7 +1011,8 @@ static struct cmd_results *cmd_move(int argc, char **argv) { | |||
1011 | } | 1011 | } |
1012 | const char* expected_syntax = "Expected 'move <left|right|up|down>' or " | 1012 | const char* expected_syntax = "Expected 'move <left|right|up|down>' or " |
1013 | "'move <container|window> to workspace <name>' or " | 1013 | "'move <container|window> to workspace <name>' or " |
1014 | "'move <container|window|workspace> to output <name|direction>'"; | 1014 | "'move <container|window|workspace> to output <name|direction>' or " |
1015 | "'move position mouse'"; | ||
1015 | swayc_t *view = get_focused_container(&root_container); | 1016 | swayc_t *view = get_focused_container(&root_container); |
1016 | 1017 | ||
1017 | if (strcasecmp(argv[0], "left") == 0) { | 1018 | if (strcasecmp(argv[0], "left") == 0) { |
@@ -1115,7 +1116,14 @@ static struct cmd_results *cmd_move(int argc, char **argv) { | |||
1115 | focused = swayc_active_workspace(); | 1116 | focused = swayc_active_workspace(); |
1116 | } | 1117 | } |
1117 | set_focused_container(focused); | 1118 | set_focused_container(focused); |
1118 | } else if (strcasecmp(argv[0], "position") == 0 && strcasecmp(argv[1], "mouse") == 0) { | 1119 | } else if (strcasecmp(argv[0], "position") == 0) { |
1120 | if ((error = checkarg(argc, "move workspace", EXPECTED_EQUAL_TO, 2))) { | ||
1121 | return error; | ||
1122 | } | ||
1123 | if (strcasecmp(argv[1], "mouse")) { | ||
1124 | return cmd_results_new(CMD_INVALID, "move", expected_syntax); | ||
1125 | } | ||
1126 | |||
1119 | if (view->is_floating) { | 1127 | if (view->is_floating) { |
1120 | swayc_t *output = swayc_parent_by_type(view, C_OUTPUT); | 1128 | swayc_t *output = swayc_parent_by_type(view, C_OUTPUT); |
1121 | struct wlc_geometry g; | 1129 | struct wlc_geometry g; |