mirror of
https://github.com/glfw/glfw.git
synced 2026-09-18 22:55:46 +00:00
Fixed active/focused nomenclature mixing.
This commit is contained in:
+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 &&
|
||||
|
||||
Reference in New Issue
Block a user