From: Yves S. <yst...@uw...> - 2002-05-22 01:49:28
|
Hi, I am trying to get a Carbon window that I create and provide with an EventHandler to be sent some events in an embedded tcl application. In Win32, all events come through to the handler. On OSX, I am only getting activate events - mouse and keyboard events are siphoned off. Is there a function I can call that prevents this from happening? Thanks. Yves |
From: Jim I. <ji...@ap...> - 2002-05-22 06:19:01
|
Is this an embedded Tcl application, or are you also using Aqua Tk. If the former, you will have to do quite a bit of work to get this going. Look at the Aqua Tk sources to get started. If you are also using Aqua Tk, then I started to think about this when we were doing the Carbonization, but didn't get all the way there. The idea is in the code (which is the core of the Tk event converter): static int ReceiveAndProcessEvent() { TkMacOSXEvent macEvent; MacEventStatus eventStatus; int err; char buf [ 256 ]; /* * This is a poll, since we have already counted the events coming * into this routine, and are guaranteed to have one waiting. */ err=ReceiveNextEvent(0, NULL, kEventDurationNoWait, true, &macEvent.eventRef); if (err != noErr) { return err; } else { macEvent.eClass = GetEventClass(macEvent.eventRef); macEvent.eKind = GetEventKind(macEvent.eventRef); bzero(&eventStatus, sizeof(eventStatus)); TkMacOSXProcessEvent(&macEvent,&eventStatus); if (!eventStatus.handledByTk) { if (!targetRef) { targetRef=GetEventDispatcherTarget(); } err= SendEventToEventTarget(macEvent.eventRef,targetRef); if (err != noErr /* && err != eventNotHandledErr */) { fprintf(stderr, "RCNE SendEventToEventTarget (%s) failed, %d\n", CarbonEventToAscii(macEvent.eventRef,buf ),err); } } ReleaseEvent(macEvent.eventRef); return 0; } } So if any of the individual event handlers sets handledByTk to 0, it will bet passed to the Event handler registered in the targetRef of the event. It is not wired up, however. So, for instance try a patch like: Index: tkMacOSXMouseEvent.c =================================================================== RCS file: /cvsroot/tktoolkit/tk/macosx/Attic/tkMacOSXMouseEvent.c,v retrieving revision 1.1.2.2 diff -p -r1.1.2.2 tkMacOSXMouseEvent.c *** tkMacOSXMouseEvent.c 5 Feb 2002 02:25:17 -0000 1.1.2.2 --- tkMacOSXMouseEvent.c 22 May 2002 06:10:22 -0000 *************** TkMacOSXProcessMouseEvent(TkMacOSXEvent *** 171,177 **** medPtr->windowPart= FindWindow(where, &medPtr->whichWin); window = TkMacOSXGetXWindow(medPtr->whichWin); ! frontWindow = FrontWindow(); medPtr->activeNonFloating = ActiveNonFloatingWindow(); --- 171,181 ---- medPtr->windowPart= FindWindow(where, &medPtr->whichWin); window = TkMacOSXGetXWindow(medPtr->whichWin); ! if (medPtr->whichWin != NULL && window == None) { ! statusPtr->handledByTk = 0; ! return 0; ! } ! frontWindow = FrontWindow(); medPtr->activeNonFloating = ActiveNonFloatingWindow(); This will make all mouse events that are in a window that is NOT Tk's will be dispatched to the Event handler for the window. This is probably wrong, I just hacked it in quickly tonight. Probably better would be to check & make sure the unrecognized window is the FRONT window. This doesn't deal with the other events, like Activate, Keystroke, Menu events when your window is in the front. Adding these behaviors is pretty straightforward, but I have to think a bit more about when exactly to send the events to the unrecognized window... Jim > Hi, > > I am trying to get a Carbon window that I create and provide with an > EventHandler to be sent some events in an embedded tcl application. In > Win32, all events come through to the handler. On OSX, I am only getting > activate events - mouse and keyboard events are siphoned off. > > Is there a function I can call that prevents this from happening? > > Thanks. > > Yves > > > _______________________________________________________________ > > Don't miss the 2002 Sprint PCS Application Developer's Conference > August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm > > _______________________________________________ > Tcl-mac mailing list > Tc...@li... > https://lists.sourceforge.net/lists/listinfo/tcl-mac > -- ++=++=++=++=++=++=++=++=++=++=++=++=++=++=++=++=++=++=++= Jim Ingham ji...@ap... Developer Tools - gdb |