Bug 429510 Web apps cannot handle Ctrl+foo/Alt+foo key on keypress event, gtk2 part r=karl, sr=roc, a=beltzner

This commit is contained in:
masayuki%d-toybox.com 2008-05-06 04:11:52 +00:00
Родитель cc44c043d3
Коммит a11bd24dcd
1 изменённых файлов: 14 добавлений и 0 удалений

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

@ -2456,6 +2456,9 @@ nsWindow::OnKeyPressEvent(GtkWidget *aWidget, GdkEventKey *aEvent)
g_free(keys);
}
if (minGroup >= 0) {
PRUint32 unmodifiedCh =
event.isShift ? altCharCodes.mShiftedCharCode :
altCharCodes.mUnshiftedCharCode;
// unshifted charcode of found keyboard layout.
PRUint32 ch =
GetCharCodeFor(aEvent, baseState, minGroup);
@ -2470,6 +2473,17 @@ nsWindow::OnKeyPressEvent(GtkWidget *aWidget, GdkEventKey *aEvent)
altCharCodes.mShiftedCharCode) {
event.alternativeCharCodes.AppendElement(altCharCodes);
}
// If the charCode is not Latin, and the level is 0 or 1,
// we should replace the charCode to Latin char if Alt and
// Meta keys are not pressed. (Alt should be sent the
// localized char for accesskey like handling of Web
// Applications.)
ch = event.isShift ? altCharCodes.mShiftedCharCode :
altCharCodes.mUnshiftedCharCode;
if (ch && !(event.isAlt || event.isMeta) &&
event.charCode == unmodifiedCh) {
event.charCode = ch;
}
}
}
}