DeviceWorkstation.st
branchjv
changeset 8077 08cff8ab7e0a
parent 8057 e3d9945d5d9f
parent 8073 fd95fdcb8533
child 8420 76e39223f5ab
equal deleted inserted replaced
8076:53f81628e70c 8077:08cff8ab7e0a
  5321      or a numeric keysym code. If state is nil, the modifier bits (shift & control)
  5321      or a numeric keysym code. If state is nil, the modifier bits (shift & control)
  5322      are computed from the keyboardMap - if non-nil, these are passed as modifierbits.
  5322      are computed from the keyboardMap - if non-nil, these are passed as modifierbits.
  5323      The non-nil case is the lowlevel entry, where state must include any shift/ctrl information
  5323      The non-nil case is the lowlevel entry, where state must include any shift/ctrl information
  5324      (not very user friendly)"
  5324      (not very user friendly)"
  5325 
  5325 
  5326     self subclassResponsibility
  5326     "/ WARNING: this is a generic implementation that completely bypasses underlaying
       
  5327     "/ system event queue. It may not be complete - it has been written as a quick hack
       
  5328     "/ to make UI testing framework kind-of working on systems where there's no proper
       
  5329     "/ implementation of this method (e.g., Windows at the time)
       
  5330 
       
  5331     | view shiftWasDown ctrlWasDown altWasDown metaWasDown |
       
  5332 
       
  5333     view := self viewFromId: targetId.
       
  5334 
       
  5335     [
       
  5336         shiftWasDown := shiftDown.
       
  5337         altWasDown := altDown.
       
  5338         metaWasDown := metaDown.
       
  5339         ctrlWasDown := ctrlDown.
       
  5340         stateMask notNil ifTrue:[ 
       
  5341             shiftDown := (stateMask bitAnd: self shiftModifierMask) ~~ 0.
       
  5342             altDown := (stateMask bitAnd: self altModifierMask) ~~ 0.
       
  5343             metaDown := (stateMask bitAnd: self metaModifierMask) ~~ 0.
       
  5344             ctrlDown := (stateMask bitAnd: self ctrlModifierMask) ~~ 0.
       
  5345         ].
       
  5346         (typeSymbol == #keyPress or:[ typeSymbol == #keyRelease ]) ifTrue:[
       
  5347             | key |
       
  5348 
       
  5349             key := keySymCodeOrButtonNr.
       
  5350             (#(Left Right Up Down) includes: key) ifTrue:[ 
       
  5351                 key := (#Cursor , key) asSymbol.
       
  5352             ].
       
  5353             typeSymbol == #keyPress ifTrue:[
       
  5354                 self keyPress:key x:1 y:1 view:view.
       
  5355             ] ifFalse:[
       
  5356                 self keyRelease:key x:1 y:1 view:view.
       
  5357             ]
       
  5358         ] ifFalse:[  
       
  5359             self notYetImplemented.
       
  5360         ].
       
  5361     ] ensure:[ 
       
  5362         shiftDown := shiftWasDown.
       
  5363         altDown := altWasDown.
       
  5364         metaDown := metaWasDown.
       
  5365         ctrlDown := ctrlWasDown.
       
  5366     ].
       
  5367 
       
  5368     "Modified (comment): / 06-05-2017 / 11:15:25 / jv"
  5327 !
  5369 !
  5328 
  5370 
  5329 simulateKeyboardInput:aCharacterOrString inViewId:viewId
  5371 simulateKeyboardInput:aCharacterOrString inViewId:viewId
  5330     "send input to some other view, by simulating keyPress/keyRelease
  5372     "send input to some other view, by simulating keyPress/keyRelease
  5331      events.
  5373      events.