History

FEATURE: Allows detecting simulated cursors in JS, this allows JS-developers to track all cursors separately. By using the deviceID. (deviceID 0 = default mouse-cursor , 1500 and 1501 hydra cursors)

Thijs Wenker committed 12 years ago

Commit b6cb19c1 parent 7f9e39c9 files · +118 −32Browse files

Showing the changes to interface/src/Application.cpp (1 of 9 files). Show all

Unified · Split

interface/src/Application.cpp+10−9
@@ -155,7 +155,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 154 unmodified lines
155155 _mouseX(0),
156156 _mouseY(0),
157157 _lastMouseMove(usecTimestampNow()),
158− _lastMouseMoveType(QEvent::MouseMove),
158+ _lastMouseMoveWasSimulated(false),
159159 _mouseHidden(false),
160160 _seenMouseMove(false),
161161 _touchAvgX(0.0f),
@@ -1141,18 +1141,19 @@ void Application::focusOutEvent(QFocusEvent* event) { · 979 unmodified lines
11411141 _keysPressed.clear();
11421142 }
11431143
1144−void Application::mouseMoveEvent(QMouseEvent* event) {
1144+void Application::mouseMoveEvent(QMouseEvent* event, unsigned int deviceID) {
11451145
11461146 bool showMouse = true;
1147+
1148+ // Used by application overlay to determine how to draw cursor(s)
1149+ _lastMouseMoveWasSimulated = deviceID > 0;
1150+
11471151 // If this mouse move event is emitted by a controller, dont show the mouse cursor
1148− if (event->type() == CONTROLLER_MOVE_EVENT) {
1152+ if (_lastMouseMoveWasSimulated) {
11491153 showMouse = false;
11501154 }
11511155
1152− // Used by application overlay to determine how to draw cursor(s)
1153− _lastMouseMoveType = event->type();
1154−
1155− _controllerScriptingInterface.emitMouseMoveEvent(event); // send events to any registered scripts
1156+ _controllerScriptingInterface.emitMouseMoveEvent(event, deviceID); // send events to any registered scripts
11561157
11571158 // if one of our scripts have asked to capture this event, then stop processing it
11581159 if (_controllerScriptingInterface.isMouseCaptured()) {
@@ -1171,7 +1172,7 @@ void Application::mouseMoveEvent(QMouseEvent* event) { · 12 unmodified lines
11711172 _mouseY = event->y();
11721173 }
11731174
1174−void Application::mousePressEvent(QMouseEvent* event) {
1175+void Application::mousePressEvent(QMouseEvent* event, unsigned int deviceID) {
11751176 _controllerScriptingInterface.emitMousePressEvent(event); // send events to any registered scripts
11761177
11771178 // if one of our scripts have asked to capture this event, then stop processing it
@@ -1204,7 +1205,7 @@ void Application::mousePressEvent(QMouseEvent* event) { · 26 unmodified lines
12041205 }
12051206 }
12061207
1207−void Application::mouseReleaseEvent(QMouseEvent* event) {
1208+void Application::mouseReleaseEvent(QMouseEvent* event, unsigned int deviceID) {
12081209 _controllerScriptingInterface.emitMouseReleaseEvent(event); // send events to any registered scripts
12091210
12101211 // if one of our scripts have asked to capture this event, then stop processing it

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t