diff --git a/indra/llui/llfocusmgr.cpp b/indra/llui/llfocusmgr.cpp index 7817fd0d5..e5242f7db 100644 --- a/indra/llui/llfocusmgr.cpp +++ b/indra/llui/llfocusmgr.cpp @@ -366,6 +366,20 @@ void LLFocusMgr::removeKeyboardFocusWithoutCallback( const LLFocusableElement* f } } +bool LLFocusMgr::keyboardFocusHasAccelerators() const +{ + LLView* focus_view = dynamic_cast(mKeyboardFocus); + while(focus_view) + { + if (focus_view->hasAccelerators()) + { + return true; + } + + focus_view = focus_view->getParent(); + } + return false; +} void LLFocusMgr::setMouseCapture( LLMouseHandler* new_captor ) { diff --git a/indra/llui/llfocusmgr.h b/indra/llui/llfocusmgr.h index 5f1466f5d..7e5e50dfb 100644 --- a/indra/llui/llfocusmgr.h +++ b/indra/llui/llfocusmgr.h @@ -121,6 +121,7 @@ public: void unlockFocus(); BOOL focusLocked() const { return mLockedView != NULL; } + bool keyboardFocusHasAccelerators() const; struct Impl; diff --git a/indra/llui/llview.h b/indra/llui/llview.h index b009bab41..cc7ce21eb 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -357,6 +357,11 @@ public: BOOL focusNextRoot(); BOOL focusPrevRoot(); + // Normally we want the app menus to get priority on accelerated keys + // However, sometimes we want to give specific views a first chance + // at handling them. (eg. the script editor) + virtual bool hasAccelerators() const { return false; } + virtual void deleteAllChildren(); virtual void setTentative(BOOL b); diff --git a/indra/newview/llpreviewnotecard.h b/indra/newview/llpreviewnotecard.h index 442673c0c..6ea6e1ba8 100644 --- a/indra/newview/llpreviewnotecard.h +++ b/indra/newview/llpreviewnotecard.h @@ -66,6 +66,7 @@ public: // llview virtual void draw(); + virtual bool hasAccelerators() const { return true; } virtual BOOL handleKeyHere(KEY key, MASK mask); virtual void setEnabled( BOOL enabled ); virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index ace3f9949..906708333 100644 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -128,6 +128,8 @@ public: static BOOL enableSelectAllMenu(void* userdata); static BOOL enableDeselectMenu(void* userdata); + virtual bool hasAccelerators() const { return true; } + private: static bool onHelpWebDialog(const LLSD& notification, const LLSD& response); static void onBtnHelp(void* userdata); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 03b3cd673..7ea6c9890 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2723,7 +2723,6 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) LLFocusableElement* keyboard_focus = gFocusMgr.getKeyboardFocus(); - /* // give menus a chance to handle modified (Ctrl, Alt) shortcut keys before current focus // as long as focus isn't locked if (mask & (MASK_CONTROL | MASK_ALT) && !gFocusMgr.focusLocked()) @@ -2736,13 +2735,14 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) return TRUE; } + /* Singu Note: This caused a bug where the menu ate keys before parents of keyboard_focus for some reason, breaking multifloaters usage of ctrl-w to close their selected child floater if ((gMenuBarView && gMenuBarView->handleAcceleratorKey(key, mask)) || (gLoginMenuBarView && gLoginMenuBarView->handleAcceleratorKey(key, mask))) { return TRUE; } + */ } - */ // give floaters first chance to handle TAB key // so frontmost floater gets focus diff --git a/indra/newview/skins/default/xui/en-us/floater_preview_notecard.xml b/indra/newview/skins/default/xui/en-us/floater_preview_notecard.xml index 5307864c6..90a0a592e 100644 --- a/indra/newview/skins/default/xui/en-us/floater_preview_notecard.xml +++ b/indra/newview/skins/default/xui/en-us/floater_preview_notecard.xml @@ -24,30 +24,18 @@ - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - + + - - - - - - - - - - - - + + + + + + + + + + + +