History

in 2d mode, clicks on tablet don't get used for other things

Seth Alves committed 9 years ago

Commit 70060eb1 parent 73774a67 files · +57 −23Browse files

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

Unified · Split

interface/src/Application.cpp+27−13
@@ -3097,17 +3097,23 @@ void Application::mouseMoveEvent(QMouseEvent* event) { · 3096 unmodified lines
30973097
30983098 if (compositor.getReticleVisible() || !isHMDMode() || !compositor.getReticleOverDesktop() ||
30993099 getOverlays().getOverlayAtPoint(glm::vec2(transformedPos.x(), transformedPos.y())) != UNKNOWN_OVERLAY_ID) {
3100− getOverlays().mouseMoveEvent(&mappedEvent);
3101− getEntities()->mouseMoveEvent(&mappedEvent);
3100+ if (_mouseToOverlays) {
3101+ getOverlays().mouseMoveEvent(&mappedEvent);
3102+ } else {
3103+ getEntities()->mouseMoveEvent(&mappedEvent);
3104+ }
3105+ }
3106+
3107+ if (!_mouseToOverlays) {
3108+ _controllerScriptingInterface->emitMouseMoveEvent(&mappedEvent); // send events to any registered scripts
31023109 }
3103− _controllerScriptingInterface->emitMouseMoveEvent(&mappedEvent); // send events to any registered scripts
31043110
31053111 // if one of our scripts have asked to capture this event, then stop processing it
31063112 if (_controllerScriptingInterface->isMouseCaptured()) {
31073113 return;
31083114 }
31093115
3110− if (_keyboardMouseDevice->isActive()) {
3116+ if (!_mouseToOverlays && _keyboardMouseDevice->isActive()) {
31113117 _keyboardMouseDevice->mouseMoveEvent(event);
31123118 }
31133119 }
@@ -3115,6 +3121,7 @@ void Application::mouseMoveEvent(QMouseEvent* event) { · 1 unmodified line
31153121 void Application::mousePressEvent(QMouseEvent* event) {
31163122 // Inhibit the menu if the user is using alt-mouse dragging
31173123 _altPressed = false;
3124+ _mouseToOverlays = false;
31183125
31193126 auto offscreenUi = DependencyManager::get<OffscreenUi>();
31203127 // If we get a mouse press event it means it wasn't consumed by the offscreen UI,
@@ -3131,21 +3138,23 @@ void Application::mousePressEvent(QMouseEvent* event) { · 10 unmodified lines
31313138 event->buttons(), event->modifiers());
31323139
31333140 if (!_aboutToQuit) {
3134− getOverlays().mousePressEvent(&mappedEvent);
3135−
3136− if (!_controllerScriptingInterface->areEntityClicksCaptured()) {
3141+ if (getOverlays().mousePressEvent(&mappedEvent)) {
3142+ _mouseToOverlays = true;
3143+ } else if (!_controllerScriptingInterface->areEntityClicksCaptured()) {
31373144 getEntities()->mousePressEvent(&mappedEvent);
31383145 }
31393146 }
31403147
3141− _controllerScriptingInterface->emitMousePressEvent(&mappedEvent); // send events to any registered scripts
3148+ if (!_mouseToOverlays) {
3149+ _controllerScriptingInterface->emitMousePressEvent(&mappedEvent); // send events to any registered scripts
3150+ }
31423151
31433152 // if one of our scripts have asked to capture this event, then stop processing it
31443153 if (_controllerScriptingInterface->isMouseCaptured()) {
31453154 return;
31463155 }
31473156
3148− if (hasFocus()) {
3157+ if (!_mouseToOverlays && hasFocus()) {
31493158 if (_keyboardMouseDevice->isActive()) {
31503159 _keyboardMouseDevice->mousePressEvent(event);
31513160 }
@@ -3179,18 +3188,23 @@ void Application::mouseReleaseEvent(QMouseEvent* event) { · 27 unmodified lines
31793188 event->buttons(), event->modifiers());
31803189
31813190 if (!_aboutToQuit) {
3182− getOverlays().mouseReleaseEvent(&mappedEvent);
3183− getEntities()->mouseReleaseEvent(&mappedEvent);
3191+ if (_mouseToOverlays) {
3192+ getOverlays().mouseReleaseEvent(&mappedEvent);
3193+ } else {
3194+ getEntities()->mouseReleaseEvent(&mappedEvent);
3195+ }
31843196 }
31853197
3186− _controllerScriptingInterface->emitMouseReleaseEvent(&mappedEvent); // send events to any registered scripts
3198+ if (!_mouseToOverlays) {
3199+ _controllerScriptingInterface->emitMouseReleaseEvent(&mappedEvent); // send events to any registered scripts
3200+ }
31873201
31883202 // if one of our scripts have asked to capture this event, then stop processing it
31893203 if (_controllerScriptingInterface->isMouseCaptured()) {
31903204 return;
31913205 }
31923206
3193− if (hasFocus()) {
3207+ if (!_mouseToOverlays && hasFocus()) {
31943208 if (_keyboardMouseDevice->isActive()) {
31953209 _keyboardMouseDevice->mouseReleaseEvent(event);
31963210 }

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