Exemplo n.º 1
0
        public CoreWindowExtension(object owner)
        {
            _owner              = (CoreWindow)owner;
            _ownerEvents        = (ICoreWindowEvents)owner;
            _displayInformation = DisplayInformation.GetForCurrentView();

            try
            {
                _libInputContext = libinput_path_create_context();

                _inputThread = new Thread(Run)
                {
                    Name         = "Uno libdev Input",
                    IsBackground = true
                };

                _inputThread.Start();
            }
            catch (Exception ex)
            {
                if (this.Log().IsEnabled(LogLevel.Warning))
                {
                    this.Log().LogWarning($"Failed to initialize LibInput, continuing without pointer and keyboard support ({ex.Message})");
                }
            }
        }
Exemplo n.º 2
0
        public WpfUIElementPointersSupport(object owner)
        {
            _ownerEvents = (ICoreWindowEvents)owner;

            _host = WpfHost.Current;

            _host.MouseEnter += HostOnMouseEnter;
            _host.MouseLeave += HostOnMouseLeave;
            _host.MouseMove  += HostOnMouseMove;
            _host.MouseDown  += HostOnMouseDown;
            _host.MouseUp    += HostOnMouseUp;

            // Hook for native events
            _host.Loaded += HookNative;

            void HookNative(object sender, RoutedEventArgs e)
            {
                _host.Loaded -= HookNative;

                var win = Window.GetWindow(_host);
                var fromDependencyObject = PresentationSource.FromDependencyObject(win);

                _hwndSource = fromDependencyObject as HwndSource;
                _hwndSource?.AddHook(OnWmMessage);
            }
        }
        public TizenUIElementPointersSupport(object owner, UnoCanvas canvas)
        {
            _owner              = (CoreWindow)owner;
            _ownerEvents        = (ICoreWindowEvents)owner;
            _canvas             = canvas;
            _displayInformation = DisplayInformation.GetForCurrentView();

            _gestureLayer = new GestureLayer(canvas);
            _gestureLayer.Attach(canvas);
            _gestureLayer.IsEnabled = true;
            SetupTapGesture();
            SetupMomentumGesture();
        }
Exemplo n.º 4
0
        public GtkUIElementPointersSupport(object owner)
        {
            _owner       = (CoreWindow)owner;
            _ownerEvents = (ICoreWindowEvents)owner;

            GtkHost.Window.AddEvents((int)(
                                         Gdk.EventMask.PointerMotionMask
                                         | EventMask.ButtonPressMask
                                         | EventMask.SmoothScrollMask
                                         ));
            GtkHost.Window.MotionNotifyEvent  += OnWindowMotionEvent;
            GtkHost.Window.ButtonPressEvent   += OnWindowButtonPressEvent;
            GtkHost.Window.ButtonReleaseEvent += OnWindowButtonReleaseEvent;
            GtkHost.Window.EnterNotifyEvent   += OnWindowEnterEvent;
            GtkHost.Window.LeaveNotifyEvent   += OnWindowLeaveEvent;
            GtkHost.Window.ScrollEvent        += OnWindowScrollEvent;
        }
Exemplo n.º 5
0
        public HostPointerHandler(IWpfHost host)
        {
            if (host is not WpfControl hostControl)
            {
                throw new ArgumentException($"{nameof(host)} must be a WPF Control instance", nameof(host));
            }

            if (!host.IsIsland)
            {
                _coreWindow = CoreWindow.GetForCurrentThread() !;
            }

            _hostControl = hostControl;

            _hostControl.MouseEnter += HostOnMouseEnter;
            _hostControl.MouseLeave += HostOnMouseLeave;
            _hostControl.MouseMove  += HostOnMouseMove;
            _hostControl.MouseDown  += HostOnMouseDown;
            _hostControl.MouseUp    += HostOnMouseUp;

            // Hook for native events
            _hostControl.Loaded += HookNative;

            void HookNative(object sender, RoutedEventArgs e)
            {
                _hostControl.Loaded -= HookNative;

                var win = Window.GetWindow(_hostControl);

                var fromDependencyObject = PresentationSource.FromDependencyObject(win);

                _hwndSource = fromDependencyObject as HwndSource;
                _hwndSource?.AddHook(OnWmMessage);
            }

            _host = host;
        }