diff --git a/glass/glass-mat-lib-macosx/src/com/sun/mat/ui/GlassTouches.m b/glass/glass-mat-lib-macosx/src/com/sun/mat/ui/GlassTouches.m --- a/glass/glass-mat-lib-macosx/src/com/sun/mat/ui/GlassTouches.m +++ b/glass/glass-mat-lib-macosx/src/com/sun/mat/ui/GlassTouches.m @@ -90,9 +90,10 @@ // This is undesirable, so enable event tap after such a reset. [glassTouches enableTouchInputEventTap]; LOG("TOUCHES: listenTouchEvents: recover after timeout\n"); - return NULL; + return event; } + NSAutoreleasePool *pool = [NSAutoreleasePool new]; NSEvent* theEvent = [NSEvent eventWithCGEvent:event]; if (theEvent) { @@ -101,7 +102,7 @@ [glassTouches sendJavaTouchEvent:theEvent]; } } - + [pool drain]; return event; } @@ -167,13 +168,14 @@ self->eventTap = CGEventTapCreate(kCGHIDEventTap, kCGHeadInsertEventTap, - kCGEventTapOptionDefault, + kCGEventTapOptionListenOnly, CGEventMaskBit(NSEventTypeGesture), listenTouchEvents, nil); LOG("TOUCHES: eventTap=%p\n", self->eventTap); // Create a run loop source. + if (self->eventTap != NULL) { self->runLoopSource = CFMachPortCreateRunLoopSource(kCFAllocatorDefault, self->eventTap, 0); @@ -183,6 +185,7 @@ CFRunLoopAddSource(CFRunLoopGetCurrent(), self->runLoopSource, kCFRunLoopCommonModes); } + } return self; }