boolean eventMouse3 = false;
boolean eventMouseWheelUp = false;
boolean eventMouseWheelDown = false;
+ boolean eventAlt = false;
+ boolean eventCtrl = false;
+ boolean eventShift = false;
// System.err.printf("buttons: %04x\r\n", buttons);
- switch (buttons) {
+ switch (buttons & 0xE3) {
case 0:
eventMouse1 = true;
mouse1 = true;
eventType = TMouseEvent.Type.MOUSE_MOTION;
break;
}
+
+ if ((buttons & 0x04) != 0) {
+ eventShift = true;
+ }
+ if ((buttons & 0x08) != 0) {
+ eventAlt = true;
+ }
+ if ((buttons & 0x10) != 0) {
+ eventCtrl = true;
+ }
+
return new TMouseEvent(eventType, x, y, x, y,
eventMouse1, eventMouse2, eventMouse3,
- eventMouseWheelUp, eventMouseWheelDown);
+ eventMouseWheelUp, eventMouseWheelDown,
+ eventAlt, eventCtrl, eventShift);
}
/**
boolean eventMouse3 = false;
boolean eventMouseWheelUp = false;
boolean eventMouseWheelDown = false;
+ boolean eventAlt = false;
+ boolean eventCtrl = false;
+ boolean eventShift = false;
if (release) {
eventType = TMouseEvent.Type.MOUSE_UP;
}
- switch (buttons) {
+ switch (buttons & 0xE3) {
case 0:
eventMouse1 = true;
break;
// Unknown, bail out
return null;
}
+
+ if ((buttons & 0x04) != 0) {
+ eventShift = true;
+ }
+ if ((buttons & 0x08) != 0) {
+ eventAlt = true;
+ }
+ if ((buttons & 0x10) != 0) {
+ eventCtrl = true;
+ }
+
return new TMouseEvent(eventType, x, y, x, y,
eventMouse1, eventMouse2, eventMouse3,
- eventMouseWheelUp, eventMouseWheelDown);
+ eventMouseWheelUp, eventMouseWheelDown,
+ eventAlt, eventCtrl, eventShift);
}
/**
boolean eventMouse1 = false;
boolean eventMouse2 = false;
boolean eventMouse3 = false;
+ boolean eventAlt = false;
+ boolean eventCtrl = false;
+ boolean eventShift = false;
+
if ((modifiers & MouseEvent.BUTTON1_DOWN_MASK) != 0) {
eventMouse1 = true;
}
if ((modifiers & MouseEvent.BUTTON3_DOWN_MASK) != 0) {
eventMouse3 = true;
}
+ if ((modifiers & MouseEvent.ALT_DOWN_MASK) != 0) {
+ eventAlt = true;
+ }
+ if ((modifiers & MouseEvent.CTRL_DOWN_MASK) != 0) {
+ eventCtrl = true;
+ }
+ if ((modifiers & MouseEvent.SHIFT_DOWN_MASK) != 0) {
+ eventShift = true;
+ }
+
mouse1 = eventMouse1;
mouse2 = eventMouse2;
mouse3 = eventMouse3;
int y = textRow(mouse.getY());
TMouseEvent mouseEvent = new TMouseEvent(TMouseEvent.Type.MOUSE_MOTION,
- x, y, x, y, mouse1, mouse2, mouse3, false, false);
+ x, y, x, y, mouse1, mouse2, mouse3, false, false,
+ eventAlt, eventCtrl, eventShift);
synchronized (eventQueue) {
eventQueue.add(mouseEvent);
oldMouseX = x;
oldMouseY = y;
+ boolean eventAlt = false;
+ boolean eventCtrl = false;
+ boolean eventShift = false;
+
+ int modifiers = mouse.getModifiersEx();
+ if ((modifiers & MouseEvent.ALT_DOWN_MASK) != 0) {
+ eventAlt = true;
+ }
+ if ((modifiers & MouseEvent.CTRL_DOWN_MASK) != 0) {
+ eventCtrl = true;
+ }
+ if ((modifiers & MouseEvent.SHIFT_DOWN_MASK) != 0) {
+ eventShift = true;
+ }
+
TMouseEvent mouseEvent = new TMouseEvent(TMouseEvent.Type.MOUSE_MOTION,
- x, y, x, y, mouse1, mouse2, mouse3, false, false);
+ x, y, x, y, mouse1, mouse2, mouse3, false, false,
+ eventAlt, eventCtrl, eventShift);
synchronized (eventQueue) {
eventQueue.add(mouseEvent);
boolean eventMouse1 = false;
boolean eventMouse2 = false;
boolean eventMouse3 = false;
+ boolean eventAlt = false;
+ boolean eventCtrl = false;
+ boolean eventShift = false;
+
if ((modifiers & MouseEvent.BUTTON1_DOWN_MASK) != 0) {
eventMouse1 = true;
}
if ((modifiers & MouseEvent.BUTTON3_DOWN_MASK) != 0) {
eventMouse3 = true;
}
+ if ((modifiers & MouseEvent.ALT_DOWN_MASK) != 0) {
+ eventAlt = true;
+ }
+ if ((modifiers & MouseEvent.CTRL_DOWN_MASK) != 0) {
+ eventCtrl = true;
+ }
+ if ((modifiers & MouseEvent.SHIFT_DOWN_MASK) != 0) {
+ eventShift = true;
+ }
+
mouse1 = eventMouse1;
mouse2 = eventMouse2;
mouse3 = eventMouse3;
int y = textRow(mouse.getY());
TMouseEvent mouseEvent = new TMouseEvent(TMouseEvent.Type.MOUSE_DOWN,
- x, y, x, y, mouse1, mouse2, mouse3, false, false);
+ x, y, x, y, mouse1, mouse2, mouse3, false, false,
+ eventAlt, eventCtrl, eventShift);
synchronized (eventQueue) {
eventQueue.add(mouseEvent);
boolean eventMouse1 = false;
boolean eventMouse2 = false;
boolean eventMouse3 = false;
+ boolean eventAlt = false;
+ boolean eventCtrl = false;
+ boolean eventShift = false;
+
if ((modifiers & MouseEvent.BUTTON1_DOWN_MASK) != 0) {
eventMouse1 = true;
}
if ((modifiers & MouseEvent.BUTTON3_DOWN_MASK) != 0) {
eventMouse3 = true;
}
+ if ((modifiers & MouseEvent.ALT_DOWN_MASK) != 0) {
+ eventAlt = true;
+ }
+ if ((modifiers & MouseEvent.CTRL_DOWN_MASK) != 0) {
+ eventCtrl = true;
+ }
+ if ((modifiers & MouseEvent.SHIFT_DOWN_MASK) != 0) {
+ eventShift = true;
+ }
+
if (mouse1) {
mouse1 = false;
eventMouse1 = true;
int y = textRow(mouse.getY());
TMouseEvent mouseEvent = new TMouseEvent(TMouseEvent.Type.MOUSE_UP,
- x, y, x, y, eventMouse1, eventMouse2, eventMouse3, false, false);
+ x, y, x, y, eventMouse1, eventMouse2, eventMouse3, false, false,
+ eventAlt, eventCtrl, eventShift);
synchronized (eventQueue) {
eventQueue.add(mouseEvent);
boolean eventMouse3 = false;
boolean mouseWheelUp = false;
boolean mouseWheelDown = false;
+ boolean eventAlt = false;
+ boolean eventCtrl = false;
+ boolean eventShift = false;
+
if ((modifiers & MouseEvent.BUTTON1_DOWN_MASK) != 0) {
eventMouse1 = true;
}
if ((modifiers & MouseEvent.BUTTON3_DOWN_MASK) != 0) {
eventMouse3 = true;
}
+ if ((modifiers & MouseEvent.ALT_DOWN_MASK) != 0) {
+ eventAlt = true;
+ }
+ if ((modifiers & MouseEvent.CTRL_DOWN_MASK) != 0) {
+ eventCtrl = true;
+ }
+ if ((modifiers & MouseEvent.SHIFT_DOWN_MASK) != 0) {
+ eventShift = true;
+ }
+
mouse1 = eventMouse1;
mouse2 = eventMouse2;
mouse3 = eventMouse3;
}
TMouseEvent mouseEvent = new TMouseEvent(TMouseEvent.Type.MOUSE_DOWN,
- x, y, x, y, mouse1, mouse2, mouse3, mouseWheelUp, mouseWheelDown);
+ x, y, x, y, mouse1, mouse2, mouse3, mouseWheelUp, mouseWheelDown,
+ eventAlt, eventCtrl, eventShift);
synchronized (eventQueue) {
eventQueue.add(mouseEvent);
*/
private boolean mouseWheelDown;
+ /**
+ * Keyboard modifier ALT.
+ */
+ private boolean alt;
+
+ /**
+ * Keyboard modifier CTRL.
+ */
+ private boolean ctrl;
+
+ /**
+ * Keyboard modifier SHIFT.
+ */
+ private boolean shift;
+
// ------------------------------------------------------------------------
// Constructors -----------------------------------------------------------
// ------------------------------------------------------------------------
* @param mouse3 if true, middle button is down
* @param mouseWheelUp if true, mouse wheel (button 4) is down
* @param mouseWheelDown if true, mouse wheel (button 5) is down
+ * @param alt if true, ALT was pressed with this mouse event
+ * @param ctrl if true, CTRL was pressed with this mouse event
+ * @param shift if true, SHIFT was pressed with this mouse event
*/
public TMouseEvent(final Type type, final int x, final int y,
final int absoluteX, final int absoluteY,
final boolean mouse1, final boolean mouse2, final boolean mouse3,
- final boolean mouseWheelUp, final boolean mouseWheelDown) {
+ final boolean mouseWheelUp, final boolean mouseWheelDown,
+ final boolean alt, final boolean ctrl, final boolean shift) {
this.type = type;
this.x = x;
this.mouse3 = mouse3;
this.mouseWheelUp = mouseWheelUp;
this.mouseWheelDown = mouseWheelDown;
+ this.alt = alt;
+ this.ctrl = ctrl;
+ this.shift = shift;
}
// ------------------------------------------------------------------------
return mouseWheelDown;
}
+ /**
+ * Getter for ALT.
+ *
+ * @return alt value
+ */
+ public boolean isAlt() {
+ return alt;
+ }
+
+ /**
+ * Getter for CTRL.
+ *
+ * @return ctrl value
+ */
+ public boolean isCtrl() {
+ return ctrl;
+ }
+
+ /**
+ * Getter for SHIFT.
+ *
+ * @return shift value
+ */
+ public boolean isShift() {
+ return shift;
+ }
+
/**
* Create a duplicate instance.
*
*/
public TMouseEvent dup() {
TMouseEvent mouse = new TMouseEvent(type, x, y, absoluteX, absoluteY,
- mouse1, mouse2, mouse3, mouseWheelUp, mouseWheelDown);
+ mouse1, mouse2, mouse3, mouseWheelUp, mouseWheelDown,
+ alt, ctrl, shift);
+
return mouse;
}
*/
@Override
public String toString() {
- return String.format("Mouse: %s x %d y %d absoluteX %d absoluteY %d 1 %s 2 %s 3 %s DOWN %s UP %s",
+ return String.format("Mouse: %s x %d y %d absoluteX %d absoluteY %d 1 %s 2 %s 3 %s DOWN %s UP %s ALT %s CTRL %s SHIFT %s",
type,
x, y,
absoluteX, absoluteY,
mouse2,
mouse3,
mouseWheelUp,
- mouseWheelDown);
+ mouseWheelDown,
+ alt, ctrl, shift);
}
}