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
981587abbc
commit
a775a55c46
|
|
@ -1,10 +1,4 @@
|
|||
/*
|
||||
* %W% %E%
|
||||
*
|
||||
* Copyright 2002 Sun Microsystems, Inc. All rights reserved.
|
||||
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||
*/
|
||||
/*****************************************************************************
|
||||
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
|
|
@ -35,7 +29,7 @@
|
|||
* You acknowledge that this software is not designed or intended for us in
|
||||
* the design, construction, operation or maintenance of any nuclear facility
|
||||
*
|
||||
*****************************************************************************/
|
||||
*/
|
||||
package net.java.games.input;
|
||||
|
||||
import java.util.Map;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,4 @@
|
|||
/*
|
||||
* %W% %E%
|
||||
*
|
||||
* Copyright 2002 Sun Microsystems, Inc. All rights reserved.
|
||||
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||
*/
|
||||
/*****************************************************************************
|
||||
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
|
|
@ -35,7 +29,7 @@
|
|||
* You acknowledge that this software is not designed or intended for us in
|
||||
* the design, construction, operation or maintenance of any nuclear facility
|
||||
*
|
||||
*****************************************************************************/
|
||||
*/
|
||||
package net.java.games.input;
|
||||
|
||||
/** Generic Desktop Usages
|
||||
|
|
|
|||
|
|
@ -1,10 +1,4 @@
|
|||
/*
|
||||
* %W% %E%
|
||||
*
|
||||
* Copyright 2002 Sun Microsystems, Inc. All rights reserved.
|
||||
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||
*/
|
||||
/*****************************************************************************
|
||||
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
|
|
@ -35,12 +29,9 @@
|
|||
* You acknowledge that this software is not designed or intended for us in
|
||||
* the design, construction, operation or maintenance of any nuclear facility
|
||||
*
|
||||
*****************************************************************************/
|
||||
*/
|
||||
package net.java.games.input;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
|
||||
/** Mapping from Keyboard HID usages to Component.Identifier.Key
|
||||
* @author elias
|
||||
* @version 1.0
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ final class OSXHIDDevice {
|
|||
|
||||
private final long device_address;
|
||||
private final long device_interface_address;
|
||||
private final Map properties;
|
||||
private final Map<String,?> properties;
|
||||
|
||||
private boolean released;
|
||||
|
||||
|
|
@ -130,7 +130,7 @@ final class OSXHIDDevice {
|
|||
return (String)properties.get(kIOHIDProductKey);
|
||||
}
|
||||
|
||||
private final OSXHIDElement createElementFromElementProperties(Map element_properties) {
|
||||
private final OSXHIDElement createElementFromElementProperties(Map<String,?> element_properties) {
|
||||
/* long size = getLongFromProperties(element_properties, kIOHIDElementSizeKey);
|
||||
// ignore elements that can't fit into the 32 bit value field of a hid event
|
||||
if (size > 32)
|
||||
|
|
@ -161,12 +161,13 @@ final class OSXHIDDevice {
|
|||
}
|
||||
}
|
||||
|
||||
private final void addElements(List elements, Map properties) {
|
||||
@SuppressWarnings("unchecked")
|
||||
private final void addElements(List<OSXHIDElement> elements, Map<String,?> properties) {
|
||||
Object[] elements_properties = (Object[])properties.get(kIOHIDElementKey);
|
||||
if (elements_properties == null)
|
||||
return;
|
||||
for (int i = 0; i < elements_properties.length; i++) {
|
||||
Map element_properties = (Map)elements_properties[i];
|
||||
Map<String,?> element_properties = (Map<String,?>)elements_properties[i];
|
||||
OSXHIDElement element = createElementFromElementProperties(element_properties);
|
||||
if (element != null) {
|
||||
elements.add(element);
|
||||
|
|
@ -175,28 +176,28 @@ final class OSXHIDDevice {
|
|||
}
|
||||
}
|
||||
|
||||
public final List getElements() {
|
||||
List elements = new ArrayList();
|
||||
public final List<OSXHIDElement> getElements() {
|
||||
List<OSXHIDElement> elements = new ArrayList<>();
|
||||
addElements(elements, properties);
|
||||
return elements;
|
||||
}
|
||||
|
||||
private final static long getLongFromProperties(Map properties, String key, long default_value) {
|
||||
private final static long getLongFromProperties(Map<String,?> properties, String key, long default_value) {
|
||||
Long long_obj = (Long)properties.get(key);
|
||||
if (long_obj == null)
|
||||
return default_value;
|
||||
return long_obj.longValue();
|
||||
}
|
||||
|
||||
private final static boolean getBooleanFromProperties(Map properties, String key, boolean default_value) {
|
||||
private final static boolean getBooleanFromProperties(Map<String,?> properties, String key, boolean default_value) {
|
||||
return getLongFromProperties(properties, key, default_value ? 1 : 0) != 0;
|
||||
}
|
||||
|
||||
private final static int getIntFromProperties(Map properties, String key) {
|
||||
private final static int getIntFromProperties(Map<String,?> properties, String key) {
|
||||
return (int)getLongFromProperties(properties, key);
|
||||
}
|
||||
|
||||
private final static long getLongFromProperties(Map properties, String key) {
|
||||
private final static long getLongFromProperties(Map<String,?> properties, String key) {
|
||||
Long long_obj = (Long)properties.get(key);
|
||||
return long_obj.longValue();
|
||||
}
|
||||
|
|
@ -217,28 +218,6 @@ final class OSXHIDDevice {
|
|||
return createUsagePair(usage_page_id, usage_id);
|
||||
}
|
||||
|
||||
/*
|
||||
public final List getUsagePairs() {
|
||||
List usage_pairs_list = new ArrayList();
|
||||
Object[] usage_pairs = (Object[])properties.get(kIOHIDDeviceUsagePairsKey);
|
||||
if (usage_pairs == null) {
|
||||
int usage_page_id = getIntFromProperties(properties, kIOHIDPrimaryUsagePageKey);
|
||||
int usage_id = getIntFromProperties(properties, kIOHIDPrimaryUsageKey);
|
||||
UsagePair pair = createUsagePair(usage_page_id, usage_id);
|
||||
if (pair != null)
|
||||
usage_pairs_list.add(pair);
|
||||
}
|
||||
for (int i = 0; i < usage_pairs.length; i++) {
|
||||
Map usage_pair = (Map)usage_pairs[i];
|
||||
int usage_page_id = getIntFromProperties(usage_pair, kIOHIDDeviceUsagePageKey);
|
||||
int usage_id = getIntFromProperties(usage_pair, kIOHIDDeviceUsageKey);
|
||||
UsagePair pair = createUsagePair(usage_page_id, usage_id);
|
||||
if (pair != null)
|
||||
usage_pairs_list.add(pair);
|
||||
}
|
||||
return usage_pairs_list;
|
||||
}
|
||||
*/
|
||||
private final void dumpProperties() {
|
||||
log.info(toString());
|
||||
dumpMap("", properties);
|
||||
|
|
@ -253,8 +232,8 @@ final class OSXHIDDevice {
|
|||
log.info(prefix + "}");
|
||||
}
|
||||
|
||||
private final static void dumpMap(String prefix, Map map) {
|
||||
Iterator keys = map.keySet().iterator();
|
||||
private final static void dumpMap(String prefix, Map<String,?> map) {
|
||||
Iterator<String> keys = map.keySet().iterator();
|
||||
while (keys.hasNext()) {
|
||||
Object key = keys.next();
|
||||
Object value = map.get(key);
|
||||
|
|
@ -263,22 +242,23 @@ final class OSXHIDDevice {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private final static void dumpObject(String prefix, Object obj) {
|
||||
if (obj instanceof Long) {
|
||||
Long l = (Long)obj;
|
||||
log.info(prefix + "0x" + Long.toHexString(l.longValue()));
|
||||
} else if (obj instanceof Map)
|
||||
dumpMap(prefix, (Map)obj);
|
||||
dumpMap(prefix, (Map<String,?>)obj);
|
||||
else if (obj.getClass().isArray())
|
||||
dumpArray(prefix, (Object[])obj);
|
||||
else
|
||||
log.info(prefix + obj);
|
||||
}
|
||||
|
||||
private final Map getDeviceProperties() throws IOException {
|
||||
private final Map<String,?> getDeviceProperties() throws IOException {
|
||||
return nGetDeviceProperties(device_address);
|
||||
}
|
||||
private final static native Map nGetDeviceProperties(long device_address) throws IOException;
|
||||
private final static native Map<String,?> nGetDeviceProperties(long device_address) throws IOException;
|
||||
|
||||
public final synchronized void release() throws IOException {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,4 @@
|
|||
/*
|
||||
* %W% %E%
|
||||
*
|
||||
* Copyright 2002 Sun Microsystems, Inc. All rights reserved.
|
||||
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||
*/
|
||||
/*****************************************************************************
|
||||
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
|
|
@ -35,7 +29,7 @@
|
|||
* You acknowledge that this software is not designed or intended for us in
|
||||
* the design, construction, operation or maintenance of any nuclear facility
|
||||
*
|
||||
*****************************************************************************/
|
||||
*/
|
||||
package net.java.games.input;
|
||||
|
||||
/** Generic Desktop Usages
|
||||
|
|
|
|||
|
|
@ -1,10 +1,4 @@
|
|||
/*
|
||||
* %W% %E%
|
||||
*
|
||||
* Copyright 2002 Sun Microsystems, Inc. All rights reserved.
|
||||
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||
*/
|
||||
/*****************************************************************************
|
||||
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
|
|
@ -35,7 +29,7 @@
|
|||
* You acknowledge that this software is not designed or intended for us in
|
||||
* the design, construction, operation or maintenance of any nuclear facility
|
||||
*
|
||||
*****************************************************************************/
|
||||
*/
|
||||
package net.java.games.input;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
|
@ -77,7 +71,7 @@ final class UsagePage {
|
|||
/* ReservedPointofSalepages 0x8E - 0X8F */
|
||||
public final static UsagePage CAMERACONTROL= new UsagePage(0x90); /* USB Device Class Definition for Image Class Devices */
|
||||
public final static UsagePage ARCADE = new UsagePage(0x91); /* OAAF Definitions for arcade and coinop related Devices */
|
||||
private final Class usage_class;
|
||||
private final Class<? extends Usage> usage_class;
|
||||
private final int usage_page_id;
|
||||
|
||||
public final static UsagePage map(int page_id) {
|
||||
|
|
@ -86,7 +80,7 @@ final class UsagePage {
|
|||
return map[page_id];
|
||||
}
|
||||
|
||||
private UsagePage(int page_id, Class usage_class) {
|
||||
private UsagePage(int page_id, Class<? extends Usage> usage_class) {
|
||||
map[page_id] = this;
|
||||
this.usage_class = usage_class;
|
||||
this.usage_page_id = page_id;
|
||||
|
|
@ -104,8 +98,8 @@ final class UsagePage {
|
|||
if (usage_class == null)
|
||||
return null;
|
||||
try {
|
||||
Method map_method = usage_class.getMethod("map", new Class[]{int.class});
|
||||
Object result = map_method.invoke(null, new Object[]{new Integer(usage_id)});
|
||||
Method map_method = usage_class.getMethod("map", int.class);
|
||||
Object result = map_method.invoke(null, usage_id);
|
||||
return (Usage)result;
|
||||
} catch (Exception e) {
|
||||
throw new Error(e);
|
||||
|
|
|
|||
Loading…
Reference in a new issue