From b8d79c190497c2dc20a01ac1841e8e3365a0513f Mon Sep 17 00:00:00 2001 From: AJ Kelly Date: Wed, 23 Feb 2011 16:53:51 -0600 Subject: [PATCH] well, I'm in over my head on this one, but this should be somewhat of a start --- src/archutils/Darwin/MouseDevice.cpp | 24 ++++++++++++++++++++++++ src/archutils/Darwin/MouseDevice.h | 20 ++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 src/archutils/Darwin/MouseDevice.cpp create mode 100644 src/archutils/Darwin/MouseDevice.h diff --git a/src/archutils/Darwin/MouseDevice.cpp b/src/archutils/Darwin/MouseDevice.cpp new file mode 100644 index 0000000000..c765fc0f30 --- /dev/null +++ b/src/archutils/Darwin/MouseDevice.cpp @@ -0,0 +1,24 @@ +#include "global.h" +#include "MouseDevice.h" + +bool MouseDevice::AddLogicalDevice( int usagePage, int usage ) +{ + // Mice can either be kHIDUsage_GD_Mouse or kHIDUsage_GD_Pointer... + // Let's just go with kHIDUsage_GD_Mouse for now. + return usagePage == kHIDPage_GenericDesktop && usage == kHIDUsage_GD_Mouse; +} + +void MouseDevice::AddElement( int usagePage, int usage, IOHIDElementCookie cookie, const CFDictionaryRef properties ) +{ + if( usagePage != kHIDPage_GenericDesktop ) + return; + + DeviceButton button; + if( UsbKeyToDeviceButton(usage,button) ) + m_Mapping[cookie] = button; +} + +void MouseDevice::Open() +{ + // I hate coding blind... +} \ No newline at end of file diff --git a/src/archutils/Darwin/MouseDevice.h b/src/archutils/Darwin/MouseDevice.h new file mode 100644 index 0000000000..0dc1ee565f --- /dev/null +++ b/src/archutils/Darwin/MouseDevice.h @@ -0,0 +1,20 @@ +#ifndef MOUSE_DEVICE_H +#define MOUSE_DEVICE_H + +#include "HIDDevice.h" + +class MouseDevice : public HIDDevice +{ +private: + // stuff + +protected: + bool AddLogicalDevice( int usagePage, int usage ); + void AddElement( int usagePage, int usage, IOHIDElementCookie cookie, const CFDictionaryRef properties ) + void Open() + +public: + // even more stuff +}; + +#endif \ No newline at end of file