49401: alt key shouldn't focus menubar unless ui.key.menuAccessKeyFocuses

(default true on windows, false elsewhere) is true.
  r=dean_tessman@hotmail.com
This commit is contained in:
akkana%netscape.com 2000-08-24 00:05:40 +00:00
Родитель 3a61c3367a
Коммит d813b07826
4 изменённых файлов: 8 добавлений и 3 удалений

Просмотреть файл

@ -62,7 +62,7 @@ NS_IMPL_QUERY_INTERFACE3(nsMenuBarListener, nsIDOMKeyListener, nsIDOMFocusListen
////////////////////////////////////////////////////////////////////////
nsMenuBarListener::nsMenuBarListener(nsMenuBarFrame* aMenuBar)
:mAccessKeyDown(PR_FALSE), mAccessKey(-1)
:mAccessKeyDown(PR_FALSE), mAccessKeyFocuses(PR_FALSE), mAccessKey(-1)
{
NS_INIT_REFCNT();
mMenuBarFrame = aMenuBar;
@ -92,6 +92,8 @@ void nsMenuBarListener::InitAccessKey()
if (NS_SUCCEEDED(rv) && prefs)
{
rv = prefs->GetIntPref("ui.key.menuAccessKey", &mAccessKey);
rv |= prefs->GetBoolPref("ui.key.menuAccessKeyFocuses",
&mAccessKeyFocuses);
}
#ifdef DEBUG_akkana
if (NS_FAILED(rv))
@ -107,7 +109,7 @@ nsMenuBarListener::KeyUp(nsIDOMEvent* aKeyEvent)
{
InitAccessKey();
if (mAccessKey)
if (mAccessKey && mAccessKeyFocuses)
{
// On a press of the ALT key by itself, we toggle the menu's
// active/inactive state.
@ -206,7 +208,7 @@ nsMenuBarListener::KeyDown(nsIDOMEvent* aKeyEvent)
mAccessKeyDown = PR_FALSE;
}
if (theChar == mAccessKey || access) {
if (theChar == (PRUint32)mAccessKey || access) {
// No other modifiers can be down.
// Especially CTRL. CTRL+ALT == AltGR, and
// we'll fuck up on non-US enhanced 102-key

Просмотреть файл

@ -68,6 +68,7 @@ protected:
nsMenuBarFrame* mMenuBarFrame; // The menu bar object.
PRBool mAccessKeyDown; // Whether or not the ALT key is currently down.
PRBool mAccessKeyFocuses; // Does the access key by itself focus the menubar?
PRInt32 mAccessKey; // See nsIDOMKeyEvent.h for sample values
};

Просмотреть файл

@ -427,6 +427,7 @@ pref("security.xpconnect.plugin.unrestricted", true);
// menu access key = alt, accelerator key = control.
pref("ui.key.acceleratorKey", 17);
pref("ui.key.menuAccessKey", 18);
pref("ui.key.menuAccessKeyFocuses", false);
// Middle-mouse handling
pref("middlemouse.paste", false);

Просмотреть файл

@ -34,6 +34,7 @@ pref("news.thread_columns_win", "");
pref("category.thread_columns_win", "");
pref("news.category_columns_win", "");
pref("ui.key.menuAccessKeyFocuses", true);
pref("font.name.serif.ar", "Times New Roman");
pref("font.name.sans-serif.ar", "Arial");