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
155 _mouseX(0),155 _mouseX(0),
156 _mouseY(0),156 _mouseY(0),
157 _lastMouseMove(usecTimestampNow()),157 _lastMouseMove(usecTimestampNow()),
158 _lastMouseMoveType(QEvent::MouseMove),158 _lastMouseMoveWasSimulated(false),
159 _mouseHidden(false),159 _mouseHidden(false),
160 _seenMouseMove(false),160 _seenMouseMove(false),
161 _touchAvgX(0.0f),161 _touchAvgX(0.0f),
@@ -1141,18 +1141,19 @@ void Application::focusOutEvent(QFocusEvent* event) { · 979 unmodified lines
1141 _keysPressed.clear();1141 _keysPressed.clear();
1142}1142}
1143 1143
1144void Application::mouseMoveEvent(QMouseEvent* event) {1144void Application::mouseMoveEvent(QMouseEvent* event, unsigned int deviceID) {
1145 1145
1146 bool showMouse = true;1146 bool showMouse = true;
1147
1148 // Used by application overlay to determine how to draw cursor(s)
1149 _lastMouseMoveWasSimulated = deviceID > 0;
1150
1147 // If this mouse move event is emitted by a controller, dont show the mouse cursor1151 // 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) {
1149 showMouse = false;1153 showMouse = false;
1150 }1154 }
1151 1155
1152 // Used by application overlay to determine how to draw cursor(s)1156 _controllerScriptingInterface.emitMouseMoveEvent(event, deviceID); // send events to any registered scripts
1153 _lastMouseMoveType = event->type();
1154
1155 _controllerScriptingInterface.emitMouseMoveEvent(event); // send events to any registered scripts
1156 1157
1157 // if one of our scripts have asked to capture this event, then stop processing it1158 // if one of our scripts have asked to capture this event, then stop processing it
1158 if (_controllerScriptingInterface.isMouseCaptured()) {1159 if (_controllerScriptingInterface.isMouseCaptured()) {
@@ -1171,7 +1172,7 @@ void Application::mouseMoveEvent(QMouseEvent* event) { · 12 unmodified lines
1171 _mouseY = event->y();1172 _mouseY = event->y();
1172}1173}
1173 1174
1174void Application::mousePressEvent(QMouseEvent* event) {1175void Application::mousePressEvent(QMouseEvent* event, unsigned int deviceID) {
1175 _controllerScriptingInterface.emitMousePressEvent(event); // send events to any registered scripts1176 _controllerScriptingInterface.emitMousePressEvent(event); // send events to any registered scripts
1176 1177
1177 // if one of our scripts have asked to capture this event, then stop processing it1178 // 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
1204 }1205 }
1205}1206}
1206 1207
1207void Application::mouseReleaseEvent(QMouseEvent* event) {1208void Application::mouseReleaseEvent(QMouseEvent* event, unsigned int deviceID) {
1208 _controllerScriptingInterface.emitMouseReleaseEvent(event); // send events to any registered scripts1209 _controllerScriptingInterface.emitMouseReleaseEvent(event); // send events to any registered scripts
1209 1210
1210 // if one of our scripts have asked to capture this event, then stop processing it1211 // 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