diff options
Diffstat (limited to 'sway/tree')
-rw-r--r-- | sway/tree/arrange.c | 25 | ||||
-rw-r--r-- | sway/tree/container.c | 26 | ||||
-rw-r--r-- | sway/tree/output.c | 8 | ||||
-rw-r--r-- | sway/tree/root.c | 2 | ||||
-rw-r--r-- | sway/tree/view.c | 1 |
5 files changed, 29 insertions, 33 deletions
diff --git a/sway/tree/arrange.c b/sway/tree/arrange.c index 9c1a11e5..4aa82c35 100644 --- a/sway/tree/arrange.c +++ b/sway/tree/arrange.c @@ -311,13 +311,12 @@ void arrange_output(struct sway_output *output) { if (config->reloading) { return; } - struct wlr_box output_box; - wlr_output_layout_get_box(root->output_layout, - output->wlr_output, &output_box); - output->lx = output_box.x; - output->ly = output_box.y; - output->width = output_box.width; - output->height = output_box.height; + const struct wlr_box *output_box = wlr_output_layout_get_box( + root->output_layout, output->wlr_output); + output->lx = output_box->x; + output->ly = output_box->y; + output->width = output_box->width; + output->height = output_box->height; for (int i = 0; i < output->workspaces->length; ++i) { struct sway_workspace *workspace = output->workspaces->items[i]; @@ -329,12 +328,12 @@ void arrange_root(void) { if (config->reloading) { return; } - struct wlr_box layout_box; - wlr_output_layout_get_box(root->output_layout, NULL, &layout_box); - root->x = layout_box.x; - root->y = layout_box.y; - root->width = layout_box.width; - root->height = layout_box.height; + const struct wlr_box *layout_box = + wlr_output_layout_get_box(root->output_layout, NULL); + root->x = layout_box->x; + root->y = layout_box->y; + root->width = layout_box->width; + root->height = layout_box->height; if (root->fullscreen_global) { struct sway_container *fs = root->fullscreen_global; diff --git a/sway/tree/container.c b/sway/tree/container.c index 2b6aa2ec..17289dd3 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -9,7 +9,6 @@ #include <wayland-server-core.h> #include <wlr/types/wlr_linux_dmabuf_v1.h> #include <wlr/types/wlr_output_layout.h> -#include <wlr/types/wlr_subcompositor.h> #include <wlr/render/drm_format_set.h> #include "linux-dmabuf-unstable-v1-protocol.h" #include "cairo_util.h" @@ -195,7 +194,7 @@ static struct sway_container *surface_at_view(struct sway_container *con, double #endif case SWAY_VIEW_XDG_SHELL: _surface = wlr_xdg_surface_surface_at( - view->wlr_xdg_toplevel->base, + view->wlr_xdg_surface, view_sx, view_sy, &_sx, &_sy); break; } @@ -696,13 +695,12 @@ void floating_calculate_constraints(int *min_width, int *max_width, *min_height = config->floating_minimum_height; } - struct wlr_box box; - wlr_output_layout_get_box(root->output_layout, NULL, &box); + struct wlr_box *box = wlr_output_layout_get_box(root->output_layout, NULL); if (config->floating_maximum_width == -1) { // no maximum *max_width = INT_MAX; } else if (config->floating_maximum_width == 0) { // automatic - *max_width = box.width; + *max_width = box->width; } else { *max_width = config->floating_maximum_width; } @@ -710,7 +708,7 @@ void floating_calculate_constraints(int *min_width, int *max_width, if (config->floating_maximum_height == -1) { // no maximum *max_height = INT_MAX; } else if (config->floating_maximum_height == 0) { // automatic - *max_height = box.height; + *max_height = box->height; } else { *max_height = config->floating_maximum_height; } @@ -742,9 +740,9 @@ void container_floating_resize_and_center(struct sway_container *con) { return; } - struct wlr_box ob; - wlr_output_layout_get_box(root->output_layout, ws->output->wlr_output, &ob); - if (wlr_box_empty(&ob)) { + struct wlr_box *ob = wlr_output_layout_get_box(root->output_layout, + ws->output->wlr_output); + if (!ob) { // On NOOP output. Will be called again when moved to an output con->pending.x = 0; con->pending.y = 0; @@ -756,8 +754,8 @@ void container_floating_resize_and_center(struct sway_container *con) { floating_natural_resize(con); if (!con->view) { if (con->pending.width > ws->width || con->pending.height > ws->height) { - con->pending.x = ob.x + (ob.width - con->pending.width) / 2; - con->pending.y = ob.y + (ob.height - con->pending.height) / 2; + con->pending.x = ob->x + (ob->width - con->pending.width) / 2; + con->pending.y = ob->y + (ob->height - con->pending.height) / 2; } else { con->pending.x = ws->x + (ws->width - con->pending.width) / 2; con->pending.y = ws->y + (ws->height - con->pending.height) / 2; @@ -765,8 +763,8 @@ void container_floating_resize_and_center(struct sway_container *con) { } else { if (con->pending.content_width > ws->width || con->pending.content_height > ws->height) { - con->pending.content_x = ob.x + (ob.width - con->pending.content_width) / 2; - con->pending.content_y = ob.y + (ob.height - con->pending.content_height) / 2; + con->pending.content_x = ob->x + (ob->width - con->pending.content_width) / 2; + con->pending.content_y = ob->y + (ob->height - con->pending.content_height) / 2; } else { con->pending.content_x = ws->x + (ws->width - con->pending.content_width) / 2; con->pending.content_y = ws->y + (ws->height - con->pending.content_height) / 2; @@ -1707,7 +1705,7 @@ static void update_marks_texture(struct sway_container *con, for (int i = 0; i < con->marks->length; ++i) { char *mark = con->marks->items[i]; if (mark[0] != '_') { - snprintf(part, len + 1, "[%s]", mark); + sprintf(part, "[%s]", mark); strcat(buffer, part); } } diff --git a/sway/tree/output.c b/sway/tree/output.c index 52826c91..ad8d2482 100644 --- a/sway/tree/output.c +++ b/sway/tree/output.c @@ -301,10 +301,10 @@ struct sway_output *output_get_in_direction(struct sway_output *reference, if (!sway_assert(direction, "got invalid direction: %d", direction)) { return NULL; } - struct wlr_box output_box; - wlr_output_layout_get_box(root->output_layout, reference->wlr_output, &output_box); - int lx = output_box.x + output_box.width / 2; - int ly = output_box.y + output_box.height / 2; + struct wlr_box *output_box = + wlr_output_layout_get_box(root->output_layout, reference->wlr_output); + int lx = output_box->x + output_box->width / 2; + int ly = output_box->y + output_box->height / 2; struct wlr_output *wlr_adjacent = wlr_output_layout_adjacent_output( root->output_layout, direction, reference->wlr_output, lx, ly); if (!wlr_adjacent) { diff --git a/sway/tree/root.c b/sway/tree/root.c index 8508e9eb..73f3993c 100644 --- a/sway/tree/root.c +++ b/sway/tree/root.c @@ -209,7 +209,7 @@ static pid_t get_parent_pid(pid_t child) { FILE *stat = NULL; size_t buf_size = 0; - snprintf(file_name, sizeof(file_name), "/proc/%d/stat", child); + sprintf(file_name, "/proc/%d/stat", child); if ((stat = fopen(file_name, "r"))) { if (getline(&buffer, &buf_size, stat) != -1) { diff --git a/sway/tree/view.c b/sway/tree/view.c index 176be8af..8b7061ba 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -6,7 +6,6 @@ #include <wlr/types/wlr_buffer.h> #include <wlr/types/wlr_output_layout.h> #include <wlr/types/wlr_server_decoration.h> -#include <wlr/types/wlr_subcompositor.h> #include <wlr/types/wlr_xdg_decoration_v1.h> #include "config.h" #if HAVE_XWAYLAND |