mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-24 16:35:36 +00:00
Added INativeWindow.CreateKeyboardDriver()
Added INativeWindow.KeyPress event (KeyPressEventArgs). Removed INativeWindow.Icon property.
This commit is contained in:
parent
a9352e441b
commit
67bdd39d08
|
@ -1052,31 +1052,6 @@ namespace OpenTK
|
||||||
|
|
||||||
#region --- INativeWindow Members ---
|
#region --- INativeWindow Members ---
|
||||||
|
|
||||||
#region Icon
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the System.Drawing.Icon for this GameWindow.
|
|
||||||
/// </summary>
|
|
||||||
public Icon Icon
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (disposed)
|
|
||||||
throw new ObjectDisposedException(this.GetType().Name);
|
|
||||||
|
|
||||||
return glWindow.Icon;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (disposed)
|
|
||||||
throw new ObjectDisposedException(this.GetType().Name);
|
|
||||||
|
|
||||||
glWindow.Icon = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Focused
|
#region Focused
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1456,11 +1431,6 @@ namespace OpenTK
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<EventArgs> Disposed = delegate { };
|
public event EventHandler<EventArgs> Disposed = delegate { };
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occurs when the <see cref="Icon"/> property of the window changes.
|
|
||||||
/// </summary>
|
|
||||||
public event EventHandler<EventArgs> IconChanged = delegate { };
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Occurs when the <see cref="Title"/> property of the window changes.
|
/// Occurs when the <see cref="Title"/> property of the window changes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1476,6 +1446,11 @@ namespace OpenTK
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<EventArgs> FocusedChanged = delegate { };
|
public event EventHandler<EventArgs> FocusedChanged = delegate { };
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Occurs whenever a character is typed.
|
||||||
|
/// </summary>
|
||||||
|
public event EventHandler<KeyPressEventArgs> KeyPress = delegate { };
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -39,11 +39,6 @@ namespace OpenTK
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface INativeWindow : IDisposable
|
public interface INativeWindow : IDisposable
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the <see cref="System.Drawing.Icon"/> of the window.
|
|
||||||
/// </summary>
|
|
||||||
Icon Icon { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the title of the window.
|
/// Gets or sets the title of the window.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -186,11 +181,6 @@ namespace OpenTK
|
||||||
/// </summary>
|
/// </summary>
|
||||||
event EventHandler<EventArgs> Disposed;
|
event EventHandler<EventArgs> Disposed;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Occurs when the <see cref="Icon"/> property of the window changes.
|
|
||||||
/// </summary>
|
|
||||||
event EventHandler<EventArgs> IconChanged;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Occurs when the <see cref="Title"/> property of the window changes.
|
/// Occurs when the <see cref="Title"/> property of the window changes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -206,6 +196,11 @@ namespace OpenTK
|
||||||
/// </summary>
|
/// </summary>
|
||||||
event EventHandler<EventArgs> FocusedChanged;
|
event EventHandler<EventArgs> FocusedChanged;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Occurs whenever a character is typed.
|
||||||
|
/// </summary>
|
||||||
|
event EventHandler<KeyPressEventArgs> KeyPress;
|
||||||
|
|
||||||
//event EventHandler<EventArgs> MouseEnter;
|
//event EventHandler<EventArgs> MouseEnter;
|
||||||
//event EventHandler<MouseEventArgs> MouseMove;
|
//event EventHandler<MouseEventArgs> MouseMove;
|
||||||
//event EventHandler<MouseEventArgs> MouseWheel;
|
//event EventHandler<MouseEventArgs> MouseWheel;
|
||||||
|
@ -216,7 +211,7 @@ namespace OpenTK
|
||||||
|
|
||||||
//event EventHandler<KeyEventArgs> KeyDown;
|
//event EventHandler<KeyEventArgs> KeyDown;
|
||||||
//event EventHandler<KeyEventArgs> KeyUp;
|
//event EventHandler<KeyEventArgs> KeyUp;
|
||||||
//event EventHandler<KeyEventArgs> KeyPress;
|
|
||||||
|
|
||||||
//event EventHandler<DragEventArgs> DragDrop;
|
//event EventHandler<DragEventArgs> DragDrop;
|
||||||
//event EventHandler<DragEventArgs> DragEnter;
|
//event EventHandler<DragEventArgs> DragEnter;
|
||||||
|
|
58
Source/OpenTK/KeyPressEventArgs.cs
Normal file
58
Source/OpenTK/KeyPressEventArgs.cs
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
// #region License
|
||||||
|
// //
|
||||||
|
// // The Open Toolkit Library License
|
||||||
|
// //
|
||||||
|
// // Copyright (c) 2006 - 2009 the Open Toolkit library.
|
||||||
|
// //
|
||||||
|
// // Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// // of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// // in the Software without restriction, including without limitation the rights to
|
||||||
|
// // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
// // the Software, and to permit persons to whom the Software is furnished to do
|
||||||
|
// // so, subject to the following conditions:
|
||||||
|
// //
|
||||||
|
// // The above copyright notice and this permission notice shall be included in all
|
||||||
|
// // copies or substantial portions of the Software.
|
||||||
|
// //
|
||||||
|
// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
// // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||||
|
// // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
// // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||||
|
// // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
// // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
// // OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
// //
|
||||||
|
// #endregion
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace OpenTK
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Defines the event arguments for KeyPress events. Instances of this class are cached:
|
||||||
|
/// KeyPressEventArgs should only be used inside the relevant event, unless manually cloned.
|
||||||
|
/// </summary>
|
||||||
|
public class KeyPressEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
char key_char;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructs a new instance.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="keyChar">The ASCII character that was typed.</param>
|
||||||
|
public KeyPressEventArgs(char keyChar)
|
||||||
|
{
|
||||||
|
KeyChar = keyChar;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a <see cref="System.Char"/> that defines the ASCII character that was typed.
|
||||||
|
/// </summary>
|
||||||
|
public char KeyChar
|
||||||
|
{
|
||||||
|
get { return key_char; }
|
||||||
|
private set { key_char = value; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -94,42 +94,57 @@ namespace OpenTK.Platform
|
||||||
{
|
{
|
||||||
return implementation.CreateGraphicsMode();
|
return implementation.CreateGraphicsMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public OpenTK.Input.IKeyboardDriver CreateKeyboardDriver()
|
||||||
|
{
|
||||||
|
return implementation.CreateKeyboardDriver();
|
||||||
|
}
|
||||||
|
|
||||||
class UnsupportedPlatform : IPlatformFactory
|
class UnsupportedPlatform : IPlatformFactory
|
||||||
{
|
{
|
||||||
|
#region Fields
|
||||||
|
|
||||||
|
static readonly string error_string = "Please, refer to http://www.opentk.com for more information.";
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region IPlatformFactory Members
|
#region IPlatformFactory Members
|
||||||
|
|
||||||
public INativeWindow CreateNativeWindow(int x, int y, int width, int height, string title, GraphicsMode mode, GameWindowFlags options, DisplayDevice device)
|
public INativeWindow CreateNativeWindow(int x, int y, int width, int height, string title, GraphicsMode mode, GameWindowFlags options, DisplayDevice device)
|
||||||
{
|
{
|
||||||
throw new PlatformNotSupportedException("Please, refer to http://www.opentk.com for more information.");
|
throw new PlatformNotSupportedException(error_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IGLControl CreateGLControl(GraphicsMode mode, GLControl owner)
|
public IGLControl CreateGLControl(GraphicsMode mode, GLControl owner)
|
||||||
{
|
{
|
||||||
throw new PlatformNotSupportedException("Please, refer to http://www.opentk.com for more information.");
|
throw new PlatformNotSupportedException(error_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IDisplayDeviceDriver CreateDisplayDeviceDriver()
|
public IDisplayDeviceDriver CreateDisplayDeviceDriver()
|
||||||
{
|
{
|
||||||
throw new PlatformNotSupportedException("Please, refer to http://www.opentk.com for more information.");
|
throw new PlatformNotSupportedException(error_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IGraphicsContext CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool DirectRendering, int major, int minor, GraphicsContextFlags flags)
|
public IGraphicsContext CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool DirectRendering, int major, int minor, GraphicsContextFlags flags)
|
||||||
{
|
{
|
||||||
throw new PlatformNotSupportedException("Please, refer to http://www.opentk.com for more information.");
|
throw new PlatformNotSupportedException(error_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GraphicsContext.GetCurrentContextDelegate CreateGetCurrentGraphicsContext()
|
public GraphicsContext.GetCurrentContextDelegate CreateGetCurrentGraphicsContext()
|
||||||
{
|
{
|
||||||
throw new PlatformNotSupportedException("Please, refer to http://www.opentk.com for more information.");
|
throw new PlatformNotSupportedException(error_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public IGraphicsMode CreateGraphicsMode()
|
public IGraphicsMode CreateGraphicsMode()
|
||||||
{
|
{
|
||||||
throw new PlatformNotSupportedException("Please, refer to http://www.opentk.com for more information.");
|
throw new PlatformNotSupportedException(error_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public OpenTK.Input.IKeyboardDriver CreateKeyboardDriver()
|
||||||
|
{
|
||||||
|
throw new PlatformNotSupportedException(error_string);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,5 +46,7 @@ namespace OpenTK.Platform
|
||||||
OpenTK.Graphics.GraphicsContext.GetCurrentContextDelegate CreateGetCurrentGraphicsContext();
|
OpenTK.Graphics.GraphicsContext.GetCurrentContextDelegate CreateGetCurrentGraphicsContext();
|
||||||
|
|
||||||
OpenTK.Graphics.IGraphicsMode CreateGraphicsMode();
|
OpenTK.Graphics.IGraphicsMode CreateGraphicsMode();
|
||||||
|
|
||||||
|
OpenTK.Input.IKeyboardDriver CreateKeyboardDriver();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -949,6 +949,8 @@ namespace OpenTK.Platform.MacOS
|
||||||
|
|
||||||
public event EventHandler<EventArgs> FocusedChanged;
|
public event EventHandler<EventArgs> FocusedChanged;
|
||||||
|
|
||||||
|
public event EventHandler<KeyPressEventArgs> KeyPress;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,6 +70,11 @@ namespace OpenTK.Platform.MacOS
|
||||||
return new MacOSGraphicsMode();
|
return new MacOSGraphicsMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public OpenTK.Input.IKeyboardDriver CreateKeyboardDriver()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,6 +71,11 @@ using OpenTK.Input;
|
||||||
return new WinGraphicsMode();
|
return new WinGraphicsMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public OpenTK.Input.IKeyboardDriver CreateKeyboardDriver()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -907,6 +907,8 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
public event EventHandler<EventArgs> FocusedChanged;
|
public event EventHandler<EventArgs> FocusedChanged;
|
||||||
|
|
||||||
|
public event EventHandler<KeyPressEventArgs> KeyPress;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -42,6 +42,11 @@ namespace OpenTK.Platform.X11
|
||||||
{
|
{
|
||||||
return new X11GraphicsMode();
|
return new X11GraphicsMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public OpenTK.Input.IKeyboardDriver CreateKeyboardDriver()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -609,11 +609,19 @@ namespace OpenTK.Platform.X11
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XEventName.KeyPress:
|
case XEventName.KeyPress:
|
||||||
|
driver.ProcessEvent(ref e);
|
||||||
|
break;
|
||||||
|
|
||||||
case XEventName.KeyRelease:
|
case XEventName.KeyRelease:
|
||||||
|
// Todo: raise KeyPress event. Use code from
|
||||||
|
// http://anonsvn.mono-project.com/viewvc/trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/X11Keyboard.cs?view=markup
|
||||||
|
|
||||||
|
driver.ProcessEvent(ref e);
|
||||||
|
break;
|
||||||
|
|
||||||
case XEventName.MotionNotify:
|
case XEventName.MotionNotify:
|
||||||
case XEventName.ButtonPress:
|
case XEventName.ButtonPress:
|
||||||
case XEventName.ButtonRelease:
|
case XEventName.ButtonRelease:
|
||||||
//Functions.XPutBackEvent(window.Display, ref e);
|
|
||||||
driver.ProcessEvent(ref e);
|
driver.ProcessEvent(ref e);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -852,6 +860,8 @@ namespace OpenTK.Platform.X11
|
||||||
|
|
||||||
public event EventHandler<EventArgs> FocusedChanged;
|
public event EventHandler<EventArgs> FocusedChanged;
|
||||||
|
|
||||||
|
public event EventHandler<KeyPressEventArgs> KeyPress;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
Loading…
Reference in a new issue