def handle_events(self): errors = 0 while True: try: # Get the next event, or block until the next event is received. event = self.display.next_event() self.handle_event(event) except Xlib.error.ConnectionClosedError: log_error('Display connection closed by server.') raise KeyboardInterrupt except (KeyboardInterrupt, SystemExit): raise except: errors += 1 if errors > MAX_EXCEPTIONS: raise traceback.print_exc()
def x_error_handler(self, err, request): log_error('X protocol error: {0}'.format(err))