copy the modifierState when dealing with keyboard events
in a modal loop (ctrl pressed/released in the main view)
--- a/WindowSensor.st Mon Oct 12 14:48:33 2009 +0200
+++ b/WindowSensor.st Mon Oct 12 14:50:33 2009 +0200
@@ -1962,29 +1962,31 @@
"update the state of the shiftDown/metaDown and ctrlDown
flags"
- (key = #Shift
- or:[key = #'Shift_R'
- or:[key = #'Shift_L']]) ifTrue:[
+ (key == #Shift
+ or:[key == #'Shift_R'
+ or:[key == #'Shift_L']]) ifTrue:[
shiftDown := onOrOff.
^ self
].
- (key = #Alt
- or:[key = #'Alt_R' or:[key = #'Alt_L']]) ifTrue:[
+ (key == #Alt
+ or:[key == #'Alt_R' or:[key == #'Alt_L']]) ifTrue:[
altDown := onOrOff.
^ self
].
- (key = #Meta
- or:[key = #'Meta_R' or:[key = #'Meta_L']]) ifTrue:[
+ (key == #Meta
+ or:[key == #'Meta_R' or:[key == #'Meta_L']]) ifTrue:[
metaDown := onOrOff.
^ self
].
- (key = #Ctrl
- or:[key = #'Ctrl_R' or:[key = #'Ctrl_L']]) ifTrue:[
- ctrlDown := onOrOff.
+ (key == #Ctrl
+ or:[key == #'Ctrl_R' or:[key == #'Ctrl_L']]) ifTrue:[
+ ctrlDown ~~ onOrOff ifTrue:[
+ ctrlDown := onOrOff.
+ ].
^ self
].
- (key = #Control
- or:[key = #'Control_R' or:[key = #'Control_L']]) ifTrue:[
+ (key == #Control
+ or:[key == #'Control_R' or:[key == #'Control_L']]) ifTrue:[
ctrlDown := onOrOff.
^ self
].
@@ -2060,6 +2062,16 @@
setShiftDown:aBoolean
shiftDown := aBoolean.
+!
+
+updateModifierStatesFrom:anotherSensor
+ "update the state of the shiftDown, metaDown and ctrlDown flags
+ from another window sensor"
+
+ shiftDown := anotherSensor shiftDown.
+ altDown := anotherSensor altDown.
+ metaDown := anotherSensor metaDown.
+ ctrlDown := anotherSensor ctrlDown.
! !
!WindowSensor methodsFor:'event queue'!
@@ -3307,7 +3319,11 @@
!WindowSensor class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/WindowSensor.st,v 1.260 2009-06-01 08:43:42 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/WindowSensor.st,v 1.261 2009-10-12 12:50:33 cg Exp $'
+!
+
+version_CVS
+ ^ '$Header: /cvs/stx/stx/libview/WindowSensor.st,v 1.261 2009-10-12 12:50:33 cg Exp $'
! !
WindowSensor initialize!