Re: recieving mouseMoved: events when inactive
Re: recieving mouseMoved: events when inactive
- Subject: Re: recieving mouseMoved: events when inactive
- From: "Adam Johnson" <email@hidden>
- Date: Mon, 5 Jun 2006 21:51:53 -0400
Thank you. That works great.
On 6/1/06, Ryan Britton <email@hidden> wrote:
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