Re: recieving mouseMoved: events when inactive
Re: recieving mouseMoved: events when inactive
- Subject: Re: recieving mouseMoved: events when inactive
- From: Ryan Britton <email@hidden>
- Date: Thu, 1 Jun 2006 20:49:43 -0700
How can I get mouseMoved: events when my application is inactive?
Carbon. Depending on your needs, you may also want to add an event
handler to the application event target or the window event target.
EventHandlerRef trackMouseGlobal;
OSStatus mouseActivated(EventHandlerCallRef nextHandler, EventRef
theEvent, void *userData)
{
[yourController mouseMoved];
return CallNextEventHandler(nextHandler, theEvent);
}
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
//Add in a global handler
EventTypeSpec globalEventType[2];
globalEventType[0].eventClass = kEventClassMouse;
globalEventType[0].eventKind = kEventMouseMoved;
globalEventType[1].eventClass = kEventClassMouse;
globalEventType[1].eventKind = kEventMouseDragged;
EventHandlerUPP globalHandlerFunction = NewEventHandlerUPP
(mouseActivated);
OSStatus result = InstallEventHandler(GetEventMonitorTarget(),
globalHandlerFunction, 2, globalEventType, NULL, &trackMouseGlobal);
}
- (void)applicationWillTerminate:(NSNotification *)aNotification
{
RemoveEventHandler(trackMouseGlobal);
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden