Use WheelEvent instead of MouseWheelEvent

MouseWheelEvent is deprecated and not working in Firefox.
This commit is contained in:
Pavel Grunt 2015-01-14 18:42:59 +01:00 committed by Jeremy White
parent 54ee82f004
commit 84171b2406
2 changed files with 3 additions and 3 deletions

View File

@ -691,7 +691,7 @@ SpiceDisplayConn.prototype.hook_events = function()
canvas.addEventListener('keyup', handle_keyup); canvas.addEventListener('keyup', handle_keyup);
canvas.addEventListener('mouseout', handle_mouseout); canvas.addEventListener('mouseout', handle_mouseout);
canvas.addEventListener('mouseover', handle_mouseover); canvas.addEventListener('mouseover', handle_mouseover);
canvas.addEventListener('mousewheel', handle_mousewheel); canvas.addEventListener('wheel', handle_mousewheel);
canvas.focus(); canvas.focus();
} }
} }
@ -709,7 +709,7 @@ SpiceDisplayConn.prototype.unhook_events = function()
canvas.removeEventListener('keyup', handle_keyup); canvas.removeEventListener('keyup', handle_keyup);
canvas.removeEventListener('mouseout', handle_mouseout); canvas.removeEventListener('mouseout', handle_mouseout);
canvas.removeEventListener('mouseover', handle_mouseover); canvas.removeEventListener('mouseover', handle_mouseover);
canvas.removeEventListener('mousewheel', handle_mousewheel); canvas.removeEventListener('wheel', handle_mousewheel);
} }
} }

View File

@ -141,7 +141,7 @@ function handle_mousewheel(e)
{ {
var press = new SpiceMsgcMousePress; var press = new SpiceMsgcMousePress;
var release = new SpiceMsgcMouseRelease; var release = new SpiceMsgcMouseRelease;
if (e.wheelDelta > 0) if (e.deltaY < 0)
press.button = release.button = SPICE_MOUSE_BUTTON_UP; press.button = release.button = SPICE_MOUSE_BUTTON_UP;
else else
press.button = release.button = SPICE_MOUSE_BUTTON_DOWN; press.button = release.button = SPICE_MOUSE_BUTTON_DOWN;