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

Re: MrEd event handling

Matthew Flatt <mflatt@cs.utah.edu> writes:
>> I would like to process always just the newest event in the queue
>> and discard/dispatch all other on-paint events that are waiting the
>> queue.
>It's a shame that the X event dispatcher doesn't already do this for
>I suppose MrEd could peek ahead in the event queue and collapse update
>events itself. It doesn't sound difficult, but I'm not sure.

Doesn't the X Toolkit do this? I'm not sure if it's exactly the same
thing, but the compress_exposures flag in Xt widgets should do
something close to this. It also updates the region of the generated
Expose event to be the union of the rectangles in the individual
events (not just the bounding box).

>> Also if I get an on-paint event it would be nice to find
>> out which region of my canvas has been damaged and needs
>> to be repainted.
>No. In principle, it wouldn't be too difficult to add an operatio that
>gets the bounding box of the current update region.
>I have to say, though, that I've never found such an operation to be
>useful. It's often worthwhile to limit drawing to the current visible
>region, but I've never seen fine-grained masking pay off.

I've seen the speed difference every now and then, in various X
applications that I've used over the years. When I notice it, it makes
me think the programmer was lazy, but otherwise it usually isn't very

For example, if the application copies the display from a pre-drawn
buffer (as, e.g., image viewers and games often do), there is quite a
large difference in the amount of memory operations if you only need
to copy a small part of the window. It might be most noticeable when
the data is copied over the network from a client-side buffer (e.g.,
an XImage) and the window is gradually moved from under another so
that small parts become visible at a time.

-=- Rjs -=- Riku.Saikkonen@hut.fi
"I'm more than sympathetic to [source code availability]; I consider
that absolutely indispensable for progress."  -- D. E. Knuth