aboutsummaryrefslogtreecommitdiff
path: root/sway/commands.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2016-06-02 11:46:25 -0400
committerDrew DeVault <sir@cmpwn.com>2016-06-02 11:46:25 -0400
commit09670fc1a7485d75774c184fcbf8e907b9481aaa (patch)
treefad070df6be2bef62346c4a8232d869e3cf41fdc /sway/commands.c
parent5e395d696259283953e5b3944cfe5ab92963c189 (diff)
parent2256a9b784d6885822a428a2760838693bd75d94 (diff)
Merge pull request #691 from thuck/floating_size_conf
floating_maximum_size initial implementation
Diffstat (limited to 'sway/commands.c')
-rw-r--r--sway/commands.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/sway/commands.c b/sway/commands.c
index d8f61242..3befee13 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -58,6 +58,7 @@ static sway_cmd cmd_exec;
static sway_cmd cmd_exec_always;
static sway_cmd cmd_exit;
static sway_cmd cmd_floating;
+static sway_cmd cmd_floating_maximum_size;
static sway_cmd cmd_floating_minimum_size;
static sway_cmd cmd_floating_mod;
static sway_cmd cmd_floating_scroll;
@@ -674,6 +675,40 @@ static struct cmd_results *cmd_floating(int argc, char **argv) {
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
}
+static struct cmd_results *cmd_floating_maximum_size(int argc, char **argv) {
+ struct cmd_results *error = NULL;
+ int32_t width;
+ int32_t height;
+ char *ptr;
+
+ if ((error = checkarg(argc, "floating_maximum_size", EXPECTED_EQUAL_TO, 3))) {
+ return error;
+ }
+ width = strtol(argv[0], &ptr, 10);
+ height = strtol(argv[2], &ptr, 10);
+
+ if (width < -1) {
+ sway_log(L_DEBUG, "floating_maximum_size invalid width value: '%s'", argv[0]);
+
+ } else {
+ config->floating_maximum_width = width;
+
+ }
+
+ if (height < -1) {
+ sway_log(L_DEBUG, "floating_maximum_size invalid height value: '%s'", argv[2]);
+ }
+ else {
+ config->floating_maximum_height = height;
+
+ }
+
+ sway_log(L_DEBUG, "New floating_maximum_size: '%d' x '%d'", config->floating_maximum_width,
+ config->floating_maximum_height);
+
+ return cmd_results_new(CMD_SUCCESS, NULL, NULL);
+}
+
static struct cmd_results *cmd_floating_minimum_size(int argc, char **argv) {
struct cmd_results *error = NULL;
int32_t width;
@@ -2468,6 +2503,7 @@ static struct cmd_handler handlers[] = {
{ "exec_always", cmd_exec_always },
{ "exit", cmd_exit },
{ "floating", cmd_floating },
+ { "floating_maximum_size", cmd_floating_maximum_size },
{ "floating_minimum_size", cmd_floating_minimum_size },
{ "floating_modifier", cmd_floating_mod },
{ "floating_scroll", cmd_floating_scroll },