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?

Andre,

On 11/23/01 9:24 AM, "Andre Weinand" <weinand@xxxxxxx> wrote:

> 
> Maurice,
> 
>> Can you point me to an example of this being done in the Examples or the
>> Eclipse source?  IMHO the message pump (readAndDispatch / sleep) shouldn't
>> be exposed outside of the SWT packages anyway.  Everyplace that I have have
>> seen readAndDispatch used, nothing interesting is happening in the loop
>> anyway.
> 
> I just searched for all references to readAndDispatch in an Eclipse workspace
> and found 15 occurences, one of them org.eclipse.jface.operation.ModalContext.
> This case and others use readAndDispatch to implement a form of modality.

Ahhh.  I see my mistake now.  I had thought that the event model would be
encapsulated in SWT.  My not so brilliant plan was to use NSApplication.
RunModalForWindow() for modal loops.  Oops, looks like that code is in Jface
and beyond the scope of what I want to do.  So it does look like we will
have to implement the readAndDispatch/sleep message pump.

>> Combined with the fact that readAndDispatch does *not* guarantee that it
>> will return after processing a single event (it may have some others it
>> needs to process), I didn't think that I was breaking it's behavior too
>> badly.
> I've read the doc again and I think that it processes at most one OS event
> and possibly more inter-thread messages.
> May be somone from the SWT team can help?

Do you mean read the JavaDoc again?  Mike mentioned a spec, but I can't find
anything else on eclipse.org.  Do I have all the information I need to
reimplement SWT accurately?
 
>> I could be wrong.  Show me where an application does something interesting
>> while in message pump loop and I will have to change my opinion.  ;-)
> 
> I think nobody does anything interesting in an event loop besides having a
> special expression for terminating the loop and leaving the modal mode.

Makes ya wonder why this isn't part of Display, huh?  ;-)

>> Bottom line though is that if I do have to do a message pump style event
>> model, NSApplication can be subclassed and all events sent from the Window
>> Manager to the application can be intercepted by overriding sendEvent() and
>> put into a queue that readAndDispatch works it's way through.
> 
> Yes, that sounds feasible.
> I'll try whether I can get some of
> Eclipse's special uses of readAndDispatch() to work.

Should we set up a SourceForge project to make it easier to share code?  I
would prefer that patterns were in place to handle Cocoa object creation,
communication, and disposal before opening up the projects to all comers.
Once a couple of good examples are in place it will just be a matter of
bridging functionality and almost anyone who can read JavaDocs and code Java
should be able to help out.

-Maurice



Back to the top