diff options
author | Ton Roosendaal <ton@blender.org> | 2012-10-31 21:28:21 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2012-10-31 21:28:21 +0400 |
commit | 38a0d48fa75390033c89161518e851b48b4034ec (patch) | |
tree | 6c0de18cef3f9c7deafe1bc350e0780e460c295b /source/blender/windowmanager | |
parent | d705c52e659e63e07d22433c517fdddb2a5643bf (diff) |
Bugfix #33032
(since 2010)
- Using 2-button mouse emulation (common for tablets)
- Press LMB, start painting, press ALT, release LMB
- This kept painting to run, since the release event was a MMB,
not handled by paint code.
Diffstat (limited to 'source/blender/windowmanager')
-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 |