Skip to content

Commit

Permalink
fix: Support OS/2 JVM mouse clicks with isMetaDown
Browse files Browse the repository at this point in the history
  • Loading branch information
Pazaz committed Jan 6, 2024
1 parent 43d5e24 commit 98b83d0
Showing 1 changed file with 31 additions and 11 deletions.
42 changes: 31 additions & 11 deletions client/src/main/java/jagex2/client/GameShell.java
Original file line number Diff line number Diff line change
Expand Up @@ -282,16 +282,30 @@ public final void mousePressed(@OriginalArg(0) MouseEvent e) {
this.mouseClickX = x;
this.mouseClickY = y;

if ((e.getModifiersEx() & MouseEvent.BUTTON3_DOWN_MASK) != 0) {
this.mouseClickButton = 2;
this.mouseButton = 2;
} else if ((e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) != 0) {
this.mouseClickButton = 1;
this.mouseButton = 1;
}
try {
if ((e.getModifiersEx() & MouseEvent.BUTTON3_DOWN_MASK) != 0) {
this.mouseClickButton = 2;
this.mouseButton = 2;
} else if ((e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) != 0) {
this.mouseClickButton = 1;
this.mouseButton = 1;
}

if (InputTracking.enabled) {
InputTracking.mousePressed(x, y, (e.getModifiersEx() & MouseEvent.BUTTON3_DOWN_MASK) != 0 ? 1 : 0);
if (InputTracking.enabled) {
InputTracking.mousePressed(x, y, (e.getModifiersEx() & MouseEvent.BUTTON3_DOWN_MASK) != 0 ? 1 : 0);
}
} catch (NoSuchMethodError ex) {
if (e.isMetaDown()) {
this.mouseClickButton = 2;
this.mouseButton = 2;
} else {
this.mouseClickButton = 1;
this.mouseButton = 1;
}

if (InputTracking.enabled) {
InputTracking.mousePressed(x, y, e.isMetaDown() ? 1 : 0);
}
}
}

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

if (InputTracking.enabled) {
InputTracking.mouseReleased((e.getModifiersEx() & MouseEvent.BUTTON3_DOWN_MASK) != 0 ? 1 : 0);
try {
if (InputTracking.enabled) {
InputTracking.mouseReleased((e.getModifiersEx() & MouseEvent.BUTTON3_DOWN_MASK) != 0 ? 1 : 0);
}
} catch (NoSuchMethodError ex) {
if (InputTracking.enabled) {
InputTracking.mouseReleased(e.isMetaDown() ? 1 : 0);
}
}
}

Expand Down

0 comments on commit 98b83d0

Please sign in to comment.