Skip to content

Commit

Permalink
Set stopContextMenu flag on mousedown (for Linux)
Browse files Browse the repository at this point in the history
(#2)
  • Loading branch information
Infocatcher committed Nov 18, 2017
1 parent a5e89ac commit 0007818
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions content.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,19 @@ function onMouseDown(e) {
flags.canceled = false;
resetFlags();

var delay = isLeft(e) ? prefs.longLeftClickTimeout : prefs.showContextMenuTimeout;
if(delay <= 0)
return;

var trg = e.originalTarget || e.target;
var it = getItem(trg);
_log("onMouseDown() -> getItem(): " + it);
if(!it)
return;

if(isRight(e)) // For Linux with "contextmenu" event right after "mousedown"
flags.stopContextMenu = true;

var delay = isLeft(e) ? prefs.longLeftClickTimeout : prefs.showContextMenuTimeout;
if(delay <= 0)
return;

moveHandlers(e);

clearTimeout(delayedTimer);
Expand Down Expand Up @@ -155,10 +158,11 @@ function onClick(e) {
var trg = e.originalTarget || e.target;
var it = getItem(trg);
_log("onClick() -> getItem(): " + it);
if(!it)
if(!it) {
flags.stopContextMenu = false;
return;
}
flags.executed = true;
flags.stopContextMenu = true;
openURIItem(e, trg, it, prefs.loadInBackgroundRight, prefs.loadInRight);
}
function onContextMenu(e) {
Expand Down

0 comments on commit 0007818

Please sign in to comment.