changeset 1129:ab73d0269a5b

Ensure default keypress event is not processed if handler returns 1 Append nul to dw_mle_export return value
author mhessling@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 02 Sep 2011 10:54:39 +0000
parents 7d7535f6bc4e
children c3138ffd0de0
files mac/dw.m
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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';
 }
 
 /*