use native event routing for synthesized key events. b=432405 r/sr=roc a=dsicore

This commit is contained in:
joshmoz@gmail.com 2008-05-06 14:00:59 -07:00
Родитель a91fad2dbb
Коммит 6ab5787b83
2 изменённых файлов: 4 добавлений и 2 удалений

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

@ -1305,8 +1305,8 @@ void nsChildView::SynthesizeNativeKeyEvent(PRInt32 aNativeKeyboardLayout,
PRInt32 currentLayout = gOverrideKeyboardLayout; PRInt32 currentLayout = gOverrideKeyboardLayout;
gOverrideKeyboardLayout = aNativeKeyboardLayout; gOverrideKeyboardLayout = aNativeKeyboardLayout;
ChildView* view = static_cast<ChildView*>(mView); ChildView* view = static_cast<ChildView*>(mView);
[view keyDown:downEvent]; [NSApp sendEvent:downEvent];
[view keyUp:upEvent]; [NSApp sendEvent:upEvent];
// processKeyDownEvent and keyUp block exceptions so we're sure to // processKeyDownEvent and keyUp block exceptions so we're sure to
// reach here to restore gOverrideKeyboardLayout // reach here to restore gOverrideKeyboardLayout
gOverrideKeyboardLayout = currentLayout; gOverrideKeyboardLayout = currentLayout;

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

@ -39,6 +39,8 @@ function synthesizeNativeKey(aLayout, aKeyCode, aModifiers, aSystemChars,
if (!aWindow) if (!aWindow)
aWindow = window; aWindow = window;
document.getElementById("button").focus();
var utils = aWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor). var utils = aWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils); getInterface(Components.interfaces.nsIDOMWindowUtils);