summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorJules Blok <jules.blok@gmail.com>2015-07-20 10:04:18 +0200
committerJules Blok <jules.blok@gmail.com>2015-07-20 10:11:11 +0200
commitccb56ddf97dded3af5b2d6e3a41367f56ca7d672 (patch)
tree2b2ca724caa122fb4b425497bbdedab5309e00c5 /Source/Core
parentda38e3a8ae7be05ca783e72f0bce821dc23646bd (diff)
CFrame: Claim all keyboard events on OS X.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/DolphinWX/Frame.cpp14
-rw-r--r--Source/Core/DolphinWX/Frame.h2
-rw-r--r--Source/Core/DolphinWX/FrameTools.cpp1
3 files changed, 15 insertions, 2 deletions
diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp
index b41cdbb461..d2b396aa3d 100644
--- a/Source/Core/DolphinWX/Frame.cpp
+++ b/Source/Core/DolphinWX/Frame.cpp
@@ -1068,6 +1068,20 @@ bool TASInputHasFocus()
return false;
}
+void CFrame::OnKeyDown(wxKeyEvent& event)
+{
+ // On OS X, we claim all keyboard events while
+ // emulation is running to avoid wxWidgets sounding
+ // the system beep for unhandled key events when
+ // receiving pad/Wiimote keypresses which take an
+ // entirely different path through the HID subsystem.
+#ifndef __APPLE__
+ // On other platforms, we leave the key event alone
+ // so it can be passed on to the windowing system.
+ event.Skip();
+#endif
+}
+
void CFrame::OnMouse(wxMouseEvent& event)
{
// next handlers are all for FreeLook, so we don't need to check them if disabled
diff --git a/Source/Core/DolphinWX/Frame.h b/Source/Core/DolphinWX/Frame.h
index 4460593497..abb712b3c1 100644
--- a/Source/Core/DolphinWX/Frame.h
+++ b/Source/Core/DolphinWX/Frame.h
@@ -320,8 +320,6 @@ private:
void OnToggleWindow(wxCommandEvent& event);
void OnKeyDown(wxKeyEvent& event); // Keyboard
- void OnKeyUp(wxKeyEvent& event);
-
void OnMouse(wxMouseEvent& event); // Mouse
void OnFocusChange(wxFocusEvent& event);
diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp
index d56a8486b2..a54677423d 100644
--- a/Source/Core/DolphinWX/FrameTools.cpp
+++ b/Source/Core/DolphinWX/FrameTools.cpp
@@ -1046,6 +1046,7 @@ void CFrame::StartGame(const std::string& filename)
m_RenderParent->SetFocus();
+ wxTheApp->Bind(wxEVT_KEY_DOWN, &CFrame::OnKeyDown, this);
wxTheApp->Bind(wxEVT_RIGHT_DOWN, &CFrame::OnMouse, this);
wxTheApp->Bind(wxEVT_RIGHT_UP, &CFrame::OnMouse, this);
wxTheApp->Bind(wxEVT_MIDDLE_DOWN, &CFrame::OnMouse, this);