|
|
|
@ -30,60 +30,60 @@ public final class ControlMessage {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static ControlMessage createInjectKeycode(int action, int keycode, int metaState) {
|
|
|
|
|
ControlMessage event = new ControlMessage();
|
|
|
|
|
event.type = TYPE_INJECT_KEYCODE;
|
|
|
|
|
event.action = action;
|
|
|
|
|
event.keycode = keycode;
|
|
|
|
|
event.metaState = metaState;
|
|
|
|
|
return event;
|
|
|
|
|
ControlMessage msg = new ControlMessage();
|
|
|
|
|
msg.type = TYPE_INJECT_KEYCODE;
|
|
|
|
|
msg.action = action;
|
|
|
|
|
msg.keycode = keycode;
|
|
|
|
|
msg.metaState = metaState;
|
|
|
|
|
return msg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static ControlMessage createInjectText(String text) {
|
|
|
|
|
ControlMessage event = new ControlMessage();
|
|
|
|
|
event.type = TYPE_INJECT_TEXT;
|
|
|
|
|
event.text = text;
|
|
|
|
|
return event;
|
|
|
|
|
ControlMessage msg = new ControlMessage();
|
|
|
|
|
msg.type = TYPE_INJECT_TEXT;
|
|
|
|
|
msg.text = text;
|
|
|
|
|
return msg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static ControlMessage createInjectMouseEvent(int action, int buttons, Position position) {
|
|
|
|
|
ControlMessage event = new ControlMessage();
|
|
|
|
|
event.type = TYPE_INJECT_MOUSE_EVENT;
|
|
|
|
|
event.action = action;
|
|
|
|
|
event.buttons = buttons;
|
|
|
|
|
event.position = position;
|
|
|
|
|
return event;
|
|
|
|
|
ControlMessage msg = new ControlMessage();
|
|
|
|
|
msg.type = TYPE_INJECT_MOUSE_EVENT;
|
|
|
|
|
msg.action = action;
|
|
|
|
|
msg.buttons = buttons;
|
|
|
|
|
msg.position = position;
|
|
|
|
|
return msg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static ControlMessage createInjectScrollEvent(Position position, int hScroll, int vScroll) {
|
|
|
|
|
ControlMessage event = new ControlMessage();
|
|
|
|
|
event.type = TYPE_INJECT_SCROLL_EVENT;
|
|
|
|
|
event.position = position;
|
|
|
|
|
event.hScroll = hScroll;
|
|
|
|
|
event.vScroll = vScroll;
|
|
|
|
|
return event;
|
|
|
|
|
ControlMessage msg = new ControlMessage();
|
|
|
|
|
msg.type = TYPE_INJECT_SCROLL_EVENT;
|
|
|
|
|
msg.position = position;
|
|
|
|
|
msg.hScroll = hScroll;
|
|
|
|
|
msg.vScroll = vScroll;
|
|
|
|
|
return msg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static ControlMessage createSetClipboard(String text) {
|
|
|
|
|
ControlMessage event = new ControlMessage();
|
|
|
|
|
event.type = TYPE_SET_CLIPBOARD;
|
|
|
|
|
event.text = text;
|
|
|
|
|
return event;
|
|
|
|
|
ControlMessage msg = new ControlMessage();
|
|
|
|
|
msg.type = TYPE_SET_CLIPBOARD;
|
|
|
|
|
msg.text = text;
|
|
|
|
|
return msg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param mode one of the {@code Device.SCREEN_POWER_MODE_*} constants
|
|
|
|
|
*/
|
|
|
|
|
public static ControlMessage createSetScreenPowerMode(int mode) {
|
|
|
|
|
ControlMessage event = new ControlMessage();
|
|
|
|
|
event.type = TYPE_SET_SCREEN_POWER_MODE;
|
|
|
|
|
event.action = mode;
|
|
|
|
|
return event;
|
|
|
|
|
ControlMessage msg = new ControlMessage();
|
|
|
|
|
msg.type = TYPE_SET_SCREEN_POWER_MODE;
|
|
|
|
|
msg.action = mode;
|
|
|
|
|
return msg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static ControlMessage createEmpty(int type) {
|
|
|
|
|
ControlMessage event = new ControlMessage();
|
|
|
|
|
event.type = type;
|
|
|
|
|
return event;
|
|
|
|
|
ControlMessage msg = new ControlMessage();
|
|
|
|
|
msg.type = type;
|
|
|
|
|
return msg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getType() {
|
|
|
|
|