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.
This commit is contained in:
2019-10-03 00:20:58 +10:00
parent 2e97d50d2d
commit d596a6368c
6 changed files with 64 additions and 9 deletions

View File

@@ -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) {