'From Squeak3.2 of 11 July 2002 [latest update: #4935] on 5 August 2002 at 3:36 pm'! "Change Set: KeyUnSwap-nk Date: 2 August 2002 Author: Ned Konz PREREQUISITE: This requires the KeysAtValue-nk CS. This CS adds the ability to re-construct the original (i.e. with ctrl/alt unswapped) key event from an event. This is useful in (for instance) a Telnet or Xterm for passing ctrl- characters through untouched. "! !InputSensor class methodsFor: 'public' stamp: 'nk 8/2/2002 10:36'! unSwappedKeyEvent: evt "Answer a (possibly new) event with the key and modifier info set to represent the original (unswapped) keycode. Note that if you're duplicating ctrl and alt keys, this will return a control key." | swapped best originals | swapped _ { evt keyValue. evt buttons bitShift: -3 }. originals _ KeyDecodeTable keysAtValue: swapped ifNone: [ ^evt ]. best _ originals detect: [ :ea | ea ~= swapped ] ifNone: [ ^evt ]. ^KeyboardEvent new setType: evt type buttons: (best second bitShift: 3) position: evt position keyValue: best first hand: evt hand stamp: evt timeStamp! ! !KeyboardEvent methodsFor: 'swapping' stamp: 'nk 8/2/2002 09:04'! unswapped "Answer a version of me that reflects the actual keypress, if possible" ^InputSensor unSwappedKeyEvent: self! !