mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 21:47:59 +01:00
enable vimperator.events.toString() to return keysyms for mouse events
This commit is contained in:
@@ -317,6 +317,7 @@ function Events() //{{{
|
|||||||
|
|
||||||
var key = null;
|
var key = null;
|
||||||
var modifier = "";
|
var modifier = "";
|
||||||
|
|
||||||
if (event.ctrlKey)
|
if (event.ctrlKey)
|
||||||
modifier += "C-";
|
modifier += "C-";
|
||||||
if (event.altKey)
|
if (event.altKey)
|
||||||
@@ -324,6 +325,8 @@ function Events() //{{{
|
|||||||
if (event.metaKey)
|
if (event.metaKey)
|
||||||
modifier += "M-";
|
modifier += "M-";
|
||||||
|
|
||||||
|
if (event.type == "keypress")
|
||||||
|
{
|
||||||
if (event.charCode == 0)
|
if (event.charCode == 0)
|
||||||
{
|
{
|
||||||
if (event.shiftKey)
|
if (event.shiftKey)
|
||||||
@@ -356,8 +359,35 @@ function Events() //{{{
|
|||||||
if (key == null)
|
if (key == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (event.type == "click" || event.type == "dblclick")
|
||||||
|
{
|
||||||
|
if (event.shiftKey)
|
||||||
|
modifier += "S-";
|
||||||
|
if (event.type == "dblclick")
|
||||||
|
modifier += "2-";
|
||||||
|
// TODO: triple and quadruple click
|
||||||
|
|
||||||
|
switch (event.button)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
key = "LeftMouse"
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
key = "MiddleMouse"
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
key = "RightMouse"
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
// a key like F1 is always enclosed in < and >
|
// a key like F1 is always enclosed in < and >
|
||||||
return "<" + modifier + key + ">";
|
return "<" + modifier + key + ">";
|
||||||
|
|
||||||
} //}}}
|
} //}}}
|
||||||
|
|
||||||
this.isAcceptKey = function(key)
|
this.isAcceptKey = function(key)
|
||||||
|
|||||||
@@ -631,10 +631,6 @@ function CommandLine() //{{{
|
|||||||
|
|
||||||
var key = vimperator.events.toString(event);
|
var key = vimperator.events.toString(event);
|
||||||
|
|
||||||
// TODO: move to events.toString()
|
|
||||||
if (event.type == "click" && event.button == 0)
|
|
||||||
key = "<LeftMouse>"
|
|
||||||
|
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
case ":":
|
case ":":
|
||||||
@@ -680,6 +676,9 @@ function CommandLine() //{{{
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "<LeftMouse>":
|
case "<LeftMouse>":
|
||||||
|
case "<A-LeftMouse>":
|
||||||
|
case "<C-LeftMouse>":
|
||||||
|
case "<S-LeftMouse>":
|
||||||
if (/^(end|more(-help)?)-prompt$/.test(event.target.id))
|
if (/^(end|more(-help)?)-prompt$/.test(event.target.id))
|
||||||
; // fall through
|
; // fall through
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -94,8 +94,8 @@ the terms of any one of the MPL, the GPL or the LGPL.
|
|||||||
</listcols>
|
</listcols>
|
||||||
</listbox>
|
</listbox>
|
||||||
|
|
||||||
<iframe id="vimperator-multiline-output" src="about:blank" flex="1" height="10px" hidden="false" collapsed="true" onclick="vimperator.commandline.onMultilineOutputEvent(event)"/>
|
<iframe id="vimperator-multiline-output" src="about:blank" flex="1" height="10px" hidden="false" collapsed="true"
|
||||||
<!--onkeypress="vimperator.commandline.onMultilineOutputEvent(event)"/-->
|
onclick="vimperator.commandline.onMultilineOutputEvent(event)"/>
|
||||||
|
|
||||||
<hbox id="vimperator-commandline" flex="1" hidden="false">
|
<hbox id="vimperator-commandline" flex="1" hidden="false">
|
||||||
<label class="plain" id="vimperator-commandline-prompt" flex="0" crop="end" value="" collapsed="true"/>
|
<label class="plain" id="vimperator-commandline-prompt" flex="0" crop="end" value="" collapsed="true"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user