summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinWX/Frame.cpp
diff options
context:
space:
mode:
authorPierre Bourdon <delroth@gmail.com>2014-07-17 01:21:31 +0200
committerPierre Bourdon <delroth@gmail.com>2014-07-17 01:21:31 +0200
commit8cf21cdcdb30d1587a03b6fbb131465f489d3d25 (patch)
tree10f6a451f4f3b632b9d32382cbc4389c90772462 /Source/Core/DolphinWX/Frame.cpp
parent30e4366d280b4e801de4caa86cb787901d733e7b (diff)
parent44307c950888a4942a35b0176e2601c266894983 (diff)
Merge pull request #633 from magcius/wip/input-focus-fix
Fix input focus issues
Diffstat (limited to 'Source/Core/DolphinWX/Frame.cpp')
-rw-r--r--Source/Core/DolphinWX/Frame.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp
index 12fcb5f3bf..b57f18ad69 100644
--- a/Source/Core/DolphinWX/Frame.cpp
+++ b/Source/Core/DolphinWX/Frame.cpp
@@ -753,7 +753,29 @@ void CFrame::OnRenderWindowSizeRequest(int width, int height)
bool CFrame::RendererHasFocus()
{
- // RendererHasFocus should return true any time any one of our
+ if (m_RenderParent == nullptr)
+ return false;
+#ifdef _WIN32
+ if (m_RenderParent->GetParent()->GetHWND() == GetForegroundWindow())
+ return true;
+#else
+ wxWindow *window = wxWindow::FindFocus();
+ if (window == nullptr)
+ return false;
+ // Why these different cases?
+ if (m_RenderParent == window ||
+ m_RenderParent == window->GetParent() ||
+ m_RenderParent->GetParent() == window->GetParent())
+ {
+ return true;
+ }
+#endif
+ return false;
+}
+
+bool CFrame::UIHasFocus()
+{
+ // UIHasFocus should return true any time any one of our UI
// windows has the focus, including any dialogs or other windows.
//
// wxGetActiveWindow() returns the current wxWindow which has