mirror of
https://github.com/swaywm/sway.git
synced 2025-11-24 06:59:51 -05:00
Update for swaywm/wlroots#1126
This commit is contained in:
parent
ebcdce457a
commit
63b4bf5000
85 changed files with 391 additions and 385 deletions
|
|
@ -16,10 +16,10 @@
|
|||
#include "log.h"
|
||||
|
||||
static void terminate_swaybar(pid_t pid) {
|
||||
wlr_log(L_DEBUG, "Terminating swaybar %d", pid);
|
||||
wlr_log(WLR_DEBUG, "Terminating swaybar %d", pid);
|
||||
int ret = kill(-pid, SIGTERM);
|
||||
if (ret != 0) {
|
||||
wlr_log_errno(L_ERROR, "Unable to terminate swaybar %d", pid);
|
||||
wlr_log_errno(WLR_ERROR, "Unable to terminate swaybar %d", pid);
|
||||
} else {
|
||||
int status;
|
||||
waitpid(pid, &status, 0);
|
||||
|
|
@ -167,7 +167,7 @@ void invoke_swaybar(struct bar_config *bar) {
|
|||
// Pipe to communicate errors
|
||||
int filedes[2];
|
||||
if (pipe(filedes) == -1) {
|
||||
wlr_log(L_ERROR, "Pipe setup failed! Cannot fork into bar");
|
||||
wlr_log(WLR_ERROR, "Pipe setup failed! Cannot fork into bar");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -197,17 +197,17 @@ void invoke_swaybar(struct bar_config *bar) {
|
|||
execvp(cmd[0], cmd);
|
||||
exit(1);
|
||||
}
|
||||
wlr_log(L_DEBUG, "Spawned swaybar %d", bar->pid);
|
||||
wlr_log(WLR_DEBUG, "Spawned swaybar %d", bar->pid);
|
||||
close(filedes[0]);
|
||||
size_t len;
|
||||
if (read(filedes[1], &len, sizeof(size_t)) == sizeof(size_t)) {
|
||||
char *buf = malloc(len);
|
||||
if(!buf) {
|
||||
wlr_log(L_ERROR, "Cannot allocate error string");
|
||||
wlr_log(WLR_ERROR, "Cannot allocate error string");
|
||||
return;
|
||||
}
|
||||
if (read(filedes[1], buf, len)) {
|
||||
wlr_log(L_ERROR, "%s", buf);
|
||||
wlr_log(WLR_ERROR, "%s", buf);
|
||||
}
|
||||
free(buf);
|
||||
}
|
||||
|
|
@ -244,7 +244,7 @@ void load_swaybars() {
|
|||
if (bar->pid != 0) {
|
||||
terminate_swaybar(bar->pid);
|
||||
}
|
||||
wlr_log(L_DEBUG, "Invoking swaybar for bar id '%s'", bar->id);
|
||||
wlr_log(WLR_DEBUG, "Invoking swaybar for bar id '%s'", bar->id);
|
||||
invoke_swaybar(bar);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@
|
|||
struct input_config *new_input_config(const char* identifier) {
|
||||
struct input_config *input = calloc(1, sizeof(struct input_config));
|
||||
if (!input) {
|
||||
wlr_log(L_DEBUG, "Unable to allocate input config");
|
||||
wlr_log(WLR_DEBUG, "Unable to allocate input config");
|
||||
return NULL;
|
||||
}
|
||||
wlr_log(L_DEBUG, "new_input_config(%s)", identifier);
|
||||
wlr_log(WLR_DEBUG, "new_input_config(%s)", identifier);
|
||||
if (!(input->identifier = strdup(identifier))) {
|
||||
free(input);
|
||||
wlr_log(L_DEBUG, "Unable to allocate input config");
|
||||
wlr_log(WLR_DEBUG, "Unable to allocate input config");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -112,7 +112,7 @@ void merge_input_config(struct input_config *dst, struct input_config *src) {
|
|||
struct input_config *copy_input_config(struct input_config *ic) {
|
||||
struct input_config *copy = calloc(1, sizeof(struct input_config));
|
||||
if (copy == NULL) {
|
||||
wlr_log(L_ERROR, "could not allocate input config");
|
||||
wlr_log(WLR_ERROR, "could not allocate input config");
|
||||
return NULL;
|
||||
}
|
||||
merge_input_config(copy, ic);
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ static void set_mode(struct wlr_output *output, int width, int height,
|
|||
float refresh_rate) {
|
||||
int mhz = (int)(refresh_rate * 1000);
|
||||
if (wl_list_empty(&output->modes)) {
|
||||
wlr_log(L_DEBUG, "Assigning custom mode to %s", output->name);
|
||||
wlr_log(WLR_DEBUG, "Assigning custom mode to %s", output->name);
|
||||
wlr_output_set_custom_mode(output, width, height, mhz);
|
||||
return;
|
||||
}
|
||||
|
|
@ -106,9 +106,9 @@ static void set_mode(struct wlr_output *output, int width, int height,
|
|||
}
|
||||
}
|
||||
if (!best) {
|
||||
wlr_log(L_ERROR, "Configured mode for %s not available", output->name);
|
||||
wlr_log(WLR_ERROR, "Configured mode for %s not available", output->name);
|
||||
} else {
|
||||
wlr_log(L_DEBUG, "Assigning configured mode to %s", output->name);
|
||||
wlr_log(WLR_DEBUG, "Assigning configured mode to %s", output->name);
|
||||
wlr_output_set_mode(output, best);
|
||||
}
|
||||
}
|
||||
|
|
@ -116,7 +116,7 @@ static void set_mode(struct wlr_output *output, int width, int height,
|
|||
void terminate_swaybg(pid_t pid) {
|
||||
int ret = kill(pid, SIGTERM);
|
||||
if (ret != 0) {
|
||||
wlr_log(L_ERROR, "Unable to terminate swaybg [pid: %d]", pid);
|
||||
wlr_log(WLR_ERROR, "Unable to terminate swaybg [pid: %d]", pid);
|
||||
} else {
|
||||
int status;
|
||||
waitpid(pid, &status, 0);
|
||||
|
|
@ -144,22 +144,22 @@ void apply_output_config(struct output_config *oc, struct sway_container *output
|
|||
}
|
||||
|
||||
if (oc && oc->width > 0 && oc->height > 0) {
|
||||
wlr_log(L_DEBUG, "Set %s mode to %dx%d (%f GHz)", oc->name, oc->width,
|
||||
wlr_log(WLR_DEBUG, "Set %s mode to %dx%d (%f GHz)", oc->name, oc->width,
|
||||
oc->height, oc->refresh_rate);
|
||||
set_mode(wlr_output, oc->width, oc->height, oc->refresh_rate);
|
||||
}
|
||||
if (oc && oc->scale > 0) {
|
||||
wlr_log(L_DEBUG, "Set %s scale to %f", oc->name, oc->scale);
|
||||
wlr_log(WLR_DEBUG, "Set %s scale to %f", oc->name, oc->scale);
|
||||
wlr_output_set_scale(wlr_output, oc->scale);
|
||||
}
|
||||
if (oc && oc->transform >= 0) {
|
||||
wlr_log(L_DEBUG, "Set %s transform to %d", oc->name, oc->transform);
|
||||
wlr_log(WLR_DEBUG, "Set %s transform to %d", oc->name, oc->transform);
|
||||
wlr_output_set_transform(wlr_output, oc->transform);
|
||||
}
|
||||
|
||||
// Find position for it
|
||||
if (oc && (oc->x != -1 || oc->y != -1)) {
|
||||
wlr_log(L_DEBUG, "Set %s position to %d, %d", oc->name, oc->x, oc->y);
|
||||
wlr_log(WLR_DEBUG, "Set %s position to %d, %d", oc->name, oc->x, oc->y);
|
||||
wlr_output_layout_add(output_layout, wlr_output, oc->x, oc->y);
|
||||
} else {
|
||||
wlr_output_layout_add_auto(output_layout, wlr_output);
|
||||
|
|
@ -187,7 +187,7 @@ void apply_output_config(struct output_config *oc, struct sway_container *output
|
|||
terminate_swaybg(output->sway_output->bg_pid);
|
||||
}
|
||||
|
||||
wlr_log(L_DEBUG, "Setting background for output %d to %s",
|
||||
wlr_log(WLR_DEBUG, "Setting background for output %d to %s",
|
||||
output_i, oc->background);
|
||||
|
||||
size_t len = snprintf(NULL, 0, "%s %d %s %s",
|
||||
|
|
@ -195,13 +195,13 @@ void apply_output_config(struct output_config *oc, struct sway_container *output
|
|||
output_i, oc->background, oc->background_option);
|
||||
char *command = malloc(len + 1);
|
||||
if (!command) {
|
||||
wlr_log(L_DEBUG, "Unable to allocate swaybg command");
|
||||
wlr_log(WLR_DEBUG, "Unable to allocate swaybg command");
|
||||
return;
|
||||
}
|
||||
snprintf(command, len + 1, "%s %d %s %s",
|
||||
config->swaybg_command ? config->swaybg_command : "swaybg",
|
||||
output_i, oc->background, oc->background_option);
|
||||
wlr_log(L_DEBUG, "-> %s", command);
|
||||
wlr_log(WLR_DEBUG, "-> %s", command);
|
||||
|
||||
char *const cmd[] = { "sh", "-c", command, NULL };
|
||||
output->sway_output->bg_pid = fork();
|
||||
|
|
@ -212,11 +212,11 @@ void apply_output_config(struct output_config *oc, struct sway_container *output
|
|||
if (oc && oc->dpms_state != DPMS_IGNORE) {
|
||||
switch (oc->dpms_state) {
|
||||
case DPMS_ON:
|
||||
wlr_log(L_DEBUG, "Turning on screen");
|
||||
wlr_log(WLR_DEBUG, "Turning on screen");
|
||||
wlr_output_enable(wlr_output, true);
|
||||
break;
|
||||
case DPMS_OFF:
|
||||
wlr_log(L_DEBUG, "Turning off screen");
|
||||
wlr_log(WLR_DEBUG, "Turning off screen");
|
||||
wlr_output_enable(wlr_output, false);
|
||||
break;
|
||||
case DPMS_IGNORE:
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@
|
|||
struct seat_config *new_seat_config(const char* name) {
|
||||
struct seat_config *seat = calloc(1, sizeof(struct seat_config));
|
||||
if (!seat) {
|
||||
wlr_log(L_DEBUG, "Unable to allocate seat config");
|
||||
wlr_log(WLR_DEBUG, "Unable to allocate seat config");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wlr_log(L_DEBUG, "new_seat_config(%s)", name);
|
||||
wlr_log(WLR_DEBUG, "new_seat_config(%s)", name);
|
||||
seat->name = strdup(name);
|
||||
if (!sway_assert(seat->name, "could not allocate name for seat")) {
|
||||
free(seat);
|
||||
|
|
@ -34,7 +34,7 @@ struct seat_attachment_config *seat_attachment_config_new() {
|
|||
struct seat_attachment_config *attachment =
|
||||
calloc(1, sizeof(struct seat_attachment_config));
|
||||
if (!attachment) {
|
||||
wlr_log(L_DEBUG, "cannot allocate attachment config");
|
||||
wlr_log(WLR_DEBUG, "cannot allocate attachment config");
|
||||
return NULL;
|
||||
}
|
||||
return attachment;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue