def dispatch_events(self, dt=None):
        if not self._open:
            return

        event = IOHIDEventStruct()
        r = self._queue.contents.contents.getNextEvent(self._queue,
                ctypes.byref(event), 0, 0)
        if r != 0:
            # Undocumented behaviour?  returns 3758097127L when no events are
            # in queue (is documented to block)
            return

        try:
            element = self._element_cookies[event.elementCookie]
            element.value = event.value
        except __HOLE__:
            pass
dataset/ETHPy150Open ardekantur/pyglet/experimental/input/osx.py/Device.dispatch_events