diff --git a/README.md b/README.md index b5edf5ff..39976fae 100644 --- a/README.md +++ b/README.md @@ -330,6 +330,7 @@ GLFW. * Renamed header directory `GL` to `GLFW` * Renamed `glfw.h` to `glfw3.h` to avoid conflicts with 2.x series * Renamed `glfwOpenWindowHint` to `glfwWindowHint` + * Renamed `glfwGetWindowParam` to `glfwGetWindowAttrib` * Renamed `GLFW_ACTIVE` to `GLFW_FOCUSED` * Renamed `GLFW_FSAA_SAMPLES` to `GLFW_SAMPLES` * Renamed `GLFW_WINDOW_NO_RESIZE` to `GLFW_RESIZABLE` diff --git a/docs/moving.dox b/docs/moving.dox index 430cb406..6ce4443d 100644 --- a/docs/moving.dox +++ b/docs/moving.dox @@ -257,7 +257,8 @@ Unix-like systems, where it uses the | `glfwSetMousePosCallback` | @ref glfwSetCursorPosCallback | | | `glfwSetMouseWheelCallback` | @ref glfwSetScrollCallback | Accepts two-dimensional scroll offsets as doubles | | `glfwGetJoystickPos` | @ref glfwGetJoystickAxes | | -| `glfwGetGLVersion` | @ref glfwGetWindowParam | Use `GLFW_OPENGL_VERSION_MAJOR`, `GLFW_OPENGL_VERSION_MINOR` and `GLFW_OPENGL_REVISION` | +| `glfwGetWindowParam` | @ref glfwGetWindowAttrib | | +| `glfwGetGLVersion` | @ref glfwGetWindowAttrib | Use `GLFW_OPENGL_VERSION_MAJOR`, `GLFW_OPENGL_VERSION_MINOR` and `GLFW_OPENGL_REVISION` | | `glfwGetDesktopMode` | @ref glfwGetVideoMode | Returns the current mode of a monitor | @subsection moving_renamed_tokens Tokens diff --git a/docs/quick.dox b/docs/quick.dox index 1e83bc8e..e38caa6d 100644 --- a/docs/quick.dox +++ b/docs/quick.dox @@ -167,7 +167,7 @@ glfwMakeContextCurrent(window); @endcode -@section quick_window_params Checking the window close flag +@section quick_window_close Checking the window close flag Each window has a flag indicating whether the window should be closed. This can be checked with @ref glfwWindowShouldClose. diff --git a/docs/window.dox b/docs/window.dox index 079c3787..55531fd5 100644 --- a/docs/window.dox +++ b/docs/window.dox @@ -25,7 +25,7 @@ glfwInit, can be individually set with @ref glfwWindowHint and reset all at once to their defaults with @ref glfwDefaultWindowHints. Note again that they need to be set *before* the creation of the window you wish -to have the specified properties. +to have the specified attributes. @subsection window_hints_hard Hard and soft constraints @@ -34,8 +34,8 @@ Some window hints are hard constraints. These must match the available capabilities *exactly* for window and context creation to succeed. Hints that are not hard constraints are matched as closely as possible, but the resulting window and context may differ from what these hints requested. To -find out the actual parameters of the created window and context, use the -@ref glfwGetWindowParam function. +find out the actual attributes of the created window and context, use the +@ref glfwGetWindowAttrib function. The following hints are hard constraints: - `GLFW_STEREO` diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index 127b263f..7a82099c 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -1159,8 +1159,8 @@ GLFWAPI void glfwWindowHint(int target, int hint); * as not all parameters and hints are * [hard constraints](@ref window_hints_hard). This includes the size of the * window, especially for full screen windows. To retrieve the actual - * properties of the window and context, use queries like @ref - * glfwGetWindowParam and @ref glfwGetWindowSize. + * attributes of the created window and context, use queries like @ref + * glfwGetWindowAttrib and @ref glfwGetWindowSize. * * @param[in] width The desired width, in screen coordinates, of the window. * This must be greater than zero. @@ -1435,56 +1435,56 @@ GLFWAPI void glfwHideWindow(GLFWwindow* window); */ GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window); -/*! @brief Returns a parameter of the specified window. +/*! @brief Returns an attribute of the specified window. * - * This function returns a property of the specified window. There are many - * different properties, some related to the window and others to its context. + * This function returns an attribute of the specified window. There are many + * attributes, some related to the window and others to its context. * * @param[in] window The window to query. - * @param[in] param The parameter whose value to return. - * @return The value of the parameter, or zero if an error occurred. + * @param[in] attrib The attribute whose value to return. + * @return The value of the attribute, or zero if an error occurred. * - * @par Window parameters + * @par Window attributes * - * The `GLFW_FOCUSED` parameter indicates whether the window is focused. + * The `GLFW_FOCUSED` attribute indicates whether the window is focused. * - * The `GLFW_ICONIFIED` parameter indicates whether the window is iconified. + * The `GLFW_ICONIFIED` attribute indicates whether the window is iconified. * - * The `GLFW_VISIBLE` parameter indicates whether the window is visible. + * The `GLFW_VISIBLE` attribute indicates whether the window is visible. * - * The `GLFW_RESIZABLE` parameter indicates whether the window is resizable + * The `GLFW_RESIZABLE` attribute indicates whether the window is resizable * by the user. * - * The `GLFW_DECORATED` parameter indicates whether the window is decorated. + * The `GLFW_DECORATED` attribute indicates whether the window is decorated. * - * @par Context parameters + * @par Context attributes * - * The `GLFW_CLIENT_API` parameter indicates the client API provided by the + * The `GLFW_CLIENT_API` attribute indicates the client API provided by the * window's context; either `GLFW_OPENGL_API` or `GLFW_OPENGL_ES_API`. * * The `GLFW_CONTEXT_VERSION_MAJOR`, `GLFW_CONTEXT_VERSION_MINOR` and - * `GLFW_CONTEXT_REVISION` parameters indicate the client API version of the + * `GLFW_CONTEXT_REVISION` attributes indicate the client API version of the * window's context. * - * The `GLFW_OPENGL_FORWARD_COMPAT` parameter is `GL_TRUE` if the window's + * The `GLFW_OPENGL_FORWARD_COMPAT` attribute is `GL_TRUE` if the window's * context is an OpenGL forward-compatible one, or `GL_FALSE` otherwise. * - * The `GLFW_OPENGL_DEBUG_CONTEXT` parameter is `GL_TRUE` if the window's + * The `GLFW_OPENGL_DEBUG_CONTEXT` attribute is `GL_TRUE` if the window's * context is an OpenGL debug context, or `GL_FALSE` otherwise. * - * The `GLFW_OPENGL_PROFILE` parameter indicates the OpenGL profile used by the + * The `GLFW_OPENGL_PROFILE` attribute indicates the OpenGL profile used by the * context. This is `GLFW_OPENGL_CORE_PROFILE` or `GLFW_OPENGL_COMPAT_PROFILE` * if the context uses a known profile, or `GLFW_OPENGL_NO_PROFILE` if the * OpenGL profile is unknown or the context is for another client API. * - * The `GLFW_CONTEXT_ROBUSTNESS` parameter indicates the robustness strategy + * The `GLFW_CONTEXT_ROBUSTNESS` attribute indicates the robustness strategy * used by the context. This is `GLFW_LOSE_CONTEXT_ON_RESET` or * `GLFW_NO_RESET_NOTIFICATION` if the window's context supports robustness, or * `GLFW_NO_ROBUSTNESS` otherwise. * * @ingroup window */ -GLFWAPI int glfwGetWindowParam(GLFWwindow* window, int param); +GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib); /*! @brief Sets the user pointer of the specified window. * diff --git a/src/context.c b/src/context.c index 81b16876..deb73983 100644 --- a/src/context.c +++ b/src/context.c @@ -361,7 +361,7 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired, return closest; } -GLboolean _glfwRefreshContextParams(void) +GLboolean _glfwRefreshContextAttribs(void) { _GLFWwindow* window = _glfwPlatformGetCurrentContext(); diff --git a/src/internal.h b/src/internal.h index f8f281f5..0b910676 100644 --- a/src/internal.h +++ b/src/internal.h @@ -690,15 +690,15 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired, const _GLFWfbconfig* alternatives, unsigned int count); -/*! @brief Checks and reads back properties from the current context. +/*! @brief Retrieves the attributes of the current context. * @return `GL_TRUE` if successful, or `GL_FALSE` if the context is unusable. * @ingroup utility */ -GLboolean _glfwRefreshContextParams(void); +GLboolean _glfwRefreshContextAttribs(void); -/*! @brief Checks whether the desired context properties are valid. - * @param[in] wndconfig The context properties to check. - * @return `GL_TRUE` if the context properties are valid, or `GL_FALSE` +/*! @brief Checks whether the desired context attributes are valid. + * @param[in] wndconfig The context attributes to check. + * @return `GL_TRUE` if the context attributes are valid, or `GL_FALSE` * otherwise. * @ingroup utility * @@ -710,7 +710,7 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig); /*! @brief Checks whether the current context fulfils the specified hard * constraints. - * @param[in] wndconfig The desired context properties. + * @param[in] wndconfig The desired context attributes. * @return `GL_TRUE` if the context fulfils the hard constraints, or `GL_FALSE` * otherwise. * @ingroup utility diff --git a/src/window.c b/src/window.c index 4da35a0a..0a2d0af9 100644 --- a/src/window.c +++ b/src/window.c @@ -226,8 +226,8 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, glfwMakeContextCurrent((GLFWwindow*) window); - // Cache the actual (as opposed to requested) context parameters - if (!_glfwRefreshContextParams()) + // Retrieve the actual (as opposed to requested) context attributes + if (!_glfwRefreshContextAttribs()) { glfwDestroyWindow((GLFWwindow*) window); glfwMakeContextCurrent((GLFWwindow*) previous); @@ -521,13 +521,13 @@ GLFWAPI void glfwHideWindow(GLFWwindow* handle) _glfwPlatformHideWindow(window); } -GLFWAPI int glfwGetWindowParam(GLFWwindow* handle, int param) +GLFWAPI int glfwGetWindowAttrib(GLFWwindow* handle, int attrib) { _GLFWwindow* window = (_GLFWwindow*) handle; _GLFW_REQUIRE_INIT_OR_RETURN(0); - switch (param) + switch (attrib) { case GLFW_FOCUSED: return window == _glfw.focusedWindow; diff --git a/tests/defaults.c b/tests/defaults.c index 110251e4..d03f27c8 100644 --- a/tests/defaults.c +++ b/tests/defaults.c @@ -23,8 +23,8 @@ // //======================================================================== // -// This test creates a windowed mode window with all parameters set to -// default values and then reports the actual parameters of the created +// This test creates a windowed mode window with all window hints set to +// default values and then reports the actual attributes of the created // window and context // //======================================================================== @@ -37,18 +37,18 @@ typedef struct { - int param; + int attrib; const char* ext; const char* name; -} ParamGL; +} AttribGL; typedef struct { - int param; + int attrib; const char* name; -} ParamGLFW; +} AttribGLFW; -static ParamGL gl_params[] = +static AttribGL gl_attribs[] = { { GL_RED_BITS, NULL, "red bits" }, { GL_GREEN_BITS, NULL, "green bits" }, @@ -61,7 +61,7 @@ static ParamGL gl_params[] = { 0, NULL, NULL } }; -static ParamGLFW glfw_params[] = +static AttribGLFW glfw_attribs[] = { { GLFW_CONTEXT_VERSION_MAJOR, "Context version major" }, { GLFW_CONTEXT_VERSION_MINOR, "Context version minor" }, @@ -100,26 +100,26 @@ int main(void) printf("window size: %ix%i\n", width, height); - for (i = 0; glfw_params[i].name; i++) + for (i = 0; glfw_attribs[i].name; i++) { printf("%s: %i\n", - glfw_params[i].name, - glfwGetWindowParam(window, glfw_params[i].param)); + glfw_attribs[i].name, + glfwGetWindowAttrib(window, glfw_attribs[i].attrib)); } - for (i = 0; gl_params[i].name; i++) + for (i = 0; gl_attribs[i].name; i++) { GLint value = 0; - if (gl_params[i].ext) + if (gl_attribs[i].ext) { - if (!glfwExtensionSupported(gl_params[i].ext)) + if (!glfwExtensionSupported(gl_attribs[i].ext)) continue; } - glGetIntegerv(gl_params[i].param, &value); + glGetIntegerv(gl_attribs[i].attrib, &value); - printf("%s: %i\n", gl_params[i].name, value); + printf("%s: %i\n", gl_attribs[i].name, value); } glfwDestroyWindow(window); diff --git a/tests/glfwinfo.c b/tests/glfwinfo.c index d62013d5..87e4c9c5 100644 --- a/tests/glfwinfo.c +++ b/tests/glfwinfo.c @@ -293,10 +293,10 @@ int main(int argc, char** argv) // Report client API version - api = glfwGetWindowParam(window, GLFW_CLIENT_API); - major = glfwGetWindowParam(window, GLFW_CONTEXT_VERSION_MAJOR); - minor = glfwGetWindowParam(window, GLFW_CONTEXT_VERSION_MINOR); - revision = glfwGetWindowParam(window, GLFW_CONTEXT_REVISION); + api = glfwGetWindowAttrib(window, GLFW_CLIENT_API); + major = glfwGetWindowAttrib(window, GLFW_CONTEXT_VERSION_MAJOR); + minor = glfwGetWindowAttrib(window, GLFW_CONTEXT_VERSION_MINOR); + revision = glfwGetWindowAttrib(window, GLFW_CONTEXT_REVISION); printf("%s context version string: \"%s\"\n", get_client_api_name(api), @@ -325,18 +325,18 @@ int main(int argc, char** argv) printf("%s context flags parsed by GLFW:", get_client_api_name(api)); - if (glfwGetWindowParam(window, GLFW_OPENGL_FORWARD_COMPAT)) + if (glfwGetWindowAttrib(window, GLFW_OPENGL_FORWARD_COMPAT)) printf(" forward-compatible"); - if (glfwGetWindowParam(window, GLFW_OPENGL_DEBUG_CONTEXT)) + if (glfwGetWindowAttrib(window, GLFW_OPENGL_DEBUG_CONTEXT)) printf(" debug"); - if (glfwGetWindowParam(window, GLFW_CONTEXT_ROBUSTNESS) != GLFW_NO_ROBUSTNESS) + if (glfwGetWindowAttrib(window, GLFW_CONTEXT_ROBUSTNESS) != GLFW_NO_ROBUSTNESS) printf(" robustness"); putchar('\n'); } if (major > 3 || (major == 3 && minor >= 2)) { - int profile = glfwGetWindowParam(window, GLFW_OPENGL_PROFILE); + int profile = glfwGetWindowAttrib(window, GLFW_OPENGL_PROFILE); glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &mask); printf("%s profile mask (0x%08x): %s\n", @@ -360,7 +360,7 @@ int main(int argc, char** argv) strategy, get_strategy_name_gl(strategy)); - robustness = glfwGetWindowParam(window, GLFW_CONTEXT_ROBUSTNESS); + robustness = glfwGetWindowAttrib(window, GLFW_CONTEXT_ROBUSTNESS); printf("%s robustness strategy parsed by GLFW: %s\n", get_client_api_name(api), diff --git a/tests/iconify.c b/tests/iconify.c index 70a4fc25..9e548eab 100644 --- a/tests/iconify.c +++ b/tests/iconify.c @@ -143,8 +143,8 @@ int main(int argc, char** argv) glfwSetWindowIconifyCallback(window, window_iconify_callback); printf("Window is %s and %s\n", - glfwGetWindowParam(window, GLFW_ICONIFIED) ? "iconified" : "restored", - glfwGetWindowParam(window, GLFW_FOCUSED) ? "focused" : "defocused"); + glfwGetWindowAttrib(window, GLFW_ICONIFIED) ? "iconified" : "restored", + glfwGetWindowAttrib(window, GLFW_FOCUSED) ? "focused" : "defocused"); glEnable(GL_SCISSOR_TEST);