mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-07-07 10:20:31 +00:00
Added preliminary key handling to X11Keyboard.
Removed stupid hack in WinRawKeyboard.
This commit is contained in:
parent
22c3eb187f
commit
69730a274e
|
@ -297,12 +297,10 @@ namespace OpenTK.Platform.Windows
|
||||||
if (!WinRawKeyboard.KeyMap.ContainsKey(rin.Data.Keyboard.VKey))
|
if (!WinRawKeyboard.KeyMap.ContainsKey(rin.Data.Keyboard.VKey))
|
||||||
{
|
{
|
||||||
Debug.Print("Virtual key {0} not mapped.", rin.Data.Keyboard.VKey);
|
Debug.Print("Virtual key {0} not mapped.", rin.Data.Keyboard.VKey);
|
||||||
OpenTK.OpenGL.GL.ClearColor(1.0f, 0.3f, 0.3f, 0.0f);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
keyboards[0][WinRawKeyboard.KeyMap[rin.Data.Keyboard.VKey]] = pressed;
|
keyboards[0][WinRawKeyboard.KeyMap[rin.Data.Keyboard.VKey]] = pressed;
|
||||||
OpenTK.OpenGL.GL.ClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ using System.Text;
|
||||||
|
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace OpenTK.Platform.X11
|
namespace OpenTK.Platform.X11
|
||||||
{
|
{
|
||||||
|
@ -117,7 +118,7 @@ namespace OpenTK.Platform.X11
|
||||||
keyboards.Add(kb);
|
keyboards.Add(kb);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region internal bool ProcessKeyboardEvent(API.RawInput rin)
|
#region internal bool ProcessKeyboardEvent(X11.KeyEvent e)
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Processes X11 KeyEvents.
|
/// Processes X11 KeyEvents.
|
||||||
|
@ -126,6 +127,25 @@ namespace OpenTK.Platform.X11
|
||||||
/// <returns>True if the event was processed, false otherwise.</returns>
|
/// <returns>True if the event was processed, false otherwise.</returns>
|
||||||
internal bool ProcessKeyboardEvent(X11.KeyEvent e)
|
internal bool ProcessKeyboardEvent(X11.KeyEvent e)
|
||||||
{
|
{
|
||||||
|
int keysym = keysyms[(e.keycode - firstKeyCode) * keysyms_per_keycode].ToInt32();
|
||||||
|
int keysym2 = keysyms[(e.keycode - firstKeyCode) * keysyms_per_keycode].ToInt32();
|
||||||
|
bool pressed = e.type == EventType.KeyPress;
|
||||||
|
|
||||||
|
switch (keysym)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
if (keymap.ContainsKey((XKey)keysym))
|
||||||
|
{
|
||||||
|
keyboards[0][keymap[(XKey)keysym]] = pressed;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Print("Virtual key {0} not mapped. (keysym: {1},{2})", e.keycode, keysym, keysym2);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
/*API.e.keycode
|
/*API.e.keycode
|
||||||
switch (rin.Header.Type)
|
switch (rin.Header.Type)
|
||||||
|
|
Loading…
Reference in a new issue