SynchronousWindowSensor.st
branchjv
changeset 7286 c3b4c3c664d4
parent 7077 8827f34a4667
parent 7259 40a7c1e90b43
child 7541 39940e2446a5
equal deleted inserted replaced
7285:d047c5fb149a 7286:c3b4c3c664d4
     1 "{ Encoding: utf8 }"
       
     2 
       
     3 "
     1 "
     4  COPYRIGHT (c) 1995 by Claus Gittinger
     2  COPYRIGHT (c) 1995 by Claus Gittinger
     5 	      All Rights Reserved
     3 	      All Rights Reserved
     6 
     4 
     7  This software is furnished under a license and may be used
     5  This software is furnished under a license and may be used
   216 !
   214 !
   217 
   215 
   218 waitForExposeFor:aView
   216 waitForExposeFor:aView
   219     "wait until a graphicsExpose or a noExpose arrives (after a bitblt)."
   217     "wait until a graphicsExpose or a noExpose arrives (after a bitblt)."
   220 
   218 
   221     |device windowId stopPoll endPollTime|
   219     |viewsDevice windowId stopPoll endPollTime|
   222 
   220 
   223     device := aView graphicsDevice.
   221     viewsDevice := aView graphicsDevice.
   224 
   222 
   225     "/ this is only needed for X ...
   223     "/ this is only needed for X ...
   226     device scrollsAsynchronous ifTrue:[
   224     viewsDevice scrollsAsynchronous ifTrue:[
   227         windowId := aView id.
   225         windowId := aView id.
   228 
   226 
   229         "/
   227         "/
   230         "/ cannot suspend, I am a synchronous-modal sensor
   228         "/ cannot suspend, I am a synchronous-modal sensor
   231         "/ must poll for the event
   229         "/ must poll for the event
   232         "/
   230         "/
   233         endPollTime := Timestamp now addSeconds:2.
   231         endPollTime := Timestamp now addSeconds:2.
   234         stopPoll := false.
   232         stopPoll := false.
   235 
   233 
   236         [(gotExpose includes:aView) or:[stopPoll]] whileFalse:[
   234         [(gotExpose includes:aView) or:[stopPoll]] whileFalse:[
   237             (device exposeEventPendingFor:windowId withSync:true) ifTrue:[
   235             (viewsDevice exposeEventPendingFor:windowId withSync:true) ifTrue:[
   238                 device dispatchExposeEventFor:windowId.
   236                 viewsDevice dispatchExposeEventFor:windowId.
   239             ].
   237             ].
   240             stopPoll := Timestamp now > endPollTime.
   238             stopPoll := Timestamp now > endPollTime.
   241             Processor yield.
   239             Processor yield.
   242         ].
   240         ].
   243 
   241