mirror of
https://github.com/glfw/glfw.git
synced 2024-11-25 22:14:34 +00:00
Various error fixes.
Fixed incorrect error types. Added missing error string prefixes. Removed some invalid or superfluous error emissions. Clarified some error strings. Joined error string lines to aid grep. Replaced some generic error strings with specific ones. Documentation work. Fixes #450.
This commit is contained in:
parent
a75e43ef22
commit
d493a82f9e
@ -110,6 +110,10 @@ have been generated specifically for that error. This lets GLFW provide much
|
|||||||
more specific error descriptions but means you must make a copy if you want to
|
more specific error descriptions but means you must make a copy if you want to
|
||||||
keep the description string.
|
keep the description string.
|
||||||
|
|
||||||
|
@note Relying on erroneous behavior is not forward compatible. In other words,
|
||||||
|
do not rely on a currently invalid call to generate a specific error, as that
|
||||||
|
same call may in future versions generate a different error or become valid.
|
||||||
|
|
||||||
|
|
||||||
@section coordinate_systems Coordinate systems
|
@section coordinate_systems Coordinate systems
|
||||||
|
|
||||||
|
@ -520,7 +520,9 @@ extern "C" {
|
|||||||
/*! @brief GLFW could not find support for the requested client API on the
|
/*! @brief GLFW could not find support for the requested client API on the
|
||||||
* system.
|
* system.
|
||||||
*
|
*
|
||||||
* GLFW could not find support for the requested client API on the system.
|
* GLFW could not find support for the requested client API on the system. If
|
||||||
|
* emitted by functions other than @ref glfwCreateWindow, no supported client
|
||||||
|
* API was found.
|
||||||
*
|
*
|
||||||
* @par Analysis
|
* @par Analysis
|
||||||
* The installed graphics driver does not support the requested client API, or
|
* The installed graphics driver does not support the requested client API, or
|
||||||
@ -537,8 +539,8 @@ extern "C" {
|
|||||||
#define GLFW_API_UNAVAILABLE 0x00010006
|
#define GLFW_API_UNAVAILABLE 0x00010006
|
||||||
/*! @brief The requested OpenGL or OpenGL ES version is not available.
|
/*! @brief The requested OpenGL or OpenGL ES version is not available.
|
||||||
*
|
*
|
||||||
* The requested OpenGL or OpenGL ES version (including any requested profile
|
* The requested OpenGL or OpenGL ES version (including any requested context
|
||||||
* or context option) is not available on this machine.
|
* or framebuffer hints) is not available on this machine.
|
||||||
*
|
*
|
||||||
* @par Analysis
|
* @par Analysis
|
||||||
* The machine does not support your requirements. If your application is
|
* The machine does not support your requirements. If your application is
|
||||||
@ -560,7 +562,8 @@ extern "C" {
|
|||||||
* specific categories.
|
* specific categories.
|
||||||
*
|
*
|
||||||
* @par Analysis
|
* @par Analysis
|
||||||
* A bug in GLFW or the underlying operating system. Report the bug to our
|
* A bug or configuration error in GLFW, the underlying operating system or
|
||||||
|
* its drivers, or a lack of required resources. Report the issue to our
|
||||||
* [issue tracker](https://github.com/glfw/glfw/issues).
|
* [issue tracker](https://github.com/glfw/glfw/issues).
|
||||||
*/
|
*/
|
||||||
#define GLFW_PLATFORM_ERROR 0x00010008
|
#define GLFW_PLATFORM_ERROR 0x00010008
|
||||||
|
@ -57,7 +57,8 @@ static char* getDisplayName(CGDirectDisplayID displayID)
|
|||||||
(const void**) &value))
|
(const void**) &value))
|
||||||
{
|
{
|
||||||
// This may happen if a desktop Mac is running headless
|
// This may happen if a desktop Mac is running headless
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR, "Failed to retrieve display name");
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Cocoa: Failed to retrieve display name");
|
||||||
|
|
||||||
CFRelease(info);
|
CFRelease(info);
|
||||||
return strdup("Unknown");
|
return strdup("Unknown");
|
||||||
|
@ -1211,7 +1211,8 @@ int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
|
|||||||
cursor->ns.object = getStandardCursor(shape);
|
cursor->ns.object = getStandardCursor(shape);
|
||||||
if (!cursor->ns.object)
|
if (!cursor->ns.object)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_ENUM, "Cocoa: Invalid standard cursor");
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Cocoa: Failed to retrieve standard cursor");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1255,7 +1256,8 @@ const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
|
|||||||
|
|
||||||
if (![[pasteboard types] containsObject:NSStringPboardType])
|
if (![[pasteboard types] containsObject:NSStringPboardType])
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_FORMAT_UNAVAILABLE, NULL);
|
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
|
||||||
|
"Cocoa: Failed to retrieve string from pasteboard");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ GLboolean _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig)
|
|||||||
if (ctxconfig->api != GLFW_OPENGL_API &&
|
if (ctxconfig->api != GLFW_OPENGL_API &&
|
||||||
ctxconfig->api != GLFW_OPENGL_ES_API)
|
ctxconfig->api != GLFW_OPENGL_ES_API)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_ENUM, "Invalid client API requested");
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid client API");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ GLboolean _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig)
|
|||||||
// For now, let everything else through
|
// For now, let everything else through
|
||||||
|
|
||||||
_glfwInputError(GLFW_INVALID_VALUE,
|
_glfwInputError(GLFW_INVALID_VALUE,
|
||||||
"Invalid OpenGL version %i.%i requested",
|
"Invalid OpenGL version %i.%i",
|
||||||
ctxconfig->major, ctxconfig->minor);
|
ctxconfig->major, ctxconfig->minor);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
@ -118,7 +118,7 @@ GLboolean _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig)
|
|||||||
ctxconfig->profile != GLFW_OPENGL_COMPAT_PROFILE)
|
ctxconfig->profile != GLFW_OPENGL_COMPAT_PROFILE)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_ENUM,
|
_glfwInputError(GLFW_INVALID_ENUM,
|
||||||
"Invalid OpenGL profile requested");
|
"Invalid OpenGL profile");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,8 +129,7 @@ GLboolean _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig)
|
|||||||
// and above
|
// and above
|
||||||
|
|
||||||
_glfwInputError(GLFW_INVALID_VALUE,
|
_glfwInputError(GLFW_INVALID_VALUE,
|
||||||
"Context profiles only exist for "
|
"Context profiles are only defined for OpenGL version 3.2 and above");
|
||||||
"OpenGL version 3.2 and above");
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -139,8 +138,7 @@ GLboolean _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig)
|
|||||||
{
|
{
|
||||||
// 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
|
||||||
_glfwInputError(GLFW_INVALID_VALUE,
|
_glfwInputError(GLFW_INVALID_VALUE,
|
||||||
"Forward compatibility only exist for OpenGL "
|
"Forward-compatibility is only defined for OpenGL version 3.0 and above");
|
||||||
"version 3.0 and above");
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -156,7 +154,7 @@ GLboolean _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig)
|
|||||||
// For now, let everything else through
|
// For now, let everything else through
|
||||||
|
|
||||||
_glfwInputError(GLFW_INVALID_VALUE,
|
_glfwInputError(GLFW_INVALID_VALUE,
|
||||||
"Invalid OpenGL ES version %i.%i requested",
|
"Invalid OpenGL ES version %i.%i",
|
||||||
ctxconfig->major, ctxconfig->minor);
|
ctxconfig->major, ctxconfig->minor);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
@ -167,8 +165,8 @@ GLboolean _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig)
|
|||||||
if (ctxconfig->robustness != GLFW_NO_RESET_NOTIFICATION &&
|
if (ctxconfig->robustness != GLFW_NO_RESET_NOTIFICATION &&
|
||||||
ctxconfig->robustness != GLFW_LOSE_CONTEXT_ON_RESET)
|
ctxconfig->robustness != GLFW_LOSE_CONTEXT_ON_RESET)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_VALUE,
|
_glfwInputError(GLFW_INVALID_ENUM,
|
||||||
"Invalid context robustness mode requested");
|
"Invalid context robustness mode");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -178,8 +176,8 @@ GLboolean _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig)
|
|||||||
if (ctxconfig->release != GLFW_RELEASE_BEHAVIOR_NONE &&
|
if (ctxconfig->release != GLFW_RELEASE_BEHAVIOR_NONE &&
|
||||||
ctxconfig->release != GLFW_RELEASE_BEHAVIOR_FLUSH)
|
ctxconfig->release != GLFW_RELEASE_BEHAVIOR_FLUSH)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_VALUE,
|
_glfwInputError(GLFW_INVALID_ENUM,
|
||||||
"Invalid context release behavior requested");
|
"Invalid context release behavior");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,33 +47,25 @@ static const char* getErrorString(EGLint error)
|
|||||||
case EGL_BAD_ALLOC:
|
case EGL_BAD_ALLOC:
|
||||||
return "EGL failed to allocate resources for the requested operation";
|
return "EGL failed to allocate resources for the requested operation";
|
||||||
case EGL_BAD_ATTRIBUTE:
|
case EGL_BAD_ATTRIBUTE:
|
||||||
return "An unrecognized attribute or attribute value was passed "
|
return "An unrecognized attribute or attribute value was passed in the attribute list";
|
||||||
"in the attribute list";
|
|
||||||
case EGL_BAD_CONTEXT:
|
case EGL_BAD_CONTEXT:
|
||||||
return "An EGLContext argument does not name a valid EGL "
|
return "An EGLContext argument does not name a valid EGL rendering context";
|
||||||
"rendering context";
|
|
||||||
case EGL_BAD_CONFIG:
|
case EGL_BAD_CONFIG:
|
||||||
return "An EGLConfig argument does not name a valid EGL frame "
|
return "An EGLConfig argument does not name a valid EGL frame buffer configuration";
|
||||||
"buffer configuration";
|
|
||||||
case EGL_BAD_CURRENT_SURFACE:
|
case EGL_BAD_CURRENT_SURFACE:
|
||||||
return "The current surface of the calling thread is a window, pixel "
|
return "The current surface of the calling thread is a window, pixel buffer or pixmap that is no longer valid";
|
||||||
"buffer or pixmap that is no longer valid";
|
|
||||||
case EGL_BAD_DISPLAY:
|
case EGL_BAD_DISPLAY:
|
||||||
return "An EGLDisplay argument does not name a valid EGL display "
|
return "An EGLDisplay argument does not name a valid EGL display connection";
|
||||||
"connection";
|
|
||||||
case EGL_BAD_SURFACE:
|
case EGL_BAD_SURFACE:
|
||||||
return "An EGLSurface argument does not name a valid surface "
|
return "An EGLSurface argument does not name a valid surface configured for GL rendering";
|
||||||
"configured for GL rendering";
|
|
||||||
case EGL_BAD_MATCH:
|
case EGL_BAD_MATCH:
|
||||||
return "Arguments are inconsistent";
|
return "Arguments are inconsistent";
|
||||||
case EGL_BAD_PARAMETER:
|
case EGL_BAD_PARAMETER:
|
||||||
return "One or more argument values are invalid";
|
return "One or more argument values are invalid";
|
||||||
case EGL_BAD_NATIVE_PIXMAP:
|
case EGL_BAD_NATIVE_PIXMAP:
|
||||||
return "A NativePixmapType argument does not refer to a valid "
|
return "A NativePixmapType argument does not refer to a valid native pixmap";
|
||||||
"native pixmap";
|
|
||||||
case EGL_BAD_NATIVE_WINDOW:
|
case EGL_BAD_NATIVE_WINDOW:
|
||||||
return "A NativeWindowType argument does not refer to a valid "
|
return "A NativeWindowType argument does not refer to a valid native window";
|
||||||
"native window";
|
|
||||||
case EGL_CONTEXT_LOST:
|
case EGL_CONTEXT_LOST:
|
||||||
return "The application must destroy all contexts and reinitialise";
|
return "The application must destroy all contexts and reinitialise";
|
||||||
}
|
}
|
||||||
@ -309,7 +301,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
{
|
{
|
||||||
if (!eglBindAPI(EGL_OPENGL_ES_API))
|
if (!eglBindAPI(EGL_OPENGL_ES_API))
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||||
"EGL: Failed to bind OpenGL ES: %s",
|
"EGL: Failed to bind OpenGL ES: %s",
|
||||||
getErrorString(eglGetError()));
|
getErrorString(eglGetError()));
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
@ -319,7 +311,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
{
|
{
|
||||||
if (!eglBindAPI(EGL_OPENGL_API))
|
if (!eglBindAPI(EGL_OPENGL_API))
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||||
"EGL: Failed to bind OpenGL: %s",
|
"EGL: Failed to bind OpenGL: %s",
|
||||||
getErrorString(eglGetError()));
|
getErrorString(eglGetError()));
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
@ -389,7 +381,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
|
|
||||||
if (window->egl.context == EGL_NO_CONTEXT)
|
if (window->egl.context == EGL_NO_CONTEXT)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"EGL: Failed to create context: %s",
|
"EGL: Failed to create context: %s",
|
||||||
getErrorString(eglGetError()));
|
getErrorString(eglGetError()));
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
@ -175,7 +175,7 @@ int _glfwInitContextAPI(void)
|
|||||||
_glfw.glx.libGL = dlopen("libGL.so.1", RTLD_LAZY | RTLD_GLOBAL);
|
_glfw.glx.libGL = dlopen("libGL.so.1", RTLD_LAZY | RTLD_GLOBAL);
|
||||||
if (!_glfw.glx.libGL)
|
if (!_glfw.glx.libGL)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR, "GLX: Failed to find libGL");
|
_glfwInputError(GLFW_API_UNAVAILABLE, "GLX: Failed to find libGL");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -320,8 +320,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
!_glfw.glx.EXT_create_context_es2_profile)
|
!_glfw.glx.EXT_create_context_es2_profile)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_API_UNAVAILABLE,
|
_glfwInputError(GLFW_API_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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -331,8 +330,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
if (!_glfw.glx.ARB_create_context)
|
if (!_glfw.glx.ARB_create_context)
|
||||||
{
|
{
|
||||||
_glfwInputError(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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -343,8 +341,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
!_glfw.glx.ARB_create_context_profile)
|
!_glfw.glx.ARB_create_context_profile)
|
||||||
{
|
{
|
||||||
_glfwInputError(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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -454,7 +451,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
|
|
||||||
if (!window->glx.context)
|
if (!window->glx.context)
|
||||||
{
|
{
|
||||||
_glfwInputXError(GLFW_PLATFORM_ERROR, "GLX: Failed to create context");
|
_glfwInputXError(GLFW_VERSION_UNAVAILABLE, "GLX: Failed to create context");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
29
src/input.c
29
src/input.c
@ -46,7 +46,7 @@ static void setCursorMode(_GLFWwindow* window, int newMode)
|
|||||||
newMode != GLFW_CURSOR_HIDDEN &&
|
newMode != GLFW_CURSOR_HIDDEN &&
|
||||||
newMode != GLFW_CURSOR_DISABLED)
|
newMode != GLFW_CURSOR_DISABLED)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_ENUM, NULL);
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid cursor mode");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,7 +242,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:
|
||||||
_glfwInputError(GLFW_INVALID_ENUM, NULL);
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid input mode");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -265,7 +265,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:
|
||||||
_glfwInputError(GLFW_INVALID_ENUM, NULL);
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid input mode");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -278,7 +278,7 @@ GLFWAPI int glfwGetKey(GLFWwindow* handle, int key)
|
|||||||
|
|
||||||
if (key < 0 || key > GLFW_KEY_LAST)
|
if (key < 0 || key > GLFW_KEY_LAST)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_ENUM, "The specified key is invalid");
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid key");
|
||||||
return GLFW_RELEASE;
|
return GLFW_RELEASE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -301,7 +301,7 @@ GLFWAPI int glfwGetMouseButton(GLFWwindow* handle, int button)
|
|||||||
if (button < 0 || button > GLFW_MOUSE_BUTTON_LAST)
|
if (button < 0 || button > GLFW_MOUSE_BUTTON_LAST)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_ENUM,
|
_glfwInputError(GLFW_INVALID_ENUM,
|
||||||
"The specified mouse button is invalid");
|
"Invalid mouse button");
|
||||||
return GLFW_RELEASE;
|
return GLFW_RELEASE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -384,6 +384,17 @@ GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape)
|
|||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
|
||||||
|
if (shape != GLFW_ARROW_CURSOR &&
|
||||||
|
shape != GLFW_IBEAM_CURSOR &&
|
||||||
|
shape != GLFW_CROSSHAIR_CURSOR &&
|
||||||
|
shape != GLFW_HAND_CURSOR &&
|
||||||
|
shape != GLFW_HRESIZE_CURSOR &&
|
||||||
|
shape != GLFW_VRESIZE_CURSOR)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid standard cursor");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
cursor = calloc(1, sizeof(_GLFWcursor));
|
cursor = calloc(1, sizeof(_GLFWcursor));
|
||||||
cursor->next = _glfw.cursorListHead;
|
cursor->next = _glfw.cursorListHead;
|
||||||
_glfw.cursorListHead = cursor;
|
_glfw.cursorListHead = cursor;
|
||||||
@ -518,7 +529,7 @@ GLFWAPI int glfwJoystickPresent(int joy)
|
|||||||
|
|
||||||
if (joy < 0 || joy > GLFW_JOYSTICK_LAST)
|
if (joy < 0 || joy > GLFW_JOYSTICK_LAST)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_ENUM, NULL);
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid joystick");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -533,7 +544,7 @@ GLFWAPI const float* glfwGetJoystickAxes(int joy, int* count)
|
|||||||
|
|
||||||
if (joy < 0 || joy > GLFW_JOYSTICK_LAST)
|
if (joy < 0 || joy > GLFW_JOYSTICK_LAST)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_ENUM, NULL);
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid joystick");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -548,7 +559,7 @@ GLFWAPI const unsigned char* glfwGetJoystickButtons(int joy, int* count)
|
|||||||
|
|
||||||
if (joy < 0 || joy > GLFW_JOYSTICK_LAST)
|
if (joy < 0 || joy > GLFW_JOYSTICK_LAST)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_ENUM, NULL);
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid joystick");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -561,7 +572,7 @@ GLFWAPI const char* glfwGetJoystickName(int joy)
|
|||||||
|
|
||||||
if (joy < 0 || joy > GLFW_JOYSTICK_LAST)
|
if (joy < 0 || joy > GLFW_JOYSTICK_LAST)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_ENUM, NULL);
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid joystick");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ int _glfwPlatformInit(void)
|
|||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Mir: Failed to create event mutex: %s\n",
|
"Mir: Failed to create event mutex: %s",
|
||||||
strerror(error));
|
strerror(error));
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -127,12 +127,12 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
|
|||||||
void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
|
void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -470,7 +470,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||||||
if (wndconfig->width > mode.width || wndconfig->height > mode.height)
|
if (wndconfig->width > mode.width || wndconfig->height > mode.height)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Mir: Requested surface size is to large (%i %i)",
|
"Mir: Requested surface size too large: %ix%i",
|
||||||
wndconfig->width, wndconfig->height);
|
wndconfig->width, wndconfig->height);
|
||||||
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
@ -502,13 +502,13 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
|
|||||||
void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
|
void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos)
|
void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window,
|
void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window,
|
||||||
@ -516,19 +516,19 @@ void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window,
|
|||||||
int* right, int* bottom)
|
int* right, int* bottom)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos)
|
void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
|
void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height)
|
void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height)
|
||||||
@ -552,39 +552,39 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window)
|
|||||||
void _glfwPlatformHideWindow(_GLFWwindow* window)
|
void _glfwPlatformHideWindow(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformShowWindow(_GLFWwindow* window)
|
void _glfwPlatformShowWindow(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformUnhideWindow(_GLFWwindow* window)
|
void _glfwPlatformUnhideWindow(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
int _glfwPlatformWindowFocused(_GLFWwindow* window)
|
int _glfwPlatformWindowFocused(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _glfwPlatformWindowIconified(_GLFWwindow* window)
|
int _glfwPlatformWindowIconified(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _glfwPlatformWindowVisible(_GLFWwindow* window)
|
int _glfwPlatformWindowVisible(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -628,7 +628,7 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
|||||||
int xhot, int yhot)
|
int xhot, int yhot)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
@ -636,7 +636,7 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
|||||||
int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
|
int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
@ -644,43 +644,43 @@ int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
|
|||||||
void _glfwPlatformDestroyCursor(_GLFWcursor* cursor)
|
void _glfwPlatformDestroyCursor(_GLFWcursor* cursor)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
|
void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos)
|
void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformSetCursorPos(_GLFWwindow* window, double xpos, double ypos)
|
void _glfwPlatformSetCursorPos(_GLFWwindow* window, double xpos, double ypos)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformApplyCursorMode(_GLFWwindow* window)
|
void _glfwPlatformApplyCursorMode(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string)
|
void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
|
const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ int _glfwInitContextAPI(void)
|
|||||||
CFBundleGetBundleWithIdentifier(CFSTR("com.apple.opengl"));
|
CFBundleGetBundleWithIdentifier(CFSTR("com.apple.opengl"));
|
||||||
if (_glfw.nsgl.framework == NULL)
|
if (_glfw.nsgl.framework == NULL)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||||
"NSGL: Failed to locate OpenGL framework");
|
"NSGL: Failed to locate OpenGL framework");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
@ -76,8 +76,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
if (ctxconfig->major == 3 && ctxconfig->minor < 2)
|
if (ctxconfig->major == 3 && ctxconfig->minor < 2)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"NSGL: The targeted version of OS X does not "
|
"NSGL: The targeted version of OS X does not support OpenGL 3.0 or 3.1");
|
||||||
"support OpenGL 3.0 or 3.1");
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,18 +85,14 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
if (!ctxconfig->forward)
|
if (!ctxconfig->forward)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"NSGL: The targeted version of OS X only "
|
"NSGL: The targeted version of OS X only supports forward-compatible contexts for OpenGL 3.2 and above");
|
||||||
"supports OpenGL 3.2 and later versions if they "
|
|
||||||
"are forward-compatible");
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctxconfig->profile != GLFW_OPENGL_CORE_PROFILE)
|
if (ctxconfig->profile != GLFW_OPENGL_CORE_PROFILE)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"NSGL: The targeted version of OS X only "
|
"NSGL: The targeted version of OS X only supports core profile contexts for OpenGL 3.2 and above");
|
||||||
"supports OpenGL 3.2 and later versions if they "
|
|
||||||
"use the core profile");
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -106,8 +101,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
if (ctxconfig->major > 2)
|
if (ctxconfig->major > 2)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"NSGL: The targeted version of OS X does not "
|
"NSGL: The targeted version of OS X does not support OpenGL version 3.0 or above");
|
||||||
"support OpenGL version 3.0 or above");
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
|
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
|
||||||
@ -232,7 +226,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
shareContext:share];
|
shareContext:share];
|
||||||
if (window->nsgl.context == nil)
|
if (window->nsgl.context == nil)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"NSGL: Failed to create OpenGL context");
|
"NSGL: Failed to create OpenGL context");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -167,12 +167,6 @@ static GLboolean choosePixelFormat(_GLFWwindow* window,
|
|||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!nativeCount)
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_API_UNAVAILABLE, "WGL: No pixel formats found");
|
|
||||||
return GL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
usableConfigs = calloc(nativeCount, sizeof(_GLFWfbconfig));
|
usableConfigs = calloc(nativeCount, sizeof(_GLFWfbconfig));
|
||||||
usableCount = 0;
|
usableCount = 0;
|
||||||
|
|
||||||
@ -325,7 +319,7 @@ int _glfwInitContextAPI(void)
|
|||||||
_glfw.wgl.opengl32.instance = LoadLibraryW(L"opengl32.dll");
|
_glfw.wgl.opengl32.instance = LoadLibraryW(L"opengl32.dll");
|
||||||
if (!_glfw.wgl.opengl32.instance)
|
if (!_glfw.wgl.opengl32.instance)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR, "Failed to load opengl32.dll");
|
_glfwInputError(GLFW_PLATFORM_ERROR, "WGL: Failed to load opengl32.dll");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -367,7 +361,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
if (!window->wgl.dc)
|
if (!window->wgl.dc)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Win32: Failed to retrieve DC for window");
|
"WGL: Failed to retrieve DC for window");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -377,15 +371,14 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
if (!DescribePixelFormat(window->wgl.dc, pixelFormat, sizeof(pfd), &pfd))
|
if (!DescribePixelFormat(window->wgl.dc, pixelFormat, sizeof(pfd), &pfd))
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Win32: Failed to retrieve PFD for selected pixel "
|
"WGL: Failed to retrieve PFD for selected pixel format");
|
||||||
"format");
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SetPixelFormat(window->wgl.dc, pixelFormat, &pfd))
|
if (!SetPixelFormat(window->wgl.dc, pixelFormat, &pfd))
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Win32: Failed to set selected pixel format");
|
"WGL: Failed to set selected pixel format");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -478,7 +471,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
window->wgl.context = wglCreateContext(window->wgl.dc);
|
window->wgl.context = wglCreateContext(window->wgl.dc);
|
||||||
if (!window->wgl.context)
|
if (!window->wgl.context)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"WGL: Failed to create OpenGL context");
|
"WGL: Failed to create OpenGL context");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
@ -488,8 +481,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
if (!wglShareLists(share, window->wgl.context))
|
if (!wglShareLists(share, window->wgl.context))
|
||||||
{
|
{
|
||||||
_glfwInputError(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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -535,9 +527,7 @@ int _glfwAnalyzeContext(const _GLFWwindow* window,
|
|||||||
if (!window->wgl.ARB_create_context)
|
if (!window->wgl.ARB_create_context)
|
||||||
{
|
{
|
||||||
_glfwInputError(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 unavailable");
|
||||||
"requested but WGL_ARB_create_context is "
|
|
||||||
"unavailable");
|
|
||||||
return _GLFW_RECREATION_IMPOSSIBLE;
|
return _GLFW_RECREATION_IMPOSSIBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -549,8 +539,7 @@ int _glfwAnalyzeContext(const _GLFWwindow* window,
|
|||||||
if (!window->wgl.ARB_create_context_profile)
|
if (!window->wgl.ARB_create_context_profile)
|
||||||
{
|
{
|
||||||
_glfwInputError(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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -570,8 +559,7 @@ int _glfwAnalyzeContext(const _GLFWwindow* window,
|
|||||||
!window->wgl.EXT_create_context_es2_profile)
|
!window->wgl.EXT_create_context_es2_profile)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_API_UNAVAILABLE,
|
_glfwInputError(GLFW_API_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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
|||||||
if (!name)
|
if (!name)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Failed to convert string to UTF-8");
|
"Win32: Failed to convert string to UTF-8");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -679,7 +679,7 @@ static int createWindow(_GLFWwindow* window,
|
|||||||
if (!wideTitle)
|
if (!wideTitle)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Win32: Failed to convert title to wide string");
|
"Win32: Failed to convert window title to UTF-16");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -862,7 +862,7 @@ void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
|
|||||||
if (!wideTitle)
|
if (!wideTitle)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Win32: Failed to convert title to wide string");
|
"Win32: Failed to convert window title to UTF-16");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1168,18 +1168,12 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
|||||||
|
|
||||||
int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
|
int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
|
||||||
{
|
{
|
||||||
LPCWSTR native = translateCursorShape(shape);
|
cursor->win32.handle =
|
||||||
if (!native)
|
CopyCursor(LoadCursorW(NULL, translateCursorShape(shape)));
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_INVALID_ENUM, "Win32: Invalid standard cursor");
|
|
||||||
return GL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
cursor->win32.handle = CopyCursor(LoadCursorW(NULL, native));
|
|
||||||
if (!cursor->win32.handle)
|
if (!cursor->win32.handle)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Win32: Failed to retrieve shared cursor");
|
"Win32: Failed to create standard cursor");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1219,8 +1213,7 @@ void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string)
|
|||||||
if (!wideString)
|
if (!wideString)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Win32: Failed to convert clipboard string to "
|
"Win32: Failed to convert string to UTF-16");
|
||||||
"wide string");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1259,12 +1252,6 @@ const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
|
|||||||
{
|
{
|
||||||
HANDLE stringHandle;
|
HANDLE stringHandle;
|
||||||
|
|
||||||
if (!IsClipboardFormatAvailable(CF_UNICODETEXT))
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_FORMAT_UNAVAILABLE, NULL);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!OpenClipboard(window->win32.handle))
|
if (!OpenClipboard(window->win32.handle))
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to open clipboard");
|
_glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to open clipboard");
|
||||||
@ -1276,8 +1263,8 @@ const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
|
|||||||
{
|
{
|
||||||
CloseClipboard();
|
CloseClipboard();
|
||||||
|
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
|
||||||
"Win32: Failed to retrieve clipboard data");
|
"Win32: Failed to convert clipboard to string");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -394,7 +394,7 @@ GLFWAPI void glfwWindowHint(int target, int hint)
|
|||||||
_glfw.hints.release = hint;
|
_glfw.hints.release = hint;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
_glfwInputError(GLFW_INVALID_ENUM, NULL);
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid window hint");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -479,7 +479,7 @@ GLFWAPI void glfwSetWindowPos(GLFWwindow* handle, int xpos, int ypos)
|
|||||||
if (window->monitor)
|
if (window->monitor)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_VALUE,
|
_glfwInputError(GLFW_INVALID_VALUE,
|
||||||
"Full screen windows cannot be positioned");
|
"Full screen windows cannot be moved");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -624,7 +624,7 @@ GLFWAPI int glfwGetWindowAttrib(GLFWwindow* handle, int attrib)
|
|||||||
return window->context.release;
|
return window->context.release;
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfwInputError(GLFW_INVALID_ENUM, NULL);
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid window attribute");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -722,7 +722,7 @@ int _glfwPlatformInit(void)
|
|||||||
_glfw.x11.display = XOpenDisplay(NULL);
|
_glfw.x11.display = XOpenDisplay(NULL);
|
||||||
if (!_glfw.x11.display)
|
if (!_glfw.x11.display)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_API_UNAVAILABLE, "X11: Failed to open X display");
|
_glfwInputError(GLFW_PLATFORM_ERROR, "X11: Failed to open X display");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1619,9 +1619,7 @@ void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window,
|
|||||||
if (_glfwPlatformGetTime() - base > 0.5)
|
if (_glfwPlatformGetTime() - base > 0.5)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"X11: The window manager has a broken "
|
"X11: The window manager has a broken _NET_REQUEST_FRAME_EXTENTS implementation; please report this issue");
|
||||||
"_NET_REQUEST_FRAME_EXTENTS implementation; "
|
|
||||||
"please report this issue");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1660,9 +1658,8 @@ void _glfwPlatformIconifyWindow(_GLFWwindow* window)
|
|||||||
{
|
{
|
||||||
// Override-redirect windows cannot be iconified or restored, as those
|
// Override-redirect windows cannot be iconified or restored, as those
|
||||||
// tasks are performed by the window manager
|
// tasks are performed by the window manager
|
||||||
_glfwInputError(GLFW_API_UNAVAILABLE,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"X11: Iconification of full screen windows requires "
|
"X11: Iconification of full screen windows requires a WM that supports EWMH");
|
||||||
"a WM that supports EWMH");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1676,9 +1673,8 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window)
|
|||||||
{
|
{
|
||||||
// Override-redirect windows cannot be iconified or restored, as those
|
// Override-redirect windows cannot be iconified or restored, as those
|
||||||
// tasks are performed by the window manager
|
// tasks are performed by the window manager
|
||||||
_glfwInputError(GLFW_API_UNAVAILABLE,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"X11: Iconification of full screen windows requires "
|
"X11: Iconification of full screen windows requires a WM that supports EWMH");
|
||||||
"a WM that supports EWMH");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1835,14 +1831,8 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
|||||||
|
|
||||||
int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
|
int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
|
||||||
{
|
{
|
||||||
const unsigned int native = translateCursorShape(shape);
|
cursor->x11.handle = XCreateFontCursor(_glfw.x11.display,
|
||||||
if (!native)
|
translateCursorShape(shape));
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_INVALID_ENUM, "X11: Invalid standard cursor");
|
|
||||||
return GL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
cursor->x11.handle = XCreateFontCursor(_glfw.x11.display, native);
|
|
||||||
if (!cursor->x11.handle)
|
if (!cursor->x11.handle)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
@ -1885,7 +1875,7 @@ void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string)
|
|||||||
window->x11.handle)
|
window->x11.handle)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"X11: Failed to become owner of the clipboard selection");
|
"X11: Failed to become owner of clipboard selection");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1948,7 +1938,7 @@ const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
|
|||||||
if (_glfw.x11.clipboardString == NULL)
|
if (_glfw.x11.clipboardString == NULL)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
|
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
|
||||||
"X11: Failed to convert selection to string");
|
"X11: Failed to convert clipboard to string");
|
||||||
}
|
}
|
||||||
|
|
||||||
return _glfw.x11.clipboardString;
|
return _glfw.x11.clipboardString;
|
||||||
|
Loading…
Reference in New Issue
Block a user