mirror of
https://github.com/imprudence/imprudence.git
synced 2026-08-14 09:02:35 +00:00
Don't use the build window keyboard shortcuts when the UI has focus (except for the chatbar)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@@ -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; };
|
||||
|
||||
Reference in New Issue
Block a user