diff options
-rw-r--r-- | client/pool-buffer.c | 1 | ||||
-rw-r--r-- | sway/commands/focus.c | 1 | ||||
-rw-r--r-- | sway/commands/resize.c | 11 | ||||
-rw-r--r-- | sway/desktop/layer_shell.c | 2 | ||||
-rw-r--r-- | sway/desktop/xdg_shell.c | 3 | ||||
-rw-r--r-- | sway/desktop/xdg_shell_v6.c | 3 | ||||
-rw-r--r-- | sway/desktop/xwayland.c | 3 | ||||
-rw-r--r-- | sway/tree/root.c | 9 | ||||
-rw-r--r-- | sway/tree/view.c | 4 | ||||
-rw-r--r-- | swaybar/tray/item.c | 2 | ||||
-rw-r--r-- | swaynag/render.c | 7 |
11 files changed, 14 insertions, 32 deletions
diff --git a/client/pool-buffer.c b/client/pool-buffer.c index 588bd06c..836c6b13 100644 --- a/client/pool-buffer.c +++ b/client/pool-buffer.c | |||
@@ -85,7 +85,6 @@ static struct pool_buffer *create_buffer(struct wl_shm *shm, | |||
85 | close(fd); | 85 | close(fd); |
86 | unlink(name); | 86 | unlink(name); |
87 | free(name); | 87 | free(name); |
88 | fd = -1; | ||
89 | 88 | ||
90 | buf->size = size; | 89 | buf->size = size; |
91 | buf->width = width; | 90 | buf->width = width; |
diff --git a/sway/commands/focus.c b/sway/commands/focus.c index e7680062..0622f2e8 100644 --- a/sway/commands/focus.c +++ b/sway/commands/focus.c | |||
@@ -123,7 +123,6 @@ static struct sway_node *node_get_in_direction(struct sway_container *container, | |||
123 | 123 | ||
124 | if (can_move) { | 124 | if (can_move) { |
125 | if (desired < 0 || desired >= siblings->length) { | 125 | if (desired < 0 || desired >= siblings->length) { |
126 | can_move = false; | ||
127 | int len = siblings->length; | 126 | int len = siblings->length; |
128 | if (config->focus_wrapping != WRAP_NO && !wrap_candidate | 127 | if (config->focus_wrapping != WRAP_NO && !wrap_candidate |
129 | && len > 1) { | 128 | && len > 1) { |
diff --git a/sway/commands/resize.c b/sway/commands/resize.c index 0e497239..204de539 100644 --- a/sway/commands/resize.c +++ b/sway/commands/resize.c | |||
@@ -478,8 +478,9 @@ static struct cmd_results *cmd_resize_set(int argc, char **argv) { | |||
478 | argc--; argv++; | 478 | argc--; argv++; |
479 | } | 479 | } |
480 | int num_consumed_args = parse_resize_amount(argc, argv, &height); | 480 | int num_consumed_args = parse_resize_amount(argc, argv, &height); |
481 | argc -= num_consumed_args; | 481 | if (argc > num_consumed_args) { |
482 | argv += num_consumed_args; | 482 | return cmd_results_new(CMD_INVALID, usage); |
483 | } | ||
483 | if (width.unit == RESIZE_UNIT_INVALID) { | 484 | if (width.unit == RESIZE_UNIT_INVALID) { |
484 | return cmd_results_new(CMD_INVALID, usage); | 485 | return cmd_results_new(CMD_INVALID, usage); |
485 | } | 486 | } |
@@ -543,12 +544,14 @@ static struct cmd_results *cmd_resize_adjust(int argc, char **argv, | |||
543 | struct resize_amount second_amount; | 544 | struct resize_amount second_amount; |
544 | if (argc) { | 545 | if (argc) { |
545 | int num_consumed_args = parse_resize_amount(argc, argv, &second_amount); | 546 | int num_consumed_args = parse_resize_amount(argc, argv, &second_amount); |
546 | argc -= num_consumed_args; | 547 | if (argc > num_consumed_args) { |
547 | argv += num_consumed_args; | 548 | return cmd_results_new(CMD_INVALID, usage); |
549 | } | ||
548 | if (second_amount.unit == RESIZE_UNIT_INVALID) { | 550 | if (second_amount.unit == RESIZE_UNIT_INVALID) { |
549 | return cmd_results_new(CMD_INVALID, usage); | 551 | return cmd_results_new(CMD_INVALID, usage); |
550 | } | 552 | } |
551 | } else { | 553 | } else { |
554 | second_amount.amount = 0; | ||
552 | second_amount.unit = RESIZE_UNIT_INVALID; | 555 | second_amount.unit = RESIZE_UNIT_INVALID; |
553 | } | 556 | } |
554 | 557 | ||
diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c index a870bb9a..de8db75d 100644 --- a/sway/desktop/layer_shell.c +++ b/sway/desktop/layer_shell.c | |||
@@ -354,8 +354,6 @@ struct sway_layer_surface *layer_from_wlr_layer_surface_v1( | |||
354 | 354 | ||
355 | void handle_layer_shell_surface(struct wl_listener *listener, void *data) { | 355 | void handle_layer_shell_surface(struct wl_listener *listener, void *data) { |
356 | struct wlr_layer_surface_v1 *layer_surface = data; | 356 | struct wlr_layer_surface_v1 *layer_surface = data; |
357 | struct sway_server *server = | ||
358 | wl_container_of(listener, server, layer_shell_surface); | ||
359 | sway_log(SWAY_DEBUG, "new layer surface: namespace %s layer %d anchor %d " | 357 | sway_log(SWAY_DEBUG, "new layer surface: namespace %s layer %d anchor %d " |
360 | "size %dx%d margin %d,%d,%d,%d", | 358 | "size %dx%d margin %d,%d,%d,%d", |
361 | layer_surface->namespace, layer_surface->layer, layer_surface->layer, | 359 | layer_surface->namespace, layer_surface->layer, layer_surface->layer, |
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c index b4ac3a68..e2c614b3 100644 --- a/sway/desktop/xdg_shell.c +++ b/sway/desktop/xdg_shell.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include "sway/input/input-manager.h" | 13 | #include "sway/input/input-manager.h" |
14 | #include "sway/input/seat.h" | 14 | #include "sway/input/seat.h" |
15 | #include "sway/output.h" | 15 | #include "sway/output.h" |
16 | #include "sway/server.h" | ||
17 | #include "sway/tree/arrange.h" | 16 | #include "sway/tree/arrange.h" |
18 | #include "sway/tree/container.h" | 17 | #include "sway/tree/container.h" |
19 | #include "sway/tree/view.h" | 18 | #include "sway/tree/view.h" |
@@ -480,8 +479,6 @@ struct sway_view *view_from_wlr_xdg_surface( | |||
480 | } | 479 | } |
481 | 480 | ||
482 | void handle_xdg_shell_surface(struct wl_listener *listener, void *data) { | 481 | void handle_xdg_shell_surface(struct wl_listener *listener, void *data) { |
483 | struct sway_server *server = wl_container_of(listener, server, | ||
484 | xdg_shell_surface); | ||
485 | struct wlr_xdg_surface *xdg_surface = data; | 482 | struct wlr_xdg_surface *xdg_surface = data; |
486 | 483 | ||
487 | if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP) { | 484 | if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP) { |
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c index 553d532d..f11c00b1 100644 --- a/sway/desktop/xdg_shell_v6.c +++ b/sway/desktop/xdg_shell_v6.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include "sway/input/input-manager.h" | 12 | #include "sway/input/input-manager.h" |
13 | #include "sway/input/seat.h" | 13 | #include "sway/input/seat.h" |
14 | #include "sway/output.h" | 14 | #include "sway/output.h" |
15 | #include "sway/server.h" | ||
16 | #include "sway/tree/arrange.h" | 15 | #include "sway/tree/arrange.h" |
17 | #include "sway/tree/container.h" | 16 | #include "sway/tree/container.h" |
18 | #include "sway/tree/view.h" | 17 | #include "sway/tree/view.h" |
@@ -464,8 +463,6 @@ struct sway_view *view_from_wlr_xdg_surface_v6( | |||
464 | } | 463 | } |
465 | 464 | ||
466 | void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) { | 465 | void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) { |
467 | struct sway_server *server = wl_container_of(listener, server, | ||
468 | xdg_shell_v6_surface); | ||
469 | struct wlr_xdg_surface_v6 *xdg_surface = data; | 466 | struct wlr_xdg_surface_v6 *xdg_surface = data; |
470 | 467 | ||
471 | if (xdg_surface->role == WLR_XDG_SURFACE_V6_ROLE_POPUP) { | 468 | if (xdg_surface->role == WLR_XDG_SURFACE_V6_ROLE_POPUP) { |
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index 8dcf4bd6..4ea661f8 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include "sway/input/input-manager.h" | 12 | #include "sway/input/input-manager.h" |
13 | #include "sway/input/seat.h" | 13 | #include "sway/input/seat.h" |
14 | #include "sway/output.h" | 14 | #include "sway/output.h" |
15 | #include "sway/server.h" | ||
16 | #include "sway/tree/arrange.h" | 15 | #include "sway/tree/arrange.h" |
17 | #include "sway/tree/container.h" | 16 | #include "sway/tree/container.h" |
18 | #include "sway/tree/view.h" | 17 | #include "sway/tree/view.h" |
@@ -573,8 +572,6 @@ struct sway_view *view_from_wlr_xwayland_surface( | |||
573 | } | 572 | } |
574 | 573 | ||
575 | void handle_xwayland_surface(struct wl_listener *listener, void *data) { | 574 | void handle_xwayland_surface(struct wl_listener *listener, void *data) { |
576 | struct sway_server *server = wl_container_of(listener, server, | ||
577 | xwayland_surface); | ||
578 | struct wlr_xwayland_surface *xsurface = data; | 575 | struct wlr_xwayland_surface *xsurface = data; |
579 | 576 | ||
580 | if (xsurface->override_redirect) { | 577 | if (xsurface->override_redirect) { |
diff --git a/sway/tree/root.c b/sway/tree/root.c index c4d1145d..99cf91a7 100644 --- a/sway/tree/root.c +++ b/sway/tree/root.c | |||
@@ -169,7 +169,6 @@ static pid_t get_parent_pid(pid_t child) { | |||
169 | pid_t parent = -1; | 169 | pid_t parent = -1; |
170 | char file_name[100]; | 170 | char file_name[100]; |
171 | char *buffer = NULL; | 171 | char *buffer = NULL; |
172 | char *token = NULL; | ||
173 | const char *sep = " "; | 172 | const char *sep = " "; |
174 | FILE *stat = NULL; | 173 | FILE *stat = NULL; |
175 | size_t buf_size = 0; | 174 | size_t buf_size = 0; |
@@ -178,10 +177,10 @@ static pid_t get_parent_pid(pid_t child) { | |||
178 | 177 | ||
179 | if ((stat = fopen(file_name, "r"))) { | 178 | if ((stat = fopen(file_name, "r"))) { |
180 | if (getline(&buffer, &buf_size, stat) != -1) { | 179 | if (getline(&buffer, &buf_size, stat) != -1) { |
181 | token = strtok(buffer, sep); // pid | 180 | strtok(buffer, sep); // pid |
182 | token = strtok(NULL, sep); // executable name | 181 | strtok(NULL, sep); // executable name |
183 | token = strtok(NULL, sep); // state | 182 | strtok(NULL, sep); // state |
184 | token = strtok(NULL, sep); // parent pid | 183 | char *token = strtok(NULL, sep); // parent pid |
185 | parent = strtol(token, NULL, 10); | 184 | parent = strtol(token, NULL, 10); |
186 | } | 185 | } |
187 | free(buffer); | 186 | free(buffer); |
diff --git a/sway/tree/view.c b/sway/tree/view.c index edbfca97..8795e04f 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -236,8 +236,6 @@ void view_autoconfigure(struct sway_view *view) { | |||
236 | con->border_bottom = bottom_y != ws->y + ws->height; | 236 | con->border_bottom = bottom_y != ws->y + ws->height; |
237 | } | 237 | } |
238 | 238 | ||
239 | double x, y, width, height; | ||
240 | x = y = width = height = 0; | ||
241 | double y_offset = 0; | 239 | double y_offset = 0; |
242 | 240 | ||
243 | // In a tabbed or stacked container, the container's y is the top of the | 241 | // In a tabbed or stacked container, the container's y is the top of the |
@@ -253,7 +251,9 @@ void view_autoconfigure(struct sway_view *view) { | |||
253 | con->border_top = false; | 251 | con->border_top = false; |
254 | } | 252 | } |
255 | 253 | ||
254 | double x, y, width, height; | ||
256 | switch (con->border) { | 255 | switch (con->border) { |
256 | default: | ||
257 | case B_CSD: | 257 | case B_CSD: |
258 | case B_NONE: | 258 | case B_NONE: |
259 | x = con->x; | 259 | x = con->x; |
diff --git a/swaybar/tray/item.c b/swaybar/tray/item.c index 39d83b23..a43bbf6f 100644 --- a/swaybar/tray/item.c +++ b/swaybar/tray/item.c | |||
@@ -334,7 +334,7 @@ static void handle_click(struct swaybar_sni *sni, int x, int y, | |||
334 | 334 | ||
335 | if (strncmp(method, "Scroll", strlen("Scroll")) == 0) { | 335 | if (strncmp(method, "Scroll", strlen("Scroll")) == 0) { |
336 | char dir = method[strlen("Scroll")]; | 336 | char dir = method[strlen("Scroll")]; |
337 | char *orientation = (dir = 'U' || dir == 'D') ? "vertical" : "horizontal"; | 337 | char *orientation = (dir == 'U' || dir == 'D') ? "vertical" : "horizontal"; |
338 | int sign = (dir == 'U' || dir == 'L') ? -1 : 1; | 338 | int sign = (dir == 'U' || dir == 'L') ? -1 : 1; |
339 | 339 | ||
340 | sd_bus_call_method_async(sni->tray->bus, NULL, sni->service, sni->path, | 340 | sd_bus_call_method_async(sni->tray->bus, NULL, sni->service, sni->path, |
diff --git a/swaynag/render.c b/swaynag/render.c index c9f4ef1d..f6507e67 100644 --- a/swaynag/render.c +++ b/swaynag/render.c | |||
@@ -8,9 +8,6 @@ | |||
8 | #include "wlr-layer-shell-unstable-v1-client-protocol.h" | 8 | #include "wlr-layer-shell-unstable-v1-client-protocol.h" |
9 | 9 | ||
10 | static uint32_t render_message(cairo_t *cairo, struct swaynag *swaynag) { | 10 | static uint32_t render_message(cairo_t *cairo, struct swaynag *swaynag) { |
11 | uint32_t height = swaynag->height * swaynag->scale; | ||
12 | height -= swaynag->type->bar_border_thickness * swaynag->scale; | ||
13 | |||
14 | int text_width, text_height; | 11 | int text_width, text_height; |
15 | get_text_size(cairo, swaynag->type->font, &text_width, &text_height, NULL, | 12 | get_text_size(cairo, swaynag->type->font, &text_width, &text_height, NULL, |
16 | swaynag->scale, true, "%s", swaynag->message); | 13 | swaynag->scale, true, "%s", swaynag->message); |
@@ -77,8 +74,6 @@ static int get_detailed_scroll_button_width(cairo_t *cairo, | |||
77 | static uint32_t render_detailed(cairo_t *cairo, struct swaynag *swaynag, | 74 | static uint32_t render_detailed(cairo_t *cairo, struct swaynag *swaynag, |
78 | uint32_t y) { | 75 | uint32_t y) { |
79 | uint32_t width = swaynag->width * swaynag->scale; | 76 | uint32_t width = swaynag->width * swaynag->scale; |
80 | uint32_t height = swaynag->height * swaynag->scale; | ||
81 | height -= swaynag->type->bar_border_thickness * swaynag->scale; | ||
82 | 77 | ||
83 | int border = swaynag->type->details_border_thickness * swaynag->scale; | 78 | int border = swaynag->type->details_border_thickness * swaynag->scale; |
84 | int padding = swaynag->type->message_padding * swaynag->scale; | 79 | int padding = swaynag->type->message_padding * swaynag->scale; |
@@ -174,8 +169,6 @@ static uint32_t render_detailed(cairo_t *cairo, struct swaynag *swaynag, | |||
174 | 169 | ||
175 | static uint32_t render_button(cairo_t *cairo, struct swaynag *swaynag, | 170 | static uint32_t render_button(cairo_t *cairo, struct swaynag *swaynag, |
176 | int button_index, int *x) { | 171 | int button_index, int *x) { |
177 | uint32_t height = swaynag->height * swaynag->scale; | ||
178 | height -= swaynag->type->bar_border_thickness * swaynag->scale; | ||
179 | struct swaynag_button *button = swaynag->buttons->items[button_index]; | 172 | struct swaynag_button *button = swaynag->buttons->items[button_index]; |
180 | 173 | ||
181 | int text_width, text_height; | 174 | int text_width, text_height; |