From 86cedb94254c3ea80fc82d1eb082730cd16d6cb1 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Thu, 23 Oct 2003 18:21:56 +0000 Subject: [PATCH] *** empty log message *** --- src/native/common/extal.cpp | 2 +- src/native/macosx/hid.cpp | 23 +++++++++++++-------- src/native/macosx/org_lwjgl_input_Mouse.cpp | 2 +- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/native/common/extal.cpp b/src/native/common/extal.cpp index 31be5c58..9f43256d 100644 --- a/src/native/common/extal.cpp +++ b/src/native/common/extal.cpp @@ -196,7 +196,7 @@ static bool LoadOpenAL(JNIEnv *env, jobjectArray oalPaths) { jsize pathcount = env->GetArrayLength(oalPaths); #ifdef _DEBUG - printf("Found %d OpenAL paths\n", pathcount); + printf("Found %d OpenAL paths\n", (int)pathcount); #endif for(int i=0;iGetObjectArrayElement(oalPaths, i); diff --git a/src/native/macosx/hid.cpp b/src/native/macosx/hid.cpp index 36a9009a..59dbd026 100644 --- a/src/native/macosx/hid.cpp +++ b/src/native/macosx/hid.cpp @@ -45,7 +45,7 @@ static void searchDictionary(CFDictionaryRef dict, hid_device_t *hid_dev, int num_cookies, hid_cookie_t *hid_cookies); static void searchObject(CFTypeRef object, hid_device_t *hid_dev, int num_cookies, hid_cookie_t *hid_cookies); -/*static void printCFString(CFStringRef str) { +static void printCFString(CFStringRef str) { CFIndex buffer_size = CFStringGetLength(str) + 1; char * buffer = (char *)malloc(buffer_size); if (buffer != NULL) { @@ -61,21 +61,20 @@ static void printCFNumber(CFNumberRef num) { if (CFNumberGetValue(num, kCFNumberLongType, &number)) printf("0x%lx (%ld)", number, number); } -*/ -/*static void printProperty(CFDictionaryRef dict, CFStringRef key) { + +static void printProperty(CFDictionaryRef dict, CFStringRef key) { CFTypeRef val = CFDictionaryGetValue(dict, key); if (val != NULL) { CFTypeID type = CFGetTypeID(val); - if (type == CFArrayGetTypeID()) printf("array\n"); +/* if (type == CFArrayGetTypeID()) printf("array\n"); else if (type == CFBooleanGetTypeID()) printf("boolean\n"); else if (type == CFDictionaryGetTypeID()) printf("dictionary\n"); - else if (type == CFNumberGetTypeID()) printCFNumber((CFNumberRef)val); + else*/ if (type == CFNumberGetTypeID()) printCFNumber((CFNumberRef)val); else if (type == CFStringGetTypeID()) printCFString((CFStringRef)val); else printf("\n"); } } -*/ static void closeDeviceAndQueue(hid_device_t *hid_dev) { (*hid_dev->device_queue)->dispose(hid_dev->device_queue); @@ -205,9 +204,15 @@ bool findDevice(hid_device_t *hid_dev, long device_usage_page, long device_usage long usage; long usage_page; if (getDictLong(dev_props, CFSTR(kIOHIDPrimaryUsageKey), &usage) && - getDictLong(dev_props, CFSTR(kIOHIDPrimaryUsagePageKey), &usage_page) && - usage_page == device_usage_page && usage == device_usage) { - success = initDevice(hid_dev, hid_device, dev_props, num_cookies, hid_cookies, buffer_size); + getDictLong(dev_props, CFSTR(kIOHIDPrimaryUsagePageKey), &usage_page)) { +#ifdef _DEBUG + printf("Considering device '"); + printProperty(dev_props, CFSTR(kIOHIDProductKey)); + printf("', usage page %ld usage %ld\n", usage_page, usage); +#endif + if (usage_page == device_usage_page && usage == device_usage) { + success = initDevice(hid_dev, hid_device, dev_props, num_cookies, hid_cookies, buffer_size); + } } CFRelease(dev_props); } diff --git a/src/native/macosx/org_lwjgl_input_Mouse.cpp b/src/native/macosx/org_lwjgl_input_Mouse.cpp index 71951ca9..3c398e50 100644 --- a/src/native/macosx/org_lwjgl_input_Mouse.cpp +++ b/src/native/macosx/org_lwjgl_input_Mouse.cpp @@ -164,7 +164,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nCreate(JNIEnv * env, jclass c hid_cookies[z_axis_index].usage_page = kHIDPage_GenericDesktop; hid_cookies[z_axis_index].usage = kHIDUsage_GD_Wheel; if (!findDevice(&hid_dev, kHIDPage_GenericDesktop, kHIDUsage_GD_Mouse, NUM_COOKIES, hid_cookies, EVENT_BUFFER_SIZE)) { - throwException(env, "Could not find HID muse device"); + throwException(env, "Could not find HID mouse device"); return; } CGAssociateMouseAndMouseCursorPosition(FALSE);