Exemple #1
0
 public virtual IMouseDriver2 CreateMouseDriver()
 {
     if (XI2Mouse.IsSupported(IntPtr.Zero))
     {
         return((IMouseDriver2) new XI2Mouse());
     }
     else
     {
         return((IMouseDriver2) new X11Mouse());
     }
 }
Exemple #2
0
 public override IMouseDriver2 CreateMouseDriver()
 {
     if (XI2Mouse.IsSupported(IntPtr.Zero))
     {
         return(new XI2Mouse()); // Requires xorg 1.7 or higher.
     }
     else
     {
         return(new X11Mouse()); // Always supported.
     }
 }
Exemple #3
0
 public XI2Mouse()
 {
     using (new XLock(API.DefaultDisplay))
     {
         this.window              = new X11WindowInfo();
         this.window.Display      = API.DefaultDisplay;
         this.window.Screen       = Functions.XDefaultScreen(this.window.Display);
         this.window.RootWindow   = Functions.XRootWindow(this.window.Display, this.window.Screen);
         this.window.WindowHandle = this.window.RootWindow;
     }
     if (!XI2Mouse.IsSupported(this.window.Display))
     {
         throw new NotSupportedException("XInput2 not supported.");
     }
     using (XIEventMask mask = new XIEventMask(1, (XIEventMasks)229376))
     {
         Functions.XISelectEvents(this.window.Display, this.window.WindowHandle, mask);
         Functions.XISelectEvents(this.window.Display, this.window.RootWindow, mask);
     }
 }