[Bf-blender-cvs] [6e16bec] master: Fix T47354: Garbage key events (UNKOWNKEY) would remain in backup event's keymodifier.

Bastien Montagne noreply at git.blender.org
Mon Feb 8 15:46:24 CET 2016


Commit: 6e16becffd5725d2403724ef60d5f5bae30d828f
Author: Bastien Montagne
Date:   Mon Feb 8 15:41:39 2016 +0100
Branches: master
https://developer.blender.org/rB6e16becffd5725d2403724ef60d5f5bae30d828f

Fix T47354: Garbage key events (UNKOWNKEY) would remain in backup event's keymodifier.

For some reason, using 'dead keys' to compose some accentuated latin chars will generate
some 'unknown' key events, and in this case, direct `event.keymodifier` was correctly
cleared, but not its 'backup' version in `win->eventstate`, so all further events would
get an invalid modifier until some real one would be pressed again...

===================================================================

M	source/blender/windowmanager/intern/wm_event_system.c

===================================================================

diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 82284ef..4239ccc 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -3410,11 +3410,12 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
 			if (event.keymodifier == event.type)
 				event.keymodifier = 0;
 						
-			/* this case happened with an external numpad, it's not really clear
-			 * why, but it's also impossible to map a key modifier to an unknown
-			 * key, so it shouldn't harm */
-			if (event.keymodifier == UNKNOWNKEY)
-				event.keymodifier = 0;
+			/* this case happens with an external numpad, and also when using 'dead keys' (to compose complex latin
+			 * characters e.g.), it's not really clear why.
+			 * Since it's impossible to map a key modifier to an unknown key, it shouldn't harm to clear it. */
+			if (event.keymodifier == UNKNOWNKEY) {
+				evt->keymodifier = event.keymodifier = 0;
+			}
 			
 			/* if test_break set, it catches this. Do not set with modifier presses. XXX Keep global for now? */
 			if ((event.type == ESCKEY && event.val == KM_PRESS) &&




More information about the Bf-blender-cvs mailing list