mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-23 02:15:30 +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
0531e20287
commit
6ccbfb266e
|
@ -280,6 +280,7 @@ namespace OpenTK
|
|||
public void ProcessEvents()
|
||||
{
|
||||
glWindow.ProcessEvents();
|
||||
driver.ProcessEvents();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace OpenTK.Input
|
|||
public interface IInputDriver : IKeyboardDriver, IMouseDriver
|
||||
{
|
||||
IList<IInputDevice> InputDevices { get; }
|
||||
//void ProcessEvents
|
||||
void ProcessEvents();
|
||||
//IEnumerable<IMouse> Mice { get; }
|
||||
//IEnumerable<IHid> Hids { get; }
|
||||
}
|
||||
|
|
|
@ -47,6 +47,11 @@ namespace OpenTK
|
|||
get { return inputDriver.Mouse; }
|
||||
}
|
||||
|
||||
public void ProcessEvents()
|
||||
{
|
||||
inputDriver.ProcessEvents();
|
||||
}
|
||||
|
||||
#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)
|
||||
|
||||
int size = 0;
|
||||
|
@ -166,6 +139,12 @@ namespace OpenTK.Platform.Windows
|
|||
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
|
||||
|
||||
#region IMouseDriver Members
|
||||
|
|
|
@ -14,6 +14,11 @@ namespace OpenTK.Platform.X11
|
|||
internal sealed class X11Input : IInputDriver
|
||||
{
|
||||
private X11Keyboard keyboardDriver;
|
||||
private WindowInfo window;
|
||||
|
||||
Event e = new Event();
|
||||
KeyEvent keyEvent = new KeyEvent();
|
||||
|
||||
|
||||
#region --- Constructors ---
|
||||
|
||||
|
@ -44,7 +49,7 @@ namespace OpenTK.Platform.X11
|
|||
CreateWindowMask cw_mask =
|
||||
CreateWindowMask.CWEventMask;
|
||||
|
||||
WindowInfo window = new WindowInfo(parent);
|
||||
window = new WindowInfo(parent);
|
||||
|
||||
window.Handle = API.CreateWindow(
|
||||
window.Display,
|
||||
|
@ -110,6 +115,19 @@ namespace OpenTK.Platform.X11
|
|||
|
||||
#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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue