[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51793] trunk/blender/source/blender/ windowmanager: Bugfix #33032

Ton Roosendaal ton at blender.org
Wed Oct 31 18:28:22 CET 2012


Revision: 51793
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51793
Author:   ton
Date:     2012-10-31 17:28:21 +0000 (Wed, 31 Oct 2012)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/windowmanager/WM_types.h
    trunk/blender/source/blender/windowmanager/intern/wm_event_system.c

Modified: trunk/blender/source/blender/windowmanager/WM_types.h
===================================================================
--- trunk/blender/source/blender/windowmanager/WM_types.h	2012-10-31 17:03:31 UTC (rev 51792)
+++ trunk/blender/source/blender/windowmanager/WM_types.h	2012-10-31 17:28:21 UTC (rev 51793)
@@ -555,8 +555,8 @@
 	/* 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 */

Modified: trunk/blender/source/blender/windowmanager/intern/wm_event_system.c
===================================================================
--- trunk/blender/source/blender/windowmanager/intern/wm_event_system.c	2012-10-31 17:03:31 UTC (rev 51792)
+++ trunk/blender/source/blender/windowmanager/intern/wm_event_system.c	2012-10-31 17:28:21 UTC (rev 51793)
@@ -1281,25 +1281,50 @@
 
 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
 




More information about the Bf-blender-cvs mailing list