* XI2Mouse.cs:

* X11Factory.cs: Removed window hooking, as it complicates code
  unnecessarily.
This commit is contained in:
the_fiddler 2010-11-04 18:01:07 +00:00
parent b646cfa06c
commit 666355103b
2 changed files with 13 additions and 24 deletions

View file

@ -85,9 +85,9 @@ namespace OpenTK.Platform.X11
public virtual OpenTK.Input.IMouseDriver2 CreateMouseDriver()
{
//if (XI2Mouse.IsSupported(IntPtr.Zero))
// return new XI2Mouse(null); // Requires xorg 1.7 or higher.
//else
if (XI2Mouse.IsSupported(IntPtr.Zero))
return new XI2Mouse(); // Requires xorg 1.7 or higher.
else
return new X11Mouse(); // Always supported.
}

View file

@ -45,15 +45,10 @@ namespace OpenTK.Platform.X11
static readonly Functions.EventPredicate PredicateImpl = IsEventValid;
readonly IntPtr Predicate = Marshal.GetFunctionPointerForDelegate(PredicateImpl);
// Can either attach itself to the specified window or can hook the root window.
public XI2Mouse(X11WindowInfo win)
{
if (win != null)
{
window = win;
}
else
public XI2Mouse()
{
Debug.WriteLine("Using XI2Mouse.");
using (new XLock(API.DefaultDisplay))
{
window = new X11WindowInfo();
@ -62,7 +57,6 @@ namespace OpenTK.Platform.X11
window.RootWindow = Functions.XRootWindow(window.Display, window.Screen);
window.WindowHandle = window.RootWindow;
}
}
if (!IsSupported(window.Display))
throw new NotSupportedException("XInput2 not supported.");
@ -72,8 +66,6 @@ namespace OpenTK.Platform.X11
{
Functions.XISelectEvents(window.Display, window.WindowHandle, mask);
}
Debug.WriteLine("Using XI2Mouse.");
}
// Checks whether XInput2 is supported on the specified display.
@ -96,10 +88,7 @@ namespace OpenTK.Platform.X11
return true;
}
#region IMouseDriver Members
// Todo: remove this
public IList<MouseDevice> Mouse { get { throw new NotSupportedException(); } }
#region IMouseDriver2 Members
public MouseState GetState()
{