Started implementing X11Input.cs, X11Keyboard.cs and X11Mouse.cs drivers. Removed some warnings from X11Api.cs

This commit is contained in:
the_fiddler 2007-08-05 09:03:22 +00:00
parent 73e0509a06
commit 47a3a3f62c
8 changed files with 103 additions and 15 deletions

View file

@ -6,6 +6,6 @@ namespace OpenTK.Input
{
public interface IMouseDriver
{
IList<Keyboard> Mouse { get; }
IList<Mouse> Mouse { get; }
}
}

View file

@ -17,9 +17,14 @@ namespace OpenTK
{
inputDriver = new OpenTK.Platform.Windows.WinRawInput(parentHandle);
}
else if (Environment.OSVersion.Platform == PlatformID.Unix)
{
inputDriver = new OpenTK.Platform.X11.X11Input(parentHandle);
}
else
{
throw new PlatformNotSupportedException("Input is not implemented for platforms prior to Windows XP, yet.");
throw new PlatformNotSupportedException(
"Input handling is not supported on the current platform. Please report the problem to http://opentk.sourceforge.net");
}
}
@ -35,9 +40,9 @@ namespace OpenTK
get { return inputDriver.Keyboard; }
}
public IList<Keyboard> Mouse
IList<Mouse> IMouseDriver.Mouse
{
get { throw new NotImplementedException(); }
get { return inputDriver.Mouse; }
}
#endregion

View file

@ -18,7 +18,7 @@ using OpenTK.Input;
namespace OpenTK.Platform.Windows
{
internal class WinRawInput : NativeWindow, Input.IInputDriver
internal class WinRawInput : NativeWindow, IInputDriver
{
/// <summary>
/// Input event data.
@ -164,5 +164,14 @@ namespace OpenTK.Platform.Windows
}
#endregion
#region IMouseDriver Members
IList<Mouse> IMouseDriver.Mouse
{
get { throw new Exception("The method or operation is not implemented."); }
}
#endregion
}
}

View file

@ -561,18 +561,15 @@ XF86VidModeGetGammaRampSize(
internal int min_width, min_height;
internal int max_width, max_height;
internal int width_inc, height_inc;
internal struct min_aspect
{
internal int x; /* numerator */
internal int y; /* denominator */
}
internal struct max_aspect
{
internal int x; /* numerator */
internal int y; /* denominator */
}
internal Rectangle min_aspect, max_aspect;
internal int base_width, base_height;
internal int win_gravity;
internal struct Rectangle
{
internal int x; /* numerator */
internal int y; /* denominator */
private void stop_the_compiler_warnings() { x = y = 0; }
}
/* this structure may be extended in the future */
}

View file

@ -183,6 +183,7 @@ namespace OpenTK.Platform.X11
Trace.WriteLine("Our shiny new context is now current - ready to rock 'n' roll!");
Trace.Unindent();
created = true;
}
#endregion

View file

@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Text;
using OpenTK.Input;
namespace OpenTK.Platform.X11
{
public class X11Input : IInputDriver
{
public X11Input(IntPtr windowHandle)
{
}
#region --- IInputDriver Members ---
#region public IList<IInputDevice> InputDevices
public IList<IInputDevice> InputDevices
{
get { throw new Exception("The method or operation is not implemented."); }
}
#endregion
#region public IList<Keyboard> Keyboard
public IList<Keyboard> Keyboard
{
get { throw new Exception("The method or operation is not implemented."); }
}
#endregion
#region public IList<Mouse> Mouse
public IList<Mouse> Mouse
{
get { throw new Exception("The method or operation is not implemented."); }
}
#endregion
#endregion
}
}

View file

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Text;
using OpenTK.Input;
namespace OpenTK.Platform.X11
{
public class X11Keyboard : IKeyboardDriver
{
#region --- IKeyboardDriver Members ---
public IList<Keyboard> Keyboard
{
get { throw new Exception("The method or operation is not implemented."); }
}
#endregion
}
}

View file

@ -0,0 +1,10 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.Platform.X11
{
class X11Mouse
{
}
}