Context(ContextType type) { PlatformServices.Initialize(); this.type = type; if (screen_create_context(out handle, type) != 0) { // TODO: read errno to describe problem throw new Exception("Unable to create screen context"); } screen_request_events(handle); eventDomain = screen_get_domain(); PlatformServices.AddEventHandler(eventDomain, HandleEvent); }