mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-02-24 07:16:50 +00:00
[Linux] Print libinput seat for each detected device
This commit is contained in:
parent
20747664f4
commit
21bcc5eae1
|
@ -82,6 +82,9 @@ namespace OpenTK.Platform.Linux
|
|||
}
|
||||
}
|
||||
|
||||
[DllImport(lib, EntryPoint = "libinput_device_get_seat", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr DeviceGetSeat(IntPtr device);
|
||||
|
||||
[DllImport(lib, EntryPoint = "libinput_device_has_capability", CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
public static extern bool DeviceHasCapability(IntPtr device, DeviceCapability capability);
|
||||
|
@ -115,6 +118,26 @@ namespace OpenTK.Platform.Linux
|
|||
|
||||
[DllImport(lib, EntryPoint = "libinput_suspend", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void Suspend(IntPtr libinput);
|
||||
|
||||
[DllImport(lib, EntryPoint = "libinput_seat_get_logical_name", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern public IntPtr SeatGetLogicalNameInternal(IntPtr seat);
|
||||
public static string SeatGetLogicalName(IntPtr seat)
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
return new string((sbyte*)SeatGetLogicalNameInternal(seat));
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport(lib, EntryPoint = "libinput_seat_get_physical_name", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern public IntPtr SeatGetPhysicalNameInternal(IntPtr seat);
|
||||
public static string SeatGetPhysicalName(IntPtr seat)
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
return new string((sbyte*)SeatGetPhysicalName(seat));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum DeviceCapability
|
||||
|
|
|
@ -44,6 +44,8 @@ namespace OpenTK.Platform.Linux
|
|||
readonly IntPtr Device;
|
||||
string name;
|
||||
string output;
|
||||
string logical_seat;
|
||||
string physical_seat;
|
||||
|
||||
public DeviceBase(IntPtr device, int id)
|
||||
{
|
||||
|
@ -72,6 +74,32 @@ namespace OpenTK.Platform.Linux
|
|||
}
|
||||
}
|
||||
|
||||
public IntPtr Seat
|
||||
{
|
||||
get
|
||||
{
|
||||
return LibInput.DeviceGetSeat(Device);
|
||||
}
|
||||
}
|
||||
|
||||
public string LogicalSeatName
|
||||
{
|
||||
get
|
||||
{
|
||||
logical_seat = logical_seat ?? LibInput.SeatGetLogicalName(Seat);
|
||||
return logical_seat;
|
||||
}
|
||||
}
|
||||
|
||||
public string PhysicalSeatName
|
||||
{
|
||||
get
|
||||
{
|
||||
physical_seat = physical_seat ?? LibInput.SeatGetPhysicalName(Seat);
|
||||
return physical_seat;
|
||||
}
|
||||
}
|
||||
|
||||
public string Output
|
||||
{
|
||||
get
|
||||
|
@ -372,14 +400,16 @@ namespace OpenTK.Platform.Linux
|
|||
{
|
||||
KeyboardDevice keyboard = new KeyboardDevice(device, Keyboards.Count);
|
||||
Keyboards.Add(keyboard.Id, keyboard);
|
||||
Debug.Print("[Input] Added keyboard device {0} '{1}'", keyboard.Id, keyboard.Name);
|
||||
Debug.Print("[Input] Added keyboard device {0} '{1}' on '{2}' ('{3}')",
|
||||
keyboard.Id, keyboard.Name, keyboard.LogicalSeatName, keyboard.PhysicalSeatName);
|
||||
}
|
||||
|
||||
if (LibInput.DeviceHasCapability(device, DeviceCapability.Mouse))
|
||||
{
|
||||
MouseDevice mouse = new MouseDevice(device, Mice.Count);
|
||||
Mice.Add(mouse.Id, mouse);
|
||||
Debug.Print("[Input] Added mouse device {0} '{1}'", mouse.Id, mouse.Name);
|
||||
Debug.Print("[Input] Added mouse device {0} '{1}' on '{2}' ('{3}')",
|
||||
mouse.Id, mouse.Name, mouse.LogicalSeatName, mouse.PhysicalSeatName);
|
||||
}
|
||||
|
||||
if (LibInput.DeviceHasCapability(device, DeviceCapability.Touch))
|
||||
|
|
Loading…
Reference in a new issue