From 773b83eb8c3d1cd31b86eeaa37e60b415296c6b2 Mon Sep 17 00:00:00 2001 From: nathan Date: Fri, 23 Dec 2016 16:51:51 +0100 Subject: [PATCH] Fixed issues on MacOSX for right-click tray icon event --- src/dorkbox/systemTray/util/SystemTrayFixes.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dorkbox/systemTray/util/SystemTrayFixes.java b/src/dorkbox/systemTray/util/SystemTrayFixes.java index 29ed036..d53d536 100644 --- a/src/dorkbox/systemTray/util/SystemTrayFixes.java +++ b/src/dorkbox/systemTray/util/SystemTrayFixes.java @@ -241,6 +241,7 @@ class SystemTrayFixes { ClassPool pool = ClassPool.getDefault(); byte[] mouseEventBytes; + int mouseDelay = 75; try { CtClass trayClass = pool.get("sun.lwawt.macosx.CTrayIcon"); @@ -336,12 +337,11 @@ class SystemTrayFixes { "lastX = mouseX;" + "lastY = mouseY;" + - // the delay is necessary for this to work correctly (as is the mouseRelease) + // the delay is necessary for this to work correctly. Mouse release is not necessary. + // this simulates *just enough* of the default behavior so that right click behaves the same as left click. "int maskButton1 = java.awt.event.InputEvent.getMaskForButton(java.awt.event.MouseEvent.BUTTON1);" + "robot.mousePress(maskButton1);" + - "robot.delay(200);" + - "robot.mouseRelease(maskButton1);" + - "robot.delay(200);" + + "robot.delay(" + mouseDelay + ");" + "return;" + "}" +