DispatchEvent() private method

private DispatchEvent ( IntPtr inCaller, IntPtr inEvent, EventInfo evt, IntPtr userData ) : OSStatus
inCaller System.IntPtr
inEvent System.IntPtr
evt OpenTK.Platform.MacOS.Carbon.EventInfo
userData System.IntPtr
return OSStatus
示例#1
0
        protected static OSStatus EventHandler(IntPtr inCaller, IntPtr inEvent, IntPtr userData)
        {
            // bail out if the window passed in is not actually our window.
            // I think this happens if using winforms with a GameWindow sometimes.
            if (!mWindows.ContainsKey(userData))
            {
                return(OSStatus.EventNotHandled);
            }

            WeakReference reference = mWindows[userData];

            // bail out if the CarbonGLNative window has been garbage collected.
            if (!reference.IsAlive)
            {
                mWindows.Remove(userData);
                return(OSStatus.EventNotHandled);
            }

            CarbonGLNative window = (CarbonGLNative)reference.Target;

            //Debug.Print("Processing {0} event for {1}.", evt, window.window);
            if (window == null)
            {
                Debug.Print("Window for event not found.");
                return(OSStatus.EventNotHandled);
            }
            EventInfo evt = new EventInfo(inEvent);

            return(window.DispatchEvent(inCaller, inEvent, evt, userData));
        }
示例#2
0
        protected static OSStatus EventHandler(IntPtr inCaller, IntPtr inEvent, IntPtr userData)
        {
            if (!CarbonGLNative.mWindows.ContainsKey(userData))
            {
                return(OSStatus.EventNotHandled);
            }
            WeakReference weakReference = CarbonGLNative.mWindows[userData];

            if (!weakReference.IsAlive)
            {
                CarbonGLNative.mWindows.Remove(userData);
                return(OSStatus.EventNotHandled);
            }
            else
            {
                CarbonGLNative carbonGlNative = (CarbonGLNative)weakReference.Target;
                if (carbonGlNative == null)
                {
                    return(OSStatus.EventNotHandled);
                }
                EventInfo evt = new EventInfo(inEvent);
                return(carbonGlNative.DispatchEvent(inCaller, inEvent, evt, userData));
            }
        }