Esempio n. 1
0
        static void ConnectEvents()
        {
            EventTypeSpec[] eventTypes = new EventTypeSpec[]
            {
                new EventTypeSpec(EventClass.Application, AppEventKind.AppActivated),
                new EventTypeSpec(EventClass.Application, AppEventKind.AppDeactivated),
                new EventTypeSpec(EventClass.Application, AppEventKind.AppQuit),

                new EventTypeSpec(EventClass.Mouse, MouseEventKind.MouseDown),
                new EventTypeSpec(EventClass.Mouse, MouseEventKind.MouseUp),
                new EventTypeSpec(EventClass.Mouse, MouseEventKind.MouseMoved),
                new EventTypeSpec(EventClass.Mouse, MouseEventKind.MouseDragged),
                new EventTypeSpec(EventClass.Mouse, MouseEventKind.MouseEntered),
                new EventTypeSpec(EventClass.Mouse, MouseEventKind.MouseExited),
                new EventTypeSpec(EventClass.Mouse, MouseEventKind.WheelMoved),

                new EventTypeSpec(EventClass.Keyboard, KeyboardEventKind.RawKeyDown),
                new EventTypeSpec(EventClass.Keyboard, KeyboardEventKind.RawKeyRepeat),
                new EventTypeSpec(EventClass.Keyboard, KeyboardEventKind.RawKeyUp),
                new EventTypeSpec(EventClass.Keyboard, KeyboardEventKind.RawKeyModifiersChanged),

                new EventTypeSpec(EventClass.AppleEvent, AppleEventKind.AppleEvent),
            };

            MacOSEventHandler handler = EventHandler;

            uppHandler = API.NewEventHandlerUPP(handler);

            API.InstallApplicationEventHandler(
                uppHandler, eventTypes, IntPtr.Zero, IntPtr.Zero);

            mInitialized = true;
        }
Esempio n. 2
0
        static void ConnectEvents()
        {
            EventTypeSpec[] eventTypes = new EventTypeSpec[]
            {
                new EventTypeSpec(EventClass.Application, AppEventKind.AppActivated),
                new EventTypeSpec(EventClass.Application, AppEventKind.AppDeactivated),
                new EventTypeSpec(EventClass.Application, AppEventKind.AppQuit),

                new EventTypeSpec(EventClass.Mouse, MouseEventKind.MouseDown),
                new EventTypeSpec(EventClass.Mouse, MouseEventKind.MouseUp),
                new EventTypeSpec(EventClass.Mouse, MouseEventKind.MouseMoved),
                new EventTypeSpec(EventClass.Mouse, MouseEventKind.MouseDragged),
                new EventTypeSpec(EventClass.Mouse, MouseEventKind.MouseEntered),
                new EventTypeSpec(EventClass.Mouse, MouseEventKind.MouseExited),
                new EventTypeSpec(EventClass.Mouse, MouseEventKind.WheelMoved),
                
                new EventTypeSpec(EventClass.Keyboard, KeyboardEventKind.RawKeyDown),
                new EventTypeSpec(EventClass.Keyboard, KeyboardEventKind.RawKeyRepeat),
                new EventTypeSpec(EventClass.Keyboard, KeyboardEventKind.RawKeyUp),
                new EventTypeSpec(EventClass.Keyboard, KeyboardEventKind.RawKeyModifiersChanged),

                new EventTypeSpec(EventClass.AppleEvent, AppleEventKind.AppleEvent),
            };

            MacOSEventHandler handler = EventHandler;
            uppHandler = API.NewEventHandlerUPP(handler);

            API.InstallApplicationEventHandler(
                uppHandler, eventTypes, IntPtr.Zero, IntPtr.Zero);
            
            mInitialized = true;
        }
        void ConnectEvents()
        {
            EventTypeSpec[] eventTypes = new EventTypeSpec[]
            {
                new EventTypeSpec(EventClass.Window, WindowEventKind.WindowClose),
                new EventTypeSpec(EventClass.Window, WindowEventKind.WindowClosed),
                new EventTypeSpec(EventClass.Window, WindowEventKind.WindowBoundsChanged),
                new EventTypeSpec(EventClass.Window, WindowEventKind.WindowActivate),
                new EventTypeSpec(EventClass.Window, WindowEventKind.WindowDeactivate),

                //new EventTypeSpec(EventClass.Mouse, MouseEventKind.MouseDown),
                //new EventTypeSpec(EventClass.Mouse, MouseEventKind.MouseUp),
                //new EventTypeSpec(EventClass.Mouse, MouseEventKind.MouseMoved),
                //new EventTypeSpec(EventClass.Mouse, MouseEventKind.MouseDragged),
                //new EventTypeSpec(EventClass.Mouse, MouseEventKind.MouseEntered),
                //new EventTypeSpec(EventClass.Mouse, MouseEventKind.MouseExited),
                //new EventTypeSpec(EventClass.Mouse, MouseEventKind.WheelMoved),

                //new EventTypeSpec(EventClass.Keyboard, KeyboardEventKind.RawKeyDown),
                //new EventTypeSpec(EventClass.Keyboard, KeyboardEventKind.RawKeyRepeat),
                //new EventTypeSpec(EventClass.Keyboard, KeyboardEventKind.RawKeyUp),
                //new EventTypeSpec(EventClass.Keyboard, KeyboardEventKind.RawKeyModifiersChanged),
            };

            MacOSEventHandler handler = EventHandler;
            uppHandler = API.NewEventHandlerUPP(handler);
            API.InstallWindowEventHandler(window.WindowRef, uppHandler, eventTypes, window.WindowRef, IntPtr.Zero);
            Application.WindowEventHandler = this;
        }
