From f899070482f34d48e29476cf157eb51f29c030d2 Mon Sep 17 00:00:00 2001 From: Joel Martin Date: Tue, 29 Mar 2011 15:44:03 -0500 Subject: [PATCH] IE9 fixes: mouse, doctype. Adobe Flash link. Fix mouse button mapping in IE9. All browsers have converged on a standard left=0, middle=1, right=2 ... all except IE that is. Add html5 doctype to tests. In vnc_perf test, use do_test instead of start for function name since start is a keyword in IE. In error about Flash give a link to Adobe's download page. --- include/canvas.js | 13 +++++++++++-- include/rfb.js | 2 +- tests/canvas.html | 1 + tests/input.html | 1 + tests/keyboard.html | 1 + tests/vnc_perf.html | 5 +++-- tests/vnc_playback.html | 1 + 7 files changed, 19 insertions(+), 5 deletions(-) diff --git a/include/canvas.js b/include/canvas.js index fdc89153..10e15da9 100644 --- a/include/canvas.js +++ b/include/canvas.js @@ -221,8 +221,17 @@ function onMouseButton(e, down) { } evt = (e ? e : window.event); pos = Util.getEventPosition(e, conf.target, conf.scale); - bmask = 1 << evt.button; - //Util.Debug('mouse ' + pos.x + "," + pos.y + " down: " + down + " bmask: " + bmask); + if (evt.which) { + /* everything except IE */ + bmask = 1 << evt.button; + } else { + /* IE including 9 */ + bmask = (evt.button & 0x1) + // Left + (evt.button & 0x2) * 2 + // Right + (evt.button & 0x4) / 2; // Middle + } + //Util.Debug("mouse " + pos.x + "," + pos.y + " down: " + down + + // " bmask: " + bmask + "(evt.button: " + evt.button + ")"); if (c_mouseButton) { c_mouseButton(pos.x, pos.y, down, bmask); } diff --git a/include/rfb.js b/include/rfb.js index 9fb58d95..84b94ab6 100644 --- a/include/rfb.js +++ b/include/rfb.js @@ -203,7 +203,7 @@ function constructor() { Util.Flash.version); if ((! Util.Flash) || (Util.Flash.version < 9)) { - updateState('fatal', "WebSockets or Adobe Flash is required"); + updateState('fatal', "WebSockets or Adobe Flash<\/a> is required"); } else if (document.location.href.substr(0, 7) === "file://") { updateState('fatal', "'file://' URL is incompatible with Adobe Flash"); diff --git a/tests/canvas.html b/tests/canvas.html index 67c51d1f..b66d214f 100644 --- a/tests/canvas.html +++ b/tests/canvas.html @@ -1,3 +1,4 @@ + Canvas Performance Test diff --git a/tests/input.html b/tests/input.html index 799073d3..36c4bf5c 100644 --- a/tests/input.html +++ b/tests/input.html @@ -1,3 +1,4 @@ + Input Test diff --git a/tests/keyboard.html b/tests/keyboard.html index 7a557aed..ac5ae888 100644 --- a/tests/keyboard.html +++ b/tests/keyboard.html @@ -1,3 +1,4 @@ + Input Test diff --git a/tests/vnc_perf.html b/tests/vnc_perf.html index a4428e5e..17857c10 100644 --- a/tests/vnc_perf.html +++ b/tests/vnc_perf.html @@ -1,3 +1,4 @@ + VNC Performance Benchmark @@ -8,7 +9,7 @@ Passes:     + onclick="do_test();" disabled> 

@@ -79,7 +80,7 @@ } } - function start() { + function do_test() { $D('startButton').value = "Running"; $D('startButton').disabled = true; diff --git a/tests/vnc_playback.html b/tests/vnc_playback.html index ae0e0bb0..9f122115 100644 --- a/tests/vnc_playback.html +++ b/tests/vnc_playback.html @@ -1,3 +1,4 @@ + VNC Playback