Create window in the rendering thread to fix event handling