no more output from programs called with exec, fixed focus return values

master
Taiyu 9 years ago
parent dc9efcd79f
commit ac1c2d31bf

@ -6,6 +6,7 @@
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <fcntl.h>
#include <ctype.h> #include <ctype.h>
#include "stringop.h" #include "stringop.h"
#include "layout.h" #include "layout.h"
@ -118,6 +119,22 @@ static bool cmd_exec_always(struct sway_config *config, int argc, char **argv) {
if(cleanup == false) { if(cleanup == false) {
signal(SIGCHLD, cmd_exec_cleanup); signal(SIGCHLD, cmd_exec_cleanup);
cleanup = true; cleanup = true;
/* Set it so filedescriptors are closed for executed programs */
int flag_out = fcntl(STDOUT_FILENO, F_GETFD);
int flag_in = fcntl(STDIN_FILENO, F_GETFD);
int flag_err = fcntl(STDERR_FILENO, F_GETFD);
if (flag_out != -1) {
flag_out |= FD_CLOEXEC;
fcntl(STDOUT_FILENO, F_SETFD, flag_out);
}
if (flag_in != -1) {
flag_in |= FD_CLOEXEC;
fcntl(STDIN_FILENO, F_SETFD, flag_in);
}
if (flag_err != -1) {
flag_err |= FD_CLOEXEC;
fcntl(STDERR_FILENO, F_SETFD, flag_err);
}
} }
if (checkarg(argc, "exec_always", EXPECTED_MORE_THEN, 0) == false) { 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) {
} }
static bool cmd_fullscreen(struct sway_config *config, int argc, char **argv) { static bool cmd_fullscreen(struct sway_config *config, int argc, char **argv) {
if (checkarg(argc, "fullscreen", EXPECTED_SAME_AS, 1) == false) { if (checkarg(argc, "fullscreen", EXPECTED_SAME_AS, 0) == false) {
return false; return false;
} }

@ -5,7 +5,7 @@
#include "layout.h" #include "layout.h"
#include "movement.h" #include "movement.h"
int move_focus(enum movement_direction direction) { bool move_focus(enum movement_direction direction) {
swayc_t *current = get_focused_container(&root_container); swayc_t *current = get_focused_container(&root_container);
swayc_t *parent = current->parent; swayc_t *parent = current->parent;
@ -14,12 +14,12 @@ int move_focus(enum movement_direction direction) {
parent = parent->parent; parent = parent->parent;
if (parent->type == C_ROOT) { if (parent->type == C_ROOT) {
sway_log(L_DEBUG, "Focus cannot move to parent"); sway_log(L_DEBUG, "Focus cannot move to parent");
return 1; return false;
} else { } else {
sway_log(L_DEBUG, "Moving focus away from %p", current); sway_log(L_DEBUG, "Moving focus away from %p", current);
unfocus_all(parent); unfocus_all(parent);
focus_view(parent); focus_view(parent);
return 0; return true;
} }
} }
@ -56,7 +56,7 @@ int move_focus(enum movement_direction direction) {
} else { } else {
unfocus_all(&root_container); unfocus_all(&root_container);
focus_view(parent->children->items[desired]); focus_view(parent->children->items[desired]);
return 0; return true;
} }
} }
if (!can_move) { if (!can_move) {
@ -65,7 +65,7 @@ int move_focus(enum movement_direction direction) {
parent = parent->parent; parent = parent->parent;
if (parent->type == C_ROOT) { if (parent->type == C_ROOT) {
// Nothing we can do // Nothing we can do
return 1; return false;
} }
} }
} }

@ -12,6 +12,6 @@ enum movement_direction {
MOVE_PARENT MOVE_PARENT
}; };
int move_focus(enum movement_direction direction); bool move_focus(enum movement_direction direction);
#endif #endif

Loading…
Cancel
Save