mirror of
https://github.com/gwm17/glfw.git
synced 2024-11-26 12:18:51 -05:00
parent
a39115a27b
commit
da236ba807
|
@ -63,7 +63,7 @@ static char* getMonitorName(CGDirectDisplayID displayID, NSScreen* screen)
|
|||
&it) != 0)
|
||||
{
|
||||
// This may happen if a desktop Mac is running headless
|
||||
return NULL;
|
||||
return _glfw_strdup("Display");
|
||||
}
|
||||
|
||||
while ((service = IOIteratorNext(it)) != 0)
|
||||
|
@ -101,7 +101,7 @@ static char* getMonitorName(CGDirectDisplayID displayID, NSScreen* screen)
|
|||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||
"Cocoa: Failed to find service port for display");
|
||||
return NULL;
|
||||
return _glfw_strdup("Display");
|
||||
}
|
||||
|
||||
CFDictionaryRef names =
|
||||
|
@ -114,7 +114,7 @@ static char* getMonitorName(CGDirectDisplayID displayID, NSScreen* screen)
|
|||
{
|
||||
// This may happen if a desktop Mac is running headless
|
||||
CFRelease(info);
|
||||
return NULL;
|
||||
return _glfw_strdup("Display");
|
||||
}
|
||||
|
||||
const CFIndex size =
|
||||
|
@ -356,7 +356,7 @@ void _glfwPollMonitorsNS(void)
|
|||
const CGSize size = CGDisplayScreenSize(displays[i]);
|
||||
char* name = getMonitorName(displays[i], screen);
|
||||
if (!name)
|
||||
name = _glfw_strdup("Unknown");
|
||||
continue;
|
||||
|
||||
_GLFWmonitor* monitor = _glfwAllocMonitor(name, size.width, size.height);
|
||||
monitor->ns.displayID = displays[i];
|
||||
|
|
|
@ -446,7 +446,6 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name,
|
|||
|
||||
js = _glfw.joysticks + jid;
|
||||
js->present = GLFW_TRUE;
|
||||
js->name = _glfw_strdup(name);
|
||||
js->axes = calloc(axisCount, sizeof(float));
|
||||
js->buttons = calloc(buttonCount + (size_t) hatCount * 4, 1);
|
||||
js->hats = calloc(hatCount, 1);
|
||||
|
@ -454,6 +453,7 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name,
|
|||
js->buttonCount = buttonCount;
|
||||
js->hatCount = hatCount;
|
||||
|
||||
strncpy(js->name, name, sizeof(js->name) - 1);
|
||||
strncpy(js->guid, guid, sizeof(js->guid) - 1);
|
||||
js->mapping = findValidMapping(js);
|
||||
|
||||
|
@ -464,7 +464,6 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name,
|
|||
//
|
||||
void _glfwFreeJoystick(_GLFWjoystick* js)
|
||||
{
|
||||
free(js->name);
|
||||
free(js->axes);
|
||||
free(js->buttons);
|
||||
free(js->hats);
|
||||
|
|
|
@ -435,7 +435,7 @@ struct _GLFWwindow
|
|||
//
|
||||
struct _GLFWmonitor
|
||||
{
|
||||
char* name;
|
||||
char name[128];
|
||||
void* userPointer;
|
||||
|
||||
// Physical dimensions in millimeters.
|
||||
|
@ -496,7 +496,7 @@ struct _GLFWjoystick
|
|||
int buttonCount;
|
||||
unsigned char* hats;
|
||||
int hatCount;
|
||||
char* name;
|
||||
char name[128];
|
||||
void* userPointer;
|
||||
char guid[33];
|
||||
_GLFWmapping* mapping;
|
||||
|
|
|
@ -170,8 +170,7 @@ _GLFWmonitor* _glfwAllocMonitor(const char* name, int widthMM, int heightMM)
|
|||
monitor->widthMM = widthMM;
|
||||
monitor->heightMM = heightMM;
|
||||
|
||||
if (name)
|
||||
monitor->name = _glfw_strdup(name);
|
||||
strncpy(monitor->name, name, sizeof(monitor->name) - 1);
|
||||
|
||||
return monitor;
|
||||
}
|
||||
|
@ -189,7 +188,6 @@ void _glfwFreeMonitor(_GLFWmonitor* monitor)
|
|||
_glfwFreeGammaArrays(&monitor->currentRamp);
|
||||
|
||||
free(monitor->modes);
|
||||
free(monitor->name);
|
||||
free(monitor);
|
||||
}
|
||||
|
||||
|
|
|
@ -47,15 +47,13 @@ static void outputHandleGeometry(void* data,
|
|||
int32_t transform)
|
||||
{
|
||||
struct _GLFWmonitor *monitor = data;
|
||||
char name[1024];
|
||||
|
||||
monitor->wl.x = x;
|
||||
monitor->wl.y = y;
|
||||
monitor->widthMM = physicalWidth;
|
||||
monitor->heightMM = physicalHeight;
|
||||
|
||||
snprintf(name, sizeof(name), "%s %s", make, model);
|
||||
monitor->name = _glfw_strdup(name);
|
||||
snprintf(monitor->name, sizeof(monitor->name), "%s %s", make, model);
|
||||
}
|
||||
|
||||
static void outputHandleMode(void* data,
|
||||
|
@ -133,7 +131,7 @@ void _glfwAddOutputWayland(uint32_t name, uint32_t version)
|
|||
}
|
||||
|
||||
// The actual name of this output will be set in the geometry handler.
|
||||
monitor = _glfwAllocMonitor(NULL, 0, 0);
|
||||
monitor = _glfwAllocMonitor("", 0, 0);
|
||||
|
||||
output = wl_registry_bind(_glfw.wl.registry,
|
||||
name,
|
||||
|
|
Loading…
Reference in New Issue
Block a user