Port to KWindowSystem

Needs to be well tested.