diff options
-rw-r--r-- | sway/commands.c | 19 | ||||
-rw-r--r-- | sway/movement.c | 10 | ||||
-rw-r--r-- | sway/movement.h | 2 |
3 files changed, 24 insertions, 7 deletions
diff --git a/sway/commands.c b/sway/commands.c index 96245c8a..7721c6fb 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <string.h> | 6 | #include <string.h> |
7 | #include <unistd.h> | 7 | #include <unistd.h> |
8 | #include <sys/wait.h> | 8 | #include <sys/wait.h> |
9 | #include <fcntl.h> | ||
9 | #include <ctype.h> | 10 | #include <ctype.h> |
10 | #include "stringop.h" | 11 | #include "stringop.h" |
11 | #include "layout.h" | 12 | #include "layout.h" |
@@ -118,6 +119,22 @@ static bool cmd_exec_always(struct sway_config *config, int argc, char **argv) { | |||
118 | if(cleanup == false) { | 119 | if(cleanup == false) { |
119 | signal(SIGCHLD, cmd_exec_cleanup); | 120 | signal(SIGCHLD, cmd_exec_cleanup); |
120 | cleanup = true; | 121 | cleanup = true; |
122 | /* Set it so filedescriptors are closed for executed programs */ | ||
123 | int flag_out = fcntl(STDOUT_FILENO, F_GETFD); | ||
124 | int flag_in = fcntl(STDIN_FILENO, F_GETFD); | ||
125 | int flag_err = fcntl(STDERR_FILENO, F_GETFD); | ||
126 | if (flag_out != -1) { | ||
127 | flag_out |= FD_CLOEXEC; | ||
128 | fcntl(STDOUT_FILENO, F_SETFD, flag_out); | ||
129 | } | ||
130 | if (flag_in != -1) { | ||
131 | flag_in |= FD_CLOEXEC; | ||
132 | fcntl(STDIN_FILENO, F_SETFD, flag_in); | ||
133 | } | ||
134 | if (flag_err != -1) { | ||
135 | flag_err |= FD_CLOEXEC; | ||
136 | fcntl(STDERR_FILENO, F_SETFD, flag_err); | ||
137 | } | ||
121 | } | 138 | } |
122 | 139 | ||
123 | if (checkarg(argc, "exec_always", EXPECTED_MORE_THEN, 0) == false) { | 140 | if (checkarg(argc, "exec_always", EXPECTED_MORE_THEN, 0) == false) { |
@@ -287,7 +304,7 @@ static bool cmd_log_colors(struct sway_config *config, int argc, char **argv) { | |||
287 | } | 304 | } |
288 | 305 | ||
289 | static bool cmd_fullscreen(struct sway_config *config, int argc, char **argv) { | 306 | static bool cmd_fullscreen(struct sway_config *config, int argc, char **argv) { |
290 | if (checkarg(argc, "fullscreen", EXPECTED_SAME_AS, 1) == false) { | 307 | if (checkarg(argc, "fullscreen", EXPECTED_SAME_AS, 0) == false) { |
291 | return false; | 308 | return false; |
292 | } | 309 | } |
293 | 310 | ||
diff --git a/sway/movement.c b/sway/movement.c index a55d0350..166e6508 100644 --- a/sway/movement.c +++ b/sway/movement.c | |||
@@ -5,7 +5,7 @@ | |||
5 | #include "layout.h" | 5 | #include "layout.h" |
6 | #include "movement.h" | 6 | #include "movement.h" |
7 | 7 | ||
8 | int move_focus(enum movement_direction direction) { | 8 | bool move_focus(enum movement_direction direction) { |
9 | swayc_t *current = get_focused_container(&root_container); | 9 | swayc_t *current = get_focused_container(&root_container); |
10 | swayc_t *parent = current->parent; | 10 | swayc_t *parent = current->parent; |
11 | 11 | ||
@@ -14,12 +14,12 @@ int move_focus(enum movement_direction direction) { | |||
14 | parent = parent->parent; | 14 | parent = parent->parent; |
15 | if (parent->type == C_ROOT) { | 15 | if (parent->type == C_ROOT) { |
16 | sway_log(L_DEBUG, "Focus cannot move to parent"); | 16 | sway_log(L_DEBUG, "Focus cannot move to parent"); |
17 | return 1; | 17 | return false; |
18 | } else { | 18 | } else { |
19 | sway_log(L_DEBUG, "Moving focus away from %p", current); | 19 | sway_log(L_DEBUG, "Moving focus away from %p", current); |
20 | unfocus_all(parent); | 20 | unfocus_all(parent); |
21 | focus_view(parent); | 21 | focus_view(parent); |
22 | return 0; | 22 | return true; |
23 | } | 23 | } |
24 | } | 24 | } |
25 | 25 | ||
@@ -56,7 +56,7 @@ int move_focus(enum movement_direction direction) { | |||
56 | } else { | 56 | } else { |
57 | unfocus_all(&root_container); | 57 | unfocus_all(&root_container); |
58 | focus_view(parent->children->items[desired]); | 58 | focus_view(parent->children->items[desired]); |
59 | return 0; | 59 | return true; |
60 | } | 60 | } |
61 | } | 61 | } |
62 | if (!can_move) { | 62 | if (!can_move) { |
@@ -65,7 +65,7 @@ int move_focus(enum movement_direction direction) { | |||
65 | parent = parent->parent; | 65 | parent = parent->parent; |
66 | if (parent->type == C_ROOT) { | 66 | if (parent->type == C_ROOT) { |
67 | // Nothing we can do | 67 | // Nothing we can do |
68 | return 1; | 68 | return false; |
69 | } | 69 | } |
70 | } | 70 | } |
71 | } | 71 | } |
diff --git a/sway/movement.h b/sway/movement.h index a527674c..dd701877 100644 --- a/sway/movement.h +++ b/sway/movement.h | |||
@@ -12,6 +12,6 @@ enum movement_direction { | |||
12 | MOVE_PARENT | 12 | MOVE_PARENT |
13 | }; | 13 | }; |
14 | 14 | ||
15 | int move_focus(enum movement_direction direction); | 15 | bool move_focus(enum movement_direction direction); |
16 | 16 | ||
17 | #endif | 17 | #endif |