2.5: Middle mouse button emulation with alt + left mouse button
[blender.git] / source / blender / windowmanager / intern / wm_event_system.c
index 737028843d39f43ab66d4bc111a837bc24902549..f0d9f8c0989696a4da746920ca42898dc4b9d963 100644 (file)
@@ -672,7 +672,19 @@ static int wm_eventmatch(wmEvent *winevent, wmKeymapItem *kmi)
        int kmitype= wm_userdef_event_map(kmi->type);
 
        if(kmi->inactive) return 0;
-       
+
+       /* exception for middlemouse emulation */
+       if((U.flag & USER_TWOBUTTONMOUSE) && (kmi->type == MIDDLEMOUSE)) {
+               if(winevent->type == LEFTMOUSE && winevent->alt) {
+                       wmKeymapItem tmp= *kmi;
+
+                       tmp.type= winevent->type;
+                       tmp.alt= winevent->alt;
+                       if(wm_eventmatch(winevent, &tmp))
+                               return 1;
+               }
+       }
+
        /* the matching rules */
        if(kmitype==KM_TEXTINPUT)
                if(ISKEYBOARD(winevent->type)) return 1;