Skip to content

Commit 63f7b9a

Browse files
committed
always also send the relative pointer position
1 parent 74b036c commit 63f7b9a

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

html5/js/Client.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1753,8 +1753,8 @@ class XpraClient {
17531753
wid = win.wid;
17541754
// add relative coordinates:
17551755
const pos = jQuery(win.div).position();
1756-
coords.push(Math.round(mouse.x - pos.left));
1757-
coords.push(Math.round(mouse.y - pos.top));
1756+
coords.push(Math.round(mouse.x - pos.left - win.leftoffset));
1757+
coords.push(Math.round(mouse.y - pos.top - win.topoffset));
17581758
e.preventDefault();
17591759
}
17601760
// dont call set focus unless the focus has actually changed
@@ -1834,8 +1834,13 @@ class XpraClient {
18341834
const modifiers = this._keyb_get_modifiers(e);
18351835
const buttons = [];
18361836
let wid = 0;
1837+
const coords = [x, y];
18371838
if (win) {
18381839
wid = win.wid;
1840+
// add relative coordinates:
1841+
const pos = jQuery(win.div).position();
1842+
coords.push(Math.round(mouse.x - pos.left - win.leftoffset));
1843+
coords.push(Math.round(mouse.y - pos.top - win.topoffset));
18391844
}
18401845
const wheel = Utilities.normalizeWheel(e);
18411846
this.debug("mouse", "normalized wheel event:", wheel);
@@ -1854,12 +1859,12 @@ class XpraClient {
18541859
if (apx > 0) {
18551860
const button_x = px >= 0 ? 7 : 6;
18561861
const xdist = Math.round((px * 1000) / 120);
1857-
this.send([PACKET_TYPES.wheel_motion, wid, button_x, -xdist, [x, y], modifiers, buttons]);
1862+
this.send([PACKET_TYPES.wheel_motion, wid, button_x, -xdist, coords, modifiers, buttons]);
18581863
}
18591864
if (apy > 0) {
18601865
const button_y = py >= 0 ? 5 : 4;
18611866
const ydist = Math.round((py * 1000) / 120);
1862-
this.send([PACKET_TYPES.wheel_motion, wid, button_y, -ydist, [x, y], modifiers, buttons]);
1867+
this.send([PACKET_TYPES.wheel_motion, wid, button_y, -ydist, coords, modifiers, buttons]);
18631868
}
18641869
return;
18651870
}
@@ -1881,13 +1886,13 @@ class XpraClient {
18811886
const button_y = this.wheel_delta_y >= 0 ? 5 : 4;
18821887
while (wx >= 120) {
18831888
wx -= 120;
1884-
this.send([PACKET_TYPES.button_action, wid, button_x, true, [x, y], modifiers, buttons]);
1885-
this.send([PACKET_TYPES.button_action, wid, button_x, false, [x, y], modifiers, buttons]);
1889+
this.send([PACKET_TYPES.button_action, wid, button_x, true, coords, modifiers, buttons]);
1890+
this.send([PACKET_TYPES.button_action, wid, button_x, false, coords, modifiers, buttons]);
18861891
}
18871892
while (wy >= 120) {
18881893
wy -= 120;
1889-
this.send([PACKET_TYPES.button_action, wid, button_y, true, [x, y], modifiers, buttons]);
1890-
this.send([PACKET_TYPES.button_action, wid, button_y, false, [x, y], modifiers, buttons]);
1894+
this.send([PACKET_TYPES.button_action, wid, button_y, true, coords, modifiers, buttons]);
1895+
this.send([PACKET_TYPES.button_action, wid, button_y, false, coords, modifiers, buttons]);
18911896
}
18921897
//store left overs:
18931898
this.wheel_delta_x = this.wheel_delta_x >= 0 ? wx : -wx;

0 commit comments

Comments
 (0)