From 8db1528c7496bb36884ee93791091d5eb186e6cd Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Sun, 30 Dec 2012 23:19:38 +0100 Subject: [PATCH 1/3] Added explicit disabling of platform glext.h. --- src/internal.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/internal.h b/src/internal.h index 73bb6fcd..b86c4611 100644 --- a/src/internal.h +++ b/src/internal.h @@ -58,6 +58,10 @@ typedef struct _GLFWlibrary _GLFWlibrary; #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" // This path may need to be changed if you build GLFW using your own setup From 21f41a2bb77cb4a26f584742f8568614034b1f6b Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Mon, 31 Dec 2012 19:45:13 +0100 Subject: [PATCH 2/3] Renamed GLFW_SAMPLES and GLFW_SHOULD_CLOSE. --- examples/boing.c | 2 +- examples/splitview.c | 2 +- examples/triangle.c | 2 +- include/GL/glfw3.h | 14 +++++++------- readme.html | 3 ++- src/window.c | 4 ++-- tests/accuracy.c | 2 +- tests/events.c | 2 +- tests/fsaa.c | 4 ++-- tests/joysticks.c | 2 +- tests/peter.c | 2 +- tests/tearing.c | 2 +- tests/threads.c | 2 +- tests/title.c | 2 +- tests/windows.c | 2 +- 15 files changed, 24 insertions(+), 23 deletions(-) diff --git a/examples/boing.c b/examples/boing.c index f9771122..d6db6fcd 100644 --- a/examples/boing.c +++ b/examples/boing.c @@ -614,7 +614,7 @@ int main( void ) /* Check if we are still running */ if (glfwGetKey( window, GLFW_KEY_ESCAPE )) break; - if (glfwGetWindowParam(window, GLFW_CLOSE_REQUESTED)) + if (glfwGetWindowParam(window, GLFW_SHOULD_CLOSE)) break; } diff --git a/examples/splitview.c b/examples/splitview.c index 965a183c..41207769 100644 --- a/examples/splitview.c +++ b/examples/splitview.c @@ -502,7 +502,7 @@ int main(void) // Check if the ESC key was pressed or the window should be closed if (glfwGetKey(window, GLFW_KEY_ESCAPE)) break; - if (glfwGetWindowParam(window, GLFW_CLOSE_REQUESTED)) + if (glfwGetWindowParam(window, GLFW_SHOULD_CLOSE)) break; } diff --git a/examples/triangle.c b/examples/triangle.c index 13ef0a98..934d3f37 100644 --- a/examples/triangle.c +++ b/examples/triangle.c @@ -90,7 +90,7 @@ int main(void) // Check if the ESC key was pressed or the window should be closed if (glfwGetKey(window, GLFW_KEY_ESCAPE)) break; - if (glfwGetWindowParam(window, GLFW_CLOSE_REQUESTED)) + if (glfwGetWindowParam(window, GLFW_SHOULD_CLOSE)) break; } diff --git a/include/GL/glfw3.h b/include/GL/glfw3.h index 46db151f..87e5b2d5 100644 --- a/include/GL/glfw3.h +++ b/include/GL/glfw3.h @@ -481,11 +481,11 @@ extern "C" { * otherwise. * @see glfwGetWindowParam */ -#define GLFW_CLOSE_REQUESTED 0x00020003 +#define GLFW_SHOULD_CLOSE 0x00020003 /*! @brief The client API version revision. * @see glfwGetWindowParam */ -#define GLFW_CONTEXT_REVISION 0x00020004 +#define GLFW_CONTEXT_REVISION 0x00020004 /*! @brief The bit depth of the red component of the color buffer. * @see glfwWindowHint @@ -543,7 +543,7 @@ extern "C" { * zero to disable multisampling. * @see glfwWindowHint */ -#define GLFW_FSAA_SAMPLES 0x0002100E +#define GLFW_SAMPLES 0x0002100E /*! @brief @c GL_TRUE if the framebuffer should be sRGB capable, or @c GL_FALSE * otherwise. * @see glfwWindowHint @@ -1075,8 +1075,8 @@ GLFWAPI void glfwDefaultWindowHints(void); * * The @ref GLFW_STEREO hint specifies whether to use stereoscopic rendering. * - * The @ref GLFW_FSAA_SAMPLES hint specifies the desired number of samples to - * use for multisampling. + * The @ref GLFW_SAMPLES hint specifies the desired number of samples to use + * for multisampling. * * The @ref GLFW_SRGB_CAPABLE hint specifies whether the framebuffer should be * sRGB capable. @@ -1304,7 +1304,7 @@ GLFWAPI void glfwHideWindow(GLFWwindow window); * The @ref GLFW_RESIZABLE property indicates whether the window is resizable * 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. * * The @ref GLFW_REFRESH_RATE property will be replaced when the @c @@ -1383,7 +1383,7 @@ GLFWAPI void glfwSetWindowSizeCallback(GLFWwindow window, GLFWwindowsizefun cbfu * callback to be called. * * 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); diff --git a/readme.html b/readme.html index d5e9d922..adee790e 100644 --- a/readme.html +++ b/readme.html @@ -301,6 +301,7 @@ version of GLFW.

  • Renamed glfw.h to glfw3.h to avoid conflicts with 2.x series
  • Renamed glfwOpenWindowHint to glfwWindowHint
  • Renamed GLFW_ACTIVE to GLFW_FOCUSED
  • +
  • Renamed GLFW_FSAA_SAMPLES to GLFW_SAMPLES
  • Renamed GLFW_WINDOW token to GLFW_WINDOWED
  • Renamed GLFW_WINDOW_NO_RESIZE to GLFW_RESIZABLE
  • Renamed GLFW_BUILD_DLL to _GLFW_BUILD_DLL
  • @@ -314,7 +315,7 @@ version of GLFW.

  • Replaced mouse wheel interface with two-dimensional, floating point scrolling interface
  • Replaced glfwEnable and glfwDisable with glfwGetInputMode and glfwSetInputMode
  • Replaced joystick test with graphical version
  • -
  • Replaced automatic closing of windows with GLFW_CLOSE_REQUESTED window parameter
  • +
  • Replaced automatic closing of windows with GLFW_SHOULD_CLOSE window parameter
  • Removed the GLFW_KEY_REPEAT input option
  • Removed event auto-polling and the GLFW_AUTO_POLL_EVENTS window enable
  • Removed the Win32 port .def files
  • diff --git a/src/window.c b/src/window.c index 83db3bdd..1db4fed1 100644 --- a/src/window.c +++ b/src/window.c @@ -442,7 +442,7 @@ GLFWAPI void glfwWindowHint(int target, int hint) case GLFW_POSITION_Y: _glfwLibrary.hints.positionY = hint; break; - case GLFW_FSAA_SAMPLES: + case GLFW_SAMPLES: _glfwLibrary.hints.samples = hint; break; case GLFW_SRGB_CAPABLE: @@ -715,7 +715,7 @@ GLFWAPI int glfwGetWindowParam(GLFWwindow handle, int param) return window == _glfwLibrary.focusedWindow; case GLFW_ICONIFIED: return window->iconified; - case GLFW_CLOSE_REQUESTED: + case GLFW_SHOULD_CLOSE: return window->closeRequested; case GLFW_REFRESH_RATE: return window->refreshRate; diff --git a/tests/accuracy.c b/tests/accuracy.c index 099a619c..8219a4e8 100644 --- a/tests/accuracy.c +++ b/tests/accuracy.c @@ -108,7 +108,7 @@ int main(void) set_swap_interval(window, swap_interval); - while (!glfwGetWindowParam(window, GLFW_CLOSE_REQUESTED)) + while (!glfwGetWindowParam(window, GLFW_SHOULD_CLOSE)) { glClear(GL_COLOR_BUFFER_BIT); diff --git a/tests/events.c b/tests/events.c index c79af8b8..687af7f8 100644 --- a/tests/events.c +++ b/tests/events.c @@ -386,7 +386,7 @@ int main(void) printf("Main loop starting\n"); - while (!glfwGetWindowParam(window, GLFW_CLOSE_REQUESTED)) + while (!glfwGetWindowParam(window, GLFW_SHOULD_CLOSE)) glfwWaitEvents(); glfwTerminate(); diff --git a/tests/fsaa.c b/tests/fsaa.c index b564bfe4..4dfa819a 100644 --- a/tests/fsaa.c +++ b/tests/fsaa.c @@ -97,7 +97,7 @@ int main(int argc, char** argv) else printf("Requesting that FSAA not be available\n"); - glfwWindowHint(GLFW_FSAA_SAMPLES, samples); + glfwWindowHint(GLFW_SAMPLES, samples); window = glfwCreateWindow(800, 400, GLFW_WINDOWED, "Aliasing Detector", NULL); if (!window) @@ -128,7 +128,7 @@ int main(int argc, char** argv) gluOrtho2D(0.f, 1.f, 0.f, 0.5f); glMatrixMode(GL_MODELVIEW); - while (!glfwGetWindowParam(window, GLFW_CLOSE_REQUESTED)) + while (!glfwGetWindowParam(window, GLFW_SHOULD_CLOSE)) { GLfloat time = (GLfloat) glfwGetTime(); diff --git a/tests/joysticks.c b/tests/joysticks.c index d297a3f4..ff6b4282 100644 --- a/tests/joysticks.c +++ b/tests/joysticks.c @@ -207,7 +207,7 @@ int main(void) glfwMakeContextCurrent(window); glfwSwapInterval(1); - while (!glfwGetWindowParam(window, GLFW_CLOSE_REQUESTED)) + while (!glfwGetWindowParam(window, GLFW_SHOULD_CLOSE)) { glClear(GL_COLOR_BUFFER_BIT); diff --git a/tests/peter.c b/tests/peter.c index d7209e3a..4bfef7d2 100644 --- a/tests/peter.c +++ b/tests/peter.c @@ -129,7 +129,7 @@ int main(void) 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); diff --git a/tests/tearing.c b/tests/tearing.c index 8ab6a1d4..af5bc3c1 100644 --- a/tests/tearing.c +++ b/tests/tearing.c @@ -91,7 +91,7 @@ int main(void) glOrtho(-1.f, 1.f, -1.f, 1.f, 1.f, -1.f); glMatrixMode(GL_MODELVIEW); - while (!glfwGetWindowParam(window, GLFW_CLOSE_REQUESTED)) + while (!glfwGetWindowParam(window, GLFW_SHOULD_CLOSE)) { glClear(GL_COLOR_BUFFER_BIT); diff --git a/tests/threads.c b/tests/threads.c index 9cc78975..471b4946 100644 --- a/tests/threads.c +++ b/tests/threads.c @@ -122,7 +122,7 @@ int main(void) 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; } } diff --git a/tests/title.c b/tests/title.c index b23f0ab2..6b540149 100644 --- a/tests/title.c +++ b/tests/title.c @@ -63,7 +63,7 @@ int main(void) glfwSetWindowSizeCallback(window, window_size_callback); - while (!glfwGetWindowParam(window, GLFW_CLOSE_REQUESTED)) + while (!glfwGetWindowParam(window, GLFW_SHOULD_CLOSE)) { glClear(GL_COLOR_BUFFER_BIT); glfwSwapBuffers(window); diff --git a/tests/windows.c b/tests/windows.c index d0006836..6b20c423 100644 --- a/tests/windows.c +++ b/tests/windows.c @@ -82,7 +82,7 @@ int main(void) glClear(GL_COLOR_BUFFER_BIT); glfwSwapBuffers(windows[i]); - if (glfwGetWindowParam(windows[i], GLFW_CLOSE_REQUESTED)) + if (glfwGetWindowParam(windows[i], GLFW_SHOULD_CLOSE)) running = GL_FALSE; } From 1790194828222dd2f823db10f6e53ecca4278dc7 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Mon, 31 Dec 2012 21:05:28 +0100 Subject: [PATCH 3/3] Renamed _glfwInputError and moved to event API. --- src/clipboard.c | 4 +-- src/cocoa_clipboard.m | 6 ++-- src/cocoa_init.m | 3 +- src/cocoa_native.m | 4 +-- src/cocoa_window.m | 10 +++--- src/context.c | 74 ++++++++++++++++++++++-------------------- src/egl_context.c | 42 ++++++++++++------------ src/fullscreen.c | 10 +++--- src/gamma.c | 10 +++--- src/glx_context.c | 53 +++++++++++++++--------------- src/init.c | 4 +-- src/input.c | 39 +++++++++++----------- src/internal.h | 6 ++-- src/joystick.c | 20 ++++++------ src/nsgl_context.m | 50 ++++++++++++++-------------- src/time.c | 4 +-- src/wgl_context.c | 59 ++++++++++++++++----------------- src/win32_clipboard.c | 22 ++++++------- src/win32_fullscreen.c | 2 +- src/win32_native.c | 4 +-- src/win32_window.c | 14 ++++---- src/window.c | 54 +++++++++++++++--------------- src/x11_clipboard.c | 4 +-- src/x11_fullscreen.c | 4 +-- src/x11_gamma.c | 12 +++---- src/x11_init.c | 6 ++-- src/x11_joystick.c | 8 ++--- src/x11_native.c | 4 +-- src/x11_window.c | 10 +++--- 29 files changed, 271 insertions(+), 271 deletions(-) diff --git a/src/clipboard.c b/src/clipboard.c index 0bdea5b4..df4f2572 100644 --- a/src/clipboard.c +++ b/src/clipboard.c @@ -47,7 +47,7 @@ GLFWAPI void glfwSetClipboardString(GLFWwindow handle, const char* string) if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } @@ -65,7 +65,7 @@ GLFWAPI const char* glfwGetClipboardString(GLFWwindow handle) if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return NULL; } diff --git a/src/cocoa_clipboard.m b/src/cocoa_clipboard.m index 99918f77..a4634ad8 100644 --- a/src/cocoa_clipboard.m +++ b/src/cocoa_clipboard.m @@ -62,15 +62,15 @@ const char* _glfwPlatformGetClipboardString(_GLFWwindow* window) if (![[pasteboard types] containsObject:NSStringPboardType]) { - _glfwSetError(GLFW_FORMAT_UNAVAILABLE, NULL); + _glfwInputError(GLFW_FORMAT_UNAVAILABLE, NULL); return NULL; } NSString* object = [pasteboard stringForType:NSStringPboardType]; if (!object) { - _glfwSetError(GLFW_PLATFORM_ERROR, - "Cocoa: Failed to retrieve object from pasteboard"); + _glfwInputError(GLFW_PLATFORM_ERROR, + "Cocoa: Failed to retrieve object from pasteboard"); return NULL; } diff --git a/src/cocoa_init.m b/src/cocoa_init.m index 99638710..7abec19c 100644 --- a/src/cocoa_init.m +++ b/src/cocoa_init.m @@ -85,7 +85,8 @@ int _glfwPlatformInit(void) CFBundleGetBundleWithIdentifier(CFSTR("com.apple.opengl")); 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; } diff --git a/src/cocoa_native.m b/src/cocoa_native.m index be8aac4b..29da8d04 100644 --- a/src/cocoa_native.m +++ b/src/cocoa_native.m @@ -47,7 +47,7 @@ GLFWAPI id glfwGetCocoaWindow(GLFWwindow handle) if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return 0; } @@ -65,7 +65,7 @@ GLFWAPI id glfwGetNSGLContext(GLFWwindow handle) if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return NULL; } diff --git a/src/cocoa_window.m b/src/cocoa_window.m index fc090119..08df3340 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -692,7 +692,7 @@ static GLboolean createWindow(_GLFWwindow* window, 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; } @@ -734,8 +734,8 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, _glfwLibrary.NS.delegate = [[GLFWApplicationDelegate alloc] init]; if (_glfwLibrary.NS.delegate == nil) { - _glfwSetError(GLFW_PLATFORM_ERROR, - "Cocoa: Failed to create application delegate"); + _glfwInputError(GLFW_PLATFORM_ERROR, + "Cocoa: Failed to create application delegate"); return GL_FALSE; } @@ -745,8 +745,8 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, window->NS.delegate = [[GLFWWindowDelegate alloc] initWithGlfwWindow:window]; if (window->NS.delegate == nil) { - _glfwSetError(GLFW_PLATFORM_ERROR, - "Cocoa: Failed to create window delegate"); + _glfwInputError(GLFW_PLATFORM_ERROR, + "Cocoa: Failed to create window delegate"); return GL_FALSE; } diff --git a/src/context.c b/src/context.c index 4eb2c6d4..474999fc 100644 --- a/src/context.c +++ b/src/context.c @@ -55,7 +55,8 @@ static GLboolean parseGLVersion(int* api, int* major, int* minor, int* rev) version = (const char*) glGetString(GL_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; } @@ -73,7 +74,8 @@ static GLboolean parseGLVersion(int* api, int* major, int* minor, int* 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; } @@ -262,7 +264,7 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig) if (wndconfig->clientAPI != GLFW_OPENGL_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; } @@ -278,9 +280,9 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig) // OpenGL 2.x series ended with version 2.1 // OpenGL 3.x series ended with version 3.3 - _glfwSetError(GLFW_INVALID_VALUE, - "Invalid OpenGL version %i.%i requested", - wndconfig->glMajor, wndconfig->glMinor); + _glfwInputError(GLFW_INVALID_VALUE, + "Invalid OpenGL version %i.%i requested", + wndconfig->glMajor, wndconfig->glMinor); return GL_FALSE; } else @@ -293,8 +295,8 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig) if (wndconfig->glProfile != GLFW_OPENGL_CORE_PROFILE && wndconfig->glProfile != GLFW_OPENGL_COMPAT_PROFILE) { - _glfwSetError(GLFW_INVALID_ENUM, - "Invalid OpenGL profile requested"); + _glfwInputError(GLFW_INVALID_ENUM, + "Invalid OpenGL profile requested"); return GL_FALSE; } @@ -304,9 +306,9 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig) // Desktop OpenGL context profiles are only defined for version 3.2 // and above - _glfwSetError(GLFW_INVALID_VALUE, - "Context profiles only exist for " - "OpenGL version 3.2 and above"); + _glfwInputError(GLFW_INVALID_VALUE, + "Context profiles only exist for " + "OpenGL version 3.2 and above"); return GL_FALSE; } } @@ -314,9 +316,9 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig) if (wndconfig->glForward && wndconfig->glMajor < 3) { // Forward-compatible contexts are only defined for OpenGL version 3.0 and above - _glfwSetError(GLFW_INVALID_VALUE, - "Forward compatibility only exist for OpenGL " - "version 3.0 and above"); + _glfwInputError(GLFW_INVALID_VALUE, + "Forward compatibility only exist for OpenGL " + "version 3.0 and above"); return GL_FALSE; } } @@ -330,9 +332,9 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig) // OpenGL ES 1.x series ended with version 1.1 // OpenGL ES 2.x series ended with version 2.0 - _glfwSetError(GLFW_INVALID_VALUE, - "Invalid OpenGL ES version %i.%i requested", - wndconfig->glMajor, wndconfig->glMinor); + _glfwInputError(GLFW_INVALID_VALUE, + "Invalid OpenGL ES version %i.%i requested", + wndconfig->glMajor, wndconfig->glMinor); return GL_FALSE; } else @@ -343,16 +345,16 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig) if (wndconfig->glProfile) { // OpenGL ES does not support profiles - _glfwSetError(GLFW_INVALID_VALUE, - "Context profiles are not supported by OpenGL ES"); + _glfwInputError(GLFW_INVALID_VALUE, + "Context profiles are not supported by OpenGL ES"); return GL_FALSE; } if (wndconfig->glForward) { // OpenGL ES does not support forward-compatibility - _glfwSetError(GLFW_INVALID_VALUE, - "Forward compatibility is not supported by OpenGL ES"); + _glfwInputError(GLFW_INVALID_VALUE, + "Forward compatibility is not supported by OpenGL ES"); return GL_FALSE; } } @@ -362,8 +364,8 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig) if (wndconfig->glRobustness != GLFW_NO_RESET_NOTIFICATION && wndconfig->glRobustness != GLFW_LOSE_CONTEXT_ON_RESET) { - _glfwSetError(GLFW_INVALID_VALUE, - "Invalid OpenGL robustness mode requested"); + _glfwInputError(GLFW_INVALID_VALUE, + "Invalid context robustness mode requested"); return GL_FALSE; } } @@ -397,8 +399,8 @@ GLboolean _glfwRefreshContextParams(void) window->GetStringi = (PFNGLGETSTRINGIPROC) glfwGetProcAddress("glGetStringi"); if (!window->GetStringi) { - _glfwSetError(GLFW_PLATFORM_ERROR, - "Entry point retrieval is broken"); + _glfwInputError(GLFW_PLATFORM_ERROR, + "Entry point retrieval is broken"); return GL_FALSE; } } @@ -494,7 +496,7 @@ GLboolean _glfwIsValidContext(_GLFWwndconfig* wndconfig) // For API consistency, we emulate the behavior of the // {GLX|WGL}_ARB_create_context extension and fail here - _glfwSetError(GLFW_VERSION_UNAVAILABLE, NULL); + _glfwInputError(GLFW_VERSION_UNAVAILABLE, NULL); return GL_FALSE; } @@ -551,7 +553,7 @@ GLFWAPI void glfwMakeContextCurrent(GLFWwindow handle) if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } @@ -570,7 +572,7 @@ GLFWAPI GLFWwindow glfwGetCurrentContext(void) { if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return NULL; } @@ -588,7 +590,7 @@ GLFWAPI void glfwSwapBuffers(GLFWwindow handle) if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } @@ -604,13 +606,13 @@ GLFWAPI void glfwSwapInterval(int interval) { if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } if (!_glfwPlatformGetCurrentContext()) { - _glfwSetError(GLFW_NO_CURRENT_CONTEXT, NULL); + _glfwInputError(GLFW_NO_CURRENT_CONTEXT, NULL); return; } @@ -629,20 +631,20 @@ GLFWAPI int glfwExtensionSupported(const char* extension) if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return GL_FALSE; } window = _glfwPlatformGetCurrentContext(); if (!window) { - _glfwSetError(GLFW_NO_CURRENT_CONTEXT, NULL); + _glfwInputError(GLFW_NO_CURRENT_CONTEXT, NULL); return GL_FALSE; } if (extension == NULL || *extension == '\0') { - _glfwSetError(GLFW_INVALID_VALUE, NULL); + _glfwInputError(GLFW_INVALID_VALUE, NULL); return GL_FALSE; } @@ -690,13 +692,13 @@ GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname) { if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return NULL; } if (!_glfwPlatformGetCurrentContext()) { - _glfwSetError(GLFW_NO_CURRENT_CONTEXT, NULL); + _glfwInputError(GLFW_NO_CURRENT_CONTEXT, NULL); return NULL; } diff --git a/src/egl_context.c b/src/egl_context.c index cfb6644f..bbb856fb 100644 --- a/src/egl_context.c +++ b/src/egl_context.c @@ -83,7 +83,7 @@ static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window, configs = (EGLConfig*) malloc(sizeof(EGLConfig) * count); if (!configs) { - _glfwSetError(GLFW_OUT_OF_MEMORY, NULL); + _glfwInputError(GLFW_OUT_OF_MEMORY, NULL); return NULL; } @@ -92,8 +92,7 @@ static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window, { free(configs); - _glfwSetError(GLFW_API_UNAVAILABLE, - "EGL: No EGLConfigs returned"); + _glfwInputError(GLFW_API_UNAVAILABLE, "EGL: No EGLConfigs returned"); return NULL; } @@ -102,7 +101,7 @@ static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window, { free(configs); - _glfwSetError(GLFW_OUT_OF_MEMORY, NULL); + _glfwInputError(GLFW_OUT_OF_MEMORY, NULL); return NULL; } @@ -203,8 +202,8 @@ static int createContext(_GLFWwindow* window, eglChooseConfig(_glfwLibrary.EGL.display, attribs, &config, 1, &count); if (!count) { - _glfwSetError(GLFW_PLATFORM_ERROR, - "EGL: Failed to retrieve the selected EGLConfig"); + _glfwInputError(GLFW_PLATFORM_ERROR, + "EGL: Failed to retrieve the selected EGLConfig"); return GL_FALSE; } } @@ -251,8 +250,8 @@ static int createContext(_GLFWwindow* window, if (window->EGL.visual == NULL) { - _glfwSetError(GLFW_PLATFORM_ERROR, - "EGL: Failed to retrieve visual for EGLConfig"); + _glfwInputError(GLFW_PLATFORM_ERROR, + "EGL: Failed to retrieve visual for EGLConfig"); return GL_FALSE; } } @@ -262,7 +261,8 @@ static int createContext(_GLFWwindow* window, { 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; } } @@ -270,7 +270,7 @@ static int createContext(_GLFWwindow* window, { 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; } } @@ -337,7 +337,7 @@ static int createContext(_GLFWwindow* window, { // 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; } @@ -379,7 +379,7 @@ int _glfwInitOpenGL(void) 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; } #endif @@ -387,8 +387,7 @@ int _glfwInitOpenGL(void) _glfwLibrary.EGL.display = eglGetDisplay(_GLFW_EGL_NATIVE_DISPLAY); if (_glfwLibrary.EGL.display == EGL_NO_DISPLAY) { - _glfwSetError(GLFW_API_UNAVAILABLE, - "EGL: Failed to get EGL display"); + _glfwInputError(GLFW_API_UNAVAILABLE, "EGL: Failed to get EGL display"); return GL_FALSE; } @@ -396,8 +395,7 @@ int _glfwInitOpenGL(void) &_glfwLibrary.EGL.majorVersion, &_glfwLibrary.EGL.minorVersion)) { - _glfwSetError(GLFW_API_UNAVAILABLE, - "EGL: Failed to initialize EGL"); + _glfwInputError(GLFW_API_UNAVAILABLE, "EGL: Failed to initialize EGL"); return GL_FALSE; } @@ -445,16 +443,16 @@ int _glfwCreateContext(_GLFWwindow* window, fbconfigs = getFBConfigs(window, wndconfig, &fbcount); if (!fbconfigs) { - _glfwSetError(GLFW_PLATFORM_ERROR, - "EGL: No usable EGLFBConfigs found"); + _glfwInputError(GLFW_PLATFORM_ERROR, + "EGL: No usable EGLFBConfigs found"); return GL_FALSE; } result = _glfwChooseFBConfig(fbconfig, fbconfigs, fbcount); if (!result) { - _glfwSetError(GLFW_PLATFORM_ERROR, - "EGL: No EGLFBConfig matched the criteria"); + _glfwInputError(GLFW_PLATFORM_ERROR, + "EGL: No EGLFBConfig matched the criteria"); free(fbconfigs); return GL_FALSE; @@ -526,8 +524,8 @@ void _glfwPlatformMakeContextCurrent(_GLFWwindow* window) NULL); if (window->EGL.surface == EGL_NO_SURFACE) { - _glfwSetError(GLFW_PLATFORM_ERROR, - "EGL: Failed to create window surface"); + _glfwInputError(GLFW_PLATFORM_ERROR, + "EGL: Failed to create window surface"); } } diff --git a/src/fullscreen.c b/src/fullscreen.c index f59046d8..0dc87d95 100644 --- a/src/fullscreen.c +++ b/src/fullscreen.c @@ -118,13 +118,13 @@ GLFWAPI GLFWvidmode* glfwGetVideoModes(int* count) { if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return NULL; } if (count == NULL) { - _glfwSetError(GLFW_INVALID_VALUE, NULL); + _glfwInputError(GLFW_INVALID_VALUE, NULL); return NULL; } @@ -146,14 +146,14 @@ GLFWAPI void glfwGetDesktopMode(GLFWvidmode* mode) { if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } if (mode == NULL) { - _glfwSetError(GLFW_INVALID_VALUE, - "glfwGetDesktopMode: Parameter 'mode' cannot be NULL"); + _glfwInputError(GLFW_INVALID_VALUE, + "glfwGetDesktopMode: Parameter 'mode' cannot be NULL"); return; } diff --git a/src/gamma.c b/src/gamma.c index 07180886..d19093c2 100644 --- a/src/gamma.c +++ b/src/gamma.c @@ -48,14 +48,14 @@ GLFWAPI void glfwSetGamma(float gamma) if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } if (gamma <= 0.f) { - _glfwSetError(GLFW_INVALID_VALUE, - "Gamma value must be greater than zero"); + _glfwInputError(GLFW_INVALID_VALUE, + "Gamma value must be greater than zero"); return; } @@ -91,7 +91,7 @@ GLFWAPI void glfwGetGammaRamp(GLFWgammaramp* ramp) { if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } @@ -107,7 +107,7 @@ GLFWAPI void glfwSetGammaRamp(const GLFWgammaramp* ramp) { if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } diff --git a/src/glx_context.c b/src/glx_context.c index dbd7dd91..cd86d732 100644 --- a/src/glx_context.c +++ b/src/glx_context.c @@ -104,8 +104,8 @@ static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window, unsigned int* found) { if (!_glfwLibrary.GLX.SGIX_fbconfig) { - _glfwSetError(GLFW_API_UNAVAILABLE, - "GLX: GLXFBConfig support not found"); + _glfwInputError(GLFW_API_UNAVAILABLE, + "GLX: GLXFBConfig support not found"); return NULL; } } @@ -127,8 +127,8 @@ static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window, unsigned int* found) &count); if (!count) { - _glfwSetError(GLFW_API_UNAVAILABLE, - "GLX: No GLXFBConfigs returned"); + _glfwInputError(GLFW_API_UNAVAILABLE, + "GLX: No GLXFBConfigs returned"); return NULL; } } @@ -139,8 +139,8 @@ static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window, unsigned int* found) &count); if (!count) { - _glfwSetError(GLFW_API_UNAVAILABLE, - "GLX: No GLXFBConfigs returned"); + _glfwInputError(GLFW_API_UNAVAILABLE, + "GLX: No GLXFBConfigs returned"); return NULL; } } @@ -148,7 +148,7 @@ static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window, unsigned int* found) result = (_GLFWfbconfig*) malloc(sizeof(_GLFWfbconfig) * count); if (!result) { - _glfwSetError(GLFW_OUT_OF_MEMORY, NULL); + _glfwInputError(GLFW_OUT_OF_MEMORY, NULL); return NULL; } @@ -302,8 +302,8 @@ static int createContext(_GLFWwindow* window, if (fbconfig == NULL) { - _glfwSetError(GLFW_PLATFORM_ERROR, - "GLX: Failed to retrieve the selected GLXFBConfig"); + _glfwInputError(GLFW_PLATFORM_ERROR, + "GLX: Failed to retrieve the selected GLXFBConfig"); return GL_FALSE; } } @@ -325,8 +325,8 @@ static int createContext(_GLFWwindow* window, { XFree(fbconfig); - _glfwSetError(GLFW_PLATFORM_ERROR, - "GLX: Failed to retrieve visual for GLXFBConfig"); + _glfwInputError(GLFW_PLATFORM_ERROR, + "GLX: Failed to retrieve visual for GLXFBConfig"); return GL_FALSE; } @@ -336,9 +336,9 @@ static int createContext(_GLFWwindow* window, !_glfwLibrary.GLX.ARB_create_context_profile || !_glfwLibrary.GLX.EXT_create_context_es2_profile) { - _glfwSetError(GLFW_VERSION_UNAVAILABLE, - "GLX: OpenGL ES requested but " - "GLX_EXT_create_context_es2_profile is unavailable"); + _glfwInputError(GLFW_VERSION_UNAVAILABLE, + "GLX: OpenGL ES requested but " + "GLX_EXT_create_context_es2_profile is unavailable"); return GL_FALSE; } } @@ -347,9 +347,9 @@ static int createContext(_GLFWwindow* window, { if (!_glfwLibrary.GLX.ARB_create_context) { - _glfwSetError(GLFW_VERSION_UNAVAILABLE, - "GLX: Forward compatibility requested but " - "GLX_ARB_create_context_profile is unavailable"); + _glfwInputError(GLFW_VERSION_UNAVAILABLE, + "GLX: Forward compatibility requested but " + "GLX_ARB_create_context_profile is unavailable"); return GL_FALSE; } } @@ -359,9 +359,9 @@ static int createContext(_GLFWwindow* window, if (!_glfwLibrary.GLX.ARB_create_context || !_glfwLibrary.GLX.ARB_create_context_profile) { - _glfwSetError(GLFW_VERSION_UNAVAILABLE, - "GLX: An OpenGL profile requested but " - "GLX_ARB_create_context_profile is unavailable"); + _glfwInputError(GLFW_VERSION_UNAVAILABLE, + "GLX: An OpenGL profile requested but " + "GLX_ARB_create_context_profile is unavailable"); return GL_FALSE; } } @@ -461,7 +461,7 @@ static int createContext(_GLFWwindow* window, 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; } @@ -501,7 +501,7 @@ int _glfwInitOpenGL(void) 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; } #endif @@ -511,7 +511,7 @@ int _glfwInitOpenGL(void) &_glfwLibrary.GLX.errorBase, &_glfwLibrary.GLX.eventBase)) { - _glfwSetError(GLFW_API_UNAVAILABLE, "GLX: GLX support not found"); + _glfwInputError(GLFW_API_UNAVAILABLE, "GLX: GLX support not found"); return GL_FALSE; } @@ -519,7 +519,8 @@ int _glfwInitOpenGL(void) &_glfwLibrary.GLX.majorVersion, &_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; } @@ -638,8 +639,8 @@ int _glfwCreateContext(_GLFWwindow* window, result = _glfwChooseFBConfig(fbconfig, fbconfigs, fbcount); if (!result) { - _glfwSetError(GLFW_PLATFORM_ERROR, - "GLX: No GLXFBConfig matched the criteria"); + _glfwInputError(GLFW_PLATFORM_ERROR, + "GLX: No GLXFBConfig matched the criteria"); free(fbconfigs); return GL_FALSE; diff --git a/src/init.c b/src/init.c index dbdbc48d..3c40594a 100644 --- a/src/init.c +++ b/src/init.c @@ -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) { diff --git a/src/input.c b/src/input.c index 497e7520..22e058e3 100644 --- a/src/input.c +++ b/src/input.c @@ -43,7 +43,7 @@ static void setCursorMode(_GLFWwindow* window, int newMode) newMode != GLFW_CURSOR_HIDDEN && newMode != GLFW_CURSOR_CAPTURED) { - _glfwSetError(GLFW_INVALID_ENUM, NULL); + _glfwInputError(GLFW_INVALID_ENUM, NULL); return; } @@ -255,7 +255,7 @@ GLFWAPI int glfwGetInputMode(GLFWwindow handle, int mode) if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return 0; } @@ -268,7 +268,7 @@ GLFWAPI int glfwGetInputMode(GLFWwindow handle, int mode) case GLFW_STICKY_MOUSE_BUTTONS: return window->stickyMouseButtons; default: - _glfwSetError(GLFW_INVALID_ENUM, NULL); + _glfwInputError(GLFW_INVALID_ENUM, NULL); return 0; } } @@ -284,7 +284,7 @@ GLFWAPI void glfwSetInputMode(GLFWwindow handle, int mode, int value) if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } @@ -300,7 +300,7 @@ GLFWAPI void glfwSetInputMode(GLFWwindow handle, int mode, int value) setStickyMouseButtons(window, value ? GL_TRUE : GL_FALSE); break; default: - _glfwSetError(GLFW_INVALID_ENUM, NULL); + _glfwInputError(GLFW_INVALID_ENUM, NULL); break; } } @@ -316,14 +316,13 @@ GLFWAPI int glfwGetKey(GLFWwindow handle, int key) if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return GLFW_RELEASE; } if (key < 0 || key > GLFW_KEY_LAST) { - _glfwSetError(GLFW_INVALID_ENUM, - "The specified key is invalid"); + _glfwInputError(GLFW_INVALID_ENUM, "The specified key is invalid"); return GLFW_RELEASE; } @@ -348,14 +347,14 @@ GLFWAPI int glfwGetMouseButton(GLFWwindow handle, int button) if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return GLFW_RELEASE; } if (button < 0 || button > GLFW_MOUSE_BUTTON_LAST) { - _glfwSetError(GLFW_INVALID_ENUM, - "The specified mouse button is invalid"); + _glfwInputError(GLFW_INVALID_ENUM, + "The specified mouse button is invalid"); return GLFW_RELEASE; } @@ -380,7 +379,7 @@ GLFWAPI void glfwGetCursorPos(GLFWwindow handle, int* xpos, int* ypos) if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } @@ -403,7 +402,7 @@ GLFWAPI void glfwSetCursorPos(GLFWwindow handle, int xpos, int ypos) if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } @@ -437,7 +436,7 @@ GLFWAPI void glfwGetScrollOffset(GLFWwindow handle, double* xoffset, double* yof if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } @@ -459,7 +458,7 @@ GLFWAPI void glfwSetKeyCallback(GLFWwindow handle, GLFWkeyfun cbfun) if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } @@ -477,7 +476,7 @@ GLFWAPI void glfwSetCharCallback(GLFWwindow handle, GLFWcharfun cbfun) if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } @@ -495,7 +494,7 @@ GLFWAPI void glfwSetMouseButtonCallback(GLFWwindow handle, GLFWmousebuttonfun cb if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } @@ -513,7 +512,7 @@ GLFWAPI void glfwSetCursorPosCallback(GLFWwindow handle, GLFWcursorposfun cbfun) if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } @@ -531,7 +530,7 @@ GLFWAPI void glfwSetCursorEnterCallback(GLFWwindow handle, GLFWcursorenterfun cb if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } @@ -549,7 +548,7 @@ GLFWAPI void glfwSetScrollCallback(GLFWwindow handle, GLFWscrollfun cbfun) if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } diff --git a/src/internal.h b/src/internal.h index b86c4611..50f3fae9 100644 --- a/src/internal.h +++ b/src/internal.h @@ -341,6 +341,9 @@ void _glfwInputMouseClick(_GLFWwindow* window, int button, int action); void _glfwInputCursorMotion(_GLFWwindow* window, int x, int y); void _glfwInputCursorEnter(_GLFWwindow* window, int entered); +// Error event notification (init.c) +void _glfwInputError(int error, const char* format, ...); + //======================================================================== // Prototypes for internal utility functions @@ -353,9 +356,6 @@ void _glfwInputCursorEnter(_GLFWwindow* window, int entered); int _glfwCompareVideoModes(const GLFWvidmode* first, const GLFWvidmode* second); 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) int _glfwStringInExtensionString(const char* string, const GLubyte* extensions); const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired, diff --git a/src/joystick.c b/src/joystick.c index 9c20303d..d1015f5c 100644 --- a/src/joystick.c +++ b/src/joystick.c @@ -43,13 +43,13 @@ GLFWAPI int glfwGetJoystickParam(int joy, int param) { if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return 0; } if (joy < 0 || joy > GLFW_JOYSTICK_LAST) { - _glfwSetError(GLFW_INVALID_ENUM, NULL); + _glfwInputError(GLFW_INVALID_ENUM, NULL); return 0; } @@ -67,19 +67,19 @@ GLFWAPI int glfwGetJoystickAxes(int joy, float* axes, int numaxes) if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return 0; } if (joy < 0 || joy > GLFW_JOYSTICK_LAST) { - _glfwSetError(GLFW_INVALID_ENUM, NULL); + _glfwInputError(GLFW_INVALID_ENUM, NULL); return 0; } if (axes == NULL || numaxes < 0) { - _glfwSetError(GLFW_INVALID_VALUE, NULL); + _glfwInputError(GLFW_INVALID_VALUE, NULL); return 0; } @@ -103,19 +103,19 @@ GLFWAPI int glfwGetJoystickButtons(int joy, if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return 0; } if (joy < 0 || joy > GLFW_JOYSTICK_LAST) { - _glfwSetError(GLFW_INVALID_ENUM, NULL); + _glfwInputError(GLFW_INVALID_ENUM, NULL); return 0; } if (buttons == NULL || numbuttons < 0) { - _glfwSetError(GLFW_INVALID_VALUE, NULL); + _glfwInputError(GLFW_INVALID_VALUE, NULL); return 0; } @@ -135,13 +135,13 @@ GLFWAPI const char* glfwGetJoystickName(int joy) { if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return NULL; } if (joy < 0 || joy > GLFW_JOYSTICK_LAST) { - _glfwSetError(GLFW_INVALID_ENUM, NULL); + _glfwInputError(GLFW_INVALID_ENUM, NULL); return NULL; } diff --git a/src/nsgl_context.m b/src/nsgl_context.m index 315c39d5..9a9af616 100644 --- a/src/nsgl_context.m +++ b/src/nsgl_context.m @@ -50,8 +50,8 @@ int _glfwInitOpenGL(void) { if (pthread_key_create(&_glfwCurrentTLS, NULL) != 0) { - _glfwSetError(GLFW_PLATFORM_ERROR, - "NSOpenGL: Failed to create context TLS"); + _glfwInputError(GLFW_PLATFORM_ERROR, + "NSOpenGL: Failed to create context TLS"); return GL_FALSE; } @@ -88,8 +88,8 @@ int _glfwCreateContext(_GLFWwindow* window, if (wndconfig->clientAPI == GLFW_OPENGL_ES_API) { - _glfwSetError(GLFW_VERSION_UNAVAILABLE, - "NSOpenGL: This API does not support OpenGL ES"); + _glfwInputError(GLFW_VERSION_UNAVAILABLE, + "NSOpenGL: This API does not support OpenGL ES"); return GL_FALSE; } @@ -98,9 +98,9 @@ int _glfwCreateContext(_GLFWwindow* window, if (wndconfig->glMajor > 3 || (wndconfig->glMajor == 3 && wndconfig->glMinor != 2)) { - _glfwSetError(GLFW_VERSION_UNAVAILABLE, - "NSOpenGL: The targeted version of Mac OS X does not " - "support any OpenGL version above 2.1 except 3.2"); + _glfwInputError(GLFW_VERSION_UNAVAILABLE, + "NSOpenGL: The targeted version of Mac OS X does not " + "support any OpenGL version above 2.1 except 3.2"); return GL_FALSE; } @@ -108,19 +108,19 @@ int _glfwCreateContext(_GLFWwindow* window, { if (!wndconfig->glForward) { - _glfwSetError(GLFW_VERSION_UNAVAILABLE, - "NSOpenGL: The targeted version of Mac OS X only " - "supports OpenGL 3.2 contexts if they are " - "forward-compatible"); + _glfwInputError(GLFW_VERSION_UNAVAILABLE, + "NSOpenGL: The targeted version of Mac OS X only " + "supports OpenGL 3.2 contexts if they are " + "forward-compatible"); return GL_FALSE; } if (wndconfig->glProfile != GLFW_OPENGL_CORE_PROFILE) { - _glfwSetError(GLFW_VERSION_UNAVAILABLE, - "NSOpenGL: The targeted version of Mac OS X only " - "supports OpenGL 3.2 contexts if they use the " - "core profile"); + _glfwInputError(GLFW_VERSION_UNAVAILABLE, + "NSOpenGL: The targeted version of Mac OS X only " + "supports OpenGL 3.2 contexts if they use the " + "core profile"); return GL_FALSE; } } @@ -128,9 +128,9 @@ int _glfwCreateContext(_GLFWwindow* window, // Fail if OpenGL 3.0 or above was requested if (wndconfig->glMajor > 2) { - _glfwSetError(GLFW_VERSION_UNAVAILABLE, - "NSOpenGL: The targeted version of Mac OS X does not " - "support OpenGL version 3.0 or above"); + _glfwInputError(GLFW_VERSION_UNAVAILABLE, + "NSOpenGL: The targeted version of Mac OS X does not " + "support OpenGL version 3.0 or above"); return GL_FALSE; } #endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/ @@ -138,9 +138,9 @@ int _glfwCreateContext(_GLFWwindow* window, // Fail if a robustness strategy was requested if (wndconfig->glRobustness) { - _glfwSetError(GLFW_VERSION_UNAVAILABLE, - "NSOpenGL: Mac OS X does not support OpenGL robustness " - "strategies"); + _glfwInputError(GLFW_VERSION_UNAVAILABLE, + "NSOpenGL: Mac OS X does not support OpenGL robustness " + "strategies"); return GL_FALSE; } @@ -205,8 +205,8 @@ int _glfwCreateContext(_GLFWwindow* window, [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes]; if (window->NSGL.pixelFormat == nil) { - _glfwSetError(GLFW_PLATFORM_ERROR, - "NSOpenGL: Failed to create OpenGL pixel format"); + _glfwInputError(GLFW_PLATFORM_ERROR, + "NSOpenGL: Failed to create OpenGL pixel format"); return GL_FALSE; } @@ -220,8 +220,8 @@ int _glfwCreateContext(_GLFWwindow* window, shareContext:share]; if (window->NSGL.context == nil) { - _glfwSetError(GLFW_PLATFORM_ERROR, - "NSOpenGL: Failed to create OpenGL context"); + _glfwInputError(GLFW_PLATFORM_ERROR, + "NSOpenGL: Failed to create OpenGL context"); return GL_FALSE; } diff --git a/src/time.c b/src/time.c index 5538df99..4001f0e9 100644 --- a/src/time.c +++ b/src/time.c @@ -43,7 +43,7 @@ GLFWAPI double glfwGetTime(void) { if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return 0.0; } @@ -59,7 +59,7 @@ GLFWAPI void glfwSetTime(double time) { if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } diff --git a/src/wgl_context.c b/src/wgl_context.c index 65260539..8406fcfd 100644 --- a/src/wgl_context.c +++ b/src/wgl_context.c @@ -193,14 +193,14 @@ static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window, unsigned int* found) if (!available) { - _glfwSetError(GLFW_API_UNAVAILABLE, "WGL: No pixel formats found"); + _glfwInputError(GLFW_API_UNAVAILABLE, "WGL: No pixel formats found"); return NULL; } fbconfigs = (_GLFWfbconfig*) malloc(sizeof(_GLFWfbconfig) * available); if (!fbconfigs) { - _glfwSetError(GLFW_OUT_OF_MEMORY, NULL); + _glfwInputError(GLFW_OUT_OF_MEMORY, NULL); return NULL; } @@ -314,8 +314,8 @@ static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window, unsigned int* found) if (*found == 0) { - _glfwSetError(GLFW_PLATFORM_ERROR, - "Win32/WGL: No usable pixel formats found"); + _glfwInputError(GLFW_PLATFORM_ERROR, + "Win32/WGL: No usable pixel formats found"); free(fbconfigs); return NULL; @@ -346,15 +346,16 @@ static GLboolean createContext(_GLFWwindow* window, if (!DescribePixelFormat(window->WGL.DC, pixelFormat, sizeof(pfd), &pfd)) { - _glfwSetError(GLFW_PLATFORM_ERROR, - "Win32: Failed to retrieve PFD for selected pixel format"); + _glfwInputError(GLFW_PLATFORM_ERROR, + "Win32: Failed to retrieve PFD for selected pixel " + "format"); return GL_FALSE; } if (!SetPixelFormat(window->WGL.DC, pixelFormat, &pfd)) { - _glfwSetError(GLFW_PLATFORM_ERROR, - "Win32: Failed to set selected pixel format"); + _glfwInputError(GLFW_PLATFORM_ERROR, + "Win32: Failed to set selected pixel format"); return GL_FALSE; } @@ -416,8 +417,8 @@ static GLboolean createContext(_GLFWwindow* window, attribs); if (!window->WGL.context) { - _glfwSetError(GLFW_VERSION_UNAVAILABLE, - "WGL: Failed to create OpenGL context"); + _glfwInputError(GLFW_VERSION_UNAVAILABLE, + "WGL: Failed to create OpenGL context"); return GL_FALSE; } } @@ -426,8 +427,8 @@ static GLboolean createContext(_GLFWwindow* window, window->WGL.context = wglCreateContext(window->WGL.DC); if (!window->WGL.context) { - _glfwSetError(GLFW_PLATFORM_ERROR, - "WGL: Failed to create OpenGL context"); + _glfwInputError(GLFW_PLATFORM_ERROR, + "WGL: Failed to create OpenGL context"); return GL_FALSE; } @@ -435,9 +436,9 @@ static GLboolean createContext(_GLFWwindow* window, { if (!wglShareLists(share, window->WGL.context)) { - _glfwSetError(GLFW_PLATFORM_ERROR, - "WGL: Failed to enable sharing with specified " - "OpenGL context"); + _glfwInputError(GLFW_PLATFORM_ERROR, + "WGL: Failed to enable sharing with specified " + "OpenGL context"); return GL_FALSE; } } @@ -469,8 +470,8 @@ int _glfwCreateContext(_GLFWwindow* window, window->WGL.DC = GetDC(window->Win32.handle); if (!window->WGL.DC) { - _glfwSetError(GLFW_PLATFORM_ERROR, - "Win32: Failed to retrieve DC for window"); + _glfwInputError(GLFW_PLATFORM_ERROR, + "Win32: Failed to retrieve DC for window"); return GL_FALSE; } @@ -487,8 +488,8 @@ int _glfwCreateContext(_GLFWwindow* window, result = _glfwChooseFBConfig(fbconfig, fbconfigs, fbcount); if (!result) { - _glfwSetError(GLFW_FORMAT_UNAVAILABLE, - "Win32/WGL: No pixel format matched the criteria"); + _glfwInputError(GLFW_FORMAT_UNAVAILABLE, + "Win32/WGL: No pixel format matched the criteria"); free(fbconfigs); return GL_FALSE; @@ -538,10 +539,10 @@ int _glfwAnalyzeContext(const _GLFWwindow* window, { if (!window->WGL.ARB_create_context) { - _glfwSetError(GLFW_VERSION_UNAVAILABLE, - "WGL: A forward compatible OpenGL context " - "requested but WGL_ARB_create_context is " - "unavailable"); + _glfwInputError(GLFW_VERSION_UNAVAILABLE, + "WGL: A forward compatible OpenGL context " + "requested but WGL_ARB_create_context is " + "unavailable"); return _GLFW_RECREATION_IMPOSSIBLE; } @@ -552,9 +553,9 @@ int _glfwAnalyzeContext(const _GLFWwindow* window, { if (!window->WGL.ARB_create_context_profile) { - _glfwSetError(GLFW_VERSION_UNAVAILABLE, - "WGL: OpenGL profile requested but " - "WGL_ARB_create_context_profile is unavailable"); + _glfwInputError(GLFW_VERSION_UNAVAILABLE, + "WGL: OpenGL profile requested but " + "WGL_ARB_create_context_profile is unavailable"); return _GLFW_RECREATION_IMPOSSIBLE; } @@ -567,9 +568,9 @@ int _glfwAnalyzeContext(const _GLFWwindow* window, !window->WGL.ARB_create_context_profile || !window->WGL.EXT_create_context_es2_profile) { - _glfwSetError(GLFW_VERSION_UNAVAILABLE, - "WGL: OpenGL ES requested but " - "WGL_ARB_create_context_es2_profile is unavailable"); + _glfwInputError(GLFW_VERSION_UNAVAILABLE, + "WGL: OpenGL ES requested but " + "WGL_ARB_create_context_es2_profile is unavailable"); return _GLFW_RECREATION_IMPOSSIBLE; } diff --git a/src/win32_clipboard.c b/src/win32_clipboard.c index 22cdb8f6..788605c7 100644 --- a/src/win32_clipboard.c +++ b/src/win32_clipboard.c @@ -52,7 +52,7 @@ void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string) wideString = _glfwCreateWideStringFromUTF8(string); if (!wideString) { - _glfwSetError(GLFW_PLATFORM_ERROR, + _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to convert clipboard string to " "wide string"); return; @@ -65,8 +65,8 @@ void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string) { free(wideString); - _glfwSetError(GLFW_PLATFORM_ERROR, - "Win32: Failed to allocate global handle for clipboard"); + _glfwInputError(GLFW_PLATFORM_ERROR, + "Win32: Failed to allocate global handle for clipboard"); return; } @@ -78,8 +78,7 @@ void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string) GlobalFree(stringHandle); free(wideString); - _glfwSetError(GLFW_PLATFORM_ERROR, - "Win32: Failed to open clipboard"); + _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to open clipboard"); return; } @@ -101,14 +100,13 @@ const char* _glfwPlatformGetClipboardString(_GLFWwindow* window) if (!IsClipboardFormatAvailable(CF_UNICODETEXT)) { - _glfwSetError(GLFW_FORMAT_UNAVAILABLE, NULL); + _glfwInputError(GLFW_FORMAT_UNAVAILABLE, NULL); return NULL; } if (!OpenClipboard(window->Win32.handle)) { - _glfwSetError(GLFW_PLATFORM_ERROR, - "Win32: Failed to open clipboard"); + _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to open clipboard"); return NULL; } @@ -117,8 +115,8 @@ const char* _glfwPlatformGetClipboardString(_GLFWwindow* window) { CloseClipboard(); - _glfwSetError(GLFW_PLATFORM_ERROR, - "Win32: Failed to retrieve clipboard data"); + _glfwInputError(GLFW_PLATFORM_ERROR, + "Win32: Failed to retrieve clipboard data"); return NULL; } @@ -131,8 +129,8 @@ const char* _glfwPlatformGetClipboardString(_GLFWwindow* window) if (!_glfwLibrary.Win32.clipboardString) { - _glfwSetError(GLFW_PLATFORM_ERROR, - "Win32: Failed to convert wide string to UTF-8"); + _glfwInputError(GLFW_PLATFORM_ERROR, + "Win32: Failed to convert wide string to UTF-8"); return NULL; } diff --git a/src/win32_fullscreen.c b/src/win32_fullscreen.c index 26740d11..49a63f5f 100644 --- a/src/win32_fullscreen.c +++ b/src/win32_fullscreen.c @@ -243,7 +243,7 @@ GLFWvidmode* _glfwPlatformGetVideoModes(int* found) { free(result); - _glfwSetError(GLFW_OUT_OF_MEMORY, NULL); + _glfwInputError(GLFW_OUT_OF_MEMORY, NULL); return NULL; } diff --git a/src/win32_native.c b/src/win32_native.c index 80cc5730..94931f69 100644 --- a/src/win32_native.c +++ b/src/win32_native.c @@ -47,7 +47,7 @@ GLFWAPI HWND glfwGetWin32Window(GLFWwindow handle) if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return NULL; } @@ -65,7 +65,7 @@ GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow handle) if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return NULL; } diff --git a/src/win32_window.c b/src/win32_window.c index d114fd70..eef8eb9d 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -704,8 +704,8 @@ static ATOM registerWindowClass(void) classAtom = RegisterClass(&wc); if (!classAtom) { - _glfwSetError(GLFW_PLATFORM_ERROR, - "Win32: Failed to register window class"); + _glfwInputError(GLFW_PLATFORM_ERROR, + "Win32: Failed to register window class"); return 0; } @@ -781,8 +781,8 @@ static int createWindow(_GLFWwindow* window, wideTitle = _glfwCreateWideStringFromUTF8(wndconfig->title); if (!wideTitle) { - _glfwSetError(GLFW_PLATFORM_ERROR, - "Win32: Failed to convert title to wide string"); + _glfwInputError(GLFW_PLATFORM_ERROR, + "Win32: Failed to convert title to wide string"); return GL_FALSE; } @@ -800,7 +800,7 @@ static int createWindow(_GLFWwindow* window, 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; } @@ -963,8 +963,8 @@ void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title) WCHAR* wideTitle = _glfwCreateWideStringFromUTF8(title); if (!wideTitle) { - _glfwSetError(GLFW_PLATFORM_ERROR, - "Win32: Failed to convert title to wide string"); + _glfwInputError(GLFW_PLATFORM_ERROR, + "Win32: Failed to convert title to wide string"); return; } diff --git a/src/window.c b/src/window.c index 1db4fed1..c78a2bf7 100644 --- a/src/window.c +++ b/src/window.c @@ -216,7 +216,7 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height, if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return NULL; } @@ -265,20 +265,20 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height, if (mode != GLFW_WINDOWED && mode != GLFW_FULLSCREEN) { - _glfwSetError(GLFW_INVALID_ENUM, "Invalid window mode"); + _glfwInputError(GLFW_INVALID_ENUM, "Invalid window mode"); return GL_FALSE; } if (width <= 0 || height <= 0) { - _glfwSetError(GLFW_INVALID_VALUE, "Invalid window size"); + _glfwInputError(GLFW_INVALID_VALUE, "Invalid window size"); return GL_FALSE; } window = (_GLFWwindow*) calloc(1, sizeof(_GLFWwindow)); if (!window) { - _glfwSetError(GLFW_OUT_OF_MEMORY, NULL); + _glfwInputError(GLFW_OUT_OF_MEMORY, NULL); return NULL; } @@ -349,7 +349,7 @@ void glfwDefaultWindowHints(void) { if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } @@ -385,7 +385,7 @@ GLFWAPI void glfwWindowHint(int target, int hint) { if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } @@ -470,7 +470,7 @@ GLFWAPI void glfwWindowHint(int target, int hint) _glfwLibrary.hints.glProfile = hint; break; default: - _glfwSetError(GLFW_INVALID_ENUM, NULL); + _glfwInputError(GLFW_INVALID_ENUM, NULL); break; } } @@ -486,7 +486,7 @@ GLFWAPI void glfwDestroyWindow(GLFWwindow handle) if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } @@ -543,7 +543,7 @@ GLFWAPI void glfwSetWindowTitle(GLFWwindow handle, const char* title) if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } @@ -561,7 +561,7 @@ GLFWAPI void glfwGetWindowSize(GLFWwindow handle, int* width, int* height) if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } @@ -583,7 +583,7 @@ GLFWAPI void glfwSetWindowSize(GLFWwindow handle, int width, int height) if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } @@ -618,7 +618,7 @@ GLFWAPI void glfwIconifyWindow(GLFWwindow handle) if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } @@ -639,7 +639,7 @@ GLFWAPI void glfwRestoreWindow(GLFWwindow handle) if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } @@ -663,7 +663,7 @@ GLFWAPI void glfwShowWindow(GLFWwindow handle) if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } @@ -684,7 +684,7 @@ GLFWAPI void glfwHideWindow(GLFWwindow handle) if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } @@ -705,7 +705,7 @@ GLFWAPI int glfwGetWindowParam(GLFWwindow handle, int param) if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return 0; } @@ -745,7 +745,7 @@ GLFWAPI int glfwGetWindowParam(GLFWwindow handle, int param) return window->glProfile; } - _glfwSetError(GLFW_INVALID_ENUM, NULL); + _glfwInputError(GLFW_INVALID_ENUM, NULL); return 0; } @@ -760,7 +760,7 @@ GLFWAPI void glfwSetWindowUserPointer(GLFWwindow handle, void* pointer) if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } @@ -778,7 +778,7 @@ GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow handle) if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return NULL; } @@ -796,7 +796,7 @@ GLFWAPI void glfwSetWindowPosCallback(GLFWwindow handle, GLFWwindowposfun cbfun) if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } @@ -814,7 +814,7 @@ GLFWAPI void glfwSetWindowSizeCallback(GLFWwindow handle, GLFWwindowsizefun cbfu if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } @@ -832,7 +832,7 @@ GLFWAPI void glfwSetWindowCloseCallback(GLFWwindow handle, GLFWwindowclosefun cb if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } @@ -850,7 +850,7 @@ GLFWAPI void glfwSetWindowRefreshCallback(GLFWwindow handle, GLFWwindowrefreshfu if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } @@ -868,7 +868,7 @@ GLFWAPI void glfwSetWindowFocusCallback(GLFWwindow handle, GLFWwindowfocusfun cb if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } @@ -886,7 +886,7 @@ GLFWAPI void glfwSetWindowIconifyCallback(GLFWwindow handle, GLFWwindowiconifyfu if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } @@ -902,7 +902,7 @@ GLFWAPI void glfwPollEvents(void) { if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } @@ -920,7 +920,7 @@ GLFWAPI void glfwWaitEvents(void) { if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return; } diff --git a/src/x11_clipboard.c b/src/x11_clipboard.c index 5bc92d44..7cdb56a6 100644 --- a/src/x11_clipboard.c +++ b/src/x11_clipboard.c @@ -181,8 +181,8 @@ const char* _glfwPlatformGetClipboardString(_GLFWwindow* window) if (_glfwLibrary.X11.selection.status == _GLFW_CONVERSION_FAILED) { - _glfwSetError(GLFW_FORMAT_UNAVAILABLE, - "X11: Failed to convert selection to string"); + _glfwInputError(GLFW_FORMAT_UNAVAILABLE, + "X11: Failed to convert selection to string"); return NULL; } diff --git a/src/x11_fullscreen.c b/src/x11_fullscreen.c index 9b1121fc..9d749ad1 100644 --- a/src/x11_fullscreen.c +++ b/src/x11_fullscreen.c @@ -441,8 +441,8 @@ GLFWvidmode* _glfwPlatformGetVideoModes(int* found) visuals = XGetVisualInfo(_glfwLibrary.X11.display, 0, &dummy, &visualCount); if (visuals == NULL) { - _glfwSetError(GLFW_PLATFORM_ERROR, - "X11: Failed to retrieve the available visuals"); + _glfwInputError(GLFW_PLATFORM_ERROR, + "X11: Failed to retrieve the available visuals"); return 0; } diff --git a/src/x11_gamma.c b/src/x11_gamma.c index 148ae740..359c6fd5 100644 --- a/src/x11_gamma.c +++ b/src/x11_gamma.c @@ -114,9 +114,9 @@ void _glfwPlatformGetGammaRamp(GLFWgammaramp* ramp) // For now, don't support anything that is not GLFW_GAMMA_RAMP_SIZE if (_glfwLibrary.originalRampSize != GLFW_GAMMA_RAMP_SIZE) { - _glfwSetError(GLFW_PLATFORM_ERROR, - "X11: Failed to get gamma ramp due to size " - "incompatibility"); + _glfwInputError(GLFW_PLATFORM_ERROR, + "X11: Failed to get gamma ramp due to size " + "incompatibility"); return; } @@ -165,9 +165,9 @@ void _glfwPlatformSetGammaRamp(const GLFWgammaramp* ramp) // For now, don't support anything that is not GLFW_GAMMA_RAMP_SIZE if (_glfwLibrary.originalRampSize != GLFW_GAMMA_RAMP_SIZE) { - _glfwSetError(GLFW_PLATFORM_ERROR, - "X11: Failed to set gamma ramp due to size " - "incompatibility"); + _glfwInputError(GLFW_PLATFORM_ERROR, + "X11: Failed to set gamma ramp due to size " + "incompatibility"); return; } diff --git a/src/x11_init.c b/src/x11_init.c index e260c6cc..591a9b9d 100644 --- a/src/x11_init.c +++ b/src/x11_init.c @@ -491,7 +491,7 @@ static GLboolean initDisplay(void) _glfwLibrary.X11.display = XOpenDisplay(NULL); 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; } @@ -524,8 +524,8 @@ static GLboolean initDisplay(void) &_glfwLibrary.X11.RandR.majorVersion, &_glfwLibrary.X11.RandR.minorVersion)) { - _glfwSetError(GLFW_PLATFORM_ERROR, - "X11: Failed to query RandR version"); + _glfwInputError(GLFW_PLATFORM_ERROR, + "X11: Failed to query RandR version"); return GL_FALSE; } } diff --git a/src/x11_joystick.c b/src/x11_joystick.c index 230edcb4..e81221f6 100644 --- a/src/x11_joystick.c +++ b/src/x11_joystick.c @@ -88,7 +88,7 @@ static int openJoystickDevice(int joy, const char* path) { close(fd); - _glfwSetError(GLFW_OUT_OF_MEMORY, NULL); + _glfwInputError(GLFW_OUT_OF_MEMORY, NULL); return GL_FALSE; } @@ -99,7 +99,7 @@ static int openJoystickDevice(int joy, const char* path) free(_glfwLibrary.X11.joystick[joy].axis); close(fd); - _glfwSetError(GLFW_OUT_OF_MEMORY, NULL); + _glfwInputError(GLFW_OUT_OF_MEMORY, NULL); return GL_FALSE; } @@ -193,7 +193,7 @@ int _glfwInitJoysticks(void) 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; } @@ -280,7 +280,7 @@ int _glfwPlatformGetJoystickParam(int joy, int param) return _glfwLibrary.X11.joystick[joy].numButtons; default: - _glfwSetError(GLFW_INVALID_ENUM, NULL); + _glfwInputError(GLFW_INVALID_ENUM, NULL); } return 0; diff --git a/src/x11_native.c b/src/x11_native.c index 22f30112..9e1effd4 100644 --- a/src/x11_native.c +++ b/src/x11_native.c @@ -57,7 +57,7 @@ GLFWAPI Window glfwGetX11Window(GLFWwindow handle) if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return 0; } @@ -75,7 +75,7 @@ GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow handle) if (!_glfwInitialized) { - _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + _glfwInputError(GLFW_NOT_INITIALIZED, NULL); return NULL; } diff --git a/src/x11_window.c b/src/x11_window.c index bc880d77..846965cc 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -133,7 +133,7 @@ static GLboolean createWindow(_GLFWwindow* window, // TODO: Handle all the various error codes here and translate them // to GLFW errors - _glfwSetError(GLFW_PLATFORM_ERROR, "X11: Failed to create window"); + _glfwInputError(GLFW_PLATFORM_ERROR, "X11: Failed to create window"); return GL_FALSE; } @@ -197,8 +197,8 @@ static GLboolean createWindow(_GLFWwindow* window, XWMHints* hints = XAllocWMHints(); if (!hints) { - _glfwSetError(GLFW_OUT_OF_MEMORY, - "X11: Failed to allocate WM hints"); + _glfwInputError(GLFW_OUT_OF_MEMORY, + "X11: Failed to allocate WM hints"); return GL_FALSE; } @@ -214,8 +214,8 @@ static GLboolean createWindow(_GLFWwindow* window, XSizeHints* hints = XAllocSizeHints(); if (!hints) { - _glfwSetError(GLFW_OUT_OF_MEMORY, - "X11: Failed to allocate size hints"); + _glfwInputError(GLFW_OUT_OF_MEMORY, + "X11: Failed to allocate size hints"); return GL_FALSE; }