* 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 574909c426
commit 52d38059f4
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() public virtual OpenTK.Input.IMouseDriver2 CreateMouseDriver()
{ {
//if (XI2Mouse.IsSupported(IntPtr.Zero)) if (XI2Mouse.IsSupported(IntPtr.Zero))
// return new XI2Mouse(null); // Requires xorg 1.7 or higher. return new XI2Mouse(); // Requires xorg 1.7 or higher.
//else else
return new X11Mouse(); // Always supported. return new X11Mouse(); // Always supported.
} }

View file

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