aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/output.c
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2018-03-28 18:10:43 -0400
committerLibravatar Drew DeVault <sir@cmpwn.com>2018-03-28 18:11:03 -0400
commit8d6bce02afc656bf792815ed68121f4e614cd175 (patch)
treeb28c55c464feb85c61f314a26487404fd63f4fb3 /sway/desktop/output.c
parentRender layer surfaces and respect exclusive zone (diff)
downloadsway-8d6bce02afc656bf792815ed68121f4e614cd175.tar.gz
sway-8d6bce02afc656bf792815ed68121f4e614cd175.tar.zst
sway-8d6bce02afc656bf792815ed68121f4e614cd175.zip
Address review feedback
Diffstat (limited to 'sway/desktop/output.c')
-rw-r--r--sway/desktop/output.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index 59f79a81..9e7fbcc6 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -81,9 +81,7 @@ static void render_surface(struct wlr_surface *surface,
81 rotate_child_position(&sx, &sy, sw, sh, width, height, rotation); 81 rotate_child_position(&sx, &sy, sw, sh, width, height, rotation);
82 82
83 render_surface(subsurface->surface, wlr_output, when, 83 render_surface(subsurface->surface, wlr_output, when,
84 lx + sx, 84 lx + sx, ly + sy, rotation);
85 ly + sy,
86 rotation);
87 } 85 }
88} 86}
89 87
@@ -142,9 +140,15 @@ static void render_wl_shell_surface(struct wlr_wl_shell_surface *surface,
142 } 140 }
143} 141}
144 142
143struct render_data {
144 struct sway_output *output;
145 struct timespec *now;
146};
145 147
146static void output_frame_view(swayc_t *view, void *data) { 148static void output_frame_view(swayc_t *view, void *data) {
147 struct sway_output *output = data; 149 struct render_data *rdata = data;
150 struct sway_output *output = rdata->output;
151 struct timespec *now = rdata->now;
148 struct wlr_output *wlr_output = output->wlr_output; 152 struct wlr_output *wlr_output = output->wlr_output;
149 struct sway_view *sway_view = view->sway_view; 153 struct sway_view *sway_view = view->sway_view;
150 struct wlr_surface *surface = sway_view->surface; 154 struct wlr_surface *surface = sway_view->surface;
@@ -157,23 +161,18 @@ static void output_frame_view(swayc_t *view, void *data) {
157 case SWAY_XDG_SHELL_V6_VIEW: { 161 case SWAY_XDG_SHELL_V6_VIEW: {
158 int window_offset_x = view->sway_view->wlr_xdg_surface_v6->geometry.x; 162 int window_offset_x = view->sway_view->wlr_xdg_surface_v6->geometry.x;
159 int window_offset_y = view->sway_view->wlr_xdg_surface_v6->geometry.y; 163 int window_offset_y = view->sway_view->wlr_xdg_surface_v6->geometry.y;
160 render_surface(surface, wlr_output, &output->last_frame, 164 render_surface(surface, wlr_output, now,
161 view->x - window_offset_x, 165 view->x - window_offset_x, view->y - window_offset_y, 0);
162 view->y - window_offset_y,
163 0);
164 render_xdg_v6_popups(sway_view->wlr_xdg_surface_v6, wlr_output, 166 render_xdg_v6_popups(sway_view->wlr_xdg_surface_v6, wlr_output,
165 &output->last_frame, 167 now, view->x - window_offset_x, view->y - window_offset_y, 0);
166 view->x - window_offset_x, view->y - window_offset_y,
167 0);
168 break; 168 break;
169 } 169 }
170 case SWAY_WL_SHELL_VIEW: 170 case SWAY_WL_SHELL_VIEW:
171 render_wl_shell_surface(sway_view->wlr_wl_shell_surface, wlr_output, 171 render_wl_shell_surface(sway_view->wlr_wl_shell_surface, wlr_output,
172 &output->last_frame, view->x, view->y, 0, false); 172 now, view->x, view->y, 0, false);
173 break; 173 break;
174 case SWAY_XWAYLAND_VIEW: 174 case SWAY_XWAYLAND_VIEW:
175 render_surface(surface, wlr_output, &output->last_frame, view->x, 175 render_surface(surface, wlr_output, now, view->x, view->y, 0);
176 view->y, 0);
177 break; 176 break;
178 default: 177 default:
179 break; 178 break;
@@ -224,7 +223,11 @@ static void output_frame_notify(struct wl_listener *listener, void *data) {
224 focus : 223 focus :
225 swayc_parent_by_type(focus, C_WORKSPACE)); 224 swayc_parent_by_type(focus, C_WORKSPACE));
226 225
227 swayc_descendants_of_type(workspace, C_VIEW, output_frame_view, soutput); 226 struct render_data rdata = {
227 .output = soutput,
228 .now = &now,
229 };
230 swayc_descendants_of_type(workspace, C_VIEW, output_frame_view, &rdata);
228 231
229 // render unmanaged views on top 232 // render unmanaged views on top
230 struct sway_view *view; 233 struct sway_view *view;
@@ -246,8 +249,7 @@ static void output_frame_notify(struct wl_listener *listener, void *data) {
246 &soutput->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]); 249 &soutput->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]);
247 250
248 wlr_renderer_end(server->renderer); 251 wlr_renderer_end(server->renderer);
249 wlr_output_swap_buffers(wlr_output, &soutput->last_frame, NULL); 252 wlr_output_swap_buffers(wlr_output, &now, NULL);
250
251 soutput->last_frame = now; 253 soutput->last_frame = now;
252} 254}
253 255