Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Commit 98b83d0

Browse files
committed
fix: Support OS/2 JVM mouse clicks with isMetaDown
1 parent 43d5e24 commit 98b83d0

1 file changed

Lines changed: 31 additions & 11 deletions

File tree

client/src/main/java/jagex2/client/GameShell.java

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -282,16 +282,30 @@ public final void mousePressed(@OriginalArg(0) MouseEvent e) {
282282
this.mouseClickX = x;
283283
this.mouseClickY = y;
284284

285-
if ((e.getModifiersEx() & MouseEvent.BUTTON3_DOWN_MASK) != 0) {
286-
this.mouseClickButton = 2;
287-
this.mouseButton = 2;
288-
} else if ((e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) != 0) {
289-
this.mouseClickButton = 1;
290-
this.mouseButton = 1;
291-
}
285+
try {
286+
if ((e.getModifiersEx() & MouseEvent.BUTTON3_DOWN_MASK) != 0) {
287+
this.mouseClickButton = 2;
288+
this.mouseButton = 2;
289+
} else if ((e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) != 0) {
290+
this.mouseClickButton = 1;
291+
this.mouseButton = 1;
292+
}
292293

293-
if (InputTracking.enabled) {
294-
InputTracking.mousePressed(x, y, (e.getModifiersEx() & MouseEvent.BUTTON3_DOWN_MASK) != 0 ? 1 : 0);
294+
if (InputTracking.enabled) {
295+
InputTracking.mousePressed(x, y, (e.getModifiersEx() & MouseEvent.BUTTON3_DOWN_MASK) != 0 ? 1 : 0);
296+
}
297+
} catch (NoSuchMethodError ex) {
298+
if (e.isMetaDown()) {
299+
this.mouseClickButton = 2;
300+
this.mouseButton = 2;
301+
} else {
302+
this.mouseClickButton = 1;
303+
this.mouseButton = 1;
304+
}
305+
306+
if (InputTracking.enabled) {
307+
InputTracking.mousePressed(x, y, e.isMetaDown() ? 1 : 0);
308+
}
295309
}
296310
}
297311

@@ -300,8 +314,14 @@ public final void mouseReleased(@OriginalArg(0) MouseEvent e) {
300314
this.idleCycles = 0;
301315
this.mouseButton = 0;
302316

303-
if (InputTracking.enabled) {
304-
InputTracking.mouseReleased((e.getModifiersEx() & MouseEvent.BUTTON3_DOWN_MASK) != 0 ? 1 : 0);
317+
try {
318+
if (InputTracking.enabled) {
319+
InputTracking.mouseReleased((e.getModifiersEx() & MouseEvent.BUTTON3_DOWN_MASK) != 0 ? 1 : 0);
320+
}
321+
} catch (NoSuchMethodError ex) {
322+
if (InputTracking.enabled) {
323+
InputTracking.mouseReleased(e.isMetaDown() ? 1 : 0);
324+
}
305325
}
306326
}
307327

0 commit comments

Comments
 (0)