History

Merge pull request #11584 from SamGondelman/pointerEvents

First step of cleaning up PointerEvents

Bradley Austin Davis committed 9 years ago

Commit becd99a2 parents 6051a39 863a20413 files · +284 −358Browse files

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

Unified · Split

interface/src/Application.cpp+5−87
@@ -692,7 +692,6 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) { · 691 unmodified lines
692692 DependencyManager::set<CloseEventSender>();
693693 DependencyManager::set<ResourceManager>();
694694 DependencyManager::set<SelectionScriptingInterface>();
695− DependencyManager::set<ContextOverlayInterface>();
696695 DependencyManager::set<Ledger>();
697696 DependencyManager::set<Wallet>();
698697 DependencyManager::set<WalletScriptingInterface>();
@@ -1188,7 +1187,10 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 489 unmodified lines
11881187 // allow you to move an entity around in your hand
11891188 _entityEditSender.setPacketsPerSecond(3000); // super high!!
11901189
1190+ // Overlays need to exist before we set the ContextOverlayInterface dependency
11911191 _overlays.init(); // do this before scripts load
1192+ DependencyManager::set<ContextOverlayInterface>();
1193+
11921194 // Make sure we don't time out during slow operations at startup
11931195 updateHeartbeat();
11941196
@@ -1478,53 +1480,19 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 283 unmodified lines
14781480 }
14791481 });
14801482
1481− // If the user clicks somewhere where there is NO entity at all, we will release focus
1482− connect(getEntities().data(), &EntityTreeRenderer::mousePressOffEntity, [=]() {
1483− setKeyboardFocusEntity(UNKNOWN_ENTITY_ID);
1484− });
1485−
14861483 // Keyboard focus handling for Web overlays.
14871484 auto overlays = &(qApp->getOverlays());
1488−
1489− connect(overlays, &Overlays::mousePressOnOverlay, [=](const OverlayID& overlayID, const PointerEvent& event) {
1490− auto thisOverlay = std::dynamic_pointer_cast<Web3DOverlay>(overlays->getOverlay(overlayID));
1491− // Only Web overlays can have keyboard focus.
1492− if (thisOverlay) {
1493− setKeyboardFocusEntity(UNKNOWN_ENTITY_ID);
1494− setKeyboardFocusOverlay(overlayID);
1495− }
1496− });
1497−
14981485 connect(overlays, &Overlays::overlayDeleted, [=](const OverlayID& overlayID) {
14991486 if (overlayID == _keyboardFocusedOverlay.get()) {
15001487 setKeyboardFocusOverlay(UNKNOWN_OVERLAY_ID);
15011488 }
15021489 });
15031490
1504− connect(overlays, &Overlays::mousePressOffOverlay, [=]() {
1505− setKeyboardFocusOverlay(UNKNOWN_OVERLAY_ID);
1506− });
1507−
15081491 connect(this, &Application::aboutToQuit, [=]() {
15091492 setKeyboardFocusOverlay(UNKNOWN_OVERLAY_ID);
15101493 setKeyboardFocusEntity(UNKNOWN_ENTITY_ID);
15111494 });
15121495
1513− connect(overlays,
1514− SIGNAL(mousePressOnOverlay(const OverlayID&, const PointerEvent&)),
1515− DependencyManager::get<ContextOverlayInterface>().data(),
1516− SLOT(contextOverlays_mousePressOnOverlay(const OverlayID&, const PointerEvent&)));
1517−
1518− connect(overlays,
1519− SIGNAL(hoverEnterOverlay(const OverlayID&, const PointerEvent&)),
1520− DependencyManager::get<ContextOverlayInterface>().data(),
1521− SLOT(contextOverlays_hoverEnterOverlay(const OverlayID&, const PointerEvent&)));
1522−
1523− connect(overlays,
1524− SIGNAL(hoverLeaveOverlay(const OverlayID&, const PointerEvent&)),
1525− DependencyManager::get<ContextOverlayInterface>().data(),
1526− SLOT(contextOverlays_hoverLeaveOverlay(const OverlayID&, const PointerEvent&)));
1527−
15281496 // Add periodic checks to send user activity data
15291497 static int CHECK_NEARBY_AVATARS_INTERVAL_MS = 10000;
15301498 static int NEARBY_AVATAR_RADIUS_METERS = 10;
@@ -4561,14 +4529,9 @@ QUuid Application::getKeyboardFocusEntity() const { · 3030 unmodified lines
45614529 return _keyboardFocusedEntity.get();
45624530 }
45634531
4564−void Application::setKeyboardFocusEntity(QUuid id) {
4565− EntityItemID entityItemID(id);
4566− setKeyboardFocusEntity(entityItemID);
4567−}
4568−
45694532 static const float FOCUS_HIGHLIGHT_EXPANSION_FACTOR = 1.05f;
45704533
4571−void Application::setKeyboardFocusEntity(EntityItemID entityItemID) {
4534+void Application::setKeyboardFocusEntity(const EntityItemID& entityItemID) {
45724535 if (_keyboardFocusedEntity.get() != entityItemID) {
45734536 _keyboardFocusedEntity.set(entityItemID);
45744537
@@ -4605,7 +4568,7 @@ OverlayID Application::getKeyboardFocusOverlay() { · 30 unmodified lines
46054568 return _keyboardFocusedOverlay.get();
46064569 }
46074570
4608−void Application::setKeyboardFocusOverlay(OverlayID overlayID) {
4571+void Application::setKeyboardFocusOverlay(const OverlayID& overlayID) {
46094572 if (overlayID != _keyboardFocusedOverlay.get()) {
46104573 _keyboardFocusedOverlay.set(overlayID);
46114574
@@ -7443,51 +7406,6 @@ bool Application::isForeground() const { · 2831 unmodified lines
74437406 return _isForeground && !_window->isMinimized();
74447407 }
74457408
7446−void Application::sendMousePressOnEntity(QUuid id, PointerEvent event) {
7447− EntityItemID entityItemID(id);
7448− emit getEntities()->mousePressOnEntity(entityItemID, event);
7449−}
7450−
7451−void Application::sendMouseMoveOnEntity(QUuid id, PointerEvent event) {
7452− EntityItemID entityItemID(id);
7453− emit getEntities()->mouseMoveOnEntity(entityItemID, event);
7454−}
7455−
7456−void Application::sendMouseReleaseOnEntity(QUuid id, PointerEvent event) {
7457− EntityItemID entityItemID(id);
7458− emit getEntities()->mouseReleaseOnEntity(entityItemID, event);
7459−}
7460−
7461−void Application::sendClickDownOnEntity(QUuid id, PointerEvent event) {
7462− EntityItemID entityItemID(id);
7463− emit getEntities()->clickDownOnEntity(entityItemID, event);
7464−}
7465−
7466−void Application::sendHoldingClickOnEntity(QUuid id, PointerEvent event) {
7467− EntityItemID entityItemID(id);
7468− emit getEntities()->holdingClickOnEntity(entityItemID, event);
7469−}
7470−
7471−void Application::sendClickReleaseOnEntity(QUuid id, PointerEvent event) {
7472− EntityItemID entityItemID(id);
7473− emit getEntities()->clickReleaseOnEntity(entityItemID, event);
7474−}
7475−
7476−void Application::sendHoverEnterEntity(QUuid id, PointerEvent event) {
7477− EntityItemID entityItemID(id);
7478− emit getEntities()->hoverEnterEntity(entityItemID, event);
7479−}
7480−
7481−void Application::sendHoverOverEntity(QUuid id, PointerEvent event) {
7482− EntityItemID entityItemID(id);
7483− emit getEntities()->hoverOverEntity(entityItemID, event);
7484−}
7485−
7486−void Application::sendHoverLeaveEntity(QUuid id, PointerEvent event) {
7487− EntityItemID entityItemID(id);
7488− emit getEntities()->hoverLeaveEntity(entityItemID, event);
7489−}
7490−
74917409 // FIXME? perhaps two, one for the main thread and one for the offscreen UI rendering thread?
74927410 static const int UI_RESERVED_THREADS = 1;
74937411 // Windows won't let you have all the cores