summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authornakeee <nakeee@gmail.com>2009-01-03 23:33:45 +0000
committernakeee <nakeee@gmail.com>2009-01-03 23:33:45 +0000
commita72da4e76aca275839b9be161eb0e2d2379a0027 (patch)
tree2011b1bf4c9e89d84d44767c21a6a29c6242a2f0 /Source/Core
parent09b3d2d227581585d6008432bed9911a4e1997b2 (diff)
Make event handler wx safe
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1756 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/Src/Core.cpp13
-rw-r--r--Source/Core/Core/Src/EventHandler.cpp7
-rw-r--r--Source/Core/Core/Src/EventHandler.h3
3 files changed, 22 insertions, 1 deletions
diff --git a/Source/Core/Core/Src/Core.cpp b/Source/Core/Core/Src/Core.cpp
index 4b109b34a8..d7c35ecfb8 100644
--- a/Source/Core/Core/Src/Core.cpp
+++ b/Source/Core/Core/Src/Core.cpp
@@ -23,6 +23,7 @@
#include "Thread.h"
#include "Timer.h"
+#include "Common.h"
#include "Console.h"
#include "Core.h"
@@ -55,6 +56,7 @@
#include "MemTools.h"
#include "Host.h"
#include "LogManager.h"
+#include "EventHandler.h"
#include "State.h"
@@ -66,6 +68,8 @@
// glXMakeCurrent/ wglMakeCurrent takes a context and makes it current on the current thread.
// So it's fine to init ogl on one thread, and then make it current and start blasting on another.
+EventHandler *eventHandler = NULL;;
+
namespace Core
{
// forwarding
@@ -100,6 +104,7 @@ SCoreStartupParameter g_CoreStartupParameter; //uck
Common::Event emuThreadGoing;
+
bool PanicAlertToVideo(const char* text, bool yes_no)
{
DisplayMessage(text, 3000);
@@ -118,6 +123,11 @@ bool Init(const SCoreStartupParameter _CoreParameter)
Host_SetWaitCursor(true);
g_CoreStartupParameter = _CoreParameter;
+
+#if defined GLTEST && GLTEST
+ // init the event handler
+ eventHandler = new EventHandler();
+#endif
// start the thread again
_dbg_assert_(HLE, g_pThread == NULL);
@@ -391,6 +401,9 @@ THREAD_RETURN EmuThread(void *pArg)
PluginVideo::Video_Shutdown();
PluginVideo::UnloadPlugin();
+ if (eventHandler)
+ delete eventHandler;
+
HW::Shutdown();
LOG(MASTER_LOG, "EmuThread exited");
diff --git a/Source/Core/Core/Src/EventHandler.cpp b/Source/Core/Core/Src/EventHandler.cpp
index a6a6bb76da..a8770fc153 100644
--- a/Source/Core/Core/Src/EventHandler.cpp
+++ b/Source/Core/Core/Src/EventHandler.cpp
@@ -1,5 +1,8 @@
#include "EventHandler.h"
+
+#if defined HAVE_WX && HAVE_WX
#include <wx/wx.h>
+#endif
bool EventHandler::RegisterEventListener(listenFuncPtr func, Keys key) {
if (key.inputType == KeyboardInput) {
@@ -57,7 +60,8 @@ bool EventHandler::TestEvent (Keys k, sf::Event e)
}
return (false);
}
-
+
+#if defined HAVE_WX && HAVE_WX
// Taken from wxw source code
sf::Key::Code EventHandler::wxCharCodeToSF(int id)
{
@@ -145,6 +149,7 @@ sf::Key::Code EventHandler::wxCharCodeToSF(int id)
return sfKey;
}
+#endif
void EventHandler::SFKeyToString(sf::Key::Code keycode, char *keyStr) {
switch (keycode) {
diff --git a/Source/Core/Core/Src/EventHandler.h b/Source/Core/Core/Src/EventHandler.h
index 1de00ecb75..88fa24b8f5 100644
--- a/Source/Core/Core/Src/EventHandler.h
+++ b/Source/Core/Core/Src/EventHandler.h
@@ -1,5 +1,6 @@
#ifndef EVENTHANDER_H
#define EVENTHANDER_H 1
+#include "Common.h"
#include <queue>
#include "Event.hpp"
@@ -39,7 +40,9 @@ public:
void Update();
bool addEvent(sf::Event *e);
static bool TestEvent (Keys k, sf::Event e);
+#if defined HAVE_WX && HAVE_WX
static sf::Key::Code wxCharCodeToSF(int id);
+#endif
static void SFKeyToString(sf::Key::Code keycode, char *keyStr);
};