diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 3c4cbd97f..f92fa1d56 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -3912,7 +3912,7 @@ void LLAppViewer::idle() return; } - gViewerWindow->handlePerFrameHover(); + gViewerWindow->updateUI(); /////////////////////////////////////// // Agent and camera movement diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index bd584bc6c..8a880d1bd 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -399,7 +399,7 @@ bool idle_startup() // until initialization is complete, but need to be done here for things // to work. gIdleCallbacks.callFunctions(); - gViewerWindow->handlePerFrameHover(); + gViewerWindow->updateUI(); LLMortician::updateClass(); if (gNoRender) diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp index a264e30b5..ab55f6988 100644 --- a/indra/newview/lltextureview.cpp +++ b/indra/newview/lltextureview.cpp @@ -747,52 +747,56 @@ void LLTextureView::draw() if (!mOrderFetch) { #if 1 - if (pri < HIGH_PRIORITY && LLSelectMgr::getInstance()) - { - struct f : public LLSelectedTEFunctor + if (pri < HIGH_PRIORITY && LLSelectMgr::getInstance()) { - LLViewerFetchedTexture* mImage; - f(LLViewerFetchedTexture* image) : mImage(image) {} - virtual bool apply(LLViewerObject* object, S32 te) + struct f : public LLSelectedTEFunctor { - return (mImage == object->getTEImage(te)); + LLViewerFetchedTexture* mImage; + f(LLViewerFetchedTexture* image) : mImage(image) {} + virtual bool apply(LLViewerObject* object, S32 te) + { + return (mImage == object->getTEImage(te)); + } + } func(imagep); + const bool firstonly = true; + bool match = LLSelectMgr::getInstance()->getSelection()->applyToTEs(&func, firstonly); + if (match) + { + pri += 3*HIGH_PRIORITY; } - } func(imagep); - const bool firstonly = true; - bool match = LLSelectMgr::getInstance()->getSelection()->applyToTEs(&func, firstonly); - if (match) - { - pri += 3*HIGH_PRIORITY; } - } #endif #if 1 - if (pri < HIGH_PRIORITY && (cur_discard< 0 || desired_discard < cur_discard)) - { - LLViewerObject *objectp = gHoverView->getLastHoverObject(); - if (objectp) + if (pri < HIGH_PRIORITY && (cur_discard< 0 || desired_discard < cur_discard)) { - S32 tex_count = objectp->getNumTEs(); - for (S32 i = 0; i < tex_count; i++) + LLSelectNode* hover_node = LLSelectMgr::instance().getHoverNode(); + if (hover_node) { - if (imagep == objectp->getTEImage(i)) + LLViewerObject *objectp = hover_node->getObject(); + if (objectp) { - pri += 2*HIGH_PRIORITY; - break; + S32 tex_count = objectp->getNumTEs(); + for (S32 i = 0; i < tex_count; i++) + { + if (imagep == objectp->getTEImage(i)) + { + pri += 2*HIGH_PRIORITY; + break; + } + } } } } - } #endif #if 1 - if (pri > 0.f && pri < HIGH_PRIORITY) - { - if (imagep->mLastPacketTimer.getElapsedTimeF32() < 1.f || - imagep->mFetchDeltaTime < 0.25f) + if (pri > 0.f && pri < HIGH_PRIORITY) { - pri += 1*HIGH_PRIORITY; + if (imagep->mLastPacketTimer.getElapsedTimeF32() < 1.f || + imagep->mFetchDeltaTime < 0.25f) + { + pri += 1*HIGH_PRIORITY; + } } - } #endif } diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index bc297bcb0..30d00b6c6 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -152,7 +152,7 @@ void display_startup() LLGLState::checkStates(); LLGLState::checkTextureChannels(); - gViewerWindow->handlePerFrameHover(); // Fix ui flicker. + gViewerWindow->updateUI(); // Fix ui flicker. glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); LLGLSUIDefault gls_ui; diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index f06fce3e4..130ecfe74 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2793,7 +2793,7 @@ void LLViewerWindow::moveCursorToCenter() // Update UI based on stored mouse position from mouse-move // event processing. -BOOL LLViewerWindow::handlePerFrameHover() +void LLViewerWindow::updateUI() { static LLFastTimer::DeclareTimer ftm("Update UI"); LLFastTimer t(ftm); @@ -2819,51 +2819,13 @@ BOOL LLViewerWindow::handlePerFrameHover() &gDebugRaycastStart, &gDebugRaycastEnd); } - //RN: fix for asynchronous notification of mouse leaving window not working - LLCoordWindow mouse_pos; - mWindow->getCursorPosition(&mouse_pos); - if (mouse_pos.mX < 0 || - mouse_pos.mY < 0 || - mouse_pos.mX > mWindowRectRaw.getWidth() || - mouse_pos.mY > mWindowRectRaw.getHeight()) - { - mMouseInWindow = FALSE; - } - else - { - mMouseInWindow = TRUE; - } + updateMouseDelta(); - S32 dx = lltrunc((F32) (mCurrentMousePoint.mX - mLastMousePoint.mX) * LLUI::sGLScaleFactor.mV[VX]); - S32 dy = lltrunc((F32) (mCurrentMousePoint.mY - mLastMousePoint.mY) * LLUI::sGLScaleFactor.mV[VY]); - - LLVector2 mouse_vel; - - static const LLCachedControl mouse_smooth("MouseSmooth",false); - if (mouse_smooth) - { - static F32 fdx = 0.f; - static F32 fdy = 0.f; - - F32 amount = 16.f; - fdx = fdx + ((F32) dx - fdx) * llmin(gFrameIntervalSeconds*amount,1.f); - fdy = fdy + ((F32) dy - fdy) * llmin(gFrameIntervalSeconds*amount,1.f); - - mCurrentMouseDelta.set(llround(fdx), llround(fdy)); - mouse_vel.setVec(fdx,fdy); - } - else - { - mCurrentMouseDelta.set(dx, dy); - mouse_vel.setVec((F32) dx, (F32) dy); - } - - mMouseVelocityStat.addValue(mouse_vel.magVec()); if (gNoRender) { - return TRUE; + return; } // clean up current focus @@ -3239,7 +3201,7 @@ BOOL LLViewerWindow::handlePerFrameHover() previous_x = x; previous_y = y; - return handled; + return; } @@ -3250,6 +3212,50 @@ void LLViewerWindow::hoverPickCallback(const LLPickInfo& pick_info) } +void LLViewerWindow::updateMouseDelta() +{ + S32 dx = lltrunc((F32) (mCurrentMousePoint.mX - mLastMousePoint.mX) * LLUI::sGLScaleFactor.mV[VX]); + S32 dy = lltrunc((F32) (mCurrentMousePoint.mY - mLastMousePoint.mY) * LLUI::sGLScaleFactor.mV[VY]); + + //RN: fix for asynchronous notification of mouse leaving window not working + LLCoordWindow mouse_pos; + mWindow->getCursorPosition(&mouse_pos); + if (mouse_pos.mX < 0 || + mouse_pos.mY < 0 || + mouse_pos.mX > mWindowRectRaw.getWidth() || + mouse_pos.mY > mWindowRectRaw.getHeight()) + { + mMouseInWindow = FALSE; + } + else + { + mMouseInWindow = TRUE; + } + + LLVector2 mouse_vel; + + static const LLCachedControl mouse_smooth("MouseSmooth",false); + if (mouse_smooth) + { + static F32 fdx = 0.f; + static F32 fdy = 0.f; + + F32 amount = 16.f; + fdx = fdx + ((F32) dx - fdx) * llmin(gFrameIntervalSeconds*amount,1.f); + fdy = fdy + ((F32) dy - fdy) * llmin(gFrameIntervalSeconds*amount,1.f); + + mCurrentMouseDelta.set(llround(fdx), llround(fdy)); + mouse_vel.setVec(fdx,fdy); + } + else + { + mCurrentMouseDelta.set(dx, dy); + mouse_vel.setVec((F32) dx, (F32) dy); + } + + mMouseVelocityStat.addValue(mouse_vel.magVec()); +} + void LLViewerWindow::saveLastMouse(const LLCoordGL &point) { // Store last mouse location. diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index 86ca05fb4..30848b386 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -282,7 +282,8 @@ public: void updateObjectUnderCursor(); - BOOL handlePerFrameHover(); // Once per frame, update UI based on mouse position + void updateUI(); // Once per frame, update UI based on mouse position + void updateMouseDelta(); BOOL handleKey(KEY key, MASK mask); void handleScrollWheel (S32 clicks);