diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-10-02 17:20:58 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-10-02 17:25:06 +0300 |
commit | d596a6368cc62d198dd33dadd1cd0831d0de3dee (patch) | |
tree | bc1a70f5f4d7411726f0107161d4110de7578dc3 /source/blender/windowmanager | |
parent | 2e97d50d2d3bdba1ba151d96a6b40382f07785c4 (diff) |
Preference: option to use OS-Key to emulate MMB
Alt-LMB is used in quite a few areas now, see T69323
using OS-Key allows these conflicts to be avoided.
Currently disabled for WIN32, since it conflicts with the start menu.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 6b4327d5f44..6991dd2f9a6 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -4210,19 +4210,31 @@ static void wm_eventemulation(wmEvent *event, bool test_only) if (U.flag & USER_TWOBUTTONMOUSE) { if (event->type == LEFTMOUSE) { - if (event->val == KM_PRESS && event->alt) { - event->type = MIDDLEMOUSE; - event->alt = 0; + short *mod = ( +#if !defined(WIN32) + (U.mouse_emulate_3_button_modifier == USER_EMU_MMB_MOD_OSKEY) ? &event->oskey : + &event->alt +#else + /* Disable for WIN32 for now because it accesses the start menu. */ + &event->alt +#endif + ); - if (!test_only) { - emulating_event = MIDDLEMOUSE; + if (event->val == KM_PRESS) { + if (*mod) { + *mod = 0; + event->type = MIDDLEMOUSE; + + if (!test_only) { + emulating_event = MIDDLEMOUSE; + } } } else if (event->val == KM_RELEASE) { /* only send middle-mouse release if emulated */ if (emulating_event == MIDDLEMOUSE) { event->type = MIDDLEMOUSE; - event->alt = 0; + *mod = 0; } if (!test_only) { |