aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/sway/output.h3
-rw-r--r--sway/debug-tree.c16
-rw-r--r--sway/desktop/output.c8
-rw-r--r--sway/desktop/render.c4
-rw-r--r--sway/desktop/xdg_shell.c8
-rw-r--r--sway/desktop/xdg_shell_v6.c8
-rw-r--r--sway/tree/arrange.c4
-rw-r--r--sway/tree/output.c19
-rw-r--r--sway/tree/view.c8
-rw-r--r--sway/tree/workspace.c8
10 files changed, 47 insertions, 39 deletions
diff --git a/include/sway/output.h b/include/sway/output.h
index 540ed8a0..19a61175 100644
--- a/include/sway/output.h
+++ b/include/sway/output.h
@@ -28,6 +28,9 @@ struct sway_output {
struct timespec last_frame;
struct wlr_output_damage *damage;
+ int lx, ly;
+ int width, height;
+
bool enabled;
list_t *workspaces;
diff --git a/sway/debug-tree.c b/sway/debug-tree.c
index 2ed3c087..973c6d88 100644
--- a/sway/debug-tree.c
+++ b/sway/debug-tree.c
@@ -43,10 +43,10 @@ static char *get_string(struct sway_node *node) {
case N_OUTPUT:
snprintf(buffer, 512, "N_OUTPUT id:%zd '%s' %dx%d@%d,%d", node->id,
node->sway_output->wlr_output->name,
- node->sway_output->wlr_output->width,
- node->sway_output->wlr_output->height,
- node->sway_output->wlr_output->lx,
- node->sway_output->wlr_output->ly);
+ node->sway_output->width,
+ node->sway_output->height,
+ node->sway_output->lx,
+ node->sway_output->ly);
break;
case N_WORKSPACE:
snprintf(buffer, 512, "N_WORKSPACE id:%zd '%s' %s %dx%d@%.f,%.f",
@@ -128,11 +128,11 @@ void update_debug_tree() {
int width = 640, height = 480;
for (int i = 0; i < root->outputs->length; ++i) {
struct sway_output *output = root->outputs->items[i];
- if (output->wlr_output->width > width) {
- width = output->wlr_output->width;
+ if (output->width > width) {
+ width = output->width;
}
- if (output->wlr_output->height > height) {
- height = output->wlr_output->height;
+ if (output->height > height) {
+ height = output->height;
}
}
cairo_surface_t *surface =
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index c182bad6..792a7231 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -98,8 +98,8 @@ static bool get_surface_box(struct surface_iterator_data *data,
wlr_box_rotated_bounds(&box, data->rotation, &rotated_box);
struct wlr_box output_box = {
- .width = output->wlr_output->width,
- .height = output->wlr_output->height,
+ .width = output->width,
+ .height = output->height,
};
struct wlr_box intersection;
@@ -249,8 +249,8 @@ bool output_has_opaque_overlay_layer_surface(struct sway_output *output) {
struct sway_layer_surface *sway_layer_surface =
layer_from_wlr_layer_surface(wlr_layer_surface);
pixman_box32_t output_box = {
- .x2 = output->wlr_output->width,
- .y2 = output->wlr_output->height,
+ .x2 = output->width,
+ .y2 = output->height,
};
pixman_region32_t surface_opaque_box;
pixman_region32_init(&surface_opaque_box);
diff --git a/sway/desktop/render.c b/sway/desktop/render.c
index 99b2cf3d..9d80f3c7 100644
--- a/sway/desktop/render.c
+++ b/sway/desktop/render.c
@@ -238,8 +238,8 @@ static void render_saved_view(struct sway_view *view,
};
struct wlr_box output_box = {
- .width = output->wlr_output->width,
- .height = output->wlr_output->height,
+ .width = output->width,
+ .height = output->height,
};
struct wlr_box intersection;
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c
index e19d8e18..575f229d 100644
--- a/sway/desktop/xdg_shell.c
+++ b/sway/desktop/xdg_shell.c
@@ -59,10 +59,10 @@ static void popup_unconstrain(struct sway_xdg_popup *popup) {
// the output box expressed in the coordinate system of the toplevel parent
// of the popup
struct wlr_box output_toplevel_sx_box = {
- .x = output->wlr_output->lx - view->x,
- .y = output->wlr_output->ly - view->y,
- .width = output->wlr_output->width,
- .height = output->wlr_output->height,
+ .x = output->lx - view->x,
+ .y = output->ly - view->y,
+ .width = output->width,
+ .height = output->height,
};
wlr_xdg_popup_unconstrain_from_box(wlr_popup, &output_toplevel_sx_box);
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c
index b23d4577..58fbd631 100644
--- a/sway/desktop/xdg_shell_v6.c
+++ b/sway/desktop/xdg_shell_v6.c
@@ -58,10 +58,10 @@ static void popup_unconstrain(struct sway_xdg_popup_v6 *popup) {
// the output box expressed in the coordinate system of the toplevel parent
// of the popup
struct wlr_box output_toplevel_sx_box = {
- .x = output->wlr_output->lx - view->x,
- .y = output->wlr_output->ly - view->y,
- .width = output->wlr_output->width,
- .height = output->wlr_output->height,
+ .x = output->lx - view->x,
+ .y = output->ly - view->y,
+ .width = output->width,
+ .height = output->height,
};
wlr_xdg_popup_v6_unconstrain_from_box(wlr_popup, &output_toplevel_sx_box);
diff --git a/sway/tree/arrange.c b/sway/tree/arrange.c
index f86d4a74..2cccf65a 100644
--- a/sway/tree/arrange.c
+++ b/sway/tree/arrange.c
@@ -219,8 +219,8 @@ void arrange_workspace(struct sway_workspace *workspace) {
struct sway_container *fs = workspace->fullscreen;
fs->x = output->wlr_output->lx;
fs->y = output->wlr_output->ly;
- fs->width = output->wlr_output->width;
- fs->height = output->wlr_output->height;
+ fs->width = output->width;
+ fs->height = output->height;
arrange_container(fs);
} else {
struct wlr_box box;
diff --git a/sway/tree/output.c b/sway/tree/output.c
index d72eb1a1..afc336f8 100644
--- a/sway/tree/output.c
+++ b/sway/tree/output.c
@@ -75,6 +75,11 @@ void output_enable(struct sway_output *output, struct output_config *oc) {
apply_output_config(oc, output);
list_add(root->outputs, output);
+ output->lx = wlr_output->lx;
+ output->ly = wlr_output->ly;
+ wlr_output_transformed_resolution(wlr_output,
+ &output->width, &output->height);
+
restore_workspaces(output);
if (!output->workspaces->length) {
@@ -265,8 +270,8 @@ struct sway_output *output_get_in_direction(struct sway_output *reference,
"got invalid direction: %d", direction)) {
return NULL;
}
- int lx = reference->wlr_output->lx + reference->wlr_output->width / 2;
- int ly = reference->wlr_output->ly + reference->wlr_output->height / 2;
+ int lx = reference->wlr_output->lx + reference->width / 2;
+ int ly = reference->wlr_output->ly + reference->height / 2;
struct wlr_output *wlr_adjacent = wlr_output_layout_adjacent_output(
root->output_layout, wlr_dir, reference->wlr_output, lx, ly);
if (!wlr_adjacent) {
@@ -346,10 +351,10 @@ void output_sort_workspaces(struct sway_output *output) {
}
void output_get_box(struct sway_output *output, struct wlr_box *box) {
- box->x = output->wlr_output->lx;
- box->y = output->wlr_output->ly;
- box->width = output->wlr_output->width;
- box->height = output->wlr_output->height;
+ box->x = output->lx;
+ box->y = output->ly;
+ box->width = output->width;
+ box->height = output->height;
}
enum sway_container_layout output_get_default_layout(
@@ -360,7 +365,7 @@ enum sway_container_layout output_get_default_layout(
if (config->default_orientation != L_NONE) {
return config->default_orientation;
}
- if (output->wlr_output->height > output->wlr_output->width) {
+ if (output->height > output->width) {
return L_VERT;
}
return L_HORIZ;
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 452c2bd1..ff63df2d 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -167,10 +167,10 @@ void view_autoconfigure(struct sway_view *view) {
struct sway_output *output = view->container->workspace->output;
if (view->container->is_fullscreen) {
- view->x = output->wlr_output->lx;
- view->y = output->wlr_output->ly;
- view->width = output->wlr_output->width;
- view->height = output->wlr_output->height;
+ view->x = output->lx;
+ view->y = output->ly;
+ view->width = output->width;
+ view->height = output->height;
return;
}
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c
index 38ee478e..bb1ded22 100644
--- a/sway/tree/workspace.c
+++ b/sway/tree/workspace.c
@@ -53,10 +53,10 @@ struct sway_workspace *workspace_create(struct sway_output *output,
return NULL;
}
node_init(&ws->node, N_WORKSPACE, ws);
- ws->x = output->wlr_output->lx;
- ws->y = output->wlr_output->ly;
- ws->width = output->wlr_output->width;
- ws->height = output->wlr_output->height;
+ ws->x = output->lx;
+ ws->y = output->ly;
+ ws->width = output->width;
+ ws->height = output->height;
ws->name = name ? strdup(name) : NULL;
ws->prev_split_layout = L_NONE;
ws->layout = output_get_default_layout(output);