mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-07-16 15:47:37 +00:00
[X11] Warn when XI2Mouse is not supported.
Without the XI2 extension, mouse support will suffer significantly. More specifically, low-level mouse events will not be available.
This commit is contained in:
parent
3febb4dda0
commit
452d61bc60
|
@ -156,30 +156,38 @@ namespace OpenTK.Platform.X11
|
||||||
// If a display is not specified, the default display is used.
|
// If a display is not specified, the default display is used.
|
||||||
internal static bool IsSupported(IntPtr display)
|
internal static bool IsSupported(IntPtr display)
|
||||||
{
|
{
|
||||||
if (display == IntPtr.Zero)
|
try
|
||||||
{
|
{
|
||||||
display = API.DefaultDisplay;
|
if (display == IntPtr.Zero)
|
||||||
}
|
|
||||||
|
|
||||||
using (new XLock(display))
|
|
||||||
{
|
|
||||||
int major, ev, error;
|
|
||||||
if (Functions.XQueryExtension(display, "XInputExtension", out major, out ev, out error) != 0)
|
|
||||||
{
|
{
|
||||||
XIOpCode = major;
|
display = API.DefaultDisplay;
|
||||||
|
}
|
||||||
|
|
||||||
int minor = 2;
|
using (new XLock(display))
|
||||||
while (minor >= 0)
|
{
|
||||||
|
int major, ev, error;
|
||||||
|
if (Functions.XQueryExtension(display, "XInputExtension", out major, out ev, out error) != 0)
|
||||||
{
|
{
|
||||||
if (XI.QueryVersion(display, ref major, ref minor) == ErrorCodes.Success)
|
XIOpCode = major;
|
||||||
|
|
||||||
|
int minor = 2;
|
||||||
|
while (minor >= 0)
|
||||||
{
|
{
|
||||||
XIVersion = major * 100 + minor * 10;
|
if (XI.QueryVersion(display, ref major, ref minor) == ErrorCodes.Success)
|
||||||
return true;
|
{
|
||||||
|
XIVersion = major * 100 + minor * 10;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
minor--;
|
||||||
}
|
}
|
||||||
minor--;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (DllNotFoundException e)
|
||||||
|
{
|
||||||
|
Debug.Print(e.ToString());
|
||||||
|
Debug.Print("XInput2 extension not supported. Mouse support will suffer.");
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue