Removed OSType
This commit is contained in:
parent
72654bafff
commit
963af8b78e
|
@ -39,7 +39,7 @@ public class Clicker implements Runnable{
|
||||||
private int mincolordistance = 35;
|
private int mincolordistance = 35;
|
||||||
private Overlay ov = null;
|
private Overlay ov = null;
|
||||||
|
|
||||||
OSType os;
|
private int alt_key;
|
||||||
|
|
||||||
long started = -1;
|
long started = -1;
|
||||||
|
|
||||||
|
@ -94,17 +94,10 @@ public class Clicker implements Runnable{
|
||||||
public void run() {
|
public void run() {
|
||||||
sleep(1000);//chill ma
|
sleep(1000);//chill ma
|
||||||
|
|
||||||
//determine os
|
|
||||||
String oss = System.getProperty("os.name").toLowerCase();
|
String oss = System.getProperty("os.name").toLowerCase();
|
||||||
if(oss.contains("nix") | oss.contains("nux") | oss.contains("aix"))
|
alt_key = ( oss.contains("nix") | oss.contains("nux") | oss.contains("aix") | oss.contains("win") ? KeyEvent.VK_ALT : KeyEvent.VK_META);
|
||||||
os = OSType.Linux;
|
//windows and linux have another alt key than mac, so lets determine the OS type, to determine the key code.
|
||||||
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);
|
|
||||||
|
|
||||||
int card = 0;
|
int card = 0;
|
||||||
try {
|
try {
|
||||||
Robot rob = new Robot();
|
Robot rob = new Robot();
|
||||||
|
@ -209,8 +202,6 @@ public class Clicker implements Runnable{
|
||||||
private void backfocus(Robot bot) {
|
private void backfocus(Robot bot) {
|
||||||
if(backfocus) {
|
if(backfocus) {
|
||||||
|
|
||||||
int alt_key = ( os == OSType.Windows | os == OSType.Linux ? KeyEvent.VK_ALT : KeyEvent.VK_META);
|
|
||||||
|
|
||||||
bot.keyPress(alt_key);
|
bot.keyPress(alt_key);
|
||||||
|
|
||||||
bot.keyPress(KeyEvent.VK_TAB);
|
bot.keyPress(KeyEvent.VK_TAB);
|
||||||
|
@ -387,13 +378,6 @@ public class Clicker implements Runnable{
|
||||||
paused = b;
|
paused = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum OSType {
|
|
||||||
Linux,
|
|
||||||
Windows,
|
|
||||||
OSX,
|
|
||||||
unsupported
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Rectangle getRect(int x, int y) {
|
public static Rectangle getRect(int x, int y) {
|
||||||
return new Rectangle(x-2, y-2, 5, 5);
|
return new Rectangle(x-2, y-2, 5, 5);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue