Commit 0eccf75f authored by Camilla Berglund's avatar Camilla Berglund
Browse files

Replace GL booleans with public macros

parent 13fbb474
......@@ -61,6 +61,8 @@ GLFW bundles a number of dependencies in the `deps/` directory.
## Changelog
- Added `GLFW_TRUE` and `GLFW_FALSE` as client API independent boolean values
## Contact
......
......@@ -103,7 +103,7 @@ creating OpenGL contexts of version 2.1 and below. Where this extension is
unavailable, the `GLFW_CONTEXT_VERSION_MAJOR` and `GLFW_CONTEXT_VERSION_MINOR`
hints will only be partially supported, the `GLFW_OPENGL_DEBUG_CONTEXT` hint
will have no effect, and setting the `GLFW_OPENGL_PROFILE` or
`GLFW_OPENGL_FORWARD_COMPAT` hints to `GL_TRUE` will cause @ref
`GLFW_OPENGL_FORWARD_COMPAT` hints to `GLFW_TRUE` will cause @ref
glfwCreateWindow to fail.
GLFW uses the `GLX_ARB_create_context_profile` extension to provide support for
......@@ -146,7 +146,7 @@ creating OpenGL contexts of version 2.1 and below. Where this extension is
unavailable, the `GLFW_CONTEXT_VERSION_MAJOR` and `GLFW_CONTEXT_VERSION_MINOR`
hints will only be partially supported, the `GLFW_OPENGL_DEBUG_CONTEXT` hint
will have no effect, and setting the `GLFW_OPENGL_PROFILE` or
`GLFW_OPENGL_FORWARD_COMPAT` hints to `GL_TRUE` will cause @ref
`GLFW_OPENGL_FORWARD_COMPAT` hints to `GLFW_TRUE` will cause @ref
glfwCreateWindow to fail.
GLFW uses the `WGL_ARB_create_context_profile` extension to provide support for
......@@ -176,7 +176,7 @@ version 2.1.
Because of this, on OS X 10.7 and later, the `GLFW_CONTEXT_VERSION_MAJOR` and
`GLFW_CONTEXT_VERSION_MINOR` hints will cause @ref glfwCreateWindow to fail if
given version 3.0 or 3.1, the `GLFW_OPENGL_FORWARD_COMPAT` hint must be set to
`GL_TRUE` and the `GLFW_OPENGL_PROFILE` hint must be set to
`GLFW_TRUE` and the `GLFW_OPENGL_PROFILE` hint must be set to
`GLFW_OPENGL_CORE_PROFILE` when creating OpenGL 3.2 and later contexts and the
`GLFW_OPENGL_DEBUG_CONTEXT` hint is ignored.
......
......@@ -64,7 +64,7 @@ contexts with hidden windows can be created with the
[GLFW_VISIBLE](@ref window_hints_wnd) window hint.
@code
glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
GLFWwindow* offscreen_context = glfwCreateWindow(640, 480, "", NULL, NULL);
@endcode
......@@ -271,8 +271,8 @@ if (glfwExtensionSupported("GL_ARB_debug_output"))
@endcode
The argument is a null terminated ASCII string with the extension name. If the
extension is supported, @ref glfwExtensionSupported returns `GL_TRUE`, otherwise
it returns `GL_FALSE`.
extension is supported, @ref glfwExtensionSupported returns `GLFW_TRUE`,
otherwise it returns `GLFW_FALSE`.
@subsubsection context_glext_proc Fetching function pointers
......
......@@ -37,7 +37,7 @@ GLFW_NOT_INITIALIZED error.
@subsection intro_init_init Initializing GLFW
The library is initialized with @ref glfwInit, which returns `GL_FALSE` if an
The library is initialized with @ref glfwInit, which returns `GLFW_FALSE` if an
error occurred.
@code
......@@ -50,7 +50,7 @@ if (!glfwInit())
If any part of initialization fails, all remaining bits are terminated as if
@ref glfwTerminate was called. The library only needs to be initialized once
and additional calls to an already initialized library will simply return
`GL_TRUE` immediately.
`GLFW_TRUE` immediately.
Once the library has been successfully initialized, it should be terminated
before the application exits.
......
......@@ -216,7 +216,7 @@ glfwTerminate, the window is "open".
A user attempting to close a window is now just an event like any other. Unlike
GLFW 2, windows and contexts created with GLFW 3 will never be destroyed unless
you choose them to be. Each window now has a close flag that is set to
`GL_TRUE` when the user attempts to close that window. By default, nothing else
`GLFW_TRUE` when the user attempts to close that window. By default, nothing else
happens and the window stays visible. It is then up to you to either destroy
the window, take some other action or simply ignore the request.
......@@ -254,7 +254,7 @@ int GLFWCALL window_close_callback(void);
void window_close_callback(GLFWwindow* window);
@endcode
@note GLFW never clears the close flag to `GL_FALSE`, meaning you can use it
@note GLFW never clears the close flag to `GLFW_FALSE`, meaning you can use it
for other reasons to close the window as well, for example the user choosing
Quit from an in-game menu.
......
......@@ -60,8 +60,8 @@ the GLFW header.
@subsection quick_init_term Initializing and terminating GLFW
Before you can use most GLFW functions, the library must be initialized. On
successful initialization, `GL_TRUE` is returned. If an error occurred,
`GL_FALSE` is returned.
successful initialization, `GLFW_TRUE` is returned. If an error occurred,
`GLFW_FALSE` is returned.
@code
if (!glfwInit())
......@@ -192,7 +192,7 @@ callback function.
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
glfwSetWindowShouldClose(window, GL_TRUE);
glfwSetWindowShouldClose(window, GLFW_TRUE);
}
@endcode
......
......@@ -298,12 +298,12 @@ extension.
Window hint | Default value | Supported values
------------------------------- | --------------------------- | ----------------
`GLFW_RESIZABLE` | `GL_TRUE` | `GL_TRUE` or `GL_FALSE`
`GLFW_VISIBLE` | `GL_TRUE` | `GL_TRUE` or `GL_FALSE`
`GLFW_DECORATED` | `GL_TRUE` | `GL_TRUE` or `GL_FALSE`
`GLFW_FOCUSED` | `GL_TRUE` | `GL_TRUE` or `GL_FALSE`
`GLFW_AUTO_ICONIFY` | `GL_TRUE` | `GL_TRUE` or `GL_FALSE`
`GLFW_FLOATING` | `GL_FALSE` | `GL_TRUE` or `GL_FALSE`
`GLFW_RESIZABLE` | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
`GLFW_VISIBLE` | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
`GLFW_DECORATED` | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
`GLFW_FOCUSED` | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
`GLFW_AUTO_ICONIFY` | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
`GLFW_FLOATING` | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
`GLFW_RED_BITS` | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE`
`GLFW_GREEN_BITS` | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE`
`GLFW_BLUE_BITS` | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE`
......@@ -317,16 +317,16 @@ Window hint | Default value | Supported values
`GLFW_AUX_BUFFERS` | 0 | 0 to `INT_MAX` or `GLFW_DONT_CARE`
`GLFW_SAMPLES` | 0 | 0 to `INT_MAX` or `GLFW_DONT_CARE`
`GLFW_REFRESH_RATE` | `GLFW_DONT_CARE` | 0 to `INT_MAX` or `GLFW_DONT_CARE`
`GLFW_STEREO` | `GL_FALSE` | `GL_TRUE` or `GL_FALSE`
`GLFW_SRGB_CAPABLE` | `GL_FALSE` | `GL_TRUE` or `GL_FALSE`
`GLFW_DOUBLEBUFFER` | `GL_TRUE` | `GL_TRUE` or `GL_FALSE`
`GLFW_STEREO` | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
`GLFW_SRGB_CAPABLE` | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
`GLFW_DOUBLEBUFFER` | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
`GLFW_CLIENT_API` | `GLFW_OPENGL_API` | `GLFW_OPENGL_API` or `GLFW_OPENGL_ES_API`
`GLFW_CONTEXT_VERSION_MAJOR` | 1 | Any valid major version number of the chosen client API
`GLFW_CONTEXT_VERSION_MINOR` | 0 | Any valid minor version number of the chosen client API
`GLFW_CONTEXT_ROBUSTNESS` | `GLFW_NO_ROBUSTNESS` | `GLFW_NO_ROBUSTNESS`, `GLFW_NO_RESET_NOTIFICATION` or `GLFW_LOSE_CONTEXT_ON_RESET`
`GLFW_CONTEXT_RELEASE_BEHAVIOR` | `GLFW_ANY_RELEASE_BEHAVIOR` | `GLFW_ANY_RELEASE_BEHAVIOR`, `GLFW_RELEASE_BEHAVIOR_FLUSH` or `GLFW_RELEASE_BEHAVIOR_NONE`
`GLFW_OPENGL_FORWARD_COMPAT` | `GL_FALSE` | `GL_TRUE` or `GL_FALSE`
`GLFW_OPENGL_DEBUG_CONTEXT` | `GL_FALSE` | `GL_TRUE` or `GL_FALSE`
`GLFW_OPENGL_FORWARD_COMPAT` | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
`GLFW_OPENGL_DEBUG_CONTEXT` | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
`GLFW_OPENGL_PROFILE` | `GLFW_OPENGL_ANY_PROFILE` | `GLFW_OPENGL_ANY_PROFILE`, `GLFW_OPENGL_COMPAT_PROFILE` or `GLFW_OPENGL_CORE_PROFILE`
......@@ -383,7 +383,7 @@ again unless certain conditions are met.
void window_close_callback(GLFWwindow* window)
{
if (!time_to_close)
glfwSetWindowShouldClose(window, GL_FALSE);
glfwSetWindowShouldClose(window, GLFW_FALSE);
}
@endcode
......@@ -746,11 +746,11 @@ either `GLFW_OPENGL_API` or `GLFW_OPENGL_ES_API`.
`GLFW_CONTEXT_VERSION_MAJOR`, `GLFW_CONTEXT_VERSION_MINOR` and
`GLFW_CONTEXT_REVISION` indicate the client API version of the window's context.
`GLFW_OPENGL_FORWARD_COMPAT` is `GL_TRUE` if the window's context is an OpenGL
forward-compatible one, or `GL_FALSE` otherwise.
`GLFW_OPENGL_FORWARD_COMPAT` is `GLFW_TRUE` if the window's context is an OpenGL
forward-compatible one, or `GLFW_FALSE` otherwise.
`GLFW_OPENGL_DEBUG_CONTEXT` is `GL_TRUE` if the window's context is an OpenGL
debug context, or `GL_FALSE` otherwise.
`GLFW_OPENGL_DEBUG_CONTEXT` is `GLFW_TRUE` if the window's context is an OpenGL
debug context, or `GLFW_FALSE` otherwise.
`GLFW_OPENGL_PROFILE` indicates the OpenGL profile used by the context. This is
`GLFW_OPENGL_CORE_PROFILE` or `GLFW_OPENGL_COMPAT_PROFILE` if the context uses
......
......@@ -91,7 +91,7 @@ typedef struct {float x; float y; float z;} vertex_t;
int width, height;
GLfloat deg_rot_y = 0.f;
GLfloat deg_rot_y_inc = 2.f;
GLboolean override_pos = GL_FALSE;
int override_pos = GLFW_FALSE;
GLfloat cursor_x = 0.f;
GLfloat cursor_y = 0.f;
GLfloat ball_x = -RADIUS;
......@@ -236,7 +236,7 @@ void reshape( GLFWwindow* window, int w, int h )
void key_callback( GLFWwindow* window, int key, int scancode, int action, int mods )
{
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
glfwSetWindowShouldClose(window, GL_TRUE);
glfwSetWindowShouldClose(window, GLFW_TRUE);
}
static void set_ball_pos ( GLfloat x, GLfloat y )
......@@ -252,12 +252,12 @@ void mouse_button_callback( GLFWwindow* window, int button, int action, int mods
if (action == GLFW_PRESS)
{
override_pos = GL_TRUE;
override_pos = GLFW_TRUE;
set_ball_pos(cursor_x, cursor_y);
}
else
{
override_pos = GL_FALSE;
override_pos = GLFW_FALSE;
}
}
......
......@@ -219,7 +219,7 @@ void key( GLFWwindow* window, int k, int s, int action, int mods )
view_rotz += 5.0;
break;
case GLFW_KEY_ESCAPE:
glfwSetWindowShouldClose(window, GL_TRUE);
glfwSetWindowShouldClose(window, GLFW_TRUE);
break;
case GLFW_KEY_UP:
view_rotx += 5.0;
......
......@@ -386,7 +386,7 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
{
case GLFW_KEY_ESCAPE:
/* Exit program on Escape */
glfwSetWindowShouldClose(window, GL_TRUE);
glfwSetWindowShouldClose(window, GLFW_TRUE);
break;
}
}
......@@ -414,11 +414,11 @@ int main(int argc, char** argv)
if (!glfwInit())
exit(EXIT_FAILURE);
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE);
window = glfwCreateWindow(800, 600, "GLFW OpenGL3 Heightmap demo", NULL, NULL);
if (! window )
......
......@@ -875,7 +875,7 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
switch (key)
{
case GLFW_KEY_ESCAPE:
glfwSetWindowShouldClose(window, GL_TRUE);
glfwSetWindowShouldClose(window, GLFW_TRUE);
break;
case GLFW_KEY_W:
wireframe = !wireframe;
......
......@@ -37,7 +37,7 @@ static void error_callback(int error, const char* description)
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
glfwSetWindowShouldClose(window, GL_TRUE);
glfwSetWindowShouldClose(window, GLFW_TRUE);
}
int main(void)
......
......@@ -473,7 +473,7 @@ static void mouseButtonFun(GLFWwindow* window, int button, int action, int mods)
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
glfwSetWindowShouldClose(window, GL_TRUE);
glfwSetWindowShouldClose(window, GLFW_TRUE);
}
......
......@@ -278,7 +278,7 @@ void key_callback(GLFWwindow* window, int key, int scancode, int action, int mod
switch (key)
{
case GLFW_KEY_ESCAPE:
glfwSetWindowShouldClose(window, GL_TRUE);
glfwSetWindowShouldClose(window, GLFW_TRUE);
break;
case GLFW_KEY_SPACE:
init_grid();
......
......@@ -214,6 +214,24 @@ extern "C" {
#define GLFW_VERSION_REVISION 0
/*! @} */
/*! @name Boolean values
* @{ */
/*! @brief One.
*
* One. Seriously. You don't _need_ to use this symbol in your code. It's
* just semantic sugar for the number 1. You can use `1` or `true` or `_True`
* or `GL_TRUE` or whatever you want.
*/
#define GLFW_TRUE 1
/*! @brief Zero.
*
* Zero. Seriously. You don't _need_ to use this symbol in your code. It's
* just just semantic sugar for the number 0. You can use `0` or `false` or
* `_False` or `GL_FALSE` or whatever you want.
*/
#define GLFW_FALSE 0
/*! @} */
/*! @name Key and button actions
* @{ */
/*! @brief The key or mouse button was released.
......@@ -801,8 +819,8 @@ typedef void (* GLFWwindowrefreshfun)(GLFWwindow*);
* This is the function signature for window focus callback functions.
*
* @param[in] window The window that gained or lost input focus.
* @param[in] focused `GL_TRUE` if the window was given input focus, or
* `GL_FALSE` if it lost it.
* @param[in] focused `GLFW_TRUE` if the window was given input focus, or
* `GLFW_FALSE` if it lost it.
*
* @sa glfwSetWindowFocusCallback
*
......@@ -816,8 +834,8 @@ typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int);
* functions.
*
* @param[in] window The window that was iconified or restored.
* @param[in] iconified `GL_TRUE` if the window was iconified, or `GL_FALSE`
* if it was restored.
* @param[in] iconified `GLFW_TRUE` if the window was iconified, or
* `GLFW_FALSE` if it was restored.
*
* @sa glfwSetWindowIconifyCallback
*
......@@ -876,8 +894,8 @@ typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double);
* This is the function signature for cursor enter/leave callback functions.
*
* @param[in] window The window that received the event.
* @param[in] entered `GL_TRUE` if the cursor entered the window's client
* area, or `GL_FALSE` if it left it.
* @param[in] entered `GLFW_TRUE` if the cursor entered the window's client
* area, or `GLFW_FALSE` if it left it.
*
* @sa glfwSetCursorEnterCallback
*
......@@ -1057,9 +1075,9 @@ typedef struct GLFWimage
* succeeds, you should call @ref glfwTerminate before the application exits.
*
* Additional calls to this function after successful initialization but before
* termination will return `GL_TRUE` immediately.
* termination will return `GLFW_TRUE` immediately.
*
* @return `GL_TRUE` if successful, or `GL_FALSE` if an
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
* [error](@ref error_handling) occurred.
*
* @remarks __OS X:__ This function will change the current directory of the
......@@ -2420,20 +2438,20 @@ GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode);
* and unlimited cursor movement. This is useful for implementing for
* example 3D camera controls.
*
* If the mode is `GLFW_STICKY_KEYS`, the value must be either `GL_TRUE` to
* enable sticky keys, or `GL_FALSE` to disable it. If sticky keys are
* If the mode is `GLFW_STICKY_KEYS`, the value must be either `GLFW_TRUE` to
* enable sticky keys, or `GLFW_FALSE` to disable it. If sticky keys are
* enabled, a key press will ensure that @ref glfwGetKey returns `GLFW_PRESS`
* the next time it is called even if the key had been released before the
* call. This is useful when you are only interested in whether keys have been
* pressed but not when or in which order.
*
* If the mode is `GLFW_STICKY_MOUSE_BUTTONS`, the value must be either
* `GL_TRUE` to enable sticky mouse buttons, or `GL_FALSE` to disable it. If
* sticky mouse buttons are enabled, a mouse button press will ensure that @ref
* glfwGetMouseButton returns `GLFW_PRESS` the next time it is called even if
* the mouse button had been released before the call. This is useful when you
* are only interested in whether mouse buttons have been pressed but not when
* or in which order.
* `GLFW_TRUE` to enable sticky mouse buttons, or `GLFW_FALSE` to disable it.
* If sticky mouse buttons are enabled, a mouse button press will ensure that
* @ref glfwGetMouseButton returns `GLFW_PRESS` the next time it is called even
* if the mouse button had been released before the call. This is useful when
* you are only interested in whether mouse buttons have been pressed but not
* when or in which order.
*
* @param[in] window The window whose input mode to set.
* @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
......@@ -2957,7 +2975,7 @@ GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* window, GLFWdropfun cbfun);
* This function returns whether the specified joystick is present.
*
* @param[in] joy The [joystick](@ref joysticks) to query.
* @return `GL_TRUE` if the joystick is present, or `GL_FALSE` otherwise.
* @return `GLFW_TRUE` if the joystick is present, or `GLFW_FALSE` otherwise.
*
* @par Thread Safety
* This function may only be called from the main thread.
......@@ -3279,7 +3297,8 @@ GLFWAPI void glfwSwapInterval(int interval);
* a context, so there is no danger in doing this.
*
* @param[in] extension The ASCII encoded name of the extension.
* @return `GL_TRUE` if the extension is available, or `GL_FALSE` otherwise.
* @return `GLFW_TRUE` if the extension is available, or `GLFW_FALSE`
* otherwise.
*
* @par Thread Safety
* This function may be called from any thread.
......
......@@ -207,17 +207,17 @@ int _glfwPlatformInit(void)
_glfw.ns.eventSource = CGEventSourceCreate(kCGEventSourceStateHIDSystemState);
if (!_glfw.ns.eventSource)
return GL_FALSE;
return GLFW_FALSE;
CGEventSourceSetLocalEventsSuppressionInterval(_glfw.ns.eventSource, 0.0);
if (!_glfwInitContextAPI())
return GL_FALSE;
return GLFW_FALSE;
_glfwInitTimer();
_glfwInitJoysticks();
return GL_TRUE;
return GLFW_TRUE;
}
void _glfwPlatformTerminate(void)
......
......@@ -76,28 +76,28 @@ static char* getDisplayName(CGDirectDisplayID displayID)
// Check whether the display mode should be included in enumeration
//
static GLboolean modeIsGood(CGDisplayModeRef mode)
static GLFWbool modeIsGood(CGDisplayModeRef mode)
{
uint32_t flags = CGDisplayModeGetIOFlags(mode);
if (!(flags & kDisplayModeValidFlag) || !(flags & kDisplayModeSafeFlag))
return GL_FALSE;
return GLFW_FALSE;
if (flags & kDisplayModeInterlacedFlag)
return GL_FALSE;
return GLFW_FALSE;
if (flags & kDisplayModeStretchedFlag)
return GL_FALSE;
return GLFW_FALSE;
CFStringRef format = CGDisplayModeCopyPixelEncoding(mode);
if (CFStringCompare(format, CFSTR(IO16BitDirectPixels), 0) &&
CFStringCompare(format, CFSTR(IO32BitDirectPixels), 0))
{
CFRelease(format);
return GL_FALSE;
return GLFW_FALSE;
}
CFRelease(format);
return GL_TRUE;
return GLFW_TRUE;
}
// Convert Core Graphics display mode to GLFW video mode
......@@ -166,7 +166,7 @@ static void endFadeReservation(CGDisplayFadeReservationToken token)
// Change the current video mode
//
GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
GLFWbool _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
{
CFArrayRef modes;
CFIndex count, i;
......@@ -178,7 +178,7 @@ GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
best = _glfwChooseVideoMode(monitor, desired);
_glfwPlatformGetVideoMode(monitor, &current);
if (_glfwCompareVideoModes(&current, best) == 0)
return GL_TRUE;
return GLFW_TRUE;
CVDisplayLinkCreateWithCGDisplay(monitor->ns.displayID, &link);
......@@ -216,10 +216,10 @@ GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Cocoa: Monitor mode list changed");
return GL_FALSE;
return GLFW_FALSE;
}
return GL_TRUE;
return GLFW_TRUE;
}
// Restore the previously saved (original) video mode
......@@ -283,7 +283,7 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
return monitors;
}
GLboolean _glfwPlatformIsSameMonitor(_GLFWmonitor* first, _GLFWmonitor* second)
GLFWbool _glfwPlatformIsSameMonitor(_GLFWmonitor* first, _GLFWmonitor* second)
{
// HACK: Compare unit numbers instead of display IDs to work around display
// replacement on machines with automatic graphics switching
......
......@@ -116,7 +116,7 @@ typedef struct _GLFWtimeNS
void _glfwInitTimer(void);
GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired);
GLFWbool _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired);
void _glfwRestoreVideoMode(_GLFWmonitor* monitor);
#endif // _glfw3_cocoa_platform_h_
......@@ -66,10 +66,10 @@ static void centerCursor(_GLFWwindow *window)
// Enter full screen mode
//
static GLboolean enterFullscreenMode(_GLFWwindow* window)
static GLFWbool enterFullscreenMode(_GLFWwindow* window)
{
GLFWvidmode mode;
GLboolean status;
GLFWbool status;
int xpos, ypos;
status = _glfwSetVideoMode(window->monitor, &window->videoMode);
......@@ -207,7 +207,7 @@ static int translateKey(unsigned int key)
if (window->monitor)
leaveFullscreenMode(window);
_glfwInputWindowIconify(window, GL_TRUE);
_glfwInputWindowIconify(window, GLFW_TRUE);
}
- (void)windowDidDeminiaturize:(NSNotification *)notification
......@@ -215,7 +215,7 @@ static int translateKey(unsigned int key)
if (window->monitor)
enterFullscreenMode(window);
_glfwInputWindowIconify(window, GL_FALSE);
_glfwInputWindowIconify(window, GLFW_FALSE);
}
- (void)windowDidBecomeKey:(NSNotification *)notification
......@@ -226,7 +226,7 @@ static int translateKey(unsigned int key)
centerCursor(window);
}
_glfwInputWindowFocus(window, GL_TRUE);
_glfwInputWindowFocus(window, GLFW_TRUE);
_glfwPlatformSetCursorMode(window, window->cursorMode);
}
......@@ -235,7 +235,7 @@ static int translateKey(unsigned int key)
if (window->monitor && window->autoIconify)
_glfwPlatformIconifyWindow(window);
_glfwInputWindowFocus(window, GL_FALSE);
_glfwInputWindowFocus(window, GLFW_FALSE);
}
@end
......@@ -440,12 +440,12 @@ static int translateKey(unsigned int key)
- (void)mouseExited:(NSEvent *)event
{
_glfwInputCursorEnter(window, GL_FALSE);
_glfwInputCursorEnter(window, GLFW_FALSE);
}
- (void)mouseEntered:(NSEvent *)event
{
_glfwInputCursorEnter(window, GL_TRUE);
_glfwInputCursorEnter(window, GLFW_TRUE);
}
- (void)viewDidChangeBackingProperties
......@@ -782,10 +782,10 @@ static void createMenuBar(void)
// Initialize the Cocoa Application Kit
//
static GLboolean initializeAppKit(void)
static GLFWbool initializeAppKit(void)
{
if (NSApp)
return GL_TRUE;
return GLFW_TRUE;
// Implicitly create shared NSApplication instance
[GLFWApplication sharedApplication];
......@@ -807,26 +807,26 @@ static GLboolean initializeAppKit(void)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Cocoa: Failed to create application delegate");
return GL_FALSE;
return GLFW_FALSE;
}
[NSApp setDelegate:_glfw.ns.delegate];
[NSApp run];
return GL_TRUE;
return GLFW_TRUE;
}
// Create the Cocoa window
//
static GLboolean createWindow(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig)
static GLFWbool createWindow(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig)
{
window->ns.delegate = [[GLFWWindowDelegate alloc] initWithGlfwWindow:window];
if (window->ns.delegate == nil)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Cocoa: Failed to create window delegate");
return GL_FALSE;
return GLFW_FALSE;
}
unsigned int styleMask = 0;
......@@ -866,7 +866,7 @@ static GLboolean createWindow(_GLFWwindow* window,
if (window->ns.object == nil)
{
_glfwInputError(GLFW_PLATFORM_ERROR, "Cocoa: Failed to create window");
return GL_FALSE;
return GLFW_FALSE;
}
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
......@@ -908,7 +908,7 @@ static GLboolean createWindow(_GLFWwindow* window,
[window->ns.object setRestorable:NO];
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
return GL_TRUE;
return GLFW_TRUE;
}
......@@ -922,13 +922,13 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
const _GLFWfbconfig* fbconfig)
{
if (!initializeAppKit())
return GL_FALSE;
return GLFW_FALSE;
if (!createWindow(window, wndconfig))
return GL_FALSE;
return GLFW_FALSE;
if (!_glfwCreateContext(window, ctxconfig, fbconfig))