mirror of
https://github.com/glfw/glfw.git
synced 2025-10-04 05:36:35 +00:00
Merge 87293db93b
into f51cf81148
This commit is contained in:
commit
0986df1c53
@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include <mach/mach.h>
|
#include <mach/mach.h>
|
||||||
#include <mach/mach_error.h>
|
#include <mach/mach_error.h>
|
||||||
@ -287,11 +288,17 @@ static void matchCallback(void* context,
|
|||||||
|
|
||||||
CFStringRef name = IOHIDDeviceGetProperty(deviceRef,
|
CFStringRef name = IOHIDDeviceGetProperty(deviceRef,
|
||||||
CFSTR(kIOHIDProductKey));
|
CFSTR(kIOHIDProductKey));
|
||||||
CFStringGetCString(name,
|
if (name)
|
||||||
joystick->name,
|
{
|
||||||
sizeof(joystick->name),
|
CFStringGetCString(name,
|
||||||
kCFStringEncodingUTF8);
|
joystick->name,
|
||||||
|
sizeof(joystick->name),
|
||||||
|
kCFStringEncodingUTF8);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strncpy(joystick->name, "Unknown", sizeof(joystick->name));
|
||||||
|
}
|
||||||
joystick->axisElements = CFArrayCreateMutable(NULL, 0, NULL);
|
joystick->axisElements = CFArrayCreateMutable(NULL, 0, NULL);
|
||||||
joystick->buttonElements = CFArrayCreateMutable(NULL, 0, NULL);
|
joystick->buttonElements = CFArrayCreateMutable(NULL, 0, NULL);
|
||||||
joystick->hatElements = CFArrayCreateMutable(NULL, 0, NULL);
|
joystick->hatElements = CFArrayCreateMutable(NULL, 0, NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user