summaryrefslogtreecommitdiffstats
path: root/sway/desktop/output.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/desktop/output.c')
-rw-r--r--sway/desktop/output.c40
1 files changed, 18 insertions, 22 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index 96f23291..8a4fb4a2 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -57,10 +57,7 @@ static void rotate_child_position(double *sx, double *sy, double sw, double sh,
57 */ 57 */
58static bool surface_intersect_output(struct wlr_surface *surface, 58static bool surface_intersect_output(struct wlr_surface *surface,
59 struct wlr_output_layout *output_layout, struct wlr_output *wlr_output, 59 struct wlr_output_layout *output_layout, struct wlr_output *wlr_output,
60 double lx, double ly, float rotation, struct wlr_box *box) { 60 double ox, double oy, float rotation, struct wlr_box *box) {
61 double ox = lx, oy = ly;
62 wlr_output_layout_output_coords(output_layout, wlr_output, &ox, &oy);
63
64 if (box != NULL) { 61 if (box != NULL) {
65 box->x = ox * wlr_output->scale; 62 box->x = ox * wlr_output->scale;
66 box->y = oy * wlr_output->scale; 63 box->y = oy * wlr_output->scale;
@@ -69,7 +66,7 @@ static bool surface_intersect_output(struct wlr_surface *surface,
69 } 66 }
70 67
71 struct wlr_box layout_box = { 68 struct wlr_box layout_box = {
72 .x = lx, .y = ly, 69 .x = wlr_output->lx + ox, .y = wlr_output->ly + oy,
73 .width = surface->current->width, .height = surface->current->height, 70 .width = surface->current->width, .height = surface->current->height,
74 }; 71 };
75 wlr_box_rotated_bounds(&layout_box, rotation, &layout_box); 72 wlr_box_rotated_bounds(&layout_box, rotation, &layout_box);
@@ -78,7 +75,7 @@ static bool surface_intersect_output(struct wlr_surface *surface,
78 75
79static void render_surface(struct wlr_surface *surface, 76static void render_surface(struct wlr_surface *surface,
80 struct wlr_output *wlr_output, struct timespec *when, 77 struct wlr_output *wlr_output, struct timespec *when,
81 double lx, double ly, float rotation) { 78 double ox, double oy, float rotation) {
82 struct wlr_renderer *renderer = 79 struct wlr_renderer *renderer =
83 wlr_backend_get_renderer(wlr_output->backend); 80 wlr_backend_get_renderer(wlr_output->backend);
84 81
@@ -90,7 +87,7 @@ static void render_surface(struct wlr_surface *surface,
90 87
91 struct wlr_box box; 88 struct wlr_box box;
92 bool intersects = surface_intersect_output(surface, layout, wlr_output, 89 bool intersects = surface_intersect_output(surface, layout, wlr_output,
93 lx, ly, rotation, &box); 90 ox, oy, rotation, &box);
94 if (intersects) { 91 if (intersects) {
95 float matrix[9]; 92 float matrix[9];
96 enum wl_output_transform transform = 93 enum wl_output_transform transform =
@@ -113,7 +110,7 @@ static void render_surface(struct wlr_surface *surface,
113 surface->current->width, surface->current->height, rotation); 110 surface->current->width, surface->current->height, rotation);
114 111
115 render_surface(subsurface->surface, wlr_output, when, 112 render_surface(subsurface->surface, wlr_output, when,
116 lx + sx, ly + sy, rotation); 113 ox + sx, oy + sy, rotation);
117 } 114 }
118} 115}
119 116
@@ -211,9 +208,7 @@ static void render_view(struct sway_container *view, void *data) {
211 } 208 }
212} 209}
213 210
214static void render_layer(struct sway_output *output, 211static void render_layer(struct sway_output *output, struct timespec *when,
215 const struct wlr_box *output_layout_box,
216 struct timespec *when,
217 struct wl_list *layer) { 212 struct wl_list *layer) {
218 struct sway_layer_surface *sway_layer; 213 struct sway_layer_surface *sway_layer;
219 wl_list_for_each(sway_layer, layer, link) { 214 wl_list_for_each(sway_layer, layer, link) {
@@ -245,14 +240,15 @@ static void render_output(struct sway_output *output, struct timespec *when,
245 float clear_color[] = {0.25f, 0.25f, 0.25f, 1.0f}; 240 float clear_color[] = {0.25f, 0.25f, 0.25f, 1.0f};
246 wlr_renderer_clear(renderer, clear_color); 241 wlr_renderer_clear(renderer, clear_color);
247 242
248 struct wlr_output_layout *layout = root_container.sway_root->output_layout; 243 struct wlr_output_layout *output_layout =
244 root_container.sway_root->output_layout;
249 const struct wlr_box *output_box = 245 const struct wlr_box *output_box =
250 wlr_output_layout_get_box(layout, wlr_output); 246 wlr_output_layout_get_box(output_layout, wlr_output);
251 247
252 render_layer(output, output_box, when, 248 render_layer(output, when,
253 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]); 249 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]);
254 render_layer(output, output_box, when, 250 render_layer(output, when,
255 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]); 251 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]);
256 252
257 struct sway_seat *seat = input_manager_current_seat(input_manager); 253 struct sway_seat *seat = input_manager_current_seat(input_manager);
258 struct sway_container *focus = 254 struct sway_container *focus =
@@ -262,7 +258,7 @@ static void render_output(struct sway_output *output, struct timespec *when,
262 focus = output->swayc->children->items[0]; 258 focus = output->swayc->children->items[0];
263 } 259 }
264 struct sway_container *workspace = focus->type == C_WORKSPACE ? 260 struct sway_container *workspace = focus->type == C_WORKSPACE ?
265 focus : container_parent(focus, C_WORKSPACE); 261 focus : container_parent(focus, C_WORKSPACE);
266 262
267 struct render_data rdata = { 263 struct render_data rdata = {
268 .output = output, 264 .output = output,
@@ -296,10 +292,10 @@ static void render_output(struct sway_output *output, struct timespec *when,
296 } 292 }
297 293
298 // TODO: Consider revising this when fullscreen windows are supported 294 // TODO: Consider revising this when fullscreen windows are supported
299 render_layer(output, output_box, when, 295 render_layer(output, when,
300 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]); 296 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]);
301 render_layer(output, output_box, when, 297 render_layer(output, when,
302 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]); 298 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]);
303 299
304renderer_end: 300renderer_end:
305 wlr_renderer_end(renderer); 301 wlr_renderer_end(renderer);