diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-04-07 11:53:10 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-07 11:53:10 -0400 |
commit | c47b4d4edb7714612ec7236fafda5ca54cb92ce4 (patch) | |
tree | 9a7f991e9c3da20351b58c53e0b6dbe376f12dca /sway/tree/view.c | |
parent | Merge pull request #1700 from swaywm/move-cmd-full (diff) | |
parent | Damage all surfaces when damaging whole container (diff) | |
download | sway-c47b4d4edb7714612ec7236fafda5ca54cb92ce4.tar.gz sway-c47b4d4edb7714612ec7236fafda5ca54cb92ce4.tar.zst sway-c47b4d4edb7714612ec7236fafda5ca54cb92ce4.zip |
Merge pull request #1756 from emersion/output-damage
Fine-grained damage tracking
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r-- | sway/tree/view.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c index 9855c5e1..99b44720 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -79,20 +79,15 @@ void view_close(struct sway_view *view) { | |||
79 | } | 79 | } |
80 | } | 80 | } |
81 | 81 | ||
82 | void view_damage_whole(struct sway_view *view) { | 82 | void view_damage(struct sway_view *view, bool whole) { |
83 | for (int i = 0; i < root_container.children->length; ++i) { | 83 | for (int i = 0; i < root_container.children->length; ++i) { |
84 | struct sway_container *cont = root_container.children->items[i]; | 84 | struct sway_container *cont = root_container.children->items[i]; |
85 | if (cont->type == C_OUTPUT) { | 85 | if (cont->type == C_OUTPUT) { |
86 | output_damage_whole_view(cont->sway_output, view); | 86 | output_damage_view(cont->sway_output, view, whole); |
87 | } | 87 | } |
88 | } | 88 | } |
89 | } | 89 | } |
90 | 90 | ||
91 | void view_damage_from(struct sway_view *view) { | ||
92 | // TODO | ||
93 | view_damage_whole(view); | ||
94 | } | ||
95 | |||
96 | static void view_get_layout_box(struct sway_view *view, struct wlr_box *box) { | 91 | static void view_get_layout_box(struct sway_view *view, struct wlr_box *box) { |
97 | struct sway_container *output = container_parent(view->swayc, C_OUTPUT); | 92 | struct sway_container *output = container_parent(view->swayc, C_OUTPUT); |
98 | 93 | ||
@@ -191,7 +186,7 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface) { | |||
191 | arrange_windows(cont->parent, -1, -1); | 186 | arrange_windows(cont->parent, -1, -1); |
192 | input_manager_set_focus(input_manager, cont); | 187 | input_manager_set_focus(input_manager, cont); |
193 | 188 | ||
194 | view_damage_whole(view); | 189 | view_damage(view, true); |
195 | view_handle_container_reparent(&view->container_reparent, NULL); | 190 | view_handle_container_reparent(&view->container_reparent, NULL); |
196 | } | 191 | } |
197 | 192 | ||
@@ -202,7 +197,7 @@ void view_unmap(struct sway_view *view) { | |||
202 | 197 | ||
203 | wl_signal_emit(&view->events.unmap, view); | 198 | wl_signal_emit(&view->events.unmap, view); |
204 | 199 | ||
205 | view_damage_whole(view); | 200 | view_damage(view, true); |
206 | 201 | ||
207 | wl_list_remove(&view->surface_new_subsurface.link); | 202 | wl_list_remove(&view->surface_new_subsurface.link); |
208 | wl_list_remove(&view->container_reparent.link); | 203 | wl_list_remove(&view->container_reparent.link); |
@@ -220,10 +215,10 @@ void view_update_position(struct sway_view *view, double ox, double oy) { | |||
220 | return; | 215 | return; |
221 | } | 216 | } |
222 | 217 | ||
223 | view_damage_whole(view); | 218 | view_damage(view, true); |
224 | view->swayc->x = ox; | 219 | view->swayc->x = ox; |
225 | view->swayc->y = oy; | 220 | view->swayc->y = oy; |
226 | view_damage_whole(view); | 221 | view_damage(view, true); |
227 | } | 222 | } |
228 | 223 | ||
229 | void view_update_size(struct sway_view *view, int width, int height) { | 224 | void view_update_size(struct sway_view *view, int width, int height) { |
@@ -231,10 +226,10 @@ void view_update_size(struct sway_view *view, int width, int height) { | |||
231 | return; | 226 | return; |
232 | } | 227 | } |
233 | 228 | ||
234 | view_damage_whole(view); | 229 | view_damage(view, true); |
235 | view->width = width; | 230 | view->width = width; |
236 | view->height = height; | 231 | view->height = height; |
237 | view_damage_whole(view); | 232 | view_damage(view, true); |
238 | } | 233 | } |
239 | 234 | ||
240 | 235 | ||
@@ -253,7 +248,7 @@ static void view_child_handle_surface_commit(struct wl_listener *listener, | |||
253 | struct sway_view_child *child = | 248 | struct sway_view_child *child = |
254 | wl_container_of(listener, child, surface_commit); | 249 | wl_container_of(listener, child, surface_commit); |
255 | // TODO: only accumulate damage from the child | 250 | // TODO: only accumulate damage from the child |
256 | view_damage_from(child->view); | 251 | view_damage(child->view, false); |
257 | } | 252 | } |
258 | 253 | ||
259 | static void view_child_handle_surface_new_subsurface( | 254 | static void view_child_handle_surface_new_subsurface( |
@@ -315,12 +310,12 @@ void view_child_init(struct sway_view_child *child, | |||
315 | view_init_subsurfaces(child->view, surface); | 310 | view_init_subsurfaces(child->view, surface); |
316 | 311 | ||
317 | // TODO: only damage the whole child | 312 | // TODO: only damage the whole child |
318 | view_damage_whole(child->view); | 313 | view_damage(child->view, true); |
319 | } | 314 | } |
320 | 315 | ||
321 | void view_child_destroy(struct sway_view_child *child) { | 316 | void view_child_destroy(struct sway_view_child *child) { |
322 | // TODO: only damage the whole child | 317 | // TODO: only damage the whole child |
323 | view_damage_whole(child->view); | 318 | view_damage(child->view, true); |
324 | 319 | ||
325 | wl_list_remove(&child->surface_commit.link); | 320 | wl_list_remove(&child->surface_commit.link); |
326 | wl_list_remove(&child->surface_destroy.link); | 321 | wl_list_remove(&child->surface_destroy.link); |