+ /**
+ * Handle mouse release events.
+ *
+ * @param mouse mouse button release event
+ */
+ @Override
+ public void onMouseUp(final TMouseEvent mouse) {
+ if (inWindowMove || inWindowResize) {
+ // TWindow needs to deal with this.
+ super.onMouseUp(mouse);
+ return;
+ }
+
+ if (mouseOnEmulator(mouse)) {
+ synchronized (emulator) {
+ mouse.setX(mouse.getX() - 1);
+ mouse.setY(mouse.getY() - 1);
+ emulator.mouse(mouse);
+ readEmulatorState();
+ return;
+ }
+ }
+
+ // Emulator didn't consume it, pass it on
+ super.onMouseUp(mouse);
+ }
+
+ /**
+ * Handle mouse motion events.
+ *
+ * @param mouse mouse motion event
+ */
+ @Override
+ public void onMouseMotion(final TMouseEvent mouse) {
+ if (inWindowMove || inWindowResize) {
+ // TWindow needs to deal with this.
+ super.onMouseMotion(mouse);
+ return;
+ }
+
+ if (mouseOnEmulator(mouse)) {
+ synchronized (emulator) {
+ mouse.setX(mouse.getX() - 1);
+ mouse.setY(mouse.getY() - 1);
+ emulator.mouse(mouse);
+ readEmulatorState();
+ return;
+ }
+ }
+
+ // Emulator didn't consume it, pass it on
+ super.onMouseMotion(mouse);
+ }
+