diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp index 30bc743e72fbf31b5efb889dd4995beaeecea8e0..67ef98d7b3b1a49946adfc5081a977c4019717a9 100644 --- a/indra/llwindow/llwindow.cpp +++ b/indra/llwindow/llwindow.cpp @@ -137,6 +137,12 @@ BOOL LLWindow::canDelete() return TRUE; } +//virtual +void LLWindow::setTitle(const std::string title) +{ + // the action happens in the platform specific impl +} + // virtual void LLWindow::incBusyCount() { diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h index d4d5b769376d1e4ae70e9333c0ee86adfcadf992..41eb1d7ee5eb0e877ab2973a623807c67214ab78 100644 --- a/indra/llwindow/llwindow.h +++ b/indra/llwindow/llwindow.h @@ -86,6 +86,13 @@ class LLWindow : public LLInstanceTracker<LLWindow> virtual void showCursorFromMouseMove() = 0; virtual void hideCursorUntilMouseMove() = 0; + // Provide a way to set the Viewer window title after the + // windows has been created. The initial use case for this + // is described in SL-16102 (update window title with agent + // name, location etc. for non-interactive viewer) but it + // may also be useful in other cases. + virtual void setTitle(const std::string title); + // These two functions create a way to make a busy cursor instead // of an arrow when someone's busy doing something. Draw an // arrow/hour if busycount > 0. diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index b2b123f0da0764e297b46ac67d82bcac22ba9044..dc3e77cc57b33be90a31b2a490354ac35f4f6f6f 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -1811,6 +1811,13 @@ void LLWindowWin32::moveWindow( const LLCoordScreen& position, const LLCoordScre MoveWindow(mWindowHandle, position.mX, position.mY, size.mX, size.mY, TRUE); } +void LLWindowWin32::setTitle(const std::string title) +{ + // TODO: Do we need to use the wide string version of this call + // to support non-ascii usernames (and region names??) + SetWindowTextA(mWindowHandle, title.c_str()); +} + BOOL LLWindowWin32::setCursorPosition(const LLCoordWindow position) { mMousePositionModified = TRUE; diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index 0b3d14fb166917375c73deba7608f18bcbf7edf5..34dcb7f268c86ab97aca5545e5ebedd6c2ce207c 100644 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h @@ -58,7 +58,8 @@ class LLWindowWin32 : public LLWindow /*virtual*/ BOOL setSizeImpl(LLCoordScreen size); /*virtual*/ BOOL setSizeImpl(LLCoordWindow size); /*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL); - /*virtual*/ BOOL setCursorPosition(LLCoordWindow position); + /*virtual*/ void setTitle(const std::string title); + /*virtual*/ BOOL setCursorPosition(LLCoordWindow position); /*virtual*/ BOOL getCursorPosition(LLCoordWindow *position); /*virtual*/ void showCursor(); /*virtual*/ void hideCursor(); diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 6ff94e1afd7d8b41fffe402244ef67b22d2be63a..5987bc3ddf18947a3227dce2ce7d5d52fc9ef7b4 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -16666,6 +16666,17 @@ <key>Value</key> <integer>1</integer> </map> + <key>UpdateAppWindowTitleBar</key> + <map> + <key>Comment</key> + <string>Updates the application window title bar with brief information about user/location</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> </map> </llsd> diff --git a/indra/newview/llteleporthistory.cpp b/indra/newview/llteleporthistory.cpp index 3c3c1c96ef99a7c285101803a77820cb66280ad8..b872053d3f09d7c08df42bbb562670b9584d7807 100644 --- a/indra/newview/llteleporthistory.cpp +++ b/indra/newview/llteleporthistory.cpp @@ -39,6 +39,11 @@ #include "llviewerregion.h" #include "llworldmap.h" #include "llagentui.h" +#include "llwindow.h" +#include "llviewerwindow.h" +#include "llavatarname.h" +#include "llavatarnamecache.h" + ////////////////////////////////////////////////////////////////////////////// // LLTeleportHistoryItem @@ -174,6 +179,28 @@ void LLTeleportHistory::updateCurrentLocation(const LLVector3d& new_pos) if (!mGotInitialUpdate) mGotInitialUpdate = true; + // update Viewer window title with username and region name + // if we are in "non-interactive mode" (SL-15999) or the debug + // setting to allow it is enabled (may be useful in other situations) + if (gNonInteractive || gSavedSettings.getBOOL("UpdateAppWindowTitleBar")) + { + LLAvatarName av_name; + if (LLAvatarNameCache::get(gAgent.getID(), &av_name)) + { + if (gAgent.getRegion() && gViewerWindow && gViewerWindow->getWindow()) + { + std::string region = gAgent.getRegion()->getName(); + std::string username = av_name.getUserName(); + + // this first pass simply displays username and region name + // but could easily be extended to include other details like + // X/Y/Z location within a region etc. + std::string new_title = STRINGIZE(username << " @ " << region); + gViewerWindow->getWindow()->setTitle(new_title); + } + } + } + // Signal the interesting party that we've changed. onHistoryChanged(); }