SynchronousWindowSensor.st
changeset 266 1e234d542ef9
parent 264 fc9ecf4814a0
child 267 5728c37ff3f6
equal deleted inserted replaced
265:f5f8c8d19842 266:1e234d542ef9
     1 "
     1 "
     2  COPYRIGHT (c) 1995 by Claus Gittinger
     2  COPYRIGHT (c) 1993 by Claus Gittinger
     3               All Rights Reserved
     3               All Rights Reserved
     4 
     4 
     5  This software is furnished under a license and may be used
     5  This software is furnished under a license and may be used
     6  only in accordance with the terms of that license and with the
     6  only in accordance with the terms of that license and with the
     7  inclusion of the above copyright notice.   This software may not
     7  inclusion of the above copyright notice.   This software may not
    35 
    35 
    36 documentation
    36 documentation
    37 "
    37 "
    38     in contrast to a regular windowSensor, instances of SynchronousWindowSensor
    38     in contrast to a regular windowSensor, instances of SynchronousWindowSensor
    39     do NOT put events into a queue and do NOT wakeup any windowGroup process.
    39     do NOT put events into a queue and do NOT wakeup any windowGroup process.
    40     These are used for only one single situation: when a modal debugger
    40     Instead, the underlying view is notified synchronously (via a message send)
    41     (i.e. one that is debugging the scheduler or event-dispatcher) is open.
    41     about the event.
       
    42 
       
    43     These are used for only one single situation: 
       
    44         when a modal debugger is open
       
    45     (i.e. one that is debugging the scheduler or event-dispatcher).
    42     This debuggers windowGroup is augmented with a synchronous Sensor, in order
    46     This debuggers windowGroup is augmented with a synchronous Sensor, in order
    43     to prevent the event handling code from suspending any process 
    47     to prevent the event handling code from suspending any process 
    44     (you cannot suspend the scheduler).
    48     (you cannot suspend the scheduler; you should not suspend the event dispatcher).
       
    49 
    45     This is pretty tricky and magic - you dont have to understand this.
    50     This is pretty tricky and magic - you dont have to understand this.
    46     (consider this system internal code)
    51     (consider this system internal code)
    47 "
    52 "
    48 ! !
    53 ! !
    49 
    54 
   192 
   197 
   193 keyPress:untranslatedKey x:x y:y view:aView
   198 keyPress:untranslatedKey x:x y:y view:aView
   194     "forward a key-press event for some view"
   199     "forward a key-press event for some view"
   195 
   200 
   196     |xlatedKey|
   201     |xlatedKey|
       
   202 
       
   203     self key:untranslatedKey state:true. 
   197 
   204 
   198     xlatedKey := device translateKey:untranslatedKey.
   205     xlatedKey := device translateKey:untranslatedKey.
   199     xlatedKey notNil ifTrue:[
   206     xlatedKey notNil ifTrue:[
   200         WindowEvent
   207         WindowEvent
   201           sendEvent:#keyPress:x:y:
   208           sendEvent:#keyPress:x:y:
   202           arguments:(Array with:xlatedKey with:x with:y)
   209           arguments:(Array with:xlatedKey with:x with:y)
   203           view:aView
   210           view:aView
   204     ]
   211     ]
   205 
   212 
   206     "Created: 24.11.1995 / 19:17:23 / cg"
   213     "Created: 24.11.1995 / 19:17:23 / cg"
   207     "Modified: 24.11.1995 / 19:19:25 / cg"
   214     "Modified: 25.11.1995 / 10:21:26 / cg"
   208 !
   215 !
   209 
   216 
   210 keyRelease:untranslatedKey x:x y:y view:aView
   217 keyRelease:untranslatedKey x:x y:y view:aView
   211     "forward a key-release event for some view"
   218     "forward a key-release event for some view"
   212 
   219 
   213     |xlatedKey|
   220     |xlatedKey|
       
   221 
       
   222     self key:untranslatedKey state:false. 
   214 
   223 
   215     xlatedKey := device translateKey:untranslatedKey.
   224     xlatedKey := device translateKey:untranslatedKey.
   216     xlatedKey notNil ifTrue:[
   225     xlatedKey notNil ifTrue:[
   217         WindowEvent
   226         WindowEvent
   218             sendEvent:#keyRelease:x:y:
   227             sendEvent:#keyRelease:x:y:
   219             arguments:(Array with:xlatedKey with:x with:y)
   228             arguments:(Array with:xlatedKey with:x with:y)
   220             view:aView
   229             view:aView
   221     ]
   230     ]
   222 
   231 
   223     "Created: 24.11.1995 / 19:17:50 / cg"
   232     "Created: 24.11.1995 / 19:17:50 / cg"
   224     "Modified: 24.11.1995 / 19:19:28 / cg"
   233     "Modified: 25.11.1995 / 10:21:37 / cg"
   225 !
   234 !
   226 
   235 
   227 mappedView:aView
   236 mappedView:aView
   228     "forward a mapped event for some view"
   237     "forward a mapped event for some view"
   229 
   238 
   317 ! !
   326 ! !
   318 
   327 
   319 !SynchronousWindowSensor class methodsFor:'documentation'!
   328 !SynchronousWindowSensor class methodsFor:'documentation'!
   320 
   329 
   321 version
   330 version
   322     ^ '$Header: /cvs/stx/stx/libview/SynchronousWindowSensor.st,v 1.1 1995-11-24 22:32:48 cg Exp $'
   331 ^ '$Header: /cvs/stx/stx/libview/SynchronousWindowSensor.st,v 1.2 1995-11-25 09:24:12 cg Exp $'! !
   323 ! !