Esempio n. 4
0
 private void ConnectEvents()
 {
   this.mInputDriver = new CarbonInput();
   EventTypeSpec[] eventTypes = new EventTypeSpec[5]
   {
     new EventTypeSpec(EventClass.Window, WindowEventKind.WindowClose),
     new EventTypeSpec(EventClass.Window, WindowEventKind.WindowClosed),
     new EventTypeSpec(EventClass.Window, WindowEventKind.WindowBoundsChanged),
     new EventTypeSpec(EventClass.Window, WindowEventKind.WindowActivate),
     new EventTypeSpec(EventClass.Window, WindowEventKind.WindowDeactivate)
   };
   this.uppHandler = API.NewEventHandlerUPP(new MacOSEventHandler(CarbonGLNative.EventHandler));
   API.InstallWindowEventHandler(this.window.WindowRef, this.uppHandler, eventTypes, this.window.WindowRef, IntPtr.Zero);
   Application.WindowEventHandler = this;
 }
Esempio n. 5
0
File: API.cs Progetto: tanis2000/FEZ
 private static OSStatus _InstallEventHandler(IntPtr eventTargetRef, IntPtr handlerProc, int numtypes, EventTypeSpec[] typeList, IntPtr userData, IntPtr handlerRef);
Esempio n. 6
0
File: API.cs Progetto: tanis2000/FEZ
 internal static void InstallWindowEventHandler(IntPtr windowRef, IntPtr uppHandlerProc, EventTypeSpec[] eventTypes, IntPtr userData, IntPtr handlerRef)
 {
     OSStatus errorCode = API._InstallEventHandler(API.GetWindowEventTarget(windowRef), uppHandlerProc, eventTypes.Length, eventTypes, userData, handlerRef);
       if (errorCode != OSStatus.NoError)
     throw new MacOSException(errorCode);
 }
Esempio n. 7
0
        internal static void InstallWindowEventHandler(IntPtr windowRef, IntPtr uppHandlerProc, 
            EventTypeSpec[] eventTypes, IntPtr userData, IntPtr handlerRef)
        {
            IntPtr windowTarget = GetWindowEventTarget(windowRef);

            Debug.Print("Window: {0}", windowRef);
            Debug.Print("Window Target: {0}", windowTarget);
            Debug.Print("Handler: {0}", uppHandlerProc);
            Debug.Print("Num Events: {0}", eventTypes.Length);
            Debug.Print("User Data: {0}", userData);
            Debug.Print("Handler Ref: {0}", handlerRef);

            OSStatus error = _InstallEventHandler(windowTarget, uppHandlerProc,
                                    eventTypes.Length, eventTypes,
                                    userData, handlerRef);

            Debug.Print("Status: {0}", error);

            if (error != OSStatus.NoError)
            {
                throw new MacOSException(error);
            }
        }
Esempio n. 8
0
        internal static void InstallApplicationEventHandler(IntPtr uppHandlerProc, 
            EventTypeSpec[] eventTypes, IntPtr userData, IntPtr handlerRef)
        {
            OSStatus error = _InstallEventHandler(GetApplicationEventTarget(), uppHandlerProc,
                                    eventTypes.Length, eventTypes,
                                    userData, handlerRef);

            if (error != OSStatus.NoError)
            {
                throw new MacOSException(error);
            }
        }
Esempio n. 9
0
 public static void InstallWindowEventHandler(IntPtr windowRef, IntPtr uppHandlerProc,
     EventTypeSpec[] eventTypes, IntPtr userData, IntPtr handlerRef)
 {
     IntPtr windowTarget = GetWindowEventTarget(windowRef);
     OSStatus error = InstallEventHandler(windowTarget, uppHandlerProc,
                                           eventTypes.Length, eventTypes,
                                           userData, handlerRef);
     CheckReturn( error );
 }
Esempio n. 10
0
 public static void InstallApplicationEventHandler(IntPtr uppHandlerProc,
     EventTypeSpec[] eventTypes, IntPtr userData, IntPtr handlerRef)
 {
     OSStatus error = InstallEventHandler(GetApplicationEventTarget(), uppHandlerProc,
                                           eventTypes.Length, eventTypes,
                                           userData, handlerRef);
     CheckReturn( error );
 }