mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-23 11:35:39 +00:00
Hooked up Keyboard event handling in X11Input
Added ProcessEvents() function to IInputDriver. Does nothing on WinRawInput, but is needed by X11Input
This commit is contained in:
parent
69730a274e
commit
13c04f4bbd
|
@ -280,6 +280,7 @@ namespace OpenTK
|
||||||
public void ProcessEvents()
|
public void ProcessEvents()
|
||||||
{
|
{
|
||||||
glWindow.ProcessEvents();
|
glWindow.ProcessEvents();
|
||||||
|
driver.ProcessEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -7,7 +7,7 @@ namespace OpenTK.Input
|
||||||
public interface IInputDriver : IKeyboardDriver, IMouseDriver
|
public interface IInputDriver : IKeyboardDriver, IMouseDriver
|
||||||
{
|
{
|
||||||
IList<IInputDevice> InputDevices { get; }
|
IList<IInputDevice> InputDevices { get; }
|
||||||
//void ProcessEvents
|
void ProcessEvents();
|
||||||
//IEnumerable<IMouse> Mice { get; }
|
//IEnumerable<IMouse> Mice { get; }
|
||||||
//IEnumerable<IHid> Hids { get; }
|
//IEnumerable<IHid> Hids { get; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,11 @@ namespace OpenTK
|
||||||
get { return inputDriver.Mouse; }
|
get { return inputDriver.Mouse; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ProcessEvents()
|
||||||
|
{
|
||||||
|
inputDriver.ProcessEvents();
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,33 +57,6 @@ namespace OpenTK.Platform.Windows
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a value indicating whether the Device list has changed, for example
|
|
||||||
/// by removing or adding a device.
|
|
||||||
/// </summary>
|
|
||||||
internal static bool DeviceListChanged
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
uint count = 0;
|
|
||||||
if (API.GetRawInputDeviceList(null, ref count, API.RawInputDeviceListSize) == 0)
|
|
||||||
{
|
|
||||||
if (deviceCount == count)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
deviceCount = count;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new ApplicationException(String.Format(
|
|
||||||
"Could not retrieve the count of Keyboard devices. Windows error: {0}",
|
|
||||||
Marshal.GetLastWin32Error()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
#region protected override void WndProc(ref Message msg)
|
#region protected override void WndProc(ref Message msg)
|
||||||
|
|
||||||
int size = 0;
|
int size = 0;
|
||||||
|
@ -166,6 +139,12 @@ namespace OpenTK.Platform.Windows
|
||||||
get { throw new Exception("The method or operation is not implemented."); }
|
get { throw new Exception("The method or operation is not implemented."); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ProcessEvents()
|
||||||
|
{
|
||||||
|
// Do nothing, the WndProc is automatically notified of new events.
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IMouseDriver Members
|
#region IMouseDriver Members
|
||||||
|
|
|
@ -14,6 +14,11 @@ namespace OpenTK.Platform.X11
|
||||||
internal sealed class X11Input : IInputDriver
|
internal sealed class X11Input : IInputDriver
|
||||||
{
|
{
|
||||||
private X11Keyboard keyboardDriver;
|
private X11Keyboard keyboardDriver;
|
||||||
|
private WindowInfo window;
|
||||||
|
|
||||||
|
Event e = new Event();
|
||||||
|
KeyEvent keyEvent = new KeyEvent();
|
||||||
|
|
||||||
|
|
||||||
#region --- Constructors ---
|
#region --- Constructors ---
|
||||||
|
|
||||||
|
@ -44,7 +49,7 @@ namespace OpenTK.Platform.X11
|
||||||
CreateWindowMask cw_mask =
|
CreateWindowMask cw_mask =
|
||||||
CreateWindowMask.CWEventMask;
|
CreateWindowMask.CWEventMask;
|
||||||
|
|
||||||
WindowInfo window = new WindowInfo(parent);
|
window = new WindowInfo(parent);
|
||||||
|
|
||||||
window.Handle = API.CreateWindow(
|
window.Handle = API.CreateWindow(
|
||||||
window.Display,
|
window.Display,
|
||||||
|
@ -110,6 +115,19 @@ namespace OpenTK.Platform.X11
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
public void ProcessEvents()
|
||||||
|
{
|
||||||
|
API.PeekEvent(window.Display, e);
|
||||||
|
switch (e.Type)
|
||||||
|
{
|
||||||
|
case EventType.KeyPress:
|
||||||
|
case EventType.KeyRelease:
|
||||||
|
API.NextEvent(window.Display, keyEvent);
|
||||||
|
keyboardDriver.ProcessKeyboardEvent(keyEvent);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue