mirror of
https://github.com/glfw/glfw.git
synced 2024-11-14 02:31:46 +00:00
Removed constant string length for monitor parameters.
This commit is contained in:
parent
f89feefa46
commit
3aa4976d6f
@ -548,7 +548,6 @@ GLFWAPI void glfwSetErrorCallback(GLFWerrorfun cbfun);
|
|||||||
#define GLFW_MONITOR_PARAM_I_PHYS_HEIGHT 2
|
#define GLFW_MONITOR_PARAM_I_PHYS_HEIGHT 2
|
||||||
#define GLFW_MONITOR_PARAM_I_SCREEN_X_POS 3
|
#define GLFW_MONITOR_PARAM_I_SCREEN_X_POS 3
|
||||||
#define GLFW_MONITOR_PARAM_I_SCREEN_Y_POS 4
|
#define GLFW_MONITOR_PARAM_I_SCREEN_Y_POS 4
|
||||||
#define GLFW_MONITOR_PARAM_S_NAME_LEN 30
|
|
||||||
|
|
||||||
/* Monitor types */
|
/* Monitor types */
|
||||||
typedef struct _GLFWmonitor* GLFWmonitor;
|
typedef struct _GLFWmonitor* GLFWmonitor;
|
||||||
|
@ -225,7 +225,7 @@ struct _GLFWmonitor
|
|||||||
|
|
||||||
void* userPointer;
|
void* userPointer;
|
||||||
|
|
||||||
char deviceName[GLFW_MONITOR_PARAM_S_NAME_LEN+1];
|
char* deviceName;
|
||||||
// physical dimensions in millimeters.
|
// physical dimensions in millimeters.
|
||||||
int physicalWidth;
|
int physicalWidth;
|
||||||
int physicalHeight;
|
int physicalHeight;
|
||||||
|
@ -52,8 +52,9 @@ _GLFWmonitor** _glfwCreateMonitor(_GLFWmonitor** current, DISPLAY_DEVICE* adapte
|
|||||||
|
|
||||||
DeleteDC(dc);
|
DeleteDC(dc);
|
||||||
|
|
||||||
memcpy((*current)->deviceName, monitor->DeviceName, GLFW_MONITOR_PARAM_S_NAME_LEN+1);
|
(*monitor)->deviceName = _glfwMalloc(strlen(monitor->DeviceName) + 1);
|
||||||
(*current)->deviceName[GLFW_MONITOR_PARAM_S_NAME_LEN] = '\0';
|
memcpy((*current)->deviceName, monitor->DeviceName, strlen(monitor->DeviceName) + 1);
|
||||||
|
(*current)->deviceName[strlen(monitor->DeviceName)] = '\0';
|
||||||
|
|
||||||
(*current)->screenXPosition = setting->dmPosition.x;
|
(*current)->screenXPosition = setting->dmPosition.x;
|
||||||
(*current)->screenYPosition = setting->dmPosition.y;
|
(*current)->screenYPosition = setting->dmPosition.y;
|
||||||
@ -68,6 +69,7 @@ _GLFWmonitor* _glfwDestroyMonitor(_GLFWmonitor* monitor)
|
|||||||
|
|
||||||
result = monitor->next;
|
result = monitor->next;
|
||||||
|
|
||||||
|
_glfwFree(monitor->deviceName);
|
||||||
_glfwFree(monitor);
|
_glfwFree(monitor);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -47,8 +47,9 @@ _GLFWmonitor** _glfwCreateMonitor(_GLFWmonitor** current, XRROutputInfo* outputI
|
|||||||
(*current)->physicalWidth = outputInfo->mm_width;
|
(*current)->physicalWidth = outputInfo->mm_width;
|
||||||
(*current)->physicalHeight = outputInfo->mm_height;
|
(*current)->physicalHeight = outputInfo->mm_height;
|
||||||
|
|
||||||
memcpy((*current)->deviceName, outputInfo->name, GLFW_MONITOR_PARAM_S_NAME_LEN+1);
|
(*monitor)->deviceName = _glfwMalloc(strlen(outputInfo->name) + 1);
|
||||||
(*current)->deviceName[GLFW_MONITOR_PARAM_S_NAME_LEN] = '\0';
|
memcpy((*current)->deviceName, outputInfo->name, strlen(outputInfo->name) + 1);
|
||||||
|
(*current)->deviceName[strlen(outputInfo->name)] = '\0';
|
||||||
|
|
||||||
(*current)->screenXPosition = crtcInfo->x;
|
(*current)->screenXPosition = crtcInfo->x;
|
||||||
(*current)->screenYPosition = crtcInfo->y;
|
(*current)->screenYPosition = crtcInfo->y;
|
||||||
@ -68,6 +69,7 @@ _GLFWmonitor* _glfwDestroyMonitor(_GLFWmonitor* monitor)
|
|||||||
XRRFreeOutputInfo(monitor->X11.output);
|
XRRFreeOutputInfo(monitor->X11.output);
|
||||||
#endif /*_GLFW_HAS_XRANDR*/
|
#endif /*_GLFW_HAS_XRANDR*/
|
||||||
|
|
||||||
|
_glfwFree(monitor->deviceName);
|
||||||
_glfwFree(monitor);
|
_glfwFree(monitor);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
Loading…
Reference in New Issue
Block a user