Esempio n. 1
0
 private void OnMouseWheel(object sender, MouseInterceptor.MouseEventArgs e)
 {
     if (mAltKeyPressed)
     {
         mVolumeChangeAction?.Update(e);
         e.Handled = true;
     }
 }
 public void Update(MouseInterceptor.MouseEventArgs e)
 {
     if (e.Delta >= 120)
     {
         VolumeUp();
     }
     else if (e.Delta <= -120)
     {
         VolumeDown();
     }
 }
Esempio n. 3
0
        private void OnMouseMove(object sender, MouseInterceptor.MouseEventArgs e)
        {
            switch (mCurrentState)
            {
            case State.DragWindow:
                mDragAction?.Update(e.Location);
                break;

            case State.ResizeWindow:
                mResizeAction?.Update(e.Location);
                break;
            }
        }
Esempio n. 4
0
        private void OnMouseDown(object sender, MouseInterceptor.MouseEventArgs e)
        {
            if (!Enabled)
            {
                return;
            }

            if (mAltKeyPressed && mCurrentState == State.None)
            {
                var hwndMouseOver = WinAPI.WindowFromPoint(e.Location);
                var topLevelHwnd  = GetTopMostHwnd(hwndMouseOver);
                if (topLevelHwnd == default)
                {
                    return;
                }

                var windowText = WinAPI.GetWindowTitle(topLevelHwnd);
                if (Properties.Settings.Default.excludes.ToEnumerable().Any(
                        exclude => Regex.IsMatch(windowText, exclude)))
                {
                    return;
                }

                if (e.Button == MouseButtons.Left)
                {
                    mDragAction   = new MouseDragAction(topLevelHwnd, e.Location);
                    mCurrentState = State.DragWindow;
                    mAltKeyUsed   = true;
                    e.Handled     = true;
                }
                else if (e.Button == MouseButtons.Middle)
                {
                    mCurrentState = State.OnTopWindow;
                    mAltKeyUsed   = true;
                    e.Handled     = true;
                    ToggleTopmost(topLevelHwnd);
                }
                else if (e.Button == MouseButtons.Right)
                {
                    mResizeAction = new MouseResizeAction(topLevelHwnd, e.Location);
                    mCurrentState = State.ResizeWindow;
                    mAltKeyUsed   = true;
                    e.Handled     = true;
                }
            }
        }
Esempio n. 5
0
 private void OnMouseUp(object sender, MouseInterceptor.MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left && mCurrentState == State.DragWindow)
     {
         mCurrentState = State.None;
         mDragAction.Finish(e.Location);
         mDragAction = null;
         e.Handled   = true;
     }
     else if (e.Button == MouseButtons.Right && mCurrentState == State.ResizeWindow)
     {
         mCurrentState = State.None;
         mResizeAction.Finish(e.Location);
         mResizeAction = null;
         e.Handled     = true;
     }
     else if (e.Button == MouseButtons.Middle && mCurrentState == State.OnTopWindow)
     {
         mCurrentState = State.None;
         e.Handled     = true;
     }
 }