mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-25 19:15:36 +00:00
Reverted to 0.3.12 way of handling input events.
This commit is contained in:
parent
ff5540b487
commit
24a2140872
|
@ -29,7 +29,6 @@ namespace OpenTK.Platform.X11
|
|||
Thread pollingThread = null;
|
||||
|
||||
bool disposed;
|
||||
bool disposing = false;
|
||||
|
||||
#region --- Constructors ---
|
||||
|
||||
|
@ -45,13 +44,13 @@ namespace OpenTK.Platform.X11
|
|||
Debug.Indent();
|
||||
|
||||
if (attach == null)
|
||||
{
|
||||
throw new ArgumentException("A valid parent window must be defined, in order to create an X11Input driver.");
|
||||
}
|
||||
|
||||
window = new X11.WindowInfo(attach);
|
||||
window.Parent = attach;
|
||||
/*
|
||||
window = new WindowInfo();
|
||||
window.Parent = attach;
|
||||
|
||||
Debug.Print("Creating hidden input window.");
|
||||
|
||||
XSetWindowAttributes wnd_attr = new XSetWindowAttributes();
|
||||
|
@ -80,7 +79,7 @@ namespace OpenTK.Platform.X11
|
|||
keyboardDriver = new X11Keyboard(window);
|
||||
mouseDriver = new X11Mouse(window);
|
||||
|
||||
//Thread pollingThread = new Thread(InternalPoll);
|
||||
//pollingThread = new Thread(InternalPoll);
|
||||
//pollingThread.Priority = ThreadPriority.BelowNormal;
|
||||
//pollingThread.IsBackground = true;
|
||||
//pollingThread.Start();
|
||||
|
@ -90,44 +89,46 @@ namespace OpenTK.Platform.X11
|
|||
|
||||
#endregion
|
||||
|
||||
#region private void InternalPoll()
|
||||
#if false
|
||||
private void InternalPoll()
|
||||
{
|
||||
/*
|
||||
X11.XEvent e = new XEvent();
|
||||
try
|
||||
{
|
||||
//while (!disposed)
|
||||
//{
|
||||
// Functions.XMaskEvent(window.Display,
|
||||
// EventMask.PointerMotionMask | EventMask.PointerMotionHintMask |
|
||||
// EventMask.ButtonPressMask | EventMask.ButtonReleaseMask |
|
||||
// EventMask.KeyPressMask | EventMask.KeyReleaseMask |
|
||||
// EventMask.StructureNotifyMask, ref e);
|
||||
while (!disposed)
|
||||
{
|
||||
Functions.XMaskEvent(window.Display,
|
||||
EventMask.PointerMotionMask | EventMask.PointerMotionHintMask |
|
||||
EventMask.ButtonPressMask | EventMask.ButtonReleaseMask |
|
||||
EventMask.KeyPressMask | EventMask.KeyReleaseMask |
|
||||
EventMask.StructureNotifyMask, ref e);
|
||||
|
||||
// if (disposed || disposing)
|
||||
// return;
|
||||
if (disposed)
|
||||
return;
|
||||
|
||||
// switch (e.type)
|
||||
// {
|
||||
// case XEventName.KeyPress:
|
||||
// case XEventName.KeyRelease:
|
||||
// keyboardDriver.ProcessKeyboardEvent(ref e.KeyEvent);
|
||||
// break;
|
||||
switch (e.type)
|
||||
{
|
||||
case XEventName.KeyPress:
|
||||
case XEventName.KeyRelease:
|
||||
keyboardDriver.ProcessKeyboardEvent(ref e.KeyEvent);
|
||||
break;
|
||||
|
||||
// case XEventName.ButtonPress:
|
||||
// case XEventName.ButtonRelease:
|
||||
// mouseDriver.ProcessButton(ref e.ButtonEvent);
|
||||
// break;
|
||||
case XEventName.ButtonPress:
|
||||
case XEventName.ButtonRelease:
|
||||
mouseDriver.ProcessButton(ref e.ButtonEvent);
|
||||
break;
|
||||
|
||||
// case XEventName.MotionNotify:
|
||||
// mouseDriver.ProcessMotion(ref e.MotionEvent);
|
||||
// break;
|
||||
case XEventName.MotionNotify:
|
||||
mouseDriver.ProcessMotion(ref e.MotionEvent);
|
||||
break;
|
||||
|
||||
// case XEventName.DestroyNotify:
|
||||
// Functions.XPutBackEvent(window.Display, ref e);
|
||||
// //pollingThread.Abort();
|
||||
// return;
|
||||
// }
|
||||
//}
|
||||
case XEventName.DestroyNotify:
|
||||
Functions.XPutBackEvent(window.Display, ref e);
|
||||
//pollingThread.Abort();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (ThreadAbortException expt)
|
||||
{
|
||||
|
@ -135,8 +136,11 @@ namespace OpenTK.Platform.X11
|
|||
Functions.XDestroyWindow(window.Display, window.Handle);
|
||||
return;
|
||||
}
|
||||
*/
|
||||
}
|
||||
#endif
|
||||
#endregion
|
||||
|
||||
#region internal void ProcessEvent(ref XEvent e)
|
||||
|
||||
internal void ProcessEvent(ref XEvent e)
|
||||
{
|
||||
|
@ -162,6 +166,8 @@ namespace OpenTK.Platform.X11
|
|||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- IInputDriver Members ---
|
||||
|
||||
#region public IList<IInputDevice> InputDevices
|
||||
|
@ -199,6 +205,7 @@ namespace OpenTK.Platform.X11
|
|||
public void Poll()
|
||||
{
|
||||
mouseDriver.Poll();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -217,7 +224,7 @@ namespace OpenTK.Platform.X11
|
|||
{
|
||||
if (!disposed)
|
||||
{
|
||||
disposing = true;
|
||||
//disposing = true;
|
||||
if (pollingThread != null && pollingThread.IsAlive)
|
||||
pollingThread.Abort();
|
||||
|
||||
|
|
|
@ -161,12 +161,12 @@ namespace OpenTK.Platform.X11
|
|||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
#region --- Constructor ---
|
||||
|
||||
internal X11Keyboard(WindowInfo window)
|
||||
{
|
||||
if (window == null)
|
||||
throw new ArgumentException("Window cannot be null.");
|
||||
throw new ArgumentNullException("window");
|
||||
|
||||
this.window = window;
|
||||
Initialize();
|
||||
|
@ -250,6 +250,8 @@ namespace OpenTK.Platform.X11
|
|||
|
||||
#endregion
|
||||
|
||||
#region public void Poll()
|
||||
|
||||
public void Poll()
|
||||
{
|
||||
//Keymap map = new Keymap();
|
||||
|
@ -273,5 +275,7 @@ namespace OpenTK.Platform.X11
|
|||
}
|
||||
*/
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace OpenTK.Platform.X11
|
|||
WindowInfo window;
|
||||
List<MouseDevice> mice = new List<MouseDevice>();
|
||||
|
||||
#region Constructor
|
||||
#region --- Constructor ---
|
||||
|
||||
public X11Mouse(WindowInfo window)
|
||||
{
|
||||
|
@ -28,6 +28,7 @@ namespace OpenTK.Platform.X11
|
|||
|
||||
// Just create one mouse now.
|
||||
// TODO: support for multiple devices through evdev.
|
||||
// TODO: Should call XSelectInput for mouse pointer events.
|
||||
MouseDevice m = new MouseDevice();
|
||||
m.Description = "Default X11 mouse";
|
||||
m.DeviceID = IntPtr.Zero;
|
||||
|
|
Loading…
Reference in a new issue