Fixed active/focused nomenclature mixing.

This commit is contained in:
Camilla Berglund 2012-11-22 17:04:44 +01:00
parent bce2cd65e1
commit 14355d692f
11 changed files with 54 additions and 53 deletions

View File

@ -462,9 +462,9 @@ extern "C" {
* @ingroup window
* @{ */
/*! @brief @c GL_TRUE if the window is active, or @c GL_FALSE otherwise.
/*! @brief @c GL_TRUE if the window has focus, or @c GL_FALSE otherwise.
*/
#define GLFW_ACTIVE 0x00020001
#define GLFW_FOCUSED 0x00020001
/*! @brief @c GL_TRUE if the window is iconified, or @c GL_FALSE otherwise.
*/
#define GLFW_ICONIFIED 0x00020002
@ -679,9 +679,9 @@ extern "C" {
* more specific categories.
*/
#define GLFW_PLATFORM_ERROR 0x00070008
/*! @brief The specified window needed to be active for the call to succeed.
/*! @brief The specified window needed to be focused for the call to succeed.
*/
#define GLFW_WINDOW_NOT_ACTIVE 0x00070009
#define GLFW_WINDOW_NOT_FOCUSED 0x00070009
/*! @brief The clipboard did not contain data in the requested format.
*/
#define GLFW_FORMAT_UNAVAILABLE 0x0007000A
@ -1332,7 +1332,7 @@ GLFWAPI void glfwGetCursorPos(GLFWwindow window, int* xpos, int* ypos);
* client area, or @c NULL.
* @ingroup input
*
* @note The specified window must be active.
* @note The specified window must be focused.
*
* @sa glfwGetCursorPos
*/

View File

@ -298,6 +298,7 @@ version of GLFW.</p>
<li>Changed <code>glfwGetVideoModes</code> to return a dynamic, unlimited number of video modes</li>
<li>Renamed <code>glfw.h</code> to <code>glfw3.h</code> to avoid conflicts with 2.x series</li>
<li>Renamed <code>glfwOpenWindowHint</code> to <code>glfwWindowHint</code></li>
<li>Renamed <code>GLFW_ACTIVE</code> to <code>GLFW_FOCUSED</code></li>
<li>Renamed <code>GLFW_WINDOW</code> token to <code>GLFW_WINDOWED</code></li>
<li>Renamed <code>GLFW_WINDOW_NO_RESIZE</code> to <code>GLFW_RESIZABLE</code></li>
<li>Renamed <code>GLFW_BUILD_DLL</code> to <code>_GLFW_BUILD_DLL</code></li>

View File

@ -228,8 +228,8 @@ GLFWAPI const char* glfwErrorString(int error)
return "The requested OpenGL version is unavailable";
case GLFW_PLATFORM_ERROR:
return "A platform-specific error occurred";
case GLFW_WINDOW_NOT_ACTIVE:
return "The specified window is not active";
case GLFW_WINDOW_NOT_FOCUSED:
return "The specified window is not focused";
case GLFW_FORMAT_UNAVAILABLE:
return "The requested format is unavailable";
}

View File

@ -422,9 +422,9 @@ GLFWAPI void glfwSetCursorPos(GLFWwindow handle, int xpos, int ypos)
return;
}
if (_glfwLibrary.activeWindow != window)
if (_glfwLibrary.focusedWindow != window)
{
_glfwSetError(GLFW_WINDOW_NOT_ACTIVE, NULL);
_glfwSetError(GLFW_WINDOW_NOT_FOCUSED, NULL);
return;
}

View File

@ -226,7 +226,7 @@ struct _GLFWlibrary
_GLFWhints hints;
_GLFWwindow* windowListHead;
_GLFWwindow* activeWindow;
_GLFWwindow* focusedWindow;
GLFWgammaramp currentRamp;
GLFWgammaramp originalRamp;
@ -321,7 +321,7 @@ void _glfwPlatformCopyContext(_GLFWwindow* src, _GLFWwindow* dst, unsigned long
//========================================================================
// Window event notification (window.c)
void _glfwInputWindowFocus(_GLFWwindow* window, GLboolean activated);
void _glfwInputWindowFocus(_GLFWwindow* window, GLboolean focused);
void _glfwInputWindowPos(_GLFWwindow* window, int x, int y);
void _glfwInputWindowSize(_GLFWwindow* window, int width, int height);
void _glfwInputWindowIconify(_GLFWwindow* window, int iconified);

View File

@ -328,22 +328,22 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
case WM_ACTIVATE:
{
// Window was (de)activated and/or (de)iconified
// Window was (de)focused and/or (de)iconified
BOOL active = LOWORD(wParam) != WA_INACTIVE;
BOOL focused = LOWORD(wParam) != WA_INACTIVE;
BOOL iconified = HIWORD(wParam) ? TRUE : FALSE;
if (active && iconified)
if (focused && iconified)
{
// This is a workaround for window iconification using the
// taskbar leading to windows being told they're active and
// iconified and then never told they're deactivated
active = FALSE;
// taskbar leading to windows being told they're focused and
// iconified and then never told they're defocused
focused = FALSE;
}
if (!active && _glfwLibrary.activeWindow == window)
if (!focused && _glfwLibrary.focusedWindow == window)
{
// The window was deactivated (or iconified, see above)
// The window was defocused (or iconified, see above)
if (window->cursorMode == GLFW_CURSOR_CAPTURED)
showCursor(window);
@ -364,9 +364,9 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
}
}
}
else if (active && _glfwLibrary.activeWindow != window)
else if (focused && _glfwLibrary.focusedWindow != window)
{
// The window was activated
// The window was focused
if (window->cursorMode == GLFW_CURSOR_CAPTURED)
captureCursor(window);
@ -386,7 +386,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
}
}
_glfwInputWindowFocus(window, active);
_glfwInputWindowFocus(window, focused);
_glfwInputWindowIconify(window, iconified);
return 0;
}
@ -544,7 +544,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
if (window->cursorMode == GLFW_CURSOR_CAPTURED)
{
if (_glfwLibrary.activeWindow != window)
if (_glfwLibrary.focusedWindow != window)
return 0;
x = newCursorX - window->Win32.oldCursorX;
@ -829,8 +829,8 @@ static void destroyWindow(_GLFWwindow* window)
// This is duplicated from glfwDestroyWindow
// TODO: Stop duplicating code
if (window == _glfwLibrary.activeWindow)
_glfwLibrary.activeWindow = NULL;
if (window == _glfwLibrary.focusedWindow)
_glfwLibrary.focusedWindow = NULL;
if (window->Win32.handle)
{
@ -1132,7 +1132,7 @@ void _glfwPlatformPollEvents(void)
MSG msg;
_GLFWwindow* window;
window = _glfwLibrary.activeWindow;
window = _glfwLibrary.focusedWindow;
if (window)
{
window->Win32.cursorCentered = GL_FALSE;
@ -1168,7 +1168,7 @@ void _glfwPlatformPollEvents(void)
// LSHIFT/RSHIFT fixup (keys tend to "stick" without this fix)
// This is the only async event handling in GLFW, but it solves some
// nasty problems.
window = _glfwLibrary.activeWindow;
window = _glfwLibrary.focusedWindow;
if (window)
{
int lshift_down, rshift_down;
@ -1186,8 +1186,8 @@ void _glfwPlatformPollEvents(void)
_glfwInputKey(window, GLFW_KEY_RIGHT_SHIFT, GLFW_RELEASE);
}
// Did the cursor move in an active window that has captured the cursor
window = _glfwLibrary.activeWindow;
// Did the cursor move in an focused window that has captured the cursor
window = _glfwLibrary.focusedWindow;
if (window)
{
if (window->cursorMode == GLFW_CURSOR_CAPTURED &&

View File

@ -72,21 +72,21 @@ static void clearScrollOffsets(void)
// Register window focus events
//========================================================================
void _glfwInputWindowFocus(_GLFWwindow* window, GLboolean activated)
void _glfwInputWindowFocus(_GLFWwindow* window, GLboolean focused)
{
if (activated)
if (focused)
{
if (_glfwLibrary.activeWindow != window)
if (_glfwLibrary.focusedWindow != window)
{
_glfwLibrary.activeWindow = window;
_glfwLibrary.focusedWindow = window;
if (window->windowFocusCallback)
window->windowFocusCallback(window, activated);
window->windowFocusCallback(window, focused);
}
}
else
{
if (_glfwLibrary.activeWindow == window)
if (_glfwLibrary.focusedWindow == window)
{
int i;
@ -104,10 +104,10 @@ void _glfwInputWindowFocus(_GLFWwindow* window, GLboolean activated)
_glfwInputMouseClick(window, i, GLFW_RELEASE);
}
_glfwLibrary.activeWindow = NULL;
_glfwLibrary.focusedWindow = NULL;
if (window->windowFocusCallback)
window->windowFocusCallback(window, activated);
window->windowFocusCallback(window, focused);
}
}
}
@ -502,9 +502,9 @@ GLFWAPI void glfwDestroyWindow(GLFWwindow handle)
if (window == _glfwPlatformGetCurrentContext())
_glfwPlatformMakeContextCurrent(NULL);
// Clear the active window pointer if this is the active window
if (window == _glfwLibrary.activeWindow)
_glfwLibrary.activeWindow = NULL;
// Clear the focused window pointer if this is the focused window
if (window == _glfwLibrary.focusedWindow)
_glfwLibrary.focusedWindow = NULL;
_glfwPlatformDestroyWindow(window);
@ -700,8 +700,8 @@ GLFWAPI int glfwGetWindowParam(GLFWwindow handle, int param)
switch (param)
{
case GLFW_ACTIVE:
return window == _glfwLibrary.activeWindow;
case GLFW_FOCUSED:
return window == _glfwLibrary.focusedWindow;
case GLFW_ICONIFIED:
return window->iconified;
case GLFW_CLOSE_REQUESTED:

View File

@ -632,7 +632,7 @@ static void processEvent(XEvent *event)
if (window->cursorMode == GLFW_CURSOR_CAPTURED)
{
if (_glfwLibrary.activeWindow != window)
if (_glfwLibrary.focusedWindow != window)
break;
x = event->xmotion.x - window->X11.cursorPosX;
@ -1134,11 +1134,11 @@ void _glfwPlatformPollEvents(void)
processEvent(&event);
}
// Check whether the cursor has moved inside an active window that has
// Check whether the cursor has moved inside an focused window that has
// captured the cursor (because then it needs to be re-centered)
_GLFWwindow* window;
window = _glfwLibrary.activeWindow;
window = _glfwLibrary.focusedWindow;
if (window)
{
if (window->cursorMode == GLFW_CURSOR_CAPTURED &&

View File

@ -248,12 +248,12 @@ static void window_refresh_callback(GLFWwindow window)
}
}
static void window_focus_callback(GLFWwindow window, int activated)
static void window_focus_callback(GLFWwindow window, int focused)
{
printf("%08x at %0.3f: Window %s\n",
counter++,
glfwGetTime(),
activated ? "activated" : "deactivated");
focused ? "focused" : "defocused");
}
static void window_iconify_callback(GLFWwindow window, int iconified)

View File

@ -23,7 +23,7 @@
//
//========================================================================
//
// This test is used to test window activation and iconfication for
// This test is used to test window focusing and iconfication for
// fullscreen windows with a video mode differing from the desktop mode
//
//========================================================================
@ -35,11 +35,11 @@
static GLboolean running = GL_TRUE;
static void window_focus_callback(GLFWwindow window, int activated)
static void window_focus_callback(GLFWwindow window, int focused)
{
printf("%0.3f: Window %s\n",
glfwGetTime(),
activated ? "activated" : "deactivated");
focused ? "focused" : "defocused");
}
static void window_key_callback(GLFWwindow window, int key, int action)

View File

@ -75,11 +75,11 @@ static void window_size_callback(GLFWwindow window, int width, int height)
glViewport(0, 0, width, height);
}
static void window_focus_callback(GLFWwindow window, int activated)
static void window_focus_callback(GLFWwindow window, int focused)
{
printf("%0.2f Window %s\n",
glfwGetTime(),
activated ? "activated" : "deactivated");
focused ? "focused" : "defocused");
}
static void window_iconify_callback(GLFWwindow window, int iconified)
@ -152,7 +152,7 @@ int main(int argc, char** argv)
printf("Window is %s and %s\n",
glfwGetWindowParam(window, GLFW_ICONIFIED) ? "iconified" : "restored",
glfwGetWindowParam(window, GLFW_ACTIVE) ? "active" : "inactive");
glfwGetWindowParam(window, GLFW_FOCUSED) ? "focused" : "defocused");
glEnable(GL_SCISSOR_TEST);