From d8eff3fa55ab531ba7d007584112e20691a33760 Mon Sep 17 00:00:00 2001 From: Mario GLiewe Date: Wed, 28 Jan 2015 04:01:49 +0100 Subject: [PATCH] fix: make mousewheel work for gpm --- lib/gpmclient.js | 4 ++-- lib/program.js | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/gpmclient.js b/lib/gpmclient.js index 43903e2..3c2a191 100644 --- a/lib/gpmclient.js +++ b/lib/gpmclient.js @@ -130,11 +130,11 @@ function GpmClient(options) { switch(evnt.type & 15) { case GPM_MOVE: if (evnt.dx || evnt.dy) self.emit('move', evnt.buttons, evnt.modifiers, evnt.x, evnt.y) - if (evnt.wdx || evnt.wdy) self.emit('mousewheel', evnt.buttons, evnt.modifiers, evnt.wdx, evnt.wdy) + if (evnt.wdx || evnt.wdy) self.emit('mousewheel', evnt.buttons, evnt.modifiers, evnt.x, evnt.y, evnt.wdx, evnt.wdy) break; case GPM_DRAG: if (evnt.dx || evnt.dy) self.emit('drag', evnt.buttons, evnt.modifiers, evnt.x, evnt.y) - if (evnt.wdx || evnt.wdy) self.emit('mousewheel', evnt.buttons, evnt.modifiers, evnt.wdx, evnt.wdy) + if (evnt.wdx || evnt.wdy) self.emit('mousewheel', evnt.buttons, evnt.modifiers, evnt.x, evnt.y, evnt.wdx, evnt.wdy) break; case GPM_DOWN: self.emit('btndown', evnt.buttons, evnt.modifiers, evnt.x, evnt.y) diff --git a/lib/program.js b/lib/program.js index 2960d89..1a4d9d6 100644 --- a/lib/program.js +++ b/lib/program.js @@ -679,13 +679,12 @@ Program.prototype.enableGpm = function() { self.emit('keypress', null, key); self.emit('mouse', key); }); - this.gpm.on('nousewheel', function(btn,modifier, dx, dy) { - x--, y--; + this.gpm.on('mousewheel', function(btn,modifier, x, y, dx, dy) { var key={ name: 'mouse', type: 'GPM', action: dy>0? 'wheelup':'wheeldown', button: self.gpm.ButtonName(btn), - raw: [btn,modifier, x, y], + raw: [btn,modifier, x, y, dx, dy], x: x, y: y, shift: self.gpm.hasShiftKey(modifier), meta: self.gpm.hasMetaKey(modifier),