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