# \[glfw-dev\] problem with GLFW\_REFRESH\_RATE

**URL:** <https://discourse.glfw.org/t/glfw-dev-problem-with-glfw-refresh-rate/387>\
**Category:** support\
**Created:** [July 30, 2006, 10:17am UTC](https://discourse.glfw.org/t/glfw-dev-problem-with-glfw-refresh-rate/387 "2006-07-30T10:17:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [July 30, 2006, 10:17am UTC](https://discourse.glfw.org/t/glfw-dev-problem-with-glfw-refresh-rate/387/1 "2006-07-30T10:17:26Z")

</div>

**nobody** wrote on [Sunday, July 30, 2006](https://sourceforge.net/p/glfw/discussion/247562/thread/82b7780c/#5556):

Hello,

I try to use glfwOpenWindowHint(GLFW\_REFRESH\_RATE, X); without success (under Windows). On the “win32\_fullscreen.c” I found the code it change the display mode and probably the refresh rate. I can’t understand how it work. When \_glfwWin.DesiredRefreshRate is \> 0 the flag DISPLAYFREQUENCY is added. But the dm.dmDisplayFrequency is not set before the ChangeDisplaySettings, it’s a error ?  
(I think we must add “dm.dmDisplayFrequency=\_glfwWin.DesiredRefreshRate” before the ChangeDisplaySettings)

Thanks if you can help me,

Jérôme Cayet

//========================================================================  
// \_glfwSetVideoModeMODE() - Change the current video mode  
//========================================================================

void \_glfwSetVideoModeMODE( int mode )  
{  
DEVMODE dm;  
int success;

```
// Get the parameters for the best matching display mode
dm.dmSize = sizeof\( DEVMODE \);
\(void\) EnumDisplaySettings\( NULL, mode, &amp;dm \);

// Set which fields we want to specify
dm.dmFields = DM\_PELSWIDTH | DM\_PELSHEIGHT | DM\_BITSPERPEL;

// Do we have a prefered refresh rate?
if\( \_glfwWin.DesiredRefreshRate &gt; 0 \)
\{
    dm.dmFields = dm.dmFields | DM\_DISPLAYFREQUENCY;
\}

// Change display setting
dm.dmSize = sizeof\( DEVMODE \);
success = ChangeDisplaySettings\( &amp;dm, CDS\_FULLSCREEN \);

// If the mode change was not possible, query the current display
// settings \(we'll use the desktop resolution for fullscreen mode\)
if\( success == DISP\_CHANGE\_SUCCESSFUL \)
\{
    \_glfwWin.ModeID = mode;
\}
else
\{
    \_glfwWin.ModeID = ENUM\_REGISTRY\_SETTINGS;
    EnumDisplaySettings\( NULL, ENUM\_REGISTRY\_SETTINGS, &amp;dm \);
\}

// Set the window size to that of the display mode
\_glfwWin.Width = dm.dmPelsWidth;
\_glfwWin.Height = dm.dmPelsHeight;

```

}

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [August 16, 2006, 12:52am UTC](https://discourse.glfw.org/t/glfw-dev-problem-with-glfw-refresh-rate/387/2 "2006-08-16T00:52:08Z")

</div>

**[elmindreda](https://sourceforge.net/u/elmindreda/)** wrote on [Wednesday, August 16, 2006](https://sourceforge.net/p/glfw/discussion/247562/thread/82b7780c/#5556/8892):

You are quite right. That’s a bug. A fix has been committed to CVS, and should be included in the next release.

I can’t see that it’s ever been correct in the CVS history. Odd that no one noticed before.
