41 int firstBPP, secondBPP, firstSize, secondSize;
48 if (firstBPP != secondBPP)
49 return firstBPP - secondBPP;
54 if (firstSize != secondSize)
55 return firstSize - secondSize;
78 monitor->
modes = modes;
100 for (j = 0; j < monitorCount; j++)
113 for (i = 0; i < monitorCount; i++)
128 if (window->
monitor == monitors[i])
142 for (j = 0; j < monitorCount; j++)
151 if (j < monitorCount)
169 monitor->
name = strdup(name);
184 free(monitor->
modes);
191 ramp->
red = calloc(size,
sizeof(
unsigned short));
192 ramp->
green = calloc(size,
sizeof(
unsigned short));
193 ramp->
blue = calloc(size,
sizeof(
unsigned short));
210 for (i = 0; i <
count; i++)
220 unsigned int sizeDiff, leastSizeDiff = UINT_MAX;
221 unsigned int rateDiff, leastRateDiff = UINT_MAX;
222 unsigned int colorDiff, leastColorDiff = UINT_MAX;
231 current = monitor->
modes + i;
242 sizeDiff = abs((current->
width - desired->
width) *
252 if ((colorDiff < leastColorDiff) ||
253 (colorDiff == leastColorDiff && sizeDiff < leastSizeDiff) ||
254 (colorDiff == leastColorDiff && sizeDiff == leastSizeDiff && rateDiff < leastRateDiff))
257 leastSizeDiff = sizeDiff;
258 leastRateDiff = rateDiff;
259 leastColorDiff = colorDiff;
281 *red = *green = *blue = bpp / 3;
282 delta = bpp - (*red * 3);
350 return monitor->
name;
372 return monitor->
modes;
388 unsigned short values[256];
393 if (gamma != gamma || gamma <= 0.f || gamma > FLT_MAX)
399 for (i = 0; i < 256; i++)
406 value = pow(value, 1.0 / gamma) * 65535.0 + 0.5;
412 values[i] = (
unsigned short) value;
static int refreshVideoModes(_GLFWmonitor *monitor)
void _glfwFreeGammaArrays(GLFWgammaramp *ramp)
static int compareVideoModes(const void *firstPtr, const void *secondPtr)
GLFWgammaramp currentRamp
void _glfwFreeMonitor(_GLFWmonitor *monitor)
Frees a monitor object and any data associated with it.
GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun)
Sets the monitor configuration callback.
GLFWAPI void glfwSetGamma(GLFWmonitor *handle, float gamma)
Generates a gamma ramp and sets it for the specified monitor.
void(* GLFWmonitorfun)(GLFWmonitor *, int)
The function signature for monitor configuration callbacks.
#define _GLFW_REQUIRE_INIT()
struct _GLFWlibrary::@3 callbacks
GLFWAPI const GLFWvidmode * glfwGetVideoMode(GLFWmonitor *handle)
Returns the current mode of the specified monitor.
_GLFWwindow * windowListHead
_GLFWlibrary _glfw
All global data protected by _glfwInitialized. This should only be touched after a call to glfwInit t...
struct GLFWmonitor GLFWmonitor
Opaque monitor object.
#define GLFW_DISCONNECTED
#define _GLFW_SWAP_POINTERS(x, y)
#define _GLFW_REQUIRE_INIT_OR_RETURN(x)
GLFWAPI GLFWmonitor ** glfwGetMonitors(int *count)
Returns the currently connected monitors.
GLFWAPI const char * glfwGetMonitorName(GLFWmonitor *handle)
Returns the name of the specified monitor.
GLuint GLuint GLsizei count
struct _GLFWwindow * next
void _glfwFreeMonitors(_GLFWmonitor **monitors, int count)
GLFWAPI const GLFWgammaramp * glfwGetGammaRamp(GLFWmonitor *handle)
Returns the current gamma ramp for the specified monitor.
void _glfwSplitBPP(int bpp, int *red, int *green, int *blue)
Splits a color depth into red, green and blue bit depths.
_GLFWmonitor * _glfwAllocMonitor(const char *name, int widthMM, int heightMM)
Allocates and returns a monitor object with the specified name and dimensions.
GLsizei const GLfloat * value
void _glfwAllocGammaArrays(GLFWgammaramp *ramp, unsigned int size)
GLFWgammaramp originalRamp
GLFWAPI void glfwGetMonitorPos(GLFWmonitor *handle, int *xpos, int *ypos)
Returns the position of the monitor's viewport on the virtual screen.
#define GLFW_INVALID_VALUE
One of the arguments to the function was an invalid value.
GLenum GLsizei GLsizei GLint * values
void _glfwInputMonitorChange(void)
GLuint const GLchar * name
GLFWAPI const GLFWvidmode * glfwGetVideoModes(GLFWmonitor *handle, int *count)
Returns the available video modes for the specified monitor.
GLFWAPI GLFWmonitor * glfwGetPrimaryMonitor(void)
Returns the primary monitor.
int _glfwCompareVideoModes(const GLFWvidmode *first, const GLFWvidmode *second)
Performs lexical comparison between two GLFWvidmode structures.
GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor *handle, int *widthMM, int *heightMM)
Returns the physical size of the monitor.
void _glfwInputError(int error, const char *format,...)
Notifies shared code of an error.
const GLFWvidmode * _glfwChooseVideoMode(_GLFWmonitor *monitor, const GLFWvidmode *desired)
Window and context structure.
GLFWAPI void glfwSetGammaRamp(GLFWmonitor *handle, const GLFWgammaramp *ramp)
Sets the current gamma ramp for the specified monitor.