Don't use the build window keyboard shortcuts when the UI has focus (except for the chatbar)

This commit is contained in:
McCabe Maxsted
2011-03-15 17:12:51 -07:00
parent 5be2952cc3
commit a47ebd7864
3 changed files with 30 additions and 4 deletions
+17 -4
View File
@@ -34,6 +34,8 @@
#include "lltoolmgr.h"
#include "llchatbar.h"
#include "llfloatertools.h"
#include "lltool.h"
// tools and manipulators
#include "llmanipscale.h"
@@ -191,11 +193,22 @@ LLTool* LLToolMgr::getCurrentTool()
else
{
// due to window management weirdness we can get here with gToolNull
bool can_override = mBaseTool && (mBaseTool != gToolNull);
mOverrideTool = can_override ? mBaseTool->getOverrideTool(override_mask) : NULL;
// Don't use keyboard overrides when the edit window doesn't have focus. The chatbar is an unfortunate exception -- MC
if (gViewerWindow && gViewerWindow->getUIHasFocus()
&& gFloaterTools && !gFloaterTools->hasFocus()
&& gChatBar && !gChatBar->getVisible())
{
cur_tool = mBaseTool;
}
else
{
bool can_override = mBaseTool && (mBaseTool != gToolNull) ;
mOverrideTool = can_override ? mBaseTool->getOverrideTool(override_mask) : NULL;
// use keyboard-override tool if available otherwise drop back to base tool
cur_tool = mOverrideTool ? mOverrideTool : mBaseTool;
// use keyboard-override tool if available otherwise drop back to base tool
cur_tool = mOverrideTool ? mOverrideTool : mBaseTool;
}
}
LLTool* prev_tool = mSelectedTool;
+10
View File
@@ -5011,6 +5011,16 @@ LLRect LLViewerWindow::getChatConsoleRect()
return console_rect;
}
bool LLViewerWindow::getUIHasFocus()
{
return gFocusMgr.getKeyboardFocus() != NULL
|| LLMenuGL::getKeyboardMode()
|| (gMenuBarView && gMenuBarView->getHighlightedItem() && gMenuBarView->getHighlightedItem()->isActive())
|| gFocusMgr.childHasKeyboardFocus(mRootView);
}
//----------------------------------------------------------------------------
+3
View File
@@ -195,6 +195,9 @@ public:
S32 getWindowDisplayHeight() const;
S32 getWindowDisplayWidth() const;
// Returns true when the UI has focus, false when the 3D world does
bool getUIHasFocus();
// Window in scaled pixels (via UI scale), use this for
// UI elements checking size.
const LLRect& getVirtualWindowRect() const { return mVirtualWindowRect; };