Path: utzoo!attcan!uunet!seismo!sundc!pitstop!sun!decwrl!labrea!bloom-beacon!home.csc.ti.COM!Oren From: Oren@home.csc.ti.COM (LaMott Oren) Newsgroups: comp.windows.x Subject: Re: Detecting/Compressing Multiple Exposure Events - how ? Message-ID: <2798113409-14017620@SI> Date: 1 Sep 88 13:43:29 GMT Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 46 Date: 31 Aug 88 18:44:11 GMT From: sandra@cs.utah.edu (Sandra J Loosemore) Subject: Re: Detecting/Compressing Multiple Exposure Events - how ? Any clues on how to do this in CLX? I just tried some experiments with using an EVENT-CASE with :timeout 0 and :discard-p t to scan through the event queue, discarding all but the first expose event on a window. But returning T from the clause to indicate that the event should be kept would also exit from the EVENT-CASE, so you'd never see whether there are more expose events in the queue or not. I tried doing a recursive call to EVENT-CASE to look at the remaining events, but that seemed to end up throwing out events it shouldn't have. I'd appreciate seeing a bit of code that actually works. -Sandra Loosemore Instead of discarding all but the first, discard all but the last. That is, when you receive an :exposure event, ignore it if there's another in the queue using: (event-case (display :discard-p t :force-output-p t) (exposure (window count) (unless ;; Ignore all but the last exposure event (event-case (window :discard-p nil :peek-p t :timeout 0) (exposure ((window event-window)) (window-equal window event-window))) (refresh window))) ;; handle other events... ) This technique works well for :motion-notify and enter/leave-notify event compression. If you really want to discard all but the first exposure event, the release 3 version of CLX contains a new form, EVENT-COND, which will give you the control you want. An easy way to compress exposure events is to ignore all events with a non-zero count: (event-case (display :discard-p t :force-output-p t) (exposure (window count) (when (zerop count) ;; Ignore all but the last exposure event (refresh window))) ;; handle other events... )