Use the unshifted charCode when the Shift key and other modifiers are down (for accesskey handling). b=351310 r=zeniko sr=pavlov

This commit is contained in:
mats.palmgren%bredband.net 2006-11-28 11:58:29 +00:00
parent 70f470fa7a
commit b0a2cbb089

View File

@ -2122,6 +2122,20 @@ nsWindow::OnKeyPressEvent(GtkWidget *aWidget, GdkEventKey *aEvent)
event.charCode >= GDK_A &&
event.charCode <= GDK_Z)
event.charCode = gdk_keyval_to_lower(event.charCode);
// Keep the characters unshifted for shortcuts and accesskeys and
// make sure that numbers are always passed as such (among others:
// bugs 50255 and 351310)
if (event.isShift && (event.charCode < GDK_0 || event.charCode > GDK_9)) {
GdkKeymapKey k = { aEvent->hardware_keycode, aEvent->group, 0 };
guint savedKeyval = aEvent->keyval;
aEvent->keyval = gdk_keymap_lookup_key(gdk_keymap_get_default(), &k);
PRUint32 unshiftedCharCode = nsConvertCharCodeToUnicode(aEvent);
if (unshiftedCharCode)
event.charCode = unshiftedCharCode;
else
aEvent->keyval = savedKeyval;
}
}
}