mirror of
https://github.com/gwm17/glfw.git
synced 2024-11-26 12:18:51 -05:00
Ripped out horribly broken refresh rate mess.
This commit is contained in:
parent
23c6def880
commit
52dac79219
|
@ -500,44 +500,40 @@ extern "C" {
|
|||
* @see glfwWindowHint
|
||||
*/
|
||||
#define GLFW_STENCIL_BITS 0x00021005
|
||||
/*! @brief The monitor refresh rate.
|
||||
* @see glfwWindowHint glfwGetWindowParam
|
||||
*/
|
||||
#define GLFW_REFRESH_RATE 0x00021006
|
||||
/*! @brief The bit depth of the red component of the accumulation buffer.
|
||||
* @see glfwWindowHint
|
||||
*/
|
||||
#define GLFW_ACCUM_RED_BITS 0x00021007
|
||||
#define GLFW_ACCUM_RED_BITS 0x00021006
|
||||
/*! @brief The bit depth of the red component of the accumulation buffer.
|
||||
* @see glfwWindowHint
|
||||
*/
|
||||
#define GLFW_ACCUM_GREEN_BITS 0x00021008
|
||||
#define GLFW_ACCUM_GREEN_BITS 0x00021007
|
||||
/*! @brief The bit depth of the red component of the accumulation buffer.
|
||||
* @see glfwWindowHint
|
||||
*/
|
||||
#define GLFW_ACCUM_BLUE_BITS 0x00021009
|
||||
#define GLFW_ACCUM_BLUE_BITS 0x00021008
|
||||
/*! @brief The bit depth of the red component of the accumulation buffer.
|
||||
* @see glfwWindowHint
|
||||
*/
|
||||
#define GLFW_ACCUM_ALPHA_BITS 0x0002100A
|
||||
#define GLFW_ACCUM_ALPHA_BITS 0x00021009
|
||||
/*! @brief The number of auxiliary buffers.
|
||||
* @see glfwWindowHint
|
||||
*/
|
||||
#define GLFW_AUX_BUFFERS 0x0002100B
|
||||
#define GLFW_AUX_BUFFERS 0x0002100A
|
||||
/*! @brief @c GL_TRUE for stereo rendering, or @c GL_FALSE otherwise.
|
||||
* @see glfwWindowHint
|
||||
*/
|
||||
#define GLFW_STEREO 0x0002100C
|
||||
#define GLFW_STEREO 0x0002100B
|
||||
/*! @brief The number of samples used for default framebuffer multisampling, or
|
||||
* zero to disable multisampling.
|
||||
* @see glfwWindowHint
|
||||
*/
|
||||
#define GLFW_FSAA_SAMPLES 0x0002100E
|
||||
#define GLFW_FSAA_SAMPLES 0x0002100C
|
||||
/*! @brief @c GL_TRUE if the framebuffer should be sRGB capable, or @c GL_FALSE
|
||||
* otherwise.
|
||||
* @see glfwWindowHint
|
||||
*/
|
||||
#define GLFW_SRGB_CAPABLE 0x0002100F
|
||||
#define GLFW_SRGB_CAPABLE 0x0002100D
|
||||
|
||||
/*! @brief The @link clients client API @endlink to create a context for.
|
||||
* @see glfwWindowHint glfwGetWindowParam
|
||||
|
@ -1146,11 +1142,6 @@ GLFWAPI void glfwDefaultWindowHints(void);
|
|||
* specify the desired bit depths of the various components of the default
|
||||
* framebuffer.
|
||||
*
|
||||
* The @ref GLFW_REFRESH_RATE hint specifies the desired monitor refresh rate,
|
||||
* in Hz, of the video mode for a fullscreen window, or zero to let the system
|
||||
* choose a suitable refresh rate. If a windowed mode window is created, this
|
||||
* hint is ignored.
|
||||
*
|
||||
* The @ref GLFW_ACCUM_RED_BITS, @ref GLFW_ACCUM_GREEN_BITS, @ref
|
||||
* GLFW_ACCUM_BLUE_BITS and @ref GLFW_ACCUM_ALPHA_BITS hints specify the
|
||||
* desired bit depths of the various components of the accumulation buffer.
|
||||
|
@ -1400,9 +1391,6 @@ GLFWAPI GLFWmonitor glfwGetWindowMonitor(GLFWwindow window);
|
|||
* The @ref GLFW_CLOSE_REQUESTED property indicates whether the window has been
|
||||
* requested by the user to close.
|
||||
*
|
||||
* The @ref GLFW_REFRESH_RATE property will be replaced when the @c
|
||||
* multi-monitor branch is merged.
|
||||
*
|
||||
* The @ref GLFW_POSITION_X and @ref GLFW_POSITION_Y properties indicate the
|
||||
* screen position, in pixels, of the upper-left corner of the window's client
|
||||
* area.
|
||||
|
|
|
@ -139,13 +139,12 @@ static GLFWvidmode vidmodeFromCGDisplayMode(CGDisplayModeRef mode)
|
|||
// Change the current video mode
|
||||
//========================================================================
|
||||
|
||||
GLboolean _glfwSetVideoMode(int* width, int* height, int* bpp, int* refreshRate)
|
||||
GLboolean _glfwSetVideoMode(int* width, int* height, int* bpp)
|
||||
{
|
||||
CGDisplayModeRef bestMode = NULL;
|
||||
CFArrayRef modes;
|
||||
CFIndex count, i;
|
||||
unsigned int leastSizeDiff = UINT_MAX;
|
||||
double leastRateDiff = DBL_MAX;
|
||||
|
||||
modes = CGDisplayCopyAllDisplayModes(CGMainDisplayID(), NULL);
|
||||
count = CFArrayGetCount(modes);
|
||||
|
@ -177,23 +176,11 @@ GLboolean _glfwSetVideoMode(int* width, int* height, int* bpp, int* refreshRate)
|
|||
((modeWidth - *width) * (modeWidth - *width) +
|
||||
(modeHeight - *height) * (modeHeight - *height));
|
||||
|
||||
double rateDiff;
|
||||
|
||||
if (*refreshRate > 0)
|
||||
rateDiff = fabs(CGDisplayModeGetRefreshRate(mode) - *refreshRate);
|
||||
else
|
||||
{
|
||||
// If no refresh rate was specified, then they're all the same
|
||||
rateDiff = 0;
|
||||
}
|
||||
|
||||
if ((sizeDiff < leastSizeDiff) ||
|
||||
(sizeDiff == leastSizeDiff && (rateDiff < leastRateDiff)))
|
||||
if (sizeDiff < leastSizeDiff)
|
||||
{
|
||||
bestMode = mode;
|
||||
|
||||
leastSizeDiff = sizeDiff;
|
||||
leastRateDiff = rateDiff;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ void _glfwInitJoysticks(void);
|
|||
void _glfwTerminateJoysticks(void);
|
||||
|
||||
// Fullscreen
|
||||
GLboolean _glfwSetVideoMode(int* width, int* height, int* bpp, int* refreshRate);
|
||||
GLboolean _glfwSetVideoMode(int* width, int* height, int* bpp);
|
||||
void _glfwRestoreVideoMode(void);
|
||||
|
||||
// OpenGL support
|
||||
|
|
|
@ -772,13 +772,8 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||
{
|
||||
int bpp = colorBits + fbconfig->alphaBits;
|
||||
|
||||
if (!_glfwSetVideoMode(&window->width,
|
||||
&window->height,
|
||||
&bpp,
|
||||
&window->refreshRate))
|
||||
{
|
||||
if (!_glfwSetVideoMode(&window->width, &window->height, &bpp))
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
_glfwPlatformShowWindow(window);
|
||||
[[window->NS.object contentView] enterFullScreenMode:[NSScreen mainScreen]
|
||||
|
@ -885,14 +880,6 @@ void _glfwPlatformHideWindow(_GLFWwindow* window)
|
|||
_glfwInputWindowVisibility(window, GL_FALSE);
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
// Write back window parameters into GLFW window structure
|
||||
//========================================================================
|
||||
|
||||
void _glfwPlatformRefreshWindowParams(_GLFWwindow* window)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//========================================================================
|
||||
// Poll for new window and input events
|
||||
|
|
|
@ -91,7 +91,6 @@ struct _GLFWhints
|
|||
int alphaBits;
|
||||
int depthBits;
|
||||
int stencilBits;
|
||||
int refreshRate;
|
||||
int accumRedBits;
|
||||
int accumGreenBits;
|
||||
int accumBlueBits;
|
||||
|
@ -123,7 +122,6 @@ struct _GLFWhints
|
|||
struct _GLFWwndconfig
|
||||
{
|
||||
const char* title;
|
||||
int refreshRate;
|
||||
GLboolean resizable;
|
||||
GLboolean visible;
|
||||
int positionX;
|
||||
|
@ -182,7 +180,6 @@ struct _GLFWwindow
|
|||
int mode; // GLFW_WINDOWED or GLFW_FULLSCREEN
|
||||
GLboolean resizable; // GL_TRUE if user may resize this window
|
||||
GLboolean visible; // GL_TRUE if this window is visible
|
||||
int refreshRate; // monitor refresh rate
|
||||
void* userPointer;
|
||||
_GLFWmonitor* monitor;
|
||||
|
||||
|
@ -341,7 +338,6 @@ void _glfwPlatformMakeContextCurrent(_GLFWwindow* window);
|
|||
_GLFWwindow* _glfwPlatformGetCurrentContext(void);
|
||||
void _glfwPlatformSwapBuffers(_GLFWwindow* window);
|
||||
void _glfwPlatformSwapInterval(int interval);
|
||||
void _glfwPlatformRefreshWindowParams(_GLFWwindow* window);
|
||||
int _glfwPlatformExtensionSupported(const char* extension);
|
||||
GLFWglproc _glfwPlatformGetProcAddress(const char* procname);
|
||||
|
||||
|
|
|
@ -45,19 +45,18 @@
|
|||
|
||||
|
||||
//========================================================================
|
||||
// Return closest video mode by dimensions, refresh rate and bits per pixel
|
||||
// Return closest video mode by dimensions and bits per pixel
|
||||
//========================================================================
|
||||
|
||||
static GLboolean getClosestVideoMode(int* width, int* height,
|
||||
int* bpp, int* refreshRate,
|
||||
GLboolean exactBPP)
|
||||
int* bpp, GLboolean exactBPP)
|
||||
{
|
||||
int mode, bestWidth = 0, bestHeight = 0, bestBPP = 0, bestRate = 0;
|
||||
unsigned int sizeDiff, rateDiff, leastSizeDiff, leastRateDiff;
|
||||
int mode, bestWidth = 0, bestHeight = 0, bestBPP = 0;
|
||||
unsigned int sizeDiff, leastSizeDiff;
|
||||
GLboolean foundMode = GL_FALSE;
|
||||
DEVMODE dm;
|
||||
|
||||
leastSizeDiff = leastRateDiff = UINT_MAX;
|
||||
leastSizeDiff = UINT_MAX;
|
||||
|
||||
for (mode = 0; ; mode++)
|
||||
{
|
||||
|
@ -74,29 +73,15 @@ static GLboolean getClosestVideoMode(int* width, int* height,
|
|||
(dm.dmPelsHeight - *height) *
|
||||
(dm.dmPelsHeight - *height));
|
||||
|
||||
if (*refreshRate > 0)
|
||||
{
|
||||
rateDiff = (dm.dmDisplayFrequency - *refreshRate) *
|
||||
(dm.dmDisplayFrequency - *refreshRate);
|
||||
}
|
||||
else
|
||||
{
|
||||
// If no refresh rate was specified, then they're all the same
|
||||
rateDiff = 0;
|
||||
}
|
||||
// We match BPP first, then screen area
|
||||
|
||||
// We match first BPP, then screen area and last refresh rate
|
||||
|
||||
if ((sizeDiff < leastSizeDiff) ||
|
||||
(sizeDiff == leastSizeDiff && (rateDiff < leastRateDiff)))
|
||||
if ((sizeDiff < leastSizeDiff) || (sizeDiff == leastSizeDiff))
|
||||
{
|
||||
bestWidth = dm.dmPelsWidth;
|
||||
bestHeight = dm.dmPelsHeight;
|
||||
bestBPP = dm.dmBitsPerPel;
|
||||
bestRate = dm.dmDisplayFrequency;
|
||||
|
||||
leastSizeDiff = sizeDiff;
|
||||
leastRateDiff = rateDiff;
|
||||
|
||||
foundMode = GL_TRUE;
|
||||
}
|
||||
|
@ -109,11 +94,6 @@ static GLboolean getClosestVideoMode(int* width, int* height,
|
|||
*height = bestHeight;
|
||||
*bpp = bestBPP;
|
||||
|
||||
// Only save the found refresh rate if the client requested a specific
|
||||
// rate; otherwise keep it at zero to let Windows select the best rate
|
||||
if (*refreshRate > 0)
|
||||
*refreshRate = bestRate;
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
@ -127,19 +107,17 @@ static GLboolean getClosestVideoMode(int* width, int* height,
|
|||
//========================================================================
|
||||
|
||||
void _glfwSetVideoMode(int* width, int* height,
|
||||
int* bpp, int* refreshRate,
|
||||
GLboolean exactBPP)
|
||||
int* bpp, GLboolean exactBPP)
|
||||
{
|
||||
DEVMODE dm;
|
||||
int closestWidth, closestHeight, closestBPP, closestRate;
|
||||
int closestWidth, closestHeight, closestBPP;
|
||||
|
||||
closestWidth = *width;
|
||||
closestHeight = *height;
|
||||
closestBPP = *bpp;
|
||||
closestRate = *refreshRate;
|
||||
|
||||
if (getClosestVideoMode(&closestWidth, &closestHeight,
|
||||
&closestBPP, &closestRate, exactBPP))
|
||||
&closestBPP, exactBPP))
|
||||
{
|
||||
dm.dmSize = sizeof(DEVMODE);
|
||||
dm.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL;
|
||||
|
@ -147,18 +125,11 @@ void _glfwSetVideoMode(int* width, int* height,
|
|||
dm.dmPelsHeight = closestHeight;
|
||||
dm.dmBitsPerPel = closestBPP;
|
||||
|
||||
if (*refreshRate > 0)
|
||||
{
|
||||
dm.dmFields |= DM_DISPLAYFREQUENCY;
|
||||
dm.dmDisplayFrequency = closestRate;
|
||||
}
|
||||
|
||||
if (ChangeDisplaySettings(&dm, CDS_FULLSCREEN) == DISP_CHANGE_SUCCESSFUL)
|
||||
{
|
||||
*width = closestWidth;
|
||||
*height = closestHeight;
|
||||
*bpp = closestBPP;
|
||||
*refreshRate = closestRate;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -169,7 +140,6 @@ void _glfwSetVideoMode(int* width, int* height,
|
|||
*width = dm.dmPelsWidth;
|
||||
*height = dm.dmPelsHeight;
|
||||
*bpp = dm.dmBitsPerPel;
|
||||
*refreshRate = dm.dmDisplayFrequency;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -146,7 +146,6 @@ typedef struct _GLFWwindowWin32
|
|||
DWORD dwExStyle; // --"--
|
||||
|
||||
// Various platform specific internal variables
|
||||
int desiredRefreshRate; // Desired vertical monitor refresh rate
|
||||
GLboolean cursorCentered;
|
||||
GLboolean cursorInside;
|
||||
int oldCursorX, oldCursorY;
|
||||
|
@ -169,7 +168,6 @@ typedef struct _GLFWlibraryWin32
|
|||
int width;
|
||||
int height;
|
||||
int bitsPerPixel;
|
||||
int refreshRate;
|
||||
} monitor;
|
||||
|
||||
// Timer data
|
||||
|
@ -227,9 +225,7 @@ int _glfwAnalyzeContext(const _GLFWwindow* window,
|
|||
const _GLFWfbconfig* fbconfig);
|
||||
|
||||
// Fullscreen support
|
||||
void _glfwSetVideoMode(int* width, int* height,
|
||||
int* bpp, int* refreshRate,
|
||||
GLboolean exactBPP);
|
||||
void _glfwSetVideoMode(int* width, int* height, int* bpp, GLboolean exactBPP);
|
||||
void _glfwRestoreVideoMode(void);
|
||||
|
||||
|
||||
|
|
|
@ -377,7 +377,6 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||
_glfwSetVideoMode(&_glfwLibrary.Win32.monitor.width,
|
||||
&_glfwLibrary.Win32.monitor.height,
|
||||
&_glfwLibrary.Win32.monitor.bitsPerPixel,
|
||||
&_glfwLibrary.Win32.monitor.refreshRate,
|
||||
GL_TRUE);
|
||||
|
||||
_glfwLibrary.Win32.monitor.modeChanged = GL_TRUE;
|
||||
|
@ -868,8 +867,6 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||
{
|
||||
int status;
|
||||
|
||||
window->Win32.desiredRefreshRate = wndconfig->refreshRate;
|
||||
|
||||
if (!_glfwLibrary.Win32.classAtom)
|
||||
{
|
||||
_glfwLibrary.Win32.classAtom = registerWindowClass();
|
||||
|
@ -885,13 +882,11 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||
|
||||
_glfwLibrary.Win32.monitor.width = window->width;
|
||||
_glfwLibrary.Win32.monitor.height = window->height;
|
||||
_glfwLibrary.Win32.monitor.refreshRate = wndconfig->refreshRate;
|
||||
_glfwLibrary.Win32.monitor.bitsPerPixel = bpp;
|
||||
|
||||
_glfwSetVideoMode(&_glfwLibrary.Win32.monitor.width,
|
||||
&_glfwLibrary.Win32.monitor.height,
|
||||
&_glfwLibrary.Win32.monitor.bitsPerPixel,
|
||||
&_glfwLibrary.Win32.monitor.refreshRate,
|
||||
GL_FALSE);
|
||||
|
||||
_glfwLibrary.Win32.monitor.modeChanged = GL_TRUE;
|
||||
|
@ -1069,28 +1064,6 @@ void _glfwPlatformHideWindow(_GLFWwindow* window)
|
|||
}
|
||||
|
||||
|
||||
//========================================================================
|
||||
// Write back window parameters into GLFW window structure
|
||||
//========================================================================
|
||||
|
||||
void _glfwPlatformRefreshWindowParams(_GLFWwindow* window)
|
||||
{
|
||||
DEVMODE dm;
|
||||
|
||||
ZeroMemory(&dm, sizeof(DEVMODE));
|
||||
dm.dmSize = sizeof(DEVMODE);
|
||||
|
||||
if (EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm))
|
||||
{
|
||||
window->refreshRate = dm.dmDisplayFrequency;
|
||||
if (window->refreshRate <= 1)
|
||||
window->refreshRate = 0;
|
||||
}
|
||||
else
|
||||
window->refreshRate = 0;
|
||||
}
|
||||
|
||||
|
||||
//========================================================================
|
||||
// Poll for new window and input events
|
||||
//========================================================================
|
||||
|
|
19
src/window.c
19
src/window.c
|
@ -242,7 +242,6 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
|
|||
|
||||
// Set up desired window config
|
||||
wndconfig.title = title;
|
||||
wndconfig.refreshRate = Max(_glfwLibrary.hints.refreshRate, 0);
|
||||
wndconfig.resizable = _glfwLibrary.hints.resizable ? GL_TRUE : GL_FALSE;
|
||||
wndconfig.visible = _glfwLibrary.hints.visible ? GL_TRUE : GL_FALSE;
|
||||
wndconfig.positionX = _glfwLibrary.hints.positionX;
|
||||
|
@ -295,9 +294,6 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
|
|||
return GL_FALSE;
|
||||
}
|
||||
|
||||
// Cache the actual (as opposed to requested) window parameters
|
||||
_glfwPlatformRefreshWindowParams(window);
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
|
||||
// Cache the actual (as opposed to requested) context parameters
|
||||
|
@ -404,9 +400,6 @@ GLFWAPI void glfwWindowHint(int target, int hint)
|
|||
case GLFW_STENCIL_BITS:
|
||||
_glfwLibrary.hints.stencilBits = hint;
|
||||
break;
|
||||
case GLFW_REFRESH_RATE:
|
||||
_glfwLibrary.hints.refreshRate = hint;
|
||||
break;
|
||||
case GLFW_ACCUM_RED_BITS:
|
||||
_glfwLibrary.hints.accumRedBits = hint;
|
||||
break;
|
||||
|
@ -593,13 +586,6 @@ GLFWAPI void glfwSetWindowSize(GLFWwindow handle, int width, int height)
|
|||
return;
|
||||
|
||||
_glfwPlatformSetWindowSize(window, width, height);
|
||||
|
||||
if (window->monitor)
|
||||
{
|
||||
// Refresh window parameters (may have changed due to changed video
|
||||
// modes)
|
||||
_glfwPlatformRefreshWindowParams(window);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -642,9 +628,6 @@ GLFWAPI void glfwRestoreWindow(GLFWwindow handle)
|
|||
return;
|
||||
|
||||
_glfwPlatformRestoreWindow(window);
|
||||
|
||||
if (window->monitor)
|
||||
_glfwPlatformRefreshWindowParams(window);
|
||||
}
|
||||
|
||||
|
||||
|
@ -712,8 +695,6 @@ GLFWAPI int glfwGetWindowParam(GLFWwindow handle, int param)
|
|||
return window->iconified;
|
||||
case GLFW_CLOSE_REQUESTED:
|
||||
return window->closeRequested;
|
||||
case GLFW_REFRESH_RATE:
|
||||
return window->refreshRate;
|
||||
case GLFW_RESIZABLE:
|
||||
return window->resizable;
|
||||
case GLFW_VISIBLE:
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
// Finds the video mode closest in size to the specified desired size
|
||||
//========================================================================
|
||||
|
||||
int _glfwGetClosestVideoMode(int* width, int* height, int* rate)
|
||||
int _glfwGetClosestVideoMode(int* width, int* height)
|
||||
{
|
||||
int i, match, bestmatch;
|
||||
|
||||
|
@ -51,8 +51,6 @@ int _glfwGetClosestVideoMode(int* width, int* height, int* rate)
|
|||
{
|
||||
#if defined(_GLFW_HAS_XRANDR)
|
||||
int sizecount, bestsize;
|
||||
int ratecount, bestrate;
|
||||
short* ratelist;
|
||||
XRRScreenConfiguration* sc;
|
||||
XRRScreenSize* sizelist;
|
||||
|
||||
|
@ -81,26 +79,6 @@ int _glfwGetClosestVideoMode(int* width, int* height, int* rate)
|
|||
// Report width & height of best matching mode
|
||||
*width = sizelist[bestsize].width;
|
||||
*height = sizelist[bestsize].height;
|
||||
|
||||
if (*rate > 0)
|
||||
{
|
||||
ratelist = XRRConfigRates(sc, bestsize, &ratecount);
|
||||
|
||||
bestrate = -1;
|
||||
bestmatch = INT_MAX;
|
||||
for (i = 0; i < ratecount; i++)
|
||||
{
|
||||
match = abs(ratelist[i] - *rate);
|
||||
if (match < bestmatch)
|
||||
{
|
||||
bestmatch = match;
|
||||
bestrate = ratelist[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (bestrate != -1)
|
||||
*rate = bestrate;
|
||||
}
|
||||
}
|
||||
|
||||
XRRFreeScreenConfigInfo(sc);
|
||||
|
@ -122,7 +100,7 @@ int _glfwGetClosestVideoMode(int* width, int* height, int* rate)
|
|||
// Change the current video mode
|
||||
//========================================================================
|
||||
|
||||
void _glfwSetVideoModeMODE(int mode, int rate)
|
||||
void _glfwSetVideoModeMODE(int mode)
|
||||
{
|
||||
if (_glfwLibrary.X11.RandR.available)
|
||||
{
|
||||
|
@ -145,27 +123,12 @@ void _glfwSetVideoModeMODE(int mode, int rate)
|
|||
_glfwLibrary.X11.FS.modeChanged = GL_TRUE;
|
||||
}
|
||||
|
||||
if (rate > 0)
|
||||
{
|
||||
// Set desired configuration
|
||||
XRRSetScreenConfigAndRate(_glfwLibrary.X11.display,
|
||||
sc,
|
||||
root,
|
||||
mode,
|
||||
RR_Rotate_0,
|
||||
(short) rate,
|
||||
CurrentTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set desired configuration
|
||||
XRRSetScreenConfig(_glfwLibrary.X11.display,
|
||||
sc,
|
||||
root,
|
||||
mode,
|
||||
RR_Rotate_0,
|
||||
CurrentTime);
|
||||
}
|
||||
|
||||
XRRFreeScreenConfigInfo(sc);
|
||||
#endif /*_GLFW_HAS_XRANDR*/
|
||||
|
@ -177,15 +140,15 @@ void _glfwSetVideoModeMODE(int mode, int rate)
|
|||
// Change the current video mode
|
||||
//========================================================================
|
||||
|
||||
void _glfwSetVideoMode(int* width, int* height, int* rate)
|
||||
void _glfwSetVideoMode(int* width, int* height)
|
||||
{
|
||||
int bestmode;
|
||||
|
||||
// Find a best match mode
|
||||
bestmode = _glfwGetClosestVideoMode(width, height, rate);
|
||||
bestmode = _glfwGetClosestVideoMode(width, height);
|
||||
|
||||
// Change mode
|
||||
_glfwSetVideoModeMODE(bestmode, *rate);
|
||||
_glfwSetVideoModeMODE(bestmode);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -252,9 +252,9 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||
void _glfwDestroyContext(_GLFWwindow* window);
|
||||
|
||||
// Fullscreen support
|
||||
int _glfwGetClosestVideoMode(int* width, int* height, int* rate);
|
||||
void _glfwSetVideoModeMODE(int mode, int rate);
|
||||
void _glfwSetVideoMode(int* width, int* height, int* rate);
|
||||
int _glfwGetClosestVideoMode(int* width, int* height);
|
||||
void _glfwSetVideoModeMODE(int mode);
|
||||
void _glfwSetVideoMode(int* width, int* height);
|
||||
void _glfwRestoreVideoMode(void);
|
||||
|
||||
// Joystick input
|
||||
|
|
|
@ -339,8 +339,7 @@ static void enterFullscreenMode(_GLFWwindow* window)
|
|||
_glfwLibrary.X11.saver.changed = GL_TRUE;
|
||||
}
|
||||
|
||||
_glfwSetVideoMode(&window->width, &window->height,
|
||||
&window->refreshRate);
|
||||
_glfwSetVideoMode(&window->width, &window->height);
|
||||
|
||||
if (_glfwLibrary.X11.hasEWMH &&
|
||||
_glfwLibrary.X11.wmState != None &&
|
||||
|
@ -855,8 +854,6 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||
const _GLFWwndconfig* wndconfig,
|
||||
const _GLFWfbconfig* fbconfig)
|
||||
{
|
||||
window->refreshRate = wndconfig->refreshRate;
|
||||
|
||||
if (!_glfwCreateContext(window, wndconfig, fbconfig))
|
||||
return GL_FALSE;
|
||||
|
||||
|
@ -977,14 +974,12 @@ void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
|
|||
|
||||
void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
|
||||
{
|
||||
int mode = 0, rate, sizeChanged = GL_FALSE;
|
||||
|
||||
rate = window->refreshRate;
|
||||
int mode = 0, sizeChanged = GL_FALSE;
|
||||
|
||||
if (window->monitor)
|
||||
{
|
||||
// Get the closest matching video mode for the specified window size
|
||||
mode = _glfwGetClosestVideoMode(&width, &height, &rate);
|
||||
mode = _glfwGetClosestVideoMode(&width, &height);
|
||||
}
|
||||
|
||||
if (!window->resizable)
|
||||
|
@ -1012,8 +1007,7 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
|
|||
sizeChanged = GL_TRUE;
|
||||
}
|
||||
|
||||
// Change video mode, keeping current refresh rate
|
||||
_glfwSetVideoModeMODE(mode, window->refreshRate);
|
||||
_glfwSetVideoModeMODE(mode);
|
||||
}
|
||||
|
||||
// Set window size (if not already changed)
|
||||
|
@ -1089,31 +1083,6 @@ void _glfwPlatformHideWindow(_GLFWwindow* window)
|
|||
}
|
||||
|
||||
|
||||
//========================================================================
|
||||
// Read back framebuffer parameters from the context
|
||||
//========================================================================
|
||||
|
||||
void _glfwPlatformRefreshWindowParams(_GLFWwindow* window)
|
||||
{
|
||||
// Retrieve refresh rate if possible
|
||||
if (_glfwLibrary.X11.RandR.available)
|
||||
{
|
||||
#if defined(_GLFW_HAS_XRANDR)
|
||||
XRRScreenConfiguration* sc;
|
||||
|
||||
sc = XRRGetScreenInfo(_glfwLibrary.X11.display, _glfwLibrary.X11.root);
|
||||
window->refreshRate = XRRConfigCurrentRate(sc);
|
||||
XRRFreeScreenConfigInfo(sc);
|
||||
#endif /*_GLFW_HAS_XRANDR*/
|
||||
}
|
||||
else
|
||||
{
|
||||
// Zero means unknown according to the GLFW spec
|
||||
window->refreshRate = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//========================================================================
|
||||
// Poll for new window and input events
|
||||
//========================================================================
|
||||
|
|
|
@ -63,7 +63,6 @@ static ParamGL gl_params[] =
|
|||
|
||||
static ParamGLFW glfw_params[] =
|
||||
{
|
||||
{ GLFW_REFRESH_RATE, "refresh rate" },
|
||||
{ GLFW_CONTEXT_VERSION_MAJOR, "Context version major" },
|
||||
{ GLFW_CONTEXT_VERSION_MINOR, "Context version minor" },
|
||||
{ GLFW_OPENGL_FORWARD_COMPAT, "OpenGL forward compatible" },
|
||||
|
|
Loading…
Reference in New Issue
Block a user