mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 10:05:10 +00:00
Renamed glfwGetWindowParam to glfwGetWindowAttrib.
Parameters are something specified at creation time and are often immutable, while many of the values returned by glfwGetWindowParam reflected current state not controlled by any parameter or hint.
This commit is contained in:
parent
fdd4518ae5
commit
ad1f6f0341
@ -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`
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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`
|
||||
|
@ -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.
|
||||
*
|
||||
|
@ -361,7 +361,7 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
|
||||
return closest;
|
||||
}
|
||||
|
||||
GLboolean _glfwRefreshContextParams(void)
|
||||
GLboolean _glfwRefreshContextAttribs(void)
|
||||
{
|
||||
_GLFWwindow* window = _glfwPlatformGetCurrentContext();
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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),
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user