Skip to content

Commit c7ea861

Browse files
committed
Merge pull request #104894 from sorascode/fix-macos-joy-name
[macos] fix: use productCategory instead of vendorName for joypad name
2 parents 1f1b1c5 + abaaa87 commit c7ea861

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/apple/joypad_apple.mm

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,13 @@ int rightmost_one(int n) {
503503
}
504504

505505
// Tell Godot about our new controller.
506-
Input::get_singleton()->joy_connection_changed(joy_id, true, String::utf8(p_controller.vendorName.UTF8String));
506+
char const *device_name;
507+
if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, *)) {
508+
device_name = p_controller.productCategory.UTF8String;
509+
} else {
510+
device_name = p_controller.vendorName.UTF8String;
511+
}
512+
Input::get_singleton()->joy_connection_changed(joy_id, true, String::utf8(device_name));
507513

508514
// Assign our player index.
509515
joypads.insert(joy_id, memnew(GameController(joy_id, p_controller)));

0 commit comments

Comments
 (0)