diff options
author | Brian Ashworth <bosrsf04@gmail.com> | 2019-01-01 08:45:21 -0500 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2019-01-02 23:33:33 +0100 |
commit | 5bf4daf2634929e7c94a6c7e56eda66d4667ca2f (patch) | |
tree | 1a5b0c1300c056cdd48f9d819e960e1336c46602 /sway/commands | |
parent | Fix fullscreen view rendering crash (diff) | |
download | sway-5bf4daf2634929e7c94a6c7e56eda66d4667ca2f.tar.gz sway-5bf4daf2634929e7c94a6c7e56eda66d4667ca2f.tar.zst sway-5bf4daf2634929e7c94a6c7e56eda66d4667ca2f.zip |
Implement tiling_drag_threshold
Implements `tiling_drag_threshold <threshold>` to prevent accidental
dragging of tiling containers. If a container (and all of its
descendants) are unfocused and the tile bar is pressed, a threshold
will be used before actually starting the drag. Once the threshold has
been exceeded, the cursor will change to the grab icon and the operation
will switch from `OP_MOVE_TILING_THRESHOLD` to `OP_MOVE_TILING`.
Diffstat (limited to 'sway/commands')
-rw-r--r-- | sway/commands/tiling_drag_threshold.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/sway/commands/tiling_drag_threshold.c b/sway/commands/tiling_drag_threshold.c new file mode 100644 index 00000000..6b0531c3 --- /dev/null +++ b/sway/commands/tiling_drag_threshold.c | |||
@@ -0,0 +1,22 @@ | |||
1 | #include <string.h> | ||
2 | #include "sway/commands.h" | ||
3 | #include "sway/config.h" | ||
4 | #include "log.h" | ||
5 | |||
6 | struct cmd_results *cmd_tiling_drag_threshold(int argc, char **argv) { | ||
7 | struct cmd_results *error = NULL; | ||
8 | if ((error = checkarg(argc, "tiling_drag_threshold", EXPECTED_EQUAL_TO, 1))) { | ||
9 | return error; | ||
10 | } | ||
11 | |||
12 | char *inv; | ||
13 | int value = strtol(argv[0], &inv, 10); | ||
14 | if (*inv != '\0' || value < 0) { | ||
15 | return cmd_results_new(CMD_INVALID, "tiling_drag_threshold", | ||
16 | "Invalid threshold specified"); | ||
17 | } | ||
18 | |||
19 | config->tiling_drag_threshold = value; | ||
20 | |||
21 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
22 | } | ||