From 6e68d89e0f9d99748c3e133ebc7d699516dfb7fa Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Mon, 7 Oct 2013 16:12:23 +0200 Subject: [PATCH] Fixed focus for Win+D window restoration. --- README.md | 2 ++ src/win32_window.c | 19 +++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8579ef3e..f1eec4df 100644 --- a/README.md +++ b/README.md @@ -208,6 +208,8 @@ See the [GLFW documentation](http://www.glfw.org/docs/latest/). ## Changelog + - [Win32] Bugfix: Restoring windows using the Win+D hot key did not trigger the + focus callback - [Win32] Bugfix: The disabled cursor mode clip rectangle was updated for unfocused windows - [Cocoa] Bugfix: The `GLFW_KEY_GRAVE_ACCENT` and `GLFW_KEY_WORLD_1` keys had diff --git a/src/win32_window.c b/src/win32_window.c index 2b44ab16..c0273c3b 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -388,10 +388,21 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, if (focused && iconified) { - // This is a workaround for window iconification using the - // taskbar leading to windows being told they're focused and - // iconified and then never told they're defocused - focused = FALSE; + if (window->iconified && _glfw.focusedWindow != window) + { + // This is a workaround for window restoration using the + // Win+D hot key leading to windows being told they're + // focused and iconified and then never told they're + // restored + iconified = FALSE; + } + else + { + // This is a workaround for window iconification using the + // taskbar leading to windows being told they're focused and + // iconified and then never told they're defocused + focused = FALSE; + } } if (!focused && _glfw.focusedWindow == window)