InputDriver now checks for pre-XP windows versions, and instantiates the WMInput driver.

This commit is contained in:
the_fiddler 2007-10-19 20:01:41 +00:00
parent 32d40b8033
commit 085ae52ce4

View file

@ -24,22 +24,32 @@ namespace OpenTK
if (parent == null)
throw new ArgumentException("A valid window (IWindowInfo) must be specified to construct an InputDriver");
if (Environment.OSVersion.Version.Major > 5 ||
(Environment.OSVersion.Version.Major == 5 && Environment.OSVersion.Version.Minor >= 1))
switch (Environment.OSVersion.Platform)
{
inputDriver = new OpenTK.Platform.Windows.WinRawInput(parent.WindowInfo);
}
else if (Environment.OSVersion.Platform == PlatformID.Unix)
{
//inputDriver = new OpenTK.Platform.X11.X11Input(
// parent is OpenTK.Platform.X11.WindowInfo ? (OpenTK.Platform.X11.WindowInfo)parent :
// parent is OpenTK.Platform.WindowInfo ? (OpenTK.Platform.X11.WindowInfo)(parent as OpenTK.Platform.WindowInfo) : null);
inputDriver = new OpenTK.Platform.X11.X11Input(parent.WindowInfo);
}
else
{
throw new PlatformNotSupportedException(
"Input handling is not supported on the current platform. Please report the problem to http://opentk.sourceforge.net");
case PlatformID.Win32Windows:
case PlatformID.Win32NT:
case PlatformID.Win32S:
case PlatformID.WinCE:
if (Environment.OSVersion.Version.Major > 5 ||
(Environment.OSVersion.Version.Major == 5 && Environment.OSVersion.Version.Minor >= 1))
{
inputDriver = new OpenTK.Platform.Windows.WinRawInput(parent.WindowInfo);
}
else
{
// Legacy or unknown windows version:
inputDriver = new OpenTK.Platform.Windows.WMInput(parent.WindowInfo);
}
break;
case PlatformID.Unix:
inputDriver = new OpenTK.Platform.X11.X11Input(parent.WindowInfo);
break;
default:
throw new PlatformNotSupportedException(
"Input handling is not supported on the current platform. Please report the problem to http://opentk.sourceforge.net");
}
}