diff options
Diffstat (limited to 'sway')
-rw-r--r-- | sway/desktop/output.c | 40 | ||||
-rw-r--r-- | sway/tree/layout.c | 16 |
2 files changed, 28 insertions, 28 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 10ed1f6d..4b407f41 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -46,10 +46,7 @@ static void rotate_child_position(double *sx, double *sy, double sw, double sh, | |||
46 | */ | 46 | */ |
47 | static bool surface_intersect_output(struct wlr_surface *surface, | 47 | static bool surface_intersect_output(struct wlr_surface *surface, |
48 | struct wlr_output_layout *output_layout, struct wlr_output *wlr_output, | 48 | struct wlr_output_layout *output_layout, struct wlr_output *wlr_output, |
49 | double lx, double ly, float rotation, struct wlr_box *box) { | 49 | double ox, double oy, float rotation, struct wlr_box *box) { |
50 | double ox = lx, oy = ly; | ||
51 | wlr_output_layout_output_coords(output_layout, wlr_output, &ox, &oy); | ||
52 | |||
53 | if (box != NULL) { | 50 | if (box != NULL) { |
54 | box->x = ox * wlr_output->scale; | 51 | box->x = ox * wlr_output->scale; |
55 | box->y = oy * wlr_output->scale; | 52 | box->y = oy * wlr_output->scale; |
@@ -58,7 +55,7 @@ static bool surface_intersect_output(struct wlr_surface *surface, | |||
58 | } | 55 | } |
59 | 56 | ||
60 | struct wlr_box layout_box = { | 57 | struct wlr_box layout_box = { |
61 | .x = lx, .y = ly, | 58 | .x = wlr_output->lx + ox, .y = wlr_output->ly + oy, |
62 | .width = surface->current->width, .height = surface->current->height, | 59 | .width = surface->current->width, .height = surface->current->height, |
63 | }; | 60 | }; |
64 | wlr_box_rotated_bounds(&layout_box, rotation, &layout_box); | 61 | wlr_box_rotated_bounds(&layout_box, rotation, &layout_box); |
@@ -67,7 +64,7 @@ static bool surface_intersect_output(struct wlr_surface *surface, | |||
67 | 64 | ||
68 | static void render_surface(struct wlr_surface *surface, | 65 | static void render_surface(struct wlr_surface *surface, |
69 | struct wlr_output *wlr_output, struct timespec *when, | 66 | struct wlr_output *wlr_output, struct timespec *when, |
70 | double lx, double ly, float rotation) { | 67 | double ox, double oy, float rotation) { |
71 | struct wlr_renderer *renderer = | 68 | struct wlr_renderer *renderer = |
72 | wlr_backend_get_renderer(wlr_output->backend); | 69 | wlr_backend_get_renderer(wlr_output->backend); |
73 | 70 | ||
@@ -79,7 +76,7 @@ static void render_surface(struct wlr_surface *surface, | |||
79 | 76 | ||
80 | struct wlr_box box; | 77 | struct wlr_box box; |
81 | bool intersects = surface_intersect_output(surface, layout, wlr_output, | 78 | bool intersects = surface_intersect_output(surface, layout, wlr_output, |
82 | lx, ly, rotation, &box); | 79 | ox, oy, rotation, &box); |
83 | if (intersects) { | 80 | if (intersects) { |
84 | float matrix[9]; | 81 | float matrix[9]; |
85 | enum wl_output_transform transform = | 82 | enum wl_output_transform transform = |
@@ -102,7 +99,7 @@ static void render_surface(struct wlr_surface *surface, | |||
102 | surface->current->width, surface->current->height, rotation); | 99 | surface->current->width, surface->current->height, rotation); |
103 | 100 | ||
104 | render_surface(subsurface->surface, wlr_output, when, | 101 | render_surface(subsurface->surface, wlr_output, when, |
105 | lx + sx, ly + sy, rotation); | 102 | ox + sx, oy + sy, rotation); |
106 | } | 103 | } |
107 | } | 104 | } |
108 | 105 | ||
@@ -200,9 +197,7 @@ static void render_view(struct sway_container *view, void *data) { | |||
200 | } | 197 | } |
201 | } | 198 | } |
202 | 199 | ||
203 | static void render_layer(struct sway_output *output, | 200 | static void render_layer(struct sway_output *output, struct timespec *when, |
204 | const struct wlr_box *output_layout_box, | ||
205 | struct timespec *when, | ||
206 | struct wl_list *layer) { | 201 | struct wl_list *layer) { |
207 | struct sway_layer_surface *sway_layer; | 202 | struct sway_layer_surface *sway_layer; |
208 | wl_list_for_each(sway_layer, layer, link) { | 203 | wl_list_for_each(sway_layer, layer, link) { |
@@ -234,14 +229,15 @@ static void render_output(struct sway_output *output, struct timespec *when, | |||
234 | float clear_color[] = {0.25f, 0.25f, 0.25f, 1.0f}; | 229 | float clear_color[] = {0.25f, 0.25f, 0.25f, 1.0f}; |
235 | wlr_renderer_clear(renderer, clear_color); | 230 | wlr_renderer_clear(renderer, clear_color); |
236 | 231 | ||
237 | struct wlr_output_layout *layout = root_container.sway_root->output_layout; | 232 | struct wlr_output_layout *output_layout = |
233 | root_container.sway_root->output_layout; | ||
238 | const struct wlr_box *output_box = | 234 | const struct wlr_box *output_box = |
239 | wlr_output_layout_get_box(layout, wlr_output); | 235 | wlr_output_layout_get_box(output_layout, wlr_output); |
240 | 236 | ||
241 | render_layer(output, output_box, when, | 237 | render_layer(output, when, |
242 | &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]); | 238 | &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]); |
243 | render_layer(output, output_box, when, | 239 | render_layer(output, when, |
244 | &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]); | 240 | &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]); |
245 | 241 | ||
246 | struct sway_seat *seat = input_manager_current_seat(input_manager); | 242 | struct sway_seat *seat = input_manager_current_seat(input_manager); |
247 | struct sway_container *focus = | 243 | struct sway_container *focus = |
@@ -251,7 +247,7 @@ static void render_output(struct sway_output *output, struct timespec *when, | |||
251 | focus = output->swayc->children->items[0]; | 247 | focus = output->swayc->children->items[0]; |
252 | } | 248 | } |
253 | struct sway_container *workspace = focus->type == C_WORKSPACE ? | 249 | struct sway_container *workspace = focus->type == C_WORKSPACE ? |
254 | focus : container_parent(focus, C_WORKSPACE); | 250 | focus : container_parent(focus, C_WORKSPACE); |
255 | 251 | ||
256 | struct render_data rdata = { | 252 | struct render_data rdata = { |
257 | .output = output, | 253 | .output = output, |
@@ -285,10 +281,10 @@ static void render_output(struct sway_output *output, struct timespec *when, | |||
285 | } | 281 | } |
286 | 282 | ||
287 | // TODO: Consider revising this when fullscreen windows are supported | 283 | // TODO: Consider revising this when fullscreen windows are supported |
288 | render_layer(output, output_box, when, | 284 | render_layer(output, when, |
289 | &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]); | 285 | &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]); |
290 | render_layer(output, output_box, when, | 286 | render_layer(output, when, |
291 | &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]); | 287 | &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]); |
292 | 288 | ||
293 | renderer_end: | 289 | renderer_end: |
294 | wlr_renderer_end(renderer); | 290 | wlr_renderer_end(renderer); |
diff --git a/sway/tree/layout.c b/sway/tree/layout.c index 95a84d12..617350d9 100644 --- a/sway/tree/layout.c +++ b/sway/tree/layout.c | |||
@@ -19,10 +19,14 @@ | |||
19 | 19 | ||
20 | struct sway_container root_container; | 20 | struct sway_container root_container; |
21 | 21 | ||
22 | static void output_layout_change_notify(struct wl_listener *listener, | 22 | static void output_layout_handle_change(struct wl_listener *listener, |
23 | void *data) { | 23 | void *data) { |
24 | struct wlr_box *layout_box = wlr_output_layout_get_box( | 24 | struct wlr_output_layout *output_layout = |
25 | root_container.sway_root->output_layout, NULL); | 25 | root_container.sway_root->output_layout; |
26 | const struct wlr_box *layout_box = | ||
27 | wlr_output_layout_get_box(output_layout, NULL); | ||
28 | root_container.x = layout_box->x; | ||
29 | root_container.y = layout_box->y; | ||
26 | root_container.width = layout_box->width; | 30 | root_container.width = layout_box->width; |
27 | root_container.height = layout_box->height; | 31 | root_container.height = layout_box->height; |
28 | 32 | ||
@@ -34,8 +38,8 @@ static void output_layout_change_notify(struct wl_listener *listener, | |||
34 | } | 38 | } |
35 | struct sway_output *output = output_container->sway_output; | 39 | struct sway_output *output = output_container->sway_output; |
36 | 40 | ||
37 | struct wlr_box *output_box = wlr_output_layout_get_box( | 41 | const struct wlr_box *output_box = |
38 | root_container.sway_root->output_layout, output->wlr_output); | 42 | wlr_output_layout_get_box(output_layout, output->wlr_output); |
39 | if (!output_box) { | 43 | if (!output_box) { |
40 | continue; | 44 | continue; |
41 | } | 45 | } |
@@ -62,7 +66,7 @@ void layout_init(void) { | |||
62 | wl_signal_init(&root_container.sway_root->events.new_container); | 66 | wl_signal_init(&root_container.sway_root->events.new_container); |
63 | 67 | ||
64 | root_container.sway_root->output_layout_change.notify = | 68 | root_container.sway_root->output_layout_change.notify = |
65 | output_layout_change_notify; | 69 | output_layout_handle_change; |
66 | wl_signal_add(&root_container.sway_root->output_layout->events.change, | 70 | wl_signal_add(&root_container.sway_root->output_layout->events.change, |
67 | &root_container.sway_root->output_layout_change); | 71 | &root_container.sway_root->output_layout_change); |
68 | } | 72 | } |