This commit is contained in:
@@ -8,8 +8,10 @@ import com.melloware.jintellitype.JIntellitype;
|
||||
|
||||
import pm.Device;
|
||||
import pm.Task;
|
||||
import pm.application.windows.Command;
|
||||
import pm.exception.EventException;
|
||||
import pm.exception.device.DeviceInitialiseException;
|
||||
import pm.macro.event.Hold;
|
||||
import pm.macro.event.Press;
|
||||
import pm.macro.event.Release;
|
||||
import pm.task.Continuous;
|
||||
@@ -37,8 +39,11 @@ public class JIntellitypeDevice extends Device implements HotkeyListener, Intell
|
||||
new Hotkey(Key.NEXT),
|
||||
new Task(Action.NEXT, Target.MAIN));
|
||||
add(
|
||||
new Hotkey(Modifier.CTRL | Modifier.WIN, 'q'),
|
||||
new Task(Action.PLAY, Target.APPLICATIONS));
|
||||
new Press(CommandButton.VOLUME_DOWN),
|
||||
new Task(Action.VOLUME_DOWN, Target.APPLICATIONS));
|
||||
add(
|
||||
new Press(CommandButton.VOLUME_UP),
|
||||
new Task(Action.VOLUME_UP, Target.APPLICATIONS));
|
||||
add(
|
||||
new Hotkey(Modifier.CTRL | Modifier.WIN, 'x'),
|
||||
new Task(Action.EXIT, Target.MAIN));
|
||||
|
||||
@@ -3,33 +3,27 @@ package pm.device.text;
|
||||
import java.io.InputStream;
|
||||
import java.util.Scanner;
|
||||
|
||||
import pm.Listener;
|
||||
import pm.Task;
|
||||
import pm.task.TaskManager;
|
||||
import pm.value.Action;
|
||||
import pm.value.Target;
|
||||
|
||||
public class InputListener implements Runnable {
|
||||
protected static final int SLEEP = 100;
|
||||
|
||||
protected boolean run;
|
||||
public class InputListener extends Listener {
|
||||
protected Scanner input;
|
||||
|
||||
public InputListener(InputStream inputStream) {
|
||||
input = new Scanner(inputStream);
|
||||
}
|
||||
|
||||
public void start() {
|
||||
new Thread(this).start();
|
||||
}
|
||||
|
||||
public void run() {
|
||||
run = true;
|
||||
while (running()) {
|
||||
String textinput = input.next().toUpperCase();
|
||||
if(textinput != null) {
|
||||
String string = input.next().toUpperCase();
|
||||
if(string != null) {
|
||||
try {
|
||||
TaskManager.add(
|
||||
new Task(Action.valueOf(textinput), Target.APPLICATION));
|
||||
new Task(Action.valueOf(string), Target.APPLICATION));
|
||||
} catch(IllegalArgumentException e) {}
|
||||
}
|
||||
try {
|
||||
@@ -43,8 +37,4 @@ public class InputListener implements Runnable {
|
||||
protected boolean running() {
|
||||
return run && input.hasNext();
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
run = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,11 +6,10 @@ import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import pm.Listener;
|
||||
import pm.device.text.InputListener;
|
||||
|
||||
public class SocketListener implements Runnable {
|
||||
protected boolean run;
|
||||
|
||||
public class SocketListener extends Listener {
|
||||
protected ServerSocket server;
|
||||
protected ArrayList<InputListener> inputListenerList;
|
||||
|
||||
@@ -19,12 +18,7 @@ public class SocketListener implements Runnable {
|
||||
inputListenerList = new ArrayList<InputListener>();
|
||||
}
|
||||
|
||||
public void start() {
|
||||
new Thread(this).start();
|
||||
}
|
||||
|
||||
public void run() {
|
||||
run = true;
|
||||
while (run) {
|
||||
try {
|
||||
Socket socket = server.accept();
|
||||
|
||||
@@ -7,7 +7,6 @@ import org.wiigee.util.Log;
|
||||
import pm.Button;
|
||||
import pm.Device;
|
||||
import pm.Task;
|
||||
import pm.device.javainput.rumblepad.RumblepadButton;
|
||||
import pm.device.wiimote.gesture.GestureDevice;
|
||||
import pm.exception.device.DeviceInitialiseException;
|
||||
import pm.exception.event.UnknownButtonException;
|
||||
|
||||
Reference in New Issue
Block a user