mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 08:09:26 +01:00
Make event handler wx safe
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1756 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
09b3d2d227
commit
a72da4e76a
@ -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");
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user