Made glfwGetVideoMode consistent with getters.

master
Camilla Berglund ago%!(EXTRA string=12 years)
parent 5d308db654
commit ce1e84def6
  1. 5
      include/GL/glfw3.h
  2. 1
      src/internal.h
  3. 9
      src/monitor.c
  4. 4
      tests/events.c
  5. 6
      tests/gamma.c
  6. 6
      tests/iconify.c
  7. 6
      tests/modes.c

@ -1060,14 +1060,13 @@ GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count);
* on whether it is focused.
*
* @param[in] monitor The monitor to query.
* @return The current mode of the monitor, or a struct cleared to all zeroes
* if an error occurred.
* @return The current mode of the monitor, or `NULL` if an error occurred.
*
* @sa glfwGetVideoModes
*
* @ingroup monitor
*/
GLFWAPI GLFWvidmode glfwGetVideoMode(GLFWmonitor* monitor);
GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor);
/*! @brief Generates a gamma ramp and sets it for the specified monitor.
*

@ -248,6 +248,7 @@ struct _GLFWmonitor
GLFWvidmode* modes;
int modeCount;
GLFWvidmode currentMode;
GLFWgammaramp originalRamp;
GLFWgammaramp currentRamp;

@ -322,14 +322,13 @@ GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* handle, int* count)
return monitor->modes;
}
GLFWAPI GLFWvidmode glfwGetVideoMode(GLFWmonitor* handle)
GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* handle)
{
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
GLFWvidmode mode = { 0, 0, 0, 0, 0 };
_GLFW_REQUIRE_INIT_OR_RETURN(mode);
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
_glfwPlatformGetVideoMode(monitor, &mode);
return mode;
_glfwPlatformGetVideoMode(monitor, &monitor->currentMode);
return &monitor->currentMode;
}

@ -371,7 +371,7 @@ void monitor_callback(GLFWmonitor* monitor, int event)
if (event == GLFW_CONNECTED)
{
int x, y, widthMM, heightMM;
GLFWvidmode mode = glfwGetVideoMode(monitor);
const GLFWvidmode* mode = glfwGetVideoMode(monitor);
glfwGetMonitorPos(monitor, &x, &y);
glfwGetMonitorPhysicalSize(monitor, &widthMM, &heightMM);
@ -380,7 +380,7 @@ void monitor_callback(GLFWmonitor* monitor, int event)
counter++,
glfwGetTime(),
glfwGetMonitorName(monitor),
mode.width, mode.height,
mode->width, mode->height,
x, y,
widthMM, heightMM);
}

@ -127,9 +127,9 @@ int main(int argc, char** argv)
if (monitor)
{
GLFWvidmode mode = glfwGetVideoMode(monitor);
width = mode.width;
height = mode.height;
const GLFWvidmode* mode = glfwGetVideoMode(monitor);
width = mode->width;
height = mode->height;
}
else
{

@ -117,9 +117,9 @@ int main(int argc, char** argv)
if (monitor)
{
GLFWvidmode mode = glfwGetVideoMode(monitor);
width = mode.width;
height = mode.height;
const GLFWvidmode* mode = glfwGetVideoMode(monitor);
width = mode->width;
height = mode->height;
}
else
{

@ -82,7 +82,7 @@ static void key_callback(GLFWwindow* window, int key, int action, int mods)
static void list_modes(GLFWmonitor* monitor)
{
int count, x, y, widthMM, heightMM, dpi, i;
GLFWvidmode mode = glfwGetVideoMode(monitor);
const GLFWvidmode* mode = glfwGetVideoMode(monitor);
const GLFWvidmode* modes = glfwGetVideoModes(monitor, &count);
glfwGetMonitorPos(monitor, &x, &y);
@ -91,10 +91,10 @@ static void list_modes(GLFWmonitor* monitor)
printf("Name: %s (%s)\n",
glfwGetMonitorName(monitor),
glfwGetPrimaryMonitor() == monitor ? "primary" : "secondary");
printf("Current mode: %s\n", format_mode(&mode));
printf("Current mode: %s\n", format_mode(mode));
printf("Virtual position: %i %i\n", x, y);
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("Modes:\n");

Loading…
Cancel
Save