This is an attempt to resolve bug 362857. A number of users have complained about restored application not supporting desktop effects, like transparency and blurring. This is caused by a race condition where restored applications start before KWin (and its compositor) finishes its initialization. Under this condition, applications fail to detect compositor and disable desktop effect on themselves.
This patch tries to avoid this race condition by inserting delay b/w initialization of KSM server, which starts KWin (or user-designated WM), and start-up phase 0. At the same time, the patch also tries to minimize the actual delay by detecting KWin and compositors using D-Bus and KWindowSystem repectively.