From 963af8b78eebe4eeff9e180e6bb1204bc5a6cea7 Mon Sep 17 00:00:00 2001 From: mrbesen Date: Thu, 26 Oct 2017 13:47:55 +0200 Subject: [PATCH] Removed OSType --- src/mrbesen/cr/auto/clicker/Clicker.java | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/src/mrbesen/cr/auto/clicker/Clicker.java b/src/mrbesen/cr/auto/clicker/Clicker.java index ee29495..a33fe6f 100644 --- a/src/mrbesen/cr/auto/clicker/Clicker.java +++ b/src/mrbesen/cr/auto/clicker/Clicker.java @@ -39,7 +39,7 @@ public class Clicker implements Runnable{ private int mincolordistance = 35; private Overlay ov = null; - OSType os; + private int alt_key; long started = -1; @@ -94,17 +94,10 @@ public class Clicker implements Runnable{ public void run() { sleep(1000);//chill ma - //determine os String oss = System.getProperty("os.name").toLowerCase(); - if(oss.contains("nix") | oss.contains("nux") | oss.contains("aix")) - os = OSType.Linux; - else if(oss.contains("win")) - os = OSType.Windows; - else if(oss.contains("mac")) - os = OSType.OSX; - else - Main.get().ui.info("OS not supported for backfocus: " + oss); - + alt_key = ( oss.contains("nix") | oss.contains("nux") | oss.contains("aix") | oss.contains("win") ? KeyEvent.VK_ALT : KeyEvent.VK_META); + //windows and linux have another alt key than mac, so lets determine the OS type, to determine the key code. + int card = 0; try { Robot rob = new Robot(); @@ -209,8 +202,6 @@ public class Clicker implements Runnable{ private void backfocus(Robot bot) { if(backfocus) { - int alt_key = ( os == OSType.Windows | os == OSType.Linux ? KeyEvent.VK_ALT : KeyEvent.VK_META); - bot.keyPress(alt_key); bot.keyPress(KeyEvent.VK_TAB); @@ -387,13 +378,6 @@ public class Clicker implements Runnable{ paused = b; } - private enum OSType { - Linux, - Windows, - OSX, - unsupported - } - public static Rectangle getRect(int x, int y) { return new Rectangle(x-2, y-2, 5, 5); }