Check for window events so we don't lock up the program