summaryrefslogtreecommitdiffstats
path: root/sway/config
diff options
context:
space:
mode:
authorLibravatar emersion <contact@emersion.fr>2018-07-09 22:54:30 +0100
committerLibravatar emersion <contact@emersion.fr>2018-07-09 22:54:30 +0100
commit63b4bf500020cf35cebfdce2d73f8e359ff495c2 (patch)
tree76624b3d4820551261e5c15f773c403c1a41264e /sway/config
parentMerge pull request #2223 from RyanDwyer/floating-move (diff)
downloadsway-63b4bf500020cf35cebfdce2d73f8e359ff495c2.tar.gz
sway-63b4bf500020cf35cebfdce2d73f8e359ff495c2.tar.zst
sway-63b4bf500020cf35cebfdce2d73f8e359ff495c2.zip
Update for swaywm/wlroots#1126
Diffstat (limited to 'sway/config')
-rw-r--r--sway/config/bar.c14
-rw-r--r--sway/config/input.c8
-rw-r--r--sway/config/output.c26
-rw-r--r--sway/config/seat.c6
4 files changed, 27 insertions, 27 deletions
diff --git a/sway/config/bar.c b/sway/config/bar.c
index ee062c6a..3a74331e 100644
--- a/sway/config/bar.c
+++ b/sway/config/bar.c
@@ -16,10 +16,10 @@
16#include "log.h" 16#include "log.h"
17 17
18static void terminate_swaybar(pid_t pid) { 18static void terminate_swaybar(pid_t pid) {
19 wlr_log(L_DEBUG, "Terminating swaybar %d", pid); 19 wlr_log(WLR_DEBUG, "Terminating swaybar %d", pid);
20 int ret = kill(-pid, SIGTERM); 20 int ret = kill(-pid, SIGTERM);
21 if (ret != 0) { 21 if (ret != 0) {
22 wlr_log_errno(L_ERROR, "Unable to terminate swaybar %d", pid); 22 wlr_log_errno(WLR_ERROR, "Unable to terminate swaybar %d", pid);
23 } else { 23 } else {
24 int status; 24 int status;
25 waitpid(pid, &status, 0); 25 waitpid(pid, &status, 0);
@@ -167,7 +167,7 @@ void invoke_swaybar(struct bar_config *bar) {
167 // Pipe to communicate errors 167 // Pipe to communicate errors
168 int filedes[2]; 168 int filedes[2];
169 if (pipe(filedes) == -1) { 169 if (pipe(filedes) == -1) {
170 wlr_log(L_ERROR, "Pipe setup failed! Cannot fork into bar"); 170 wlr_log(WLR_ERROR, "Pipe setup failed! Cannot fork into bar");
171 return; 171 return;
172 } 172 }
173 173
@@ -197,17 +197,17 @@ void invoke_swaybar(struct bar_config *bar) {
197 execvp(cmd[0], cmd); 197 execvp(cmd[0], cmd);
198 exit(1); 198 exit(1);
199 } 199 }
200 wlr_log(L_DEBUG, "Spawned swaybar %d", bar->pid); 200 wlr_log(WLR_DEBUG, "Spawned swaybar %d", bar->pid);
201 close(filedes[0]); 201 close(filedes[0]);
202 size_t len; 202 size_t len;
203 if (read(filedes[1], &len, sizeof(size_t)) == sizeof(size_t)) { 203 if (read(filedes[1], &len, sizeof(size_t)) == sizeof(size_t)) {
204 char *buf = malloc(len); 204 char *buf = malloc(len);
205 if(!buf) { 205 if(!buf) {
206 wlr_log(L_ERROR, "Cannot allocate error string"); 206 wlr_log(WLR_ERROR, "Cannot allocate error string");
207 return; 207 return;
208 } 208 }
209 if (read(filedes[1], buf, len)) { 209 if (read(filedes[1], buf, len)) {
210 wlr_log(L_ERROR, "%s", buf); 210 wlr_log(WLR_ERROR, "%s", buf);
211 } 211 }
212 free(buf); 212 free(buf);
213 } 213 }
@@ -244,7 +244,7 @@ void load_swaybars() {
244 if (bar->pid != 0) { 244 if (bar->pid != 0) {
245 terminate_swaybar(bar->pid); 245 terminate_swaybar(bar->pid);
246 } 246 }
247 wlr_log(L_DEBUG, "Invoking swaybar for bar id '%s'", bar->id); 247 wlr_log(WLR_DEBUG, "Invoking swaybar for bar id '%s'", bar->id);
248 invoke_swaybar(bar); 248 invoke_swaybar(bar);
249 } 249 }
250 } 250 }
diff --git a/sway/config/input.c b/sway/config/input.c
index 17303ccc..9840df18 100644
--- a/sway/config/input.c
+++ b/sway/config/input.c
@@ -8,13 +8,13 @@
8struct input_config *new_input_config(const char* identifier) { 8struct input_config *new_input_config(const char* identifier) {
9 struct input_config *input = calloc(1, sizeof(struct input_config)); 9 struct input_config *input = calloc(1, sizeof(struct input_config));
10 if (!input) { 10 if (!input) {
11 wlr_log(L_DEBUG, "Unable to allocate input config"); 11 wlr_log(WLR_DEBUG, "Unable to allocate input config");
12 return NULL; 12 return NULL;
13 } 13 }
14 wlr_log(L_DEBUG, "new_input_config(%s)", identifier); 14 wlr_log(WLR_DEBUG, "new_input_config(%s)", identifier);
15 if (!(input->identifier = strdup(identifier))) { 15 if (!(input->identifier = strdup(identifier))) {
16 free(input); 16 free(input);
17 wlr_log(L_DEBUG, "Unable to allocate input config"); 17 wlr_log(WLR_DEBUG, "Unable to allocate input config");
18 return NULL; 18 return NULL;
19 } 19 }
20 20
@@ -112,7 +112,7 @@ void merge_input_config(struct input_config *dst, struct input_config *src) {
112struct input_config *copy_input_config(struct input_config *ic) { 112struct input_config *copy_input_config(struct input_config *ic) {
113 struct input_config *copy = calloc(1, sizeof(struct input_config)); 113 struct input_config *copy = calloc(1, sizeof(struct input_config));
114 if (copy == NULL) { 114 if (copy == NULL) {
115 wlr_log(L_ERROR, "could not allocate input config"); 115 wlr_log(WLR_ERROR, "could not allocate input config");
116 return NULL; 116 return NULL;
117 } 117 }
118 merge_input_config(copy, ic); 118 merge_input_config(copy, ic);
diff --git a/sway/config/output.c b/sway/config/output.c
index 648ded27..205e2633 100644
--- a/sway/config/output.c
+++ b/sway/config/output.c
@@ -90,7 +90,7 @@ static void set_mode(struct wlr_output *output, int width, int height,
90 float refresh_rate) { 90 float refresh_rate) {
91 int mhz = (int)(refresh_rate * 1000); 91 int mhz = (int)(refresh_rate * 1000);
92 if (wl_list_empty(&output->modes)) { 92 if (wl_list_empty(&output->modes)) {
93 wlr_log(L_DEBUG, "Assigning custom mode to %s", output->name); 93 wlr_log(WLR_DEBUG, "Assigning custom mode to %s", output->name);
94 wlr_output_set_custom_mode(output, width, height, mhz); 94 wlr_output_set_custom_mode(output, width, height, mhz);
95 return; 95 return;
96 } 96 }
@@ -106,9 +106,9 @@ static void set_mode(struct wlr_output *output, int width, int height,
106 } 106 }
107 } 107 }
108 if (!best) { 108 if (!best) {
109 wlr_log(L_ERROR, "Configured mode for %s not available", output->name); 109 wlr_log(WLR_ERROR, "Configured mode for %s not available", output->name);
110 } else { 110 } else {
111 wlr_log(L_DEBUG, "Assigning configured mode to %s", output->name); 111 wlr_log(WLR_DEBUG, "Assigning configured mode to %s", output->name);
112 wlr_output_set_mode(output, best); 112 wlr_output_set_mode(output, best);
113 } 113 }
114} 114}
@@ -116,7 +116,7 @@ static void set_mode(struct wlr_output *output, int width, int height,
116void terminate_swaybg(pid_t pid) { 116void terminate_swaybg(pid_t pid) {
117 int ret = kill(pid, SIGTERM); 117 int ret = kill(pid, SIGTERM);
118 if (ret != 0) { 118 if (ret != 0) {
119 wlr_log(L_ERROR, "Unable to terminate swaybg [pid: %d]", pid); 119 wlr_log(WLR_ERROR, "Unable to terminate swaybg [pid: %d]", pid);
120 } else { 120 } else {
121 int status; 121 int status;
122 waitpid(pid, &status, 0); 122 waitpid(pid, &status, 0);
@@ -144,22 +144,22 @@ void apply_output_config(struct output_config *oc, struct sway_container *output
144 } 144 }
145 145
146 if (oc && oc->width > 0 && oc->height > 0) { 146 if (oc && oc->width > 0 && oc->height > 0) {
147 wlr_log(L_DEBUG, "Set %s mode to %dx%d (%f GHz)", oc->name, oc->width, 147 wlr_log(WLR_DEBUG, "Set %s mode to %dx%d (%f GHz)", oc->name, oc->width,
148 oc->height, oc->refresh_rate); 148 oc->height, oc->refresh_rate);
149 set_mode(wlr_output, oc->width, oc->height, oc->refresh_rate); 149 set_mode(wlr_output, oc->width, oc->height, oc->refresh_rate);
150 } 150 }
151 if (oc && oc->scale > 0) { 151 if (oc && oc->scale > 0) {
152 wlr_log(L_DEBUG, "Set %s scale to %f", oc->name, oc->scale); 152 wlr_log(WLR_DEBUG, "Set %s scale to %f", oc->name, oc->scale);
153 wlr_output_set_scale(wlr_output, oc->scale); 153 wlr_output_set_scale(wlr_output, oc->scale);
154 } 154 }
155 if (oc && oc->transform >= 0) { 155 if (oc && oc->transform >= 0) {
156 wlr_log(L_DEBUG, "Set %s transform to %d", oc->name, oc->transform); 156 wlr_log(WLR_DEBUG, "Set %s transform to %d", oc->name, oc->transform);
157 wlr_output_set_transform(wlr_output, oc->transform); 157 wlr_output_set_transform(wlr_output, oc->transform);
158 } 158 }
159 159
160 // Find position for it 160 // Find position for it
161 if (oc && (oc->x != -1 || oc->y != -1)) { 161 if (oc && (oc->x != -1 || oc->y != -1)) {
162 wlr_log(L_DEBUG, "Set %s position to %d, %d", oc->name, oc->x, oc->y); 162 wlr_log(WLR_DEBUG, "Set %s position to %d, %d", oc->name, oc->x, oc->y);
163 wlr_output_layout_add(output_layout, wlr_output, oc->x, oc->y); 163 wlr_output_layout_add(output_layout, wlr_output, oc->x, oc->y);
164 } else { 164 } else {
165 wlr_output_layout_add_auto(output_layout, wlr_output); 165 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
187 terminate_swaybg(output->sway_output->bg_pid); 187 terminate_swaybg(output->sway_output->bg_pid);
188 } 188 }
189 189
190 wlr_log(L_DEBUG, "Setting background for output %d to %s", 190 wlr_log(WLR_DEBUG, "Setting background for output %d to %s",
191 output_i, oc->background); 191 output_i, oc->background);
192 192
193 size_t len = snprintf(NULL, 0, "%s %d %s %s", 193 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
195 output_i, oc->background, oc->background_option); 195 output_i, oc->background, oc->background_option);
196 char *command = malloc(len + 1); 196 char *command = malloc(len + 1);
197 if (!command) { 197 if (!command) {
198 wlr_log(L_DEBUG, "Unable to allocate swaybg command"); 198 wlr_log(WLR_DEBUG, "Unable to allocate swaybg command");
199 return; 199 return;
200 } 200 }
201 snprintf(command, len + 1, "%s %d %s %s", 201 snprintf(command, len + 1, "%s %d %s %s",
202 config->swaybg_command ? config->swaybg_command : "swaybg", 202 config->swaybg_command ? config->swaybg_command : "swaybg",
203 output_i, oc->background, oc->background_option); 203 output_i, oc->background, oc->background_option);
204 wlr_log(L_DEBUG, "-> %s", command); 204 wlr_log(WLR_DEBUG, "-> %s", command);
205 205
206 char *const cmd[] = { "sh", "-c", command, NULL }; 206 char *const cmd[] = { "sh", "-c", command, NULL };
207 output->sway_output->bg_pid = fork(); 207 output->sway_output->bg_pid = fork();
@@ -212,11 +212,11 @@ void apply_output_config(struct output_config *oc, struct sway_container *output
212 if (oc && oc->dpms_state != DPMS_IGNORE) { 212 if (oc && oc->dpms_state != DPMS_IGNORE) {
213 switch (oc->dpms_state) { 213 switch (oc->dpms_state) {
214 case DPMS_ON: 214 case DPMS_ON:
215 wlr_log(L_DEBUG, "Turning on screen"); 215 wlr_log(WLR_DEBUG, "Turning on screen");
216 wlr_output_enable(wlr_output, true); 216 wlr_output_enable(wlr_output, true);
217 break; 217 break;
218 case DPMS_OFF: 218 case DPMS_OFF:
219 wlr_log(L_DEBUG, "Turning off screen"); 219 wlr_log(WLR_DEBUG, "Turning off screen");
220 wlr_output_enable(wlr_output, false); 220 wlr_output_enable(wlr_output, false);
221 break; 221 break;
222 case DPMS_IGNORE: 222 case DPMS_IGNORE:
diff --git a/sway/config/seat.c b/sway/config/seat.c
index bd8b45c8..83dac4c0 100644
--- a/sway/config/seat.c
+++ b/sway/config/seat.c
@@ -7,11 +7,11 @@
7struct seat_config *new_seat_config(const char* name) { 7struct seat_config *new_seat_config(const char* name) {
8 struct seat_config *seat = calloc(1, sizeof(struct seat_config)); 8 struct seat_config *seat = calloc(1, sizeof(struct seat_config));
9 if (!seat) { 9 if (!seat) {
10 wlr_log(L_DEBUG, "Unable to allocate seat config"); 10 wlr_log(WLR_DEBUG, "Unable to allocate seat config");
11 return NULL; 11 return NULL;
12 } 12 }
13 13
14 wlr_log(L_DEBUG, "new_seat_config(%s)", name); 14 wlr_log(WLR_DEBUG, "new_seat_config(%s)", name);
15 seat->name = strdup(name); 15 seat->name = strdup(name);
16 if (!sway_assert(seat->name, "could not allocate name for seat")) { 16 if (!sway_assert(seat->name, "could not allocate name for seat")) {
17 free(seat); 17 free(seat);
@@ -34,7 +34,7 @@ struct seat_attachment_config *seat_attachment_config_new() {
34 struct seat_attachment_config *attachment = 34 struct seat_attachment_config *attachment =
35 calloc(1, sizeof(struct seat_attachment_config)); 35 calloc(1, sizeof(struct seat_attachment_config));
36 if (!attachment) { 36 if (!attachment) {
37 wlr_log(L_DEBUG, "cannot allocate attachment config"); 37 wlr_log(WLR_DEBUG, "cannot allocate attachment config");
38 return NULL; 38 return NULL;
39 } 39 }
40 return attachment; 40 return attachment;