Revert "merge sway master"

This reverts commit 7460d9f565.
This commit is contained in:
Will McKinnon 2022-08-15 00:54:07 -04:00
parent cf1ed777ae
commit 7b530bf448
63 changed files with 463 additions and 644 deletions

View file

@ -28,13 +28,8 @@ static bool terminal_execute(char *terminal, char *command) {
fprintf(tmp, "#!/bin/sh\nrm %s\n%s", fname, command);
fclose(tmp);
chmod(fname, S_IRUSR | S_IWUSR | S_IXUSR);
size_t cmd_size = strlen(terminal) + strlen(" -e ") + strlen(fname) + 1;
char *cmd = malloc(cmd_size);
if (!cmd) {
perror("malloc");
return false;
}
snprintf(cmd, cmd_size, "%s -e %s", terminal, fname);
char *cmd = malloc(sizeof(char) * (strlen(terminal) + strlen(" -e ") + strlen(fname) + 1));
sprintf(cmd, "%s -e %s", terminal, fname);
execlp("sh", "sh", "-c", cmd, NULL);
sway_log_errno(SWAY_ERROR, "Failed to run command, execlp() returned.");
free(cmd);
@ -63,7 +58,7 @@ static void swaynag_button_execute(struct swaynag *swaynag,
} else if (pid == 0) {
// Child of the child. Will be reparented to the init process
char *terminal = getenv("TERMINAL");
if (button->terminal && terminal && *terminal) {
if (button->terminal && terminal && strlen(terminal)) {
sway_log(SWAY_DEBUG, "Found $TERMINAL: %s", terminal);
if (!terminal_execute(terminal, button->action)) {
swaynag_destroy(swaynag);
@ -143,7 +138,7 @@ static void update_cursor(struct swaynag_seat *seat) {
const char *cursor_theme = getenv("XCURSOR_THEME");
unsigned cursor_size = 24;
const char *env_cursor_size = getenv("XCURSOR_SIZE");
if (env_cursor_size && *env_cursor_size) {
if (env_cursor_size && strlen(env_cursor_size) > 0) {
errno = 0;
char *end;
unsigned size = strtoul(env_cursor_size, &end, 10);
@ -344,7 +339,6 @@ static void handle_global(void *data, struct wl_registry *registry,
struct swaynag_seat *seat =
calloc(1, sizeof(struct swaynag_seat));
if (!seat) {
perror("calloc");
return;
}
@ -362,10 +356,6 @@ static void handle_global(void *data, struct wl_registry *registry,
if (!swaynag->output) {
struct swaynag_output *output =
calloc(1, sizeof(struct swaynag_output));
if (!output) {
perror("calloc");
return;
}
output->wl_output = wl_registry_bind(registry, name,
&wl_output_interface, 4);
output->wl_name = name;
@ -521,8 +511,13 @@ void swaynag_destroy(struct swaynag *swaynag) {
swaynag_seat_destroy(seat);
}
destroy_buffer(&swaynag->buffers[0]);
destroy_buffer(&swaynag->buffers[1]);
if (&swaynag->buffers[0]) {
destroy_buffer(&swaynag->buffers[0]);
}
if (&swaynag->buffers[1]) {
destroy_buffer(&swaynag->buffers[1]);
}
if (swaynag->outputs.prev || swaynag->outputs.next) {
struct swaynag_output *output, *temp;