ref #15 restructure window (creates context now) and event dispatching - works fine now