57262: Support the "Stop" key on Sun keyboads.

61355: key bindings don't work when Caps Lock is on.
Fixes from Jay Yan, Jay.Yan@sun.com, r=akkana, sr=jag, a=asa
This commit is contained in:
akkana%netscape.com 2002-04-05 03:37:18 +00:00
Родитель 362f2ab1b1
Коммит 2f55f5c65e
1 изменённых файлов: 23 добавлений и 1 удалений

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

@ -245,6 +245,15 @@ int nsPlatformToDOMKeyCode(GdkEventKey *aGEK)
} }
// function keys // function keys
// See bug 57262, Sun's Stop key generates F11 keysym code, in order to
// make Stop key stops the page loading while not sabotaging F11 key in
// all platforms, this code catches F11 keysym, then changes it into ESCAPE,
// which stops the page loading on all platforms.
// Now, Stop key has the same function as ESC in Solaris
#if defined(SUNOS4) || defined(SOLARIS)
if (keysym == GDK_F11)
return NS_VK_ESCAPE;
#endif
if (keysym >= GDK_F1 && keysym <= GDK_F24) if (keysym >= GDK_F1 && keysym <= GDK_F24)
return keysym - GDK_F1 + NS_VK_F1; return keysym - GDK_F1 + NS_VK_F1;
@ -367,7 +376,20 @@ void InitKeyPressEvent(GdkEventKey *aGEK,
// the isShift flag alone (probably not a printable character) // the isShift flag alone (probably not a printable character)
// if none of the other modifier keys are pressed then we need to // if none of the other modifier keys are pressed then we need to
// clear isShift so the character can be inserted in the editor // clear isShift so the character can be inserted in the editor
if (!anEvent.isControl && !anEvent.isAlt && !anEvent.isMeta)
if ( anEvent.isControl || anEvent.isAlt || anEvent.isMeta ) {
// make Ctrl+uppercase functional as same as Ctrl+lowercase
// when Ctrl+uppercase(eg.Ctrl+C) is pressed,convert the charCode
// from uppercase to lowercase(eg.Ctrl+c),so do Alt and Meta Key
// It is hack code for bug 61355, there is same code snip for
// Windows platform in widget/src/windows/nsWindow.cpp: See bug 16486
// Note: if Shift is pressed at the same time, do not to_lower()
// Because Ctrl+Shift has different function with Ctrl
if ( !anEvent.isShift &&
anEvent.charCode >= GDK_A &&
anEvent.charCode <= GDK_Z )
anEvent.charCode = gdk_keyval_to_lower(anEvent.charCode);
} else
anEvent.isShift = PR_FALSE; anEvent.isShift = PR_FALSE;
} else { } else {
anEvent.keyCode = nsPlatformToDOMKeyCode(aGEK); anEvent.keyCode = nsPlatformToDOMKeyCode(aGEK);