Emit the committed() signal after the state is applied
Currently, the committed signal is emitted after the client has called wl_surface.commit. However, this breaks with synchronized subsurfaces.
Notably, Firefox splits a web page in a bunch of smaller layers, which can be backed by wl_subsurface objects.
All the subsurfaces are in the sync mode. If a layer needs to be repainted, Firefox will commit the corresponding subsurface with a frame callback.
Since the committed signal is emitted when the wl_surface.commit request is invoked, kwin will schedule a new frame immediately. Meaning, that it is quite likely that firefox will have old contents.
The right thing to do would be to schedule a frame when all the ancestors of the layer subsurface have been committed.
This change re-jitters the commit logic so the committed signal is emitted when a new state is applied to the surface. It also slightly cleans up how SubSurfaceInterface::parentCommit() is called.
It will be nice to cleanup the commit logic further by calling the surface role's commit hook unconditionally, i.e. not check whether it's a subsurface. But doing so may result in infinite recursions. How to clean up that is still TBD.