Shortened monitor-related tokens.

This commit is contained in:
Camilla Berglund 2012-12-13 01:56:33 +01:00
parent 55f7813d68
commit 052c587dd5
4 changed files with 15 additions and 16 deletions

View File

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

View File

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

View File

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

View File

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