mirror of
https://github.com/glfw/glfw.git
synced 2024-11-14 06:23:50 +00:00
Merge branch 'master' into multi-monitor
Conflicts: include/GL/glfw3.h readme.html src/fullscreen.c src/internal.h src/window.c src/x11_fullscreen.c
This commit is contained in:
commit
835f00eb10
@ -614,7 +614,7 @@ int main( void )
|
|||||||
/* Check if we are still running */
|
/* Check if we are still running */
|
||||||
if (glfwGetKey( window, GLFW_KEY_ESCAPE ))
|
if (glfwGetKey( window, GLFW_KEY_ESCAPE ))
|
||||||
break;
|
break;
|
||||||
if (glfwGetWindowParam(window, GLFW_CLOSE_REQUESTED))
|
if (glfwGetWindowParam(window, GLFW_SHOULD_CLOSE))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -502,7 +502,7 @@ int main(void)
|
|||||||
// Check if the ESC key was pressed or the window should be closed
|
// Check if the ESC key was pressed or the window should be closed
|
||||||
if (glfwGetKey(window, GLFW_KEY_ESCAPE))
|
if (glfwGetKey(window, GLFW_KEY_ESCAPE))
|
||||||
break;
|
break;
|
||||||
if (glfwGetWindowParam(window, GLFW_CLOSE_REQUESTED))
|
if (glfwGetWindowParam(window, GLFW_SHOULD_CLOSE))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ int main(void)
|
|||||||
// Check if the ESC key was pressed or the window should be closed
|
// Check if the ESC key was pressed or the window should be closed
|
||||||
if (glfwGetKey(window, GLFW_KEY_ESCAPE))
|
if (glfwGetKey(window, GLFW_KEY_ESCAPE))
|
||||||
break;
|
break;
|
||||||
if (glfwGetWindowParam(window, GLFW_CLOSE_REQUESTED))
|
if (glfwGetWindowParam(window, GLFW_SHOULD_CLOSE))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -470,7 +470,7 @@ extern "C" {
|
|||||||
* otherwise.
|
* otherwise.
|
||||||
* @see glfwGetWindowParam
|
* @see glfwGetWindowParam
|
||||||
*/
|
*/
|
||||||
#define GLFW_CLOSE_REQUESTED 0x00020003
|
#define GLFW_SHOULD_CLOSE 0x00020003
|
||||||
/*! @brief The client API version revision.
|
/*! @brief The client API version revision.
|
||||||
* @see glfwGetWindowParam
|
* @see glfwGetWindowParam
|
||||||
*/
|
*/
|
||||||
@ -528,7 +528,7 @@ extern "C" {
|
|||||||
* zero to disable multisampling.
|
* zero to disable multisampling.
|
||||||
* @see glfwWindowHint
|
* @see glfwWindowHint
|
||||||
*/
|
*/
|
||||||
#define GLFW_FSAA_SAMPLES 0x0002100C
|
#define GLFW_SAMPLES 0x0002100C
|
||||||
/*! @brief @c GL_TRUE if the framebuffer should be sRGB capable, or @c GL_FALSE
|
/*! @brief @c GL_TRUE if the framebuffer should be sRGB capable, or @c GL_FALSE
|
||||||
* otherwise.
|
* otherwise.
|
||||||
* @see glfwWindowHint
|
* @see glfwWindowHint
|
||||||
@ -1151,8 +1151,8 @@ GLFWAPI void glfwDefaultWindowHints(void);
|
|||||||
*
|
*
|
||||||
* The @ref GLFW_STEREO hint specifies whether to use stereoscopic rendering.
|
* The @ref GLFW_STEREO hint specifies whether to use stereoscopic rendering.
|
||||||
*
|
*
|
||||||
* The @ref GLFW_FSAA_SAMPLES hint specifies the desired number of samples to
|
* The @ref GLFW_SAMPLES hint specifies the desired number of samples to use
|
||||||
* use for multisampling.
|
* for multisampling.
|
||||||
*
|
*
|
||||||
* The @ref GLFW_SRGB_CAPABLE hint specifies whether the framebuffer should be
|
* The @ref GLFW_SRGB_CAPABLE hint specifies whether the framebuffer should be
|
||||||
* sRGB capable.
|
* sRGB capable.
|
||||||
@ -1388,7 +1388,7 @@ GLFWAPI GLFWmonitor glfwGetWindowMonitor(GLFWwindow window);
|
|||||||
* The @ref GLFW_RESIZABLE property indicates whether the window is resizable
|
* The @ref GLFW_RESIZABLE property indicates whether the window is resizable
|
||||||
* by the user.
|
* by the user.
|
||||||
*
|
*
|
||||||
* The @ref GLFW_CLOSE_REQUESTED property indicates whether the window has been
|
* The @ref GLFW_SHOULD_CLOSE property indicates whether the window has been
|
||||||
* requested by the user to close.
|
* requested by the user to close.
|
||||||
*
|
*
|
||||||
* The @ref GLFW_POSITION_X and @ref GLFW_POSITION_Y properties indicate the
|
* The @ref GLFW_POSITION_X and @ref GLFW_POSITION_Y properties indicate the
|
||||||
@ -1464,7 +1464,7 @@ GLFWAPI void glfwSetWindowSizeCallback(GLFWwindow window, GLFWwindowsizefun cbfu
|
|||||||
* callback to be called.
|
* callback to be called.
|
||||||
*
|
*
|
||||||
* The return value of the close callback becomes the new value of the @ref
|
* The return value of the close callback becomes the new value of the @ref
|
||||||
* GLFW_CLOSE_REQUESTED window parameter.
|
* GLFW_SHOULD_CLOSE window parameter.
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwSetWindowCloseCallback(GLFWwindow window, GLFWwindowclosefun cbfun);
|
GLFWAPI void glfwSetWindowCloseCallback(GLFWwindow window, GLFWwindowclosefun cbfun);
|
||||||
|
|
||||||
|
@ -307,6 +307,7 @@ version of GLFW.</p>
|
|||||||
<li>Renamed <code>glfw.h</code> to <code>glfw3.h</code> to avoid conflicts with 2.x series</li>
|
<li>Renamed <code>glfw.h</code> to <code>glfw3.h</code> to avoid conflicts with 2.x series</li>
|
||||||
<li>Renamed <code>glfwOpenWindowHint</code> to <code>glfwWindowHint</code></li>
|
<li>Renamed <code>glfwOpenWindowHint</code> to <code>glfwWindowHint</code></li>
|
||||||
<li>Renamed <code>GLFW_ACTIVE</code> to <code>GLFW_FOCUSED</code></li>
|
<li>Renamed <code>GLFW_ACTIVE</code> to <code>GLFW_FOCUSED</code></li>
|
||||||
|
<li>Renamed <code>GLFW_FSAA_SAMPLES</code> to <code>GLFW_SAMPLES</code></li>
|
||||||
<li>Renamed <code>GLFW_WINDOW_NO_RESIZE</code> to <code>GLFW_RESIZABLE</code></li>
|
<li>Renamed <code>GLFW_WINDOW_NO_RESIZE</code> to <code>GLFW_RESIZABLE</code></li>
|
||||||
<li>Renamed <code>GLFW_BUILD_DLL</code> to <code>_GLFW_BUILD_DLL</code></li>
|
<li>Renamed <code>GLFW_BUILD_DLL</code> to <code>_GLFW_BUILD_DLL</code></li>
|
||||||
<li>Renamed <code>version</code> test to <code>glfwinfo</code></li>
|
<li>Renamed <code>version</code> test to <code>glfwinfo</code></li>
|
||||||
@ -320,7 +321,7 @@ version of GLFW.</p>
|
|||||||
<li>Replaced mouse wheel interface with two-dimensional, floating point scrolling interface</li>
|
<li>Replaced mouse wheel interface with two-dimensional, floating point scrolling interface</li>
|
||||||
<li>Replaced <code>glfwEnable</code> and <code>glfwDisable</code> with <code>glfwGetInputMode</code> and <code>glfwSetInputMode</code></li>
|
<li>Replaced <code>glfwEnable</code> and <code>glfwDisable</code> with <code>glfwGetInputMode</code> and <code>glfwSetInputMode</code></li>
|
||||||
<li>Replaced <code>joystick</code> test with graphical version</li>
|
<li>Replaced <code>joystick</code> test with graphical version</li>
|
||||||
<li>Replaced automatic closing of windows with <code>GLFW_CLOSE_REQUESTED</code> window parameter</li>
|
<li>Replaced automatic closing of windows with <code>GLFW_SHOULD_CLOSE</code> window parameter</li>
|
||||||
<li>Removed the <code>GLFW_KEY_REPEAT</code> input option</li>
|
<li>Removed the <code>GLFW_KEY_REPEAT</code> input option</li>
|
||||||
<li>Removed event auto-polling and the <code>GLFW_AUTO_POLL_EVENTS</code> window enable</li>
|
<li>Removed event auto-polling and the <code>GLFW_AUTO_POLL_EVENTS</code> window enable</li>
|
||||||
<li>Removed the Win32 port .def files</li>
|
<li>Removed the Win32 port .def files</li>
|
||||||
|
@ -47,7 +47,7 @@ GLFWAPI void glfwSetClipboardString(GLFWwindow handle, const char* string)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ GLFWAPI const char* glfwGetClipboardString(GLFWwindow handle)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,14 +62,14 @@ const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
|
|||||||
|
|
||||||
if (![[pasteboard types] containsObject:NSStringPboardType])
|
if (![[pasteboard types] containsObject:NSStringPboardType])
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_FORMAT_UNAVAILABLE, NULL);
|
_glfwInputError(GLFW_FORMAT_UNAVAILABLE, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* object = [pasteboard stringForType:NSStringPboardType];
|
NSString* object = [pasteboard stringForType:NSStringPboardType];
|
||||||
if (!object)
|
if (!object)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Cocoa: Failed to retrieve object from pasteboard");
|
"Cocoa: Failed to retrieve object from pasteboard");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,8 @@ int _glfwPlatformInit(void)
|
|||||||
CFBundleGetBundleWithIdentifier(CFSTR("com.apple.opengl"));
|
CFBundleGetBundleWithIdentifier(CFSTR("com.apple.opengl"));
|
||||||
if (_glfwLibrary.NSGL.framework == NULL)
|
if (_glfwLibrary.NSGL.framework == NULL)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR, "Failed to locate OpenGL framework");
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"NSGL: Failed to locate OpenGL framework");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,14 +235,14 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
|||||||
displays = (CGDirectDisplayID*) calloc(monitorCount, sizeof(CGDirectDisplayID));
|
displays = (CGDirectDisplayID*) calloc(monitorCount, sizeof(CGDirectDisplayID));
|
||||||
if (!displays)
|
if (!displays)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_OUT_OF_MEMORY, NULL);
|
_glfwInputError(GLFW_OUT_OF_MEMORY, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
monitors = (_GLFWmonitor**) calloc(monitorCount, sizeof(_GLFWmonitor*));
|
monitors = (_GLFWmonitor**) calloc(monitorCount, sizeof(_GLFWmonitor*));
|
||||||
if (!monitors)
|
if (!monitors)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_OUT_OF_MEMORY, NULL);
|
_glfwInputError(GLFW_OUT_OF_MEMORY, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ GLFWAPI id glfwGetCocoaWindow(GLFWwindow handle)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ GLFWAPI id glfwGetNSGLContext(GLFWwindow handle)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -692,7 +692,7 @@ static GLboolean createWindow(_GLFWwindow* window,
|
|||||||
|
|
||||||
if (window->NS.object == nil)
|
if (window->NS.object == nil)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR, "Cocoa: Failed to create window");
|
_glfwInputError(GLFW_PLATFORM_ERROR, "Cocoa: Failed to create window");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -734,7 +734,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||||||
_glfwLibrary.NS.delegate = [[GLFWApplicationDelegate alloc] init];
|
_glfwLibrary.NS.delegate = [[GLFWApplicationDelegate alloc] init];
|
||||||
if (_glfwLibrary.NS.delegate == nil)
|
if (_glfwLibrary.NS.delegate == nil)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Cocoa: Failed to create application delegate");
|
"Cocoa: Failed to create application delegate");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
@ -745,7 +745,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||||||
window->NS.delegate = [[GLFWWindowDelegate alloc] initWithGlfwWindow:window];
|
window->NS.delegate = [[GLFWWindowDelegate alloc] initWithGlfwWindow:window];
|
||||||
if (window->NS.delegate == nil)
|
if (window->NS.delegate == nil)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Cocoa: Failed to create window delegate");
|
"Cocoa: Failed to create window delegate");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,8 @@ static GLboolean parseGLVersion(int* api, int* major, int* minor, int* rev)
|
|||||||
version = (const char*) glGetString(GL_VERSION);
|
version = (const char*) glGetString(GL_VERSION);
|
||||||
if (!version)
|
if (!version)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR, "Failed to retrieve version string");
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Failed to retrieve context version string");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +74,8 @@ static GLboolean parseGLVersion(int* api, int* major, int* minor, int* rev)
|
|||||||
|
|
||||||
if (!sscanf(version, "%d.%d.%d", &_major, &_minor, &_rev))
|
if (!sscanf(version, "%d.%d.%d", &_major, &_minor, &_rev))
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR, "No version found in version string");
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"No version found in context version string");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,7 +264,7 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig)
|
|||||||
if (wndconfig->clientAPI != GLFW_OPENGL_API &&
|
if (wndconfig->clientAPI != GLFW_OPENGL_API &&
|
||||||
wndconfig->clientAPI != GLFW_OPENGL_ES_API)
|
wndconfig->clientAPI != GLFW_OPENGL_ES_API)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_INVALID_ENUM, "Invalid client API requested");
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid client API requested");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -278,7 +280,7 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig)
|
|||||||
// OpenGL 2.x series ended with version 2.1
|
// OpenGL 2.x series ended with version 2.1
|
||||||
// OpenGL 3.x series ended with version 3.3
|
// OpenGL 3.x series ended with version 3.3
|
||||||
|
|
||||||
_glfwSetError(GLFW_INVALID_VALUE,
|
_glfwInputError(GLFW_INVALID_VALUE,
|
||||||
"Invalid OpenGL version %i.%i requested",
|
"Invalid OpenGL version %i.%i requested",
|
||||||
wndconfig->glMajor, wndconfig->glMinor);
|
wndconfig->glMajor, wndconfig->glMinor);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
@ -293,7 +295,7 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig)
|
|||||||
if (wndconfig->glProfile != GLFW_OPENGL_CORE_PROFILE &&
|
if (wndconfig->glProfile != GLFW_OPENGL_CORE_PROFILE &&
|
||||||
wndconfig->glProfile != GLFW_OPENGL_COMPAT_PROFILE)
|
wndconfig->glProfile != GLFW_OPENGL_COMPAT_PROFILE)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_INVALID_ENUM,
|
_glfwInputError(GLFW_INVALID_ENUM,
|
||||||
"Invalid OpenGL profile requested");
|
"Invalid OpenGL profile requested");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
@ -304,7 +306,7 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig)
|
|||||||
// Desktop OpenGL context profiles are only defined for version 3.2
|
// Desktop OpenGL context profiles are only defined for version 3.2
|
||||||
// and above
|
// and above
|
||||||
|
|
||||||
_glfwSetError(GLFW_INVALID_VALUE,
|
_glfwInputError(GLFW_INVALID_VALUE,
|
||||||
"Context profiles only exist for "
|
"Context profiles only exist for "
|
||||||
"OpenGL version 3.2 and above");
|
"OpenGL version 3.2 and above");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
@ -314,7 +316,7 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig)
|
|||||||
if (wndconfig->glForward && wndconfig->glMajor < 3)
|
if (wndconfig->glForward && wndconfig->glMajor < 3)
|
||||||
{
|
{
|
||||||
// Forward-compatible contexts are only defined for OpenGL version 3.0 and above
|
// Forward-compatible contexts are only defined for OpenGL version 3.0 and above
|
||||||
_glfwSetError(GLFW_INVALID_VALUE,
|
_glfwInputError(GLFW_INVALID_VALUE,
|
||||||
"Forward compatibility only exist for OpenGL "
|
"Forward compatibility only exist for OpenGL "
|
||||||
"version 3.0 and above");
|
"version 3.0 and above");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
@ -330,7 +332,7 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig)
|
|||||||
// OpenGL ES 1.x series ended with version 1.1
|
// OpenGL ES 1.x series ended with version 1.1
|
||||||
// OpenGL ES 2.x series ended with version 2.0
|
// OpenGL ES 2.x series ended with version 2.0
|
||||||
|
|
||||||
_glfwSetError(GLFW_INVALID_VALUE,
|
_glfwInputError(GLFW_INVALID_VALUE,
|
||||||
"Invalid OpenGL ES version %i.%i requested",
|
"Invalid OpenGL ES version %i.%i requested",
|
||||||
wndconfig->glMajor, wndconfig->glMinor);
|
wndconfig->glMajor, wndconfig->glMinor);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
@ -343,7 +345,7 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig)
|
|||||||
if (wndconfig->glProfile)
|
if (wndconfig->glProfile)
|
||||||
{
|
{
|
||||||
// OpenGL ES does not support profiles
|
// OpenGL ES does not support profiles
|
||||||
_glfwSetError(GLFW_INVALID_VALUE,
|
_glfwInputError(GLFW_INVALID_VALUE,
|
||||||
"Context profiles are not supported by OpenGL ES");
|
"Context profiles are not supported by OpenGL ES");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
@ -351,7 +353,7 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig)
|
|||||||
if (wndconfig->glForward)
|
if (wndconfig->glForward)
|
||||||
{
|
{
|
||||||
// OpenGL ES does not support forward-compatibility
|
// OpenGL ES does not support forward-compatibility
|
||||||
_glfwSetError(GLFW_INVALID_VALUE,
|
_glfwInputError(GLFW_INVALID_VALUE,
|
||||||
"Forward compatibility is not supported by OpenGL ES");
|
"Forward compatibility is not supported by OpenGL ES");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
@ -362,8 +364,8 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig)
|
|||||||
if (wndconfig->glRobustness != GLFW_NO_RESET_NOTIFICATION &&
|
if (wndconfig->glRobustness != GLFW_NO_RESET_NOTIFICATION &&
|
||||||
wndconfig->glRobustness != GLFW_LOSE_CONTEXT_ON_RESET)
|
wndconfig->glRobustness != GLFW_LOSE_CONTEXT_ON_RESET)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_INVALID_VALUE,
|
_glfwInputError(GLFW_INVALID_VALUE,
|
||||||
"Invalid OpenGL robustness mode requested");
|
"Invalid context robustness mode requested");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -397,7 +399,7 @@ GLboolean _glfwRefreshContextParams(void)
|
|||||||
window->GetStringi = (PFNGLGETSTRINGIPROC) glfwGetProcAddress("glGetStringi");
|
window->GetStringi = (PFNGLGETSTRINGIPROC) glfwGetProcAddress("glGetStringi");
|
||||||
if (!window->GetStringi)
|
if (!window->GetStringi)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Entry point retrieval is broken");
|
"Entry point retrieval is broken");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
@ -494,7 +496,7 @@ GLboolean _glfwIsValidContext(_GLFWwndconfig* wndconfig)
|
|||||||
// For API consistency, we emulate the behavior of the
|
// For API consistency, we emulate the behavior of the
|
||||||
// {GLX|WGL}_ARB_create_context extension and fail here
|
// {GLX|WGL}_ARB_create_context extension and fail here
|
||||||
|
|
||||||
_glfwSetError(GLFW_VERSION_UNAVAILABLE, NULL);
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE, NULL);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -551,7 +553,7 @@ GLFWAPI void glfwMakeContextCurrent(GLFWwindow handle)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -570,7 +572,7 @@ GLFWAPI GLFWwindow glfwGetCurrentContext(void)
|
|||||||
{
|
{
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -588,7 +590,7 @@ GLFWAPI void glfwSwapBuffers(GLFWwindow handle)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -604,13 +606,13 @@ GLFWAPI void glfwSwapInterval(int interval)
|
|||||||
{
|
{
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_glfwPlatformGetCurrentContext())
|
if (!_glfwPlatformGetCurrentContext())
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NO_CURRENT_CONTEXT, NULL);
|
_glfwInputError(GLFW_NO_CURRENT_CONTEXT, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -629,20 +631,20 @@ GLFWAPI int glfwExtensionSupported(const char* extension)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
window = _glfwPlatformGetCurrentContext();
|
window = _glfwPlatformGetCurrentContext();
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NO_CURRENT_CONTEXT, NULL);
|
_glfwInputError(GLFW_NO_CURRENT_CONTEXT, NULL);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extension == NULL || *extension == '\0')
|
if (extension == NULL || *extension == '\0')
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_INVALID_VALUE, NULL);
|
_glfwInputError(GLFW_INVALID_VALUE, NULL);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -690,13 +692,13 @@ GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname)
|
|||||||
{
|
{
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_glfwPlatformGetCurrentContext())
|
if (!_glfwPlatformGetCurrentContext())
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NO_CURRENT_CONTEXT, NULL);
|
_glfwInputError(GLFW_NO_CURRENT_CONTEXT, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window,
|
|||||||
configs = (EGLConfig*) malloc(sizeof(EGLConfig) * count);
|
configs = (EGLConfig*) malloc(sizeof(EGLConfig) * count);
|
||||||
if (!configs)
|
if (!configs)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_OUT_OF_MEMORY, NULL);
|
_glfwInputError(GLFW_OUT_OF_MEMORY, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,8 +92,7 @@ static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window,
|
|||||||
{
|
{
|
||||||
free(configs);
|
free(configs);
|
||||||
|
|
||||||
_glfwSetError(GLFW_API_UNAVAILABLE,
|
_glfwInputError(GLFW_API_UNAVAILABLE, "EGL: No EGLConfigs returned");
|
||||||
"EGL: No EGLConfigs returned");
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,7 +101,7 @@ static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window,
|
|||||||
{
|
{
|
||||||
free(configs);
|
free(configs);
|
||||||
|
|
||||||
_glfwSetError(GLFW_OUT_OF_MEMORY, NULL);
|
_glfwInputError(GLFW_OUT_OF_MEMORY, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,7 +202,7 @@ static int createContext(_GLFWwindow* window,
|
|||||||
eglChooseConfig(_glfwLibrary.EGL.display, attribs, &config, 1, &count);
|
eglChooseConfig(_glfwLibrary.EGL.display, attribs, &config, 1, &count);
|
||||||
if (!count)
|
if (!count)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"EGL: Failed to retrieve the selected EGLConfig");
|
"EGL: Failed to retrieve the selected EGLConfig");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
@ -251,7 +250,7 @@ static int createContext(_GLFWwindow* window,
|
|||||||
|
|
||||||
if (window->EGL.visual == NULL)
|
if (window->EGL.visual == NULL)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"EGL: Failed to retrieve visual for EGLConfig");
|
"EGL: Failed to retrieve visual for EGLConfig");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
@ -262,7 +261,8 @@ static int createContext(_GLFWwindow* window,
|
|||||||
{
|
{
|
||||||
if (!eglBindAPI(EGL_OPENGL_ES_API))
|
if (!eglBindAPI(EGL_OPENGL_ES_API))
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR, "EGL: OpenGL ES is not supported");
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"EGL: OpenGL ES is not supported");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -270,7 +270,7 @@ static int createContext(_GLFWwindow* window,
|
|||||||
{
|
{
|
||||||
if (!eglBindAPI(EGL_OPENGL_API))
|
if (!eglBindAPI(EGL_OPENGL_API))
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR, "EGL: OpenGL is not supported");
|
_glfwInputError(GLFW_PLATFORM_ERROR, "EGL: OpenGL is not supported");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -337,7 +337,7 @@ static int createContext(_GLFWwindow* window,
|
|||||||
{
|
{
|
||||||
// TODO: Handle all the various error codes here
|
// TODO: Handle all the various error codes here
|
||||||
|
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR, "EGL: Failed to create context");
|
_glfwInputError(GLFW_PLATFORM_ERROR, "EGL: Failed to create context");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -379,7 +379,7 @@ int _glfwInitOpenGL(void)
|
|||||||
|
|
||||||
if (!_glfwLibrary.EGL.libEGL)
|
if (!_glfwLibrary.EGL.libEGL)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR, "EGL: Failed to find libEGL");
|
_glfwInputError(GLFW_PLATFORM_ERROR, "EGL: Failed to find libEGL");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -387,8 +387,7 @@ int _glfwInitOpenGL(void)
|
|||||||
_glfwLibrary.EGL.display = eglGetDisplay(_GLFW_EGL_NATIVE_DISPLAY);
|
_glfwLibrary.EGL.display = eglGetDisplay(_GLFW_EGL_NATIVE_DISPLAY);
|
||||||
if (_glfwLibrary.EGL.display == EGL_NO_DISPLAY)
|
if (_glfwLibrary.EGL.display == EGL_NO_DISPLAY)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_API_UNAVAILABLE,
|
_glfwInputError(GLFW_API_UNAVAILABLE, "EGL: Failed to get EGL display");
|
||||||
"EGL: Failed to get EGL display");
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -396,8 +395,7 @@ int _glfwInitOpenGL(void)
|
|||||||
&_glfwLibrary.EGL.majorVersion,
|
&_glfwLibrary.EGL.majorVersion,
|
||||||
&_glfwLibrary.EGL.minorVersion))
|
&_glfwLibrary.EGL.minorVersion))
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_API_UNAVAILABLE,
|
_glfwInputError(GLFW_API_UNAVAILABLE, "EGL: Failed to initialize EGL");
|
||||||
"EGL: Failed to initialize EGL");
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -445,7 +443,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
fbconfigs = getFBConfigs(window, wndconfig, &fbcount);
|
fbconfigs = getFBConfigs(window, wndconfig, &fbcount);
|
||||||
if (!fbconfigs)
|
if (!fbconfigs)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"EGL: No usable EGLFBConfigs found");
|
"EGL: No usable EGLFBConfigs found");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
@ -453,7 +451,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
result = _glfwChooseFBConfig(fbconfig, fbconfigs, fbcount);
|
result = _glfwChooseFBConfig(fbconfig, fbconfigs, fbcount);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"EGL: No EGLFBConfig matched the criteria");
|
"EGL: No EGLFBConfig matched the criteria");
|
||||||
|
|
||||||
free(fbconfigs);
|
free(fbconfigs);
|
||||||
@ -526,7 +524,7 @@ void _glfwPlatformMakeContextCurrent(_GLFWwindow* window)
|
|||||||
NULL);
|
NULL);
|
||||||
if (window->EGL.surface == EGL_NO_SURFACE)
|
if (window->EGL.surface == EGL_NO_SURFACE)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"EGL: Failed to create window surface");
|
"EGL: Failed to create window surface");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,13 +48,13 @@ GLFWAPI void glfwSetGamma(float gamma)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gamma <= 0.f)
|
if (gamma <= 0.f)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_INVALID_VALUE,
|
_glfwInputError(GLFW_INVALID_VALUE,
|
||||||
"Gamma value must be greater than zero");
|
"Gamma value must be greater than zero");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -91,7 +91,7 @@ GLFWAPI void glfwGetGammaRamp(GLFWgammaramp* ramp)
|
|||||||
{
|
{
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ GLFWAPI void glfwSetGammaRamp(const GLFWgammaramp* ramp)
|
|||||||
{
|
{
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window, unsigned int* found)
|
|||||||
{
|
{
|
||||||
if (!_glfwLibrary.GLX.SGIX_fbconfig)
|
if (!_glfwLibrary.GLX.SGIX_fbconfig)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_API_UNAVAILABLE,
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||||
"GLX: GLXFBConfig support not found");
|
"GLX: GLXFBConfig support not found");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -127,7 +127,7 @@ static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window, unsigned int* found)
|
|||||||
&count);
|
&count);
|
||||||
if (!count)
|
if (!count)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_API_UNAVAILABLE,
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||||
"GLX: No GLXFBConfigs returned");
|
"GLX: No GLXFBConfigs returned");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -139,7 +139,7 @@ static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window, unsigned int* found)
|
|||||||
&count);
|
&count);
|
||||||
if (!count)
|
if (!count)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_API_UNAVAILABLE,
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||||
"GLX: No GLXFBConfigs returned");
|
"GLX: No GLXFBConfigs returned");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -148,7 +148,7 @@ static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window, unsigned int* found)
|
|||||||
result = (_GLFWfbconfig*) malloc(sizeof(_GLFWfbconfig) * count);
|
result = (_GLFWfbconfig*) malloc(sizeof(_GLFWfbconfig) * count);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_OUT_OF_MEMORY, NULL);
|
_glfwInputError(GLFW_OUT_OF_MEMORY, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -302,7 +302,7 @@ static int createContext(_GLFWwindow* window,
|
|||||||
|
|
||||||
if (fbconfig == NULL)
|
if (fbconfig == NULL)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"GLX: Failed to retrieve the selected GLXFBConfig");
|
"GLX: Failed to retrieve the selected GLXFBConfig");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
@ -325,7 +325,7 @@ static int createContext(_GLFWwindow* window,
|
|||||||
{
|
{
|
||||||
XFree(fbconfig);
|
XFree(fbconfig);
|
||||||
|
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"GLX: Failed to retrieve visual for GLXFBConfig");
|
"GLX: Failed to retrieve visual for GLXFBConfig");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
@ -336,7 +336,7 @@ static int createContext(_GLFWwindow* window,
|
|||||||
!_glfwLibrary.GLX.ARB_create_context_profile ||
|
!_glfwLibrary.GLX.ARB_create_context_profile ||
|
||||||
!_glfwLibrary.GLX.EXT_create_context_es2_profile)
|
!_glfwLibrary.GLX.EXT_create_context_es2_profile)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_VERSION_UNAVAILABLE,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"GLX: OpenGL ES requested but "
|
"GLX: OpenGL ES requested but "
|
||||||
"GLX_EXT_create_context_es2_profile is unavailable");
|
"GLX_EXT_create_context_es2_profile is unavailable");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
@ -347,7 +347,7 @@ static int createContext(_GLFWwindow* window,
|
|||||||
{
|
{
|
||||||
if (!_glfwLibrary.GLX.ARB_create_context)
|
if (!_glfwLibrary.GLX.ARB_create_context)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_VERSION_UNAVAILABLE,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"GLX: Forward compatibility requested but "
|
"GLX: Forward compatibility requested but "
|
||||||
"GLX_ARB_create_context_profile is unavailable");
|
"GLX_ARB_create_context_profile is unavailable");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
@ -359,7 +359,7 @@ static int createContext(_GLFWwindow* window,
|
|||||||
if (!_glfwLibrary.GLX.ARB_create_context ||
|
if (!_glfwLibrary.GLX.ARB_create_context ||
|
||||||
!_glfwLibrary.GLX.ARB_create_context_profile)
|
!_glfwLibrary.GLX.ARB_create_context_profile)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_VERSION_UNAVAILABLE,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"GLX: An OpenGL profile requested but "
|
"GLX: An OpenGL profile requested but "
|
||||||
"GLX_ARB_create_context_profile is unavailable");
|
"GLX_ARB_create_context_profile is unavailable");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
@ -461,7 +461,7 @@ static int createContext(_GLFWwindow* window,
|
|||||||
|
|
||||||
if (window->GLX.context == NULL)
|
if (window->GLX.context == NULL)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR, "GLX: Failed to create context");
|
_glfwInputError(GLFW_PLATFORM_ERROR, "GLX: Failed to create context");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -501,7 +501,7 @@ int _glfwInitOpenGL(void)
|
|||||||
|
|
||||||
if (!_glfwLibrary.GLX.libGL)
|
if (!_glfwLibrary.GLX.libGL)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR, "GLX: Failed to find libGL");
|
_glfwInputError(GLFW_PLATFORM_ERROR, "GLX: Failed to find libGL");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -511,7 +511,7 @@ int _glfwInitOpenGL(void)
|
|||||||
&_glfwLibrary.GLX.errorBase,
|
&_glfwLibrary.GLX.errorBase,
|
||||||
&_glfwLibrary.GLX.eventBase))
|
&_glfwLibrary.GLX.eventBase))
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_API_UNAVAILABLE, "GLX: GLX support not found");
|
_glfwInputError(GLFW_API_UNAVAILABLE, "GLX: GLX support not found");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -519,7 +519,8 @@ int _glfwInitOpenGL(void)
|
|||||||
&_glfwLibrary.GLX.majorVersion,
|
&_glfwLibrary.GLX.majorVersion,
|
||||||
&_glfwLibrary.GLX.minorVersion))
|
&_glfwLibrary.GLX.minorVersion))
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_API_UNAVAILABLE, "GLX: Failed to query GLX version");
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||||
|
"GLX: Failed to query GLX version");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -638,7 +639,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
result = _glfwChooseFBConfig(fbconfig, fbconfigs, fbcount);
|
result = _glfwChooseFBConfig(fbconfig, fbconfigs, fbcount);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"GLX: No GLXFBConfig matched the criteria");
|
"GLX: No GLXFBConfig matched the criteria");
|
||||||
|
|
||||||
free(fbconfigs);
|
free(fbconfigs);
|
||||||
|
@ -97,10 +97,10 @@ static const char* getErrorString(int error)
|
|||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//========================================================================
|
//========================================================================
|
||||||
// Sets the current error value
|
// Register error
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
void _glfwSetError(int error, const char* format, ...)
|
void _glfwInputError(int error, const char* format, ...)
|
||||||
{
|
{
|
||||||
if (_glfwErrorCallback)
|
if (_glfwErrorCallback)
|
||||||
{
|
{
|
||||||
|
37
src/input.c
37
src/input.c
@ -43,7 +43,7 @@ static void setCursorMode(_GLFWwindow* window, int newMode)
|
|||||||
newMode != GLFW_CURSOR_HIDDEN &&
|
newMode != GLFW_CURSOR_HIDDEN &&
|
||||||
newMode != GLFW_CURSOR_CAPTURED)
|
newMode != GLFW_CURSOR_CAPTURED)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_INVALID_ENUM, NULL);
|
_glfwInputError(GLFW_INVALID_ENUM, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -255,7 +255,7 @@ GLFWAPI int glfwGetInputMode(GLFWwindow handle, int mode)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,7 +268,7 @@ GLFWAPI int glfwGetInputMode(GLFWwindow handle, int mode)
|
|||||||
case GLFW_STICKY_MOUSE_BUTTONS:
|
case GLFW_STICKY_MOUSE_BUTTONS:
|
||||||
return window->stickyMouseButtons;
|
return window->stickyMouseButtons;
|
||||||
default:
|
default:
|
||||||
_glfwSetError(GLFW_INVALID_ENUM, NULL);
|
_glfwInputError(GLFW_INVALID_ENUM, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -284,7 +284,7 @@ GLFWAPI void glfwSetInputMode(GLFWwindow handle, int mode, int value)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -300,7 +300,7 @@ GLFWAPI void glfwSetInputMode(GLFWwindow handle, int mode, int value)
|
|||||||
setStickyMouseButtons(window, value ? GL_TRUE : GL_FALSE);
|
setStickyMouseButtons(window, value ? GL_TRUE : GL_FALSE);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
_glfwSetError(GLFW_INVALID_ENUM, NULL);
|
_glfwInputError(GLFW_INVALID_ENUM, NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -316,14 +316,13 @@ GLFWAPI int glfwGetKey(GLFWwindow handle, int key)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return GLFW_RELEASE;
|
return GLFW_RELEASE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key < 0 || key > GLFW_KEY_LAST)
|
if (key < 0 || key > GLFW_KEY_LAST)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_INVALID_ENUM,
|
_glfwInputError(GLFW_INVALID_ENUM, "The specified key is invalid");
|
||||||
"The specified key is invalid");
|
|
||||||
return GLFW_RELEASE;
|
return GLFW_RELEASE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -348,13 +347,13 @@ GLFWAPI int glfwGetMouseButton(GLFWwindow handle, int button)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return GLFW_RELEASE;
|
return GLFW_RELEASE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (button < 0 || button > GLFW_MOUSE_BUTTON_LAST)
|
if (button < 0 || button > GLFW_MOUSE_BUTTON_LAST)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_INVALID_ENUM,
|
_glfwInputError(GLFW_INVALID_ENUM,
|
||||||
"The specified mouse button is invalid");
|
"The specified mouse button is invalid");
|
||||||
return GLFW_RELEASE;
|
return GLFW_RELEASE;
|
||||||
}
|
}
|
||||||
@ -380,7 +379,7 @@ GLFWAPI void glfwGetCursorPos(GLFWwindow handle, int* xpos, int* ypos)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -403,7 +402,7 @@ GLFWAPI void glfwSetCursorPos(GLFWwindow handle, int xpos, int ypos)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -437,7 +436,7 @@ GLFWAPI void glfwGetScrollOffset(GLFWwindow handle, double* xoffset, double* yof
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -459,7 +458,7 @@ GLFWAPI void glfwSetKeyCallback(GLFWwindow handle, GLFWkeyfun cbfun)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -477,7 +476,7 @@ GLFWAPI void glfwSetCharCallback(GLFWwindow handle, GLFWcharfun cbfun)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -495,7 +494,7 @@ GLFWAPI void glfwSetMouseButtonCallback(GLFWwindow handle, GLFWmousebuttonfun cb
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -513,7 +512,7 @@ GLFWAPI void glfwSetCursorPosCallback(GLFWwindow handle, GLFWcursorposfun cbfun)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -531,7 +530,7 @@ GLFWAPI void glfwSetCursorEnterCallback(GLFWwindow handle, GLFWcursorenterfun cb
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -549,7 +548,7 @@ GLFWAPI void glfwSetScrollCallback(GLFWwindow handle, GLFWscrollfun cbfun)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,6 +59,10 @@ typedef struct _GLFWmonitor _GLFWmonitor;
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
// Disable the inclusion of the platform glext.h by gl.h to allow proper
|
||||||
|
// inclusion of our own, newer glext.h below
|
||||||
|
#define GL_GLEXT_LEGACY
|
||||||
|
|
||||||
#include "../include/GL/glfw3.h"
|
#include "../include/GL/glfw3.h"
|
||||||
|
|
||||||
// This path may need to be changed if you build GLFW using your own setup
|
// This path may need to be changed if you build GLFW using your own setup
|
||||||
@ -368,6 +372,9 @@ void _glfwInputCursorEnter(_GLFWwindow* window, int entered);
|
|||||||
// Monitor event notification (monitor.c)
|
// Monitor event notification (monitor.c)
|
||||||
void _glfwInputMonitorChange(void);
|
void _glfwInputMonitorChange(void);
|
||||||
|
|
||||||
|
// Error event notification (init.c)
|
||||||
|
void _glfwInputError(int error, const char* format, ...);
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
//========================================================================
|
||||||
// Prototypes for internal utility functions
|
// Prototypes for internal utility functions
|
||||||
@ -383,9 +390,6 @@ const GLFWvidmode* _glfwChooseVideoMode(const GLFWvidmode* desired,
|
|||||||
int _glfwCompareVideoModes(const GLFWvidmode* first, const GLFWvidmode* second);
|
int _glfwCompareVideoModes(const GLFWvidmode* first, const GLFWvidmode* second);
|
||||||
void _glfwSplitBPP(int bpp, int* red, int* green, int* blue);
|
void _glfwSplitBPP(int bpp, int* red, int* green, int* blue);
|
||||||
|
|
||||||
// Error handling (init.c)
|
|
||||||
void _glfwSetError(int error, const char* format, ...);
|
|
||||||
|
|
||||||
// OpenGL context helpers (opengl.c)
|
// OpenGL context helpers (opengl.c)
|
||||||
int _glfwStringInExtensionString(const char* string, const GLubyte* extensions);
|
int _glfwStringInExtensionString(const char* string, const GLubyte* extensions);
|
||||||
const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
|
const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
|
||||||
|
@ -43,13 +43,13 @@ GLFWAPI int glfwGetJoystickParam(int joy, int param)
|
|||||||
{
|
{
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (joy < 0 || joy > GLFW_JOYSTICK_LAST)
|
if (joy < 0 || joy > GLFW_JOYSTICK_LAST)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_INVALID_ENUM, NULL);
|
_glfwInputError(GLFW_INVALID_ENUM, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,19 +67,19 @@ GLFWAPI int glfwGetJoystickAxes(int joy, float* axes, int numaxes)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (joy < 0 || joy > GLFW_JOYSTICK_LAST)
|
if (joy < 0 || joy > GLFW_JOYSTICK_LAST)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_INVALID_ENUM, NULL);
|
_glfwInputError(GLFW_INVALID_ENUM, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (axes == NULL || numaxes < 0)
|
if (axes == NULL || numaxes < 0)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_INVALID_VALUE, NULL);
|
_glfwInputError(GLFW_INVALID_VALUE, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,19 +103,19 @@ GLFWAPI int glfwGetJoystickButtons(int joy,
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (joy < 0 || joy > GLFW_JOYSTICK_LAST)
|
if (joy < 0 || joy > GLFW_JOYSTICK_LAST)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_INVALID_ENUM, NULL);
|
_glfwInputError(GLFW_INVALID_ENUM, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buttons == NULL || numbuttons < 0)
|
if (buttons == NULL || numbuttons < 0)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_INVALID_VALUE, NULL);
|
_glfwInputError(GLFW_INVALID_VALUE, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,13 +135,13 @@ GLFWAPI const char* glfwGetJoystickName(int joy)
|
|||||||
{
|
{
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (joy < 0 || joy > GLFW_JOYSTICK_LAST)
|
if (joy < 0 || joy > GLFW_JOYSTICK_LAST)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_INVALID_ENUM, NULL);
|
_glfwInputError(GLFW_INVALID_ENUM, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ _GLFWmonitor* _glfwCreateMonitor(const char* name,
|
|||||||
_GLFWmonitor* monitor = (_GLFWmonitor*) calloc(1, sizeof(_GLFWmonitor));
|
_GLFWmonitor* monitor = (_GLFWmonitor*) calloc(1, sizeof(_GLFWmonitor));
|
||||||
if (!monitor)
|
if (!monitor)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_OUT_OF_MEMORY, NULL);
|
_glfwInputError(GLFW_OUT_OF_MEMORY, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,13 +284,13 @@ GLFWAPI const GLFWmonitor* glfwGetMonitors(int* count)
|
|||||||
{
|
{
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count == NULL)
|
if (count == NULL)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_INVALID_VALUE, NULL);
|
_glfwInputError(GLFW_INVALID_VALUE, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -310,7 +310,7 @@ GLFWAPI GLFWmonitor glfwGetPrimaryMonitor(void)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,7 +325,7 @@ GLFWAPI GLFWmonitor glfwGetPrimaryMonitor(void)
|
|||||||
|
|
||||||
if (!handle)
|
if (!handle)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR, NULL);
|
_glfwInputError(GLFW_PLATFORM_ERROR, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -343,13 +343,13 @@ GLFWAPI int glfwGetMonitorParam(GLFWmonitor handle, int param)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (monitor == NULL)
|
if (monitor == NULL)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_INVALID_VALUE,
|
_glfwInputError(GLFW_INVALID_VALUE,
|
||||||
"glfwGetMonitorParam: Invalid monitor handle");
|
"glfwGetMonitorParam: Invalid monitor handle");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -366,7 +366,7 @@ GLFWAPI int glfwGetMonitorParam(GLFWmonitor handle, int param)
|
|||||||
return monitor->positionY;
|
return monitor->positionY;
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfwSetError(GLFW_INVALID_ENUM,
|
_glfwInputError(GLFW_INVALID_ENUM,
|
||||||
"glfwGetMonitorParam: Invalid enum value for 'param' parameter");
|
"glfwGetMonitorParam: Invalid enum value for 'param' parameter");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -382,13 +382,13 @@ GLFWAPI const char* glfwGetMonitorName(GLFWmonitor handle)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (monitor == NULL)
|
if (monitor == NULL)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_INVALID_VALUE,
|
_glfwInputError(GLFW_INVALID_VALUE,
|
||||||
"glfwGetMonitorString: Invalid monitor handle");
|
"glfwGetMonitorString: Invalid monitor handle");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -405,7 +405,7 @@ GLFWAPI void glfwSetMonitorCallback(GLFWmonitorfun cbfun)
|
|||||||
{
|
{
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -423,20 +423,20 @@ GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor handle, int* count)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (monitor == NULL)
|
if (monitor == NULL)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_INVALID_VALUE,
|
_glfwInputError(GLFW_INVALID_VALUE,
|
||||||
"glfwGetVideoModes: Invalid monitor handle");
|
"glfwGetVideoModes: Invalid monitor handle");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count == NULL)
|
if (count == NULL)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_INVALID_VALUE, NULL);
|
_glfwInputError(GLFW_INVALID_VALUE, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -466,13 +466,13 @@ GLFWAPI void glfwGetVideoMode(GLFWmonitor handle, GLFWvidmode* mode)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == NULL)
|
if (mode == NULL)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_INVALID_VALUE, NULL);
|
_glfwInputError(GLFW_INVALID_VALUE, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ int _glfwInitOpenGL(void)
|
|||||||
{
|
{
|
||||||
if (pthread_key_create(&_glfwCurrentTLS, NULL) != 0)
|
if (pthread_key_create(&_glfwCurrentTLS, NULL) != 0)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"NSOpenGL: Failed to create context TLS");
|
"NSOpenGL: Failed to create context TLS");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
@ -88,7 +88,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
|
|
||||||
if (wndconfig->clientAPI == GLFW_OPENGL_ES_API)
|
if (wndconfig->clientAPI == GLFW_OPENGL_ES_API)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_VERSION_UNAVAILABLE,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"NSOpenGL: This API does not support OpenGL ES");
|
"NSOpenGL: This API does not support OpenGL ES");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
@ -98,7 +98,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
if (wndconfig->glMajor > 3 ||
|
if (wndconfig->glMajor > 3 ||
|
||||||
(wndconfig->glMajor == 3 && wndconfig->glMinor != 2))
|
(wndconfig->glMajor == 3 && wndconfig->glMinor != 2))
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_VERSION_UNAVAILABLE,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"NSOpenGL: The targeted version of Mac OS X does not "
|
"NSOpenGL: The targeted version of Mac OS X does not "
|
||||||
"support any OpenGL version above 2.1 except 3.2");
|
"support any OpenGL version above 2.1 except 3.2");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
@ -108,7 +108,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
{
|
{
|
||||||
if (!wndconfig->glForward)
|
if (!wndconfig->glForward)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_VERSION_UNAVAILABLE,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"NSOpenGL: The targeted version of Mac OS X only "
|
"NSOpenGL: The targeted version of Mac OS X only "
|
||||||
"supports OpenGL 3.2 contexts if they are "
|
"supports OpenGL 3.2 contexts if they are "
|
||||||
"forward-compatible");
|
"forward-compatible");
|
||||||
@ -117,7 +117,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
|
|
||||||
if (wndconfig->glProfile != GLFW_OPENGL_CORE_PROFILE)
|
if (wndconfig->glProfile != GLFW_OPENGL_CORE_PROFILE)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_VERSION_UNAVAILABLE,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"NSOpenGL: The targeted version of Mac OS X only "
|
"NSOpenGL: The targeted version of Mac OS X only "
|
||||||
"supports OpenGL 3.2 contexts if they use the "
|
"supports OpenGL 3.2 contexts if they use the "
|
||||||
"core profile");
|
"core profile");
|
||||||
@ -128,7 +128,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
// Fail if OpenGL 3.0 or above was requested
|
// Fail if OpenGL 3.0 or above was requested
|
||||||
if (wndconfig->glMajor > 2)
|
if (wndconfig->glMajor > 2)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_VERSION_UNAVAILABLE,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"NSOpenGL: The targeted version of Mac OS X does not "
|
"NSOpenGL: The targeted version of Mac OS X does not "
|
||||||
"support OpenGL version 3.0 or above");
|
"support OpenGL version 3.0 or above");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
@ -138,7 +138,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
// Fail if a robustness strategy was requested
|
// Fail if a robustness strategy was requested
|
||||||
if (wndconfig->glRobustness)
|
if (wndconfig->glRobustness)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_VERSION_UNAVAILABLE,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"NSOpenGL: Mac OS X does not support OpenGL robustness "
|
"NSOpenGL: Mac OS X does not support OpenGL robustness "
|
||||||
"strategies");
|
"strategies");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
@ -205,7 +205,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
[[NSOpenGLPixelFormat alloc] initWithAttributes:attributes];
|
[[NSOpenGLPixelFormat alloc] initWithAttributes:attributes];
|
||||||
if (window->NSGL.pixelFormat == nil)
|
if (window->NSGL.pixelFormat == nil)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"NSOpenGL: Failed to create OpenGL pixel format");
|
"NSOpenGL: Failed to create OpenGL pixel format");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
@ -220,7 +220,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
shareContext:share];
|
shareContext:share];
|
||||||
if (window->NSGL.context == nil)
|
if (window->NSGL.context == nil)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"NSOpenGL: Failed to create OpenGL context");
|
"NSOpenGL: Failed to create OpenGL context");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ GLFWAPI double glfwGetTime(void)
|
|||||||
{
|
{
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ GLFWAPI void glfwSetTime(double time)
|
|||||||
{
|
{
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,14 +193,14 @@ static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window, unsigned int* found)
|
|||||||
|
|
||||||
if (!available)
|
if (!available)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_API_UNAVAILABLE, "WGL: No pixel formats found");
|
_glfwInputError(GLFW_API_UNAVAILABLE, "WGL: No pixel formats found");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
fbconfigs = (_GLFWfbconfig*) malloc(sizeof(_GLFWfbconfig) * available);
|
fbconfigs = (_GLFWfbconfig*) malloc(sizeof(_GLFWfbconfig) * available);
|
||||||
if (!fbconfigs)
|
if (!fbconfigs)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_OUT_OF_MEMORY, NULL);
|
_glfwInputError(GLFW_OUT_OF_MEMORY, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -314,7 +314,7 @@ static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window, unsigned int* found)
|
|||||||
|
|
||||||
if (*found == 0)
|
if (*found == 0)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Win32/WGL: No usable pixel formats found");
|
"Win32/WGL: No usable pixel formats found");
|
||||||
|
|
||||||
free(fbconfigs);
|
free(fbconfigs);
|
||||||
@ -346,14 +346,15 @@ static GLboolean createContext(_GLFWwindow* window,
|
|||||||
|
|
||||||
if (!DescribePixelFormat(window->WGL.DC, pixelFormat, sizeof(pfd), &pfd))
|
if (!DescribePixelFormat(window->WGL.DC, pixelFormat, sizeof(pfd), &pfd))
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Win32: Failed to retrieve PFD for selected pixel format");
|
"Win32: Failed to retrieve PFD for selected pixel "
|
||||||
|
"format");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SetPixelFormat(window->WGL.DC, pixelFormat, &pfd))
|
if (!SetPixelFormat(window->WGL.DC, pixelFormat, &pfd))
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Win32: Failed to set selected pixel format");
|
"Win32: Failed to set selected pixel format");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
@ -416,7 +417,7 @@ static GLboolean createContext(_GLFWwindow* window,
|
|||||||
attribs);
|
attribs);
|
||||||
if (!window->WGL.context)
|
if (!window->WGL.context)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_VERSION_UNAVAILABLE,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"WGL: Failed to create OpenGL context");
|
"WGL: Failed to create OpenGL context");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
@ -426,7 +427,7 @@ static GLboolean createContext(_GLFWwindow* window,
|
|||||||
window->WGL.context = wglCreateContext(window->WGL.DC);
|
window->WGL.context = wglCreateContext(window->WGL.DC);
|
||||||
if (!window->WGL.context)
|
if (!window->WGL.context)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"WGL: Failed to create OpenGL context");
|
"WGL: Failed to create OpenGL context");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
@ -435,7 +436,7 @@ static GLboolean createContext(_GLFWwindow* window,
|
|||||||
{
|
{
|
||||||
if (!wglShareLists(share, window->WGL.context))
|
if (!wglShareLists(share, window->WGL.context))
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"WGL: Failed to enable sharing with specified "
|
"WGL: Failed to enable sharing with specified "
|
||||||
"OpenGL context");
|
"OpenGL context");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
@ -469,7 +470,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
window->WGL.DC = GetDC(window->Win32.handle);
|
window->WGL.DC = GetDC(window->Win32.handle);
|
||||||
if (!window->WGL.DC)
|
if (!window->WGL.DC)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Win32: Failed to retrieve DC for window");
|
"Win32: Failed to retrieve DC for window");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
@ -487,7 +488,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
result = _glfwChooseFBConfig(fbconfig, fbconfigs, fbcount);
|
result = _glfwChooseFBConfig(fbconfig, fbconfigs, fbcount);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_FORMAT_UNAVAILABLE,
|
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
|
||||||
"Win32/WGL: No pixel format matched the criteria");
|
"Win32/WGL: No pixel format matched the criteria");
|
||||||
|
|
||||||
free(fbconfigs);
|
free(fbconfigs);
|
||||||
@ -538,7 +539,7 @@ int _glfwAnalyzeContext(const _GLFWwindow* window,
|
|||||||
{
|
{
|
||||||
if (!window->WGL.ARB_create_context)
|
if (!window->WGL.ARB_create_context)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_VERSION_UNAVAILABLE,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"WGL: A forward compatible OpenGL context "
|
"WGL: A forward compatible OpenGL context "
|
||||||
"requested but WGL_ARB_create_context is "
|
"requested but WGL_ARB_create_context is "
|
||||||
"unavailable");
|
"unavailable");
|
||||||
@ -552,7 +553,7 @@ int _glfwAnalyzeContext(const _GLFWwindow* window,
|
|||||||
{
|
{
|
||||||
if (!window->WGL.ARB_create_context_profile)
|
if (!window->WGL.ARB_create_context_profile)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_VERSION_UNAVAILABLE,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"WGL: OpenGL profile requested but "
|
"WGL: OpenGL profile requested but "
|
||||||
"WGL_ARB_create_context_profile is unavailable");
|
"WGL_ARB_create_context_profile is unavailable");
|
||||||
return _GLFW_RECREATION_IMPOSSIBLE;
|
return _GLFW_RECREATION_IMPOSSIBLE;
|
||||||
@ -567,7 +568,7 @@ int _glfwAnalyzeContext(const _GLFWwindow* window,
|
|||||||
!window->WGL.ARB_create_context_profile ||
|
!window->WGL.ARB_create_context_profile ||
|
||||||
!window->WGL.EXT_create_context_es2_profile)
|
!window->WGL.EXT_create_context_es2_profile)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_VERSION_UNAVAILABLE,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"WGL: OpenGL ES requested but "
|
"WGL: OpenGL ES requested but "
|
||||||
"WGL_ARB_create_context_es2_profile is unavailable");
|
"WGL_ARB_create_context_es2_profile is unavailable");
|
||||||
return _GLFW_RECREATION_IMPOSSIBLE;
|
return _GLFW_RECREATION_IMPOSSIBLE;
|
||||||
|
@ -52,7 +52,7 @@ void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string)
|
|||||||
wideString = _glfwCreateWideStringFromUTF8(string);
|
wideString = _glfwCreateWideStringFromUTF8(string);
|
||||||
if (!wideString)
|
if (!wideString)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Win32: Failed to convert clipboard string to "
|
"Win32: Failed to convert clipboard string to "
|
||||||
"wide string");
|
"wide string");
|
||||||
return;
|
return;
|
||||||
@ -65,7 +65,7 @@ void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string)
|
|||||||
{
|
{
|
||||||
free(wideString);
|
free(wideString);
|
||||||
|
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Win32: Failed to allocate global handle for clipboard");
|
"Win32: Failed to allocate global handle for clipboard");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -78,8 +78,7 @@ void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string)
|
|||||||
GlobalFree(stringHandle);
|
GlobalFree(stringHandle);
|
||||||
free(wideString);
|
free(wideString);
|
||||||
|
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to open clipboard");
|
||||||
"Win32: Failed to open clipboard");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,14 +100,13 @@ const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
|
|||||||
|
|
||||||
if (!IsClipboardFormatAvailable(CF_UNICODETEXT))
|
if (!IsClipboardFormatAvailable(CF_UNICODETEXT))
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_FORMAT_UNAVAILABLE, NULL);
|
_glfwInputError(GLFW_FORMAT_UNAVAILABLE, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!OpenClipboard(window->Win32.handle))
|
if (!OpenClipboard(window->Win32.handle))
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to open clipboard");
|
||||||
"Win32: Failed to open clipboard");
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,7 +115,7 @@ const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
|
|||||||
{
|
{
|
||||||
CloseClipboard();
|
CloseClipboard();
|
||||||
|
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Win32: Failed to retrieve clipboard data");
|
"Win32: Failed to retrieve clipboard data");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -131,7 +129,7 @@ const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
|
|||||||
|
|
||||||
if (!_glfwLibrary.Win32.clipboardString)
|
if (!_glfwLibrary.Win32.clipboardString)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Win32: Failed to convert wide string to UTF-8");
|
"Win32: Failed to convert wide string to UTF-8");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -326,7 +326,7 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
|
|||||||
{
|
{
|
||||||
free(result);
|
free(result);
|
||||||
|
|
||||||
_glfwSetError(GLFW_OUT_OF_MEMORY, NULL);
|
_glfwInputError(GLFW_OUT_OF_MEMORY, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ GLFWAPI HWND glfwGetWin32Window(GLFWwindow handle)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow handle)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -712,7 +712,7 @@ static ATOM registerWindowClass(void)
|
|||||||
classAtom = RegisterClass(&wc);
|
classAtom = RegisterClass(&wc);
|
||||||
if (!classAtom)
|
if (!classAtom)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Win32: Failed to register window class");
|
"Win32: Failed to register window class");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -793,7 +793,7 @@ static int createWindow(_GLFWwindow* window,
|
|||||||
wideTitle = _glfwCreateWideStringFromUTF8(wndconfig->title);
|
wideTitle = _glfwCreateWideStringFromUTF8(wndconfig->title);
|
||||||
if (!wideTitle)
|
if (!wideTitle)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Win32: Failed to convert title to wide string");
|
"Win32: Failed to convert title to wide string");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
@ -812,7 +812,7 @@ static int createWindow(_GLFWwindow* window,
|
|||||||
|
|
||||||
if (!window->Win32.handle)
|
if (!window->Win32.handle)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR, "Win32: Failed to create window");
|
_glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to create window");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -971,7 +971,7 @@ void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
|
|||||||
WCHAR* wideTitle = _glfwCreateWideStringFromUTF8(title);
|
WCHAR* wideTitle = _glfwCreateWideStringFromUTF8(title);
|
||||||
if (!wideTitle)
|
if (!wideTitle)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Win32: Failed to convert title to wide string");
|
"Win32: Failed to convert title to wide string");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
58
src/window.c
58
src/window.c
@ -217,7 +217,7 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,14 +265,14 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
|
|||||||
|
|
||||||
if (width <= 0 || height <= 0)
|
if (width <= 0 || height <= 0)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_INVALID_VALUE, "Invalid window size");
|
_glfwInputError(GLFW_INVALID_VALUE, "Invalid window size");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
window = (_GLFWwindow*) calloc(1, sizeof(_GLFWwindow));
|
window = (_GLFWwindow*) calloc(1, sizeof(_GLFWwindow));
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_OUT_OF_MEMORY, NULL);
|
_glfwInputError(GLFW_OUT_OF_MEMORY, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -340,7 +340,7 @@ void glfwDefaultWindowHints(void)
|
|||||||
{
|
{
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -376,7 +376,7 @@ GLFWAPI void glfwWindowHint(int target, int hint)
|
|||||||
{
|
{
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -430,7 +430,7 @@ GLFWAPI void glfwWindowHint(int target, int hint)
|
|||||||
case GLFW_POSITION_Y:
|
case GLFW_POSITION_Y:
|
||||||
_glfwLibrary.hints.positionY = hint;
|
_glfwLibrary.hints.positionY = hint;
|
||||||
break;
|
break;
|
||||||
case GLFW_FSAA_SAMPLES:
|
case GLFW_SAMPLES:
|
||||||
_glfwLibrary.hints.samples = hint;
|
_glfwLibrary.hints.samples = hint;
|
||||||
break;
|
break;
|
||||||
case GLFW_SRGB_CAPABLE:
|
case GLFW_SRGB_CAPABLE:
|
||||||
@ -458,7 +458,7 @@ GLFWAPI void glfwWindowHint(int target, int hint)
|
|||||||
_glfwLibrary.hints.glProfile = hint;
|
_glfwLibrary.hints.glProfile = hint;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
_glfwSetError(GLFW_INVALID_ENUM, NULL);
|
_glfwInputError(GLFW_INVALID_ENUM, NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -474,7 +474,7 @@ GLFWAPI void glfwDestroyWindow(GLFWwindow handle)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -531,7 +531,7 @@ GLFWAPI void glfwSetWindowTitle(GLFWwindow handle, const char* title)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -549,7 +549,7 @@ GLFWAPI void glfwGetWindowSize(GLFWwindow handle, int* width, int* height)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -571,7 +571,7 @@ GLFWAPI void glfwSetWindowSize(GLFWwindow handle, int width, int height)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -599,7 +599,7 @@ GLFWAPI void glfwIconifyWindow(GLFWwindow handle)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -620,7 +620,7 @@ GLFWAPI void glfwRestoreWindow(GLFWwindow handle)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -641,7 +641,7 @@ GLFWAPI void glfwShowWindow(GLFWwindow handle)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -662,7 +662,7 @@ GLFWAPI void glfwHideWindow(GLFWwindow handle)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -683,7 +683,7 @@ GLFWAPI int glfwGetWindowParam(GLFWwindow handle, int param)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -693,7 +693,7 @@ GLFWAPI int glfwGetWindowParam(GLFWwindow handle, int param)
|
|||||||
return window == _glfwLibrary.focusedWindow;
|
return window == _glfwLibrary.focusedWindow;
|
||||||
case GLFW_ICONIFIED:
|
case GLFW_ICONIFIED:
|
||||||
return window->iconified;
|
return window->iconified;
|
||||||
case GLFW_CLOSE_REQUESTED:
|
case GLFW_SHOULD_CLOSE:
|
||||||
return window->closeRequested;
|
return window->closeRequested;
|
||||||
case GLFW_RESIZABLE:
|
case GLFW_RESIZABLE:
|
||||||
return window->resizable;
|
return window->resizable;
|
||||||
@ -721,7 +721,7 @@ GLFWAPI int glfwGetWindowParam(GLFWwindow handle, int param)
|
|||||||
return window->glProfile;
|
return window->glProfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfwSetError(GLFW_INVALID_ENUM, NULL);
|
_glfwInputError(GLFW_INVALID_ENUM, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -736,7 +736,7 @@ GLFWAPI GLFWmonitor glfwGetWindowMonitor(GLFWwindow handle)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -754,7 +754,7 @@ GLFWAPI void glfwSetWindowUserPointer(GLFWwindow handle, void* pointer)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -772,7 +772,7 @@ GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow handle)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -790,7 +790,7 @@ GLFWAPI void glfwSetWindowPosCallback(GLFWwindow handle, GLFWwindowposfun cbfun)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -808,7 +808,7 @@ GLFWAPI void glfwSetWindowSizeCallback(GLFWwindow handle, GLFWwindowsizefun cbfu
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -826,7 +826,7 @@ GLFWAPI void glfwSetWindowCloseCallback(GLFWwindow handle, GLFWwindowclosefun cb
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -844,7 +844,7 @@ GLFWAPI void glfwSetWindowRefreshCallback(GLFWwindow handle, GLFWwindowrefreshfu
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -862,7 +862,7 @@ GLFWAPI void glfwSetWindowFocusCallback(GLFWwindow handle, GLFWwindowfocusfun cb
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -880,7 +880,7 @@ GLFWAPI void glfwSetWindowIconifyCallback(GLFWwindow handle, GLFWwindowiconifyfu
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -896,7 +896,7 @@ GLFWAPI void glfwPollEvents(void)
|
|||||||
{
|
{
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -914,7 +914,7 @@ GLFWAPI void glfwWaitEvents(void)
|
|||||||
{
|
{
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
|
|||||||
|
|
||||||
if (_glfwLibrary.X11.selection.status == _GLFW_CONVERSION_FAILED)
|
if (_glfwLibrary.X11.selection.status == _GLFW_CONVERSION_FAILED)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_FORMAT_UNAVAILABLE,
|
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
|
||||||
"X11: Failed to convert selection to string");
|
"X11: Failed to convert selection to string");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ void _glfwPlatformGetGammaRamp(GLFWgammaramp* ramp)
|
|||||||
// For now, don't support anything that is not GLFW_GAMMA_RAMP_SIZE
|
// For now, don't support anything that is not GLFW_GAMMA_RAMP_SIZE
|
||||||
if (_glfwLibrary.originalRampSize != GLFW_GAMMA_RAMP_SIZE)
|
if (_glfwLibrary.originalRampSize != GLFW_GAMMA_RAMP_SIZE)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"X11: Failed to get gamma ramp due to size "
|
"X11: Failed to get gamma ramp due to size "
|
||||||
"incompatibility");
|
"incompatibility");
|
||||||
return;
|
return;
|
||||||
@ -165,7 +165,7 @@ void _glfwPlatformSetGammaRamp(const GLFWgammaramp* ramp)
|
|||||||
// For now, don't support anything that is not GLFW_GAMMA_RAMP_SIZE
|
// For now, don't support anything that is not GLFW_GAMMA_RAMP_SIZE
|
||||||
if (_glfwLibrary.originalRampSize != GLFW_GAMMA_RAMP_SIZE)
|
if (_glfwLibrary.originalRampSize != GLFW_GAMMA_RAMP_SIZE)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"X11: Failed to set gamma ramp due to size "
|
"X11: Failed to set gamma ramp due to size "
|
||||||
"incompatibility");
|
"incompatibility");
|
||||||
return;
|
return;
|
||||||
|
@ -491,7 +491,7 @@ static GLboolean initDisplay(void)
|
|||||||
_glfwLibrary.X11.display = XOpenDisplay(NULL);
|
_glfwLibrary.X11.display = XOpenDisplay(NULL);
|
||||||
if (!_glfwLibrary.X11.display)
|
if (!_glfwLibrary.X11.display)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_API_UNAVAILABLE, "X11: Failed to open X display");
|
_glfwInputError(GLFW_API_UNAVAILABLE, "X11: Failed to open X display");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -524,7 +524,7 @@ static GLboolean initDisplay(void)
|
|||||||
&_glfwLibrary.X11.RandR.majorVersion,
|
&_glfwLibrary.X11.RandR.majorVersion,
|
||||||
&_glfwLibrary.X11.RandR.minorVersion))
|
&_glfwLibrary.X11.RandR.minorVersion))
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"X11: Failed to query RandR version");
|
"X11: Failed to query RandR version");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ static int openJoystickDevice(int joy, const char* path)
|
|||||||
{
|
{
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
_glfwSetError(GLFW_OUT_OF_MEMORY, NULL);
|
_glfwInputError(GLFW_OUT_OF_MEMORY, NULL);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ static int openJoystickDevice(int joy, const char* path)
|
|||||||
free(_glfwLibrary.X11.joystick[joy].axis);
|
free(_glfwLibrary.X11.joystick[joy].axis);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
_glfwSetError(GLFW_OUT_OF_MEMORY, NULL);
|
_glfwInputError(GLFW_OUT_OF_MEMORY, NULL);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,7 +193,7 @@ int _glfwInitJoysticks(void)
|
|||||||
|
|
||||||
if (regcomp(®ex, "^js[0-9]\\+$", 0) != 0)
|
if (regcomp(®ex, "^js[0-9]\\+$", 0) != 0)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR, "X11: Failed to compile regex");
|
_glfwInputError(GLFW_PLATFORM_ERROR, "X11: Failed to compile regex");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,7 +280,7 @@ int _glfwPlatformGetJoystickParam(int joy, int param)
|
|||||||
return _glfwLibrary.X11.joystick[joy].numButtons;
|
return _glfwLibrary.X11.joystick[joy].numButtons;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
_glfwSetError(GLFW_INVALID_ENUM, NULL);
|
_glfwInputError(GLFW_INVALID_ENUM, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -219,7 +219,7 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
|||||||
{
|
{
|
||||||
XRRFreeScreenResources(sr);
|
XRRFreeScreenResources(sr);
|
||||||
|
|
||||||
_glfwSetError(GLFW_OUT_OF_MEMORY, NULL);
|
_glfwInputError(GLFW_OUT_OF_MEMORY, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,7 +319,7 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
|
|||||||
result = (GLFWvidmode*) malloc(sizeof(GLFWvidmode) * count);
|
result = (GLFWvidmode*) malloc(sizeof(GLFWvidmode) * count);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_OUT_OF_MEMORY, NULL);
|
_glfwInputError(GLFW_OUT_OF_MEMORY, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -373,7 +373,7 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
|
|||||||
result = (GLFWvidmode*) malloc(sizeof(GLFWvidmode));
|
result = (GLFWvidmode*) malloc(sizeof(GLFWvidmode));
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_OUT_OF_MEMORY, NULL);
|
_glfwInputError(GLFW_OUT_OF_MEMORY, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -406,7 +406,7 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
|
|||||||
_glfwLibrary.X11.root);
|
_glfwLibrary.X11.root);
|
||||||
if (!sr)
|
if (!sr)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"X11: Failed to retrieve RandR screen resources");
|
"X11: Failed to retrieve RandR screen resources");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -417,7 +417,7 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
|
|||||||
{
|
{
|
||||||
XRRFreeScreenResources(sr);
|
XRRFreeScreenResources(sr);
|
||||||
|
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"X11: Failed to retrieve RandR crtc info");
|
"X11: Failed to retrieve RandR crtc info");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ GLFWAPI Window glfwGetX11Window(GLFWwindow handle)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow handle)
|
|||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ static GLboolean createWindow(_GLFWwindow* window,
|
|||||||
// TODO: Handle all the various error codes here and translate them
|
// TODO: Handle all the various error codes here and translate them
|
||||||
// to GLFW errors
|
// to GLFW errors
|
||||||
|
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR, "X11: Failed to create window");
|
_glfwInputError(GLFW_PLATFORM_ERROR, "X11: Failed to create window");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,7 +197,7 @@ static GLboolean createWindow(_GLFWwindow* window,
|
|||||||
XWMHints* hints = XAllocWMHints();
|
XWMHints* hints = XAllocWMHints();
|
||||||
if (!hints)
|
if (!hints)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_OUT_OF_MEMORY,
|
_glfwInputError(GLFW_OUT_OF_MEMORY,
|
||||||
"X11: Failed to allocate WM hints");
|
"X11: Failed to allocate WM hints");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
@ -214,7 +214,7 @@ static GLboolean createWindow(_GLFWwindow* window,
|
|||||||
XSizeHints* hints = XAllocSizeHints();
|
XSizeHints* hints = XAllocSizeHints();
|
||||||
if (!hints)
|
if (!hints)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_OUT_OF_MEMORY,
|
_glfwInputError(GLFW_OUT_OF_MEMORY,
|
||||||
"X11: Failed to allocate size hints");
|
"X11: Failed to allocate size hints");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ int main(void)
|
|||||||
|
|
||||||
set_swap_interval(window, swap_interval);
|
set_swap_interval(window, swap_interval);
|
||||||
|
|
||||||
while (!glfwGetWindowParam(window, GLFW_CLOSE_REQUESTED))
|
while (!glfwGetWindowParam(window, GLFW_SHOULD_CLOSE))
|
||||||
{
|
{
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
@ -414,7 +414,7 @@ int main(void)
|
|||||||
|
|
||||||
printf("Main loop starting\n");
|
printf("Main loop starting\n");
|
||||||
|
|
||||||
while (!glfwGetWindowParam(window, GLFW_CLOSE_REQUESTED))
|
while (!glfwGetWindowParam(window, GLFW_SHOULD_CLOSE))
|
||||||
glfwWaitEvents();
|
glfwWaitEvents();
|
||||||
|
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
|
@ -97,7 +97,7 @@ int main(int argc, char** argv)
|
|||||||
else
|
else
|
||||||
printf("Requesting that FSAA not be available\n");
|
printf("Requesting that FSAA not be available\n");
|
||||||
|
|
||||||
glfwWindowHint(GLFW_FSAA_SAMPLES, samples);
|
glfwWindowHint(GLFW_SAMPLES, samples);
|
||||||
|
|
||||||
window = glfwCreateWindow(800, 400, "Aliasing Detector", NULL, NULL);
|
window = glfwCreateWindow(800, 400, "Aliasing Detector", NULL, NULL);
|
||||||
if (!window)
|
if (!window)
|
||||||
@ -128,7 +128,7 @@ int main(int argc, char** argv)
|
|||||||
gluOrtho2D(0.f, 1.f, 0.f, 0.5f);
|
gluOrtho2D(0.f, 1.f, 0.f, 0.5f);
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
|
||||||
while (!glfwGetWindowParam(window, GLFW_CLOSE_REQUESTED))
|
while (!glfwGetWindowParam(window, GLFW_SHOULD_CLOSE))
|
||||||
{
|
{
|
||||||
GLfloat time = (GLfloat) glfwGetTime();
|
GLfloat time = (GLfloat) glfwGetTime();
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ int main(void)
|
|||||||
glfwMakeContextCurrent(window);
|
glfwMakeContextCurrent(window);
|
||||||
glfwSwapInterval(1);
|
glfwSwapInterval(1);
|
||||||
|
|
||||||
while (!glfwGetWindowParam(window, GLFW_CLOSE_REQUESTED))
|
while (!glfwGetWindowParam(window, GLFW_SHOULD_CLOSE))
|
||||||
{
|
{
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ int main(void)
|
|||||||
|
|
||||||
glClearColor(0.f, 0.f, 0.f, 0.f);
|
glClearColor(0.f, 0.f, 0.f, 0.f);
|
||||||
|
|
||||||
while (!glfwGetWindowParam(window_handle, GLFW_CLOSE_REQUESTED))
|
while (!glfwGetWindowParam(window_handle, GLFW_SHOULD_CLOSE))
|
||||||
{
|
{
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ int main(void)
|
|||||||
glOrtho(-1.f, 1.f, -1.f, 1.f, 1.f, -1.f);
|
glOrtho(-1.f, 1.f, -1.f, 1.f, 1.f, -1.f);
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
|
||||||
while (!glfwGetWindowParam(window, GLFW_CLOSE_REQUESTED))
|
while (!glfwGetWindowParam(window, GLFW_SHOULD_CLOSE))
|
||||||
{
|
{
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ int main(void)
|
|||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
if (glfwGetWindowParam(threads[i].window, GLFW_CLOSE_REQUESTED))
|
if (glfwGetWindowParam(threads[i].window, GLFW_SHOULD_CLOSE))
|
||||||
running = GL_FALSE;
|
running = GL_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ int main(void)
|
|||||||
|
|
||||||
glfwSetWindowSizeCallback(window, window_size_callback);
|
glfwSetWindowSizeCallback(window, window_size_callback);
|
||||||
|
|
||||||
while (!glfwGetWindowParam(window, GLFW_CLOSE_REQUESTED))
|
while (!glfwGetWindowParam(window, GLFW_SHOULD_CLOSE))
|
||||||
{
|
{
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
glfwSwapBuffers(window);
|
glfwSwapBuffers(window);
|
||||||
|
@ -82,7 +82,7 @@ int main(void)
|
|||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
glfwSwapBuffers(windows[i]);
|
glfwSwapBuffers(windows[i]);
|
||||||
|
|
||||||
if (glfwGetWindowParam(windows[i], GLFW_CLOSE_REQUESTED))
|
if (glfwGetWindowParam(windows[i], GLFW_SHOULD_CLOSE))
|
||||||
running = GL_FALSE;
|
running = GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user