mirror of
https://github.com/glfw/glfw.git
synced 2026-09-20 16:30:45 +00:00
Fixed active/focused nomenclature mixing.
This commit is contained in:
+2
-2
@@ -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";
|
||||
}
|
||||
|
||||
+2
-2
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -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);
|
||||
|
||||
+18
-18
@@ -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 &&
|
||||
|
||||
+13
-13
@@ -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:
|
||||
|
||||
+3
-3
@@ -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 &&
|
||||
|
||||
Reference in New Issue
Block a user