コード例 #1
0
    def dispatch_events(self):
        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)

            if self._recreate_deferred:
                self._recreate_immediate()
            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
ファイル: __init__.py プロジェクト: momja/Code-Club
 def dispatch_pending_events(self):
     while self._event_queue:
         event = self._event_queue.pop(0)
         if type(event[0]) is str:
             # pyglet event
             EventDispatcher.dispatch_event(self, *event)
         else:
             # win32 event
             event[0](*event[1:])
コード例 #3
0
ファイル: __init__.py プロジェクト: Benrflanders/Pytris
 def dispatch_pending_events(self):
     while self._event_queue:
         event = self._event_queue.pop(0)
         if type(event[0]) is str:
             # pyglet event
             EventDispatcher.dispatch_event(self, *event)
         else:
             # win32 event
             event[0](*event[1:])
コード例 #4
0
ファイル: __init__.py プロジェクト: certik/sympy-oldcore
    def dispatch_events(self):
        self._allow_dispatch_event = True
        while self._event_queue:
            event = self._event_queue.pop(0)
            if type(event[0]) is str:
                # pyglet event
                EventDispatcher.dispatch_event(self, *event)
            else:
                # win32 event
                event[0](*event[1:])

        msg = MSG()
        while _user32.PeekMessageW(byref(msg), self._hwnd, 0, 0, PM_REMOVE):
            _user32.TranslateMessage(byref(msg))
            _user32.DispatchMessageW(byref(msg))
        self._allow_dispatch_event = False
コード例 #5
0
ファイル: __init__.py プロジェクト: jcockayne/sympy-rkern
    def dispatch_events(self):
        self._allow_dispatch_event = True
        while self._event_queue:
            event = self._event_queue.pop(0)
            if type(event[0]) is str:
                # pyglet event
                EventDispatcher.dispatch_event(self, *event)
            else:
                # win32 event
                event[0](*event[1:])

        msg = MSG()
        while _user32.PeekMessageW(byref(msg), 0, 0, 0, PM_REMOVE):
            _user32.TranslateMessage(byref(msg))
            _user32.DispatchMessageW(byref(msg))
        self._allow_dispatch_event = False
コード例 #6
0
ファイル: __init__.py プロジェクト: certik/sympy-oldcore
    def dispatch_events(self):
        if self._recreate_deferred:
            self._recreate_immediate()

        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)

            if self._recreate_deferred:
                self._recreate_immediate()
            result = carbon.ReceiveNextEvent(0, c_void_p(), 0, True, byref(e))

        self._allow_dispatch_event = False
        if result != eventLoopTimedOutErr:
            raise 'Error %d' % result
コード例 #7
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')
コード例 #8
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')
コード例 #9
0
ファイル: __init__.py プロジェクト: certik/sympy-oldcore
    def dispatch_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')

        self._allow_dispatch_event = True

        e = xlib.XEvent()

        # Cache these in case window is closed from an event handler
        _x_display = self._x_display
        _window = self._window

        # Check for the events specific to this window
        while xlib.XCheckWindowEvent(_x_display, _window,
                0x1ffffff, byref(e)):
            event_handler = self._event_handlers.get(e.type)
            if event_handler:
                event_handler(e)

        # Now check generic events for this display and manually filter
        # them to see whether they're for this window. sigh.
        # Store off the events we need to push back so we don't confuse
        # XCheckTypedEvent
        push_back = []
        while xlib.XCheckTypedEvent(_x_display, 
                                    xlib.ClientMessage, byref(e)):
            if e.xclient.window != _window:
                push_back.append(e)
                e = xlib.XEvent()
            else:
                event_handler = self._event_handlers.get(e.type)
                if event_handler:
                    event_handler(e)
        for e in push_back:
            xlib.XPutBackEvent(_x_display, byref(e))

        self._allow_dispatch_event = False
コード例 #10
0
ファイル: __init__.py プロジェクト: KevinGoodsell/sympy
    def dispatch_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')

        self._allow_dispatch_event = True

        e = xlib.XEvent()

        # Cache these in case window is closed from an event handler
        _x_display = self._x_display
        _window = self._window

        # Check for the events specific to this window
        while xlib.XCheckWindowEvent(_x_display, _window,
                0x1ffffff, byref(e)):
            if xlib.XFilterEvent(e, 0):
                continue
            event_handler = self._event_handlers.get(e.type)
            if event_handler:
                event_handler(e)

        # Generic events for this window (the window close event).
        while xlib.XCheckTypedWindowEvent(_x_display, _window, 
                xlib.ClientMessage, byref(e)):
            event_handler = self._event_handlers.get(e.type)
            if event_handler:
                event_handler(e)
        
        self._allow_dispatch_event = False
コード例 #11
0
    def dispatch_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')

        self._allow_dispatch_event = True

        e = xlib.XEvent()

        # Cache these in case window is closed from an event handler
        _x_display = self._x_display
        _window = self._window

        # Check for the events specific to this window
        while xlib.XCheckWindowEvent(_x_display, _window, 0x1ffffff, byref(e)):
            if xlib.XFilterEvent(e, 0):
                continue
            event_handler = self._event_handlers.get(e.type)
            if event_handler:
                event_handler(e)

        # Generic events for this window (the window close event).
        while xlib.XCheckTypedWindowEvent(_x_display, _window,
                                          xlib.ClientMessage, byref(e)):
            event_handler = self._event_handlers.get(e.type)
            if event_handler:
                event_handler(e)

        self._allow_dispatch_event = False
コード例 #12
0
ファイル: __init__.py プロジェクト: zzkklep/thbattle
 def dispatch_pending_events(self):
     while self._event_queue:
         event = self._event_queue.pop(0)
         EventDispatcher.dispatch_event(self, *event)
コード例 #13
0
ファイル: __init__.py プロジェクト: dpkay/gfxnuggets
 def dispatch_pending_events(self):
     while self._event_queue:
         event = self._event_queue.pop(0)
         EventDispatcher.dispatch_event(self, *event)
コード例 #14
0
    def dispatch_pending_events(self):
        while self._event_queue:
            EventDispatcher.dispatch_event(self, *self._event_queue.pop(0))

        if self._recreate_deferred:
            self._recreate_immediate()
コード例 #15
0
 def dispatch_events(self):
     while self._event_queue:
         EventDispatcher.dispatch_event(self, *self._event_queue.pop(0))