mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 858454 - Deliver MozKeyboard key events from the event loop instead of synchronously (r=fabrice).
This commit is contained in:
parent
1d9fb84fc5
commit
c5ccedacf6
@ -14,6 +14,9 @@ Cu.import("resource://gre/modules/ObjectWrapper.jsm");
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
|
||||
"@mozilla.org/childprocessmessagemanager;1", "nsIMessageSender");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "tm",
|
||||
"@mozilla.org/thread-manager;1", "nsIThreadManager");
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// MozKeyboard
|
||||
// -----------------------------------------------------------------------
|
||||
@ -72,9 +75,19 @@ MozKeyboard.prototype = {
|
||||
|
||||
sendKey: function mozKeyboardSendKey(keyCode, charCode) {
|
||||
charCode = (charCode == undefined) ? keyCode : charCode;
|
||||
["keydown", "keypress", "keyup"].forEach((function sendKey(type) {
|
||||
this._utils.sendKeyEvent(type, keyCode, charCode, null);
|
||||
}).bind(this));
|
||||
|
||||
let mainThread = tm.mainThread;
|
||||
let utils = this._utils;
|
||||
|
||||
function send(type) {
|
||||
mainThread.dispatch(function() {
|
||||
utils.sendKeyEvent(type, keyCode, charCode, null);
|
||||
}, mainThread.DISPATCH_NORMAL);
|
||||
}
|
||||
|
||||
send("keydown");
|
||||
send("keypress");
|
||||
send("keyup");
|
||||
},
|
||||
|
||||
setSelectedOption: function mozKeyboardSetSelectedOption(index) {
|
||||
|
Loading…
Reference in New Issue
Block a user