Migrate tabs to spaces in src/Gui/3Dconnexion/*
This commit is contained in:
@@ -30,23 +30,23 @@ class QMainWindow;
|
||||
|
||||
namespace Gui
|
||||
{
|
||||
class GUIApplicationNativeEventAware;
|
||||
class GUIApplicationNativeEventAware;
|
||||
|
||||
class GuiAbstractNativeEvent : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit GuiAbstractNativeEvent(GUIApplicationNativeEventAware *app);
|
||||
~GuiAbstractNativeEvent() override =0;
|
||||
virtual void initSpaceball(QMainWindow *window)=0;
|
||||
private:
|
||||
GuiAbstractNativeEvent();
|
||||
GuiAbstractNativeEvent(const GuiAbstractNativeEvent&);
|
||||
GuiAbstractNativeEvent& operator=(const GuiAbstractNativeEvent&);
|
||||
protected:
|
||||
static GUIApplicationNativeEventAware *mainApp;
|
||||
class GuiAbstractNativeEvent : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit GuiAbstractNativeEvent(GUIApplicationNativeEventAware *app);
|
||||
~GuiAbstractNativeEvent() override =0;
|
||||
virtual void initSpaceball(QMainWindow *window)=0;
|
||||
private:
|
||||
GuiAbstractNativeEvent();
|
||||
GuiAbstractNativeEvent(const GuiAbstractNativeEvent&);
|
||||
GuiAbstractNativeEvent& operator=(const GuiAbstractNativeEvent&);
|
||||
protected:
|
||||
static GUIApplicationNativeEventAware *mainApp;
|
||||
static std::vector<int>motionDataArray;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -60,29 +60,29 @@ void Gui::GuiNativeEvent::initSpaceball(QMainWindow *window)
|
||||
|
||||
void Gui::GuiNativeEvent::pollSpacenav()
|
||||
{
|
||||
spnav_event ev;
|
||||
while(spnav_poll_event(&ev))
|
||||
{
|
||||
switch (ev.type)
|
||||
{
|
||||
case SPNAV_EVENT_MOTION:
|
||||
{
|
||||
motionDataArray[0] = -ev.motion.x;
|
||||
motionDataArray[1] = -ev.motion.z;
|
||||
motionDataArray[2] = -ev.motion.y;
|
||||
motionDataArray[3] = -ev.motion.rx;
|
||||
motionDataArray[4] = -ev.motion.rz;
|
||||
motionDataArray[5] = -ev.motion.ry;
|
||||
mainApp->postMotionEvent(motionDataArray);
|
||||
break;
|
||||
}
|
||||
case SPNAV_EVENT_BUTTON:
|
||||
{
|
||||
mainApp->postButtonEvent(ev.button.bnum, ev.button.press);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
spnav_event ev;
|
||||
while(spnav_poll_event(&ev))
|
||||
{
|
||||
switch (ev.type)
|
||||
{
|
||||
case SPNAV_EVENT_MOTION:
|
||||
{
|
||||
motionDataArray[0] = -ev.motion.x;
|
||||
motionDataArray[1] = -ev.motion.z;
|
||||
motionDataArray[2] = -ev.motion.y;
|
||||
motionDataArray[3] = -ev.motion.rx;
|
||||
motionDataArray[4] = -ev.motion.rz;
|
||||
motionDataArray[5] = -ev.motion.ry;
|
||||
mainApp->postMotionEvent(motionDataArray);
|
||||
break;
|
||||
}
|
||||
case SPNAV_EVENT_BUTTON:
|
||||
{
|
||||
mainApp->postButtonEvent(ev.button.bnum, ev.button.press);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "3Dconnexion/moc_GuiNativeEventLinux.cpp"
|
||||
|
||||
@@ -29,22 +29,22 @@ class QMainWindow;
|
||||
|
||||
namespace Gui
|
||||
{
|
||||
class GUIApplicationNativeEventAware;
|
||||
class GUIApplicationNativeEventAware;
|
||||
|
||||
class GuiNativeEvent : public GuiAbstractNativeEvent
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GuiNativeEvent(GUIApplicationNativeEventAware *app);
|
||||
~GuiNativeEvent() override;
|
||||
void initSpaceball(QMainWindow *window) override final;
|
||||
private:
|
||||
GuiNativeEvent();
|
||||
GuiNativeEvent(const GuiNativeEvent&);
|
||||
GuiNativeEvent& operator=(const GuiNativeEvent&);
|
||||
private Q_SLOTS:
|
||||
void pollSpacenav();
|
||||
};
|
||||
class GuiNativeEvent : public GuiAbstractNativeEvent
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GuiNativeEvent(GUIApplicationNativeEventAware *app);
|
||||
~GuiNativeEvent() override;
|
||||
void initSpaceball(QMainWindow *window) override final;
|
||||
private:
|
||||
GuiNativeEvent();
|
||||
GuiNativeEvent(const GuiNativeEvent&);
|
||||
GuiNativeEvent& operator=(const GuiNativeEvent&);
|
||||
private Q_SLOTS:
|
||||
void pollSpacenav();
|
||||
};
|
||||
}
|
||||
|
||||
#endif //GUINATIVEEVENT_H
|
||||
|
||||
@@ -95,7 +95,7 @@ bool Gui::GuiNativeEvent::xcbEventFilter(void *xcb_void, long* result)
|
||||
|
||||
spnav_event navEvent;
|
||||
|
||||
const xcb_client_message_event_t* xcb_ev = static_cast<const xcb_client_message_event_t*>(xcb_void);
|
||||
const xcb_client_message_event_t* xcb_ev = static_cast<const xcb_client_message_event_t*>(xcb_void);
|
||||
// Qt4 used XEvents in native event filters, but Qt5 changed to XCB. The
|
||||
// SpaceNavigator API only works with XEvent, so we need to construct a
|
||||
// temporary XEvent with just enough information for spnav_x11_event()
|
||||
@@ -200,7 +200,7 @@ bool Gui::GuiNativeEvent::x11EventFilter(XEvent *event)
|
||||
through posting an Spaceball event (flooding situation),
|
||||
the motion data provided by the incoming event is added to the saved data.
|
||||
*/
|
||||
int dx, dy, dz, drx, dry, drz;
|
||||
int dx, dy, dz, drx, dry, drz;
|
||||
|
||||
if (nMotionEvents == 0)
|
||||
{
|
||||
|
||||
@@ -35,22 +35,22 @@ class GUIApplicationNativeEventAware;
|
||||
|
||||
namespace Gui
|
||||
{
|
||||
class GUIApplicationNativeEventAware;
|
||||
class GUIApplicationNativeEventAware;
|
||||
|
||||
class GuiNativeEvent : public GuiAbstractNativeEvent
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GuiNativeEvent(GUIApplicationNativeEventAware *app);
|
||||
~GuiNativeEvent() override;
|
||||
void initSpaceball(QMainWindow *window) override final;
|
||||
private:
|
||||
GuiNativeEvent();
|
||||
GuiNativeEvent(const GuiNativeEvent&);
|
||||
GuiNativeEvent& operator=(const GuiNativeEvent&);
|
||||
class GuiNativeEvent : public GuiAbstractNativeEvent
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GuiNativeEvent(GUIApplicationNativeEventAware *app);
|
||||
~GuiNativeEvent() override;
|
||||
void initSpaceball(QMainWindow *window) override final;
|
||||
private:
|
||||
GuiNativeEvent();
|
||||
GuiNativeEvent(const GuiNativeEvent&);
|
||||
GuiNativeEvent& operator=(const GuiNativeEvent&);
|
||||
public:
|
||||
static bool xcbEventFilter(void *message, long* result);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
#endif //GUINATIVEEVENT_H
|
||||
|
||||
@@ -145,7 +145,7 @@ Gui::GuiNativeEvent::~GuiNativeEvent()
|
||||
|
||||
void Gui::GuiNativeEvent::initSpaceball(QMainWindow *window)
|
||||
{
|
||||
Q_UNUSED(window)
|
||||
Q_UNUSED(window)
|
||||
OSStatus err;
|
||||
/* make sure the framework is installed */
|
||||
if (SetConnexionHandlers == NULL)
|
||||
|
||||
@@ -55,26 +55,26 @@ extern int16_t ConnexionSetButtonLabels(uint8_t *labels, uint16_t size);
|
||||
|
||||
namespace Gui
|
||||
{
|
||||
class GUIApplicationNativeEventAware;
|
||||
class GUIApplicationNativeEventAware;
|
||||
|
||||
class GuiNativeEvent : public GuiAbstractNativeEvent
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit GuiNativeEvent(GUIApplicationNativeEventAware *app);
|
||||
~GuiNativeEvent() override;
|
||||
void initSpaceball(QMainWindow *window) final;
|
||||
private:
|
||||
GuiNativeEvent();
|
||||
GuiNativeEvent(const GuiNativeEvent&);
|
||||
GuiNativeEvent& operator=(const GuiNativeEvent&);
|
||||
private:
|
||||
class GuiNativeEvent : public GuiAbstractNativeEvent
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit GuiNativeEvent(GUIApplicationNativeEventAware *app);
|
||||
~GuiNativeEvent() override;
|
||||
void initSpaceball(QMainWindow *window) final;
|
||||
private:
|
||||
GuiNativeEvent();
|
||||
GuiNativeEvent(const GuiNativeEvent&);
|
||||
GuiNativeEvent& operator=(const GuiNativeEvent&);
|
||||
private:
|
||||
static UInt16 tdxClientID; /* ID assigned by the driver */
|
||||
static uint32_t lastButtons;
|
||||
static void tdx_drv_handler( io_connect_t connection,
|
||||
natural_t messageType,
|
||||
void *messageArgument );
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
#endif //GUINATIVEEVENT_H
|
||||
|
||||
@@ -297,15 +297,15 @@ void Gui::GuiNativeEvent::initSpaceball(QMainWindow *mainWindow)
|
||||
// Methods for windows events
|
||||
|
||||
/*!
|
||||
Converts a hid device keycode (button identifier) of a pre-2009 3Dconnexion USB device to the standard 3d mouse virtual key definition.
|
||||
Converts a hid device keycode (button identifier) of a pre-2009 3Dconnexion USB device to the standard 3d mouse virtual key definition.
|
||||
|
||||
\a pid USB Product ID (PID) of 3D mouse device
|
||||
\a hidKeyCode Hid keycode as retrieved from a Raw Input packet
|
||||
\a pid USB Product ID (PID) of 3D mouse device
|
||||
\a hidKeyCode Hid keycode as retrieved from a Raw Input packet
|
||||
|
||||
\return The standard 3d mouse virtual key (button identifier) or zero if an error occurs.
|
||||
\return The standard 3d mouse virtual key (button identifier) or zero if an error occurs.
|
||||
|
||||
Converts a hid device keycode (button identifier) of a pre-2009 3Dconnexion USB device
|
||||
to the standard 3d mouse virtual key definition.
|
||||
Converts a hid device keycode (button identifier) of a pre-2009 3Dconnexion USB device
|
||||
to the standard 3d mouse virtual key definition.
|
||||
*/
|
||||
|
||||
unsigned short HidToVirtualKey(unsigned long pid, unsigned short hidKeyCode)
|
||||
@@ -346,29 +346,29 @@ bool Gui::GuiNativeEvent::RawInputEventFilter(void *msg, long *result)
|
||||
|
||||
|
||||
/*!
|
||||
Access the mouse parameters structure
|
||||
Access the mouse parameters structure
|
||||
*/
|
||||
I3dMouseParam& Gui::GuiNativeEvent::MouseParams()
|
||||
{
|
||||
return f3dMouseParams;
|
||||
return f3dMouseParams;
|
||||
}
|
||||
|
||||
/*!
|
||||
Access the mouse parameters structure
|
||||
Access the mouse parameters structure
|
||||
*/
|
||||
const I3dMouseParam& Gui::GuiNativeEvent::MouseParams() const
|
||||
{
|
||||
return f3dMouseParams;
|
||||
return f3dMouseParams;
|
||||
}
|
||||
|
||||
/*!
|
||||
Called with the processed motion data when a 3D mouse event is received
|
||||
Called with the processed motion data when a 3D mouse event is received
|
||||
|
||||
The default implementation emits a Move3d signal with the motion data
|
||||
The default implementation emits a Move3d signal with the motion data
|
||||
*/
|
||||
void Gui::GuiNativeEvent::Move3d(HANDLE device, std::vector<float>& motionData)
|
||||
{
|
||||
Q_UNUSED(device);
|
||||
Q_UNUSED(device);
|
||||
|
||||
motionDataArray[0] = -ceil(motionData[0]);
|
||||
motionDataArray[1] = ceil(motionData[1]);
|
||||
@@ -381,21 +381,21 @@ void Gui::GuiNativeEvent::Move3d(HANDLE device, std::vector<float>& motionData)
|
||||
}
|
||||
|
||||
/*!
|
||||
Called when a 3D mouse key is pressed
|
||||
Called when a 3D mouse key is pressed
|
||||
|
||||
The default implementation emits a On3dmouseKeyDown signal with the key code.
|
||||
The default implementation emits a On3dmouseKeyDown signal with the key code.
|
||||
*/
|
||||
void Gui::GuiNativeEvent::On3dmouseKeyDown(HANDLE device, int virtualKeyCode)
|
||||
{
|
||||
Q_UNUSED(device);
|
||||
Q_UNUSED(device);
|
||||
|
||||
mainApp->postButtonEvent(virtualKeyCode - 1, 1);
|
||||
}
|
||||
|
||||
/*!
|
||||
Called when a 3D mouse key is released
|
||||
Called when a 3D mouse key is released
|
||||
|
||||
The default implementation emits a On3dmouseKeyUp signal with the key code.
|
||||
The default implementation emits a On3dmouseKeyUp signal with the key code.
|
||||
*/
|
||||
void Gui::GuiNativeEvent::On3dmouseKeyUp(HANDLE device, int virtualKeyCode)
|
||||
{
|
||||
@@ -405,9 +405,9 @@ void Gui::GuiNativeEvent::On3dmouseKeyUp(HANDLE device, int virtualKeyCode)
|
||||
}
|
||||
|
||||
/*!
|
||||
Get an initialized array of PRAWINPUTDEVICE for the 3D devices
|
||||
Get an initialized array of PRAWINPUTDEVICE for the 3D devices
|
||||
|
||||
pNumDevices returns the number of devices to register. Currently this is always 1.
|
||||
pNumDevices returns the number of devices to register. Currently this is always 1.
|
||||
*/
|
||||
static PRAWINPUTDEVICE GetDevicesToRegister(unsigned int *pNumDevices)
|
||||
{
|
||||
@@ -426,7 +426,7 @@ static PRAWINPUTDEVICE GetDevicesToRegister(unsigned int *pNumDevices)
|
||||
}
|
||||
|
||||
/*!
|
||||
Detect the 3D mouse
|
||||
Detect the 3D mouse
|
||||
*/
|
||||
bool Gui::GuiNativeEvent::Is3dmouseAttached()
|
||||
{
|
||||
@@ -475,9 +475,9 @@ bool Gui::GuiNativeEvent::Is3dmouseAttached()
|
||||
|
||||
|
||||
/*!
|
||||
Initialize the window to receive raw-input messages
|
||||
Initialize the window to receive raw-input messages
|
||||
|
||||
This needs to be called initially so that Windows will send the messages from the 3D mouse to the window.
|
||||
This needs to be called initially so that Windows will send the messages from the 3D mouse to the window.
|
||||
*/
|
||||
bool Gui::GuiNativeEvent::InitializeRawInput(HWND hwndTarget)
|
||||
{
|
||||
@@ -512,10 +512,10 @@ bool Gui::GuiNativeEvent::InitializeRawInput(HWND hwndTarget)
|
||||
|
||||
|
||||
/*!
|
||||
Get the raw input data from Windows
|
||||
Get the raw input data from Windows
|
||||
|
||||
Includes workaround for incorrect alignment of the RAWINPUT structure on x64 os
|
||||
when running as Wow64 (copied directly from 3DConnexion code)
|
||||
Includes workaround for incorrect alignment of the RAWINPUT structure on x64 os
|
||||
when running as Wow64 (copied directly from 3DConnexion code)
|
||||
*/
|
||||
|
||||
UINT Gui::GuiNativeEvent::GetRawInputBuffer(PRAWINPUT pData, PUINT pcbSize, UINT cbSizeHeader)
|
||||
@@ -575,10 +575,10 @@ UINT Gui::GuiNativeEvent::GetRawInputBuffer(PRAWINPUT pData, PUINT pcbSize, UINT
|
||||
}
|
||||
|
||||
/*!
|
||||
Process the raw input device data
|
||||
Process the raw input device data
|
||||
|
||||
On3dmouseInput() does all the preprocessing of the rawinput device data before
|
||||
finally calling the Move3d method.
|
||||
On3dmouseInput() does all the preprocessing of the rawinput device data before
|
||||
finally calling the Move3d method.
|
||||
*/
|
||||
|
||||
void Gui::GuiNativeEvent::On3dmouseInput()
|
||||
@@ -713,7 +713,7 @@ void Gui::GuiNativeEvent::On3dmouseInput()
|
||||
}
|
||||
|
||||
/*!
|
||||
Called when new raw input data is available
|
||||
Called when new raw input data is available
|
||||
*/
|
||||
void Gui::GuiNativeEvent::OnRawInput(UINT nInputCode, HRAWINPUT hRawInput)
|
||||
{
|
||||
|
||||
@@ -37,19 +37,19 @@ class GUIApplicationNativeEventAware;
|
||||
|
||||
namespace Gui
|
||||
{
|
||||
class GUIApplicationNativeEventAware;
|
||||
class GUIApplicationNativeEventAware;
|
||||
|
||||
class GuiNativeEvent : public GuiAbstractNativeEvent
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GuiNativeEvent(GUIApplicationNativeEventAware *app);
|
||||
~GuiNativeEvent() override;
|
||||
void initSpaceball(QMainWindow *window) override final;
|
||||
private:
|
||||
GuiNativeEvent();
|
||||
GuiNativeEvent(const GuiNativeEvent&);
|
||||
GuiNativeEvent& operator=(const GuiNativeEvent&);
|
||||
class GuiNativeEvent : public GuiAbstractNativeEvent
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GuiNativeEvent(GUIApplicationNativeEventAware *app);
|
||||
~GuiNativeEvent() override;
|
||||
void initSpaceball(QMainWindow *window) override final;
|
||||
private:
|
||||
GuiNativeEvent();
|
||||
GuiNativeEvent(const GuiNativeEvent&);
|
||||
GuiNativeEvent& operator=(const GuiNativeEvent&);
|
||||
public:
|
||||
static bool Is3dmouseAttached();
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace Gui
|
||||
// use to calculate distance traveled since last event
|
||||
DWORD fLast3dmouseInputTime;
|
||||
static Gui::GuiNativeEvent* gMouseInput;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
#endif //GUINATIVEEVENT_H
|
||||
|
||||
@@ -15,11 +15,11 @@ class I3dMouseSensor
|
||||
{
|
||||
public:
|
||||
|
||||
enum ESpeed {
|
||||
kLowSpeed = 0,
|
||||
kMidSpeed,
|
||||
kHighSpeed
|
||||
};
|
||||
enum ESpeed {
|
||||
kLowSpeed = 0,
|
||||
kMidSpeed,
|
||||
kHighSpeed
|
||||
};
|
||||
|
||||
virtual bool IsPanZoom() const = 0;
|
||||
virtual bool IsRotate() const = 0;
|
||||
@@ -41,23 +41,23 @@ class I3dMouseNavigation
|
||||
public:
|
||||
|
||||
enum EPivot {
|
||||
kManualPivot = 0,
|
||||
kAutoPivot,
|
||||
kAutoPivotOverride
|
||||
kManualPivot = 0,
|
||||
kAutoPivot,
|
||||
kAutoPivotOverride
|
||||
};
|
||||
|
||||
enum ENavigation {
|
||||
kObjectMode = 0,
|
||||
kCameraMode,
|
||||
kFlyMode,
|
||||
kWalkMode,
|
||||
kHelicopterMode
|
||||
kObjectMode = 0,
|
||||
kCameraMode,
|
||||
kFlyMode,
|
||||
kWalkMode,
|
||||
kHelicopterMode
|
||||
};
|
||||
|
||||
enum EPivotVisibility {
|
||||
kHidePivot = 0,
|
||||
kShowPivot,
|
||||
kShowMovingPivot
|
||||
kHidePivot = 0,
|
||||
kShowPivot,
|
||||
kShowMovingPivot
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user