# HG changeset patch # User mhessling@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1314960879 0 # Node ID ab73d0269a5bde5d94eec4aab82d88d0dbdc0499 # Parent 7d7535f6bc4ef3cf3c44ce384764b3025b1e86f5 Ensure default keypress event is not processed if handler returns 1 Append nul to dw_mle_export return value diff -r 7d7535f6bc4e -r ab73d0269a5b mac/dw.m --- a/mac/dw.m Fri Sep 02 01:17:31 2011 +0000 +++ b/mac/dw.m Fri Sep 02 10:54:39 2011 +0000 @@ -701,7 +701,16 @@ @end @implementation DWWindow --(void)sendEvent:(NSEvent *)theEvent { if([theEvent type] == NSKeyDown) { _event_handler(self, theEvent, 2); } [super sendEvent:theEvent]; } +-(void)sendEvent:(NSEvent *)theEvent +{ + int rcode = 0; + if([theEvent type] == NSKeyDown) + { + rcode = _event_handler(self, theEvent, 2); + } + if ( rcode == 0 ) + [super sendEvent:theEvent]; +} -(void)keyDown:(NSEvent *)theEvent { } -(void)mouseDragged:(NSEvent *)theEvent { _event_handler(self, theEvent, 5); } -(int)redraw { return redraw; } @@ -4298,6 +4307,7 @@ NSMutableString *ms = [ts mutableString]; const char *tmp = [ms UTF8String]; strncpy(buffer, tmp+startpoint, length); + buffer[length] = '\0'; } /*