2
0
Эх сурвалжийг харах

Added saving of monitor mode count.

Camilla Berglund 12 жил өмнө
parent
commit
b66e1de97c
2 өөрчлөгдсөн 9 нэмэгдсэн , 2 устгасан
  1. 1 0
      src/internal.h
  2. 8 2
      src/monitor.c

+ 1 - 0
src/internal.h

@@ -241,6 +241,7 @@ struct _GLFWmonitor
     int       positionY;
 
     GLFWvidmode*  modes;
+    int           modeCount;
 
     // These are defined in the current port's platform.h
     _GLFW_PLATFORM_MONITOR_STATE;

+ 8 - 2
src/monitor.c

@@ -399,10 +399,16 @@ GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor handle, int* count)
 
     free(monitor->modes);
 
-    monitor->modes = _glfwPlatformGetVideoModes(monitor, count);
+    monitor->modes = _glfwPlatformGetVideoModes(monitor, &monitor->modeCount);
     if (monitor->modes)
-        qsort(monitor->modes, *count, sizeof(GLFWvidmode), compareVideoModes);
+    {
+        qsort(monitor->modes,
+              monitor->modeCount,
+              sizeof(GLFWvidmode),
+              compareVideoModes);
+    }
 
+    *count = monitor->modeCount;
     return monitor->modes;
 }