DeviceWorkstation.st
branchjv
changeset 8073 fd95fdcb8533
parent 7970 43c6888f5f92
child 8077 08cff8ab7e0a
equal deleted inserted replaced
8016:653376a94c8f 8073:fd95fdcb8533
  5166      or a numeric keysym code. If state is nil, the modifier bits (shift & control)
  5166      or a numeric keysym code. If state is nil, the modifier bits (shift & control)
  5167      are computed from the keyboardMap - if non-nil, these are passed as modifierbits.
  5167      are computed from the keyboardMap - if non-nil, these are passed as modifierbits.
  5168      The non-nil case is the lowlevel entry, where state must include any shift/ctrl information
  5168      The non-nil case is the lowlevel entry, where state must include any shift/ctrl information
  5169      (not very user friendly)"
  5169      (not very user friendly)"
  5170 
  5170 
  5171     self subclassResponsibility
  5171     "/ WARNING: this is a generic implementation that completely bypasses underlaying
       
  5172     "/ system event queue. It may not be complete - it has been written as a quick hack
       
  5173     "/ to make UI testing framework kind-of working on systems where there's no proper
       
  5174     "/ implementation of this method (e.g., Windows at the time)
       
  5175 
       
  5176     | view shiftWasDown ctrlWasDown altWasDown metaWasDown |
       
  5177 
       
  5178     view := self viewFromId: targetId.
       
  5179 
       
  5180     [
       
  5181         shiftWasDown := shiftDown.
       
  5182         altWasDown := altDown.
       
  5183         metaWasDown := metaDown.
       
  5184         ctrlWasDown := ctrlDown.
       
  5185         stateMask notNil ifTrue:[ 
       
  5186             shiftDown := (stateMask bitAnd: self shiftModifierMask) ~~ 0.
       
  5187             altDown := (stateMask bitAnd: self altModifierMask) ~~ 0.
       
  5188             metaDown := (stateMask bitAnd: self metaModifierMask) ~~ 0.
       
  5189             ctrlDown := (stateMask bitAnd: self ctrlModifierMask) ~~ 0.
       
  5190         ].
       
  5191         (typeSymbol == #keyPress or:[ typeSymbol == #keyRelease ]) ifTrue:[
       
  5192             | key |
       
  5193 
       
  5194             key := keySymCodeOrButtonNr.
       
  5195             (#(Left Right Up Down) includes: key) ifTrue:[ 
       
  5196                 key := (#Cursor , key) asSymbol.
       
  5197             ].
       
  5198             typeSymbol == #keyPress ifTrue:[
       
  5199                 self keyPress:key x:1 y:1 view:view.
       
  5200             ] ifFalse:[
       
  5201                 self keyRelease:key x:1 y:1 view:view.
       
  5202             ]
       
  5203         ] ifFalse:[  
       
  5204             self notYetImplemented.
       
  5205         ].
       
  5206     ] ensure:[ 
       
  5207         shiftDown := shiftWasDown.
       
  5208         altDown := altWasDown.
       
  5209         metaDown := metaWasDown.
       
  5210         ctrlDown := ctrlWasDown.
       
  5211     ].
       
  5212 
       
  5213     "Modified (comment): / 06-05-2017 / 11:15:25 / jv"
  5172 !
  5214 !
  5173 
  5215 
  5174 simulateKeyboardInput:aCharacterOrString inViewId:viewId
  5216 simulateKeyboardInput:aCharacterOrString inViewId:viewId
  5175     "send input to some other view, by simulating keyPress/keyRelease
  5217     "send input to some other view, by simulating keyPress/keyRelease
  5176      events.
  5218      events.