Commit: 7d9bbf1b781487ddf42cee3aec0f2a42d84fc4bf
Author: Joshua Leung
Date:   Sun Oct 11 01:42:11 2015 +1300
Branches: GPencil_Editing_Stage3
https://developer.blender.org/rB7d9bbf1b781487ddf42cee3aec0f2a42d84fc4bf

Fixes for using tablet events in keymap

* Need to classify tablet events as being in the "mouse" category, or else 
attempts
  to add a new keymap item for this will fail by reverting to keyboard input

* Made event matching more restrictive - it will now trigger only on a tablet 
events
  for LEFTMOUSE events. The problem was that, even when hovering over the tablet
  and pressing a key, you'd still get an event with tablet data, which meant 
that
  that event would get wrongly caught and handled.

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

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

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

diff --git a/source/blender/windowmanager/intern/wm_event_system.c 
b/source/blender/windowmanager/intern/wm_event_system.c
index 58b3033..b307a87 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -1544,6 +1544,8 @@ static int wm_eventmatch(wmEvent *winevent, wmKeyMapItem 
*kmi)
                        
                        if (wmtab == NULL)
                                return 0;
+                       else if (winevent->type != LEFTMOUSE) /* tablet events 
can occur on hover + keypress */
+                               return 0;
                        else if ((kmitype == TABLET_STYLUS) && (wmtab->Active 
!= EVT_TABLET_STYLUS))
                                return 0;
                        else if ((kmitype == TABLET_ERASER) && (wmtab->Active 
!= EVT_TABLET_ERASER))
diff --git a/source/blender/windowmanager/intern/wm_keymap.c 
b/source/blender/windowmanager/intern/wm_keymap.c
index 016583e..1ca4741 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -202,6 +202,9 @@ int WM_keymap_map_type_get(wmKeyMapItem *kmi)
        if (kmi->type == KM_TEXTINPUT) {
                return KMI_TYPE_TEXTINPUT;
        }
+       if (ELEM(kmi->type, TABLET_STYLUS, TABLET_ERASER)) {
+               return KMI_TYPE_MOUSE;
+       }
        return KMI_TYPE_KEYBOARD;
 }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to