@@ -317,7 +317,8 @@ def scroll_event_windows(self, event):
317317 FigureCanvasBase .scroll_event (self , x , y , step , guiEvent = event )
318318
319319 def _get_key (self , event ):
320- key = cbook ._unikey_or_keysym_to_mplkey (event .char , event .keysym )
320+ unikey = event .char
321+ key = cbook ._unikey_or_keysym_to_mplkey (unikey , event .keysym )
321322
322323 # add modifier keys to the key string. Bit details originate from
323324 # http://effbot.org/tkinterbook/tkinter-events-and-bindings.htm
@@ -328,26 +329,30 @@ def _get_key(self, event):
328329 # however this is not the case on "darwin", so double check that
329330 # we aren't adding repeat modifier flags to a modifier key.
330331 if sys .platform == 'win32' :
331- modifiers = [(17 , 'alt' , 'alt' ),
332- (2 , 'ctrl' , 'control' ),
332+ modifiers = [(2 , 'ctrl' , 'control' ),
333+ (17 , 'alt' , 'alt' ),
334+ (0 , 'shift' , 'shift' ),
333335 ]
334336 elif sys .platform == 'darwin' :
335- modifiers = [(3 , 'super ' , 'super ' ),
337+ modifiers = [(2 , 'ctrl ' , 'control ' ),
336338 (4 , 'alt' , 'alt' ),
337- (2 , 'ctrl' , 'control' ),
339+ (0 , 'shift' , 'shift' ),
340+ (3 , 'super' , 'super' ),
338341 ]
339342 else :
340- modifiers = [(6 , 'super ' , 'super ' ),
343+ modifiers = [(2 , 'ctrl ' , 'control ' ),
341344 (3 , 'alt' , 'alt' ),
342- (2 , 'ctrl' , 'control' ),
345+ (0 , 'shift' , 'shift' ),
346+ (6 , 'super' , 'super' ),
343347 ]
344348
345349 if key is not None :
346350 # shift is not added to the keys as this is already accounted for
347351 for bitmask , prefix , key_name in modifiers :
348352 if event .state & (1 << bitmask ) and key_name not in key :
349- key = '{0}+{1}' .format (prefix , key )
350-
353+ if not (prefix == 'shift' and unikey ):
354+ key = '{0}+{1}' .format (prefix , key )
355+ break
351356 return key
352357
353358 def key_press (self , event ):
0 commit comments