Cleanup, the carbon events aren't being dispatched so this will be done in the same way as the joysticks.
This commit is contained in:
@@ -464,36 +464,6 @@ void InputHandler_Carbon::QueueCallBack( void *target, int result, void *refcon,
|
||||
}
|
||||
}
|
||||
|
||||
OSStatus InputHandler_Carbon::EventHandler( EventHandlerCallRef callRef, EventRef event, void *data )
|
||||
{
|
||||
InputHandler_Carbon *This = (InputHandler_Carbon *)data;
|
||||
UInt32 kind = GetEventKind(event);
|
||||
UInt32 keyCode;
|
||||
char charCode;
|
||||
|
||||
GetEventParameter( event, kEventParamKeyCode, typeUInt32, NULL, sizeof(keyCode), NULL, &keyCode );
|
||||
GetEventParameter( event, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(charCode), NULL, &charCode );
|
||||
|
||||
const char *type;
|
||||
|
||||
switch( kind )
|
||||
{
|
||||
case kEventRawKeyDown:
|
||||
type = "down";
|
||||
break;
|
||||
case kEventRawKeyRepeat:
|
||||
type = "repeat";
|
||||
break;
|
||||
case kEventRawKeyUp:
|
||||
type = "up";
|
||||
default:
|
||||
type = "unknown";
|
||||
}
|
||||
|
||||
LOG->Trace( "(0) %u %c: %s\n", unsigned(keyCode), charCode, type );
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void RunLoopStarted( CFRunLoopObserverRef o, CFRunLoopActivity a, void *sem )
|
||||
{
|
||||
CFRelease(o); // we don't need this any longer
|
||||
@@ -530,23 +500,10 @@ InputHandler_Carbon::~InputHandler_Carbon()
|
||||
delete *i;
|
||||
if( mMasterPort )
|
||||
mach_port_deallocate( mach_task_self(), mMasterPort );
|
||||
RemoveEventHandler( mEventHandlerRef );
|
||||
DisposeEventHandlerUPP( mEventHandlerUPP );
|
||||
}
|
||||
|
||||
InputHandler_Carbon::InputHandler_Carbon() : mSem("Input thread started")
|
||||
{
|
||||
// Install a Carbon Event handler
|
||||
mEventHandlerUPP = NewEventHandlerUPP( EventHandler );
|
||||
EventTypeSpec typeList[] = {
|
||||
{ kEventClassKeyboard, kEventRawKeyDown },
|
||||
{ kEventClassKeyboard, kEventRawKeyRepeat },
|
||||
{ kEventClassKeyboard, kEventRawKeyUp } };
|
||||
|
||||
|
||||
if( InstallEventHandler(GetApplicationEventTarget(), mEventHandlerUPP, 3, typeList, this, &mEventHandlerRef) )
|
||||
LOG->Warn("Failed to install the Event Handler.");
|
||||
|
||||
// Get a Mach port to initiate communication with I/O Kit.
|
||||
mach_port_t masterPort;
|
||||
|
||||
|
||||
@@ -3,15 +3,7 @@
|
||||
|
||||
#include <vector>
|
||||
#include "InputHandler.h"
|
||||
|
||||
// Avoid pulling the <Carbon/Carbon.h> header in here
|
||||
typedef struct OpaqueEventHandlerCallRef *EventHandlerCallRef;
|
||||
typedef struct OpaqueEventRef *EventRef;
|
||||
typedef struct OpaqueEventHandlerRef *EventHandlerRef;
|
||||
typedef struct OpaqueEventTargetRef *EventTargetRef;
|
||||
typedef long int OSStatus;
|
||||
typedef OSStatus (*EventHandlerProcPtr) ( EventHandlerCallRef, EventRef, void * );
|
||||
typedef EventHandlerProcPtr EventHandlerUPP;
|
||||
#include "RageThreads.h"
|
||||
|
||||
class JoystickDevice;
|
||||
|
||||
@@ -20,8 +12,11 @@ class InputHandler_Carbon : public InputHandler
|
||||
private:
|
||||
int mMasterPort;
|
||||
std::vector<JoystickDevice *> mDevices;
|
||||
EventHandlerUPP mEventHandlerUPP;
|
||||
EventHandlerRef mEventHandlerRef;
|
||||
RageThread mInputThread;
|
||||
RageSemaphore mSem;
|
||||
void *mLoopRef;
|
||||
|
||||
static int Run(void *data);
|
||||
|
||||
public:
|
||||
InputHandler_Carbon();
|
||||
@@ -31,7 +26,6 @@ public:
|
||||
vector<CString>& vDescriptionsOut );
|
||||
|
||||
static void QueueCallBack( void *target, int result, void *refcon, void *sender );
|
||||
static OSStatus EventHandler( EventHandlerCallRef callRef, EventRef event, void *data );
|
||||
};
|
||||
#define USE_INPUT_HANDLER_CARBON
|
||||
|
||||
|
||||
Reference in New Issue
Block a user