Commit cfddc8ea authored by Bryant Mairs's avatar Bryant Mairs

Attaching an event filter now requires a specific type of object, instead of just a function.

Therefore Mouse3DInput has been changed to now inherit from that base class and implement the necessary interface.
parent 2361a30e
...@@ -119,8 +119,9 @@ unsigned short HidToVirtualKey(unsigned long pid, unsigned short hidKeyCode) ...@@ -119,8 +119,9 @@ unsigned short HidToVirtualKey(unsigned long pid, unsigned short hidKeyCode)
static Mouse3DInput* gMouseInput = 0; static Mouse3DInput* gMouseInput = 0;
bool Mouse3DInput::RawInputEventFilter(void* msg, long* result) bool Mouse3DInput::nativeEventFilter(const QByteArray &eventType, void* msg, long* result)
{ {
Q_UNUSED(eventType);
if (gMouseInput == 0) return false; if (gMouseInput == 0) return false;
MSG* message = (MSG*)(msg); MSG* message = (MSG*)(msg);
...@@ -146,7 +147,7 @@ Mouse3DInput::Mouse3DInput(QWidget* widget) : ...@@ -146,7 +147,7 @@ Mouse3DInput::Mouse3DInput(QWidget* widget) :
InitializeRawInput((HWND)widget->winId()); InitializeRawInput((HWND)widget->winId());
gMouseInput = this; gMouseInput = this;
qApp->installNativeEventFilter(Mouse3DInput::RawInputEventFilter); qApp->installNativeEventFilter(this);
} }
Mouse3DInput::~Mouse3DInput() Mouse3DInput::~Mouse3DInput()
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include "MouseParameters.h" #include "MouseParameters.h"
#include <QWidget> #include <QWidget>
#include <QByteArray>
#include <QAbstractNativeEventFilter>
#include <vector> #include <vector>
#include <map> #include <map>
...@@ -32,12 +34,13 @@ ...@@ -32,12 +34,13 @@
Qt is compiled for Win 2000 targets. Qt is compiled for Win 2000 targets.
*/ */
class Mouse3DInput : public QObject class Mouse3DInput : public QAbstractNativeEventFilter, public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
Mouse3DInput(QWidget* widget); Mouse3DInput(QWidget* widget);
~Mouse3DInput(); ~Mouse3DInput();
virtual bool nativeEventFilter(const QByteArray& eventType, void* msg, long* result);
static bool Is3dmouseAttached(); static bool Is3dmouseAttached();
...@@ -58,7 +61,6 @@ private: ...@@ -58,7 +61,6 @@ private:
bool InitializeRawInput(HWND hwndTarget); bool InitializeRawInput(HWND hwndTarget);
static bool RawInputEventFilter(void* msg, long* result);
void OnRawInput(UINT nInputCode, HRAWINPUT hRawInput); void OnRawInput(UINT nInputCode, HRAWINPUT hRawInput);
UINT GetRawInputBuffer(PRAWINPUT pData, PUINT pcbSize, UINT cbSizeHeader); UINT GetRawInputBuffer(PRAWINPUT pData, PUINT pcbSize, UINT cbSizeHeader);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment