[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: programming delays.



=> 
=> 
=> In my program transformation tool, I would like to include an automatic mode
=> in which:
=> 
=> - transformations are read from a file.
=> 
=> - for each transformation:
=> 
=>                - the target is highlighted.
=> 
=>                - a delay occurs.
=> 
=>                - the transformation is performed.
=> 
=> I can do each of these sub-operations, but I don't succeed in doing them  in
=> the above order. Whatever I do, the delay occurs first, then the highlighting.
=> However I specify first the redisplay and then the delay. I suppose there  is
=> a problem of communicating processes...

Yes, the X server and Centaur are not synchronised.

Here is a small function to perform animation (on the {current}
selection):

(de anim (ctedit tree)
    ({selection}:change
     ({ctedit}:find-selection ctedit
			      '{current}
			      )
     ({tree}:path tree)
     )
    (when ({ctedit}:update-select ctedit
				  ({ctedit}:find-select ctedit
							'{current}
							)
				  )
	  ({ctedit}:scroll-to-selection
	   ctedit
	   '{current}
	   )
	  ({ctedit}:incremental-redisplay ctedit)
	  (bitmap-sync) ;; (1)
	  (process-pending-events) ;; (2)
	  (sleep 1) ;; (3)
	  )
    )

(1) : to make sure that all buffered X protocol calls are
performed, and that the X server has sent back to Centaur all
relevant X events.

(2) : to process X events stored in the input queue.

(3) : to wait a bit (otherwise, Centaur display is really to fast).


	Vincent Prunet