comparison mac/dw.m @ 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
comparison
equal deleted inserted replaced
1128:7d7535f6bc4e 1129:ab73d0269a5b
699 -(int)redraw; 699 -(int)redraw;
700 -(void)setRedraw:(int)val; 700 -(void)setRedraw:(int)val;
701 @end 701 @end
702 702
703 @implementation DWWindow 703 @implementation DWWindow
704 -(void)sendEvent:(NSEvent *)theEvent { if([theEvent type] == NSKeyDown) { _event_handler(self, theEvent, 2); } [super sendEvent:theEvent]; } 704 -(void)sendEvent:(NSEvent *)theEvent
705 {
706 int rcode = 0;
707 if([theEvent type] == NSKeyDown)
708 {
709 rcode = _event_handler(self, theEvent, 2);
710 }
711 if ( rcode == 0 )
712 [super sendEvent:theEvent];
713 }
705 -(void)keyDown:(NSEvent *)theEvent { } 714 -(void)keyDown:(NSEvent *)theEvent { }
706 -(void)mouseDragged:(NSEvent *)theEvent { _event_handler(self, theEvent, 5); } 715 -(void)mouseDragged:(NSEvent *)theEvent { _event_handler(self, theEvent, 5); }
707 -(int)redraw { return redraw; } 716 -(int)redraw { return redraw; }
708 -(void)setRedraw:(int)val { redraw = val; } 717 -(void)setRedraw:(int)val { redraw = val; }
709 @end 718 @end
4296 DWMLE *mle = [sv documentView]; 4305 DWMLE *mle = [sv documentView];
4297 NSTextStorage *ts = [mle textStorage]; 4306 NSTextStorage *ts = [mle textStorage];
4298 NSMutableString *ms = [ts mutableString]; 4307 NSMutableString *ms = [ts mutableString];
4299 const char *tmp = [ms UTF8String]; 4308 const char *tmp = [ms UTF8String];
4300 strncpy(buffer, tmp+startpoint, length); 4309 strncpy(buffer, tmp+startpoint, length);
4310 buffer[length] = '\0';
4301 } 4311 }
4302 4312
4303 /* 4313 /*
4304 * Obtains information about an MLE box. 4314 * Obtains information about an MLE box.
4305 * Parameters: 4315 * Parameters: