Ejemplo n.º 1
0
        public void SendMouseButtonAction(int button, ButtonAction buttonAction, double percentX, double percentY, Viewer viewer)
        {
            try
            {
                var isPressed = buttonAction == ButtonAction.Down;
                // Browser buttons start at 0.  XTest starts at 1.
                var mouseButton = (uint)(button + 1);

                InitDisplay();
                SendMouseMove(percentX, percentY, viewer);
                if (EnvironmentHelper.Is64)
                {
                    LibXtst.XTestFakeButtonEvent(Display, mouseButton, isPressed, 0);
                }
                else
                {
                    LibXtst_32.XTestFakeButtonEvent(Display, mouseButton, isPressed, 0);
                }
                LibX11.XSync(Display, false);
            }
            catch (Exception ex)
            {
                Logger.Write(ex);
            }
        }
Ejemplo n.º 2
0
 public void SendLeftMouseUp(double percentX, double percentY, Viewer viewer)
 {
     try
     {
         SendMouseMove(percentX, percentY, viewer);
         LibXtst.XTestFakeButtonEvent(Display, 1, false, 0);
         LibX11.XSync(Display, false);
     }
     catch (Exception ex)
     {
         Logger.Write(ex);
     }
 }
Ejemplo n.º 3
0
 public void SendRightMouseDown(double percentX, double percentY, Viewer viewer)
 {
     try
     {
         InitDisplay();
         SendMouseMove(percentX, percentY, viewer);
         LibXtst.XTestFakeButtonEvent(Display, 3, true, 0);
         LibX11.XSync(Display, false);
     }
     catch (Exception ex)
     {
         Logger.Write(ex);
     }
 }
Ejemplo n.º 4
0
 public uint SendLeftMouseDown(double percentX, double percentY, Viewer viewer)
 {
     try
     {
         SendMouseMove(percentX, percentY, viewer);
         LibXtst.XTestFakeButtonEvent(Display, 1, true, 0);
         LibX11.XSync(Display, false);
         return(0);
     }
     catch (Exception ex)
     {
         Logger.Write(ex);
         return(1);
     }
 }
Ejemplo n.º 5
0
 public void SendMouseWheel(int deltaY, Viewer viewer)
 {
     try
     {
         if (deltaY > 0)
         {
             LibXtst.XTestFakeButtonEvent(Display, 4, true, 0);
             LibXtst.XTestFakeButtonEvent(Display, 4, false, 0);
         }
         else
         {
             LibXtst.XTestFakeButtonEvent(Display, 5, true, 0);
             LibXtst.XTestFakeButtonEvent(Display, 5, false, 0);
         }
         LibX11.XSync(Display, false);
     }
     catch (Exception ex)
     {
         Logger.Write(ex);
     }
 }
Ejemplo n.º 6
0
 public void SendRightMouseUp(double percentX, double percentY, Viewer viewer)
 {
     try
     {
         InitDisplay();
         SendMouseMove(percentX, percentY, viewer);
         if (EnvironmentHelper.Is64)
         {
             LibXtst.XTestFakeButtonEvent(Display, 3, false, 0);
         }
         else
         {
             LibXtst_32.XTestFakeButtonEvent(Display, 3, false, 0);
         }
         LibX11.XSync(Display, false);
     }
     catch (Exception ex)
     {
         Logger.Write(ex);
     }
 }
Ejemplo n.º 7
0
 public void SendMouseWheel(int deltaY)
 {
     try
     {
         InitDisplay();
         if (deltaY > 0)
         {
             LibXtst.XTestFakeButtonEvent(Display, 4, true, 0);
             LibXtst.XTestFakeButtonEvent(Display, 4, false, 0);
             if (EnvironmentHelper.Is64)
             {
                 LibXtst.XTestFakeButtonEvent(Display, 4, true, 0);
                 LibXtst.XTestFakeButtonEvent(Display, 4, false, 0);
             }
             else
             {
                 LibXtst_32.XTestFakeButtonEvent(Display, 4, true, 0);
                 LibXtst_32.XTestFakeButtonEvent(Display, 4, false, 0);
             }
         }
         else
         {
             if (EnvironmentHelper.Is64)
             {
                 LibXtst.XTestFakeButtonEvent(Display, 5, true, 0);
                 LibXtst.XTestFakeButtonEvent(Display, 5, false, 0);
             }
             else
             {
                 LibXtst_32.XTestFakeButtonEvent(Display, 5, true, 0);
                 LibXtst_32.XTestFakeButtonEvent(Display, 5, false, 0);
             }
         }
         LibX11.XSync(Display, false);
     }
     catch (Exception ex)
     {
         Logger.Write(ex);
     }
 }