[#20792] MMB emulation, release broken

Store last mmb event value to make emulation work when modifier keys are released first.

This is done in a not so nice way for now. Eventually, I'd like for emulation keys to have their own data structures (user creatable and all that)
This commit is contained in:
Martin Poirier 2010-01-27 17:01:41 +00:00
parent c896f1aa43
commit a46f36b19c

@ -808,20 +808,24 @@ int WM_userdef_event_map(int kmitype)
static void wm_eventemulation(wmEvent *event)
{
static int mmb_emulated = 0; /* this should be in a data structure somwhere */
/* middlemouse emulation */
if(U.flag & USER_TWOBUTTONMOUSE) {
if(event->type == LEFTMOUSE && event->alt) {
if(event->type == LEFTMOUSE && (event->alt || mmb_emulated == KM_PRESS)) {
event->type = MIDDLEMOUSE;
event->alt = 0;
mmb_emulated = event->val;
}
}
#ifdef __APPLE__
/* rightmouse emulation */
if(U.flag & USER_TWOBUTTONMOUSE) {
if(event->type == LEFTMOUSE && event->oskey) {
if(event->type == LEFTMOUSE && (event->oskey || mmb_emulated == KM_PRESS) {
event->type = RIGHTMOUSE;
event->oskey = 0;
mmb_emulated = event->val;
}
}
#endif