Thanks to visit codestin.com
Credit goes to GitHub.com

Skip to content

glfwJoystickIsGamepad returns false for an Xbox Wireless Controller #2797

@mortie

Description

@mortie

When I connect an Xbox Wireless Controller to my computer (running macOS 26), glfwJoystickIsPresent(0) returns true, but glfwJoystickIsGamepad(0) returns false.

Here’s a small test program I wrote which demonstrates the issue:

#include <GLFW/glfw3.h>
#include <cstdlib>
#include <iostream>

int main()
{
	if (!glfwInit()) abort();

	GLFWwindow *window = glfwCreateWindow(640, 480, "GLFW Test", nullptr, nullptr);
	if (!window) abort();

	while (!glfwWindowShouldClose(window)) {
		glfwPollEvents();

		for (int jid = 0; jid <= GLFW_JOYSTICK_LAST; ++jid) {
			if (!glfwJoystickPresent(jid)) {
				continue;
			}

			const char *name = glfwGetJoystickName(jid);
			if (glfwJoystickIsGamepad(jid)) {
				std::cout << "Gamepad " << jid << ": " << name << '\n';
			} else {
				std::cout << "Non-gamepad " << jid << ": " << name << '\n';
			}
		}
	}

	glfwTerminate();
}

When I connect my Xbox Wireless Controller, it starts printing the following line every frame:

Non-gamepad 0: Xbox Wireless Controller

I would expect it to output Gamepad 0: Xbox Wireless Controller.

Am I doing something wrong here? This is just a normal, genuine Xbox Wireless Controller (bought from a reputable electronics reseller), so it would surprise me if it’s not in the game controller database.

OS: macOS 26 Tahoe (I’m not at my Linux machine to test it there for a couple of days)
GLFW version: Tested with 3.4 from Homebrew, 3.4 built from source, and 162896e (the current tip of master).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug reports and bugfix pull requestsinputKeyboard, joystick or mouse

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions