1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-26 12:18:51 -05:00

Use monitor callback event more strictly

This commit is contained in:
Camilla Berglund 2015-12-13 19:11:21 +01:00
parent 810bab7391
commit addb977ef1
2 changed files with 10 additions and 4 deletions

View File

@ -67,16 +67,22 @@ glfwSetMonitorCallback(monitor_callback);
@endcode @endcode
The callback function receives the handle for the monitor that has been The callback function receives the handle for the monitor that has been
connected or disconnected and a monitor action. connected or disconnected and the event that occurred.
@code @code
void monitor_callback(GLFWmonitor* monitor, int event) void monitor_callback(GLFWmonitor* monitor, int event)
{ {
if (event == GLFW_CONNECTED)
{
// The monitor was connected
}
else if (event == GLFW_DISCONNECTED)
{
// The monitor was disconnected
}
} }
@endcode @endcode
The action is one of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`.
@section monitor_properties Monitor properties @section monitor_properties Monitor properties

View File

@ -442,7 +442,7 @@ static void monitor_callback(GLFWmonitor* monitor, int event)
x, y, x, y,
widthMM, heightMM); widthMM, heightMM);
} }
else else if (event == GLFW_DISCONNECTED)
{ {
printf("%08x at %0.3f: Monitor %s was disconnected\n", printf("%08x at %0.3f: Monitor %s was disconnected\n",
counter++, counter++,