示例#1
0
文件: __init__.py 项目: arokem/Fos
    def dispatch_events(self):
        from fos.lib.pyglet import app

        app.platform_event_loop.dispatch_posted_events()

        self._allow_dispatch_event = True
        while self._event_queue:
            EventDispatcher.dispatch_event(self, *self._event_queue.pop(0))

        e = EventRef()
        result = carbon.ReceiveNextEvent(0, c_void_p(), 0, True, byref(e))
        while result == noErr:
            carbon.SendEventToEventTarget(e, self._event_dispatcher)
            carbon.ReleaseEvent(e)

            result = carbon.ReceiveNextEvent(0, c_void_p(), 0, True, byref(e))

        self._allow_dispatch_event = False

        # Return value from ReceiveNextEvent can be ignored if not
        # noErr; we check here only to look for new bugs.
        # eventLoopQuitErr: the inner event loop was quit, see
        # http://lists.apple.com/archives/Carbon-dev/2006/Jun/msg00850.html
        # Can occur when mixing with other toolkits, e.g. Tk.
        # Fixes issue 180.
        if result not in (eventLoopTimedOutErr, eventLoopQuitErr):
            raise "Error %d" % result
示例#2
0
    def dispatch_events(self):
        from fos.lib.pyglet import app
        app.platform_event_loop.dispatch_posted_events()

        self._allow_dispatch_event = True
        while self._event_queue:
            EventDispatcher.dispatch_event(self, *self._event_queue.pop(0))

        e = EventRef()
        result = carbon.ReceiveNextEvent(0, c_void_p(), 0, True, byref(e))
        while result == noErr:
            carbon.SendEventToEventTarget(e, self._event_dispatcher)
            carbon.ReleaseEvent(e)

            result = carbon.ReceiveNextEvent(0, c_void_p(), 0, True, byref(e))

        self._allow_dispatch_event = False

        # Return value from ReceiveNextEvent can be ignored if not
        # noErr; we check here only to look for new bugs.
        # eventLoopQuitErr: the inner event loop was quit, see
        # http://lists.apple.com/archives/Carbon-dev/2006/Jun/msg00850.html
        # Can occur when mixing with other toolkits, e.g. Tk.
        # Fixes issue 180.
        if result not in (eventLoopTimedOutErr, eventLoopQuitErr):
            raise 'Error %d' % result
示例#3
0
 def dispatch_pending_events(self):
     while self._event_queue:
         event = self._event_queue.pop(0)
         if type(event[0]) is str:
             # fos.lib.pyglet event
             EventDispatcher.dispatch_event(self, *event)
         else:
             # win32 event
             event[0](*event[1:])
示例#4
0
文件: __init__.py 项目: arokem/Fos
 def dispatch_pending_events(self):
     while self._event_queue:
         event = self._event_queue.pop(0)
         if type(event[0]) is str:
             # fos.lib.pyglet event
             EventDispatcher.dispatch_event(self, *event)
         else:
             # win32 event
             event[0](*event[1:])
示例#5
0
    def dispatch_pending_events(self):
        while self._event_queue:
            EventDispatcher.dispatch_event(self, *self._event_queue.pop(0))

        # Dispatch any context-related events
        if self._lost_context:
            self._lost_context = False
            EventDispatcher.dispatch_event(self, 'on_context_lost')
        if self._lost_context_state:
            self._lost_context_state = False
            EventDispatcher.dispatch_event(self, 'on_context_state_lost')
示例#6
0
文件: __init__.py 项目: arokem/Fos
    def dispatch_pending_events(self):
        while self._event_queue:
            EventDispatcher.dispatch_event(self, *self._event_queue.pop(0))

        # Dispatch any context-related events
        if self._lost_context:
            self._lost_context = False
            EventDispatcher.dispatch_event(self, "on_context_lost")
        if self._lost_context_state:
            self._lost_context_state = False
            EventDispatcher.dispatch_event(self, "on_context_state_lost")
示例#7
0
文件: __init__.py 项目: arokem/Fos
 def dispatch_pending_events(self):
     while self._event_queue:
         EventDispatcher.dispatch_event(self, *self._event_queue.pop(0))
示例#8
0
 def dispatch_pending_events(self):
     while self._event_queue:
         EventDispatcher.dispatch_event(self, *self._event_queue.pop(0))