mirror of
https://github.com/shadowfacts/jinput-arm64.git
synced 2025-12-06 08:01:59 +01:00
Fixed compile warnings
This commit is contained in:
parent
88395eef77
commit
7d3e5f31ae
|
|
@ -67,9 +67,7 @@ public final class OSXEnvironmentPlugin extends ControllerEnvironment implements
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static void loadLibrary(final String lib_name) {
|
static void loadLibrary(final String lib_name) {
|
||||||
AccessController.doPrivileged(
|
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
|
||||||
new PrivilegedAction() {
|
|
||||||
public final Object run() {
|
|
||||||
try {
|
try {
|
||||||
String lib_path = System.getProperty("net.java.games.input.librarypath");
|
String lib_path = System.getProperty("net.java.games.input.librarypath");
|
||||||
if (lib_path != null)
|
if (lib_path != null)
|
||||||
|
|
@ -81,25 +79,16 @@ public final class OSXEnvironmentPlugin extends ControllerEnvironment implements
|
||||||
supported = false;
|
supported = false;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static String getPrivilegedProperty(final String property) {
|
static String getPrivilegedProperty(final String property) {
|
||||||
return (String)AccessController.doPrivileged(new PrivilegedAction() {
|
return AccessController.doPrivileged((PrivilegedAction<String>)() -> System.getProperty(property));
|
||||||
public Object run() {
|
|
||||||
return System.getProperty(property);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static String getPrivilegedProperty(final String property, final String default_value) {
|
static String getPrivilegedProperty(final String property, final String default_value) {
|
||||||
return (String)AccessController.doPrivileged(new PrivilegedAction() {
|
return AccessController.doPrivileged((PrivilegedAction<String>)() -> System.getProperty(property, default_value));
|
||||||
public Object run() {
|
|
||||||
return System.getProperty(property, default_value);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
@ -147,10 +136,10 @@ public final class OSXEnvironmentPlugin extends ControllerEnvironment implements
|
||||||
return supported;
|
return supported;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final static void addElements(OSXHIDQueue queue, List elements, List components, boolean map_mouse_buttons) throws IOException {
|
private final static void addElements(OSXHIDQueue queue, List<OSXHIDElement> elements, List<OSXComponent> components, boolean map_mouse_buttons) throws IOException {
|
||||||
Iterator it = elements.iterator();
|
Iterator<OSXHIDElement> it = elements.iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
OSXHIDElement element = (OSXHIDElement)it.next();
|
OSXHIDElement element = it.next();
|
||||||
Component.Identifier id = element.getIdentifier();
|
Component.Identifier id = element.getIdentifier();
|
||||||
if (id == null)
|
if (id == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -169,8 +158,8 @@ public final class OSXEnvironmentPlugin extends ControllerEnvironment implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final static Keyboard createKeyboardFromDevice(OSXHIDDevice device, List elements) throws IOException {
|
private final static Keyboard createKeyboardFromDevice(OSXHIDDevice device, List<OSXHIDElement> elements) throws IOException {
|
||||||
List components = new ArrayList();
|
List<OSXComponent> components = new ArrayList<>();
|
||||||
OSXHIDQueue queue = device.createQueue(AbstractController.EVENT_QUEUE_DEPTH);
|
OSXHIDQueue queue = device.createQueue(AbstractController.EVENT_QUEUE_DEPTH);
|
||||||
try {
|
try {
|
||||||
addElements(queue, elements, components, false);
|
addElements(queue, elements, components, false);
|
||||||
|
|
@ -180,12 +169,11 @@ public final class OSXEnvironmentPlugin extends ControllerEnvironment implements
|
||||||
}
|
}
|
||||||
Component[] components_array = new Component[components.size()];
|
Component[] components_array = new Component[components.size()];
|
||||||
components.toArray(components_array);
|
components.toArray(components_array);
|
||||||
Keyboard keyboard = new OSXKeyboard(device, queue, components_array, new Controller[]{}, new Rumbler[]{});
|
return new OSXKeyboard(device, queue, components_array, new Controller[]{}, new Rumbler[]{});
|
||||||
return keyboard;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private final static Mouse createMouseFromDevice(OSXHIDDevice device, List elements) throws IOException {
|
private final static Mouse createMouseFromDevice(OSXHIDDevice device, List<OSXHIDElement> elements) throws IOException {
|
||||||
List components = new ArrayList();
|
List<OSXComponent> components = new ArrayList<>();
|
||||||
OSXHIDQueue queue = device.createQueue(AbstractController.EVENT_QUEUE_DEPTH);
|
OSXHIDQueue queue = device.createQueue(AbstractController.EVENT_QUEUE_DEPTH);
|
||||||
try {
|
try {
|
||||||
addElements(queue, elements, components, true);
|
addElements(queue, elements, components, true);
|
||||||
|
|
@ -204,8 +192,8 @@ public final class OSXEnvironmentPlugin extends ControllerEnvironment implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final static AbstractController createControllerFromDevice(OSXHIDDevice device, List elements, Controller.Type type) throws IOException {
|
private final static AbstractController createControllerFromDevice(OSXHIDDevice device, List<OSXHIDElement> elements, Controller.Type type) throws IOException {
|
||||||
List components = new ArrayList();
|
List<OSXComponent> components = new ArrayList<>();
|
||||||
OSXHIDQueue queue = device.createQueue(AbstractController.EVENT_QUEUE_DEPTH);
|
OSXHIDQueue queue = device.createQueue(AbstractController.EVENT_QUEUE_DEPTH);
|
||||||
try {
|
try {
|
||||||
addElements(queue, elements, components, false);
|
addElements(queue, elements, components, false);
|
||||||
|
|
@ -215,15 +203,14 @@ public final class OSXEnvironmentPlugin extends ControllerEnvironment implements
|
||||||
}
|
}
|
||||||
Component[] components_array = new Component[components.size()];
|
Component[] components_array = new Component[components.size()];
|
||||||
components.toArray(components_array);
|
components.toArray(components_array);
|
||||||
AbstractController controller = new OSXAbstractController(device, queue, components_array, new Controller[]{}, new Rumbler[]{}, type);
|
return new OSXAbstractController(device, queue, components_array, new Controller[]{}, new Rumbler[]{}, type);
|
||||||
return controller;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private final static void createControllersFromDevice(OSXHIDDevice device, List controllers) throws IOException {
|
private final static void createControllersFromDevice(OSXHIDDevice device, List<Controller> controllers) throws IOException {
|
||||||
UsagePair usage_pair = device.getUsagePair();
|
UsagePair usage_pair = device.getUsagePair();
|
||||||
if (usage_pair == null)
|
if (usage_pair == null)
|
||||||
return;
|
return;
|
||||||
List elements = device.getElements();
|
List<OSXHIDElement> elements = device.getElements();
|
||||||
if (usage_pair.getUsagePage() == UsagePage.GENERIC_DESKTOP && (usage_pair.getUsage() == GenericDesktopUsage.MOUSE ||
|
if (usage_pair.getUsagePage() == UsagePage.GENERIC_DESKTOP && (usage_pair.getUsage() == GenericDesktopUsage.MOUSE ||
|
||||||
usage_pair.getUsage() == GenericDesktopUsage.POINTER)) {
|
usage_pair.getUsage() == GenericDesktopUsage.POINTER)) {
|
||||||
Controller mouse = createMouseFromDevice(device, elements);
|
Controller mouse = createMouseFromDevice(device, elements);
|
||||||
|
|
@ -231,26 +218,18 @@ public final class OSXEnvironmentPlugin extends ControllerEnvironment implements
|
||||||
controllers.add(mouse);
|
controllers.add(mouse);
|
||||||
} else if (usage_pair.getUsagePage() == UsagePage.GENERIC_DESKTOP && (usage_pair.getUsage() == GenericDesktopUsage.KEYBOARD ||
|
} else if (usage_pair.getUsagePage() == UsagePage.GENERIC_DESKTOP && (usage_pair.getUsage() == GenericDesktopUsage.KEYBOARD ||
|
||||||
usage_pair.getUsage() == GenericDesktopUsage.KEYPAD)) {
|
usage_pair.getUsage() == GenericDesktopUsage.KEYPAD)) {
|
||||||
Controller keyboard = createKeyboardFromDevice(device, elements);
|
controllers.add(createKeyboardFromDevice(device, elements));
|
||||||
if (keyboard != null)
|
|
||||||
controllers.add(keyboard);
|
|
||||||
} else if (usage_pair.getUsagePage() == UsagePage.GENERIC_DESKTOP && usage_pair.getUsage() == GenericDesktopUsage.JOYSTICK) {
|
} else if (usage_pair.getUsagePage() == UsagePage.GENERIC_DESKTOP && usage_pair.getUsage() == GenericDesktopUsage.JOYSTICK) {
|
||||||
Controller joystick = createControllerFromDevice(device, elements, Controller.Type.STICK);
|
controllers.add(createControllerFromDevice(device, elements, Controller.Type.STICK));
|
||||||
if (joystick != null)
|
|
||||||
controllers.add(joystick);
|
|
||||||
} else if (usage_pair.getUsagePage() == UsagePage.GENERIC_DESKTOP && usage_pair.getUsage() == GenericDesktopUsage.MULTI_AXIS_CONTROLLER) {
|
} else if (usage_pair.getUsagePage() == UsagePage.GENERIC_DESKTOP && usage_pair.getUsage() == GenericDesktopUsage.MULTI_AXIS_CONTROLLER) {
|
||||||
Controller multiaxis = createControllerFromDevice(device, elements, Controller.Type.STICK);
|
controllers.add(createControllerFromDevice(device, elements, Controller.Type.STICK));
|
||||||
if (multiaxis != null)
|
|
||||||
controllers.add(multiaxis);
|
|
||||||
} else if (usage_pair.getUsagePage() == UsagePage.GENERIC_DESKTOP && usage_pair.getUsage() == GenericDesktopUsage.GAME_PAD) {
|
} else if (usage_pair.getUsagePage() == UsagePage.GENERIC_DESKTOP && usage_pair.getUsage() == GenericDesktopUsage.GAME_PAD) {
|
||||||
Controller game_pad = createControllerFromDevice(device, elements, Controller.Type.GAMEPAD);
|
controllers.add(createControllerFromDevice(device, elements, Controller.Type.GAMEPAD));
|
||||||
if (game_pad != null)
|
|
||||||
controllers.add(game_pad);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final static Controller[] enumerateControllers() {
|
private final static Controller[] enumerateControllers() {
|
||||||
List controllers = new ArrayList();
|
List<Controller> controllers = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
OSXHIDDeviceIterator it = new OSXHIDDeviceIterator();
|
OSXHIDDeviceIterator it = new OSXHIDDeviceIterator();
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue