//处理滚轮事件,暂不知如何处理
 private static void HandleMouseWheelEvent(SDL_MouseWheelEvent e)
 {
     //CefMouseEvent mouseEvent = new CefMouseEvent();
     // mouseEvent.X = e.x;
     //mouseEvent.Y = e.y;
     // _host.SendMouseWheelEvent(mouseEvent,e.d)
 }
Exemple #2
0
        /// <summary>
        /// Handles SDL2's MOUSEWHEEL event.
        /// </summary>
        private void OnMouseWheel(ref SDL_MouseWheelEvent evt)
        {
            if (!Ultraviolet.GetInput().EmulateMouseWithTouchInput&& evt.which == SDL_TOUCH_MOUSEID)
            {
                return;
            }

            var window = Ultraviolet.GetPlatform().Windows.GetByID((int)evt.windowID);

            wheelDeltaX = evt.x;
            wheelDeltaY = evt.y;
            OnWheelScrolled(window, evt.x, evt.y);
        }
 public SdlMouseWheelEvent(SDL_MouseWheelEvent handle)
 {
     _handle = handle;
 }
        /// <summary>
        /// 直接转换相关事件
        /// </summary>
        /// <param name="ev"></param>
        public static unsafe void HandleEvent(SDL_Event *ev)
        {
            if (_host == null)
            {
                return;
            }
            switch (ev->type)
            {
            case SDL_EventType.Quit:
                //Close();
                break;

            case SDL_EventType.Terminating:
                //Close();
                break;

            case SDL_EventType.WindowEvent:
                //SDL_WindowEvent windowEvent = Unsafe.Read<SDL_WindowEvent>(ev);
                //HandleWindowEvent(windowEvent);
                break;

            case SDL_EventType.KeyDown:
            case SDL_EventType.KeyUp:
                SDL_KeyboardEvent keyboardEvent = Unsafe.Read <SDL_KeyboardEvent>(ev);
                HandleKeyboardEvent(keyboardEvent);
                break;

            case SDL_EventType.TextEditing:
                break;

            case SDL_EventType.TextInput:
                SDL_TextInputEvent textInputEvent = Unsafe.Read <SDL_TextInputEvent>(ev);
                HandleTextInputEvent(textInputEvent);
                break;

            case SDL_EventType.KeyMapChanged:
                break;

            case SDL_EventType.MouseMotion:
                SDL_MouseMotionEvent mouseMotionEvent = Unsafe.Read <SDL_MouseMotionEvent>(ev);
                HandleMouseMotionEvent(mouseMotionEvent);
                break;

            case SDL_EventType.MouseButtonDown:
            case SDL_EventType.MouseButtonUp:
                SDL_MouseButtonEvent mouseButtonEvent = Unsafe.Read <SDL_MouseButtonEvent>(ev);
                HandleMouseButtonEvent(mouseButtonEvent);
                break;

            case SDL_EventType.MouseWheel:
                SDL_MouseWheelEvent mouseWheelEvent = Unsafe.Read <SDL_MouseWheelEvent>(ev);
                HandleMouseWheelEvent(mouseWheelEvent);
                break;

            case SDL_EventType.JoyAxisMotion:
                break;

            case SDL_EventType.JoyBallMotion:
                break;

            case SDL_EventType.JoyHatMotion:
                break;

            case SDL_EventType.JoyButtonDown:
                break;

            case SDL_EventType.JoyButtonUp:
                break;

            case SDL_EventType.JoyDeviceAdded:
                break;

            case SDL_EventType.JoyDeviceRemoved:
                break;

            case SDL_EventType.ControllerAxisMotion:
                break;

            case SDL_EventType.ControllerButtonDown:
                break;

            case SDL_EventType.ControllerButtonUp:
                break;

            case SDL_EventType.ControllerDeviceAdded:
                break;

            case SDL_EventType.ControllerDeviceRemoved:
                break;

            case SDL_EventType.ControllerDeviceRemapped:
                break;

            case SDL_EventType.FingerDown:
                break;

            case SDL_EventType.FingerUp:
                break;

            case SDL_EventType.FingerMotion:
                break;

            case SDL_EventType.DollarGesture:
                break;

            case SDL_EventType.DollarRecord:
                break;

            case SDL_EventType.MultiGesture:
                break;

            case SDL_EventType.ClipboardUpdate:
                break;

            case SDL_EventType.DropFile:
                break;

            case SDL_EventType.DropTest:
                break;

            case SDL_EventType.DropBegin:
                break;

            case SDL_EventType.DropComplete:
                break;

            case SDL_EventType.AudioDeviceAdded:
                break;

            case SDL_EventType.AudioDeviceRemoved:
                break;

            case SDL_EventType.RenderTargetsReset:
                break;

            case SDL_EventType.RenderDeviceReset:
                break;

            case SDL_EventType.UserEvent:
                break;

            case SDL_EventType.LastEvent:
                break;

            default:
                // Ignore
                break;
            }
        }