Skip to content
Permalink
Browse files

ANDROID: Enter main menu on middle mouse press

  • Loading branch information...
zeldin committed Aug 8, 2013
1 parent a50ede2 commit bb39cbcba4a3ca8d16b1589e2d07a4325076b01b
@@ -66,6 +66,8 @@ enum {
JE_MOUSE_MOVE = 13,
JE_GAMEPAD = 14,
JE_JOYSTICK = 15,
JE_MMB_DOWN = 16,
JE_MMB_UP = 17,
JE_QUIT = 0x1000
};

@@ -922,6 +924,20 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3,

return;

case JE_MMB_DOWN:
e.type = Common::EVENT_MAINMENU;

lockMutex(_event_queue_lock);
_event_queue.push(e);
unlockMutex(_event_queue_lock);

return;

case JE_MMB_UP:
// No action

return;

case JE_QUIT:
e.type = Common::EVENT_QUIT;

@@ -14,6 +14,7 @@
private long _rmbGuardTime;
private boolean _rmbPressed;
private boolean _lmbPressed;
private boolean _mmbPressed;

/**
* Class initialization fails when this throws an exception.
@@ -114,6 +115,23 @@ public boolean onMouseEvent(MotionEvent e, boolean hover) {
_rmbPressed = false;
}

boolean mmbDown = (buttonState & MotionEvent.BUTTON_TERTIARY) == MotionEvent.BUTTON_TERTIARY;
if (mmbDown) {
if (!_mmbPressed) {
// middle mouse button was pressed just now
_scummvm.pushEvent(ScummVMEvents.JE_MMB_DOWN, (int)e.getX(), (int)e.getY(), e.getButtonState(), 0, 0);
}

_mmbPressed = true;
} else {
if (_mmbPressed) {
// middle mouse button was released just now
_scummvm.pushEvent(ScummVMEvents.JE_MMB_UP, (int)e.getX(), (int)e.getY(), e.getButtonState(), 0, 0);
}

_mmbPressed = false;
}

return true;
}

@@ -34,6 +34,8 @@
public static final int JE_MOUSE_MOVE = 13;
public static final int JE_GAMEPAD = 14;
public static final int JE_JOYSTICK = 15;
public static final int JE_MMB_DOWN = 16;
public static final int JE_MMB_UP = 17;
public static final int JE_QUIT = 0x1000;

final protected Context _context;

0 comments on commit bb39cbc

Please sign in to comment.
You can’t perform that action at this time.