I'm very confused. The SIGIO timer is used *only* for C-g. It has nothing to
do with any other events. (sit-for 0) ought to
(1) cause all pending non-command events to get executed, and
(b) do redisplay
However, sit-for gets preempted by input coming in.
What about (sit-for 0.1)?
I suppose a solution along the lines of dispatch-non-command-events might be OK
if you've tried everything else and it doesn't work, but i'm leery of
introducing new Lisp functions to deal with specific problems. Pretty soon we
end up with a whole bevy of such ill-defined functions, like we already have.
I think instead, you should introduce the following primitive:
(wait-for-event redisplay &rest event-specs)
Waits for one of the event specifications specified to happen. Returns
something about what happened.
REDISPLAY controls the behavior of redisplay during waiting. Something like
nil (never redisplay),
t (redisplay when it seems appropriate), etc.
EVENT-SPECS could be
t -- drain all non-user events, and then return
any-process -- wait till input or state change on any process
process -- wait till input or state change on process
time -- wait till such-and-such time has elapsed
'user -- wait till user event has happened
'(user predicate) -- wait till user event matching the predicate has
happened
'event -- wait till any event has happened
'(event predicate) -- wait till event matching the predicate has happened
The existing functions `next-event', `next-command-event',
`accept-process-output', `sit-for', `sleep-for', etc. could all be written in
terms of this new command. You could use this command inside of your glyph
code to ensure that the events get processed that need do in order for widget
updates to happen.
But you said something about need a magic event to invoke redisplay? Why is
that?
I also don't understand what you say about "exiting the event loop". I
wonder
if perhaps you don't completely understand how the XEmacs event loop works?
Point me to the section of the widget code that deals with events, and I'll try
to look at it and see if I can figure something out; I'm almost certain i can
come up with a better way of doing things.
{But in the meanwhile if you felt like creating the `wait-for-event' primitive
I mentioned above).
ben
Andy Piper wrote:
At 07:46 PM 3/21/00 -0700, Ben Wing wrote:
>Andy, I don't like dispatch-non-command-events. What's wrong with
(sit-for 0)?
The problem I am trying to solve is that for native widgets to show up you
have to exit the XEmacs event loop. (sit-for 0) doesn't necessarily do this
as far as I can tell - although that may be due to SIGIO brokeness under
cygwin. If you use BROKEN_SIGIO the timer does not happen quickly enough to
cause, for instance, widgets in thr progress gauge to show up.
I'm happy to consider other possibilities. What I want is something that:
a) will pick up someone trying to click on a button
b) return control to the native event loop.
andy
--------------------------------------------------------------
Dr Andy Piper
Senior Consultant Architect, BEA Systems Ltd
--
Ben
In order to save my hands, I am cutting back on my mail. I also write
as succinctly as possible -- please don't be offended. If you send me
mail, you _will_ get a response, but please be patient, especially for
XEmacs-related mail. If you need an immediate response and it is not
apparent in your message, please say so. Thanks for your understanding.
See also
http://www.666.com/ben/typing.html.