I have a gesture addon and the trigger to is the primary mouse button + wheel. Once the wheel is scrolled while the primary mouse button is held, all further mouse events are blocked. Until the primary mouse button is released.
However I need to cancel the current highlight in progress, the html5 drag in progress, the autoscroll in progress if any, and ideally any other events initiate by the mousedown. The way I currently do it is use nsIDOMWindowUtils
to send a mouseup
event (and tap into code to cancel autoscroll) but I dislike this method:
setTimeout(function () {
var cwin = Services.wm.getMostRecentWindow('navigator:browser').gBrowser.selectedBrowser.contentWindow;
var utils = cwin.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
utils.sendMouseEvent('mouseup', 1, 1, triggerButtonNumber, 1, 0);
console.error('done');
}, 4000)
I was wondering if anyone could brainstorm with me some other ideas please?
I have tried suppressing events with nsIDOMWindowUtils :: supressEventHandling but on unsupress the events continue from where they left off.
Basically what I’m trying to do is undo/cancel/preventDefault any events started by the “Down” of the first mouse button.