Added a semaphore on event callbacks and modified the screen capture to support non-fullscreen.