Re: [AD] Non C program accessing Allegro on OS X

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]



Jon Rafkind wrote:


I just had a go with a test program (nothing as complicated as Allegro). It confirmed what I thought, i.e [NSApplication run] _does_ have to be called by thread 1, otherwise the icon just bounces for ever in the dock and, as you say, the notifications never run.

Argh!

According to the mzscheme docs, they implement their own thread system. Can you use this to run the message pump, somehow?

Hm, like what do you mean exactly? Do you mean something like

void messagePump(){
    if (osx_gfx_mode == OSX_GFX_WINDOW)
        osx_update_dirty_lines();
     _unix_lock_mutex(osx_event_mutex);
     if (osx_gfx_mode == OSX_GFX_FULL) {
        if ((osx_palette) && (osx_palette_dirty)) {
           CGDisplaySetPalette(kCGDirectMainDisplay, osx_palette);
       osx_palette_dirty = FALSE;
    }
     }
     osx_event_handler();
     _unix_unlock_mutex(osx_event_mutex);
}

then in mzscheme

(while true
   (do-stuff)
   (messagePump))

or something? I suppose this is reasonable but scheme aint the fastest thing in the world and then the overhead of calling Allegro might be costly, but if this is the only way then I will see what I can do.

Actually I sort of tried this and it failed. What I did was run (hack_the_mac) from scheme which in turn set up the NSApp stuff with the [NSApp run] at the end. Apparently this method never returns since it runs its own system event loop or something. I guess I would have to override the run method in NSApp and deal with system events myself or something, but I couldnt find any code online that did this so Im at a bit of a loss. Know of any tutorials or example code about overriding the run method, Peter( or anyone else )?




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/