All pastes #2089821 Raw Edit

Unnamed

public text v1 · immutable
#2089821 ·published 2011-10-13 18:22 UTC
rendered paste body
#include "veapplication.h"

bool VEApplication::macEventFilter(EventHandlerCallRef callRef, EventRef event)
{
    static NSEvent *lastEvent = 0;

    NSEvent *e = reinterpret_cast<NSEvent *>(event);

    if (e == lastEvent)
		return false;
	
	if ([e type] == NSMouseMoved)
    {
		NSEvent *newEvent = [NSEvent 
			mouseEventWithType:[e type]
			location:NSMakePoint([e locationInWindow].x+10, [e locationInWindow].y+10)
			modifierFlags:[e modifierFlags]
			timestamp:[e timestamp]
			windowNumber:[e windowNumber]
			context:[e context]
			eventNumber:[e eventNumber]
			clickCount:[e clickCount]
			pressure:[e pressure]];
	    
		printf("posting moveEvent\n");
		lastEvent = newEvent;
		[NSApp postEvent:newEvent atStart:NO];
		return true;
    }
/* 
	else if ([e type] == NSMouseEntered || [e type] == NSMouseExited)
	{
		NSEvent *newEvent = [NSEvent 
			enterExitEventWithType:[e type]
			location:NSMakePoint([e locationInWindow].x+10, [e locationInWindow].y+10)
			modifierFlags:[e modifierFlags]
			timestamp:[e timestamp]
			windowNumber:[e windowNumber]
			context:[e context]
			eventNumber:[e eventNumber]
			trackingNumber:[e trackingNumber]
			userData:[e userData]];
	    
		printf("posting enterEvent\n");
		lastEvent = newEvent;
		[NSApp postEvent:newEvent atStart:NO];
		return true;
		
	}
 */
    return false;
}