Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] MacOS X port status?

Jeff,

Thanks for the excellent and detailed info!

On 11/23/01 1:27 PM, "Jeff Brown" <j9brown@xxxxxxxxxxxxxxxxx> wrote:

> <idle_rambling>
> 
> Personally, I'm somewhat disappointed by the openness of that API
> as it is error prone and not very useful except perhaps to construct
> modal loops.  Invariably this amounts to nesting an event loop within
> the dispatch portion of some outer event loop.  Among other things,
> this means for SWT implementers that some care must be taken when
> user event handlers are invoked immediately via sendEvent() instead
> of being deferred via postEvent() since sendEvent() might not return
> "prompty", and the message queue may be a few events shorter when
> it does.
> 
> IMHO, rather than worrying about the added complexity involved with
> possible nesting of event loops, perhaps some higher-level modality
> support could be constructed.  Unfortunately, I can't think of any
> ways to do this without breaking the SWT event model in some way.
> Any ideas?
> 
> </idle_rambling>

I agree completely about the openness of the event API causing problems.
Because the message pump was exposed outside of SWT, I have had to implement
a suboptimal solution for Cocoa.  By inserting an unnecessary chunk of Java
into the middle of Cocoa's event loop, I have no doubt that event handling
performance has been impacted.

Shooting from the hip, I think you could implement a run() method in Display
that does the normal event loop and a runModalContext() to do modal loops
(replacing the Jface ModalContext).  Then deprecate readAndDispatch() and
sleep().  According to Mike, this would take an act of Congress to get done.
;-)  I'm not going to hold my breath.

If the Cocoa version of SWT ever gets to the self-hosting phase, I will go
ahead and implement the run()/runModalContext() combo and go through Eclipse
and update the code to use the more theoretically more efficient methods.  I
would be a PITA, but the payoff could be substantial.

-Maurice



Back to the top