Mercurial > dwindows
comparison mac/dw.m @ 898:bf2ca780f62d
One more try at window key handling... since I can't seem to trap keyDown events in most places that get focus...
Trap it in the sendEvent method.. this will get all keystrokes destined for this window.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Mon, 18 Apr 2011 08:56:33 +0000 |
parents | 8c29ea2d17fc |
children | 3fbba8b1f440 |
comparison
equal
deleted
inserted
replaced
897:2b07bf8ed95b | 898:bf2ca780f62d |
---|---|
574 -(void *)userdata { return userdata; } | 574 -(void *)userdata { return userdata; } |
575 -(void)setUserdata:(void *)input { userdata = input; } | 575 -(void)setUserdata:(void *)input { userdata = input; } |
576 @end | 576 @end |
577 | 577 |
578 @interface DWWindow : NSWindow | 578 @interface DWWindow : NSWindow |
579 -(void)sendEvent:(NSEvent *)theEvent; | |
579 -(void)keyDown:(NSEvent *)theEvent; | 580 -(void)keyDown:(NSEvent *)theEvent; |
580 @end | 581 @end |
581 | 582 |
582 @implementation DWWindow | 583 @implementation DWWindow |
583 -(void)keyDown:(NSEvent *)theEvent { _event_handler(self, theEvent, 2); } | 584 -(void)sendEvent:(NSEvent *)theEvent { if([theEvent type] == NSKeyDown) { _event_handler(self, theEvent, 2); } [super sendEvent:theEvent]; } |
585 -(void)keyDown:(NSEvent *)theEvent { } | |
584 @end | 586 @end |
585 | 587 |
586 /* Subclass for a top-level window */ | 588 /* Subclass for a top-level window */ |
587 @interface DWView : DWBox | 589 @interface DWView : DWBox |
588 #ifdef BUILDING_FOR_SNOW_LEOPARD | 590 #ifdef BUILDING_FOR_SNOW_LEOPARD |