error in AUPublic/AUCarbonViewBase/CarbonEventHandler
error in AUPublic/AUCarbonViewBase/CarbonEventHandler
- Subject: error in AUPublic/AUCarbonViewBase/CarbonEventHandler
- From: Brandon Ware <email@hidden>
- Date: Wed, 2 Oct 2002 06:25:08 -0400
In CarbonEventHandler.h/cc, if you call WantEventTypes for two or more
different targets, only the latest registered handler and target will
be called. CarbonEventHandler checks to see if a handler has been
registered, and if so, just adds the event type to the handler, even if
it has a different target. The fix is to keep track of the
handler-target combination:
-- CarbonEventHandler.h --
#include <map>
...
protected:
/*! @var mHandler */
typedef std::map<EventTargetRef, EventHandlerRef> Handlers;
Handlers mHandlers;
};
-- CarbonEventHandler.cpp --
...
CarbonEventHandler::~CarbonEventHandler()
{
for( Handlers::iterator i = mHandlers.begin();
i != mHandlers.end();
++i )
{
if( i->second )
RemoveEventHandler(i->second);
}
}
void CarbonEventHandler::WantEventTypes(EventTargetRef target, UInt32
inNumTypes, const EventTypeSpec *inList)
{
Handlers::iterator iHandler = mHandlers.find(target);
if(iHandler == mHandlers.end())
{
EventHandlerRef handler = 0;
verify_noerr(InstallEventHandler(target, TheEventHandler, inNumTypes,
inList, this, &handler));
mHandlers[target] = handler;
}
else
{
verify_noerr(AddEventTypesToHandler(iHandler->second, inNumTypes,
inList));
}
}
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.