コード例 #1
0
        private void OnInterceptionInputActivity(object sender, InterceptionEventArgs e)
        {
            var action = new Action(() =>
            {
                foreach (var keyInfo in e.KeyInfos)
                {
                    var device = InputHelper.ToInputDevice(e.Device);
                    var key    = InputHelper.ToInputKey(keyInfo.Key);
                    var args   = new InputEventArgs(device, key, keyInfo.IsDown, e.Handled);

                    if (this.InputActivity != null)
                    {
                        this.InputActivity(this, args);
                        e.Handled = args.Handled;
                    }

                    if (!KeysHelper.IsMouseMoveKey(keyInfo.Key))
                    {
                        var sb = new StringBuilder(this.InputMonitorHistory);
                        sb.AppendLine(args.ToString());
                        this.InputMonitorHistory = sb.ToString();
                    }
                }

                this.CheckForEmergencyHit(e);
            });

            bool isMouseClick = e.Device.DeviceType == InterceptionDeviceType.Mouse && e.KeyInfos.Any(x => KeysHelper.IsMouseClickKey(x.Key));

            // App.IsFocused is maybe too slow and the ui freezes the splitter main window
            if (isMouseClick && GlobalSettings.IsMainWindowActivated)
            {
                this.Dispatcher.BeginInvoke(action);
            }
            else
            {
                this.Dispatcher.Invoke(action);
            }

            if (GlobalSettings.IsMainWindowActivated)
            {
                e.Handled = false;
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: nicolas-repiquet/Granite
 public override void InputEvent(InputEventArgs e)
 {
     Engine.LogDebug(e.ToString());
     m_uiManager.ProcessInputEvent(e);
 }