Registers an invalidate handler for a specific window. This will get called whenever a region in the window or its children is invalidated.
This can be used to record the invalidated region, which is useful if you are keeping an offscreen copy of some region and want to keep it up to date. You can also modify the invalidated region in case you’re doing some effect where e.g. a child widget appears in multiple places.