MantisBT - VTK
View Issue Details
0006004VTK(No Category)public2007-11-04 13:252016-08-12 09:54
Chris Kruszynski 
Karthik Krishnan 
normalmajoralways
closedmoved 
XWindows
 
 
0006004: Keyboard event handling in new style widgets is horribly broken.
There is a major issue with the handling of keyboard events in the new style widgets. Apparently it is assumed that providing a KeySym string to the callback mapper which is set to NULL will cause the event translator to only compare the provided key code to the key code of an event, and ignore the KeySym string/character.

This assumption fails when various control keys (such as ctrl or shift) are pressed: these keys return a keycode value of 0. The vtkEvent::operator==() method will not compare keycodes if either of the events has a keycode 0 (the keypress has this keycode), it will not compare keysyms if either is NULL (the widget set it to NULL), and as a result the comparison will return 1, and the widget will receive a keypress event, even though the key which was pressed was not the one that the widget wanted.

Another issue with the key handling is in vtkAbstractWidget::ProcessEventsHandler(). The comparison (modifier == vtkEvent::AnyModifier) will always be false, because the previously called vtkEvent::GetModifier() never returns the value vtkEvent::AnyModifier. The part where first event translations which want vtkEvent::NoModifier are checked, and then the ones that want vtkEvent::AnyModifier never gets executed.
- Put a vtkContourWidget in a window and enable it.
- Click around a bit creating a number of points for the contour.
- Press the shift key.
- Notice how part of the contour is deleted, even though the widget should only delete contour points when the '/' key (code 47) is pressed.

The second issue can probably be reproduced by first adding an event translation for some key with AnyModifier, and then one with NoModifier, pressing the key, and noticing that the translation with AnyModifier is used instead of the one with NoModifier.
No tags attached.
Issue History
2007-11-04 13:25Chris KruszynskiNew Issue
2008-02-06 09:38Jeff BaumesStatusbacklog => tabled
2008-02-06 09:38Jeff BaumesAssigned To => Karthik Krishnan
2008-02-24 12:56Karthik KrishnanStatustabled => @80@
2008-02-24 12:56Karthik KrishnanResolutionopen => fixed
2008-02-24 12:56Karthik KrishnanNote Added: 0010639
2008-02-26 08:30Chris KruszynskiStatus@80@ => @20@
2008-02-26 08:30Chris KruszynskiResolutionfixed => reopened
2008-02-26 08:30Chris KruszynskiNote Added: 0010647
2011-06-16 13:11Zack GalbreathCategory => (No Category)
2016-08-12 09:54Kitware RobotNote Added: 0036936
2016-08-12 09:54Kitware RobotStatusexpired => closed
2016-08-12 09:54Kitware RobotResolutionreopened => moved

Notes
(0010639)
Karthik Krishnan   
2008-02-24 12:56   
This is fixed. See the mails on the developers list and the mails:

http://public.kitware.com/pipermail/vtk-developers/2007-December/004865.html [^]
http://public.kitware.com/pipermail/vtk-developers/2007-December/004876.html [^]
http://public.kitware.com/pipermail/vtk-developers/2007-December/004858.html [^]
http://public.kitware.com/pipermail/vtk-developers/2007-December/004861.html [^]
(0010647)
Chris Kruszynski   
2008-02-26 08:30   
The issue with vtkAbstractWidget::ProcessEventsHandler() is still present. I propose the following patch:

--- vtkAbstractWidget.cxx 9 Jan 2008 15:30:29 -0000 1.15
+++ vtkAbstractWidget.cxx 26 Feb 2008 13:29:12 -0000
@@ -215,7 +215,7 @@
 
   // If neither the ctrl nor the shift keys are pressed, give
   // NoModifier a preference over AnyModifer.
- if (modifier == vtkEvent::AnyModifier)
+ if (modifier == vtkEvent::NoModifier)
     {
     widgetEvent = self->EventTranslator->GetTranslation(vtkEvent,
                                           vtkEvent::NoModifier,
(0036936)
Kitware Robot   
2016-08-12 09:54   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current VTK Issues page linked in the banner at the top of this page.