aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-08-30 21:20:31 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-09-05 18:01:43 +1000
commitacc2628c799170dea98380cda2237137137f182f (patch)
treeb28b186339b90b75a767b96c780f9a643ff70204
parentImplement type safe arguments and demote sway_container (diff)
downloadsway-acc2628c799170dea98380cda2237137137f182f.tar.gz
sway-acc2628c799170dea98380cda2237137137f182f.tar.zst
sway-acc2628c799170dea98380cda2237137137f182f.zip
Don't use wlr_output properties
These properties are before rotation.
-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 {
28 struct timespec last_frame; 28 struct timespec last_frame;
29 struct wlr_output_damage *damage; 29 struct wlr_output_damage *damage;
30 30
31 int lx, ly;
32 int width, height;
33
31 bool enabled; 34 bool enabled;
32 list_t *workspaces; 35 list_t *workspaces;
33 36
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) {
43 case N_OUTPUT: 43 case N_OUTPUT:
44 snprintf(buffer, 512, "N_OUTPUT id:%zd '%s' %dx%d@%d,%d", node->id, 44 snprintf(buffer, 512, "N_OUTPUT id:%zd '%s' %dx%d@%d,%d", node->id,
45 node->sway_output->wlr_output->name, 45 node->sway_output->wlr_output->name,
46 node->sway_output->wlr_output->width, 46 node->sway_output->width,
47 node->sway_output->wlr_output->height, 47 node->sway_output->height,
48 node->sway_output->wlr_output->lx, 48 node->sway_output->lx,
49 node->sway_output->wlr_output->ly); 49 node->sway_output->ly);
50 break; 50 break;
51 case N_WORKSPACE: 51 case N_WORKSPACE:
52 snprintf(buffer, 512, "N_WORKSPACE id:%zd '%s' %s %dx%d@%.f,%.f", 52 snprintf(buffer, 512, "N_WORKSPACE id:%zd '%s' %s %dx%d@%.f,%.f",
@@ -128,11 +128,11 @@ void update_debug_tree() {
128 int width = 640, height = 480; 128 int width = 640, height = 480;
129 for (int i = 0; i < root->outputs->length; ++i) { 129 for (int i = 0; i < root->outputs->length; ++i) {
130 struct sway_output *output = root->outputs->items[i]; 130 struct sway_output *output = root->outputs->items[i];
131 if (output->wlr_output->width > width) { 131 if (output->width > width) {
132 width = output->wlr_output->width; 132 width = output->width;
133 } 133 }
134 if (output->wlr_output->height > height) { 134 if (output->height > height) {
135 height = output->wlr_output->height; 135 height = output->height;
136 } 136 }
137 } 137 }
138 cairo_surface_t *surface = 138 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,
98 wlr_box_rotated_bounds(&box, data->rotation, &rotated_box); 98 wlr_box_rotated_bounds(&box, data->rotation, &rotated_box);
99 99
100 struct wlr_box output_box = { 100 struct wlr_box output_box = {
101 .width = output->wlr_output->width, 101 .width = output->width,
102 .height = output->wlr_output->height, 102 .height = output->height,
103 }; 103 };
104 104
105 struct wlr_box intersection; 105 struct wlr_box intersection;
@@ -249,8 +249,8 @@ bool output_has_opaque_overlay_layer_surface(struct sway_output *output) {
249 struct sway_layer_surface *sway_layer_surface = 249 struct sway_layer_surface *sway_layer_surface =
250 layer_from_wlr_layer_surface(wlr_layer_surface); 250 layer_from_wlr_layer_surface(wlr_layer_surface);
251 pixman_box32_t output_box = { 251 pixman_box32_t output_box = {
252 .x2 = output->wlr_output->width, 252 .x2 = output->width,
253 .y2 = output->wlr_output->height, 253 .y2 = output->height,
254 }; 254 };
255 pixman_region32_t surface_opaque_box; 255 pixman_region32_t surface_opaque_box;
256 pixman_region32_init(&surface_opaque_box); 256 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,
238 }; 238 };
239 239
240 struct wlr_box output_box = { 240 struct wlr_box output_box = {
241 .width = output->wlr_output->width, 241 .width = output->width,
242 .height = output->wlr_output->height, 242 .height = output->height,
243 }; 243 };
244 244
245 struct wlr_box intersection; 245 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) {
59 // the output box expressed in the coordinate system of the toplevel parent 59 // the output box expressed in the coordinate system of the toplevel parent
60 // of the popup 60 // of the popup
61 struct wlr_box output_toplevel_sx_box = { 61 struct wlr_box output_toplevel_sx_box = {
62 .x = output->wlr_output->lx - view->x, 62 .x = output->lx - view->x,
63 .y = output->wlr_output->ly - view->y, 63 .y = output->ly - view->y,
64 .width = output->wlr_output->width, 64 .width = output->width,
65 .height = output->wlr_output->height, 65 .height = output->height,
66 }; 66 };
67 67
68 wlr_xdg_popup_unconstrain_from_box(wlr_popup, &output_toplevel_sx_box); 68 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) {
58 // the output box expressed in the coordinate system of the toplevel parent 58 // the output box expressed in the coordinate system of the toplevel parent
59 // of the popup 59 // of the popup
60 struct wlr_box output_toplevel_sx_box = { 60 struct wlr_box output_toplevel_sx_box = {
61 .x = output->wlr_output->lx - view->x, 61 .x = output->lx - view->x,
62 .y = output->wlr_output->ly - view->y, 62 .y = output->ly - view->y,
63 .width = output->wlr_output->width, 63 .width = output->width,
64 .height = output->wlr_output->height, 64 .height = output->height,
65 }; 65 };
66 66
67 wlr_xdg_popup_v6_unconstrain_from_box(wlr_popup, &output_toplevel_sx_box); 67 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) {
219 struct sway_container *fs = workspace->fullscreen; 219 struct sway_container *fs = workspace->fullscreen;
220 fs->x = output->wlr_output->lx; 220 fs->x = output->wlr_output->lx;
221 fs->y = output->wlr_output->ly; 221 fs->y = output->wlr_output->ly;
222 fs->width = output->wlr_output->width; 222 fs->width = output->width;
223 fs->height = output->wlr_output->height; 223 fs->height = output->height;
224 arrange_container(fs); 224 arrange_container(fs);
225 } else { 225 } else {
226 struct wlr_box box; 226 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) {
75 apply_output_config(oc, output); 75 apply_output_config(oc, output);
76 list_add(root->outputs, output); 76 list_add(root->outputs, output);
77 77
78 output->lx = wlr_output->lx;
79 output->ly = wlr_output->ly;
80 wlr_output_transformed_resolution(wlr_output,
81 &output->width, &output->height);
82
78 restore_workspaces(output); 83 restore_workspaces(output);
79 84
80 if (!output->workspaces->length) { 85 if (!output->workspaces->length) {
@@ -265,8 +270,8 @@ struct sway_output *output_get_in_direction(struct sway_output *reference,
265 "got invalid direction: %d", direction)) { 270 "got invalid direction: %d", direction)) {
266 return NULL; 271 return NULL;
267 } 272 }
268 int lx = reference->wlr_output->lx + reference->wlr_output->width / 2; 273 int lx = reference->wlr_output->lx + reference->width / 2;
269 int ly = reference->wlr_output->ly + reference->wlr_output->height / 2; 274 int ly = reference->wlr_output->ly + reference->height / 2;
270 struct wlr_output *wlr_adjacent = wlr_output_layout_adjacent_output( 275 struct wlr_output *wlr_adjacent = wlr_output_layout_adjacent_output(
271 root->output_layout, wlr_dir, reference->wlr_output, lx, ly); 276 root->output_layout, wlr_dir, reference->wlr_output, lx, ly);
272 if (!wlr_adjacent) { 277 if (!wlr_adjacent) {
@@ -346,10 +351,10 @@ void output_sort_workspaces(struct sway_output *output) {
346} 351}
347 352
348void output_get_box(struct sway_output *output, struct wlr_box *box) { 353void output_get_box(struct sway_output *output, struct wlr_box *box) {
349 box->x = output->wlr_output->lx; 354 box->x = output->lx;
350 box->y = output->wlr_output->ly; 355 box->y = output->ly;
351 box->width = output->wlr_output->width; 356 box->width = output->width;
352 box->height = output->wlr_output->height; 357 box->height = output->height;
353} 358}
354 359
355enum sway_container_layout output_get_default_layout( 360enum sway_container_layout output_get_default_layout(
@@ -360,7 +365,7 @@ enum sway_container_layout output_get_default_layout(
360 if (config->default_orientation != L_NONE) { 365 if (config->default_orientation != L_NONE) {
361 return config->default_orientation; 366 return config->default_orientation;
362 } 367 }
363 if (output->wlr_output->height > output->wlr_output->width) { 368 if (output->height > output->width) {
364 return L_VERT; 369 return L_VERT;
365 } 370 }
366 return L_HORIZ; 371 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) {
167 struct sway_output *output = view->container->workspace->output; 167 struct sway_output *output = view->container->workspace->output;
168 168
169 if (view->container->is_fullscreen) { 169 if (view->container->is_fullscreen) {
170 view->x = output->wlr_output->lx; 170 view->x = output->lx;
171 view->y = output->wlr_output->ly; 171 view->y = output->ly;
172 view->width = output->wlr_output->width; 172 view->width = output->width;
173 view->height = output->wlr_output->height; 173 view->height = output->height;
174 return; 174 return;
175 } 175 }
176 176
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,
53 return NULL; 53 return NULL;
54 } 54 }
55 node_init(&ws->node, N_WORKSPACE, ws); 55 node_init(&ws->node, N_WORKSPACE, ws);
56 ws->x = output->wlr_output->lx; 56 ws->x = output->lx;
57 ws->y = output->wlr_output->ly; 57 ws->y = output->ly;
58 ws->width = output->wlr_output->width; 58 ws->width = output->width;
59 ws->height = output->wlr_output->height; 59 ws->height = output->height;
60 ws->name = name ? strdup(name) : NULL; 60 ws->name = name ? strdup(name) : NULL;
61 ws->prev_split_layout = L_NONE; 61 ws->prev_split_layout = L_NONE;
62 ws->layout = output_get_default_layout(output); 62 ws->layout = output_get_default_layout(output);