diff --git a/12to11-test.xml b/12to11-test.xml
index 64180b7..7604a4c 100644
--- a/12to11-test.xml
+++ b/12to11-test.xml
@@ -154,6 +154,13 @@
+
+
+ Force the subcompositor to be garbaged, and all contents
+ redrawn from scratch upon any damage.
+
+
+
The map event is sent once the window is mapped and its
diff --git a/compositor.h b/compositor.h
index 3894f27..a3fcef7 100644
--- a/compositor.h
+++ b/compositor.h
@@ -820,6 +820,7 @@ extern SubcompositorDestroyCallback *SubcompositorOnDestroy (Subcompositor *,
void (*) (void *),
void *);
extern void SubcompositorRemoveDestroyCallback (SubcompositorDestroyCallback *);
+extern void SubcompositorSetAlwaysGarbaged (Subcompositor *);
extern void ViewSetSubcompositor (View *, Subcompositor *);
diff --git a/subcompositor.c b/subcompositor.c
index a228da9..cde4ab3 100644
--- a/subcompositor.c
+++ b/subcompositor.c
@@ -133,6 +133,8 @@ enum
SubcompositorIsPartiallyMapped = (1 << 4),
/* This means that the subcompositor has a target attached. */
SubcompositorIsTargetAttached = (1 << 5),
+ /* This means the subcompositor is always garbaged. */
+ SubcompositorIsAlwaysGarbaged = (1 << 6),
};
#define IsGarbaged(subcompositor) \
@@ -160,6 +162,11 @@ enum
#define IsTargetAttached(subcompositor) \
((subcompositor)->state & SubcompositorIsTargetAttached)
+#define SetAlwaysGarbaged(subcompositor) \
+ ((subcompositor)->state |= SubcompositorIsAlwaysGarbaged)
+#define IsAlwaysGarbaged(subcompositor) \
+ ((subcompositor)->state & SubcompositorIsAlwaysGarbaged)
+
enum
{
/* This means that the view and all its inferiors should be
@@ -3042,8 +3049,11 @@ SubcompositorUpdate (Subcompositor *subcompositor)
EndFrame (subcompositor);
- /* Clear the garbaged flag. */
- subcompositor->state &= ~SubcompositorIsGarbaged;
+ /* Clear the garbaged flag, unless for debugging purposes the
+ subcompositor is always garbaged. */
+
+ if (!IsAlwaysGarbaged (subcompositor))
+ subcompositor->state &= ~SubcompositorIsGarbaged;
return;
}
@@ -3282,3 +3292,10 @@ SubcompositorRemoveDestroyCallback (SubcompositorDestroyCallback *callback)
XLFree (callback);
}
+
+void
+SubcompositorSetAlwaysGarbaged (Subcompositor *subcompositor)
+{
+ SetGarbaged (subcompositor);
+ SetAlwaysGarbaged (subcompositor);
+}
diff --git a/test.c b/test.c
index 6d67ead..48d47a4 100644
--- a/test.c
+++ b/test.c
@@ -363,9 +363,21 @@ Activate (Surface *surface, Role *role, int deviceid,
}
}
+static void
+SetAlwaysGarbage (struct wl_client *client, struct wl_resource *resource)
+{
+ TestSurface *test;
+
+ test = wl_resource_get_user_data (resource);
+
+ /* Make the subcompositor always garbaged. */
+ SubcompositorSetAlwaysGarbaged (test->subcompositor);
+}
+
static const struct test_surface_interface test_surface_impl =
{
.destroy = Destroy,
+ .set_always_garbage = SetAlwaysGarbage,
};
static void
diff --git a/tests/test_harness.c b/tests/test_harness.c
index 3dcf35e..5e15cb1 100644
--- a/tests/test_harness.c
+++ b/tests/test_harness.c
@@ -421,6 +421,9 @@ make_test_surface (struct test_display *display,
return false;
}
+ if (getenv ("TEST_ALWAYS_GARBAGE"))
+ test_surface_set_always_garbage (test_surface);
+
*surface_return = surface;
*test_surface_return = test_surface;
return true;