From a8fb423e44ede5777a15cc6f7cfbd614795f6cf9 Mon Sep 17 00:00:00 2001 From: TighMacFanatic Date: Sun, 17 Jul 2011 17:04:33 -0400 Subject: [PATCH 01/61] Fix compile warning due to signed/unsigned mistake. --- indra/newview/lltexturefetch.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 967d56b9d..ced122c78 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -479,7 +479,7 @@ static bool sgConnectionThrottle() { LLMutexLock lock(&mutex); const U32 THROTTLE_TIMESTEPS_PER_SECOND = 10; static const LLCachedControl max_connections_per_second("HTTPRequestRate", 30); - S32 max_connections = max_connections_per_second/THROTTLE_TIMESTEPS_PER_SECOND; + U32 max_connections = max_connections_per_second/THROTTLE_TIMESTEPS_PER_SECOND; const S32 timestep = USEC_PER_SEC/THROTTLE_TIMESTEPS_PER_SECOND; U64 now = LLTimer::getTotalTime(); std::deque timestamps; From 057a154a6da61bca8fa479af38a30b4caa3e33c5 Mon Sep 17 00:00:00 2001 From: Aleric Inglewood Date: Fri, 29 Jul 2011 17:24:39 +0200 Subject: [PATCH 02/61] Minor documentation fixes. --- indra/newview/statemachine/aievent.cpp | 2 +- indra/newview/statemachine/aievent.h | 2 +- indra/newview/statemachine/aifetchinventoryfolder.cpp | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/indra/newview/statemachine/aievent.cpp b/indra/newview/statemachine/aievent.cpp index 0e7e9fa6e..ec2901932 100644 --- a/indra/newview/statemachine/aievent.cpp +++ b/indra/newview/statemachine/aievent.cpp @@ -40,7 +40,7 @@ struct AIRSData { AIRSData(bool one_shot) : mOneShot(one_shot) { } }; -// A list of all statemachines registered for a particular event, and and API to work on it. +// A list of all statemachines registered for a particular event, and an API to work on it. struct AIRegisteredStateMachines { typedef std::map rsm_type; rsm_type mRegisteredStateMachines; diff --git a/indra/newview/statemachine/aievent.h b/indra/newview/statemachine/aievent.h index a90a04aaf..34ecc4db3 100644 --- a/indra/newview/statemachine/aievent.h +++ b/indra/newview/statemachine/aievent.h @@ -56,7 +56,7 @@ class AIEvent { * * This may be called for already unregistered events. * This should be called from the destructor of a statemachine for any event it registers, - * as well as when it doesn't need the event anymore (in the case on non- one shot events). + * as well as when it doesn't need the event anymore (in the case of non- one shot events). * * @param event the event we want to no longer be notified off. * @param statemachine the statemachine. diff --git a/indra/newview/statemachine/aifetchinventoryfolder.cpp b/indra/newview/statemachine/aifetchinventoryfolder.cpp index 3a3865a6e..c85001e8b 100644 --- a/indra/newview/statemachine/aifetchinventoryfolder.cpp +++ b/indra/newview/statemachine/aifetchinventoryfolder.cpp @@ -88,7 +88,10 @@ void AIFetchInventoryFolder::initialize_impl(void) mNeedNotifyObservers = false; set_state(AIFetchInventoryFolder_checkFolderExists); if (!gInventory.isInventoryUsable()) + { + // This immediately calls this->idle(), and then when the event occurs cont(). AIEvent::Register(AIEvent::LLInventoryModel_mIsAgentInvUsable_true, this); + } } void AIFetchInventoryFolder::multiplex_impl(void) From d828f858c9b97b2c934ffb740c01fb7e8e298aa3 Mon Sep 17 00:00:00 2001 From: Aleric Inglewood Date: Mon, 1 Aug 2011 21:00:27 +0200 Subject: [PATCH 03/61] LLFrameTimer review and resulting changes. This makes the class API a bit more sane, although only a bit, because I had to leave it working with possibly new code merged in from LL: the API can't really change. I also removed some unused code. While reviewing how LLFrameTimer worked however, I did find a few instances where things where broken: * sFrameDeltaTime wasn't correctly updated (more than once per frame and therefore erratic). This only influenced scrolling speed, but still. * While dragging an inventory item, the scroll arrows of a tab container didn't work (LLTabContainer::handleDragAndDrop). * Map zoom interpolation was broken (it interpolated between A and B, but used the already updated interpolation for A the next frame... (added mCurZoomValInterpolationStart). --- indra/llcommon/llapp.cpp | 9 -- indra/llcommon/llapp.h | 19 ---- indra/llcommon/llframetimer.cpp | 100 ++++++++++++---------- indra/llcommon/llframetimer.h | 95 +++++++++++--------- indra/llmessage/llpumpio.cpp | 4 +- indra/llui/llalertdialog.cpp | 3 +- indra/llui/lllineeditor.cpp | 3 +- indra/llui/lltabcontainer.cpp | 80 +++++++++-------- indra/llvfs/llpidlock.cpp | 2 +- indra/newview/llappviewer.cpp | 3 +- indra/newview/llfloateractivespeakers.cpp | 10 +-- indra/newview/llfloatersnapshot.cpp | 6 +- indra/newview/llfloaterworldmap.cpp | 19 ++-- indra/newview/llfloaterworldmap.h | 1 + indra/newview/llpanelmediahud.cpp | 3 +- indra/newview/llpreviewtexture.cpp | 3 +- indra/newview/llstatusbar.cpp | 6 +- indra/newview/llviewerinventory.cpp | 12 +-- indra/newview/llvoavatar.cpp | 2 +- 19 files changed, 189 insertions(+), 191 deletions(-) diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp index c35a84255..59173eecd 100644 --- a/indra/llcommon/llapp.cpp +++ b/indra/llcommon/llapp.cpp @@ -249,15 +249,6 @@ LLSD LLApp::getOptionData(OptionPriority level) return mOptions[level]; } -void LLApp::stepFrame() -{ - LLFrameTimer::updateFrameTime(); - LLFrameTimer::updateFrameCount(); - LLEventTimer::updateClass(); - mRunner.run(); -} - - void LLApp::setupErrorHandling() { // Error handling is done by starting up an error handling thread, which just sleeps and diff --git a/indra/llcommon/llapp.h b/indra/llcommon/llapp.h index 05e2bccaf..09e88b326 100644 --- a/indra/llcommon/llapp.h +++ b/indra/llcommon/llapp.h @@ -236,17 +236,6 @@ public: pid_t fork(); #endif - /** - * @brief Get a reference to the application runner - * - * Please use the runner with caution. Since the Runner usage - * pattern is not yet clear, this method just gives access to it - * to add and remove runnables. - * @return Returns the application runner. Do not save the - * pointer past the caller's stack frame. - */ - LLRunner& getRunner() { return mRunner; } - public: typedef std::map string_map; string_map mOptionMap; // Contains all command-line options and arguments in a map @@ -264,11 +253,6 @@ protected: static LLAppChildCallback sDefaultChildCallback; #endif - /** - * @brief This method is called once a frame to do once a frame tasks. - */ - void stepFrame(); - /** * @ brief This method is called once as soon as logging is initialized. */ @@ -289,9 +273,6 @@ private: // Default application threads LLErrorThread* mThreadErrorp; // Waits for app to go to status ERROR, then runs the error callback - // This is the application level runnable scheduler. - LLRunner mRunner; - /** @name Runtime option implementation */ //@{ diff --git a/indra/llcommon/llframetimer.cpp b/indra/llcommon/llframetimer.cpp index 138c67a36..d05b9875c 100644 --- a/indra/llcommon/llframetimer.cpp +++ b/indra/llcommon/llframetimer.cpp @@ -4,6 +4,7 @@ * $LicenseInfo:firstyear=2002&license=viewergpl$ * * Copyright (c) 2002-2009, Linden Research, Inc. + * Copyright (c) 2011, Aleric Inglewood. * * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab @@ -35,48 +36,55 @@ #include "llframetimer.h" +// Local constants. +static F64 const USEC_PER_SECOND = 1000000.0; +static F64 const USEC_TO_SEC_F64 = 0.000001; + // Static members -//LLTimer LLFrameTimer::sInternalTimer; -U64 LLFrameTimer::sStartTotalTime = totalTime(); -F64 LLFrameTimer::sFrameTime = 0.0; -U64 LLFrameTimer::sTotalTime = 0; -F64 LLFrameTimer::sTotalSeconds = 0.0; -S32 LLFrameTimer::sFrameCount = 0; -U64 LLFrameTimer::sFrameDeltaTime = 0; -const F64 USEC_PER_SECOND = 1000000.0; -const F64 USEC_TO_SEC_F64 = 0.000001; +U64 const LLFrameTimer::sStartTotalTime = totalTime(); // Application start in microseconds since epoch. +U64 LLFrameTimer::sTotalTime = LLFrameTimer::sStartTotalTime; // Current time in microseconds since epoch, updated at least once per frame. +F64 LLFrameTimer::sTotalSeconds = // Current time in seconds since epoch, updated together with LLFrameTimer::sTotalTime. + U64_to_F64(LLFrameTimer::sTotalTime) * USEC_TO_SEC_F64; +F64 LLFrameTimer::sFrameTime = 0.0; // Current time in seconds since application start, updated together with LLFrameTimer::sTotalTime. +// Updated exactly once per frame: +S32 LLFrameTimer::sFrameCount = 0; // Current frame number (number of frames since application start). +U64 LLFrameTimer::sPrevTotalTime = LLFrameTimer::sStartTotalTime; // Previous (frame) time in microseconds since epoch, updated once per frame. +U64 LLFrameTimer::sFrameDeltaTime = 0; // Microseconds between last two calls to LLFrameTimer::updateFrameTimeAndCount. // static void LLFrameTimer::updateFrameTime() { - U64 total_time = totalTime(); - sFrameDeltaTime = total_time - sTotalTime; - sTotalTime = total_time; + sTotalTime = totalTime(); sTotalSeconds = U64_to_F64(sTotalTime) * USEC_TO_SEC_F64; sFrameTime = U64_to_F64(sTotalTime - sStartTotalTime) * USEC_TO_SEC_F64; } -void LLFrameTimer::start() +// static +void LLFrameTimer::updateFrameTimeAndCount() { - reset(); - mStarted = TRUE; + updateFrameTime(); + sFrameDeltaTime = sTotalTime - sPrevTotalTime; + sPrevTotalTime = sTotalTime; + ++sFrameCount; +} + +void LLFrameTimer::reset(F32 expiration) +{ + llassert(!mPaused); + mStartTime = sFrameTime; + mExpiry = sFrameTime + expiration; +} + +void LLFrameTimer::start(F32 expiration) +{ + reset(expiration); + mRunning = true; // Start, if not already started. } void LLFrameTimer::stop() { - mStarted = FALSE; -} - -void LLFrameTimer::reset() -{ - mStartTime = sFrameTime; - mExpiry = sFrameTime; -} - -void LLFrameTimer::resetWithExpiry(F32 expiration) -{ - reset(); - setTimerExpirySec(expiration); + llassert(!mPaused); + mRunning = false; } // Don't combine pause/unpause with start/stop @@ -89,25 +97,31 @@ void LLFrameTimer::resetWithExpiry(F32 expiration) // Note: elapsed would also be valid with no unpause() call (= time run until pause() called) void LLFrameTimer::pause() { - if (mStarted) - mStartTime = sFrameTime - mStartTime; // save dtime - mStarted = FALSE; + if (!mPaused) + { + mStartTime = sFrameTime - mStartTime; // Abuse mStartTime to store the elapsed time so far. + } + mPaused = true; } void LLFrameTimer::unpause() { - if (!mStarted) - mStartTime = sFrameTime - mStartTime; // restore dtime - mStarted = TRUE; + if (mPaused) + { + mStartTime = sFrameTime - mStartTime; // Set mStartTime consistent with the elapsed time so far. + } + mPaused = false; } void LLFrameTimer::setTimerExpirySec(F32 expiration) { - mExpiry = expiration + mStartTime; + llassert(!mPaused); + mExpiry = mStartTime + expiration; } void LLFrameTimer::setExpiryAt(F64 seconds_since_epoch) { + llassert(!mPaused); mStartTime = sFrameTime; mExpiry = seconds_since_epoch - (USEC_TO_SEC_F64 * sStartTotalTime); } @@ -119,20 +133,14 @@ F64 LLFrameTimer::expiresAt() const return expires_at; } -BOOL LLFrameTimer::checkExpirationAndReset(F32 expiration) +bool LLFrameTimer::checkExpirationAndReset(F32 expiration) { - //llinfos << "LLFrameTimer::checkExpirationAndReset()" << llendl; - //llinfos << " mStartTime:" << mStartTime << llendl; - //llinfos << " sFrameTime:" << sFrameTime << llendl; - //llinfos << " mExpiry: " << mExpiry << llendl; - - if(hasExpired()) + if (hasExpired()) { - reset(); - setTimerExpirySec(expiration); - return TRUE; + reset(expiration); + return true; } - return FALSE; + return false; } // static diff --git a/indra/llcommon/llframetimer.h b/indra/llcommon/llframetimer.h index f4775a992..e737a884e 100644 --- a/indra/llcommon/llframetimer.h +++ b/indra/llcommon/llframetimer.h @@ -6,6 +6,7 @@ * $LicenseInfo:firstyear=2002&license=viewergpl$ * * Copyright (c) 2002-2009, Linden Research, Inc. + * Copyright (c) 2011, Aleric Inglewood. * * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab @@ -37,7 +38,7 @@ /** * *NOTE: Because of limitations on linux which we do not really have * time to explore, the total time is derived from the frame time - * and is recsynchronized on every frame. + * and is resynchronized on every frame. */ #include "lltimer.h" @@ -46,61 +47,64 @@ class LL_COMMON_API LLFrameTimer { public: - LLFrameTimer() : mStartTime( sFrameTime ), mExpiry(0), mStarted(TRUE) {} + // Create an LLFrameTimer and start it. After creation it is running and in the state expired (hasExpired will return true). + LLFrameTimer(void) : mStartTime(sFrameTime), mExpiry(0), mRunning(true), mPaused(false) { } - // Return the number of seconds since the start of this - // application instance. + // Return the number of seconds since the start of the application. static F64 getElapsedSeconds() { // Loses msec precision after ~4.5 hours... return sFrameTime; } - // Return a low precision usec since epoch + // Return a low precision usec since epoch. static U64 getTotalTime() { - return sTotalTime ? sTotalTime : totalTime(); + llassert(sTotalTime); + return sTotalTime; } - // Return a low precision seconds since epoch + // Return a low precision seconds since epoch. static F64 getTotalSeconds() { return sTotalSeconds; } - // Call this method once per frame to update the current frame time. This is actually called - // at some other times as well + // Call this method once per frame to update the current frame time. + // This is actually called at some other times as well. static void updateFrameTime(); - // Call this method once, and only once, per frame to update the current frame count. - static void updateFrameCount() { sFrameCount++; } + // Call this method once, and only once, per frame to update the current frame count and sFrameDeltaTime. + static void updateFrameTimeAndCount(); - static U32 getFrameCount() { return sFrameCount; } + // Return current frame number (the number of frames since application start). + static U32 getFrameCount() { return sFrameCount; } - static F32 getFrameDeltaTimeF32(); + // Return duration of last frame in seconds. + static F32 getFrameDeltaTimeF32(); // Return seconds since the current frame started - static F32 getCurrentFrameTime(); + static F32 getCurrentFrameTime(); // MANIPULATORS - void start(); - void stop(); - void reset(); - void resetWithExpiry(F32 expiration); - void pause(); - void unpause(); + + void reset(F32 expiration = 0.f); // Same as start() but leaves mRunning off when called after stop(). + void start(F32 expiration = 0.f); // Reset and (re)start with expiration. + void stop(); // Stop running. + + void pause(); // Mark elapsed time so far. + void unpause(); // Move 'start' time in order to decrement time between pause and unpause from ElapsedTime. + void setTimerExpirySec(F32 expiration); void setExpiryAt(F64 seconds_since_epoch); - BOOL checkExpirationAndReset(F32 expiration); - F32 getElapsedTimeAndResetF32() { F32 t = F32(sFrameTime - mStartTime); reset(); return t; } - - void setAge(const F64 age) { mStartTime = sFrameTime - age; } + bool checkExpirationAndReset(F32 expiration); // Returns true when expired. Only resets if expired. + F32 getElapsedTimeAndResetF32() { F32 t = getElapsedTimeF32(); reset(); return t; } + void setAge(const F64 age) { llassert(!mPaused); mStartTime = sFrameTime - age; } // ACCESSORS - BOOL hasExpired() const { return (sFrameTime >= mExpiry); } - F32 getTimeToExpireF32() const { return (F32)(mExpiry - sFrameTime); } - F32 getElapsedTimeF32() const { return mStarted ? (F32)(sFrameTime - mStartTime) : (F32)mStartTime; } - BOOL getStarted() const { return mStarted; } + bool hasExpired() const { return sFrameTime >= mExpiry; } + F32 getElapsedTimeF32() const { llassert(mRunning); return mPaused ? (F32)mStartTime : (F32)(sFrameTime - mStartTime); } + bool getStarted() const { return mRunning; } // return the seconds since epoch when this timer will expire. F64 expiresAt() const; @@ -114,45 +118,52 @@ protected: // Aplication constants // - // Start time of opp in usec since epoch - static U64 sStartTotalTime; + // Application start in microseconds since epoch. + static U64 const sStartTotalTime; // // Data updated per frame // - // Seconds since application start + // Current time in seconds since application start, updated together with sTotalTime. static F64 sFrameTime; - // Time that has elapsed since last call to updateFrameTime() + // Microseconds between last two calls to updateFrameTimeAndCount (time between last two frames). static U64 sFrameDeltaTime; - // Total microseconds since epoch. + // Current time in microseconds since epoch, updated at least once per frame. static U64 sTotalTime; - // Seconds since epoch. + // Previous (frame) time in microseconds since epoch, updated once per frame. + static U64 sPrevTotalTime; + + // Current time in seconds since epoch, updated together with sTotalTime. static F64 sTotalSeconds; - // Total number of frames elapsed in application + // Current frame number (number of frames since application start). static S32 sFrameCount; // // Member data // - // Number of seconds after application start when this timer was - // started. Set equal to sFrameTime when reset. + // When not paused (mPaused is false): number of seconds since application start, + // otherwise this value is equal to the accumulated run time (ElapsedTime). + // Set equal to sFrameTime when reset. F64 mStartTime; - // Timer expires this many seconds after application start time. + // Timer expires when sFrameTime reaches this value (in seconds since application start). F64 mExpiry; - // Useful bit of state usually associated with timers, but does - // not affect actual functionality - BOOL mStarted; + // True when running, merely a boolean return by getStarted(). The timer always runs. + bool mRunning; + + // True when accumulating ElapsedTime. If false mStartTime has a different meaning + // and really unpause() should be called before anything else. + bool mPaused; }; // Glue code for Havok (or anything else that doesn't want the full .h files) -extern F32 getCurrentFrameTime(); +extern F32 getCurrentFrameTime(); #endif // LL_LLFRAMETIMER_H diff --git a/indra/llmessage/llpumpio.cpp b/indra/llmessage/llpumpio.cpp index c50dcc876..7a10c0fa6 100644 --- a/indra/llmessage/llpumpio.cpp +++ b/indra/llmessage/llpumpio.cpp @@ -1147,9 +1147,7 @@ void LLPumpIO::LLChainInfo::setTimeoutSeconds(F32 timeout) LLMemType m1(LLMemType::MTYPE_IO_PUMP); if(timeout > 0.0f) { - mTimer.start(); - mTimer.reset(); - mTimer.setTimerExpirySec(timeout); + mTimer.start(timeout); } else { diff --git a/indra/llui/llalertdialog.cpp b/indra/llui/llalertdialog.cpp index f708e220e..27700ca20 100644 --- a/indra/llui/llalertdialog.cpp +++ b/indra/llui/llalertdialog.cpp @@ -349,8 +349,7 @@ bool LLAlertDialog::show() if(mDefaultOption >= 0) { // delay before enabling default button - mDefaultBtnTimer.start(); - mDefaultBtnTimer.setTimerExpirySec(DEFAULT_BUTTON_DELAY); + mDefaultBtnTimer.start(DEFAULT_BUTTON_DELAY); } // attach to floater if necessary diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index fe4190a2b..328e62051 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -858,8 +858,7 @@ BOOL LLLineEditor::handleHover(S32 x, S32 y, MASK mask) if (mScrollTimer.hasExpired()) { S32 increment = llround(mScrollTimer.getElapsedTimeF32() / AUTO_SCROLL_TIME); - mScrollTimer.reset(); - mScrollTimer.setTimerExpirySec(AUTO_SCROLL_TIME); + mScrollTimer.reset(AUTO_SCROLL_TIME); if( (x < mMinHPixels) && (mScrollHPos > 0 ) ) { // Scroll to the left diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 1f94191d2..e1bf4d4aa 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -630,49 +630,59 @@ LLXMLNodePtr LLTabContainer::getXML(bool save_children) const // virtual BOOL LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType type, void* cargo_data, EAcceptance *accept, std::string &tooltip) { - BOOL has_scroll_arrows = (getMaxScrollPos() > 0); + bool const has_scroll_arrows = (getMaxScrollPos() > 0); - if( mDragAndDropDelayTimer.getElapsedTimeF32() > SCROLL_DELAY_TIME ) + LLButton* button = NULL; + if (has_scroll_arrows) { - if (has_scroll_arrows) + // We're dragging an inventory item. Check if we're hovering over scroll arrows of this tab container. + if (mJumpPrevArrowBtn && mJumpPrevArrowBtn->getRect().pointInRect(x, y)) { - if (mJumpPrevArrowBtn && mJumpPrevArrowBtn->getRect().pointInRect(x, y)) + button = mJumpPrevArrowBtn; + } + else if (mJumpNextArrowBtn && mJumpNextArrowBtn->getRect().pointInRect(x, y)) + { + button = mJumpNextArrowBtn; + } + else if (mPrevArrowBtn->getRect().pointInRect(x, y)) + { + button = mPrevArrowBtn; + } + else if (mNextArrowBtn->getRect().pointInRect(x, y)) + { + button = mNextArrowBtn; + } + if (button) + { + if (mDragAndDropDelayTimer.getStarted() && mDragAndDropDelayTimer.hasExpired()) { - S32 local_x = x - mJumpPrevArrowBtn->getRect().mLeft; - S32 local_y = y - mJumpPrevArrowBtn->getRect().mBottom; - mJumpPrevArrowBtn->handleHover(local_x, local_y, mask); + // We've been hovering (another) SCROLL_DELAY_TIME seconds. Emulate a button press. + button->onCommit(); + // Reset the timer. + mDragAndDropDelayTimer.start(SCROLL_DELAY_TIME); } - if (mJumpNextArrowBtn && mJumpNextArrowBtn->getRect().pointInRect(x, y)) + else if (!mDragAndDropDelayTimer.getStarted()) { - S32 local_x = x - mJumpNextArrowBtn->getRect().mLeft; - S32 local_y = y - mJumpNextArrowBtn->getRect().mBottom; - mJumpNextArrowBtn->handleHover(local_x, local_y, mask); - } - if (mPrevArrowBtn->getRect().pointInRect(x, y)) - { - S32 local_x = x - mPrevArrowBtn->getRect().mLeft; - S32 local_y = y - mPrevArrowBtn->getRect().mBottom; - mPrevArrowBtn->handleHover(local_x, local_y, mask); - } - else if (mNextArrowBtn->getRect().pointInRect(x, y)) - { - S32 local_x = x - mNextArrowBtn->getRect().mLeft; - S32 local_y = y - mNextArrowBtn->getRect().mBottom; - mNextArrowBtn->handleHover(local_x, local_y, mask); + // We just entered the arrow. Start the timer. + mDragAndDropDelayTimer.start(SCROLL_DELAY_TIME); } } - - for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) + else { - LLTabTuple* tuple = *iter; - tuple->mButton->setVisible( TRUE ); - S32 local_x = x - tuple->mButton->getRect().mLeft; - S32 local_y = y - tuple->mButton->getRect().mBottom; - if (tuple->mButton->pointInView(local_x, local_y) && tuple->mButton->getEnabled() && !tuple->mTabPanel->getVisible()) - { - tuple->mButton->onCommit(); - mDragAndDropDelayTimer.stop(); - } + // We're not on an arrow or just left it. Stop the time (in case it was running). + mDragAndDropDelayTimer.stop(); + } + } + + for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) + { + LLTabTuple* tuple = *iter; + tuple->mButton->setVisible( TRUE ); + S32 local_x = x - tuple->mButton->getRect().mLeft; + S32 local_y = y - tuple->mButton->getRect().mBottom; + if (tuple->mButton->pointInView(local_x, local_y) && tuple->mButton->getEnabled() && !tuple->mTabPanel->getVisible()) + { + tuple->mButton->onCommit(); } } @@ -1849,5 +1859,3 @@ void LLTabContainer::commitHoveredButton(S32 x, S32 y) } } - - diff --git a/indra/llvfs/llpidlock.cpp b/indra/llvfs/llpidlock.cpp index 28cee2940..5df5eadbe 100644 --- a/indra/llvfs/llpidlock.cpp +++ b/indra/llvfs/llpidlock.cpp @@ -167,7 +167,7 @@ bool LLPidLockFile::requestLock(LLNameTable *name_table, bool autosave, if (!mWaiting) //Not presently waiting to save. Queue up. { - mTimer.resetWithExpiry(timeout); + mTimer.reset(timeout); mWaiting=TRUE; } diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 874a24643..3b1436474 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -3501,8 +3501,7 @@ void LLAppViewer::idle() // Update frame timers static LLTimer idle_timer; - LLFrameTimer::updateFrameTime(); - LLFrameTimer::updateFrameCount(); + LLFrameTimer::updateFrameTimeAndCount(); LLEventTimer::updateClass(); LLCriticalDamp::updateInterpolants(); LLMortician::updateClass(); diff --git a/indra/newview/llfloateractivespeakers.cpp b/indra/newview/llfloateractivespeakers.cpp index a641ac69d..27d35c6bb 100644 --- a/indra/newview/llfloateractivespeakers.cpp +++ b/indra/newview/llfloateractivespeakers.cpp @@ -91,7 +91,7 @@ LLSpeaker::LLSpeaker(const LLUUID& id, const std::string& name, const ESpeakerTy gVoiceClient->setUserVolume(id, LLMuteList::getInstance()->getSavedResidentVolume(id)); - mActivityTimer.resetWithExpiry(SPEAKER_TIMEOUT); + mActivityTimer.reset(SPEAKER_TIMEOUT); } @@ -1021,7 +1021,7 @@ LLPointer LLSpeakerMgr::setSpeaker(const LLUUID& id, const std::strin { // keep highest priority status (lowest value) instead of overriding current value speakerp->mStatus = llmin(speakerp->mStatus, status); - speakerp->mActivityTimer.resetWithExpiry(SPEAKER_TIMEOUT); + speakerp->mActivityTimer.reset(SPEAKER_TIMEOUT); // RN: due to a weird behavior where IMs from attached objects come from the wearer's agent_id // we need to override speakers that we think are objects when we find out they are really // residents @@ -1329,7 +1329,7 @@ void LLIMSpeakerMgr::updateSpeakers(const LLSD& update) { speakerp->mStatus = LLSpeaker::STATUS_NOT_IN_CHANNEL; speakerp->mDotColor = INACTIVE_COLOR; - speakerp->mActivityTimer.resetWithExpiry(SPEAKER_TIMEOUT); + speakerp->mActivityTimer.reset(SPEAKER_TIMEOUT); } else if (agent_data["transition"].asString() == "ENTER") { @@ -1377,7 +1377,7 @@ void LLIMSpeakerMgr::updateSpeakers(const LLSD& update) { speakerp->mStatus = LLSpeaker::STATUS_NOT_IN_CHANNEL; speakerp->mDotColor = INACTIVE_COLOR; - speakerp->mActivityTimer.resetWithExpiry(SPEAKER_TIMEOUT); + speakerp->mActivityTimer.reset(SPEAKER_TIMEOUT); } else if ( agent_transition == "ENTER") { @@ -1476,7 +1476,7 @@ void LLLocalSpeakerMgr::updateSpeakerList() { speakerp->mStatus = LLSpeaker::STATUS_NOT_IN_CHANNEL; speakerp->mDotColor = INACTIVE_COLOR; - speakerp->mActivityTimer.resetWithExpiry(SPEAKER_TIMEOUT); + speakerp->mActivityTimer.reset(SPEAKER_TIMEOUT); } } } diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index a60490da9..ad44c0bbd 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -228,7 +228,6 @@ LLSnapshotLivePreview::LLSnapshotLivePreview (const LLRect& rect) : mSnapshotBufferType(LLViewerWindow::SNAPSHOT_TYPE_COLOR) { setSnapshotQuality(gSavedSettings.getS32("SnapshotQuality")); - mSnapshotDelayTimer.setTimerExpirySec(0.0f); mSnapshotDelayTimer.start(); // gIdleCallbacks.addFunction( &LLSnapshotLivePreview::onIdle, (void*)this ); sList.insert(this); @@ -349,8 +348,7 @@ void LLSnapshotLivePreview::updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail mShineAnimTimer.stop(); if (new_snapshot) { - mSnapshotDelayTimer.start(); - mSnapshotDelayTimer.setTimerExpirySec(delay); + mSnapshotDelayTimer.start(delay); } if(new_thumbnail) { @@ -753,7 +751,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) // see if it's time yet to snap the shot and bomb out otherwise. previewp->mSnapshotActive = - (previewp->mSnapshotDelayTimer.getStarted() && previewp->mSnapshotDelayTimer.hasExpired()) + (previewp->mSnapshotDelayTimer.getStarted() && previewp->mSnapshotDelayTimer.hasExpired()) && !LLToolCamera::getInstance()->hasMouseCapture(); // don't take snapshots while ALT-zoom active if ( ! previewp->mSnapshotActive) { diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index 716573d12..3ad43d037 100644 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -502,17 +502,26 @@ void LLFloaterWorldMap::draw() getDragHandle()->setMouseOpaque(TRUE); //RN: snaps to zoom value because interpolation caused jitter in the text rendering - if (!mZoomTimer.getStarted() && mCurZoomVal != (F32)childGetValue("zoom slider").asReal()) + F32 interp = 1.f; + if (!mZoomTimer.getStarted()) { - mZoomTimer.start(); + mCurZoomValInterpolationStart = mCurZoomVal; + if (mCurZoomVal < (F32)childGetValue("zoom slider").asReal()) + { + mZoomTimer.start(); + } } - F32 interp = mZoomTimer.getElapsedTimeF32() / MAP_ZOOM_TIME; - if (interp > 1.f) + if (mZoomTimer.getStarted()) + { + interp = mZoomTimer.getElapsedTimeF32() / MAP_ZOOM_TIME; + } + if (interp >= 1.f) { interp = 1.f; mZoomTimer.stop(); } - mCurZoomVal = lerp(mCurZoomVal, (F32)childGetValue("zoom slider").asReal(), interp); + // Interpolate between mCurZoomValInterpolationStart and "zoom slider". + mCurZoomVal = lerp(mCurZoomValInterpolationStart, (F32)childGetValue("zoom slider").asReal(), interp); F32 map_scale = 256.f*pow(2.f, mCurZoomVal); LLWorldMapView::setScale( map_scale ); diff --git a/indra/newview/llfloaterworldmap.h b/indra/newview/llfloaterworldmap.h index 5c8c976d6..03baa3eef 100644 --- a/indra/newview/llfloaterworldmap.h +++ b/indra/newview/llfloaterworldmap.h @@ -164,6 +164,7 @@ protected: // Sets sMapScale, in pixels per region F32 mCurZoomVal; + F32 mCurZoomValInterpolationStart; // Used during mZoomTimer interpolation. LLFrameTimer mZoomTimer; LLDynamicArray mLandmarkAssetIDList; diff --git a/indra/newview/llpanelmediahud.cpp b/indra/newview/llpanelmediahud.cpp index 4b33ae6f2..b77ba15cb 100644 --- a/indra/newview/llpanelmediahud.cpp +++ b/indra/newview/llpanelmediahud.cpp @@ -396,9 +396,8 @@ void LLPanelMediaHUD::updateShape() } } // If we need to start fading the UI (and we have not already started) - else if(! mFadeTimer.getStarted()) + else if (!mFadeTimer.getStarted()) { - mFadeTimer.reset(); mFadeTimer.start(); } } diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index e23e662ec..55a5ef6b0 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -446,8 +446,7 @@ void LLPreviewTexture::onFileLoadedForSave(BOOL success, } else { - self->mSavedFileTimer.reset(); - self->mSavedFileTimer.setTimerExpirySec( SECONDS_TO_SHOW_FILE_SAVED_MSG ); + self->mSavedFileTimer.reset(SECONDS_TO_SHOW_FILE_SAVED_MSG); } self->mSaveFileName.clear(); diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index 50c8940a2..240d122f3 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -683,8 +683,7 @@ void LLStatusBar::setBalance(S32 balance) if( balance != mBalance ) { - mBalanceTimer->reset(); - mBalanceTimer->setTimerExpirySec( ICON_TIMER_EXPIRY ); + mBalanceTimer->reset(ICON_TIMER_EXPIRY); mBalance = balance; } } @@ -728,8 +727,7 @@ void LLStatusBar::setHealth(S32 health) } } - mHealthTimer->reset(); - mHealthTimer->setTimerExpirySec( ICON_TIMER_EXPIRY ); + mHealthTimer->reset(ICON_TIMER_EXPIRY); } mHealth = health; diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 6bb8be13f..4e4d56df1 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -390,7 +390,7 @@ LLViewerInventoryCategory::LLViewerInventoryCategory(const LLUUID& uuid, mVersion(LLViewerInventoryCategory::VERSION_UNKNOWN), mDescendentCount(LLViewerInventoryCategory::DESCENDENT_COUNT_UNKNOWN) { - mDescendentsRequested.reset(); + mDescendentsRequested.stop(); } LLViewerInventoryCategory::LLViewerInventoryCategory(const LLUUID& owner_id) : @@ -398,7 +398,7 @@ LLViewerInventoryCategory::LLViewerInventoryCategory(const LLUUID& owner_id) : mVersion(LLViewerInventoryCategory::VERSION_UNKNOWN), mDescendentCount(LLViewerInventoryCategory::DESCENDENT_COUNT_UNKNOWN) { - mDescendentsRequested.reset(); + mDescendentsRequested.stop(); } LLViewerInventoryCategory::LLViewerInventoryCategory(const LLViewerInventoryCategory* other) @@ -489,12 +489,12 @@ bool LLViewerInventoryCategory::fetchDescendents() // if((mUUID == gSystemFolderRoot) || (gInventory.isObjectDescendentOf(mUUID, gSystemFolderRoot))) return false; // - if((VERSION_UNKNOWN == mVersion) - && mDescendentsRequested.hasExpired()) //Expired check prevents multiple downloads. + if (VERSION_UNKNOWN == mVersion && + (!mDescendentsRequested.getStarted() || + mDescendentsRequested.hasExpired())) // Expired check prevents multiple downloads. { const F32 FETCH_TIMER_EXPIRY = 10.0f; - mDescendentsRequested.reset(); - mDescendentsRequested.setTimerExpirySec(FETCH_TIMER_EXPIRY); + mDescendentsRequested.start(FETCH_TIMER_EXPIRY); // bitfield // 1 = by date diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index f219fe860..a36f5db00 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3817,7 +3817,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) } //idle text std::string idle_string; - if(!mIsSelf && mIdleTimer.getElapsedTimeF32() > 120 && gSavedSettings.getBOOL("AscentShowIdleTime")) + if(!mIsSelf && mIdleTimer.getElapsedTimeF32() > 120.f && gSavedSettings.getBOOL("AscentShowIdleTime")) { idle_string = getIdleTime(); } From a9028b5c1772057c96ddbb3acfd89b0a65ad6ab3 Mon Sep 17 00:00:00 2001 From: Player Dagostino Date: Tue, 2 Aug 2011 19:47:33 +0200 Subject: [PATCH 04/61] Add some missing clothing entries to the viewer and pie menus --- .../skins/default/xui/en-us/menu_pie_self.xml | 5 +++++ .../skins/default/xui/en-us/menu_viewer.xml | 22 +++++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/indra/newview/skins/default/xui/en-us/menu_pie_self.xml b/indra/newview/skins/default/xui/en-us/menu_pie_self.xml index ee6c1bd8a..9ae376800 100644 --- a/indra/newview/skins/default/xui/en-us/menu_pie_self.xml +++ b/indra/newview/skins/default/xui/en-us/menu_pie_self.xml @@ -54,6 +54,11 @@ + + + + diff --git a/indra/newview/skins/default/xui/en-us/menu_viewer.xml b/indra/newview/skins/default/xui/en-us/menu_viewer.xml index 4a49daede..04a5fd94f 100644 --- a/indra/newview/skins/default/xui/en-us/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en-us/menu_viewer.xml @@ -196,11 +196,25 @@ - + + + + + + + + + - - - + + + + From 9ec40dbcac49ec276fa382ea943a16e3142c6e62 Mon Sep 17 00:00:00 2001 From: Player Dagostino Date: Tue, 2 Aug 2011 19:53:03 +0200 Subject: [PATCH 05/61] Slight modification of the wrapper to let qt find its optional plugins in the pathname --- indra/newview/linux_tools/wrapper.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/indra/newview/linux_tools/wrapper.sh b/indra/newview/linux_tools/wrapper.sh index 34cb59877..64f14a7c8 100755 --- a/indra/newview/linux_tools/wrapper.sh +++ b/indra/newview/linux_tools/wrapper.sh @@ -116,10 +116,13 @@ fi export VIEWER_BINARY='singularity-do-not-run-directly' BINARY_TYPE=$(expr match "$(file -b bin/$VIEWER_BINARY)" '\(.*executable\)') +QPP=qt4/plugins/imageformats/ if [ "${BINARY_TYPE}" == "ELF 64-bit LSB executable" ]; then - export SL_ENV='LD_LIBRARY_PATH="`pwd`"/lib64:"`pwd`"/lib32:"${LD_LIBRARY_PATH}"' + QTPLUGINS=/usr/lib64/$QPP:/lib64/$QPP:/usr/local/lib64/$QPP + export SL_ENV='LD_LIBRARY_PATH="`pwd`"/lib64:"`pwd`"/lib32:$QTPLUGINS:"${LD_LIBRARY_PATH}"' else - export SL_ENV='LD_LIBRARY_PATH="`pwd`"/lib:"${LD_LIBRARY_PATH}"' + QTPLUGINS=/usr/lib/$QPP:/lib/$QPP:/usr/local/lib/$QPP + export SL_ENV='LD_LIBRARY_PATH="`pwd`"/lib:$QTPLUGINS:"${LD_LIBRARY_PATH}"' fi export SL_CMD='$LL_WRAPPER bin/$VIEWER_BINARY' From 4b98d69c2fad0095475861ff2eb5c53bdbd9f004 Mon Sep 17 00:00:00 2001 From: Player Dagostino Date: Tue, 2 Aug 2011 19:55:25 +0200 Subject: [PATCH 06/61] Fix the mouse flickering problem inherited by Ascent --- indra/newview/lltoolpie.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index e26e039e4..9fd7f75c8 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -659,8 +659,6 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask) */ - gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW); - LLViewerObject *object = NULL; LLViewerObject *parent = NULL; // object = gViewerWindow->getHoverPick().getObject(); From 5009b0544e9915dd33ac467019945cc7f201b229 Mon Sep 17 00:00:00 2001 From: Player Dagostino Date: Tue, 2 Aug 2011 19:58:47 +0200 Subject: [PATCH 07/61] Adaptation of the CoolViewer patch that allows Linux users to paste by middle-clicking. --- indra/llui/lltexteditor.cpp | 6 + indra/llwindow/CMakeLists.txt | 1 + indra/llwindow/llmousehandler.h | 21 +- indra/llwindow/llwindowsdl.cpp | 59 ++++ indra/llwindow/llwindowsdl.h | 6 + indra/newview/lltool.cpp | 14 + indra/newview/lltool.h | 3 + indra/newview/llviewerwindow.cpp | 483 ++++++++----------------------- indra/newview/llviewerwindow.h | 7 +- 9 files changed, 230 insertions(+), 370 deletions(-) diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 3326524cb..42b8972c8 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -2418,6 +2418,12 @@ BOOL LLTextEditor::handleEditKey(const KEY key, const MASK mask) } } + if( handled ) + { + // take selection to 'primary' clipboard + updatePrimary(); + } + return handled; } diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt index 710789fc4..e73b97a99 100644 --- a/indra/llwindow/CMakeLists.txt +++ b/indra/llwindow/CMakeLists.txt @@ -45,6 +45,7 @@ set(llwindows_HEADER_FILES set(viewer_SOURCE_FILES llwindow.cpp + llmousehandler.cpp ) set(viewer_HEADER_FILES diff --git a/indra/llwindow/llmousehandler.h b/indra/llwindow/llmousehandler.h index f3a2edd8a..7bd0f2eeb 100644 --- a/indra/llwindow/llmousehandler.h +++ b/indra/llwindow/llmousehandler.h @@ -33,9 +33,10 @@ #ifndef LL_MOUSEHANDLER_H #define LL_MOUSEHANDLER_H -#include "llstring.h" +#include "linden_common.h" +#include "llrect.h" -// Abstract interface. +// Mostly-abstract interface. // Intended for use via multiple inheritance. // A class may have as many interfaces as it likes, but never needs to inherit one more than once. @@ -49,13 +50,23 @@ public: SHOW_IF_NOT_BLOCKED, SHOW_ALWAYS, } EShowToolTip; + typedef enum { + CLICK_LEFT, + CLICK_MIDDLE, + CLICK_RIGHT, + CLICK_DOUBLELEFT + } EClickType; + virtual BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType clicktype, BOOL down); virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) = 0; virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) = 0; - virtual BOOL handleHover(S32 x, S32 y, MASK mask) = 0; - virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) = 0; - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) = 0; + virtual BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask) = 0; + virtual BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask) = 0; virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) = 0; virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask) = 0; + virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) = 0; + + virtual BOOL handleHover(S32 x, S32 y, MASK mask) = 0; + virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) = 0; virtual BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) = 0; virtual EShowToolTip getShowToolTip() { return SHOW_IF_NOT_BLOCKED; }; virtual const std::string& getName() const = 0; diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index 94177e6d5..2c58592fc 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -1282,6 +1282,49 @@ BOOL LLWindowSDL::copyTextToClipboard(const LLWString &text) return FALSE; // failure } + +BOOL LLWindowSDL::isPrimaryTextAvailable() +{ + if (ll_try_gtk_init()) + { + GtkClipboard * const clipboard = + gtk_clipboard_get(GDK_SELECTION_PRIMARY); + return gtk_clipboard_wait_is_text_available(clipboard) ? + TRUE : FALSE; + } + return FALSE; // failure +} + +BOOL LLWindowSDL::pasteTextFromPrimary(LLWString &text) +{ + if (ll_try_gtk_init()) + { + GtkClipboard * const clipboard = + gtk_clipboard_get(GDK_SELECTION_PRIMARY); + gchar * const data = gtk_clipboard_wait_for_text(clipboard); + if (data) + { + text = LLWString(utf8str_to_wstring(data)); + g_free(data); + return TRUE; + } + } + return FALSE; // failure +} + +BOOL LLWindowSDL::copyTextToPrimary(const LLWString &text) +{ + if (ll_try_gtk_init()) + { + const std::string utf8 = wstring_to_utf8str(text); + GtkClipboard * const clipboard = + gtk_clipboard_get(GDK_SELECTION_PRIMARY); + gtk_clipboard_set_text(clipboard, utf8.c_str(), utf8.length()); + return TRUE; + } + return FALSE; // failure +} + #else BOOL LLWindowSDL::isClipboardTextAvailable() @@ -1298,6 +1341,22 @@ BOOL LLWindowSDL::copyTextToClipboard(const LLWString &s) { return FALSE; // unsupported } + +BOOL LLWindowSDL::isPrimaryTextAvailable() +{ + return FALSE; // unsupported +} + +BOOL LLWindowSDL::pasteTextFromPrimary(LLWString &dst) +{ + return FALSE; // unsupported +} + +BOOL LLWindowSDL::copyTextToPrimary(const LLWString &s) +{ + return FALSE; // unsupported +} + #endif // LL_GTK LLWindow::LLWindowResolution* LLWindowSDL::getSupportedResolutions(S32 &num_resolutions) diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h index 2363c510d..bf346d868 100644 --- a/indra/llwindow/llwindowsdl.h +++ b/indra/llwindow/llwindowsdl.h @@ -80,9 +80,15 @@ public: /*virtual*/ void captureMouse(); /*virtual*/ void releaseMouse(); /*virtual*/ void setMouseClipping( BOOL b ); + /*virtual*/ BOOL isClipboardTextAvailable(); /*virtual*/ BOOL pasteTextFromClipboard(LLWString &dst); /*virtual*/ BOOL copyTextToClipboard(const LLWString & src); + + /*virtual*/ BOOL isPrimaryTextAvailable(); + /*virtual*/ BOOL pasteTextFromPrimary(LLWString &dst); + /*virtual*/ BOOL copyTextToPrimary(const LLWString & src); + /*virtual*/ void flashIcon(F32 seconds); /*virtual*/ F32 getGamma(); /*virtual*/ BOOL setGamma(const F32 gamma); // Set the gamma diff --git a/indra/newview/lltool.cpp b/indra/newview/lltool.cpp index da9f3c5bd..b1fad8627 100644 --- a/indra/newview/lltool.cpp +++ b/indra/newview/lltool.cpp @@ -126,6 +126,20 @@ BOOL LLTool::handleRightMouseUp(S32 x, S32 y, MASK mask) return FALSE; } +BOOL LLTool::handleMiddleMouseDown(S32 x,S32 y,MASK mask) +{ + // by default, didn't handle it + // llinfos << "LLTool::handleMiddleMouseDown" << llendl; + return FALSE; +} + +BOOL LLTool::handleMiddleMouseUp(S32 x, S32 y, MASK mask) +{ + // by default, didn't handle it + // llinfos << "LLTool::handleMiddleMouseUp" << llendl; + return FALSE; +} + BOOL LLTool::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) { // by default, didn't handle it diff --git a/indra/newview/lltool.h b/indra/newview/lltool.h index 249088fd3..f954a8c24 100644 --- a/indra/newview/lltool.h +++ b/indra/newview/lltool.h @@ -57,6 +57,9 @@ public: // Virtual functions inherited from LLMouseHandler virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); + virtual BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask); + virtual BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask); + virtual BOOL handleHover(S32 x, S32 y, MASK mask); virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 96c88bbbb..f35d448c7 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -601,47 +601,84 @@ bool LLViewerWindow::shouldShowToolTipFor(LLMouseHandler *mh) return false; } -BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask) +BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down) { + std::string buttonname; + std::string buttonstatestr; + BOOL handled = FALSE; S32 x = pos.mX; S32 y = pos.mY; x = llround((F32)x / mDisplayScale.mV[VX]); y = llround((F32)y / mDisplayScale.mV[VY]); - LLView::sMouseHandlerMessage.clear(); + if (down) + buttonstatestr = "down"; + else + buttonstatestr = "up"; - if (gDebugClicks) + switch (clicktype) { - llinfos << "ViewerWindow left mouse down at " << x << "," << y << llendl; + case LLMouseHandler::CLICK_LEFT: + mLeftMouseDown = down; + buttonname = "Left"; + break; + case LLMouseHandler::CLICK_RIGHT: + mRightMouseDown = down; + buttonname = "Right"; + break; + case LLMouseHandler::CLICK_MIDDLE: + mMiddleMouseDown = down; + buttonname = "Middle"; + break; + case LLMouseHandler::CLICK_DOUBLELEFT: + mLeftMouseDown = down; + buttonname = "Left Double Click"; + break; } + LLView::sMouseHandlerMessage.clear(); + if (gMenuBarView) { // stop ALT-key access to menu gMenuBarView->resetMenuTrigger(); } - mLeftMouseDown = TRUE; + if (gDebugClicks) + { + llinfos << "ViewerWindow " << buttonname << " mouse " << buttonstatestr << " at " << x << "," << y << llendl; + } // Make sure we get a coresponding mouseup event, even if the mouse leaves the window - mWindow->captureMouse(); + if (down) + { + mWindow->captureMouse(); + } + else + { + mWindow->releaseMouse(); + } // Indicate mouse was active gMouseIdleTimer.reset(); // Hide tooltips on mousedown - mToolTipBlocked = TRUE; + if (down) + { + mToolTipBlocked = TRUE; + mToolTip->setVisible(FALSE); + } - // Also hide hover info on mousedown + // Also hide hover info on mousedown/mouseup if (gHoverView) { gHoverView->cancelHover(); } // Don't let the user move the mouse out of the window until mouse up. - if( LLToolMgr::getInstance()->getCurrentTool()->clipMouseWhenDown() ) + if (LLToolMgr::getInstance()->getCurrentTool()->clipMouseWhenDown()) { - mWindow->setMouseClipping(TRUE); + mWindow->setMouseClipping(down); } LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); @@ -652,10 +689,9 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask mouse_captor->screenPointToLocal( x, y, &local_x, &local_y ); if (LLView::sDebugMouseHandling) { - llinfos << "Left Mouse Down handled by captor " << mouse_captor->getName() << llendl; + llinfos << buttonname << " Mouse " << buttonstatestr << " handled by captor " << mouse_captor->getName() << llendl; } - - return mouse_captor->handleMouseDown(local_x, local_y, mask); + return mouse_captor->handleAnyMouseClick(local_x, local_y, mask, clicktype, down); } // Topmost view gets a chance before the hierarchy @@ -664,216 +700,94 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask { S32 local_x, local_y; top_ctrl->screenPointToLocal( x, y, &local_x, &local_y ); - if (top_ctrl->pointInView(local_x, local_y)) + + if (down) { - return top_ctrl->handleMouseDown(local_x, local_y, mask); - } + if (top_ctrl->pointInView(local_x, local_y)) + { + return top_ctrl->handleAnyMouseClick(local_x, local_y, mask, clicktype, down) ; + } + else + { + gFocusMgr.setTopCtrl(NULL); + } + } else - { - gFocusMgr.setTopCtrl(NULL); - } + handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleMouseUp(local_x, local_y, mask); } // Give the UI views a chance to process the click - if( mRootView->handleMouseDown(x, y, mask) ) + if( mRootView->handleAnyMouseClick(x, y, mask, clicktype, down) ) { if (LLView::sDebugMouseHandling) { - llinfos << "Left Mouse Down" << LLView::sMouseHandlerMessage << llendl; + llinfos << buttonname << " Mouse " << buttonstatestr << " " << LLView::sMouseHandlerMessage << llendl; } return TRUE; } else if (LLView::sDebugMouseHandling) { - llinfos << "Left Mouse Down not handled by view" << llendl; + llinfos << buttonname << " Mouse " << buttonstatestr << " not handled by view" << llendl; } - // Do not allow tool manager to handle mouseclicks if we have disconnected - if (gDisconnected) + if (down) { - return FALSE; - } + // Do not allow tool manager to handle mouseclicks if we have disconnected + if (gDisconnected) + { + return FALSE; + } - if(LLToolMgr::getInstance()->getCurrentTool()->handleMouseDown( x, y, mask ) ) + if(LLToolMgr::getInstance()->getCurrentTool()->handleAnyMouseClick( x, y, mask, clicktype, down ) ) + { + // This is necessary to force clicks in the world to cause edit + // boxes that might have keyboard focus to relinquish it, and hence + // cause a commit to update their value. JC + gFocusMgr.setKeyboardFocus(NULL); + return TRUE; + } + } + else { - // This is necessary to force clicks in the world to cause edit - // boxes that might have keyboard focus to relinquish it, and hence - // cause a commit to update their value. JC - gFocusMgr.setKeyboardFocus(NULL); - return TRUE; + mWindow->releaseMouse(); + + LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); + if( !handled ) + { + handled = mRootView->handleAnyMouseClick(x, y, mask, clicktype, down); + } + + if( !handled ) + { + if (tool) + { + handled = tool->handleAnyMouseClick(x, y, mask, clicktype, down); + } + } } - return FALSE; + return (!down); +} + +BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask) +{ + BOOL down = TRUE; + return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_LEFT,down); } BOOL LLViewerWindow::handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK mask) { - S32 x = pos.mX; - S32 y = pos.mY; - x = llround((F32)x / mDisplayScale.mV[VX]); - y = llround((F32)y / mDisplayScale.mV[VY]); - - LLView::sMouseHandlerMessage.clear(); - - if (gDebugClicks) - { - llinfos << "ViewerWindow left mouse double-click at " << x << "," << y << llendl; - } - - mLeftMouseDown = TRUE; - - // Hide tooltips - if( mToolTip ) - { - mToolTip->setVisible( FALSE ); - } - - LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); - if( mouse_captor ) - { - S32 local_x; - S32 local_y; - mouse_captor->screenPointToLocal( x, y, &local_x, &local_y ); - if (LLView::sDebugMouseHandling) - { - llinfos << "Left Mouse Down handled by captor " << mouse_captor->getName() << llendl; - } - - return mouse_captor->handleDoubleClick(local_x, local_y, mask); - } - - // Check for hit on UI. - LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); - if (top_ctrl) - { - S32 local_x, local_y; - top_ctrl->screenPointToLocal( x, y, &local_x, &local_y ); - if (top_ctrl->pointInView(local_x, local_y)) - { - return top_ctrl->handleDoubleClick(local_x, local_y, mask); - } - else - { - gFocusMgr.setTopCtrl(NULL); - } - } - - if (mRootView->handleDoubleClick(x, y, mask)) - { - if (LLView::sDebugMouseHandling) - { - llinfos << "Left Mouse Down" << LLView::sMouseHandlerMessage << llendl; - } - return TRUE; - } - else if (LLView::sDebugMouseHandling) - { - llinfos << "Left Mouse Down not handled by view" << llendl; - } - - // Why is this here? JC 9/3/2002 - if (gNoRender) - { - return TRUE; - } - - if(LLToolMgr::getInstance()->getCurrentTool()->handleDoubleClick( x, y, mask ) ) - { - return TRUE; - } - - // if we got this far and nothing handled a double click, pass a normal mouse down - return handleMouseDown(window, pos, mask); + // try handling as a double-click first, then a single-click if that + // wasn't handled. + BOOL down = TRUE; + return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_DOUBLELEFT,down) || + handleMouseDown(window, pos, mask); } BOOL LLViewerWindow::handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) { - S32 x = pos.mX; - S32 y = pos.mY; - x = llround((F32)x / mDisplayScale.mV[VX]); - y = llround((F32)y / mDisplayScale.mV[VY]); - - LLView::sMouseHandlerMessage.clear(); - - if (gDebugClicks) - { - llinfos << "ViewerWindow left mouse up" << llendl; - } - - mLeftMouseDown = FALSE; - - // Indicate mouse was active - gMouseIdleTimer.reset(); - - // Hide tooltips on mouseup - if( mToolTip ) - { - mToolTip->setVisible( FALSE ); - } - - // Also hide hover info on mouseup - if (gHoverView) gHoverView->cancelHover(); - - BOOL handled = FALSE; - - mWindow->releaseMouse(); - - LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); - - if( tool->clipMouseWhenDown() ) - { - mWindow->setMouseClipping(FALSE); - } - - LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); - if( mouse_captor ) - { - S32 local_x; - S32 local_y; - mouse_captor->screenPointToLocal( x, y, &local_x, &local_y ); - if (LLView::sDebugMouseHandling) - { - llinfos << "Left Mouse Up handled by captor " << mouse_captor->getName() << llendl; - } - - return mouse_captor->handleMouseUp(local_x, local_y, mask); - } - - LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); - if (top_ctrl) - { - S32 local_x, local_y; - top_ctrl->screenPointToLocal( x, y, &local_x, &local_y ); - handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleMouseUp(local_x, local_y, mask); - } - - if( !handled ) - { - handled = mRootView->handleMouseUp(x, y, mask); - } - - if (LLView::sDebugMouseHandling) - { - if (handled) - { - llinfos << "Left Mouse Up" << LLView::sMouseHandlerMessage << llendl; - } - else - { - llinfos << "Left Mouse Up not handled by view" << llendl; - } - } - - if( !handled ) - { - if (tool) - { - handled = tool->handleMouseUp(x, y, mask); - } - } - - // Always handled as far as the OS is concerned. - return TRUE; + BOOL down = FALSE; + return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_LEFT,down); } @@ -886,89 +800,11 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK LLView::sMouseHandlerMessage.clear(); - if (gDebugClicks) - { - llinfos << "ViewerWindow right mouse down at " << x << "," << y << llendl; - } + BOOL down = TRUE; + BOOL handle = handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_RIGHT,down); + if (handle) + return handle; - if (gMenuBarView) - { - // stop ALT-key access to menu - gMenuBarView->resetMenuTrigger(); - } - - mRightMouseDown = TRUE; - - // Make sure we get a coresponding mouseup event, even if the mouse leaves the window - mWindow->captureMouse(); - - // Hide tooltips - if( mToolTip ) - { - mToolTip->setVisible( FALSE ); - } - - // Also hide hover info on mousedown - if (gHoverView) - { - gHoverView->cancelHover(); - } - - // Don't let the user move the mouse out of the window until mouse up. - if( LLToolMgr::getInstance()->getCurrentTool()->clipMouseWhenDown() ) - { - mWindow->setMouseClipping(TRUE); - } - - LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); - if( mouse_captor ) - { - S32 local_x; - S32 local_y; - mouse_captor->screenPointToLocal( x, y, &local_x, &local_y ); - if (LLView::sDebugMouseHandling) - { - llinfos << "Right Mouse Down handled by captor " << mouse_captor->getName() << llendl; - } - return mouse_captor->handleRightMouseDown(local_x, local_y, mask); - } - - LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); - if (top_ctrl) - { - S32 local_x, local_y; - top_ctrl->screenPointToLocal( x, y, &local_x, &local_y ); - if (top_ctrl->pointInView(local_x, local_y)) - { - return top_ctrl->handleRightMouseDown(local_x, local_y, mask); - } - else - { - gFocusMgr.setTopCtrl(NULL); - } - } - - if( mRootView->handleRightMouseDown(x, y, mask) ) - { - if (LLView::sDebugMouseHandling) - { - llinfos << "Right Mouse Down" << LLView::sMouseHandlerMessage << llendl; - } - return TRUE; - } - else if (LLView::sDebugMouseHandling) - { - llinfos << "Right Mouse Down not handled by view" << llendl; - } - - if(LLToolMgr::getInstance()->getCurrentTool()->handleRightMouseDown( x, y, mask ) ) - { - // This is necessary to force clicks in the world to cause edit - // boxes that might have keyboard focus to relinquish it, and hence - // cause a commit to update their value. JC - gFocusMgr.setKeyboardFocus(NULL); - return TRUE; - } // *HACK: this should be rolled into the composite tool logic, not // hardcoded at the top level. @@ -986,97 +822,15 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK BOOL LLViewerWindow::handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) { - S32 x = pos.mX; - S32 y = pos.mY; - x = llround((F32)x / mDisplayScale.mV[VX]); - y = llround((F32)y / mDisplayScale.mV[VY]); - - LLView::sMouseHandlerMessage.clear(); - - // Don't care about caps lock for mouse events. - if (gDebugClicks) - { - llinfos << "ViewerWindow right mouse up" << llendl; - } - - mRightMouseDown = FALSE; - - // Indicate mouse was active - gMouseIdleTimer.reset(); - - // Hide tooltips on mouseup - if( mToolTip ) - { - mToolTip->setVisible( FALSE ); - } - - // Also hide hover info on mouseup - if (gHoverView) gHoverView->cancelHover(); - - BOOL handled = FALSE; - - mWindow->releaseMouse(); - - LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); - - if( tool->clipMouseWhenDown() ) - { - mWindow->setMouseClipping(FALSE); - } - - LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); - if( mouse_captor ) - { - S32 local_x; - S32 local_y; - mouse_captor->screenPointToLocal( x, y, &local_x, &local_y ); - if (LLView::sDebugMouseHandling) - { - llinfos << "Right Mouse Up handled by captor " << mouse_captor->getName() << llendl; - } - return mouse_captor->handleRightMouseUp(local_x, local_y, mask); - } - - LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); - if (top_ctrl) - { - S32 local_x, local_y; - top_ctrl->screenPointToLocal( x, y, &local_x, &local_y ); - handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleRightMouseUp(local_x, local_y, mask); - } - - if( !handled ) - { - handled = mRootView->handleRightMouseUp(x, y, mask); - } - - if (LLView::sDebugMouseHandling) - { - if (handled) - { - llinfos << "Right Mouse Up" << LLView::sMouseHandlerMessage << llendl; - } - else - { - llinfos << "Right Mouse Up not handled by view" << llendl; - } - } - - if( !handled ) - { - if (tool) - { - handled = tool->handleRightMouseUp(x, y, mask); - } - } - - // Always handled as far as the OS is concerned. - return TRUE; + BOOL down = FALSE; + return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_RIGHT,down); } BOOL LLViewerWindow::handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask) { + BOOL down = TRUE; gVoiceClient->middleMouseState(true); + handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_MIDDLE,down); // Always handled as far as the OS is concerned. return TRUE; @@ -1084,7 +838,9 @@ BOOL LLViewerWindow::handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MAS BOOL LLViewerWindow::handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) { + BOOL down = FALSE; gVoiceClient->middleMouseState(false); + handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_MIDDLE,down); // Always handled as far as the OS is concerned. return TRUE; @@ -1463,6 +1219,7 @@ LLViewerWindow::LLViewerWindow( mWindowRect(0, height, width, 0), mVirtualWindowRect(0, height, width, 0), mLeftMouseDown(FALSE), + mMiddleMouseDown(FALSE), mRightMouseDown(FALSE), mToolTip(NULL), mToolTipBlocked(FALSE), diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index dec5a177c..773c0aa93 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -48,6 +48,7 @@ #include "lltimer.h" #include "llstat.h" #include "llalertdialog.h" +#include "llmousehandler.h" #include "llnotifications.h" class LLView; @@ -59,7 +60,6 @@ class LLVelocityBar; class LLTextBox; class LLImageRaw; class LLHUDIcon; -class LLMouseHandler; class AIFilePicker; #define PICK_HALF_WIDTH 5 @@ -84,7 +84,7 @@ public: static bool isFlora(LLViewerObject* object); - typedef enum e_pick_type + typedef enum { PICK_OBJECT, PICK_FLORA, @@ -154,6 +154,7 @@ public: /*virtual*/ BOOL handleTranslatedKeyUp(KEY key, MASK mask); /*virtual*/ void handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level); /*virtual*/ BOOL handleUnicodeChar(llwchar uni_char, MASK mask); // NOT going to handle extended + /*virtual*/ BOOL handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down); /*virtual*/ BOOL handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask); /*virtual*/ BOOL handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask); /*virtual*/ BOOL handleCloseRequest(LLWindow *window); @@ -216,6 +217,7 @@ public: LLCoordGL getCurrentMouseDelta() const { return mCurrentMouseDelta; } LLStat * getMouseVelocityStat() { return &mMouseVelocityStat; } BOOL getLeftMouseDown() const { return mLeftMouseDown; } + BOOL getMiddleMouseDown() const { return mMiddleMouseDown; } BOOL getRightMouseDown() const { return mRightMouseDown; } const LLPickInfo& getLastPick() const { return mLastPick; } @@ -392,6 +394,7 @@ protected: LLCoordGL mCurrentMouseDelta; //amount mouse moved this frame LLStat mMouseVelocityStat; BOOL mLeftMouseDown; + BOOL mMiddleMouseDown; BOOL mRightMouseDown; LLProgressView *mProgressView; From 3b168065d51d5288b54bb2135dfe4f9146e54050 Mon Sep 17 00:00:00 2001 From: Player Dagostino Date: Tue, 2 Aug 2011 20:01:20 +0200 Subject: [PATCH 08/61] Another port of a great patch from CoolViewer that lets users set the maximum number of actual visible avatars when impostors are on. --- indra/newview/llfloaterhardwaresettings.cpp | 53 +++++++++++++++---- indra/newview/llfloaterhardwaresettings.h | 12 ++--- indra/newview/llpaneldisplay.cpp | 16 ++++++ indra/newview/llpaneldisplay.h | 2 + indra/newview/llviewermenu.cpp | 4 -- .../xui/en-us/floater_hardware_settings.xml | 37 +++++++++++-- .../xui/en-us/panel_preferences_graphics1.xml | 19 ++++--- 7 files changed, 111 insertions(+), 32 deletions(-) diff --git a/indra/newview/llfloaterhardwaresettings.cpp b/indra/newview/llfloaterhardwaresettings.cpp index 23da0629b..30fa5a305 100644 --- a/indra/newview/llfloaterhardwaresettings.cpp +++ b/indra/newview/llfloaterhardwaresettings.cpp @@ -47,27 +47,25 @@ #include "pipeline.h" LLFloaterHardwareSettings* LLFloaterHardwareSettings::sHardwareSettings = NULL; +BOOL LLFloaterHardwareSettings::sUseStreamVBOexists = FALSE; LLFloaterHardwareSettings::LLFloaterHardwareSettings() : LLFloater(std::string("Hardware Settings Floater")) { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_hardware_settings.xml"); - - // load it up - initCallbacks(); } LLFloaterHardwareSettings::~LLFloaterHardwareSettings() { } -void LLFloaterHardwareSettings::onClickHelp(void* data) -{ - const char* xml_alert = "HardwareSettingsHelpButton"; - LLNotifications::instance().add(xml_alert); -} - -void LLFloaterHardwareSettings::initCallbacks(void) +void LLFloaterHardwareSettings::onCommitCheckBoxVBO(LLUICtrl* ctrl, void* user_data) { + LLFloaterHardwareSettings* self = (LLFloaterHardwareSettings*)user_data; + if (self && sUseStreamVBOexists) + { + gSavedSettings.setBOOL("RenderUseStreamVBO", self->childGetValue("stream_vbo").asBoolean()); + self->refreshEnabledState(); + } } // menu maintenance functions @@ -77,6 +75,10 @@ void LLFloaterHardwareSettings::refresh() LLPanel::refresh(); mUseVBO = gSavedSettings.getBOOL("RenderVBOEnable"); + if (sUseStreamVBOexists) + { + mUseStreamVBO = gSavedSettings.getBOOL("RenderUseStreamVBO"); + } mUseFBO = gSavedSettings.getBOOL("RenderUseFBO"); mUseAniso = gSavedSettings.getBOOL("RenderAnisotropic"); mFSAASamples = gSavedSettings.getU32("RenderFSAASamples"); @@ -96,6 +98,7 @@ void LLFloaterHardwareSettings::refreshEnabledState() childSetMinValue("GrapicsCardTextureMemory", min_tex_mem); childSetMaxValue("GrapicsCardTextureMemory", max_tex_mem); + bool vbo_ok = true; mLastVBOState = LLVertexBuffer::sEnableVBOs; if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderVBOEnable") || !gGLManager.mHasVertexBufferObject) @@ -103,6 +106,23 @@ void LLFloaterHardwareSettings::refreshEnabledState() childSetEnabled("vbo", FALSE); //Streaming VBOs -Shyotl childSetEnabled("vbo_stream", FALSE); + vbo_ok = false; + } + + if (sUseStreamVBOexists) + { + childSetVisible("stream_vbo", true); + childSetEnabled("stream_vbo", vbo_ok && childGetValue("vbo") && + LLFeatureManager::getInstance()->isFeatureAvailable("RenderUseStreamVBO")); + } + else + { + childSetVisible("stream_vbo", false); + } + + if (!LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion")) + { + childSetEnabled("occlusion", false); } else { @@ -115,7 +135,7 @@ void LLFloaterHardwareSettings::refreshEnabledState() childSetEnabled("gamma", !gPipeline.canUseWindLightShaders()); childSetEnabled("(brightness, lower is brighter)", !gPipeline.canUseWindLightShaders()); childSetEnabled("fog", !gPipeline.canUseWindLightShaders()); - + childSetVisible("note", gPipeline.canUseWindLightShaders()); } // static instance of it @@ -173,6 +193,13 @@ BOOL LLFloaterHardwareSettings::postBuild() { childSetAction("OK", onBtnOK, this); + sUseStreamVBOexists = gSavedSettings.controlExists("RenderUseStreamVBO"); + if (sUseStreamVBOexists) + { + childSetCommitCallback("vbo", onCommitCheckBoxVBO, this); + childSetCommitCallback("stream_vbo", onCommitCheckBoxVBO, this); + } + refresh(); return TRUE; @@ -202,6 +229,10 @@ void LLFloaterHardwareSettings::apply() void LLFloaterHardwareSettings::cancel() { gSavedSettings.setBOOL("RenderVBOEnable", mUseVBO); + if (sUseStreamVBOexists) + { + gSavedSettings.setBOOL("RenderUseStreamVBO", mUseStreamVBO); + } gSavedSettings.setBOOL("RenderUseFBO", mUseFBO); gSavedSettings.setBOOL("RenderAnisotropic", mUseAniso); gSavedSettings.setU32("RenderFSAASamples", mFSAASamples); diff --git a/indra/newview/llfloaterhardwaresettings.h b/indra/newview/llfloaterhardwaresettings.h index 0d78d67a2..804b26dd9 100644 --- a/indra/newview/llfloaterhardwaresettings.h +++ b/indra/newview/llfloaterhardwaresettings.h @@ -49,14 +49,11 @@ public: virtual BOOL postBuild(); - /// initialize all the callbacks for the menu - void initCallbacks(void); - /// one and one instance only static LLFloaterHardwareSettings* instance(); - /// callback for the menus help button - static void onClickHelp(void* data); + /// callback for the VBO-related settings checkboxes + static void onCommitCheckBoxVBO(LLUICtrl* ctrl, void* user_data); /// OK button static void onBtnOK( void* userdata ); @@ -87,11 +84,12 @@ public: /// refresh the enabled values void refreshEnabledState(); -protected: +private: LLSliderCtrl* mCtrlVideoCardMem; //Retained values for cancel/reset BOOL mUseVBO; + BOOL mUseStreamVBO; BOOL mUseFBO; BOOL mUseAniso; U32 mFSAASamples; @@ -101,9 +99,9 @@ protected: BOOL mProbeHardwareOnStartup; bool mLastVBOState; //track changes to LLVertexBuffer::sEnableVBOs every frame. Bleh. -private: // one instance on the inside static LLFloaterHardwareSettings* sHardwareSettings; + static BOOL sUseStreamVBOexists; }; #endif diff --git a/indra/newview/llpaneldisplay.cpp b/indra/newview/llpaneldisplay.cpp index c7aeabcce..b5b69bcfc 100644 --- a/indra/newview/llpaneldisplay.cpp +++ b/indra/newview/llpaneldisplay.cpp @@ -260,6 +260,9 @@ BOOL LLPanelDisplay::postBuild() // Avatar Render Mode mCtrlAvatarCloth = getChild("AvatarCloth"); mCtrlAvatarImpostors = getChild("AvatarImpostors"); + mCtrlAvatarImpostors->setCommitCallback(&LLPanelDisplay::onVertexShaderEnable); + mCtrlAvatarImpostors->setCallbackUserData(this); + mCtrlNonImpostors = getChild("AvatarMaxVisible"); //---------------------------------------------------------------------------- // radio set for lighting detail @@ -417,6 +420,7 @@ void LLPanelDisplay::refresh() // avatar settings mAvatarImpostors = gSavedSettings.getBOOL("RenderUseImpostors"); + mNonImpostors = gSavedSettings.getS32("RenderAvatarMaxVisible"); mAvatarCloth = gSavedSettings.getBOOL("RenderAvatarCloth"); // Draw distance @@ -514,6 +518,9 @@ void LLPanelDisplay::refreshEnabledState() //GI won't do anything with shadows off, but disabling it here is less than intuitive. Ignore shadow setting for now. mCtrlDeferredGI->setEnabled(mCtrlShadowDetail->getEnabled()/* && gSavedSettings.getS32("RenderShadowDetail") > 0*/); + // Disable max non-impostors slider if avatar impostors are off + mCtrlNonImpostors->setEnabled(gSavedSettings.getBOOL("RenderUseImpostors")); + // Vertex Shaders // mCtrlShaderEnable->setEnabled(LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable")); // [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.0a @@ -612,6 +619,7 @@ void LLPanelDisplay::disableUnavailableSettings() { mCtrlAvatarImpostors->setEnabled(FALSE); mCtrlAvatarImpostors->setValue(FALSE); + mCtrlNonImpostors->setEnabled(FALSE); } // disabled deferred if(!LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred")) @@ -654,6 +662,7 @@ void LLPanelDisplay::setHiddenGraphicsState(bool isHidden) llassert(mCtrlAvatarVP != NULL); llassert(mCtrlShaderEnable != NULL); llassert(mCtrlAvatarImpostors != NULL); + llassert(mCtrlNonImpostors != NULL); llassert(mCtrlAvatarCloth != NULL); llassert(mRadioLightingDetail2 != NULL); @@ -702,6 +711,7 @@ void LLPanelDisplay::setHiddenGraphicsState(bool isHidden) mCtrlAvatarVP->setVisible(!isHidden); mCtrlShaderEnable->setVisible(!isHidden); mCtrlAvatarImpostors->setVisible(!isHidden); + mCtrlNonImpostors->setVisible(!isHidden); mCtrlAvatarCloth->setVisible(!isHidden); mRadioLightingDetail2->setVisible(!isHidden); @@ -752,6 +762,7 @@ void LLPanelDisplay::cancel() gSavedSettings.setS32("RenderShadowDetail", mShadowDetail); gSavedSettings.setBOOL("RenderUseImpostors", mAvatarImpostors); + gSavedSettings.setS32("RenderAvatarMaxVisible", mNonImpostors); gSavedSettings.setBOOL("RenderAvatarCloth", mAvatarCloth); gSavedSettings.setBOOL("RenderLocalLights", mLocalLights); @@ -994,6 +1005,11 @@ void LLPanelDisplay::onVertexShaderEnable(LLUICtrl* self, void* data) void LLPanelDisplay::setHardwareDefaults(void* user_data) { LLFeatureManager::getInstance()->applyRecommendedSettings(); + LLControlVariable* controlp = gSavedSettings.getControl("RenderAvatarMaxVisible"); + if (controlp) + { + controlp->resetToDefault(true); + } LLFloaterPreference::refreshEnabledGraphics(); } diff --git a/indra/newview/llpaneldisplay.h b/indra/newview/llpaneldisplay.h index a36311390..5631a7ca9 100644 --- a/indra/newview/llpaneldisplay.h +++ b/indra/newview/llpaneldisplay.h @@ -106,6 +106,7 @@ protected: LLSliderCtrl *mCtrlSkyFactor; // LOD for terrain LLSliderCtrl *mCtrlMaxParticle; // Max Particle LLSliderCtrl *mCtrlPostProcess; // Max Particle + LLSliderCtrl *mCtrlNonImpostors; // Max non-impostors LLCheckBoxCtrl *mCtrlBumpShiny; LLCheckBoxCtrl *mCtrlWindLight; @@ -162,6 +163,7 @@ protected: S32 mShadowDetail; BOOL mAvatarImpostors; + S32 mNonImpostors; BOOL mAvatarCloth; S32 mAvatarMode; BOOL mLocalLights; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 90cff3cdc..572cbc741 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -1524,10 +1524,6 @@ void init_debug_rendering_menu(LLMenuGL* menu) 'R', MASK_CONTROL|MASK_SHIFT)); LLMenuItemCheckGL* item; - item = new LLMenuItemCheckGL("Object-Object Occlusion", menu_toggle_control, NULL, menu_check_control, (void*)"UseOcclusion", 'O', MASK_CONTROL|MASK_SHIFT); - item->setEnabled(gGLManager.mHasOcclusionQuery && LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion")); - menu->append(item); - item = new LLMenuItemCheckGL("Debug GL", menu_toggle_control, NULL, menu_check_control, (void*)"RenderDebugGL"); menu->append(item); diff --git a/indra/newview/skins/default/xui/en-us/floater_hardware_settings.xml b/indra/newview/skins/default/xui/en-us/floater_hardware_settings.xml index 21ba6b168..347c69a6b 100644 --- a/indra/newview/skins/default/xui/en-us/floater_hardware_settings.xml +++ b/indra/newview/skins/default/xui/en-us/floater_hardware_settings.xml @@ -1,7 +1,7 @@ - Enable VBO: + Vertex Buffer Object: + + + + + Occlusion: + + + + + Note: the Gamma and Fog Distance Ratio settings are unavailable (since useless) when the + Atmospheric Shaders are enabled. + +