diff options
-rw-r--r-- | source/blender/windowmanager/WM_types.h | 4 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 41 |
2 files changed, 35 insertions, 10 deletions
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index 6631c624a87..094df73bbd9 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -555,8 +555,8 @@ typedef struct wmOperatorType { /* previous settings - for initializing on re-use */ struct IDProperty *last_properties; - /* rna property to use for generic invoke functions. - * menus, enum search... etc */ + /* Default rna property to use for generic invoke functions. + * menus, enum search... etc. Example: Enum 'type' for a Delete menu */ PropertyRNA *prop; /* struct wmOperatorTypeMacro */ diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 1900966b5bd..06ae3848b6f 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -1281,25 +1281,50 @@ int WM_userdef_event_map(int kmitype) static void wm_eventemulation(wmEvent *event) { + /* Store last mmb event value to make emulation work when modifier keys are released first. */ 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 || mmb_emulated == KM_PRESS)) { - event->type = MIDDLEMOUSE; - event->alt = 0; - mmb_emulated = event->val; + if (event->type == LEFTMOUSE) { + + if (event->val == KM_PRESS && event->alt) { + event->type = MIDDLEMOUSE; + event->alt = 0; + mmb_emulated = 1; + } + else if (event->val == KM_RELEASE) { + /* only send middle-mouse release if emulated */ + if (mmb_emulated) { + event->type = MIDDLEMOUSE; + event->alt = 0; + } + mmb_emulated = 0; + } } + } #ifdef __APPLE__ + /* rightmouse emulation */ if (U.flag & USER_TWOBUTTONMOUSE) { - if (event->type == LEFTMOUSE && (event->oskey || mmb_emulated == KM_PRESS)) { - event->type = RIGHTMOUSE; - event->oskey = 0; - mmb_emulated = event->val; + if (event->type == LEFTMOUSE) { + + if (event->val == KM_PRESS && event->oskey) { + event->type = RIGHTMOUSE; + event->oskey = 0; + mmb_emulated = 1; + } + else if (event->val == KM_RELEASE) { + if (mmb_emulated) { + event->oskey = RIGHTMOUSE; + event->alt = 0; + } + mmb_emulated = 0; + } } + } #endif |