瀏覽代碼

Shortened monitor-related tokens.

Camilla Berglund 12 年之前
父節點
當前提交
052c587dd5
共有 4 個文件被更改,包括 15 次插入16 次删除
  1. 6 6
      include/GL/glfw3.h
  2. 4 5
      src/monitor.c
  3. 3 3
      tests/events.c
  4. 2 2
      tests/modes.c

+ 6 - 6
include/GL/glfw3.h

@@ -689,21 +689,21 @@ extern "C" {
 /*! @brief The physical width, in mm, of the monitor.
  *  @ingroup monitor
  */
-#define GLFW_MONITOR_PHYSICAL_WIDTH  0x00060001
+#define GLFW_MONITOR_WIDTH_MM         0x00060001
 /*! @brief The physical height, in mm, of the monitor.
  *  @ingroup monitor
  */
-#define GLFW_MONITOR_PHYSICAL_HEIGHT 0x00060002
+#define GLFW_MONITOR_HEIGHT_MM        0x00060002
 /*! @brief The x-coordinate of the upper-left corner of the monitor on the
  *  virtual desktop.
  *  @ingroup monitor
  */
-#define GLFW_MONITOR_POS_X           0x00060003
+#define GLFW_MONITOR_POS_X            0x00060003
 /*! @brief The y-coordinate of the upper-left corner of the monitor on the
  *  virtual desktop.
  *  @ingroup monitor
  */
-#define GLFW_MONITOR_POS_Y           0x00060004
+#define GLFW_MONITOR_POS_Y            0x00060004
 /* @} */
 
 /*! @name Monitor events
@@ -711,11 +711,11 @@ extern "C" {
 /*! @brief The monitor was connected.
  *  @ingroup monitor
  */
-#define GLFW_MONITOR_CONNECTED       0x00061000
+#define GLFW_CONNECTED                0x00061000
 /*! @brief The monitor was disconnected.
  *  @ingroup monitor
  */
-#define GLFW_MONITOR_DISCONNECTED    0x00061001
+#define GLFW_DISCONNECTED             0x00061001
 /* @} */
 
 /*************************************************************************

+ 4 - 5
src/monitor.c

@@ -150,7 +150,7 @@ void _glfwInputMonitorChange(void)
         if (j == _glfwLibrary.monitorCount)
         {
             // This monitor was not connected before
-            _glfwLibrary.monitorCallback(monitors[i], GLFW_MONITOR_CONNECTED);
+            _glfwLibrary.monitorCallback(monitors[i], GLFW_CONNECTED);
         }
     }
 
@@ -162,8 +162,7 @@ void _glfwInputMonitorChange(void)
             continue;
 
         // This monitor is no longer connected
-        _glfwLibrary.monitorCallback(_glfwLibrary.monitors[i],
-                                     GLFW_MONITOR_DISCONNECTED);
+        _glfwLibrary.monitorCallback(_glfwLibrary.monitors[i], GLFW_DISCONNECTED);
 
         for (window = _glfwLibrary.windowListHead;  window;  window = window->next)
         {
@@ -314,9 +313,9 @@ GLFWAPI int glfwGetMonitorParam(GLFWmonitor handle, int param)
 
     switch (param)
     {
-        case GLFW_MONITOR_PHYSICAL_WIDTH:
+        case GLFW_MONITOR_WIDTH_MM:
             return monitor->physicalWidth;
-        case GLFW_MONITOR_PHYSICAL_HEIGHT:
+        case GLFW_MONITOR_HEIGHT_MM:
             return monitor->physicalHeight;
         case GLFW_MONITOR_POS_X:
             return monitor->positionX;

+ 3 - 3
tests/events.c

@@ -339,7 +339,7 @@ static void char_callback(GLFWwindow window, int character)
 
 void monitor_callback(GLFWmonitor monitor, int event)
 {
-    if (event == GLFW_MONITOR_CONNECTED)
+    if (event == GLFW_CONNECTED)
     {
         GLFWvidmode mode;
         glfwGetVideoMode(monitor, &mode);
@@ -351,8 +351,8 @@ void monitor_callback(GLFWmonitor monitor, int event)
                mode.width, mode.height,
                glfwGetMonitorParam(monitor, GLFW_MONITOR_POS_X),
                glfwGetMonitorParam(monitor, GLFW_MONITOR_POS_Y),
-               glfwGetMonitorParam(monitor, GLFW_MONITOR_PHYSICAL_WIDTH),
-               glfwGetMonitorParam(monitor, GLFW_MONITOR_PHYSICAL_HEIGHT));
+               glfwGetMonitorParam(monitor, GLFW_MONITOR_WIDTH_MM),
+               glfwGetMonitorParam(monitor, GLFW_MONITOR_HEIGHT_MM));
     }
     else
     {

+ 2 - 2
tests/modes.c

@@ -104,8 +104,8 @@ static void list_modes(GLFWmonitor monitor)
            glfwGetMonitorParam(monitor, GLFW_MONITOR_POS_X),
            glfwGetMonitorParam(monitor, GLFW_MONITOR_POS_Y));
 
-    widthMM = glfwGetMonitorParam(monitor, GLFW_MONITOR_PHYSICAL_WIDTH);
-    heightMM = glfwGetMonitorParam(monitor, GLFW_MONITOR_PHYSICAL_HEIGHT);
+    widthMM = glfwGetMonitorParam(monitor, GLFW_MONITOR_WIDTH_MM);
+    heightMM = glfwGetMonitorParam(monitor, GLFW_MONITOR_HEIGHT_MM);
     dpi = (int) ((float) mode.width * 25.4f / (float) widthMM);
     printf("Physical size: %i x %i mm (%i dpi)\n", widthMM, heightMM, dpi);