aboutsummaryrefslogtreecommitdiff
path: root/rootston
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-01-18 21:34:10 +0100
committeremersion <contact@emersion.fr>2018-01-18 21:34:10 +0100
commit59ba8f35edba01a9a778a7255c65f37592025ccf (patch)
treec79670883e3d57aa062f68ce749cce47231bcb8a /rootston
parent3ba447a8f98ba804e51d9a2caabc5566e386595a (diff)
rootston: use surface damage
Diffstat (limited to 'rootston')
-rw-r--r--rootston/output.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/rootston/output.c b/rootston/output.c
index 62327b0c..6187217e 100644
--- a/rootston/output.c
+++ b/rootston/output.c
@@ -420,10 +420,34 @@ void output_damage_whole_view(struct roots_output *output,
// TODO: subsurfaces, popups, etc
}
+static void output_damage_from_surface(struct roots_output *output,
+ struct wlr_surface *surface, double lx, double ly) {
+ if (!wlr_surface_has_buffer(surface)) {
+ return;
+ }
+
+ struct wlr_box box;
+ bool intersects = surface_intersect_output(surface,
+ output->desktop->layout, output->wlr_output, lx, ly, &box);
+ if (!intersects) {
+ return;
+ }
+
+ pixman_region32_t damage;
+ pixman_region32_init(&damage);
+ pixman_region32_copy(&damage, &surface->current->surface_damage);
+ pixman_region32_translate(&damage, box.x, box.y);
+ pixman_region32_union(&output->damage, &output->damage, &damage);
+ pixman_region32_fini(&damage);
+}
+
void output_damage_from_view(struct roots_output *output,
struct roots_view *view) {
- // TODO: use surface damage
- output_damage_whole_view(output, view);
+ if (view->wlr_surface != NULL) {
+ output_damage_from_surface(output, view->wlr_surface, view->x, view->y);
+ }
+
+ // TODO: subsurfaces, popups, etc
}
static void set_mode(struct wlr_output *output,